diff options
Diffstat (limited to 'include/linux')
178 files changed, 12733 insertions, 2277 deletions
diff --git a/include/linux/atalk.h b/include/linux/atalk.h index 9035ddbd8..2e4de841c 100644 --- a/include/linux/atalk.h +++ b/include/linux/atalk.h @@ -72,11 +72,15 @@ struct atalk_sock #ifdef __KERNEL__ +#include <asm/byteorder.h> + struct ddpehdr { - /* FIXME for bigendians */ - /*__u16 deh_pad:2,deh_hops:4,deh_len:10;*/ - __u16 deh_len:10,deh_hops:4,deh_pad:2; +#ifdef __LITTLE_ENDIAN_BITFIELD + __u16 deh_len:10, deh_hops:4, deh_pad:2; +#else + __u16 deh_pad:2, deh_hops:4, deh_len:10; +#endif __u16 deh_sum; __u16 deh_dnet; __u16 deh_snet; @@ -88,13 +92,16 @@ struct ddpehdr }; /* - * Unused (and currently unsupported) + * Short form header */ struct ddpshdr { - /* FIXME for bigendians */ +#ifdef __LITTLE_ENDIAN_BITFIELD __u16 dsh_len:10, dsh_pad:6; +#else + __u16 dsh_pad:6, dsh_len:10; +#endif __u8 dsh_dport; __u8 dsh_sport; /* And netatalk apps expect to stick the type in themselves */ @@ -125,8 +132,6 @@ struct elapaarp __u8 pa_dst_node __attribute__ ((packed)); }; -typedef struct sock atalk_socket; - #define AARP_EXPIRY_TIME (5*60*HZ) /* Not specified - how long till we drop a resolved entry */ #define AARP_HASH_SIZE 16 /* Size of hash table */ #define AARP_TICK_TIME (HZ/5) /* Fast retransmission timer when resolving */ @@ -136,7 +141,16 @@ typedef struct sock atalk_socket; extern struct datalink_proto *ddp_dl, *aarp_dl; extern void aarp_proto_init(void); /* Inter module exports */ -extern struct atalk_iface *atalk_find_dev(struct device *dev); + +/* + * Give a device find its atif control structure + */ + +extern __inline__ struct atalk_iface *atalk_find_dev(struct device *dev) +{ + return dev->atalk_ptr; +} + extern struct at_addr *atalk_find_dev_addr(struct device *dev); extern int aarp_send_ddp(struct device *dev,struct sk_buff *skb, struct at_addr *sa, void *hwaddr); extern void aarp_send_probe(struct device *dev, struct at_addr *addr); diff --git a/include/linux/auto_fs.h b/include/linux/auto_fs.h new file mode 100644 index 000000000..d32a6a253 --- /dev/null +++ b/include/linux/auto_fs.h @@ -0,0 +1,177 @@ +/* -*- linux-c -*- --------------------------------------------------------- * + * + * linux/include/linux/auto_fs.h + * + * Copyright 1997 Transmeta Corporation -- All Rights Reserved + * + * This file is part of the Linux kernel and is made available under + * the terms of the GNU General Public License, version 2, or at your + * option, any later version, incorporated herein by reference. + * + * ------------------------------------------------------------------------- */ + + +#ifndef _LINUX_AUTO_FS_H +#define _LINUX_AUTO_FS_H + +#include <linux/version.h> +#include <linux/fs.h> +#include <linux/limits.h> +#include <linux/ioctl.h> +#include <asm/types.h> + +#define AUTOFS_PROTO_VERSION 2 + +enum autofs_packet_type { + autofs_ptype_missing, /* Missing entry (create wait queue) */ + /* ...need more in the future... */ +}; + +struct autofs_packet_hdr { + int proto_version; /* Protocol version */ + enum autofs_packet_type type; /* Type of packet */ +}; + +struct autofs_packet_missing { + struct autofs_packet_hdr hdr; + unsigned long wait_queue_token; + int len; + char name[NAME_MAX+1]; +}; + +#define AUTOFS_IOC_READY _IO(0x93,0x60) +#define AUTOFS_IOC_FAIL _IO(0x93,0x61) +#define AUTOFS_IOC_CATATONIC _IO(0x93,0x62) + +#ifdef __KERNEL__ + +#include <linux/wait.h> +#include <linux/sched.h> + +#if LINUX_VERSION_CODE < 0x20100 + +#include <asm/segment.h> +#define copy_to_user memcpy_tofs +#define copy_from_user memcpy_fromfs + +#else + +#include <asm/uaccess.h> +#define register_symtab(x) do { } while (0) + +#endif + +#ifndef DPRINTK +#ifdef DEBUG +#define DPRINTK(D) printk D; +#else +#define DPRINTK(D) +#endif +#endif + +#define AUTOFS_SUPER_MAGIC 0x0187 + +/* Structures associated with the root directory hash */ + +#define AUTOFS_HASH_SIZE 67 + +typedef u32 autofs_hash_t; /* Type returned by autofs_hash() */ + +struct autofs_dir_ent { + autofs_hash_t hash; + struct autofs_dir_ent *next; + struct autofs_dir_ent **back; + char *name; + int len; + ino_t ino; + time_t expiry; /* Reserved for use in failed-lookup cache */ +}; + +struct autofs_dirhash { + struct autofs_dir_ent *h[AUTOFS_HASH_SIZE]; +}; + +struct autofs_wait_queue { + unsigned long wait_queue_token; + struct wait_queue *queue; + struct autofs_wait_queue *next; + /* We use the following to see what we are waiting for */ + autofs_hash_t hash; + int len; + char *name; + /* This is for status reporting upon return */ + int status; + int wait_ctr; +}; + +struct autofs_symlink { + int len; + char *data; + time_t mtime; +}; + +#define AUTOFS_MAX_SYMLINKS 256 + +#define AUTOFS_ROOT_INO 1 +#define AUTOFS_FIRST_SYMLINK 2 +#define AUTOFS_FIRST_DIR_INO (AUTOFS_FIRST_SYMLINK+AUTOFS_MAX_SYMLINKS) + +#define AUTOFS_SYMLINK_BITMAP_LEN ((AUTOFS_MAX_SYMLINKS+31)/32) + +#ifndef END_OF_TIME +#define END_OF_TIME ((time_t)((unsigned long)((time_t)(~0UL)) >> 1)) +#endif + +struct autofs_sb_info { + struct file *pipe; + pid_t oz_pgrp; + int catatonic; + ino_t next_dir_ino; + struct autofs_wait_queue *queues; /* Wait queue pointer */ + struct autofs_dirhash dirhash; /* Root directory hash */ + struct autofs_symlink symlink[AUTOFS_MAX_SYMLINKS]; + u32 symlink_bitmap[AUTOFS_SYMLINK_BITMAP_LEN]; +}; + +/* autofs_oz_mode(): do we see the man behind the curtain? */ +static inline int autofs_oz_mode(struct autofs_sb_info *sbi) { + return sbi->catatonic || current->pgrp == sbi->oz_pgrp; +} + +/* Init function */ +int init_autofs_fs(void); + +/* Hash operations */ + +autofs_hash_t autofs_hash(const char *,int); +void autofs_initialize_hash(struct autofs_dirhash *); +struct autofs_dir_ent *autofs_hash_lookup(const struct autofs_dirhash *,autofs_hash_t,const char *,int); +void autofs_hash_insert(struct autofs_dirhash *,struct autofs_dir_ent *); +void autofs_hash_delete(struct autofs_dir_ent *); +struct autofs_dir_ent *autofs_hash_enum(const struct autofs_dirhash *,off_t *); +void autofs_hash_nuke(struct autofs_dirhash *); + +/* Operations structures */ + +extern struct inode_operations autofs_root_inode_operations; +extern struct inode_operations autofs_symlink_inode_operations; +extern struct inode_operations autofs_dir_inode_operations; + +/* Initializing function */ + +struct super_block *autofs_read_super(struct super_block *, void *,int); + +/* Queue management functions */ + +int autofs_wait(struct autofs_sb_info *,autofs_hash_t,const char *,int); +int autofs_wait_release(struct autofs_sb_info *,unsigned long,int); +void autofs_catatonic_mode(struct autofs_sb_info *); + +#ifdef DEBUG +void autofs_say(const char *name, int len); +#else +#define autofs_say(n,l) +#endif + +#endif /* __KERNEL__ */ +#endif /* _LINUX_AUTO_FS_H */ diff --git a/include/linux/awe_voice.h b/include/linux/awe_voice.h new file mode 100644 index 000000000..cdfb0ff2e --- /dev/null +++ b/include/linux/awe_voice.h @@ -0,0 +1,338 @@ +/* + * sound/awe_voice.h + * + * Voice information definitions for the low level driver for the + * AWE32/Sound Blaster 32 wave table synth. + * version 0.3.1b; Jan. 21, 1997 + * + * Copyright (C) 1996,1997 Takashi Iwai + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef AWE_VOICE_H +#define AWE_VOICE_H + +#ifndef SAMPLE_TYPE_AWE32 +#define SAMPLE_TYPE_AWE32 0x20 +#endif + +#ifndef _PATCHKEY +#define _PATCHKEY(id) ((id<<8)|0xfd) +#endif + +/*---------------------------------------------------------------- + * patch information record + *----------------------------------------------------------------*/ + +/* patch interface header: 16 bytes */ +typedef struct awe_patch_info { + short key; /* use AWE_PATCH here */ +#define AWE_PATCH _PATCHKEY(0x07) + + short device_no; /* synthesizer number */ + unsigned short sf_id; /* file id (should be zero) */ + short sf_version; /* patch version (not referred) */ + long len; /* data length (without this header) */ + + short type; /* following data type */ +#define AWE_LOAD_INFO 0 +#define AWE_LOAD_DATA 1 +#define AWE_APPEND_DATA 0x00 +#define AWE_REPLACE_DATA 0x80 + + short reserved; /* word alignment data */ + + /* the actual patch data begins after this */ +#if defined(AWE_COMPAT_030) && AWE_COMPAT_030 + char data[0]; +#endif +} awe_patch_info; + +#define AWE_PATCH_INFO_SIZE 16 + + +/*---------------------------------------------------------------- + * raw voice information record + *----------------------------------------------------------------*/ + +/* wave table envelope & effect parameters to control EMU8000 */ +typedef struct _awe_voice_parm { + unsigned short moddelay; /* modulation delay (0x8000) */ + unsigned short modatkhld; /* modulation attack & hold time (0x7f7f) */ + unsigned short moddcysus; /* modulation decay & sustain (0x7f7f) */ + unsigned short modrelease; /* modulation release time (0x807f) */ + short modkeyhold, modkeydecay; /* envelope change per key (not used) */ + unsigned short voldelay; /* volume delay (0x8000) */ + unsigned short volatkhld; /* volume attack & hold time (0x7f7f) */ + unsigned short voldcysus; /* volume decay & sustain (0x7f7f) */ + unsigned short volrelease; /* volume release time (0x807f) */ + short volkeyhold, volkeydecay; /* envelope change per key (not used) */ + unsigned short lfo1delay; /* LFO1 delay (0x8000) */ + unsigned short lfo2delay; /* LFO2 delay (0x8000) */ + unsigned short pefe; /* modulation pitch & cutoff (0x0000) */ + unsigned short fmmod; /* LFO1 pitch & cutoff (0x0000) */ + unsigned short tremfrq; /* LFO1 volume & freq (0x0000) */ + unsigned short fm2frq2; /* LFO2 pitch & freq (0x0000) */ + unsigned char cutoff; /* initial cutoff (0xff) */ + unsigned char filterQ; /* initial filter Q [0-15] (0x0) */ + unsigned char chorus; /* chorus send (0x00) */ + unsigned char reverb; /* reverb send (0x00) */ + unsigned short reserved[4]; /* not used */ +} awe_voice_parm; + +#define AWE_VOICE_PARM_SIZE 48 + + +/* wave table parameters: 92 bytes */ +typedef struct _awe_voice_info { + unsigned short sf_id; /* file id (should be zero) */ + unsigned short sample; /* sample id */ + long start, end; /* sample offset correction */ + long loopstart, loopend; /* loop offset correction */ + short rate_offset; /* sample rate pitch offset */ + unsigned short mode; /* sample mode */ +#define AWE_MODE_ROMSOUND 0x8000 +#define AWE_MODE_STEREO 1 +#define AWE_MODE_LOOPING 2 +#define AWE_MODE_NORELEASE 4 /* obsolete */ +#define AWE_MODE_INIT_PARM 8 + + short root; /* midi root key */ + short tune; /* pitch tuning (in cents) */ + char low, high; /* key note range */ + char vellow, velhigh; /* velocity range */ + char fixkey, fixvel; /* fixed key, velocity */ + char pan, fixpan; /* panning, fixed panning */ + short exclusiveClass; /* exclusive class (0 = none) */ + unsigned char amplitude; /* sample volume (127 max) */ + unsigned char attenuation; /* attenuation (0.375dB) */ + short scaleTuning; /* pitch scale tuning(%), normally 100 */ + awe_voice_parm parm; /* voice envelope parameters */ + short index; /* internal index (set by driver) */ +} awe_voice_info; + +#define AWE_VOICE_INFO_SIZE 92 + +/*----------------------------------------------------------------*/ + +/* The info entry of awe_voice_rec is changed from 0 to 1 + * for some compilers refusing zero size array. + * Due to this change, sizeof(awe_voice_rec) becomes different + * from older versions. + * Use AWE_VOICE_REC_SIZE instead. + */ +#if defined(AWE_COMPAT_030) && AWE_COMPAT_030 +#define AWE_INFOARRAY_SIZE 0 +#else +#define AWE_INFOARRAY_SIZE 1 +#endif + +/* instrument info header: 4 bytes */ +typedef struct _awe_voice_rec { + unsigned char bank; /* midi bank number */ + unsigned char instr; /* midi preset number */ + short nvoices; /* number of voices */ + + /* voice information follows here */ + awe_voice_info info[AWE_INFOARRAY_SIZE]; +} awe_voice_rec; + +#define AWE_VOICE_REC_SIZE 4 + + +/*---------------------------------------------------------------- + * sample wave information + *----------------------------------------------------------------*/ + +/* wave table sample header: 32 bytes */ +typedef struct awe_sample_info { + unsigned short sf_id; /* file id (should be zero) */ + unsigned short sample; /* sample id */ + long start, end; /* start & end offset */ + long loopstart, loopend; /* loop start & end offset */ + long size; /* size (0 = ROM) */ + short checksum_flag; /* use check sum = 1 */ + unsigned short mode_flags; /* mode flags */ +#define AWE_SAMPLE_8BITS 1 /* wave data is 8bits */ +#define AWE_SAMPLE_UNSIGNED 2 /* wave data is unsigned */ +#define AWE_SAMPLE_NO_BLANK 4 /* no blank loop is attached */ +#define AWE_SAMPLE_SINGLESHOT 8 /* single-shot w/o loop */ +#define AWE_SAMPLE_BIDIR_LOOP 16 /* bidirectional looping */ +#define AWE_SAMPLE_STEREO_LEFT 32 /* stereo left sound */ +#define AWE_SAMPLE_STEREO_RIGHT 64 /* stereo right sound */ +#define AWE_SAMPLE_REVERSE_LOOP 128 /* reverse looping */ + unsigned long checksum; /* check sum */ +#if defined(AWE_COMPAT_030) && AWE_COMPAT_030 + unsigned short data[0]; /* sample data follows here */ +#endif +} awe_sample_info; + +#define AWE_SAMPLE_INFO_SIZE 32 + + +/*---------------------------------------------------------------- + * awe hardware controls + *----------------------------------------------------------------*/ + +typedef struct _awe_mode_rec { + int base_addr; + long mem_size; /* word size */ + int max_voices, max_infos, max_samples; + unsigned short current_sf_id; + long free_mem; /* word offset */ + int free_info; + int free_sample; + short reverb_mode; + short chorus_mode; + unsigned short init_atten; + short channel_mode; + short gus_bank; + short exclusive_sound; + unsigned long drum_flags; + int debug_mode; +} awe_mode_rec; + +#define _AWE_DEBUG_MODE 0x00 +#define _AWE_REVERB_MODE 0x01 +#define _AWE_CHORUS_MODE 0x02 +#define _AWE_REMOVE_LAST_SAMPLES 0x03 +#define _AWE_INITIALIZE_CHIP 0x04 +#define _AWE_SEND_EFFECT 0x05 +#define _AWE_TERMINATE_CHANNEL 0x06 +#define _AWE_TERMINATE_ALL 0x07 +#define _AWE_INITIAL_VOLUME 0x08 +#define _AWE_SET_GUS_BANK 0x09 +#define _AWE_CHANNEL_MODE 0x0a /* v0.3 features */ +#define _AWE_DRUM_CHANNELS 0x0b /* v0.3 features */ +#define _AWE_EXCLUSIVE_SOUND 0x0c /* v0.3 features */ +#define _AWE_INITIAL_ATTEN _AWE_INITIAL_VOLUME +#define _AWE_NOTEOFF_ALL 0x0e +#define _AWE_GET_CURRENT_MODE 0x10 /* v0.3 features */ + +#define _AWE_MODE_FLAG 0x80 +#define _AWE_COOKED_FLAG 0x40 /* not supported */ +#define _AWE_MODE_VALUE_MASK 0x3F + +#define _AWE_CMD(chn, voice, cmd, p1, p2) \ +{_SEQ_NEEDBUF(8); _seqbuf[_seqbufptr] = SEQ_PRIVATE;\ + _seqbuf[_seqbufptr+1] = chn;\ + _seqbuf[_seqbufptr+2] = _AWE_MODE_FLAG|(cmd);\ + _seqbuf[_seqbufptr+3] = voice;\ + *(unsigned short*)&_seqbuf[_seqbufptr+4] = p1;\ + *(unsigned short*)&_seqbuf[_seqbufptr+6] = p2;\ + _SEQ_ADVBUF(8);} + +#define AWE_DEBUG_MODE(dev,p1) _AWE_CMD(dev, 0, _AWE_DEBUG_MODE, p1, 0) +#define AWE_REVERB_MODE(dev,p1) _AWE_CMD(dev, 0, _AWE_REVERB_MODE, p1, 0) +#define AWE_CHORUS_MODE(dev,p1) _AWE_CMD(dev, 0, _AWE_CHORUS_MODE, p1, 0) +#define AWE_REMOVE_LAST_SAMPLES(dev) _AWE_CMD(dev, 0, _AWE_REMOVE_LAST_SAMPLES, 0, 0) +#define AWE_INITIALIZE_CHIP(dev) _AWE_CMD(dev, 0, _AWE_INITIALIZE_CHIP, 0, 0) +#define AWE_SEND_EFFECT(dev,voice,type,value) _AWE_CMD(dev,voice,_AWE_SEND_EFFECT,type,value) +#define AWE_TERMINATE_CHANNEL(dev,voice) _AWE_CMD(dev,voice,_AWE_TERMINATE_CHANNEL,0,0) +#define AWE_TERMINATE_ALL(dev) _AWE_CMD(dev, 0, _AWE_TERMINATE_ALL, 0, 0) +#define AWE_NOTEOFF_ALL(dev) _AWE_CMD(dev, 0, _AWE_NOTEOFF_ALL, 0, 0) +#define AWE_INITIAL_VOLUME(dev,atten) _AWE_CMD(dev, 0, _AWE_INITIAL_VOLUME, atten, 0) +#define AWE_INITIAL_ATTEN AWE_INITIAL_VOLUME +#define AWE_SET_GUS_BANK(dev,bank) _AWE_CMD(dev, 0, _AWE_SET_GUS_BANK, bank, 0) +#define AWE_SET_CHANNEL_MODE(dev,mode) _AWE_CMD(dev, 0, _AWE_CHANNEL_MODE, mode, 0) +#define AWE_DRUM_CHANNELS(dev,channels) _AWE_CMD(dev, 0, _AWE_DRUM_CHANNELS, channels, 0) +#define AWE_EXCLUSIVE_SOUND(dev,mode) _AWE_CMD(dev, 0, _AWE_EXCLUSIVE_SOUND, mode, 0) + +/* it must be direct access */ +#define AWE_GET_CURRENT_MODE(dev,addr) \ +{char tmpbuf[8];\ + tmpbuf[0] = SEQ_PRIVATE; tmpbuf[1] = dev;\ + tmpbuf[2] = _AWE_MODE_FLAG|_AWE_GET_CURRENT_MODE;\ + tmpbuf[3] = 0; *(awe_mode_rec**)(tmpbuf +4) = (awe_mode_rec*)(addr);\ + write(seqfd, tmpbuf, 8);} + +/* extended pressure controls; not portable with other sound drivers */ +#define AWE_KEY_PRESSURE(dev,ch,note,vel) SEQ_START_NOTE(dev,ch,(note)+128,vel) +#define AWE_CHN_PRESSURE(dev,ch,vel) SEQ_START_NOTE(dev,(ch)+128,0,vel) + +/* reverb mode */ +#define AWE_REVERB_ROOM1 0 +#define AWE_REVERB_ROOM2 1 +#define AWE_REVERB_ROOM3 2 +#define AWE_REVERB_HALL1 3 +#define AWE_REVERB_HALL2 4 +#define AWE_REVERB_PLATE 5 +#define AWE_REVERB_DELAY 6 +#define AWE_REVERB_PANNINGDELAY 7 + +/* chorus mode */ +#define AWE_CHORUS_1 0 +#define AWE_CHORUS_2 1 +#define AWE_CHORUS_3 2 +#define AWE_CHORUS_4 3 +#define AWE_CHORUS_FEEDBACK 4 +#define AWE_CHORUS_FLANGER 5 +#define AWE_CHORUS_SHORTDELAY 6 +#define AWE_CHORUS_SHORTDELAY2 7 + +/* effects */ +enum { + +/* modulation envelope parameters */ +/* 0*/ AWE_FX_ENV1_DELAY, /* WORD: ENVVAL */ +/* 1*/ AWE_FX_ENV1_ATTACK, /* BYTE: up ATKHLD */ +/* 2*/ AWE_FX_ENV1_HOLD, /* BYTE: lw ATKHLD */ +/* 3*/ AWE_FX_ENV1_DECAY, /* BYTE: lw DCYSUS */ +/* 4*/ AWE_FX_ENV1_RELEASE, /* BYTE: lw DCYSUS */ +/* 5*/ AWE_FX_ENV1_SUSTAIN, /* BYTE: up DCYSUS */ +/* 6*/ AWE_FX_ENV1_PITCH, /* BYTE: up PEFE */ +/* 7*/ AWE_FX_ENV1_CUTOFF, /* BYTE: lw PEFE */ + +/* volume envelope parameters */ +/* 8*/ AWE_FX_ENV2_DELAY, /* WORD: ENVVOL */ +/* 9*/ AWE_FX_ENV2_ATTACK, /* BYTE: up ATKHLDV */ +/*10*/ AWE_FX_ENV2_HOLD, /* BYTE: lw ATKHLDV */ +/*11*/ AWE_FX_ENV2_DECAY, /* BYTE: lw DCYSUSV */ +/*12*/ AWE_FX_ENV2_RELEASE, /* BYTE: lw DCYSUSV */ +/*13*/ AWE_FX_ENV2_SUSTAIN, /* BYTE: up DCYSUSV */ + +/* LFO1 (tremolo & vibrato) parameters */ +/*14*/ AWE_FX_LFO1_DELAY, /* WORD: LFO1VAL */ +/*15*/ AWE_FX_LFO1_FREQ, /* BYTE: lo TREMFRQ */ +/*16*/ AWE_FX_LFO1_VOLUME, /* BYTE: up TREMFRQ */ +/*17*/ AWE_FX_LFO1_PITCH, /* BYTE: up FMMOD */ +/*18*/ AWE_FX_LFO1_CUTOFF, /* BYTE: lo FMMOD */ + +/* LFO2 (vibrato) parameters */ +/*19*/ AWE_FX_LFO2_DELAY, /* WORD: LFO2VAL */ +/*20*/ AWE_FX_LFO2_FREQ, /* BYTE: lo FM2FRQ2 */ +/*21*/ AWE_FX_LFO2_PITCH, /* BYTE: up FM2FRQ2 */ + +/* Other overall effect parameters */ +/*22*/ AWE_FX_INIT_PITCH, /* SHORT: pitch offset */ +/*23*/ AWE_FX_CHORUS, /* BYTE: chorus effects send (0-255) */ +/*24*/ AWE_FX_REVERB, /* BYTE: reverb effects send (0-255) */ +/*25*/ AWE_FX_CUTOFF, /* BYTE: up IFATN */ +/*26*/ AWE_FX_FILTERQ, /* BYTE: up CCCA */ + +/* Sample / loop offset changes */ +/*27*/ AWE_FX_SAMPLE_START, /* SHORT: offset */ +/*28*/ AWE_FX_LOOP_START, /* SHORT: offset */ +/*29*/ AWE_FX_LOOP_END, /* SHORT: offset */ +/*30*/ AWE_FX_COARSE_SAMPLE_START, /* SHORT: upper word offset */ +/*31*/ AWE_FX_COARSE_LOOP_START, /* SHORT: upper word offset */ +/*32*/ AWE_FX_COARSE_LOOP_END, /* SHORT: upper word offset */ + + AWE_FX_END, +}; + + +#endif /* AWE_VOICE_H */ diff --git a/include/linux/ax25.h b/include/linux/ax25.h index 7cf2c6410..9e16d3e0f 100644 --- a/include/linux/ax25.h +++ b/include/linux/ax25.h @@ -2,11 +2,10 @@ * These are the public elements of the Linux kernel AX.25 code. A similar * file netrom.h exists for the NET/ROM protocol. */ - + #ifndef AX25_KERNEL_H #define AX25_KERNEL_H - -#define PF_AX25 AF_AX25 + #define AX25_MTU 256 #define AX25_MAX_DIGIS 6 /* This is wrong, should be 8 */ @@ -20,7 +19,7 @@ #define AX25_HDRINCL 8 #define AX25_IDLE 9 #define AX25_PACLEN 10 -#define AX25_MAXQUEUE 11 +#define AX25_IAMDIGI 12 #define AX25_KILL 99 @@ -28,8 +27,11 @@ #define SIOCAX25ADDUID (SIOCPROTOPRIVATE+1) #define SIOCAX25DELUID (SIOCPROTOPRIVATE+2) #define SIOCAX25NOUID (SIOCPROTOPRIVATE+3) -#define SIOCAX25OPTRT (SIOCPROTOPRIVATE+4) -#define SIOCAX25CTLCON (SIOCPROTOPRIVATE+5) +#define SIOCAX25OPTRT (SIOCPROTOPRIVATE+7) +#define SIOCAX25CTLCON (SIOCPROTOPRIVATE+8) +#define SIOCAX25GETINFO (SIOCPROTOPRIVATE+9) +#define SIOCAX25ADDFWD (SIOCPROTOPRIVATE+10) +#define SIOCAX25DELFWD (SIOCPROTOPRIVATE+11) #define AX25_SET_RT_IPMODE 2 @@ -37,13 +39,13 @@ #define AX25_NOUID_BLOCK 1 typedef struct { - char ax25_call[7]; /* 6 call + SSID (shifted ascii!) */ + char ax25_call[7]; /* 6 call + SSID (shifted ascii!) */ } ax25_address; struct sockaddr_ax25 { - sa_family_t sax25_family; - ax25_address sax25_call; - int sax25_ndigis; + sa_family_t sax25_family; + ax25_address sax25_call; + int sax25_ndigis; /* Digipeater ax25_address sets follow */ }; @@ -51,29 +53,44 @@ struct sockaddr_ax25 { struct full_sockaddr_ax25 { struct sockaddr_ax25 fsa_ax25; - ax25_address fsa_digipeater[AX25_MAX_DIGIS]; + ax25_address fsa_digipeater[AX25_MAX_DIGIS]; }; struct ax25_routes_struct { - ax25_address port_addr; - ax25_address dest_addr; - unsigned char digi_count; - ax25_address digi_addr[AX25_MAX_DIGIS]; + ax25_address port_addr; + ax25_address dest_addr; + unsigned char digi_count; + ax25_address digi_addr[AX25_MAX_DIGIS]; }; struct ax25_route_opt_struct { - ax25_address port_addr; - ax25_address dest_addr; - int cmd; - int arg; + ax25_address port_addr; + ax25_address dest_addr; + int cmd; + int arg; }; struct ax25_ctl_struct { - ax25_address port_addr; - ax25_address source_addr; - ax25_address dest_addr; - unsigned int cmd; - unsigned long arg; + ax25_address port_addr; + ax25_address source_addr; + ax25_address dest_addr; + unsigned int cmd; + unsigned long arg; +}; + +struct ax25_info_struct { + unsigned int n2, n2count; + unsigned int t1, t1timer; + unsigned int t2, t2timer; + unsigned int t3, t3timer; + unsigned int idle, idletimer; + unsigned int state; + unsigned int rcv_q, snd_q; +}; + +struct ax25_fwd_struct { + ax25_address port_from; + ax25_address port_to; }; #endif diff --git a/include/linux/baycom.h b/include/linux/baycom.h index b4108d1df..20d927f50 100644 --- a/include/linux/baycom.h +++ b/include/linux/baycom.h @@ -21,15 +21,9 @@ struct baycom_debug_data { long debug3; }; -struct baycom_modem_type { - unsigned char modem_type; - unsigned int options; -}; - struct baycom_ioctl { int cmd; union { - struct baycom_modem_type mt; struct baycom_debug_data dbg; } data; }; @@ -37,22 +31,8 @@ struct baycom_ioctl { /* -------------------------------------------------------------------- */ /* - * modem types - */ -#define BAYCOM_MODEM_INVALID 0 -#define BAYCOM_MODEM_SER12 1 -#define BAYCOM_MODEM_PAR96 2 - -/* - * modem options; bit mask - */ -#define BAYCOM_OPTIONS_SOFTDCD 1 - -/* - * ioctl values change for baycom_net + * ioctl values change for baycom */ -#define BAYCOMCTL_GETMODEMTYPE 0x90 -#define BAYCOMCTL_SETMODEMTYPE 0x91 #define BAYCOMCTL_GETDEBUG 0x92 /* -------------------------------------------------------------------- */ diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h index 6cb59427c..a96e034ce 100644 --- a/include/linux/binfmts.h +++ b/include/linux/binfmts.h @@ -33,7 +33,7 @@ struct linux_binprm{ */ struct linux_binfmt { struct linux_binfmt * next; - long *use_count; + struct module *module; int (*load_binary)(struct linux_binprm *, struct pt_regs * regs); int (*load_shlib)(int fd); int (*core_dump)(long signr, struct pt_regs * regs); @@ -48,10 +48,12 @@ extern int read_exec(struct inode *inode, unsigned long offset, extern int open_inode(struct inode * inode, int mode); extern int init_elf_binfmt(void); +extern int init_elf32_binfmt(void); extern int init_irix_binfmt(void); extern int init_aout_binfmt(void); extern int init_script_binfmt(void); extern int init_java_binfmt(void); +extern int init_em86_binfmt(void); extern int prepare_binprm(struct linux_binprm *); extern void remove_arg_zero(struct linux_binprm *); diff --git a/include/linux/bios32.h b/include/linux/bios32.h index d3632092a..7944a53fe 100644 --- a/include/linux/bios32.h +++ b/include/linux/bios32.h @@ -54,8 +54,8 @@ extern int pcibios_write_config_byte (unsigned char bus, unsigned char dev_fn, unsigned char where, unsigned char val); extern int pcibios_write_config_word (unsigned char bus, unsigned char dev_fn, unsigned char where, unsigned short val); -extern pcibios_write_config_dword (unsigned char bus, unsigned char dev_fn, - unsigned char where, unsigned int val); +extern int pcibios_write_config_dword (unsigned char bus, unsigned char dev_fn, + unsigned char where, unsigned int val); extern const char *pcibios_strerror (int error); #endif /* BIOS32_H */ diff --git a/include/linux/blk.h b/include/linux/blk.h index cd8eb09b3..412f0c1c3 100644 --- a/include/linux/blk.h +++ b/include/linux/blk.h @@ -40,6 +40,9 @@ #ifdef CONFIG_CDU31A extern int cdu31a_init(void); #endif CONFIG_CDU31A +#ifdef CONFIG_ATARI_ACSI +extern int acsi_init(void); +#endif CONFIG_ATARI_ACSI #ifdef CONFIG_MCD extern int mcd_init(void); #endif CONFIG_MCD @@ -85,6 +88,15 @@ extern int loop_init(void); #ifdef CONFIG_BLK_DEV_MD extern int md_init(void); #endif CONFIG_BLK_DEV_MD +#ifdef CONFIG_APBLOCK +extern int ap_init(void); +#endif +#ifdef CONFIG_DDV +extern int ddv_init(void); +#endif +#ifdef CONFIG_AMIGA_Z2RAM +extern int z2_init(void); +#endif extern void set_device_ro(kdev_t dev,int flag); void add_blkdev_randomness(int major); @@ -102,9 +114,13 @@ extern int rd_image_start; /* starting block # of image */ extern unsigned long initrd_start,initrd_end; extern int mount_initrd; /* zero if initrd should not be mounted */ +extern int initrd_below_start_ok; /* 1 if it is not an error if initrd_start < memory_start */ void initrd_init(void); #endif +#ifdef CONFIG_BLK_DEV_PS2 +extern int ps2esdi_init(void); +#endif #define RO_IOCTLS(dev,where) \ case BLKROSET: { int __val; if (!suser()) return -EACCES; \ @@ -135,6 +151,15 @@ void initrd_init(void); #define DEVICE_OFF(device) #define DEVICE_NO_RANDOM +#elif (MAJOR_NR == Z2RAM_MAJOR) + +/* Zorro II Ram */ +#define DEVICE_NAME "Z2RAM" +#define DEVICE_REQUEST do_z2_request +#define DEVICE_NR(device) (MINOR(device)) +#define DEVICE_ON(device) +#define DEVICE_OFF(device) + #elif (MAJOR_NR == FLOPPY_MAJOR) static void floppy_off(unsigned int nr); @@ -202,6 +227,14 @@ static void floppy_off(unsigned int nr); #define DEVICE_ON(device) #define DEVICE_OFF(device) +#elif (MAJOR_NR == PS2ESDI_MAJOR) + +#define DEVICE_NAME "PS/2 ESDI" +#define DEVICE_REQUEST do_ps2esdi_request +#define DEVICE_NR(device) (MINOR(device) >> 6) +#define DEVICE_ON(device) +#define DEVICE_OFF(device) + #elif (MAJOR_NR == CDU31A_CDROM_MAJOR) #define DEVICE_NAME "CDU31A" @@ -210,6 +243,15 @@ static void floppy_off(unsigned int nr); #define DEVICE_ON(device) #define DEVICE_OFF(device) +#elif (MAJOR_NR == ACSI_MAJOR) && (defined(CONFIG_ATARI_ACSI) || defined(CONFIG_ATARI_ACSI_MODULE)) + +#define DEVICE_NAME "ACSI" +#define DEVICE_INTR do_acsi +#define DEVICE_REQUEST do_acsi_request +#define DEVICE_NR(device) (MINOR(device) >> 4) +#define DEVICE_ON(device) +#define DEVICE_OFF(device) + #elif (MAJOR_NR == MITSUMI_CDROM_MAJOR) #define DEVICE_NAME "Mitsumi CD-ROM" @@ -308,6 +350,22 @@ static void floppy_off(unsigned int nr); #define DEVICE_ON(device) #define DEVICE_OFF(device) +#elif (MAJOR_NR == APBLOCK_MAJOR) + +#define DEVICE_NAME "apblock" +#define DEVICE_REQUEST ap_request +#define DEVICE_NR(device) (MINOR(device)) +#define DEVICE_ON(device) +#define DEVICE_OFF(device) + +#elif (MAJOR_NR == DDV_MAJOR) + +#define DEVICE_NAME "ddv" +#define DEVICE_REQUEST ddv_request +#define DEVICE_NR(device) (MINOR(device)>>PARTN_BITS) +#define DEVICE_ON(device) +#define DEVICE_OFF(device) + #endif /* MAJOR_NR == whatever */ #if (MAJOR_NR != SCSI_TAPE_MAJOR) @@ -382,15 +440,19 @@ static void end_request(int uptodate) { struct request *req = CURRENT; #endif /* IDE_DRIVER */ struct buffer_head * bh; + int nsect; req->errors = 0; if (!uptodate) { printk("end_request: I/O error, dev %s, sector %lu\n", kdevname(req->rq_dev), req->sector); - req->nr_sectors--; - req->nr_sectors &= ~SECTOR_MASK; - req->sector += (BLOCK_SIZE / 512); - req->sector &= ~SECTOR_MASK; + if ((bh = req->bh) != NULL) { + nsect = bh->b_size >> 9; + req->nr_sectors--; + req->nr_sectors &= ~(nsect - 1); + req->sector += nsect; + req->sector &= ~(nsect - 1); + } } if ((bh = req->bh) != NULL) { @@ -412,7 +474,8 @@ static void end_request(int uptodate) { add_blkdev_randomness(MAJOR(req->rq_dev)); #endif #ifdef IDE_DRIVER - blk_dev[MAJOR(req->rq_dev)].current_request = req->next; + hwgroup->drive->queue = req->next; + blk_dev[MAJOR(req->rq_dev)].current_request = NULL; hwgroup->rq = NULL; #else DEVICE_OFF(req->rq_dev); diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index e0f578f9b..faae32756 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -33,9 +33,14 @@ struct request { struct request * next; }; +typedef void (request_fn_proc) (void); +typedef struct request ** (queue_proc) (kdev_t dev); + struct blk_dev_struct { - void (*request_fn)(void); - struct request * current_request; + request_fn_proc *request_fn; + queue_proc *queue; + void *data; + struct request *current_request; struct request plug; struct tq_struct plug_tq; }; diff --git a/include/linux/cd1400.h b/include/linux/cd1400.h index b6e5b667b..e681f6a01 100644 --- a/include/linux/cd1400.h +++ b/include/linux/cd1400.h @@ -3,6 +3,7 @@ /* * cd1400.h -- cd1400 UART hardware info. * + * Copyright (C) 1996-1997 Stallion Technologies (support@stallion.oz.au). * Copyright (C) 1994-1996 Greg Ungerer (gerg@stallion.oz.au). * * This program is free software; you can redistribute it and/or modify diff --git a/include/linux/cdk.h b/include/linux/cdk.h index a3d016791..6ed83eef9 100644 --- a/include/linux/cdk.h +++ b/include/linux/cdk.h @@ -3,6 +3,7 @@ /* * cdk.h -- CDK interface definitions. * + * Copyright (C) 1996-1997 Stallion Technologies (support@stallion.oz.au). * Copyright (C) 1994-1996 Greg Ungerer (gerg@stallion.oz.au). * * This program is free software; you can redistribute it and/or modify diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h index aba1458c3..1c2ede5e0 100644 --- a/include/linux/cdrom.h +++ b/include/linux/cdrom.h @@ -61,7 +61,36 @@ * * - XA data (green, mode2 form2): | sync - head - sub - data - EDC | * | 12 - 4 - 8 - 2324 - 4 | + * + * Sector types (format) - Forces the CD-ROM to read the specified sector type, + * attempt to read any other format ends with an error + * + * format sector type user data size (bytes) + * ----------------------------------------------------------------------------- + * 1 CD DA (Red Book) 2352 (CD_FRAMESIZE_RAW) + * 2 Mode1 Form1 (Yellow Book) 2048 (CD_FRAMESIZE) + * 3 Mode1 Form2 (Yellow Book) 2336 (CD_FRAMESIZE_RAW0) + * 4 Mode2 Form1 (Green Book) 2048 (CD_FRAMESIZE) + * 5 Mode2 Form2 (Green Book) 2328 (2324+4 spare bytes) + * + * + * Data Selection Field (pc.c[9]) - This value controls the actual number + * of bytes transferred from the CD-ROM + * + * bit 7 6 5 4 3 2 1 0 + * ---------------------------------------------------------------------------- + * | Sync | Sub | Header | User | EDC & | Error | Block | reserved + * | | Header | | Data | ECC | Flags | Error | + * \-------------------------------------------/\---------------/ + * | | + * V V + * stored on CD (2532) generated during error correction + * + * The maximal number of bytes returned by CD-ROM is 2646 (CD_FRAMESIZE_RAWER), + * when pc.c[9] = 0xfa. + * */ + /* * CDROM IOCTL structures @@ -339,7 +368,8 @@ struct ccs_modesel_head u_char number_blocks_lo; u_char _r3; u_char block_length_hi; /* block length for blocks in this desc */ - u_short block_length; + u_char block_length_med; + u_char block_length_lo; }; /* diff --git a/include/linux/comstats.h b/include/linux/comstats.h index 8f7591f38..d56918486 100644 --- a/include/linux/comstats.h +++ b/include/linux/comstats.h @@ -3,6 +3,7 @@ /* * comstats.h -- Serial Port Stats. * + * Copyright (C) 1996-1997 Stallion Technologies (support@stallion.oz.au). * Copyright (C) 1994-1996 Greg Ungerer (gerg@stallion.oz.au). * * This program is free software; you can redistribute it and/or modify diff --git a/include/linux/config.h b/include/linux/config.h index 790cff448..f817d0710 100644 --- a/include/linux/config.h +++ b/include/linux/config.h @@ -27,17 +27,4 @@ * in linux/version.h, and should only be used by linux/version.c */ -/* Shouldn't these be defined somewhere in an i386 definition? */ - -/* Don't touch these, unless you really know what you're doing. */ -#define DEF_INITSEG 0x9000 -#define DEF_SYSSEG 0x1000 -#define DEF_SETUPSEG 0x9020 -#define DEF_SYSSIZE 0x7F00 - -/* internal svga startup constants */ -#define NORMAL_VGA 0xffff /* 80x25 mode */ -#define EXTENDED_VGA 0xfffe /* 80x50 mode */ -#define ASK_VGA 0xfffd /* ask for it at bootup */ - #endif diff --git a/include/linux/console.h b/include/linux/console.h index 80a1c5e69..7589ce794 100644 --- a/include/linux/console.h +++ b/include/linux/console.h @@ -16,70 +16,7 @@ #define NPAR 16 -struct vc_data { - unsigned long vc_screenbuf_size; - unsigned short vc_num; /* Console number */ - unsigned short vc_video_erase_char; /* Background erase character */ - unsigned char vc_attr; /* Current attributes */ - unsigned char vc_def_color; /* Default colors */ - unsigned char vc_color; /* Foreground & background */ - unsigned char vc_s_color; /* Saved foreground & background */ - unsigned char vc_ulcolor; /* Colour for underline mode */ - unsigned char vc_halfcolor; /* Colour for half intensity mode */ - unsigned long vc_origin; /* Used for EGA/VGA fast scroll */ - unsigned long vc_scr_end; /* Used for EGA/VGA fast scroll */ - unsigned short *vc_pos; - unsigned long vc_x,vc_y; - unsigned long vc_top,vc_bottom; - unsigned long vc_rows,vc_cols; - unsigned long vc_size_row; - unsigned long vc_state; - unsigned long vc_npar,vc_par[NPAR]; - unsigned short *vc_video_mem_start; - unsigned long vc_video_mem_end; /* End of video RAM (sort of) */ - unsigned long vc_saved_x; - unsigned long vc_saved_y; - /* mode flags */ - unsigned long vc_charset : 1; /* Character set G0 / G1 */ - unsigned long vc_s_charset : 1; /* Saved character set */ - unsigned long vc_disp_ctrl : 1; /* Display chars < 32? */ - unsigned long vc_toggle_meta : 1; /* Toggle high bit? */ - unsigned long vc_decscnm : 1; /* Screen Mode */ - unsigned long vc_decom : 1; /* Origin Mode */ - unsigned long vc_decawm : 1; /* Autowrap Mode */ - unsigned long vc_deccm : 1; /* Cursor Visible */ - unsigned long vc_decim : 1; /* Insert Mode */ - unsigned long vc_deccolm : 1; /* 80/132 Column Mode */ - /* attribute flags */ - unsigned long vc_intensity : 2; /* 0=half-bright, 1=normal, 2=bold */ - unsigned long vc_underline : 1; - unsigned long vc_blink : 1; - unsigned long vc_reverse : 1; - unsigned long vc_s_intensity : 2; /* saved rendition */ - unsigned long vc_s_underline : 1; - unsigned long vc_s_blink : 1; - unsigned long vc_s_reverse : 1; - /* misc */ - unsigned long vc_ques : 1; - unsigned long vc_need_wrap : 1; - unsigned long vc_can_do_color : 1; - unsigned long vc_has_scrolled : 1; /* Info for unblank_screen */ - unsigned long vc_kmalloced : 1; /* kfree_s() needed */ - unsigned long vc_report_mouse : 2; - unsigned char vc_utf : 1; /* Unicode UTF-8 encoding */ - unsigned char vc_utf_count; - unsigned long vc_utf_char; - unsigned long vc_tab_stop[5]; /* Tab stops. 160 columns. */ - unsigned short *vc_translate; - unsigned char vc_G0_charset; - unsigned char vc_G1_charset; - unsigned char vc_saved_G0; - unsigned char vc_saved_G1; - unsigned int vc_bell_pitch; /* Console bell pitch */ - unsigned int vc_bell_duration; /* Console bell duration */ - struct consw *vc_sw; - /* additional information is in vt_kern.h */ -}; +struct vc_data; /* * this is what the terminal answers to a ESC-Z or csi0c query. @@ -121,4 +58,42 @@ extern struct consw *conswitchp; #define CM_ERASE (2) #define CM_MOVE (3) +struct tty_struct; +int tioclinux(struct tty_struct *tty, unsigned long arg); + +/* The interface for /dev/console(s) and printk output */ + +struct console +{ + /* + * This function should not return before the string is written. + */ + void (*write)(const char*, unsigned); + + /* To unblank the console in case of panic */ + void (*unblank)(void); + + /* + * Only the console that was registered last with wait_key != + * NULL will be used. This blocks until there is a character + * to give back, it does not schedule. + */ + void (*wait_key)(void); + + /* + * Return the device to use when opening /dev/console. Only the + * last registered console will do. + */ + int (*device)(void); + + /* + * For a linked list of consoles for multiple output. Any console + * not at the head of the list is used only for output. + */ + struct console *next; +}; + +extern void register_console(struct console *); +extern struct console *console_drivers; + #endif /* linux/console.h */ diff --git a/include/linux/elf.h b/include/linux/elf.h index 726d0aa4b..17258a19b 100644 --- a/include/linux/elf.h +++ b/include/linux/elf.h @@ -225,6 +225,74 @@ typedef struct { #define R_MIPS_HIVENDOR 127 +/* + * Sparc ELF relocation types + */ +#define R_SPARC_NONE 0 +#define R_SPARC_8 1 +#define R_SPARC_16 2 +#define R_SPARC_32 3 +#define R_SPARC_DISP8 4 +#define R_SPARC_DISP16 5 +#define R_SPARC_DISP32 6 +#define R_SPARC_WDISP30 7 +#define R_SPARC_WDISP22 8 +#define R_SPARC_HI22 9 +#define R_SPARC_22 10 +#define R_SPARC_13 11 +#define R_SPARC_LO10 12 +#define R_SPARC_GOT10 13 +#define R_SPARC_GOT13 14 +#define R_SPARC_GOT22 15 +#define R_SPARC_PC10 16 +#define R_SPARC_PC22 17 +#define R_SPARC_WPLT30 18 +#define R_SPARC_COPY 19 +#define R_SPARC_GLOB_DAT 20 +#define R_SPARC_JMP_SLOT 21 +#define R_SPARC_RELATIVE 22 +#define R_SPARC_UA32 23 +#define R_SPARC_PLT32 24 +#define R_SPARC_HIPLT22 25 +#define R_SPARC_LOPLT10 26 +#define R_SPARC_PCPLT32 27 +#define R_SPARC_PCPLT22 28 +#define R_SPARC_PCPLT10 29 +#define R_SPARC_10 30 +#define R_SPARC_11 31 +#define R_SPARC_WDISP16 40 +#define R_SPARC_WDISP19 41 +#define R_SPARC_7 43 +#define R_SPARC_5 44 +#define R_SPARC_6 45 + +/* + * 68k ELF relocation types + */ +#define R_68K_NONE 0 +#define R_68K_32 1 +#define R_68K_16 2 +#define R_68K_8 3 +#define R_68K_PC32 4 +#define R_68K_PC16 5 +#define R_68K_PC8 6 +#define R_68K_GOT32 7 +#define R_68K_GOT16 8 +#define R_68K_GOT8 9 +#define R_68K_GOT32O 10 +#define R_68K_GOT16O 11 +#define R_68K_GOT8O 12 +#define R_68K_PLT32 13 +#define R_68K_PLT16 14 +#define R_68K_PLT8 15 +#define R_68K_PLT32O 16 +#define R_68K_PLT16O 17 +#define R_68K_PLT8O 18 +#define R_68K_COPY 19 +#define R_68K_GLOB_DAT 20 +#define R_68K_JMP_SLOT 21 +#define R_68K_RELATIVE 22 + typedef struct elf32_rel { Elf32_Addr r_offset; Elf32_Word r_info; diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h index 9f8b97ccf..e0a3ab3c5 100644 --- a/include/linux/etherdevice.h +++ b/include/linux/etherdevice.h @@ -24,22 +24,31 @@ #ifndef _LINUX_ETHERDEVICE_H #define _LINUX_ETHERDEVICE_H - +#include <linux/config.h> #include <linux/if_ether.h> #ifdef __KERNEL__ extern int eth_header(struct sk_buff *skb, struct device *dev, unsigned short type, void *daddr, void *saddr, unsigned len); -extern int eth_rebuild_header(void *buff, struct device *dev, - unsigned long dst, struct sk_buff *skb); +extern int eth_rebuild_header(struct sk_buff *skb); extern unsigned short eth_type_trans(struct sk_buff *skb, struct device *dev); -extern void eth_header_cache_bind(struct hh_cache ** hhp, struct device *dev, - unsigned short htype, __u32 daddr); -extern void eth_header_cache_update(struct hh_cache *hh, struct device *dev, unsigned char * haddr); +extern void eth_header_cache_update(struct hh_cache *hh, struct device *dev, + unsigned char * haddr); +extern int eth_header_cache(struct dst_entry *dst, + struct neighbour *neigh, + struct hh_cache *hh); +extern struct device * init_etherdev(struct device *, int); + +#ifdef CONFIG_IP_ROUTER +static void inline eth_copy_and_sum (struct sk_buff *dest, unsigned char *src, int len, int base) +{ + memcpy (dest->data, src, len); +} +#else extern void eth_copy_and_sum(struct sk_buff *dest, unsigned char *src, int length, int base); -extern struct device * init_etherdev(struct device *, int); +#endif #endif diff --git a/include/linux/ext_fs.h b/include/linux/ext_fs.h deleted file mode 100644 index 9bca72b0b..000000000 --- a/include/linux/ext_fs.h +++ /dev/null @@ -1,111 +0,0 @@ -#ifndef _LINUX_EXT_FS_H -#define _LINUX_EXT_FS_H - -/* - * The ext filesystem constants/structures - */ - -#define EXT_NAME_LEN 255 -#define EXT_ROOT_INO 1 - -#define EXT_SUPER_MAGIC 0x137D - -#define EXT_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct ext_inode))) - -struct ext_inode { - unsigned short i_mode; - unsigned short i_uid; - unsigned long i_size; - unsigned long i_time; - unsigned short i_gid; - unsigned short i_nlinks; - unsigned long i_zone[12]; -}; - -struct ext_free_inode { - unsigned long count; - unsigned long free[14]; - unsigned long next; -}; - -struct ext_free_block { - unsigned long count; - unsigned long free[254]; - unsigned long next; -}; - -struct ext_super_block { - unsigned long s_ninodes; - unsigned long s_nzones; - unsigned long s_firstfreeblock; - unsigned long s_freeblockscount; - unsigned long s_firstfreeinode; - unsigned long s_freeinodescount; - unsigned long s_firstdatazone; - unsigned long s_log_zone_size; - unsigned long s_max_size; - unsigned long s_reserved1; - unsigned long s_reserved2; - unsigned long s_reserved3; - unsigned long s_reserved4; - unsigned long s_reserved5; - unsigned short s_magic; -}; - -struct ext_dir_entry { - unsigned long inode; - unsigned short rec_len; - unsigned short name_len; - char name[EXT_NAME_LEN]; -}; - -#ifdef __KERNEL__ -extern int ext_open(struct inode * inode, struct file * filp); -extern void ext_release(struct inode * inode, struct file * filp); -extern int ext_lookup(struct inode * dir,const char * name, int len, - struct inode ** result); -extern int ext_create(struct inode * dir,const char * name, int len, int mode, - struct inode ** result); -extern int ext_mkdir(struct inode * dir, const char * name, int len, int mode); -extern int ext_rmdir(struct inode * dir, const char * name, int len); -extern int ext_unlink(struct inode * dir, const char * name, int len); -extern int ext_symlink(struct inode * inode, const char * name, int len, - const char * symname); -extern int ext_link(struct inode * oldinode, struct inode * dir, const char * name, int len); -extern int ext_mknod(struct inode * dir, const char * name, int len, int mode, int rdev); -extern int ext_rename(struct inode * old_dir, const char * old_name, int old_len, - struct inode * new_dir, const char * new_name, int new_len, int must_be_dir); -extern struct inode * ext_new_inode(const struct inode * dir); -extern void ext_free_inode(struct inode * inode); -extern unsigned long ext_count_free_inodes(struct super_block *sb); -extern int ext_new_block(struct super_block * sb); -extern void ext_free_block(struct super_block * sb, int block); -extern unsigned long ext_count_free_blocks(struct super_block *sb); - -extern int ext_bmap(struct inode *,int); - -extern struct buffer_head * ext_getblk(struct inode *, int, int); -extern struct buffer_head * ext_bread(struct inode *, int, int); - -extern void ext_truncate(struct inode *); -extern void ext_put_super(struct super_block *); -extern void ext_write_super(struct super_block *); -extern struct super_block *ext_read_super(struct super_block *,void *,int); -extern int init_ext_fs(void); -extern void ext_read_inode(struct inode *); -extern void ext_write_inode(struct inode *); -extern void ext_put_inode(struct inode *); -extern void ext_statfs(struct super_block *, struct statfs *, int); -extern int ext_sync_inode(struct inode *); -extern int ext_sync_file(struct inode *, struct file *); - -extern int ext_lseek(struct inode *, struct file *, off_t, int); -extern int ext_read(struct inode *, struct file *, char *, int); -extern int ext_write(struct inode *, struct file *, char *, int); - -extern struct inode_operations ext_file_inode_operations; -extern struct inode_operations ext_dir_inode_operations; -extern struct inode_operations ext_symlink_inode_operations; - -#endif /*__KERNEL__ */ -#endif diff --git a/include/linux/ext_fs_i.h b/include/linux/ext_fs_i.h deleted file mode 100644 index 32734f95f..000000000 --- a/include/linux/ext_fs_i.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef _EXT_FS_I -#define _EXT_FS_I - -/* - * extended file system inode data in memory - */ -struct ext_inode_info { - unsigned long i_data[16]; -}; - -#endif diff --git a/include/linux/ext_fs_sb.h b/include/linux/ext_fs_sb.h deleted file mode 100644 index 19004d80f..000000000 --- a/include/linux/ext_fs_sb.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef _EXT_FS_SB -#define _EXT_FS_SB - -/* - * extended-fs super-block data in memory - */ -struct ext_sb_info { - unsigned long s_ninodes; - unsigned long s_nzones; - unsigned long s_firstdatazone; - unsigned long s_log_zone_size; - unsigned long s_max_size; - unsigned long s_firstfreeblocknumber; - unsigned long s_freeblockscount; - struct buffer_head * s_firstfreeblock; - unsigned long s_firstfreeinodenumber; - unsigned long s_freeinodescount; - struct buffer_head * s_firstfreeinodeblock; -}; - -#endif diff --git a/include/linux/fd.h b/include/linux/fd.h index a05cf3900..da7293c35 100644 --- a/include/linux/fd.h +++ b/include/linux/fd.h @@ -153,7 +153,8 @@ struct floppy_drive_params { #define FD_BROKEN_DCL 0x20 #define FD_DEBUG 0x02 #define FD_SILENT_DCL_CLEAR 0x4 -#define FD_INVERTED_DCL 0x80 +#define FD_INVERTED_DCL 0x80 /* must be 0x80, because of hardware + considerations */ char read_track; /* use readtrack during probing? */ diff --git a/include/linux/fddidevice.h b/include/linux/fddidevice.h index bb0b298ee..a093ccf71 100644 --- a/include/linux/fddidevice.h +++ b/include/linux/fddidevice.h @@ -25,18 +25,15 @@ #include <linux/if_fddi.h> #ifdef __KERNEL__ -extern int fddi_header(struct sk_buff *skb, - struct device *dev, - unsigned short type, - void *daddr, - void *saddr, - unsigned len); -extern int fddi_rebuild_header(void *buff, - struct device *dev, - unsigned long dest, - struct sk_buff *skb); +extern int fddi_header(struct sk_buff *skb, + struct device *dev, + unsigned short type, + void *daddr, + void *saddr, + unsigned len); +extern int fddi_rebuild_header(struct sk_buff *skb); extern unsigned short fddi_type_trans(struct sk_buff *skb, - struct device *dev); + struct device *dev); #endif #endif /* _LINUX_FDDIDEVICE_H */ diff --git a/include/linux/file.h b/include/linux/file.h index a3297909d..4ba5311e8 100644 --- a/include/linux/file.h +++ b/include/linux/file.h @@ -12,14 +12,17 @@ extern inline struct file * fget(unsigned long fd) return file; } -extern void __fput(struct file *, struct inode *); +extern int __fput(struct file *, struct inode *); -extern inline void fput(struct file *file, struct inode *inode) +extern inline int fput(struct file *file, struct inode *inode) { int count = file->f_count-1; + int error = 0; + if (!count) - __fput(file, inode); + error = __fput(file, inode); file->f_count = count; + return error; } #endif diff --git a/include/linux/firewall.h b/include/linux/firewall.h index e2d1f25e3..1747f3811 100644 --- a/include/linux/firewall.h +++ b/include/linux/firewall.h @@ -1,26 +1,29 @@ #ifndef __LINUX_FIREWALL_H #define __LINUX_FIREWALL_H +#include <linux/config.h> + /* * Definitions for loadable firewall modules */ -#define FW_BLOCK 0 -#define FW_ACCEPT 1 +#define FW_QUEUE 0 +#define FW_BLOCK 1 +#define FW_ACCEPT 2 #define FW_REJECT (-1) -#define FW_REDIRECT 2 -#define FW_MASQUERADE 3 -#define FW_SKIP 4 +#define FW_REDIRECT 3 +#define FW_MASQUERADE 4 +#define FW_SKIP 5 struct firewall_ops { struct firewall_ops *next; int (*fw_forward)(struct firewall_ops *this, int pf, - struct device *dev, void *phdr, void *arg); + struct device *dev, void *phdr, void *arg, struct sk_buff **pskb); int (*fw_input)(struct firewall_ops *this, int pf, - struct device *dev, void *phdr, void *arg); + struct device *dev, void *phdr, void *arg, struct sk_buff **pskb); int (*fw_output)(struct firewall_ops *this, int pf, - struct device *dev, void *phdr, void *arg); + struct device *dev, void *phdr, void *arg, struct sk_buff **pskb); /* Data falling in the second 486 cache line isn't used directly during a firewall call and scan, only by insert/delete and other unusual cases @@ -32,10 +35,27 @@ struct firewall_ops #ifdef __KERNEL__ extern int register_firewall(int pf, struct firewall_ops *fw); extern int unregister_firewall(int pf, struct firewall_ops *fw); -extern int call_fw_firewall(int pf, struct device *dev, void *phdr, void *arg); -extern int call_in_firewall(int pf, struct device *dev, void *phdr, void *arg); -extern int call_out_firewall(int pf, struct device *dev, void *phdr, void *arg); extern void fwchain_init(void); -#endif +#ifdef CONFIG_FIREWALL +extern int call_fw_firewall(int pf, struct device *dev, void *phdr, void *arg, struct sk_buff **pskb); +extern int call_in_firewall(int pf, struct device *dev, void *phdr, void *arg, struct sk_buff **pskb); +extern int call_out_firewall(int pf, struct device *dev, void *phdr, void *arg, struct sk_buff **pskb); +#else +extern __inline__ int call_fw_firewall(int pf, struct device *dev, void *phdr, void *arg, struct sk_buff **skb) +{ + return FW_ACCEPT; +} + +extern __inline__ int call_in_firewall(int pf, struct device *dev, void *phdr, void *arg, struct sk_buff **skb) +{ + return FW_ACCEPT; +} +extern __inline__ int call_out_firewall(int pf, struct device *dev, void *phdr, void *arg, struct sk_buff **skb) +{ + return FW_ACCEPT; +} + +#endif +#endif #endif diff --git a/include/linux/fs.h b/include/linux/fs.h index 2283c278e..85e04d184 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -27,7 +27,7 @@ /* Fixed constants first: */ #undef NR_OPEN -#define NR_OPEN 256 +#define NR_OPEN 1024 #define NR_SUPER 64 #define BLOCK_SIZE 1024 @@ -36,7 +36,7 @@ /* And dynamically-tunable limits and defaults: */ extern int max_inodes, nr_inodes; extern int max_files, nr_files; -#define NR_INODE 3072 /* this should be bigger than NR_FILE */ +#define NR_INODE 4096 /* this should be bigger than NR_FILE */ #define NR_FILE 1024 /* this can well be larger on a larger system */ #define MAY_EXEC 1 @@ -73,6 +73,7 @@ extern int max_files, nr_files; #define S_WRITE 128 /* Write on file/directory/symlink */ #define S_APPEND 256 /* Append-only file */ #define S_IMMUTABLE 512 /* Immutable file */ +#define MS_NOATIME 1024 /* Do not update access times. */ /* * Flags that can be altered by MS_REMOUNT @@ -94,6 +95,7 @@ extern int max_files, nr_files; * Exception: MS_RDONLY is always applied to the entire file system. */ #define IS_RDONLY(inode) (((inode)->i_sb) && ((inode)->i_sb->s_flags & MS_RDONLY)) +#define DO_UPDATE_ATIME(inode) (!((inode)->i_flags & MS_NOATIME) && !IS_RDONLY(inode)) #define IS_NOSUID(inode) ((inode)->i_flags & MS_NOSUID) #define IS_NODEV(inode) ((inode)->i_flags & MS_NODEV) #define IS_NOEXEC(inode) ((inode)->i_flags & MS_NOEXEC) @@ -126,7 +128,7 @@ extern int max_files, nr_files; #include <asm/bitops.h> extern void buffer_init(void); -extern unsigned long inode_init(unsigned long start, unsigned long end); +extern void inode_init(void); extern unsigned long file_table_init(unsigned long start, unsigned long end); extern unsigned long name_cache_init(unsigned long start, unsigned long end); @@ -177,7 +179,7 @@ struct buffer_head { unsigned long b_lru_time; /* Time when this buffer was * last used. */ struct wait_queue * b_wait; - struct buffer_head * b_prev; /* doubly linked list of hash-queue */ + struct buffer_head ** b_pprev; /* doubly linked list of hash-queue */ struct buffer_head * b_prev_free; /* doubly linked list of buffers */ struct buffer_head * b_reqnext; /* request queue */ }; @@ -219,17 +221,16 @@ static inline int buffer_protected(struct buffer_head * bh) #include <linux/pipe_fs_i.h> #include <linux/minix_fs_i.h> -#include <linux/ext_fs_i.h> #include <linux/ext2_fs_i.h> #include <linux/hpfs_fs_i.h> #include <linux/msdos_fs_i.h> #include <linux/umsdos_fs_i.h> #include <linux/iso_fs_i.h> #include <linux/nfs_fs_i.h> -#include <linux/xia_fs_i.h> #include <linux/sysv_fs_i.h> #include <linux/affs_fs_i.h> #include <linux/ufs_fs_i.h> +#include <linux/romfs_fs_i.h> /* * Attribute flags. These should be or-ed together to figure out what @@ -269,8 +270,13 @@ struct iattr { #include <linux/quota.h> struct inode { - kdev_t i_dev; + struct inode *i_hash_next; + struct inode **i_hash_pprev; + struct inode *i_next; + struct inode **i_pprev; unsigned long i_ino; + kdev_t i_dev; + unsigned short i_count; umode_t i_mode; nlink_t i_nlink; uid_t i_uid; @@ -292,11 +298,8 @@ struct inode { struct vm_area_struct *i_mmap; struct page *i_pages; struct dquot *i_dquot[MAXQUOTAS]; - struct inode *i_next, *i_prev; - struct inode *i_hash_next, *i_hash_prev; struct inode *i_bound_to, *i_bound_by; struct inode *i_mount; - unsigned short i_count; unsigned short i_flags; unsigned char i_lock; unsigned char i_dirt; @@ -308,17 +311,16 @@ struct inode { union { struct pipe_inode_info pipe_i; struct minix_inode_info minix_i; - struct ext_inode_info ext_i; struct ext2_inode_info ext2_i; struct hpfs_inode_info hpfs_i; struct msdos_inode_info msdos_i; struct umsdos_inode_info umsdos_i; struct iso_inode_info isofs_i; struct nfs_inode_info nfs_i; - struct xiafs_inode_info xiafs_i; struct sysv_inode_info sysv_i; struct affs_inode_info affs_i; struct ufs_inode_info ufs_i; + struct romfs_inode_info romfs_i; struct socket socket_i; void * generic_ip; } u; @@ -342,6 +344,7 @@ struct file { #define FL_FLOCK 2 #define FL_BROKEN 4 /* broken flock() emulation */ #define FL_ACCESS 8 /* for processes suspended by mandatory locking */ +#define FL_LOCKD 16 /* lock held by rpc.lockd */ struct file_lock { struct file_lock *fl_next; /* singly linked list for this inode */ @@ -349,20 +352,33 @@ struct file_lock { struct file_lock *fl_prevlink; /* used to simplify lock removal */ struct file_lock *fl_nextblock; /* circular list of blocked processes */ struct file_lock *fl_prevblock; - struct task_struct *fl_owner; + void *fl_owner; /* usu. the process' task_struct */ + unsigned int fl_pid; struct wait_queue *fl_wait; struct file *fl_file; unsigned char fl_flags; unsigned char fl_type; off_t fl_start; off_t fl_end; + + void (*fl_notify)(struct file_lock *); /* unblock callback */ + + union { + struct nfs_lock_info nfs_fl; + } fl_u; }; +extern struct file_lock *file_lock_table; + #include <linux/fcntl.h> extern int fcntl_getlk(unsigned int fd, struct flock *l); extern int fcntl_setlk(unsigned int fd, unsigned int cmd, struct flock *l); extern void locks_remove_locks(struct task_struct *task, struct file *filp); +extern struct file_lock *posix_test_lock(struct file *, struct file_lock *); +extern int posix_lock_file(struct file *, struct file_lock *, unsigned int); +extern void posix_block_lock(struct file_lock *, struct file_lock *); +extern void posix_unblock_lock(struct file_lock *); #include <linux/stat.h> @@ -409,16 +425,15 @@ struct fasync_struct { extern int fasync_helper(struct inode *, struct file *, int, struct fasync_struct **); #include <linux/minix_fs_sb.h> -#include <linux/ext_fs_sb.h> #include <linux/ext2_fs_sb.h> #include <linux/hpfs_fs_sb.h> #include <linux/msdos_fs_sb.h> #include <linux/iso_fs_sb.h> #include <linux/nfs_fs_sb.h> -#include <linux/xia_fs_sb.h> #include <linux/sysv_fs_sb.h> #include <linux/affs_fs_sb.h> #include <linux/ufs_fs_sb.h> +#include <linux/romfs_fs_sb.h> struct super_block { kdev_t s_dev; @@ -438,16 +453,15 @@ struct super_block { struct wait_queue * s_wait; union { struct minix_sb_info minix_sb; - struct ext_sb_info ext_sb; struct ext2_sb_info ext2_sb; struct hpfs_sb_info hpfs_sb; struct msdos_sb_info msdos_sb; struct isofs_sb_info isofs_sb; struct nfs_sb_info nfs_sb; - struct xiafs_sb_info xiafs_sb; struct sysv_sb_info sysv_sb; struct affs_sb_info affs_sb; struct ufs_sb_info ufs_sb; + struct romfs_sb_info romfs_sb; void *generic_sbp; } u; }; @@ -465,15 +479,16 @@ struct file_operations { long (*read) (struct inode *, struct file *, char *, unsigned long); long (*write) (struct inode *, struct file *, const char *, unsigned long); int (*readdir) (struct inode *, struct file *, void *, filldir_t); - int (*select) (struct inode *, struct file *, int, select_table *); + unsigned int (*poll) (struct file *, poll_table *); int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long); int (*mmap) (struct inode *, struct file *, struct vm_area_struct *); int (*open) (struct inode *, struct file *); - void (*release) (struct inode *, struct file *); + int (*release) (struct inode *, struct file *); int (*fsync) (struct inode *, struct file *); int (*fasync) (struct inode *, struct file *, int); int (*check_media_change) (kdev_t dev); int (*revalidate) (kdev_t dev); + int (*lock) (struct inode *, struct file *, int, struct file_lock *); }; struct inode_operations { @@ -495,6 +510,9 @@ struct inode_operations { void (*truncate) (struct inode *); int (*permission) (struct inode *, int); int (*smap) (struct inode *,int); + int (*updatepage) (struct inode *, struct page *, const char *, + unsigned long, unsigned int, int); + int (*revalidate) (struct inode *); }; struct super_operations { @@ -539,7 +557,7 @@ extern int do_truncate(struct inode *, unsigned long); extern int register_blkdev(unsigned int, const char *, struct file_operations *); extern int unregister_blkdev(unsigned int major, const char * name); extern int blkdev_open(struct inode * inode, struct file * filp); -extern void blkdev_release (struct inode * inode); +extern int blkdev_release (struct inode * inode); extern struct file_operations def_blk_fops; extern struct inode_operations blkdev_inode_operations; @@ -571,20 +589,17 @@ extern struct super_block super_blocks[NR_SUPER]; extern void refile_buffer(struct buffer_head * buf); extern void set_writetime(struct buffer_head * buf, int flag); -extern void refill_freelist(int size); extern int try_to_free_buffer(struct buffer_head*, struct buffer_head**, int); extern int nr_buffers; extern int buffermem; extern int nr_buffer_heads; -#define BUF_CLEAN 0 -#define BUF_UNSHARED 1 /* Buffers that were shared but are not any more */ -#define BUF_LOCKED 2 /* Buffers scheduled for write */ -#define BUF_LOCKED1 3 /* Supers, inodes */ -#define BUF_DIRTY 4 /* Dirty buffers, not yet scheduled for write */ -#define BUF_SHARED 5 /* Buffers shared */ -#define NR_LIST 6 +#define BUF_CLEAN 0 +#define BUF_LOCKED 1 /* Buffers scheduled for write */ +#define BUF_LOCKED1 2 /* Supers, inodes */ +#define BUF_DIRTY 3 /* Dirty buffers, not yet scheduled for write */ +#define NR_LIST 4 void mark_buffer_uptodate(struct buffer_head * bh, int on); @@ -654,6 +669,7 @@ extern inline void bforget(struct buffer_head *buf) __bforget(buf); } extern void set_blocksize(kdev_t dev, int size); +extern unsigned int get_hardblocksize(kdev_t dev); extern struct buffer_head * bread(kdev_t dev, int block, int size); extern struct buffer_head * breada(kdev_t dev,int block, int size, unsigned int pos, unsigned int filesize); @@ -663,6 +679,7 @@ extern int brw_page(int, struct page *, kdev_t, int [], int, int); extern int generic_readpage(struct inode *, struct page *); extern int generic_file_mmap(struct inode *, struct file *, struct vm_area_struct *); extern long generic_file_read(struct inode *, struct file *, char *, unsigned long); +extern long generic_file_write(struct inode *, struct file *, const char *, unsigned long); extern void put_super(kdev_t dev); unsigned long generate_cluster(kdev_t dev, int b[], int size); diff --git a/include/linux/hdlcdrv.h b/include/linux/hdlcdrv.h index 82a35d06d..0a6b9c735 100644 --- a/include/linux/hdlcdrv.h +++ b/include/linux/hdlcdrv.h @@ -1,5 +1,5 @@ /* - * hdlcdrv.h -- HDLC packet radio network driver. + * hdlcdrv.h -- HDLC packet radio network driver. * The Linux soundcard driver for 1200 baud and 9600 baud packet radio * (C) 1996 by Thomas Sailer, HB9JNX/AE4WA */ @@ -7,8 +7,12 @@ #ifndef _HDLCDRV_H #define _HDLCDRV_H +#include <linux/version.h> #include <linux/sockios.h> +#include <linux/version.h> +#if LINUX_VERSION_CODE < 0x20119 #include <linux/if_ether.h> +#endif #include <linux/netdevice.h> /* -------------------------------------------------------------------- */ @@ -20,6 +24,7 @@ struct hdlcdrv_params { int iobase; int irq; int dma; + int dma2; int seriobase; int pariobase; int midiiobase; @@ -34,11 +39,23 @@ struct hdlcdrv_channel_params { /* this just makes them send even if DCD is on */ }; +struct hdlcdrv_old_channel_state { + int ptt; + int dcd; + int ptt_keyed; +#if LINUX_VERSION_CODE < 0x20100 + struct enet_statistics stats; +#endif +}; + struct hdlcdrv_channel_state { - int ptt; - int dcd; - int ptt_keyed; - struct enet_statistics stats; + int ptt; + int dcd; + int ptt_keyed; + unsigned long tx_packets; + unsigned long tx_errors; + unsigned long rx_packets; + unsigned long rx_errors; }; struct hdlcdrv_ioctl { @@ -47,8 +64,11 @@ struct hdlcdrv_ioctl { struct hdlcdrv_params mp; struct hdlcdrv_channel_params cp; struct hdlcdrv_channel_state cs; + struct hdlcdrv_old_channel_state ocs; unsigned int calibrate; unsigned char bits; + char modename[128]; + char drivername[32]; } data; }; @@ -57,18 +77,39 @@ struct hdlcdrv_ioctl { /* * ioctl values */ -#define HDLCDRVCTL_GETMODEMPAR 0 -#define HDLCDRVCTL_SETMODEMPAR 1 -#define HDLCDRVCTL_GETCHANNELPAR 2 -#define HDLCDRVCTL_SETCHANNELPAR 3 -#define HDLCDRVCTL_GETSTAT 4 -#define HDLCDRVCTL_CALIBRATE 5 +#define HDLCDRVCTL_GETMODEMPAR 0 +#define HDLCDRVCTL_SETMODEMPAR 1 +#define HDLCDRVCTL_MODEMPARMASK 2 /* not handled by hdlcdrv */ +#define HDLCDRVCTL_GETCHANNELPAR 10 +#define HDLCDRVCTL_SETCHANNELPAR 11 +#define HDLCDRVCTL_OLDGETSTAT 20 +#define HDLCDRVCTL_CALIBRATE 21 +#define HDLCDRVCTL_GETSTAT 22 /* * these are mainly for debugging purposes */ -#define HDLCDRVCTL_GETSAMPLES 10 -#define HDLCDRVCTL_GETBITS 11 +#define HDLCDRVCTL_GETSAMPLES 30 +#define HDLCDRVCTL_GETBITS 31 + +/* + * not handled by hdlcdrv, but by its depending drivers + */ +#define HDLCDRVCTL_GETMODE 40 +#define HDLCDRVCTL_SETMODE 41 +#define HDLCDRVCTL_MODELIST 42 +#define HDLCDRVCTL_DRIVERNAME 43 + +/* + * mask of needed modem parameters, returned by HDLCDRVCTL_MODEMPARMASK + */ +#define HDLCDRV_PARMASK_IOBASE (1<<0) +#define HDLCDRV_PARMASK_IRQ (1<<1) +#define HDLCDRV_PARMASK_DMA (1<<2) +#define HDLCDRV_PARMASK_DMA2 (1<<3) +#define HDLCDRV_PARMASK_SERIOBASE (1<<4) +#define HDLCDRV_PARMASK_PARIOBASE (1<<5) +#define HDLCDRV_PARMASK_MIDIIOBASE (1<<6) /* -------------------------------------------------------------------- */ @@ -79,7 +120,7 @@ struct hdlcdrv_ioctl { #define HDLCDRV_HDLCBUFFER 16 /* should be a power of 2 for speed reasons */ #define HDLCDRV_BITBUFFER 256 /* should be a power of 2 for speed reasons */ #undef HDLCDRV_LOOPBACK /* define for HDLC debugging purposes */ -#undef HDLCDRV_DEBUG +#define HDLCDRV_DEBUG /* maximum packet length, excluding CRC */ #define HDLCDRV_MAXFLEN 400 @@ -133,13 +174,15 @@ struct hdlcdrv_ops { /* * first some informations needed by the hdlcdrv routines */ - int bitrate; + const char *drvname; + const char *drvinfo; /* * the routines called by the hdlcdrv routines */ int (*open)(struct device *); int (*close)(struct device *); - int (*ioctl)(struct device *, struct ifreq *, int); + int (*ioctl)(struct device *, struct ifreq *, + struct hdlcdrv_ioctl *, int); }; struct hdlcdrv_state { @@ -149,7 +192,12 @@ struct hdlcdrv_state { const struct hdlcdrv_ops *ops; + struct { + int bitrate; + } par; + struct hdlcdrv_pttoutput { + int dma2; int seriobase; int pariobase; int midiiobase; @@ -201,7 +249,11 @@ struct hdlcdrv_state { struct hdlcdrv_bitbuffer bitbuf_hdlc; #endif /* HDLCDRV_DEBUG */ +#if LINUX_VERSION_CODE < 0x20119 struct enet_statistics stats; +#else + struct net_device_stats stats; +#endif int ptt_keyed; struct sk_buff_head send_queue; /* Packets awaiting transmission */ @@ -262,12 +314,12 @@ extern inline void hdlcdrv_hbuf_put(struct hdlcdrv_hdlcbuffer *hb, /* -------------------------------------------------------------------- */ -extern void hdlcdrv_putbits(struct hdlcdrv_state *s, unsigned int bits) +extern inline void hdlcdrv_putbits(struct hdlcdrv_state *s, unsigned int bits) { hdlcdrv_hbuf_put(&s->hdlcrx.hbuf, bits); } -extern unsigned int hdlcdrv_getbits(struct hdlcdrv_state *s) +extern inline unsigned int hdlcdrv_getbits(struct hdlcdrv_state *s) { unsigned int ret; @@ -285,19 +337,19 @@ extern unsigned int hdlcdrv_getbits(struct hdlcdrv_state *s) return ret; } -extern void hdlcdrv_channelbit(struct hdlcdrv_state *s, unsigned int bit) +extern inline void hdlcdrv_channelbit(struct hdlcdrv_state *s, unsigned int bit) { #ifdef HDLCDRV_DEBUG hdlcdrv_add_bitbuffer(&s->bitbuf_channel, bit); #endif /* HDLCDRV_DEBUG */ } -extern void hdlcdrv_setdcd(struct hdlcdrv_state *s, int dcd) +extern inline void hdlcdrv_setdcd(struct hdlcdrv_state *s, int dcd) { s->hdlcrx.dcd = !!dcd; } -extern int hdlcdrv_ptt(struct hdlcdrv_state *s) +extern inline int hdlcdrv_ptt(struct hdlcdrv_state *s) { return s->hdlctx.ptt || (s->hdlctx.calibrate > 0); } diff --git a/include/linux/hdreg.h b/include/linux/hdreg.h index ba4b62648..80fbfc79b 100644 --- a/include/linux/hdreg.h +++ b/include/linux/hdreg.h @@ -91,6 +91,7 @@ struct hd_geometry { #define HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */ #define HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */ #define HDIO_GET_DMA 0x030b /* get use-dma flag */ +#define HDIO_GET_NICE 0x030c /* get nice flags */ #define HDIO_DRIVE_CMD 0x031f /* execute a special drive command */ /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */ @@ -102,6 +103,7 @@ struct hd_geometry { #define HDIO_SET_DMA 0x0326 /* change use-dma flag */ #define HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */ #define HDIO_SCAN_HWIF 0x0328 /* register and (re)scan interface */ +#define HDIO_SET_NICE 0x0329 /* set nice flags */ /* structure returned by HDIO_GET_IDENTITY, as per ANSI ATA2 rev.2f spec */ struct hd_driveid { @@ -154,6 +156,17 @@ struct hd_driveid { /* unsigned short reservedyy[96];*/ /* reserved (words 160-255) */ }; +/* + * IDE "nice" flags. These are used on a per drive basis to determine + * when to be nice and give more bandwidth to the other devices which + * share the same IDE bus. + */ +#define IDE_NICE_DSC_OVERLAP (0) /* per the DSC overlap protocol */ +#define IDE_NICE_ATAPI_OVERLAP (1) /* not supported yet */ +#define IDE_NICE_0 (2) /* when sure that it won't affect us */ +#define IDE_NICE_1 (3) /* when probably won't affect us much */ +#define IDE_NICE_2 (4) /* when we know it's on our expense */ + #ifdef __KERNEL__ /* * These routines are used for kernel command line parameters from main.c: diff --git a/include/linux/icmp.h b/include/linux/icmp.h index 611c41da8..9e5dd8899 100644 --- a/include/linux/icmp.h +++ b/include/linux/icmp.h @@ -30,6 +30,7 @@ #define ICMP_INFO_REPLY 16 /* Information Reply */ #define ICMP_ADDRESS 17 /* Address Mask Request */ #define ICMP_ADDRESSREPLY 18 /* Address Mask Reply */ +#define NR_ICMP_TYPES 18 /* Codes for UNREACH. */ @@ -49,7 +50,7 @@ #define ICMP_PKT_FILTERED 13 /* Packet filtered */ #define ICMP_PREC_VIOLATION 14 /* Precedence violation */ #define ICMP_PREC_CUTOFF 15 /* Precedence cut off */ -#define NR_ICMP_UNREACH 15 /* instead of hardcoding immediate value */ +#define NR_ICMP_UNREACH 15 /* instead of hardcoding immediate value */ /* Codes for REDIRECT. */ #define ICMP_REDIR_NET 0 /* Redirect Net */ @@ -72,14 +73,19 @@ struct icmphdr { __u16 sequence; } echo; __u32 gateway; + struct { + __u16 __unused; + __u16 mtu; + } frag; } un; }; +#ifdef __KERNEL__ struct icmp_err { int errno; unsigned fatal:1; }; - +#endif #endif /* _LINUX_ICMP_H */ diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h index d600403c8..a582e37b5 100644 --- a/include/linux/icmpv6.h +++ b/include/linux/icmpv6.h @@ -3,21 +3,22 @@ #include <asm/byteorder.h> -struct icmpv6hdr { +struct icmp6hdr { - __u8 type; - __u8 code; - __u16 checksum; + __u8 icmp6_type; + __u8 icmp6_code; + __u16 icmp6_cksum; union { + __u32 un_data32[1]; + __u16 un_data16[2]; + __u8 un_data8[4]; + struct icmpv6_echo { __u16 identifier; __u16 sequence; } u_echo; - __u32 pointer; - __u32 mtu; - __u32 unused; struct icmpv6_nd_advt { #if defined(__LITTLE_ENDIAN_BITFIELD) @@ -53,34 +54,37 @@ struct icmpv6hdr { __u16 rt_lifetime; } u_nd_ra; - } u; - -#define icmp6_identifier u.u_echo.identifier -#define icmp6_sequence u.u_echo.sequence -#define icmp6_pointer u.pointer -#define icmp6_mtu u.mtu -#define icmp6_unused u.unused -#define icmp6_router u.u_nd_advt.router -#define icmp6_solicited u.u_nd_advt.solicited -#define icmp6_override u.u_nd_advt.override -#define icmp6_ndiscreserved u.u_nd_advt.reserved -#define icmp6_hop_limit u.u_nd_ra.hop_limit -#define icmp6_addrconf_managed u.u_nd_ra.managed -#define icmp6_addrconf_other u.u_nd_ra.other -#define icmp6_rt_lifetime u.u_nd_ra.rt_lifetime + } icmp6_dataun; + +#define icmp6_identifier icmp6_dataun.u_echo.identifier +#define icmp6_sequence icmp6_dataun.u_echo.sequence +#define icmp6_pointer icmp6_dataun.un_data32[0] +#define icmp6_mtu icmp6_dataun.un_data32[0] +#define icmp6_unused icmp6_dataun.un_data32[0] +#define icmp6_maxdelay icmp6_dataun.un_data16[0] +#define icmp6_router icmp6_dataun.u_nd_advt.router +#define icmp6_solicited icmp6_dataun.u_nd_advt.solicited +#define icmp6_override icmp6_dataun.u_nd_advt.override +#define icmp6_ndiscreserved icmp6_dataun.u_nd_advt.reserved +#define icmp6_hop_limit icmp6_dataun.u_nd_ra.hop_limit +#define icmp6_addrconf_managed icmp6_dataun.u_nd_ra.managed +#define icmp6_addrconf_other icmp6_dataun.u_nd_ra.other +#define icmp6_rt_lifetime icmp6_dataun.u_nd_ra.rt_lifetime }; #define ICMPV6_DEST_UNREACH 1 #define ICMPV6_PKT_TOOBIG 2 -#define ICMPV6_TIME_EXCEEDED 3 -#define ICMPV6_PARAMETER_PROB 4 +#define ICMPV6_TIME_EXCEED 3 +#define ICMPV6_PARAMPROB 4 + +#define ICMPV6_INFOMSG_MASK 0x80 #define ICMPV6_ECHO_REQUEST 128 #define ICMPV6_ECHO_REPLY 129 -#define ICMPV6_MEMBERSHIP_QUERY 130 -#define ICMPV6_MEMBERSHIP_REPORT 131 -#define ICMPV6_MEMBERSHIP_REDUCTION 132 +#define ICMPV6_MGM_QUERY 130 +#define ICMPV6_MGM_REPORT 131 +#define ICMPV6_MGM_REDUCTION 132 /* * Codes for Destination Unreachable @@ -134,7 +138,7 @@ extern void icmpv6_send(struct sk_buff *skb, __u32 info, struct device *dev); -extern void icmpv6_init(struct proto_ops *ops); +extern void icmpv6_init(struct net_proto_family *ops); extern int icmpv6_err_convert(int type, int code, int *err); #endif diff --git a/include/linux/if.h b/include/linux/if.h index ffa226a62..06e2d740e 100644 --- a/include/linux/if.h +++ b/include/linux/if.h @@ -19,7 +19,7 @@ #ifndef _LINUX_IF_H #define _LINUX_IF_H -#include <linux/types.h> /* for "caddr_t" et al */ +#include <linux/types.h> /* for "__kernel_caddr_t" et al */ #include <linux/socket.h> /* for "struct sockaddr" et al */ /* Standard interface flags. */ @@ -32,7 +32,6 @@ #define IFF_RUNNING 0x40 /* resources allocated */ #define IFF_NOARP 0x80 /* no ARP protocol */ #define IFF_PROMISC 0x100 /* receive all packets */ -/* Not supported */ #define IFF_ALLMULTI 0x200 /* receive all multicast packets*/ #define IFF_MASTER 0x400 /* master of a load balancer */ @@ -110,7 +109,7 @@ struct ifreq int ifru_mtu; struct ifmap ifru_map; char ifru_slave[IFNAMSIZ]; /* Just fits the size */ - caddr_t ifru_data; + __kernel_caddr_t ifru_data; } ifr_ifru; }; @@ -140,8 +139,8 @@ struct ifconf int ifc_len; /* size of buffer */ union { - caddr_t ifcu_buf; - struct ifreq *ifcu_req; + __kernel_caddr_t ifcu_buf; + struct ifreq *ifcu_req; } ifc_ifcu; }; #define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h index fffb67990..5f18a049a 100644 --- a/include/linux/if_arp.h +++ b/include/linux/if_arp.h @@ -50,12 +50,14 @@ #define ARPHRD_TUNNEL 768 /* IPIP tunnel */ #define ARPHRD_TUNNEL6 769 /* IPIP6 tunnel */ -#define ARPHRD_FRAD 770 /* Frame Relay Access Device */ +#define ARPHRD_FRAD 770 /* Frame Relay Access Device */ #define ARPHRD_SKIP 771 /* SKIP vif */ #define ARPHRD_LOOPBACK 772 /* Loopback device */ #define ARPHRD_LOCALTLK 773 /* Localtalk device */ -#define ARPHRD_FDDI 774 /* FDDI interfaces */ +#define ARPHRD_FDDI 774 /* Fiber Distributed Data Interface */ +#define ARPHRD_BIF 775 /* AP1000 BIF */ #define ARPHRD_SIT 776 /* sit0 device - IPv6-in-IPv4 */ +#define ARPHRD_IPDDP 777 /* IP over DDP tunneller */ /* ARP protocol opcodes. */ #define ARPOP_REQUEST 1 /* ARP request */ @@ -87,6 +89,8 @@ struct arpreq_old { #define ATF_USETRAILERS 0x10 /* has requested trailers */ #define ATF_NETMASK 0x20 /* want to use a netmask (only for proxy entries) */ +#define ATF_DONTPUB 0x40 /* don't answer this addresses */ +#define ATF_MAGIC 0x80 /* automatically added entry */ /* * This structure defines an ethernet arp header. diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h index dd09d8352..213251b23 100644 --- a/include/linux/if_ether.h +++ b/include/linux/if_ether.h @@ -85,35 +85,11 @@ struct ethhdr }; /* - * Ethernet statistics collection data. + * We Have changed the ethernet statistics collection data. This + * is just for partial compatibility for now. */ -struct enet_statistics -{ - int rx_packets; /* total packets received */ - int tx_packets; /* total packets transmitted */ - int rx_errors; /* bad packets received */ - int tx_errors; /* packet transmit problems */ - int rx_dropped; /* no space in linux buffers */ - int tx_dropped; /* no space available in linux */ - int multicast; /* multicast packets received */ - int collisions; - - /* detailed rx_errors: */ - int rx_length_errors; - int rx_over_errors; /* receiver ring buff overflow */ - int rx_crc_errors; /* recved pkt with crc error */ - int rx_frame_errors; /* recv'd frame alignment error */ - int rx_fifo_errors; /* recv'r fifo overrun */ - int rx_missed_errors; /* receiver missed packet */ - - /* detailed tx_errors */ - int tx_aborted_errors; - int tx_carrier_errors; - int tx_fifo_errors; - int tx_heartbeat_errors; - int tx_window_errors; -}; - + +#define enet_statistics net_device_stats #endif /* _LINUX_IF_ETHER_H */ diff --git a/include/linux/if_ltalk.h b/include/linux/if_ltalk.h new file mode 100644 index 000000000..d7b17d323 --- /dev/null +++ b/include/linux/if_ltalk.h @@ -0,0 +1,12 @@ +#ifndef __LINUX_LTALK_H +#define __LINUX_LTALK_H + +#define LTALK_HLEN 1 +#define LTALK_MTU 600 +#define LTALK_ALEN 1 + +#ifdef __KERNEL__ +extern void ltalk_setup(struct device *); +#endif + +#endif diff --git a/include/linux/if_pppvar.h b/include/linux/if_pppvar.h index 1c7eb4f6d..2538d3408 100644 --- a/include/linux/if_pppvar.h +++ b/include/linux/if_pppvar.h @@ -1,4 +1,4 @@ -/* $Id: if_pppvar.h,v 1.2 1995/06/12 11:36:51 paulus Exp $ */ +/* $Id: if_pppvar.h,v 1.3 1996/09/01 07:45:23 davem Exp $ */ /* * if_pppvar.h - private structures and declarations for PPP. * @@ -93,7 +93,7 @@ struct ppp { __s32 magic; /* magic value for structure */ /* Bitmapped flag fields. */ - __u8 inuse; /* are we allocated? */ + __u32 inuse; /* are we allocated? */ __u8 escape; /* 0x20 if prev char was PPP_ESC*/ __u8 toss; /* toss this frame */ diff --git a/include/linux/if_tr.h b/include/linux/if_tr.h index 545f1b7f0..bfbf72525 100644 --- a/include/linux/if_tr.h +++ b/include/linux/if_tr.h @@ -35,6 +35,7 @@ /* These are some defined Ethernet Protocol ID's. */ +/* FIXME: should use the definitions in if_ether.h!!! */ #define ETH_P_IP 0x0800 /* Internet Protocol packet */ #define ETH_P_ARP 0x0806 /* Address Resolution packet */ #define ETH_P_RARP 0x8035 /* Reverse Addr Res packet */ @@ -94,8 +95,8 @@ struct tr_statistics { #define TR_RII 0x80 #define TR_RCF_DIR_BIT 0x80 #define TR_RCF_LEN_MASK 0x1f00 -#define TR_RCF_BROADCAST 0x8000 -#define TR_RCF_LIMITED_BROADCAST 0xA000 +#define TR_RCF_BROADCAST 0x8000 /* all-routes broadcast */ +#define TR_RCF_LIMITED_BROADCAST 0xC000 /* single-route broadcast */ #define TR_RCF_FRAME2K 0x20 #define TR_RCF_BROADCAST_MASK 0xC000 diff --git a/include/linux/igmp.h b/include/linux/igmp.h index 82569a653..b4a16b565 100644 --- a/include/linux/igmp.h +++ b/include/linux/igmp.h @@ -36,7 +36,7 @@ struct igmphdr #define IGMP_HOST_MEMBERSHIP_REPORT 0x12 /* Ditto */ #define IGMP_DVMRP 0x13 /* DVMRP routing */ #define IGMP_PIM 0x14 /* PIM routing */ -#define IGMP_TRACE 0x15 /* CISCO trace */ +#define IGMP_TRACE 0x15 #define IGMP_HOST_NEW_MEMBERSHIP_REPORT 0x16 /* New version of 0x11 */ #define IGMP_HOST_LEAVE_MESSAGE 0x17 /* An extra BSD seems to send */ @@ -91,9 +91,9 @@ struct ip_mc_list unsigned long multiaddr; struct ip_mc_list *next; struct timer_list timer; - short tm_running; - short reporter; int users; + char tm_running; + char reporter; }; struct ip_router_info @@ -108,8 +108,7 @@ struct ip_router_info extern struct ip_mc_list *ip_mc_head; -extern int igmp_rcv(struct sk_buff *, struct device *, struct options *, __u32, unsigned short, - __u32, int , struct inet_protocol *); +extern int igmp_rcv(struct sk_buff *, unsigned short); extern void ip_mc_drop_device(struct device *dev); extern int ip_mc_join_group(struct sock *sk, struct device *dev, unsigned long addr); extern int ip_mc_leave_group(struct sock *sk, struct device *dev,unsigned long addr); diff --git a/include/linux/in.h b/include/linux/in.h index 61566713f..0b77670e1 100644 --- a/include/linux/in.h +++ b/include/linux/in.h @@ -33,7 +33,6 @@ enum { IPPROTO_IDP = 22, /* XNS IDP protocol */ IPPROTO_IPV6 = 41, /* IPv6-in-IPv4 tunnelling */ - IPPROTO_ICMPV6 = 58, /* ICMPv6 */ IPPROTO_RAW = 255, /* Raw IP packets */ IPPROTO_MAX @@ -45,6 +44,42 @@ struct in_addr { __u32 s_addr; }; +#define IP_TOS 1 +#define IP_TTL 2 +#define IP_HDRINCL 3 +#define IP_OPTIONS 4 +#define IP_LOCALADDR 5 /* Cannot remove; a lot of apps still use it. ANK */ +#define IP_RECVOPTS 6 +#define IP_RETOPTS 7 +#define IP_RXINFO 8 +#define IP_TXINFO IP_RXINFO +/* Gated uses it. Remove later or preserve for 4.4BSD compatibility??? */ +#define IP_RECVDSTADDR 9 +#define IP_PMTUDISC 10 +#define IP_RECVERR 11 + +/* BSD compatibility */ +#define IP_RECVRETOPTS IP_RETOPTS + +/* IP_PMTUDISC values */ +#define IP_PMTUDISC_WANT 0 /* Use per route hints */ +#define IP_PMTUDISC_DONT 1 /* Never send DF frames */ +#define IP_PMTUDISC_DO 2 /* Always DF */ + +#define IP_MULTICAST_IF 32 +#define IP_MULTICAST_TTL 33 +#define IP_MULTICAST_LOOP 34 +#define IP_ADD_MEMBERSHIP 35 +#define IP_DROP_MEMBERSHIP 36 +#define IP_MULTICAST_IFN 37 +#define IP_ADD_MEMBERSHIPN 38 +#define IP_DROP_MEMBERSHIPN 39 + +/* These need to appear somewhere around here */ +#define IP_DEFAULT_MULTICAST_TTL 1 +#define IP_DEFAULT_MULTICAST_LOOP 1 +#define IP_MAX_MEMBERSHIPS 20 + /* Request struct for multicast socket ops */ struct ip_mreq @@ -53,6 +88,19 @@ struct ip_mreq struct in_addr imr_interface; /* local IP address of interface */ }; +struct ip_mreqn +{ + struct in_addr imr_multiaddr; /* IP multicast address of group */ + struct in_addr imr_address; /* local IP address of interface */ + int imr_ifindex; /* Interface index */ +}; + +struct in_pktinfo +{ + int ipi_ifindex; + struct in_addr ipi_spec_dst; + struct in_addr ipi_addr; +}; /* Structure describing an Internet (IP) socket address. */ #define __SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */ @@ -94,8 +142,8 @@ struct sockaddr_in { #define IN_MULTICAST(a) IN_CLASSD(a) #define IN_MULTICAST_NET 0xF0000000 -#define IN_EXPERIMENTAL(a) ((((long int) (a)) & 0xe0000000) == 0xe0000000) -#define IN_BADCLASS(a) ((((long int) (a)) & 0xf0000000) == 0xf0000000) +#define IN_EXPERIMENTAL(a) ((((long int) (a)) & 0xf0000000) == 0xf0000000) +#define IN_BADCLASS(a) IN_EXPERIMENTAL((a)) /* Address to accept any incoming messages. */ #define INADDR_ANY ((unsigned long int) 0x00000000) @@ -114,9 +162,10 @@ struct sockaddr_in { #define IN_LOOPBACK(a) ((((long int) (a)) & 0xff000000) == 0x7f000000) /* Defines for Multicast INADDR */ -#define INADDR_UNSPEC_GROUP 0xe0000000 /* 224.0.0.0 */ -#define INADDR_ALLHOSTS_GROUP 0xe0000001 /* 224.0.0.1 */ -#define INADDR_MAX_LOCAL_GROUP 0xe00000ff /* 224.0.0.255 */ +#define INADDR_UNSPEC_GROUP 0xe0000000U /* 224.0.0.0 */ +#define INADDR_ALLHOSTS_GROUP 0xe0000001U /* 224.0.0.1 */ +#define INADDR_ALLRTRS_GROUP 0xe0000002U /* 224.0.0.2 */ +#define INADDR_MAX_LOCAL_GROUP 0xe00000ffU /* 224.0.0.255 */ /* <asm/byteorder.h> contains the htonl type stuff.. */ @@ -126,6 +175,9 @@ struct sockaddr_in { /* Some random defines to make it easier in the kernel.. */ #define LOOPBACK(x) (((x) & htonl(0xff000000)) == htonl(0x7f000000)) #define MULTICAST(x) (((x) & htonl(0xf0000000)) == htonl(0xe0000000)) +#define BADCLASS(x) (((x) & htonl(0xf0000000)) == htonl(0xf0000000)) +#define ZERONET(x) (((x) & htonl(0xff000000)) == htonl(0x00000000)) +#define LOCAL_MCAST(x) (((x) & htonl(0xFFFFFF00)) == htonl(0xE0000000)) #endif diff --git a/include/linux/in6.h b/include/linux/in6.h index 781d7339d..9a6954c29 100644 --- a/include/linux/in6.h +++ b/include/linux/in6.h @@ -31,12 +31,14 @@ struct in6_addr union { __u8 u6_addr8[16]; + __u16 u6_addr16[8]; __u32 u6_addr32[4]; #if (~0UL) > 0xffffffff __u64 u6_addr64[2]; #endif } in6_u; #define s6_addr in6_u.u6_addr8 +#define s6_addr16 in6_u.u6_addr16 #define s6_addr32 in6_u.u6_addr32 #define s6_addr64 in6_u.u6_addr64 }; @@ -86,6 +88,18 @@ struct ipv6_mreq { #define IPV6_PRIORITY_15 0x0f00 /* + * IPV6 extension headers + */ +#define IPPROTO_HOPOPTS 0 /* IPv6 hop-by-hop options */ +#define IPPROTO_ROUTING 43 /* IPv6 routing header */ +#define IPPROTO_FRAGMENT 44 /* IPv6 fragmentation header */ +#define IPPROTO_ESP 50 /* encapsulating security payload */ +#define IPPROTO_AH 51 /* authentication header */ +#define IPPROTO_ICMPV6 58 /* ICMPv6 */ +#define IPPROTO_NONE 59 /* IPv6 no next header */ +#define IPPROTO_DSTOPTS 60 /* IPv6 destination options */ + +/* * IPV6 socket options */ @@ -96,6 +110,7 @@ struct ipv6_mreq { #define IPV6_RXSRCRT 5 #define IPV6_PKTOPTIONS 6 #define IPV6_CHECKSUM 7 +#define IPV6_HOPLIMIT 8 /* * Alternative names diff --git a/include/linux/init.h b/include/linux/init.h new file mode 100644 index 000000000..67a3caaac --- /dev/null +++ b/include/linux/init.h @@ -0,0 +1,51 @@ +#ifndef _LINUX_INIT_H +#define _LINUX_INIT_H + +/* These macros are used to mark some functions or + * initialized data (doesn't apply to uninitialized data) + * as `initialization' functions. The kernel can take this + * as hint that the function is used only during the initialization + * phase and free up used memory resources after + * + * Usage: + * For functions: + * you can surround the whole function declaration + * just before function body into __initfunc() macro, like: + * + * __initfunc (static void initme(int x, int y)) + * { + * extern int z; z = x * y; + * } + * + * if the function has a prototype somewhere, you can also add + * __init between closing brace of the prototype and semicolon: + * + * extern int initialize_foobar_device(int, int, int) __init; + * + * For initialized data: + * you should insert __initdata between the variable name and equal + * sign followed by value, e.g.: + * + * static int init_variable __initdata = 0; + * static char linux_logo[] __initdata = { 0x32, 0x36, ... }; + */ + +/* + * Disable the __initfunc macros if a file that is a part of a + * module attempts to use them. We do not want to interfere + * with module linking. + */ + +#ifndef MODULE +#include <asm/init.h> +#else +#define __init +#define __initdata +#define __initfunc(__arginit) __arginit +/* For assembly routines */ +#define __INIT +#define __FINIT +#define __INITDATA +#endif + +#endif diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index 77cd07c8f..7c8bbd9d0 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h @@ -4,6 +4,7 @@ #include <linux/kernel.h> #include <asm/bitops.h> +#include <asm/atomic.h> struct irqaction { void (*handler)(int, void *, struct pt_regs *); @@ -14,7 +15,7 @@ struct irqaction { struct irqaction *next; }; -extern unsigned long intr_count; +extern volatile unsigned char bh_running; extern int bh_mask_count[32]; extern unsigned long bh_active; @@ -33,6 +34,7 @@ enum { DIGI_BH, SERIAL_BH, RISCOM8_BH, + ESP_BH, NET_BH, IMMEDIATE_BH, KEYBOARD_BH, @@ -40,49 +42,8 @@ enum { CM206_BH }; -extern inline void init_bh(int nr, void (*routine)(void)) -{ - bh_base[nr] = routine; - bh_mask_count[nr] = 0; - bh_mask |= 1 << nr; -} - -extern inline void mark_bh(int nr) -{ - set_bit(nr, &bh_active); -} - -/* - * These use a mask count to correctly handle - * nested disable/enable calls - */ -extern inline void disable_bh(int nr) -{ - bh_mask &= ~(1 << nr); - bh_mask_count[nr]++; -} - -extern inline void enable_bh(int nr) -{ - if (!--bh_mask_count[nr]) - bh_mask |= 1 << nr; -} - -/* - * start_bh_atomic/end_bh_atomic also nest - * naturally by using a counter - */ -extern inline void start_bh_atomic(void) -{ - intr_count++; - barrier(); -} - -extern inline void end_bh_atomic(void) -{ - barrier(); - intr_count--; -} +#include <asm/hardirq.h> +#include <asm/softirq.h> /* * Autoprobing for irqs: diff --git a/include/linux/ioport.h b/include/linux/ioport.h index 335e3b65f..838eb5300 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h @@ -17,11 +17,16 @@ * If you unload the driver, use release_region to free ports. */ extern void reserve_setup(char *str, int *ints); -extern int check_region(unsigned int from, unsigned int extent); -extern void request_region(unsigned int from, unsigned int extent,const char *name); -extern void release_region(unsigned int from, unsigned int extent); +extern int check_region(unsigned long from, unsigned long extent); +extern void request_region(unsigned long from, unsigned long extent,const char *name); +extern void release_region(unsigned long from, unsigned long extent); extern int get_ioport_list(char *); +#ifdef __sparc__ +extern unsigned long occupy_region(unsigned long base, unsigned long end, + unsigned long num, unsigned int align, + const char *name); +#endif #define HAVE_AUTOIRQ extern void *irq2dev_map[16]; /* Use only if you own the IRQ. */ diff --git a/include/linux/ip.h b/include/linux/ip.h index 74d0fa81a..538cede73 100644 --- a/include/linux/ip.h +++ b/include/linux/ip.h @@ -18,17 +18,54 @@ #define _LINUX_IP_H #include <asm/byteorder.h> -#define IPOPT_END 0 -#define IPOPT_NOOP 1 -#define IPOPT_SEC 130 -#define IPOPT_LSRR 131 -#define IPOPT_SSRR 137 -#define IPOPT_RR 7 -#define IPOPT_SID 136 -#define IPOPT_TIMESTAMP 68 +/* SOL_IP socket options */ +#define IPTOS_TOS_MASK 0x1E +#define IPTOS_TOS(tos) ((tos)&IPTOS_TOS_MASK) +#define IPTOS_LOWDELAY 0x10 +#define IPTOS_THROUGHPUT 0x08 +#define IPTOS_RELIABILITY 0x04 +#define IPTOS_MINCOST 0x02 +#define IPTOS_PREC_MASK 0xE0 +#define IPTOS_PREC(tos) ((tos)&IPTOS_PREC_MASK) +#define IPTOS_PREC_NETCONTROL 0xe0 +#define IPTOS_PREC_INTERNETCONTROL 0xc0 +#define IPTOS_PREC_CRITIC_ECP 0xa0 +#define IPTOS_PREC_FLASHOVERRIDE 0x80 +#define IPTOS_PREC_FLASH 0x60 +#define IPTOS_PREC_IMMEDIATE 0x40 +#define IPTOS_PREC_PRIORITY 0x20 +#define IPTOS_PREC_ROUTINE 0x00 + + +/* IP options */ +#define IPOPT_COPY 0x80 +#define IPOPT_CLASS_MASK 0x60 +#define IPOPT_NUMBER_MASK 0x1f + +#define IPOPT_COPIED(o) ((o)&IPOPT_COPY) +#define IPOPT_CLASS(o) ((o)&IPOPT_CLASS_MASK) +#define IPOPT_NUMBER(o) ((o)&IPOPT_NUMBER_MASK) + +#define IPOPT_CONTROL 0x00 +#define IPOPT_RESERVED1 0x20 +#define IPOPT_MEASUREMENT 0x40 +#define IPOPT_RESERVED2 0x60 + +#define IPOPT_END (0 |IPOPT_CONTROL) +#define IPOPT_NOOP (1 |IPOPT_CONTROL) +#define IPOPT_SEC (2 |IPOPT_CONTROL|IPOPT_COPY) +#define IPOPT_LSRR (3 |IPOPT_CONTROL|IPOPT_COPY) +#define IPOPT_TIMESTAMP (4 |IPOPT_MEASUREMENT) +#define IPOPT_RR (7 |IPOPT_CONTROL) +#define IPOPT_SID (8 |IPOPT_CONTROL|IPOPT_COPY) +#define IPOPT_SSRR (9 |IPOPT_CONTROL|IPOPT_COPY) +#define IPOPT_RA (20|IPOPT_CONTROL|IPOPT_COPY) + +#define IPVERSION 4 #define MAXTTL 255 +#define IPDEFTTL 64 struct timestamp { __u8 len; @@ -67,7 +104,7 @@ struct route { #define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */ #define IPOPT_TS_PRESPEC 2 /* specified modules only */ -struct options { +struct ip_options { __u32 faddr; /* Saved first hop address */ unsigned char optlen; unsigned char srr; @@ -81,9 +118,9 @@ struct options { rr_needaddr:1, /* Need to record addr of outgoing dev */ ts_needtime:1, /* Need to record timestamp */ ts_needaddr:1; /* Need to record addr of outgoing dev */ + unsigned char router_alert; unsigned char __pad1; unsigned char __pad2; - unsigned char __pad3; unsigned char __data[0]; }; diff --git a/include/linux/ipsec.h b/include/linux/ipsec.h new file mode 100644 index 000000000..b9d7bcc63 --- /dev/null +++ b/include/linux/ipsec.h @@ -0,0 +1,69 @@ +/* + * Definitions for the SECurity layer + * + * Author: + * Robert Muchsel <muchsel@acm.org> + * + * 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. + */ + +#ifndef _LINUX_IPSEC_H +#define _LINUX_IPSEC_H + +#include <linux/config.h> +#include <linux/socket.h> +#include <net/sock.h> +#include <linux/skbuff.h> + +/* Values for the set/getsockopt calls */ + +/* These defines are compatible with NRL IPv6, however their semantics + is different */ + +#define IPSEC_LEVEL_NONE -1 /* send plaintext, accept any */ +#define IPSEC_LEVEL_DEFAULT 0 /* encrypt/authenticate if possible */ + /* the default MUST be 0, because a */ + /* socket is initialized with 0's */ +#define IPSEC_LEVEL_USE 1 /* use outbound, don't require inbound */ +#define IPSEC_LEVEL_REQUIRE 2 /* require both directions */ +#define IPSEC_LEVEL_UNIQUE 2 /* for compatibility only */ + +#ifdef __KERNEL__ + +/* skb bit flags set on packet input processing */ + +#define RCV_SEC 0x0f /* options on receive */ +#define RCV_AUTH 0x01 /* was authenticated */ +#define RCV_CRYPT 0x02 /* was encrypted */ +#define RCV_TUNNEL 0x04 /* was tunneled */ +#define SND_SEC 0xf0 /* options on send, these are */ +#define SND_AUTH 0x10 /* currently unused */ +#define SND_CRYPT 0x20 +#define SND_TUNNEL 0x40 + +/* + * FIXME: ignores network encryption for now.. + */ + +#ifdef CONFIG_NET_SECURITY +extern __inline__ int ipsec_sk_policy(struct sock *sk, struct sk_buff *skb) +{ + return ((sk->authentication < IPSEC_LEVEL_REQUIRE) || + (skb->security & RCV_AUTH)) && + ((sk->encryption < IPSEC_LEVEL_REQUIRE) || + (skb->security & RCV_CRYPT)); +} + +#else + +extern __inline__ int ipsec_sk_policy(struct sock *sk, struct sk_buff *skb) +{ + return 1; +} +#endif /* CONFIG */ + +#endif /* __KERNEL__ */ +#endif /* _LINUX_IPSEC_H */ diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index b8126a9f2..478c8503c 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h @@ -4,35 +4,6 @@ #include <linux/in6.h> #include <asm/byteorder.h> -/* - * IPv6 fixed header - */ - -struct ipv6hdr { -#if defined(__LITTLE_ENDIAN_BITFIELD) - __u8 priority:4, - version:4; -#elif defined(__BIG_ENDIAN_BITFIELD) - __u8 version:4, - priority:4; -#else -#error "Please fix <asm/byteorder.h>" -#endif - __u8 flow_lbl[3]; - - __u16 payload_len; - __u8 nexthdr; - __u8 hop_limit; - - struct in6_addr saddr; - struct in6_addr daddr; -}; - -struct in6_ifreq { - struct in6_addr addr; - __u32 prefix_len; - char devname[8]; -}; /* * Advanced API @@ -46,6 +17,13 @@ struct in6_pktinfo { int ipi6_ifindex; }; + +struct in6_ifreq { + struct in6_addr ifr6_addr; + __u32 ifr6_prefixlen; + int ifr6_ifindex; +}; + #define IPV6_SRCRT_STRICT 0x01 /* this hop must be a neighbor */ #define IPV6_SRCRT_TYPE_0 0 /* IPv6 type 0 Routing Header */ @@ -79,6 +57,30 @@ struct rt0_hdr { #ifdef __KERNEL__ /* + * IPv6 fixed header + */ + +struct ipv6hdr { +#if defined(__LITTLE_ENDIAN_BITFIELD) + __u8 priority:4, + version:4; +#elif defined(__BIG_ENDIAN_BITFIELD) + __u8 version:4, + priority:4; +#else +#error "Please fix <asm/byteorder.h>" +#endif + __u8 flow_lbl[3]; + + __u16 payload_len; + __u8 nexthdr; + __u8 hop_limit; + + struct in6_addr saddr; + struct in6_addr daddr; +}; + +/* * The length of this struct cannot be greater than the length of * the proto_priv field in a sk_buff which is currently * defined to be 16 bytes. diff --git a/include/linux/ipv6_route.h b/include/linux/ipv6_route.h index ef93e022b..97e63e362 100644 --- a/include/linux/ipv6_route.h +++ b/include/linux/ipv6_route.h @@ -13,26 +13,26 @@ #ifndef _LINUX_IPV6_ROUTE_H #define _LINUX_IPV6_ROUTE_H -#include <linux/route.h> -#define RTI_DEVRT 0x00010000 /* route lookup, dev must match */ -#define RTI_ALLONLINK 0x00020000 /* all destinations on link */ -#define RTI_DCACHE RTF_DCACHE /* rt6_info is a dcache entry */ -#define RTI_INVALID RTF_INVALID /* invalid route/dcache entry */ +#define RTF_DEFAULT 0x00010000 /* default - learned via ND */ +#define RTF_ALLONLINK 0x00020000 /* fallback, no routers on link */ +#define RTF_ADDRCONF 0x00040000 /* addrconf route - RA */ -#define RTI_DYNAMIC RTF_DYNAMIC /* rt6_info created dynamicly */ -#define RTI_GATEWAY RTF_GATEWAY -#define RTI_DYNMOD RTF_MODIFIED /* more specific route may exist*/ +#define RTF_LINKRT 0x00100000 /* link specific - device match */ +#define RTF_NONEXTHOP 0x00200000 /* route with no nexthop */ -#define DCF_PMTU RTF_MSS /* dest cache has valid PMTU */ -#define DCF_INVALID RTF_INVALID +#define RTF_CACHE 0x01000000 /* cache entry */ +#define RTF_FLOW 0x02000000 /* flow significant route */ +#define RTF_POLICY 0x04000000 /* policy route */ struct in6_rtmsg { struct in6_addr rtmsg_dst; + struct in6_addr rtmsg_src; struct in6_addr rtmsg_gateway; __u32 rtmsg_type; - __u16 rtmsg_prefixlen; - __u16 rtmsg_metric; + __u16 rtmsg_dst_len; + __u16 rtmsg_src_len; + __u32 rtmsg_metric; unsigned long rtmsg_info; __u32 rtmsg_flags; int rtmsg_ifindex; diff --git a/include/linux/ipx.h b/include/linux/ipx.h index a2d86a983..43ff8b36b 100644 --- a/include/linux/ipx.h +++ b/include/linux/ipx.h @@ -1,6 +1,7 @@ #ifndef _IPX_H_ #define _IPX_H_ #include <linux/sockios.h> +#include <linux/socket.h> #define IPX_NODE_LEN 6 #define IPX_MTU 576 diff --git a/include/linux/isdn.h b/include/linux/isdn.h index 1408407d9..ca09a6ef9 100644 --- a/include/linux/isdn.h +++ b/include/linux/isdn.h @@ -1,4 +1,4 @@ -/* $Id: isdn.h,v 1.16 1996/08/12 16:20:56 hipp Exp $ +/* $Id: isdn.h,v 1.23 1997/02/10 22:07:13 fritz Exp $ * * Main header for the Linux ISDN subsystem (linklevel). * @@ -21,6 +21,29 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Log: isdn.h,v $ + * Revision 1.23 1997/02/10 22:07:13 fritz + * Added 2 modem registers for numbering plan and screening info. + * + * Revision 1.22 1997/02/03 23:42:08 fritz + * Added ISDN_TIMER_RINGING + * Misc. changes for Kernel 2.1.X compatibility + * + * Revision 1.21 1997/01/17 01:19:10 fritz + * Applied chargeint patch. + * + * Revision 1.20 1997/01/17 00:41:19 fritz + * Increased TTY_DV. + * + * Revision 1.19 1997/01/14 01:41:07 fritz + * Added ATI2 related variables. + * Added variables for audio support in skbuffs. + * + * Revision 1.18 1996/11/06 17:37:50 keil + * more changes for 2.1.X + * + * Revision 1.17 1996/09/07 12:53:57 hipp + * moved a few isdn_ppp.c specific defines to drives/isdn/isdn_ppp.h + * * Revision 1.16 1996/08/12 16:20:56 hipp * renamed ppp_minor to ppp_slot * @@ -153,7 +176,7 @@ #define ISDN_USAGE_EXCLUSIVE 64 /* This bit is set, if channel is exclusive */ #define ISDN_USAGE_OUTGOING 128 /* This bit is set, if channel is outgoing */ -#define ISDN_MODEM_ANZREG 21 /* Number of Modem-Registers */ +#define ISDN_MODEM_ANZREG 22 /* Number of Modem-Registers */ #define ISDN_MSNLEN 20 typedef struct { @@ -173,8 +196,8 @@ typedef struct { int outgoing; } isdn_net_ioctl_phone; -#define NET_DV 0x01 /* Data version for net_cfg */ -#define TTY_DV 0x01 /* Data version for iprofd etc. */ +#define NET_DV 0x02 /* Data version for net_cfg */ +#define TTY_DV 0x03 /* Data version for iprofd etc. */ typedef struct { char name[10]; /* Name of interface */ @@ -197,6 +220,7 @@ typedef struct { int callback; /* Flag: Callback */ int cbhup; /* Flag: Reject Call before Callback */ int pppbind; /* ippp device for bindings */ + int chargeint; /* Use fixed charge interval length */ } isdn_net_ioctl_cfg; #ifdef __KERNEL__ @@ -212,7 +236,6 @@ typedef struct { #include <linux/kernel.h> #include <linux/signal.h> #include <linux/malloc.h> -#include <linux/mm.h> #include <linux/timer.h> #include <linux/wait.h> #include <linux/tty.h> @@ -274,6 +297,7 @@ typedef struct { #define ISDN_TIMER_RES 3 /* Main Timer-Resolution */ #define ISDN_TIMER_02SEC (HZ/(ISDN_TIMER_RES+1)/5) /* Slow-Timer1 .2 sec */ #define ISDN_TIMER_1SEC (HZ/(ISDN_TIMER_RES+1)) /* Slow-Timer2 1 sec */ +#define ISDN_TIMER_RINGING 5 /* tty RINGs = ISDN_TIMER_1SEC * this factor */ #define ISDN_TIMER_MODEMREAD 1 #define ISDN_TIMER_MODEMPLUS 2 #define ISDN_TIMER_MODEMRING 4 @@ -356,6 +380,7 @@ typedef struct isdn_net_local_s { /* bit0: chargeint is invalid */ /* bit1: Getting charge-interval */ /* bit2: Do charge-unit-hangup */ + /* bit3: Do hangup even on incoming */ int outgoing; /* Flag: outgoing call */ int onhtime; /* Time to keep link up */ int chargeint; /* Interval between charge-infos */ @@ -377,11 +402,21 @@ typedef struct isdn_net_local_s { struct isdn_net_dev_s *netdev; /* Ptr to netdev */ struct sk_buff *first_skb; /* Ptr to skb that triggers dialing */ struct sk_buff *sav_skb; /* Ptr to skb, rejected by LL-driver*/ +#if (LINUX_VERSION_CODE < 0x02010F) /* Ptr to orig. header_cache_bind */ - void (*org_hcb)(struct hh_cache **, struct device *, - unsigned short, __u32); + void (*org_hcb)(struct hh_cache **, + struct device *, + unsigned short, + __u32); +#else + /* Ptr to orig. hard_header_cache */ + int (*org_hhc)(struct dst_entry *dst, + struct dst_entry *neigh, + struct hh_cache *hh); +#endif /* Ptr to orig. header_cache_update */ - void (*org_hcu)(struct hh_cache *, struct device *, + void (*org_hcu)(struct hh_cache *, + struct device *, unsigned char *); int pppbind; /* ippp device for bindings */ } isdn_net_local; @@ -430,6 +465,20 @@ typedef struct isdn_net_dev_s { #define ISDN_SERIAL_TYPE_NORMAL 1 #define ISDN_SERIAL_TYPE_CALLOUT 2 +/* For using sk_buffs with audio we need some private variables + * within each sk_buff. For this purpose, we declare a struct here, + * and put it always at skb->head. A few macros help accessing the + * variables. Of course, we need to check skb_headroom prior to + * any access. + */ +typedef struct isdn_audio_skb { + unsigned short dle_count; + unsigned char lock; +} isdn_audio_skb; + +#define ISDN_AUDIO_SKB_DLECOUNT(skb) (((isdn_audio_skb*)skb->head)->dle_count) +#define ISDN_AUDIO_SKB_LOCK(skb) (((isdn_audio_skb*)skb->head)->lock) + /* Private data of AT-command-interpreter */ typedef struct atemu { u_char profile[ISDN_MODEM_ANZREG]; /* Modem-Regs. Profile 0 */ @@ -465,6 +514,12 @@ typedef struct modem_info { int isdn_channel; /* Index to isdn-channel */ int drv_index; /* Index to dev->usage */ int ncarrier; /* Flag: schedule NO CARRIER */ + unsigned char last_cause[8]; /* Last cause message */ + unsigned char last_num[20]; /* Last phone-number */ + unsigned char last_l2; /* Last layer-2 protocol */ + unsigned char last_si; /* Last service */ + unsigned char last_lhup; /* Last hangup local? */ + unsigned char last_dir; /* Last direction (in or out) */ struct timer_list nc_timer; /* Timer for delayed NO CARRIER */ int send_outstanding;/* # of outstanding send-requests */ int xmit_size; /* max. # of chars in xmit_buf */ @@ -504,11 +559,6 @@ typedef struct { #define NUM_RCV_BUFFS 64 #define PPP_HARD_HDR_LEN 4 -#define IPPP_OPEN 0x1 -#define IPPP_CONNECT 0x2 -#define IPPP_CLOSEWAIT 0x4 -#define IPPP_NOBLOCK 0x8 - #ifdef CONFIG_ISDN_PPP struct sqqueue { diff --git a/include/linux/isdn_ppp.h b/include/linux/isdn_ppp.h index 5ce86f868..026d9ee3b 100644 --- a/include/linux/isdn_ppp.h +++ b/include/linux/isdn_ppp.h @@ -4,18 +4,20 @@ extern int isdn_ppp_dial_slave(char *); extern int isdn_ppp_hangup_slave(char *); -struct pppinfo +#define CALLTYPE_INCOMING 0x1 +#define CALLTYPE_OUTGOING 0x2 +#define CALLTYPE_CALLBACK 0x4 + +struct pppcallinfo { - int type; /* set by user */ - union { - char clid[32]; /* calling ID */ - int bundles; - int linknumber; - } info; + int calltype; + unsigned char local_num[64]; + unsigned char remote_num[64]; + int charge_units; }; -#define PPPIOCLINKINFO _IOWR('t',128,struct pppinfo) +#define PPPIOCGCALLINFO _IOWR('t',128,struct pppcallinfo) #define PPPIOCBUNDLE _IOW('t',129,int) #define PPPIOCGMPFLAGS _IOR('t',130,int) #define PPPIOCSMPFLAGS _IOW('t',131,int) diff --git a/include/linux/isdnif.h b/include/linux/isdnif.h index 113099edf..ca7837180 100644 --- a/include/linux/isdnif.h +++ b/include/linux/isdnif.h @@ -1,4 +1,4 @@ -/* $Id: isdnif.h,v 1.9 1996/06/06 21:24:24 fritz Exp $ +/* $Id: isdnif.h,v 1.17 1997/02/10 21:12:53 fritz Exp $ * * Linux ISDN subsystem * @@ -22,6 +22,30 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Log: isdnif.h,v $ + * Revision 1.17 1997/02/10 21:12:53 fritz + * More setup-interface changes. + * + * Revision 1.16 1997/02/10 19:42:57 fritz + * New interface for reporting incoming calls. + * + * Revision 1.15 1997/02/09 00:18:42 keil + * leased line support + * + * Revision 1.14 1997/02/03 23:43:00 fritz + * Misc changes for Kernel 2.1.X compatibility. + * + * Revision 1.13 1996/11/13 02:39:59 fritz + * More compatibility changes. + * + * Revision 1.12 1996/11/06 17:38:48 keil + * more changes for 2.1.X + * + * Revision 1.11 1996/10/23 11:59:42 fritz + * More compatibility changes. + * + * Revision 1.10 1996/10/22 23:14:19 fritz + * Changes for compatibility to 2.0.X and 2.1.X kernels. + * * Revision 1.9 1996/06/06 21:24:24 fritz * Started adding support for suspend/resume. * @@ -64,6 +88,7 @@ #define ISDN_PTYPE_UNKNOWN 0 /* Protocol undefined */ #define ISDN_PTYPE_1TR6 1 /* german 1TR6-protocol */ #define ISDN_PTYPE_EURO 2 /* EDSS1-protocol */ +#define ISDN_PTYPE_LEASED 3 /* for leased lines */ /* * Values for Layer-2-protocol-selection @@ -145,6 +170,15 @@ #define ISDN_FEATURE_P_1TR6 (0x1000 << ISDN_PTYPE_1TR6) #define ISDN_FEATURE_P_EURO (0x1000 << ISDN_PTYPE_EURO) +typedef struct setup_parm { + char phone[32]; /* Remote Phone-Number */ + char eazmsn[32]; /* Local EAZ or MSN */ + unsigned char si1; /* Service Indicator 1 */ + unsigned char si2; /* Service Indicator 2 */ + unsigned char plan; /* Numbering plan */ + unsigned char screen; /* Screening info */ +} setup_parm; + /* * Structure for exchanging above infos * @@ -153,7 +187,10 @@ typedef struct { int driver; /* Lowlevel-Driver-ID */ int command; /* Command or Status (see above) */ ulong arg; /* Additional Data */ - char num[50]; /* Additional Data */ + union { + char num[50]; /* Additional Data */ + setup_parm setup; + } parm; } isdn_ctrl; /* @@ -302,6 +339,35 @@ typedef struct { */ extern int register_isdn(isdn_if*); +/* Compatibility Linux-2.0.X <-> Linux-2.1.X */ + +#ifndef LINUX_VERSION_CODE +#include <linux/version.h> +#endif +#if (LINUX_VERSION_CODE < 0x020100) +#include <linux/mm.h> +#define copy_from_user memcpy_fromfs +#define copy_to_user memcpy_tofs +#define GET_USER(x, addr) ( x = get_user(addr) ) +#define RWTYPE int +#define LSTYPE int +#define RWARG int +#define LSARG off_t +#define SET_SKB_FREE(x) ( x->free = 1 ) +#else +#include <asm/uaccess.h> +#define GET_USER get_user +#define PUT_USER put_user +#define RWTYPE long +#define LSTYPE long long +#define RWARG unsigned long +#define LSARG long long +#if (LINUX_VERSION_CODE < 0x02010F) +#define SET_SKB_FREE(x) ( x->free = 1 ) +#else +#define SET_SKB_FREE(x) +#endif +#endif + #endif /* __KERNEL__ */ #endif /* isdnif_h */ - diff --git a/include/linux/istallion.h b/include/linux/istallion.h index 1cf916ad4..e1bf37264 100644 --- a/include/linux/istallion.h +++ b/include/linux/istallion.h @@ -3,6 +3,7 @@ /* * istallion.h -- stallion intelligent multiport serial driver. * + * Copyright (C) 1996-1997 Stallion Technologies (support@stallion.oz.au). * Copyright (C) 1994-1996 Greg Ungerer (gerg@stallion.oz.au). * * This program is free software; you can redistribute it and/or modify diff --git a/include/linux/keyboard.h b/include/linux/keyboard.h index 57a5323e1..91dacb14d 100644 --- a/include/linux/keyboard.h +++ b/include/linux/keyboard.h @@ -19,10 +19,13 @@ may increase the number of keymaps beyond MAX_NR_OF_USER_KEYMAPS. */ #define MAX_NR_OF_USER_KEYMAPS 256 /* should be at least 7 */ +#ifdef __KERNEL__ extern const int NR_TYPES; extern const int max_vals[]; extern unsigned short *key_maps[MAX_NR_KEYMAPS]; extern unsigned short plain_map[NR_KEYS]; +extern struct wait_queue * keypress_wait; +#endif #define MAX_NR_FUNC 256 /* max nr of strings assigned to keys */ diff --git a/include/linux/lapb.h b/include/linux/lapb.h new file mode 100644 index 000000000..bf1825a6b --- /dev/null +++ b/include/linux/lapb.h @@ -0,0 +1,56 @@ +/* + * These are the public elements of the Linux LAPB module. + */ + +#ifndef LAPB_KERNEL_H +#define LAPB_KERNEL_H + +#define LAPB_OK 0 +#define LAPB_BADTOKEN 1 +#define LAPB_INVALUE 2 +#define LAPB_CONNECTED 3 +#define LAPB_NOTCONNECTED 4 +#define LAPB_REFUSED 5 +#define LAPB_TIMEDOUT 6 +#define LAPB_NOMEM 7 + +#define LAPB_STANDARD 0x00 +#define LAPB_EXTENDED 0x01 + +#define LAPB_SLP 0x00 +#define LAPB_MLP 0x02 + +#define LAPB_DTE 0x00 +#define LAPB_DCE 0x04 + +struct lapb_register_struct { + void (*connect_confirmation)(void *token, int reason); + void (*connect_indication)(void *token, int reason); + void (*disconnect_confirmation)(void *token, int reason); + void (*disconnect_indication)(void *token, int reason); + void (*data_indication)(void *token, struct sk_buff *skb); + void (*data_transmit)(void *token, struct sk_buff *skb); +}; + +struct lapb_parms_struct { + unsigned int t1; + unsigned int t1timer; + unsigned int t2; + unsigned int t2timer; + unsigned int n2; + unsigned int n2count; + unsigned int window; + unsigned int state; + unsigned int mode; +}; + +extern int lapb_register(void *token, struct lapb_register_struct *callbacks); +extern int lapb_unregister(void *token); +extern int lapb_getparms(void *token, struct lapb_parms_struct *parms); +extern int lapb_setparms(void *token, struct lapb_parms_struct *parms); +extern int lapb_connect_request(void *token); +extern int lapb_disconnect_request(void *token); +extern int lapb_data_request(void *token, struct sk_buff *skb); +extern int lapb_data_received(void *token, struct sk_buff *skb); + +#endif diff --git a/include/linux/limits.h b/include/linux/limits.h index 14428592c..b99a12bc0 100644 --- a/include/linux/limits.h +++ b/include/linux/limits.h @@ -1,7 +1,7 @@ #ifndef _LINUX_LIMITS_H #define _LINUX_LIMITS_H -#define NR_OPEN 256 +#define NR_OPEN 1024 #define NGROUPS_MAX 32 /* supplemental group IDs are available */ #define ARG_MAX 131072 /* # bytes of args + environ for exec() */ diff --git a/include/linux/linkage.h b/include/linux/linkage.h index c8a7a491a..462a90808 100644 --- a/include/linux/linkage.h +++ b/include/linux/linkage.h @@ -7,7 +7,6 @@ #define asmlinkage #endif -#ifdef __ELF__ #define SYMBOL_NAME_STR(X) #X #define SYMBOL_NAME(X) X #ifdef __STDC__ @@ -15,33 +14,13 @@ #else #define SYMBOL_NAME_LABEL(X) X/**/: #endif -#else -#define SYMBOL_NAME_STR(X) "_"#X -#ifdef __STDC__ -#define SYMBOL_NAME(X) _##X -#define SYMBOL_NAME_LABEL(X) _##X##: -#else -#define SYMBOL_NAME(X) _/**/X -#define SYMBOL_NAME_LABEL(X) _/**/X/**/: -#endif -#endif #if !defined(__i486__) && !defined(__i586__) -#ifdef __ELF__ #define __ALIGN .align 4,0x90 #define __ALIGN_STR ".align 4,0x90" -#else /* __ELF__ */ -#define __ALIGN .align 2,0x90 -#define __ALIGN_STR ".align 2,0x90" -#endif /* __ELF__ */ #else /* __i486__/__i586__ */ -#ifdef __ELF__ #define __ALIGN .align 16,0x90 #define __ALIGN_STR ".align 16,0x90" -#else /* __ELF__ */ -#define __ALIGN .align 4,0x90 -#define __ALIGN_STR ".align 4,0x90" -#endif /* __ELF__ */ #endif /* __i486__/__i586__ */ #ifdef __ASSEMBLY__ diff --git a/include/linux/lockd/bind.h b/include/linux/lockd/bind.h new file mode 100644 index 000000000..4e0aebedb --- /dev/null +++ b/include/linux/lockd/bind.h @@ -0,0 +1,43 @@ +/* + * linux/include/linux/lockd/bind.h + * + * This is the part of lockd visible to nfsd and the nfs client. + * + * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de> + */ + +#ifndef LINUX_LOCKD_BIND_H +#define LINUX_LOCKD_BIND_H + +#include <linux/lockd/nlm.h> + +/* Dummy declarations */ +struct svc_rqst; +struct knfs_fh; +struct svc_client; /* opaque type */ + +/* + * This is the set of functions for lockd->nfsd communication + */ +struct nlmsvc_binding { + void (*exp_readlock)(void); + void (*exp_unlock)(void); + struct svc_client * (*exp_getclient)(struct sockaddr_in *); + u32 (*fopen)(struct svc_rqst *, + struct knfs_fh *, + struct file *); + void (*fclose)(struct file *); + void (*detach)(void); +}; + +extern struct nlmsvc_binding * nlmsvc_ops; + +/* + * Functions exported by the lockd module + */ +extern void nlmsvc_invalidate_client(struct svc_client *clnt); +extern int nlmclnt_proc(struct inode *, int, struct file_lock *); +extern int lockd_up(void); +extern void lockd_down(void); + +#endif /* LINUX_LOCKD_BIND_H */ diff --git a/include/linux/lockd/debug.h b/include/linux/lockd/debug.h new file mode 100644 index 000000000..2a2f97a1f --- /dev/null +++ b/include/linux/lockd/debug.h @@ -0,0 +1,51 @@ +/* + * linux/include/linux/lockd/debug.h + * + * Debugging stuff. + * + * Copyright (C) 1996 Olaf Kirch <okir@monad.swb.de> + */ + +#ifndef LINUX_LOCKD_DEBUG_H +#define LINUX_LOCKD_DEBUG_H + +#ifdef __KERNEL__ + +#include <linux/sunrpc/debug.h> + +/* + * Enable lockd debugging. + * Requires RPC_DEBUG. + */ +#ifdef RPC_DEBUG +# define LOCKD_DEBUG 1 +#endif + +#undef ifdebug +#if defined(RPC_DEBUG) && defined(LOCKD_DEBUG) +# define ifdebug(flag) if (nlm_debug & NLMDBG_##flag) +#else +# define ifdebug(flag) if (0) +#endif + +#ifdef LOCKD_DEBUG +char * nlm_procname(u32); +#endif + +#endif /* __KERNEL__ */ + +/* + * Debug flags + */ +#define NLMDBG_SVC 0x0001 +#define NLMDBG_CLIENT 0x0002 +#define NLMDBG_CLNTLOCK 0x0004 +#define NLMDBG_SVCLOCK 0x0008 +#define NLMDBG_MONITOR 0x0010 +#define NLMDBG_CLNTSUBS 0x0020 +#define NLMDBG_SVCSUBS 0x0040 +#define NLMDBG_HOSTCACHE 0x0080 +#define NLMDBG_ALL 0x7fff + + +#endif /* LINUX_LOCKD_DEBUG_H */ diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h new file mode 100644 index 000000000..72035cc5c --- /dev/null +++ b/include/linux/lockd/lockd.h @@ -0,0 +1,196 @@ +/* + * linux/include/linux/lockd/lockd.h + * + * General-purpose lockd include file. + * + * Copyright (C) 1996 Olaf Kirch <okir@monad.swb.de> + */ + +#ifndef LINUX_LOCKD_LOCKD_H +#define LINUX_LOCKD_LOCKD_H + +#ifdef __KERNEL__ + +#include <linux/in.h> +#include <linux/fs.h> +#include <linux/utsname.h> +#include <linux/nfsd/nfsfh.h> +#include <linux/lockd/bind.h> +#include <linux/lockd/xdr.h> +#include <linux/lockd/debug.h> + +/* + * Version string + */ +#define LOCKD_VERSION "0.4" + +/* + * Default timeout for RPC calls (seconds) + */ +#define LOCKD_DFLT_TIMEO 10 + +/* + * Lockd host handle (used both by the client and server personality). + */ +struct nlm_host { + struct nlm_host * h_next; /* linked list (hash table) */ + struct sockaddr_in h_addr; /* peer address */ + struct svc_client * h_exportent; /* NFS client */ + struct rpc_clnt * h_rpcclnt; /* RPC client to talk to peer */ + char h_name[20]; /* remote hostname */ + u32 h_version; /* interface version */ + unsigned short h_proto; /* transport proto */ + unsigned short h_authflavor; /* RPC authentication type */ + unsigned short h_reclaiming : 1, + h_inuse : 1, + h_monitored : 1; + struct wait_queue * h_gracewait; /* wait while reclaiming */ + u32 h_state; /* pseudo-state counter */ + u32 h_nsmstate; /* true remote NSM state */ + unsigned int h_count; /* reference count */ + struct semaphore h_sema; /* mutex for pmap binding */ + unsigned long h_nextrebind; /* next portmap call */ + unsigned long h_expires; /* eligible for GC */ +}; + +/* + * Memory chunk for NLM client RPC request. + */ +#define NLMCLNT_OHSIZE (sizeof(system_utsname.nodename)+10) +struct nlm_rqst { + unsigned int a_flags; /* initial RPC task flags */ + struct nlm_host * a_host; /* host handle */ + struct nlm_args a_args; /* arguments */ + struct nlm_res a_res; /* result */ + char a_owner[NLMCLNT_OHSIZE]; +}; + +/* + * This struct describes a file held open by lockd on behalf of + * an NFS client. + */ +struct nlm_file { + struct nlm_file * f_next; /* linked list */ + struct knfs_fh f_handle; /* NFS file handle */ + struct file f_file; /* VFS file pointer */ + struct nlm_share * f_shares; /* DOS shares */ + struct nlm_block * f_blocks; /* blocked locks */ + unsigned int f_locks; /* guesstimate # of locks */ + unsigned int f_count; /* reference count */ + struct semaphore f_sema; /* avoid concurrent access */ +}; + +/* + * This is a server block (i.e. a lock requested by some client which + * couldn't be granted because of a conflicting lock). + */ +#define NLM_NEVER (~(unsigned long) 0) +struct nlm_block { + struct nlm_block * b_next; /* linked list (all blocks) */ + struct nlm_block * b_fnext; /* linked list (per file) */ + struct nlm_rqst b_call; /* RPC args & callback info */ + struct svc_serv * b_daemon; /* NLM service */ + struct nlm_host * b_host; /* host handle for RPC clnt */ + unsigned long b_when; /* next re-xmit */ + unsigned int b_id; /* block id */ + unsigned char b_queued; /* re-queued */ + unsigned char b_granted; /* VFS granted lock */ + unsigned char b_incall; /* doing callback */ + unsigned char b_done; /* callback complete */ + struct nlm_file * b_file; /* file in question */ +}; + +/* + * Valid actions for nlmsvc_traverse_files + */ +#define NLM_ACT_CHECK 0 /* check for locks */ +#define NLM_ACT_MARK 1 /* mark & sweep */ +#define NLM_ACT_UNLOCK 2 /* release all locks */ + +/* + * Global variables + */ +extern struct rpc_program nlm_program; +extern struct svc_procedure nlmsvc_procedures[]; +extern unsigned long nlmsvc_grace_period; +extern unsigned long nlmsvc_timeout; + +/* + * Lockd client functions + */ +struct nlm_rqst * nlmclnt_alloc_call(void); +int nlmclnt_call(struct nlm_rqst *, u32); +int nlmclnt_async_call(struct nlm_rqst *, u32, rpc_action); +int nlmclnt_block(struct nlm_host *, struct file_lock *, u32 *); +int nlmclnt_cancel(struct nlm_host *, struct file_lock *); +u32 nlmclnt_grant(struct nlm_lock *); +void nlmclnt_recovery(struct nlm_host *, u32); +int nlmclnt_reclaim(struct nlm_host *, struct file_lock *); +int nlmclnt_setgrantargs(struct nlm_rqst *, struct nlm_lock *); +void nlmclnt_freegrantargs(struct nlm_rqst *); + +/* + * Host cache + */ +struct nlm_host * nlmclnt_lookup_host(struct sockaddr_in *, int, int); +struct nlm_host * nlmsvc_lookup_host(struct svc_rqst *); +struct nlm_host * nlm_lookup_host(struct svc_client *, + struct sockaddr_in *, int, int); +struct rpc_clnt * nlm_bind_host(struct nlm_host *); +void nlm_rebind_host(struct nlm_host *); +void nlm_release_host(struct nlm_host *); +void nlm_shutdown_hosts(void); + +/* + * Server-side lock handling + */ +u32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *, + struct nlm_lock *, int, u32); +u32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *); +u32 nlmsvc_testlock(struct nlm_file *, struct nlm_lock *, + struct nlm_lock *); +u32 nlmsvc_cancel_blocked(struct nlm_file *, struct nlm_lock *); +unsigned long nlmsvc_retry_blocked(void); +int nlmsvc_traverse_blocks(struct nlm_host *, struct nlm_file *, + int action); + +/* + * File handling for the server personality + */ +u32 nlm_lookup_file(struct svc_rqst *, struct nlm_file **, + struct nfs_fh *); +void nlm_release_file(struct nlm_file *); +void nlmsvc_mark_resources(void); +void nlmsvc_free_host_resources(struct nlm_host *); + +extern __inline__ struct inode * +nlmsvc_file_inode(struct nlm_file *file) +{ + return file->f_file.f_inode; +} + +/* + * Compare two host addresses (needs modifying for ipv6) + */ +extern __inline__ int +nlm_cmp_addr(struct sockaddr_in *sin1, struct sockaddr_in *sin2) +{ + return sin1->sin_addr.s_addr == sin2->sin_addr.s_addr; +} + +/* + * Compare two NLM locks. + * When the second lock is of type F_UNLCK, this acts like a wildcard. + */ +extern __inline__ int +nlm_compare_locks(struct file_lock *fl1, struct file_lock *fl2) +{ + return fl1->fl_pid == fl2->fl_pid + && fl1->fl_start == fl2->fl_start + && fl1->fl_end == fl2->fl_end + &&(fl1->fl_type == fl2->fl_type || fl2->fl_type == F_UNLCK); +} + +#endif /* __KERNEL__ */ + +#endif /* LINUX_LOCKD_LOCKD_H */ diff --git a/include/linux/lockd/nlm.h b/include/linux/lockd/nlm.h new file mode 100644 index 000000000..ca606fca2 --- /dev/null +++ b/include/linux/lockd/nlm.h @@ -0,0 +1,52 @@ +/* + * linux/include/linux/lockd/nlm.h + * + * Declarations for the Network Lock Manager protocol. + * + * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de> + */ + +#ifndef LINUX_LOCKD_NLM_H +#define LINUX_LOCKD_NLM_H + +/* Maximum file offset in file_lock.fl_end */ +#ifdef OFFSET_MAX +# define NLM_OFFSET_MAX OFFSET_MAX +#else +# define NLM_OFFSET_MAX ((off_t) 0x7fffffff) +#endif + +/* Return states for NLM */ +enum { + NLM_LCK_GRANTED = 0, + NLM_LCK_DENIED, + NLM_LCK_DENIED_NOLOCKS, + NLM_LCK_BLOCKED, + NLM_LCK_DENIED_GRACE_PERIOD, +}; + +#define NLM_PROGRAM 100021 + +#define NLMPROC_NULL 0 +#define NLMPROC_TEST 1 +#define NLMPROC_LOCK 2 +#define NLMPROC_CANCEL 3 +#define NLMPROC_UNLOCK 4 +#define NLMPROC_GRANTED 5 +#define NLMPROC_TEST_MSG 6 +#define NLMPROC_LOCK_MSG 7 +#define NLMPROC_CANCEL_MSG 8 +#define NLMPROC_UNLOCK_MSG 9 +#define NLMPROC_GRANTED_MSG 10 +#define NLMPROC_TEST_RES 11 +#define NLMPROC_LOCK_RES 12 +#define NLMPROC_CANCEL_RES 13 +#define NLMPROC_UNLOCK_RES 14 +#define NLMPROC_GRANTED_RES 15 +#define NLMPROC_SHARE 20 +#define NLMPROC_UNSHARE 21 +#define NLMPROC_NM_LOCK 22 +#define NLMPROC_FREE_ALL 23 +#define NLMPROC_NSM_NOTIFY 24 /* statd callback */ + +#endif /* LINUX_LOCKD_NLM_H */ diff --git a/include/linux/lockd/share.h b/include/linux/lockd/share.h new file mode 100644 index 000000000..5d8aa325f --- /dev/null +++ b/include/linux/lockd/share.h @@ -0,0 +1,30 @@ +/* + * linux/include/linux/lockd/share.h + * + * DOS share management for lockd. + * + * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de> + */ + +#ifndef LINUX_LOCKD_SHARE_H +#define LINUX_LOCKD_SHARE_H + +/* + * DOS share for a specific file + */ +struct nlm_share { + struct nlm_share * s_next; /* linked list */ + struct nlm_host * s_host; /* client host */ + struct nlm_file * s_file; /* shared file */ + struct xdr_netobj s_owner; /* owner handle */ + u32 s_access; /* access mode */ + u32 s_mode; /* deny mode */ +}; + +u32 nlmsvc_share_file(struct nlm_host *, struct nlm_file *, + struct nlm_args *); +u32 nlmsvc_unshare_file(struct nlm_host *, struct nlm_file *, + struct nlm_args *); +int nlmsvc_traverse_shares(struct nlm_host *, struct nlm_file *, int); + +#endif /* LINUX_LOCKD_SHARE_H */ diff --git a/include/linux/lockd/sm_inter.h b/include/linux/lockd/sm_inter.h new file mode 100644 index 000000000..d93b07466 --- /dev/null +++ b/include/linux/lockd/sm_inter.h @@ -0,0 +1,45 @@ +/* + * linux/include/linux/lockd/sm_inter.h + * + * Declarations for the kernel statd client. + * + * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de> + */ + +#ifndef LINUX_LOCKD_SM_INTER_H +#define LINUX_LOCKD_SM_INTER_H + +#define SM_PROGRAM 100024 +#define SM_VERSION 1 +#define SM_STAT 1 +#define SM_MON 2 +#define SM_UNMON 3 +#define SM_UNMON_ALL 4 +#define SM_SIMU_CRASH 5 +#define SM_NOTIFY 6 + +#define SM_MAXSTRLEN 1024 + +/* + * Arguments for all calls to statd + */ +struct nsm_args { + u32 addr; /* remote address */ + u32 prog; /* RPC callback info */ + u32 vers; + u32 proc; +}; + +/* + * Result returned by statd + */ +struct nsm_res { + u32 status; + u32 state; +}; + +int nsm_monitor(struct nlm_host *); +int nsm_unmonitor(struct nlm_host *); +extern u32 nsm_local_state; + +#endif /* LINUX_LOCKD_SM_INTER_H */ diff --git a/include/linux/lockd/xdr.h b/include/linux/lockd/xdr.h new file mode 100644 index 000000000..631a8fba8 --- /dev/null +++ b/include/linux/lockd/xdr.h @@ -0,0 +1,86 @@ +/* + * linux/include/linux/lockd/xdr.h + * + * XDR types for the NLM protocol + * + * Copyright (C) 1996 Olaf Kirch <okir@monad.swb.de> + */ + +#ifndef LOCKD_XDR_H +#define LOCKD_XDR_H + +#include <linux/fs.h> +#include <linux/nfs.h> +#include <linux/sunrpc/xdr.h> + +extern u32 nlm_granted, nlm_lck_denied, nlm_lck_denied_nolocks, + nlm_lck_blocked, nlm_lck_denied_grace_period; + +/* Lock info passed via NLM */ +struct nlm_lock { + char * caller; + struct nfs_fh fh; + struct xdr_netobj oh; + struct file_lock fl; +}; + +/* + * Generic lockd arguments for all but sm_notify + */ +struct nlm_args { + u32 cookie; + struct nlm_lock lock; + u32 block; + u32 reclaim; + u32 state; + u32 monitor; + u32 fsm_access; + u32 fsm_mode; +}; + +/* + * Generic lockd result + */ +struct nlm_res { + u32 cookie; + u32 status; + struct nlm_lock lock; +}; + +/* + * statd callback when client has rebooted + */ +struct nlm_reboot { + char * mon; + int len; + u32 state; + u32 addr; +}; + +/* + * Contents of statd callback when monitored host rebooted + */ +#define NLMSVC_XDRSIZE sizeof(struct nlm_args) + +void nlmxdr_init(void); +int nlmsvc_decode_testargs(struct svc_rqst *, u32 *, struct nlm_args *); +int nlmsvc_encode_testres(struct svc_rqst *, u32 *, struct nlm_res *); +int nlmsvc_decode_lockargs(struct svc_rqst *, u32 *, struct nlm_args *); +int nlmsvc_decode_cancargs(struct svc_rqst *, u32 *, struct nlm_args *); +int nlmsvc_decode_unlockargs(struct svc_rqst *, u32 *, struct nlm_args *); +int nlmsvc_encode_res(struct svc_rqst *, u32 *, struct nlm_res *); +int nlmsvc_decode_res(struct svc_rqst *, u32 *, struct nlm_res *); +int nlmsvc_encode_void(struct svc_rqst *, u32 *, void *); +int nlmsvc_decode_void(struct svc_rqst *, u32 *, void *); +int nlmsvc_decode_shareargs(struct svc_rqst *, u32 *, struct nlm_args *); +int nlmsvc_encode_shareres(struct svc_rqst *, u32 *, struct nlm_res *); +int nlmsvc_decode_notify(struct svc_rqst *, u32 *, struct nlm_args *); +int nlmsvc_decode_reboot(struct svc_rqst *, u32 *, struct nlm_reboot *); +/* +int nlmclt_encode_testargs(struct rpc_rqst *, u32 *, struct nlm_args *); +int nlmclt_encode_lockargs(struct rpc_rqst *, u32 *, struct nlm_args *); +int nlmclt_encode_cancargs(struct rpc_rqst *, u32 *, struct nlm_args *); +int nlmclt_encode_unlockargs(struct rpc_rqst *, u32 *, struct nlm_args *); + */ + +#endif /* LOCKD_XDR_H */ diff --git a/include/linux/locks.h b/include/linux/locks.h index 9735bc630..37933f63e 100644 --- a/include/linux/locks.h +++ b/include/linux/locks.h @@ -9,12 +9,6 @@ #endif /* - * Unlocked, temporary IO buffer_heads gets moved to the reuse_list - * once their page becomes unlocked. - */ -extern struct buffer_head *reuse_list; - -/* * Buffer cache locking - note that interrupts may only unlock, not * lock buffers. */ diff --git a/include/linux/lp.h b/include/linux/lp.h index 6d488f64a..18076c1af 100644 --- a/include/linux/lp.h +++ b/include/linux/lp.h @@ -78,19 +78,31 @@ #define LP_TIMEOUT_INTERRUPT (60 * HZ) #define LP_TIMEOUT_POLLED (10 * HZ) -#define LP_B(minor) lp_table[(minor)].base /* IO address */ #define LP_F(minor) lp_table[(minor)].flags /* flags for busy, etc. */ -#define LP_S(minor) lp_in(LP_B((minor)) + 1) /* status port */ -#define LP_C(minor) (lp_table[(minor)].base + 2) /* control port */ #define LP_CHAR(minor) lp_table[(minor)].chars /* busy timeout */ #define LP_TIME(minor) lp_table[(minor)].time /* wait time */ #define LP_WAIT(minor) lp_table[(minor)].wait /* strobe wait */ -#define LP_IRQ(minor) lp_table[(minor)].irq /* interrupt # */ +#define LP_IRQ(minor) lp_table[(minor)].dev->port->irq /* interrupt # */ /* 0 means polled */ #define LP_STAT(minor) lp_table[(minor)].stats /* statistics area */ - #define LP_BUFFER_SIZE 256 +#define LP_BASE(x) lp_table[(x)].dev->port->base + +#define r_dtr(x) inb(LP_BASE(x)) +#define r_str(x) inb(LP_BASE(x)+1) +#define r_ctr(x) inb(LP_BASE(x)+2) +#define r_epp(x) inb(LP_BASE(x)+4) +#define r_fifo(x) inb(LP_BASE(x)+0x400) +#define r_ecr(x) inb(LP_BASE(x)+0x402) + +#define w_dtr(x,y) outb((y), LP_BASE(x)) +#define w_str(x,y) outb((y), LP_BASE(x)+1) +#define w_ctr(x,y) outb((y), LP_BASE(x)+2) +#define w_epp(x,y) outb((y), LP_BASE(x)+4) +#define w_fifo(x,y) outb((y), LP_BASE(x)+0x400) +#define w_ecr(x,y) outb((y), LP_BASE(x)+0x402) + struct lp_stats { unsigned long chars; unsigned long sleeps; @@ -101,8 +113,7 @@ struct lp_stats { }; struct lp_struct { - unsigned int base; - unsigned int irq; + struct ppd *dev; int flags; unsigned int chars; unsigned int time; diff --git a/include/linux/lp_intern.h b/include/linux/lp_intern.h index b6601c0b3..c7af535fb 100644 --- a/include/linux/lp_intern.h +++ b/include/linux/lp_intern.h @@ -16,7 +16,7 @@ #include <linux/types.h> #include <linux/lp_m68k.h> -int lp_internal_init(struct lp_struct *, int, int, int); +int lp_internal_init(void); #endif diff --git a/include/linux/lp_m68k.h b/include/linux/lp_m68k.h index 26d078110..6cd60e19d 100644 --- a/include/linux/lp_m68k.h +++ b/include/linux/lp_m68k.h @@ -13,8 +13,11 @@ * Interrupt support added 1993 Nigel Gamble */ -#include <linux/autoconf.h> -#include <asm/bootinfo.h> +/* + * many many printers are we going to support? currently, this is the + * hardcoded limit + */ +#define MAX_LP 5 /* * Per POSIX guidelines, this module reserves the LP and lp prefixes @@ -84,6 +87,17 @@ #define LP_BUFFER_SIZE 1024 /*256*/ +enum lp_type { +LP_UNKNOWN = 0, +LP_AMIGA = 1, +LP_ATARI = 2, +LP_MFC = 3 +}; + +/* + * warning: this structure is in kernel space and has to fit in one page, + * i.e. must not be larger than 4k + */ struct lp_struct { char *name; unsigned int irq; @@ -92,18 +106,27 @@ struct lp_struct { int (*lp_has_pout)(int); int (*lp_is_online)(int); int (*lp_my_interrupt)(int); + int (*lp_ioctl)(int, unsigned int, unsigned long); + void (*lp_open)(void); /* for module use counter */ + void (*lp_release)(void); /* for module use counter */ int flags; /*for BUSY... */ unsigned int chars; /*busy timeout */ unsigned int time; /*wait time */ unsigned int wait; struct wait_queue *lp_wait_q; /*strobe wait */ + void *base; /* hardware drivers internal use*/ + enum lp_type type; char lp_buffer[LP_BUFFER_SIZE]; int do_print; unsigned long copy_size,bytes_written; }; -extern struct lp_struct lp_table[]; +extern struct lp_struct *lp_table[MAX_LP]; +extern unsigned int lp_irq; -extern int lp_init(void); +void lp_interrupt(int, void *, struct pt_regs *); +int lp_init(void); +int register_parallel(struct lp_struct *, int); +void unregister_parallel(int); #endif diff --git a/include/linux/lp_mfc.h b/include/linux/lp_mfc.h new file mode 100644 index 000000000..cf8cfb442 --- /dev/null +++ b/include/linux/lp_mfc.h @@ -0,0 +1,14 @@ +#ifndef _LINUX_LP_MFC_H_ +#define _LINUX_LP_MFC_H_ + +/* + * created 6.11.95 Joerg Dorchain + */ + +#include <linux/types.h> +#include <linux/lp_m68k.h> + +int lp_mfc_init(void); + +#endif + diff --git a/include/linux/major.h b/include/linux/major.h index 396b33a02..ee58c06f0 100644 --- a/include/linux/major.h +++ b/include/linux/major.h @@ -62,13 +62,14 @@ #define IDE2_MAJOR 33 #define IDE3_MAJOR 34 #define NETLINK_MAJOR 36 +#define PS2ESDI_MAJOR 36 #define IDETAPE_MAJOR 37 #define Z2RAM_MAJOR 37 +#define APBLOCK_MAJOR 38 /* AP1000 Block device */ +#define DDV_MAJOR 39 /* AP1000 DDV block device */ #define RISCOM8_NORMAL_MAJOR 48 #define RISCOM8_CALLOUT_MAJOR 49 #define MKISS_MAJOR 55 -#define APBLOCK_MAJOR 60 /* AP1000 Block device */ -#define DDV_MAJOR 61 /* AP1000 DDV block device */ /* * Tests for SCSI devices. diff --git a/include/linux/mca.h b/include/linux/mca.h new file mode 100644 index 000000000..a8df76379 --- /dev/null +++ b/include/linux/mca.h @@ -0,0 +1,91 @@ +/* + * Header for Microchannel Architecture Bus + * Written by Martin Kolinek, February 1996 +*/ + +#ifndef _LINUX_MCA_H +#define _LINUX_MCA_H + +/* The detection of MCA bus is done in the real mode (using BIOS). + * The information is exported to the protected code, where this + * variable is set to one in case MCA bus was detected. +*/ +extern int MCA_bus; + +/* maximal number of MCA slots - actually, some machines have less, but +they all have sufficient number of POS registers to cover 8. */ +#define MCA_MAX_SLOT_NR 8 + +/* MCA_NOTFOUND is an error condition. The other two indicate + motherboard POS registers contain the adapter. They might be + returned by the mca_find_adapter() function, and can be used as + arguments to mca_read_stored_pos(). I'm not going to allow direct + access to the motherboard registers until we run across an adapter + that requires it. We don't know enough about them to know if it's + safe. + + See Documentation/mca.txt or one of the existing drivers for + more information. +*/ +#define MCA_NOTFOUND -1 +#define MCA_INTEGSCSI (MCA_MAX_SLOT_NR) +#define MCA_INTEGVIDEO (MCA_MAX_SLOT_NR+1) + +/* max number of adapters, including both slots and various integrated +things. */ +#define MCA_NUMADAPTERS (MCA_MAX_SLOT_NR+2) + +/* returns the slot of the first enabled adapter matching id. User can +specify a starting slot beyond zero, to deal with detecting multiple +devices. Returns MCA_NOTFOUND if id not found. Also checks the +integrated adapters. */ +extern int mca_find_adapter( int id, int start ); + +/* adapter state info - returns 0 if no */ +extern int mca_isadapter( int slot ); +extern int mca_isenabled( int slot ); + +/* gets a byte out of POS register (stored in memory) */ +extern unsigned char mca_read_stored_pos( int slot, int reg ); + +/* + This can be expanded later. Right now, it gives us a way of + getting meaningful information into the MCA_info structure, + so we can have a more interesting /proc/mca. +*/ +extern void mca_set_adapter_name( int slot, char* name ); +extern char* mca_get_adapter_name( int slot ); + +/* + This sets up an information callback for /proc/mca/slot?. The + function is called with the buffer, slot, and device pointer (or + some equally informative context information, or nothing, if you + prefer), and is expected to put useful information into the + buffer. The adapter name, id, and POS registers get printed + before this is called though, so don't do it again. + + This should be called with a NULL procfn when a module + unregisters, thus preventing kernel crashes and other such + nastiness. +*/ +typedef int (*MCA_ProcFn)( char* buf, int slot, void* dev ); +extern void mca_set_adapter_procfn( int slot, MCA_ProcFn, void* dev ); + +/* These routines actually mess with the hardware POS registers. They +temporarily disable the device (and interrupts), so make sure you know +what you're doing if you use them. Furthermore, writing to a POS may +result in two devices trying to share a resource, which in turn can +result in multiple devices sharing memory spaces, IRQs, or even trashing +hardware. YOU HAVE BEEN WARNED. + +You can only access slots with this. Motherboard registers are off +limits. +*/ + +/* read a byte from the specified POS register. */ +extern unsigned char mca_read_pos( int slot, int reg ); + +/* write a byte to the specified POS register. */ +extern void mca_write_pos( int slot, int reg, unsigned char byte ); + +#endif /* _LINUX_MCA_H */ diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h index f8ea74922..a67bc9f7e 100644 --- a/include/linux/miscdevice.h +++ b/include/linux/miscdevice.h @@ -8,6 +8,8 @@ #define AMIGAMOUSE_MINOR 4 #define ATARIMOUSE_MINOR 5 #define SUN_MOUSE_MINOR 6 +#define RTC_MINOR 135 +#define SUN_OPENPROM_MINOR 139 #define MISC_DYNAMIC_MINOR 255 extern int misc_init(void); diff --git a/include/linux/mm.h b/include/linux/mm.h index 6af5f2401..9572b3415 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -10,6 +10,7 @@ #include <linux/string.h> extern unsigned long max_mapnr; +extern unsigned long num_physpages; extern void * high_memory; #include <asm/page.h> @@ -74,6 +75,7 @@ struct vm_area_struct { #define VM_EXECUTABLE 0x1000 #define VM_LOCKED 0x2000 +#define VM_IO 0x4000 /* Memory mapped I/O or similar */ #define VM_STACK_FLAGS 0x0177 @@ -123,7 +125,7 @@ typedef struct page { unsigned dirty:16, age:8; struct wait_queue *wait; - struct page *prev_hash; + struct page **pprev_hash; struct buffer_head * buffers; unsigned long swap_unlock_entry; unsigned long map_nr; /* page->map_nr == page - mem_map */ @@ -255,7 +257,7 @@ extern void clear_page_tables(struct task_struct * tsk); extern int new_page_tables(struct task_struct * tsk); extern int copy_page_tables(struct task_struct * to); -extern int zap_page_range(struct mm_struct *mm, unsigned long address, unsigned long size); +extern void zap_page_range(struct mm_struct *mm, unsigned long address, unsigned long size); extern int copy_page_range(struct mm_struct *dst, struct mm_struct *src, struct vm_area_struct *vma); extern int remap_page_range(unsigned long from, unsigned long to, unsigned long size, pgprot_t prot); extern int zeromap_page_range(unsigned long from, unsigned long size, pgprot_t prot); @@ -272,6 +274,7 @@ extern void oom(struct task_struct * tsk); extern void si_meminfo(struct sysinfo * val); /* mmap.c */ +extern void vma_init(void); extern unsigned long do_mmap(struct file * file, unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags, unsigned long off); extern void merge_segments(struct mm_struct *, unsigned long, unsigned long); diff --git a/include/linux/modsetver.h b/include/linux/modsetver.h new file mode 100644 index 000000000..7d0b9d371 --- /dev/null +++ b/include/linux/modsetver.h @@ -0,0 +1,10 @@ +/* Symbol versioning nastiness. */ + +#define __SYMBOL_VERSION(x) __ver_ ## x +#define __VERSIONED_SYMBOL2(x,v) x ## _R ## v +#define __VERSIONED_SYMBOL1(x,v) __VERSIONED_SYMBOL2(x,v) +#define __VERSIONED_SYMBOL(x) __VERSIONED_SYMBOL1(x,__SYMBOL_VERSION(x)) + +#ifndef _set_ver +#define _set_ver(x) __VERSIONED_SYMBOL(x) +#endif diff --git a/include/linux/module.h b/include/linux/module.h index 1bf540e93..48fc78e60 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -1,138 +1,277 @@ /* * Dynamic loading of modules into the kernel. * - * Modified by Bjorn Ekwall <bj0rn@blox.se> + * Rewritten by Richard Henderson <rth@tamu.edu> Dec 1996 */ #ifndef _LINUX_MODULE_H #define _LINUX_MODULE_H +#include <linux/config.h> + #ifdef __GENKSYMS__ -# define _set_ver(sym,vers) sym +# define _set_ver(sym) sym # undef MODVERSIONS # define MODVERSIONS #else /* ! __GENKSYMS__ */ -# if defined(MODVERSIONS) && !defined(MODULE) && defined(EXPORT_SYMTAB) -# define _set_ver(sym,vers) sym +# if !defined(MODVERSIONS) && defined(EXPORT_SYMTAB) +# define _set_ver(sym) sym # include <linux/modversions.h> # endif #endif /* __GENKSYMS__ */ -/* values of module.state */ -#define MOD_UNINITIALIZED 0 -#define MOD_RUNNING 1 -#define MOD_DELETED 2 - -/* maximum length of module name */ -#define MOD_MAX_NAME 64 - -/* magic marker for modules inserted from kerneld, to be auto-reaped */ -#define MOD_AUTOCLEAN 0x40000000 /* big enough, but no sign problems... */ -#define MOD_VISITED 0x20000000 /* Thanks Jacques! */ -/* maximum length of symbol name */ -#define SYM_MAX_NAME 60 - -struct kernel_sym { /* sent to "insmod" */ - unsigned long value; /* value of symbol */ - char name[SYM_MAX_NAME]; /* name of symbol */ -}; +/* Don't need to bring in all of uaccess.h just for this decl. */ +struct exception_table_entry; -struct module_ref { - struct module *module; - struct module_ref *next; +/* Used by get_kernel_syms, which is obsolete. */ +struct kernel_sym +{ + unsigned long value; + char name[60]; /* should have been 64-sizeof(long); oh well */ }; -struct internal_symbol { - void *addr; +struct module_symbol +{ + unsigned long value; const char *name; - }; - -struct symbol_table { /* received from "insmod" */ - int size; /* total, including string table!!! */ - int n_symbols; - int n_refs; - struct internal_symbol symbol[0]; /* actual size defined by n_symbols */ - struct module_ref ref[0]; /* actual size defined by n_refs */ }; -/* - * Note: The string table follows immediately after the symbol table in memory! - */ -struct _exceptinfo{ - struct exception_table_entry *start; - struct exception_table_entry *stop; + +struct module_ref +{ + struct module *dep; /* "parent" pointer */ + struct module *ref; /* "child" pointer */ + struct module_ref *next_ref; }; -struct module { +/* TBD */ +struct module_persist; + +struct module +{ + unsigned long size_of_struct; /* == sizeof(module) */ struct module *next; - struct module_ref *ref; /* the list of modules that refer to me */ - struct symbol_table *symtab; const char *name; - int size; /* size of module in pages */ - void* addr; /* address of module */ - int state; - void (*cleanup)(void); /* cleanup routine */ - struct _exceptinfo exceptinfo; + unsigned long size; + + long usecount; + unsigned long flags; /* AUTOCLEAN et al */ + + unsigned nsyms; + unsigned ndeps; + + struct module_symbol *syms; + struct module_ref *deps; + struct module_ref *refs; + int (*init)(void); + void (*cleanup)(void); + const struct exception_table_entry *ex_table_start; + const struct exception_table_entry *ex_table_end; +#ifdef __alpha__ + unsigned long gp; +#endif + /* Members past this point are extensions to the basic + module support and are optional. Use mod_opt_member() + to examine them. */ + const struct module_persist *persist_start; + const struct module_persist *persist_end; + int (*can_unload)(void); }; -/* - prior to modules-2.1 there were no real way to identify - which insmod is talking to us Now a special signature must - be written here. - - The new module utilities knows about older kernel and write - the init in the signature and the cleanup in the init. - This is to make sure newer utilities work with older kernel - so it is simple for people to upgrade. +struct module_info +{ + unsigned long addr; + unsigned long size; + unsigned long flags; + long usecount; +}; + +/* Bits of module.flags. */ + +#define MOD_UNINITIALIZED 0 +#define MOD_RUNNING 1 +#define MOD_DELETED 2 +#define MOD_AUTOCLEAN 4 +#define MOD_VISITED 8 +#define MOD_USED_ONCE 16 + +/* Values for query_module's which. */ + +#define QM_MODULES 1 +#define QM_DEPS 2 +#define QM_REFS 3 +#define QM_SYMBOLS 4 +#define QM_INFO 5 + +/* When struct module is extended, we must test whether the new member + is present in the header received from insmod before we can use it. + This function returns true if the member is present. */ + +#define mod_member_present(mod,member) \ + ((unsigned long)(&((struct module *)0L)->member + 1) \ + <= (mod)->size_of_struct) + +/* Backwards compatibility definition. */ + +#define GET_USE_COUNT(module) ((module)->usecount) + +/* Poke the use count of a module. */ + +#define __MOD_INC_USE_COUNT(mod) \ + ((mod)->usecount++, (mod)->flags |= MOD_VISITED|MOD_USED_ONCE) +#define __MOD_DEC_USE_COUNT(mod) \ + ((mod)->usecount--, (mod)->flags |= MOD_VISITED) +#define __MOD_IN_USE(mod) \ + (mod_member_present((mod), can_unload) && (mod)->can_unload \ + ? (mod)->can_unload() : (mod)->usecount) + +/* Indirect stringification. */ + +#define __MODULE_STRING_1(x) #x +#define __MODULE_STRING(x) __MODULE_STRING_1(x) + +#if defined(MODULE) && !defined(__GENKSYMS__) + +/* Embedded module documentation macros. */ + +/* For documentation purposes only. */ + +#define MODULE_AUTHOR(name) \ +const char __module_author[] __attribute__((section(".modinfo"))) = \ +"author=" name + +#define MODULE_DESCRIPTION(desc) \ +const char __module_description[] __attribute__((section(".modinfo"))) = \ +"description=" desc + +/* Could potentially be used by kerneld... */ + +#define MODULE_SUPPORTED_DEVICE(dev) \ +const char __module_device[] __attribute__((section(".modinfo"))) = \ +"device=" dev + +/* Used to verify parameters given to the module. The TYPE arg should + be a string in the following format: + [min[-max]]{b,h,i,l,s} + The MIN and MAX specifiers delimit the length of the array. If MAX + is omitted, it defaults to MIN; if both are omitted, the default is 1. + The final character is a type specifier: + b byte + h short + i int + l long + s string */ -#define MODULE_2_1_7_SIG ((void*)0x00000217) -struct mod_routines { - void *signature; - int (*init)(void); /* initialization routine */ - void (*cleanup)(void); /* cleanup routine */ - struct _exceptinfo exceptinfo; -}; +#define MODULE_PARM(var,type) \ +const char __module_parm_##var[] \ +__attribute__((section(".modinfo"))) = \ +"parm_" __MODULE_STRING(var) "=" type -/* - * The first word of the module contains the use count. - */ -#define GET_USE_COUNT(module) (* (long *) (module)->addr) -/* - * define the count variable, and usage macros. - */ +#define MODULE_PARM_DESC(var,desc) \ +const char __module_parm_desc_##var[] \ +__attribute__((section(".modinfo"))) = \ +"parm_desc_" __MODULE_STRING(var) "=" desc -#ifdef MODULE +/* The attributes of a section are set the first time the section is + seen; we want .modinfo to not be allocated. */ + +__asm__(".section .modinfo\n\t.previous"); -extern long mod_use_count_; -#define MOD_INC_USE_COUNT (mod_use_count_++, mod_use_count_ |= MOD_VISITED) -#define MOD_DEC_USE_COUNT (mod_use_count_--, mod_use_count_ |= MOD_VISITED) -#define MOD_IN_USE ((mod_use_count_ & ~(MOD_AUTOCLEAN | MOD_VISITED)) != 0) +/* Define the module variable, and usage macros. */ +extern struct module __this_module; + +#define MOD_INC_USE_COUNT __MOD_INC_USE_COUNT(&__this_module) +#define MOD_DEC_USE_COUNT __MOD_DEC_USE_COUNT(&__this_module) +#define MOD_IN_USE __MOD_IN_USE(&__this_module) #ifndef __NO_VERSION__ #include <linux/version.h> -char kernel_version[]=UTS_RELEASE; +const char __module_kernel_version[] __attribute__((section(".modinfo"))) = +"kernel_version=" UTS_RELEASE; +#ifdef MODVERSIONS +const char __module_using_checksums[] __attribute__((section(".modinfo"))) = +"using_checksums=1"; #endif - -#if defined(MODVERSIONS) && !defined(__GENKSYMS__) -int Using_Versions; /* gcc will handle this global (used as a flag) correctly */ #endif -#else +#else /* MODULE */ + +#define MODULE_AUTHOR(name) +#define MODULE_DESCRIPTION(desc) +#define MODULE_SUPPORTED_DEVICE(name) +#define MODULE_PARM(var,type) +#define MODULE_PARM_DESC(var,desc) + +#ifndef __GENKSYMS__ #define MOD_INC_USE_COUNT do { } while (0) #define MOD_DEC_USE_COUNT do { } while (0) #define MOD_IN_USE 1 + extern struct module *module_list; +#endif /* !__GENKSYMS__ */ + +#endif /* MODULE */ + +/* Export a symbol either from the kernel or a module. + + In the kernel, the symbol is added to the kernel's global symbol table. + + In a module, it controls which variables are exported. If no + variables are explicitly exported, the action is controled by the + insmod -[xX] flags. Otherwise, only the variables listed are exported. + This obviates the need for the old register_symtab() function. */ + +#if defined(__GENKSYMS__) + +/* We want the EXPORT_SYMBOL tag left intact for recognition. */ + +#elif !defined(AUTOCONF_INCLUDED) + +#define __EXPORT_SYMBOL(sym,str) error config_must_be_included_before_module +#define EXPORT_SYMBOL(var) error config_must_be_included_before_module +#define EXPORT_SYMBOL_NOVERS(var) error config_must_be_included_before_module + +#elif !defined(CONFIG_MODULES) + +#define __EXPORT_SYMBOL(sym,str) +#define EXPORT_SYMBOL(var) +#define EXPORT_SYMBOL_NOVERS(var) + +#elif !defined(EXPORT_SYMTAB) + +/* If things weren't set up in the Makefiles to get EXPORT_SYMTAB defined, + then they weren't set up to run genksyms properly so MODVERSIONS breaks. */ +#define __EXPORT_SYMBOL(sym,str) error EXPORT_SYMTAB_not_defined +#define EXPORT_SYMBOL(var) error EXPORT_SYMTAB_not_defined +#define EXPORT_SYMBOL_NOVERS(var) error EXPORT_SYMTAB_not_defined + +#else + +#define __EXPORT_SYMBOL(sym, str) \ +const char __kstrtab_##sym[] \ +__attribute__((section(".kstrtab"))) = str; \ +const struct module_symbol __ksymtab_##sym \ +__attribute__((section("__ksymtab"))) = \ +{ (unsigned long)&sym, __kstrtab_##sym } + +#if defined(MODVERSIONS) || !defined(CONFIG_MODVERSIONS) +#define EXPORT_SYMBOL(var) __EXPORT_SYMBOL(var, __MODULE_STRING(var)) +#else +#define EXPORT_SYMBOL(var) __EXPORT_SYMBOL(var, __MODULE_STRING(__VERSIONED_SYMBOL(var))) #endif -/* insert new symbol table */ -extern int register_symtab_from(struct symbol_table *, long *); +#define EXPORT_SYMBOL_NOVERS(var) __EXPORT_SYMBOL(var, __MODULE_STRING(var)) + +#endif /* __GENKSYMS__ */ + #ifdef MODULE -#define register_symtab(symtab) register_symtab_from(symtab, &mod_use_count_) +/* Force a module to export no symbols. */ +#define EXPORT_NO_SYMBOLS __asm__(".section __ksymtab\n.previous") #else -#define register_symtab(symtab) register_symtab_from(symtab, 0) -#endif +#define EXPORT_NO_SYMBOLS +#endif /* MODULE */ -#endif +#endif /* _LINUX_MODULE_H */ diff --git a/include/linux/mpp.h b/include/linux/mpp.h new file mode 100644 index 000000000..2dd02ff4e --- /dev/null +++ b/include/linux/mpp.h @@ -0,0 +1,18 @@ +#ifndef _LINUX_MPP_H +#define _LINUX_MPP_H + +/* + * Definitions related to Massively Parallel Processing support. + */ + +/* All mpp implementations must supply these functions */ + +extern void mpp_init(void); +extern void mpp_hw_init(void); +extern void mpp_procfs_init(void); + +extern int mpp_num_cells(void); +extern int mpp_cid(void); +extern int get_mppinfo(char *buffer); + +#endif diff --git a/include/linux/mroute.h b/include/linux/mroute.h index 6772a60f8..c0dc052b2 100644 --- a/include/linux/mroute.h +++ b/include/linux/mroute.h @@ -21,9 +21,11 @@ #define MRT_DEL_MFC (MRT_BASE+5) /* Delete a multicast forwarding entry */ #define MRT_VERSION (MRT_BASE+6) /* Get the kernel multicast version */ #define MRT_ASSERT (MRT_BASE+7) /* Activate PIM assert mode */ +#define MRT_PIM (MRT_BASE+8) /* enable PIM code */ #define SIOCGETVIFCNT SIOCPROTOPRIVATE /* IP protocol privates */ #define SIOCGETSGCNT (SIOCPROTOPRIVATE+1) +#define SIOCGETRPF (SIOCPROTOPRIVATE+2) #define MAXVIFS 32 typedef unsigned long vifbitmap_t; /* User mode code depends on this lot */ @@ -56,10 +58,18 @@ struct vifctl { }; #define VIFF_TUNNEL 0x1 /* IPIP tunnel */ -#define VIFF_SRCRT 0x02 /* NI */ +#define VIFF_SRCRT 0x2 /* NI */ + + +/* PIM Vif Flags */ +#define VIFF_DR 0x0010 /* designated router */ +#define VIFF_NOMRT 0x0020 /* no neighbor on vif */ +#define VIFF_DOWN 0x0040 /* interface is down */ +#define VIFF_DISABLED 0x0080 /* disabled interafce */ +#define VIFF_REGISTER 0x00A0 /* MIssing cap@di.fc.ul.pt */ /* - * Cache manipulation structures for mrouted + * Cache manipulation structures for mrouted and PIMd */ struct mfcctl @@ -68,6 +78,10 @@ struct mfcctl struct in_addr mfcc_mcastgrp; /* Group in question */ vifi_t mfcc_parent; /* Where it arrived */ unsigned char mfcc_ttls[MAXVIFS]; /* Where it is going */ + unsigned int mfcc_pkt_cnt; /* pkt count for src-grp */ + unsigned int mfcc_byte_cnt; + unsigned int mfcc_wrong_if; + int mfcc_expire; }; /* @@ -97,6 +111,16 @@ struct sioc_vif_req }; /* + * To get RPF from unicast routing table (PIM: cap@di.fc.ul.pt) + */ +struct sioc_rpf_req +{ + unsigned long source; /* Source address */ + unsigned long rpfneighbor; /* RPF */ + vifi_t iif; /* Incoming Interface */ +}; + +/* * This is the format the mroute daemon expects to see IGMP control * data. Magically happens to be like an IP packet as per the original */ @@ -122,18 +146,23 @@ extern int ip_mroute_getsockopt(struct sock *, int, char *, int *); extern int ipmr_ioctl(struct sock *sk, int cmd, unsigned long arg); extern void mroute_close(struct sock *sk); extern void ipmr_forward(struct sk_buff *skb, int is_frag); +extern int ip_mr_find_tunnel(__u32, __u32); struct vif_device { - struct device *dev; /* Device we are using */ - struct route *rt_cache; /* Tunnel route cache */ + union + { + struct device *dev; /* Device we are using */ + struct rtable *rt; /* Route for tunnel */ + } u; unsigned long bytes_in,bytes_out; unsigned long pkt_in,pkt_out; /* Statistics */ unsigned long rate_limit; /* Traffic shaping (NI) */ unsigned char threshold; /* TTL threshold */ unsigned short flags; /* Control flags */ unsigned long local,remote; /* Addresses(remote for tunnels)*/ + unsigned long uptime; }; struct mfc_cache @@ -146,6 +175,14 @@ struct mfc_cache int mfc_flags; /* Flags on line */ struct sk_buff_head mfc_unresolved; /* Unresolved buffers */ int mfc_queuelen; /* Unresolved buffer counter */ + unsigned mfc_last_assert; + int mfc_minvif; + int mfc_maxvif; + unsigned long uptime; + unsigned long expire; + unsigned long mfc_bytes; + unsigned long mfc_pkt; + unsigned long mfc_wrong_if; unsigned char mfc_ttls[MAXVIFS]; /* TTL thresholds */ }; @@ -163,11 +200,15 @@ struct mfc_cache #endif + +#define MFC_ASSERT_THRESH (3*HZ) /* Maximal freq. of asserts */ + /* * Pseudo messages used by mrouted */ -#define IGMPMSG_NOCACHE 1 /* Kernel cache fill request to mrouted */ +#define IGMPMSG_NOCACHE 1 /* Kern cache fill request to mrouted */ #define IGMPMSG_WRONGVIF 2 /* For PIM assert processing (unused) */ +#define IGMPMSG_WHOLEPKT 3 /* For PIM Register processing */ #endif diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h index 7aef08e01..d7f46b1d8 100644 --- a/include/linux/msdos_fs.h +++ b/include/linux/msdos_fs.h @@ -7,6 +7,9 @@ #include <linux/fs.h> #include <linux/stat.h> #include <linux/fd.h> +#include <linux/config.h> + +#include <asm/byteorder.h> #define MSDOS_ROOT_INO 1 /* == MINIX_ROOT_INO */ #define SECTOR_SIZE 512 /* sector size (bytes) */ @@ -69,6 +72,14 @@ #define MSDOS_FAT12 4078 /* maximum number of clusters in a 12 bit FAT */ +#ifdef CONFIG_ATARI +#define EOF_FAT12 0xFFF /* Atari GEMDOS fs uses a different EOF */ +#define EOF_FAT16 0xFFFF +#else +#define EOF_FAT12 0xFF8 /* standard EOF */ +#define EOF_FAT16 0xFFF8 +#endif + /* * Inode flags */ @@ -87,11 +98,10 @@ * BE = big-endian, c: W = word (16 bits), L = longword (32 bits) */ -#define CF_LE_W(v) (v) -#define CF_LE_L(v) (v) -#define CT_LE_W(v) (v) -#define CT_LE_L(v) (v) - +#define CF_LE_W(v) le16_to_cpu(v) +#define CF_LE_L(v) le32_to_cpu(v) +#define CT_LE_W(v) cpu_to_le16(v) +#define CT_LE_L(v) cpu_to_le32(v) struct msdos_boot_sector { __s8 ignored[3]; /* Boot strap short or near jump */ diff --git a/include/linux/mtio.h b/include/linux/mtio.h index 61db37850..65e15f92e 100644 --- a/include/linux/mtio.h +++ b/include/linux/mtio.h @@ -245,4 +245,7 @@ struct mtconfiginfo { #define MT_ST_DEF_COMPRESSION (MT_ST_DEF_OPTIONS | 0x200000) #define MT_ST_DEF_DRVBUFFER (MT_ST_DEF_OPTIONS | 0x300000) +/* The offset for the arguments for the special HP changer load command. */ +#define MT_ST_HPLOADER_OFFSET 10000 + #endif /* _LINUX_MTIO_H */ diff --git a/include/linux/ncp.h b/include/linux/ncp.h index 3d5286ec1..83ad3f723 100644 --- a/include/linux/ncp.h +++ b/include/linux/ncp.h @@ -2,6 +2,7 @@ * ncp.h * * Copyright (C) 1995 by Volker Lendecke + * Modified for sparc by J.F. Chadima * */ @@ -19,102 +20,55 @@ #define NCP_DEALLOC_SLOT_REQUEST (0x5555) struct ncp_request_header { - __u16 type __attribute__ ((packed)); - __u8 sequence __attribute__ ((packed)); - __u8 conn_low __attribute__ ((packed)); - __u8 task __attribute__ ((packed)); - __u8 conn_high __attribute__ ((packed)); - __u8 function __attribute__ ((packed)); - __u8 data[0] __attribute__ ((packed)); + __u16 type __attribute__((packed)); + __u8 sequence __attribute__((packed)); + __u8 conn_low __attribute__((packed)); + __u8 task __attribute__((packed)); + __u8 conn_high __attribute__((packed)); + __u8 function __attribute__((packed)); + __u8 data[0] __attribute__((packed)); }; #define NCP_REPLY (0x3333) #define NCP_POSITIVE_ACK (0x9999) struct ncp_reply_header { - __u16 type __attribute__ ((packed)); - __u8 sequence __attribute__ ((packed)); - __u8 conn_low __attribute__ ((packed)); - __u8 task __attribute__ ((packed)); - __u8 conn_high __attribute__ ((packed)); - __u8 completion_code __attribute__ ((packed)); - __u8 connection_state __attribute__ ((packed)); - __u8 data[0] __attribute__ ((packed)); -}; - - -#define NCP_BINDERY_USER (0x0001) -#define NCP_BINDERY_UGROUP (0x0002) -#define NCP_BINDERY_PQUEUE (0x0003) -#define NCP_BINDERY_FSERVER (0x0004) -#define NCP_BINDERY_NAME_LEN (48) -struct ncp_bindery_object { - __u32 object_id; - __u16 object_type; - __u8 object_name[NCP_BINDERY_NAME_LEN]; - __u8 object_flags; - __u8 object_security; - __u8 object_has_prop; -}; - -struct nw_property { - __u8 value[128]; - __u8 more_flag; - __u8 property_flag; -}; - -struct prop_net_address { - __u32 network __attribute__ ((packed)); - __u8 node[IPX_NODE_LEN] __attribute__ ((packed)); - __u16 port __attribute__ ((packed)); + __u16 type __attribute__((packed)); + __u8 sequence __attribute__((packed)); + __u8 conn_low __attribute__((packed)); + __u8 task __attribute__((packed)); + __u8 conn_high __attribute__((packed)); + __u8 completion_code __attribute__((packed)); + __u8 connection_state __attribute__((packed)); + __u8 data[0] __attribute__((packed)); }; #define NCP_VOLNAME_LEN (16) #define NCP_NUMBER_OF_VOLUMES (64) struct ncp_volume_info { - __u32 total_blocks; - __u32 free_blocks; - __u32 purgeable_blocks; - __u32 not_yet_purgeable_blocks; - __u32 total_dir_entries; - __u32 available_dir_entries; - __u8 sectors_per_block; - char volume_name[NCP_VOLNAME_LEN+1]; -}; - -struct ncp_filesearch_info { - __u8 volume_number; - __u16 directory_id; - __u16 sequence_no; - __u8 access_rights; + __u32 total_blocks; + __u32 free_blocks; + __u32 purgeable_blocks; + __u32 not_yet_purgeable_blocks; + __u32 total_dir_entries; + __u32 available_dir_entries; + __u8 sectors_per_block; + char volume_name[NCP_VOLNAME_LEN + 1]; }; -#define NCP_MAX_FILENAME 14 - /* these define the attribute byte as seen by NCP */ -#define aRONLY (1L<<0) -#define aHIDDEN (1L<<1) -#define aSYSTEM (1L<<2) -#define aEXECUTE (1L<<3) -#define aDIR (1L<<4) -#define aARCH (1L<<5) +#define aRONLY (ntohl(0x01000000)) +#define aHIDDEN (ntohl(0x02000000)) +#define aSYSTEM (ntohl(0x04000000)) +#define aEXECUTE (ntohl(0x08000000)) +#define aDIR (ntohl(0x10000000)) +#define aARCH (ntohl(0x20000000)) -#define AR_READ (0x01) -#define AR_WRITE (0x02) -#define AR_EXCLUSIVE (0x20) +#define AR_READ (ntohs(0x0100)) +#define AR_WRITE (ntohs(0x0200)) +#define AR_EXCLUSIVE (ntohs(0x2000)) #define NCP_FILE_ID_LEN 6 -struct ncp_file_info { - __u8 file_id[NCP_FILE_ID_LEN]; - char file_name[NCP_MAX_FILENAME+1]; - __u8 file_attributes; - __u8 file_mode; - __u32 file_length; - __u16 creation_date; - __u16 access_date; - __u16 update_date; - __u16 update_time; -}; /* Defines for Name Spaces */ #define NW_NS_DOS 0 @@ -124,20 +78,20 @@ struct ncp_file_info { #define NW_NS_OS2 4 /* Defines for ReturnInformationMask */ -#define RIM_NAME (0x0001L) -#define RIM_SPACE_ALLOCATED (0x0002L) -#define RIM_ATTRIBUTES (0x0004L) -#define RIM_DATA_SIZE (0x0008L) -#define RIM_TOTAL_SIZE (0x0010L) -#define RIM_EXT_ATTR_INFO (0x0020L) -#define RIM_ARCHIVE (0x0040L) -#define RIM_MODIFY (0x0080L) -#define RIM_CREATION (0x0100L) -#define RIM_OWNING_NAMESPACE (0x0200L) -#define RIM_DIRECTORY (0x0400L) -#define RIM_RIGHTS (0x0800L) -#define RIM_ALL (0x0FFFL) -#define RIM_COMPRESSED_INFO (0x80000000L) +#define RIM_NAME (ntohl(0x01000000L)) +#define RIM_SPACE_ALLOCATED (ntohl(0x02000000L)) +#define RIM_ATTRIBUTES (ntohl(0x04000000L)) +#define RIM_DATA_SIZE (ntohl(0x08000000L)) +#define RIM_TOTAL_SIZE (ntohl(0x10000000L)) +#define RIM_EXT_ATTR_INFO (ntohl(0x20000000L)) +#define RIM_ARCHIVE (ntohl(0x40000000L)) +#define RIM_MODIFY (ntohl(0x80000000L)) +#define RIM_CREATION (ntohl(0x00010000L)) +#define RIM_OWNING_NAMESPACE (ntohl(0x00020000L)) +#define RIM_DIRECTORY (ntohl(0x00040000L)) +#define RIM_RIGHTS (ntohl(0x00080000L)) +#define RIM_ALL (ntohl(0xFF0F0000L)) +#define RIM_COMPRESSED_INFO (ntohl(0x00000080L)) /* open/create modes */ #define OC_MODE_OPEN 0x01 @@ -163,142 +117,80 @@ struct ncp_file_info { #define AR_OPEN_COMPRESSED 0x0100 #endif -struct nw_info_struct -{ - __u32 spaceAlloc __attribute__ ((packed)); - __u32 attributes __attribute__ ((packed)); - __u16 flags __attribute__ ((packed)); - __u32 dataStreamSize __attribute__ ((packed)); - __u32 totalStreamSize __attribute__ ((packed)); - __u16 numberOfStreams __attribute__ ((packed)); - __u16 creationTime __attribute__ ((packed)); - __u16 creationDate __attribute__ ((packed)); - __u32 creatorID __attribute__ ((packed)); - __u16 modifyTime __attribute__ ((packed)); - __u16 modifyDate __attribute__ ((packed)); - __u32 modifierID __attribute__ ((packed)); - __u16 lastAccessDate __attribute__ ((packed)); - __u16 archiveTime __attribute__ ((packed)); - __u16 archiveDate __attribute__ ((packed)); - __u32 archiverID __attribute__ ((packed)); - __u16 inheritedRightsMask __attribute__ ((packed)); - __u32 dirEntNum __attribute__ ((packed)); - __u32 DosDirNum __attribute__ ((packed)); - __u32 volNumber __attribute__ ((packed)); - __u32 EADataSize __attribute__ ((packed)); - __u32 EAKeyCount __attribute__ ((packed)); - __u32 EAKeySize __attribute__ ((packed)); - __u32 NSCreator __attribute__ ((packed)); - __u8 nameLen __attribute__ ((packed)); - __u8 entryName[256] __attribute__ ((packed)); +struct nw_info_struct { + __u32 spaceAlloc __attribute__((packed)); + __u32 attributes __attribute__((packed)); + __u16 flags __attribute__((packed)); + __u32 dataStreamSize __attribute__((packed)); + __u32 totalStreamSize __attribute__((packed)); + __u16 numberOfStreams __attribute__((packed)); + __u16 creationTime __attribute__((packed)); + __u16 creationDate __attribute__((packed)); + __u32 creatorID __attribute__((packed)); + __u16 modifyTime __attribute__((packed)); + __u16 modifyDate __attribute__((packed)); + __u32 modifierID __attribute__((packed)); + __u16 lastAccessDate __attribute__((packed)); + __u16 archiveTime __attribute__((packed)); + __u16 archiveDate __attribute__((packed)); + __u32 archiverID __attribute__((packed)); + __u16 inheritedRightsMask __attribute__((packed)); + __u32 dirEntNum __attribute__((packed)); + __u32 DosDirNum __attribute__((packed)); + __u32 volNumber __attribute__((packed)); + __u32 EADataSize __attribute__((packed)); + __u32 EAKeyCount __attribute__((packed)); + __u32 EAKeySize __attribute__((packed)); + __u32 NSCreator __attribute__((packed)); + __u8 nameLen __attribute__((packed)); + __u8 entryName[256] __attribute__((packed)); }; /* modify mask - use with MODIFY_DOS_INFO structure */ -#define DM_ATTRIBUTES (0x0002L) -#define DM_CREATE_DATE (0x0004L) -#define DM_CREATE_TIME (0x0008L) -#define DM_CREATOR_ID (0x0010L) -#define DM_ARCHIVE_DATE (0x0020L) -#define DM_ARCHIVE_TIME (0x0040L) -#define DM_ARCHIVER_ID (0x0080L) -#define DM_MODIFY_DATE (0x0100L) -#define DM_MODIFY_TIME (0x0200L) -#define DM_MODIFIER_ID (0x0400L) -#define DM_LAST_ACCESS_DATE (0x0800L) -#define DM_INHERITED_RIGHTS_MASK (0x1000L) -#define DM_MAXIMUM_SPACE (0x2000L) - -struct nw_modify_dos_info -{ - __u32 attributes __attribute__ ((packed)); - __u16 creationDate __attribute__ ((packed)); - __u16 creationTime __attribute__ ((packed)); - __u32 creatorID __attribute__ ((packed)); - __u16 modifyDate __attribute__ ((packed)); - __u16 modifyTime __attribute__ ((packed)); - __u32 modifierID __attribute__ ((packed)); - __u16 archiveDate __attribute__ ((packed)); - __u16 archiveTime __attribute__ ((packed)); - __u32 archiverID __attribute__ ((packed)); - __u16 lastAccessDate __attribute__ ((packed)); - __u16 inheritanceGrantMask __attribute__ ((packed)); - __u16 inheritanceRevokeMask __attribute__ ((packed)); - __u32 maximumSpace __attribute__ ((packed)); +#define DM_ATTRIBUTES (ntohl(0x02000000L)) +#define DM_CREATE_DATE (ntohl(0x04000000L)) +#define DM_CREATE_TIME (ntohl(0x08000000L)) +#define DM_CREATOR_ID (ntohl(0x10000000L)) +#define DM_ARCHIVE_DATE (ntohl(0x20000000L)) +#define DM_ARCHIVE_TIME (ntohl(0x40000000L)) +#define DM_ARCHIVER_ID (ntohl(0x80000000L)) +#define DM_MODIFY_DATE (ntohl(0x00010000L)) +#define DM_MODIFY_TIME (ntohl(0x00020000L)) +#define DM_MODIFIER_ID (ntohl(0x00040000L)) +#define DM_LAST_ACCESS_DATE (ntohl(0x00080000L)) +#define DM_INHERITED_RIGHTS_MASK (ntohl(0x00100000L)) +#define DM_MAXIMUM_SPACE (ntohl(0x00200000L)) + +struct nw_modify_dos_info { + __u32 attributes __attribute__((packed)); + __u16 creationDate __attribute__((packed)); + __u16 creationTime __attribute__((packed)); + __u32 creatorID __attribute__((packed)); + __u16 modifyDate __attribute__((packed)); + __u16 modifyTime __attribute__((packed)); + __u32 modifierID __attribute__((packed)); + __u16 archiveDate __attribute__((packed)); + __u16 archiveTime __attribute__((packed)); + __u32 archiverID __attribute__((packed)); + __u16 lastAccessDate __attribute__((packed)); + __u16 inheritanceGrantMask __attribute__((packed)); + __u16 inheritanceRevokeMask __attribute__((packed)); + __u32 maximumSpace __attribute__((packed)); }; struct nw_file_info { struct nw_info_struct i; - int opened; - int access; - __u32 server_file_handle __attribute__ ((packed)); - __u8 open_create_action __attribute__ ((packed)); - __u8 file_handle[6] __attribute__ ((packed)); + int opened; + int access; + __u32 server_file_handle __attribute__((packed)); + __u8 open_create_action __attribute__((packed)); + __u8 file_handle[6] __attribute__((packed)); }; struct nw_search_sequence { - __u8 volNumber __attribute__ ((packed)); - __u32 dirBase __attribute__ ((packed)); - __u32 sequence __attribute__ ((packed)); -}; - -struct nw_queue_job_entry { - __u16 InUse __attribute__ ((packed)); - __u32 prev __attribute__ ((packed)); - __u32 next __attribute__ ((packed)); - __u32 ClientStation __attribute__ ((packed)); - __u32 ClientTask __attribute__ ((packed)); - __u32 ClientObjectID __attribute__ ((packed)); - __u32 TargetServerID __attribute__ ((packed)); - __u8 TargetExecTime[6] __attribute__ ((packed)); - __u8 JobEntryTime[6] __attribute__ ((packed)); - __u32 JobNumber __attribute__ ((packed)); - __u16 JobType __attribute__ ((packed)); - __u16 JobPosition __attribute__ ((packed)); - __u16 JobControlFlags __attribute__ ((packed)); - __u8 FileNameLen __attribute__ ((packed)); - char JobFileName[13] __attribute__ ((packed)); - __u32 JobFileHandle __attribute__ ((packed)); - __u32 ServerStation __attribute__ ((packed)); - __u32 ServerTaskNumber __attribute__ ((packed)); - __u32 ServerObjectID __attribute__ ((packed)); - char JobTextDescription[50] __attribute__ ((packed)); - char ClientRecordArea[152] __attribute__ ((packed)); + __u8 volNumber __attribute__((packed)); + __u32 dirBase __attribute__((packed)); + __u32 sequence __attribute__((packed)); }; -struct queue_job { - struct nw_queue_job_entry j; - __u8 file_handle[6]; -}; - -#define QJE_OPER_HOLD 0x80 -#define QJE_USER_HOLD 0x40 -#define QJE_ENTRYOPEN 0x20 -#define QJE_SERV_RESTART 0x10 -#define QJE_SERV_AUTO 0x08 - -/* ClientRecordArea for print jobs */ - -#define KEEP_ON 0x0400 -#define NO_FORM_FEED 0x0800 -#define NOTIFICATION 0x1000 -#define DELETE_FILE 0x2000 -#define EXPAND_TABS 0x4000 -#define PRINT_BANNER 0x8000 - -struct print_job_record { - __u8 Version __attribute__ ((packed)); - __u8 TabSize __attribute__ ((packed)); - __u16 Copies __attribute__ ((packed)); - __u16 CtrlFlags __attribute__ ((packed)); - __u16 Lines __attribute__ ((packed)); - __u16 Rows __attribute__ ((packed)); - char FormName[16] __attribute__ ((packed)); - __u8 Reserved[6] __attribute__ ((packed)); - char BannerName[13] __attribute__ ((packed)); - char FnameBanner[13] __attribute__ ((packed)); - char FnameHeader[14] __attribute__ ((packed)); - char Path[80] __attribute__ ((packed)); -}; - - -#endif /* _LINUX_NCP_H */ +#endif /* _LINUX_NCP_H */ diff --git a/include/linux/ncp_fs.h b/include/linux/ncp_fs.h index 1d6744420..846f9dcea 100644 --- a/include/linux/ncp_fs.h +++ b/include/linux/ncp_fs.h @@ -21,22 +21,22 @@ */ struct ncp_ioctl_request { - unsigned int function; - unsigned int size; - char *data; + unsigned int function; + unsigned int size; + char *data; }; struct ncp_fs_info { - int version; + int version; struct sockaddr_ipx addr; - uid_t mounted_uid; - int connection; /* Connection number the server assigned us */ - int buffer_size; /* The negotiated buffer size, to be + uid_t mounted_uid; + int connection; /* Connection number the server assigned us */ + int buffer_size; /* The negotiated buffer size, to be used for read/write requests! */ - int volume_number; - __u32 directory_id; -}; + int volume_number; + __u32 directory_id; +}; #define NCP_IOC_NCPREQUEST _IOR('n', 1, struct ncp_ioctl_request) #define NCP_IOC_GETMOUNTUID _IOW('n', 2, uid_t) @@ -53,8 +53,6 @@ struct ncp_fs_info { #define NCP_MAXPATHLEN 255 #define NCP_MAXNAMELEN 14 -#define NCP_MSG_COMMAND "/sbin/nwmsg" - #ifdef __KERNEL__ /* The readdir cache size controls how many directory entries are @@ -62,7 +60,6 @@ struct ncp_fs_info { */ #define NCP_READDIR_CACHE_SIZE 64 - #define NCP_MAX_RPC_TIMEOUT (6*HZ) /* Guess, what 0x564c is :-) */ @@ -84,26 +81,25 @@ extern int ncp_malloced; extern int ncp_current_malloced; static inline void * -ncp_kmalloc(unsigned int size, int priority) + ncp_kmalloc(unsigned int size, int priority) { - ncp_malloced += 1; - ncp_current_malloced += 1; - return kmalloc(size, priority); + ncp_malloced += 1; + ncp_current_malloced += 1; + return kmalloc(size, priority); } -static inline void -ncp_kfree_s(void *obj, int size) +static inline void ncp_kfree_s(void *obj, int size) { - ncp_current_malloced -= 1; - kfree_s(obj, size); + ncp_current_malloced -= 1; + kfree_s(obj, size); } -#else /* DEBUG_NCP_MALLOC */ +#else /* DEBUG_NCP_MALLOC */ #define ncp_kmalloc(s,p) kmalloc(s,p) #define ncp_kfree_s(o,s) kfree_s(o,s) -#endif /* DEBUG_NCP_MALLOC */ +#endif /* DEBUG_NCP_MALLOC */ #if DEBUG_NCP > 0 #define DPRINTK(format, args...) printk(format , ## args) @@ -127,39 +123,35 @@ extern struct inode_operations ncp_dir_inode_operations; void ncp_free_inode_info(struct ncp_inode_info *i); void ncp_free_all_inodes(struct ncp_server *server); void ncp_init_root(struct ncp_server *server); -int ncp_conn_logged_in(struct ncp_server *server); +int ncp_conn_logged_in(struct ncp_server *server); void ncp_init_dir_cache(void); void ncp_invalid_dir_cache(struct inode *ino); struct ncp_inode_info *ncp_find_inode(struct inode *inode); ino_t ncp_info_ino(struct ncp_server *server, struct ncp_inode_info *info); void ncp_free_dir_cache(void); -int ncp_date_dos2unix(__u16 time, __u16 date); -void ncp_date_unix2dos(int unix_date, __u16 *time, __u16 *date); +int ncp_date_dos2unix(__u16 time, __u16 date); +void ncp_date_unix2dos(int unix_date, __u16 * time, __u16 * date); /* linux/fs/ncpfs/ioctl.c */ -int ncp_ioctl (struct inode * inode, struct file * filp, - unsigned int cmd, unsigned long arg); +int ncp_ioctl(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); /* linux/fs/ncpfs/inode.c */ struct super_block *ncp_read_super(struct super_block *sb, - void *raw_data, int silent); + void *raw_data, int silent); extern int init_ncp_fs(void); -void ncp_trigger_message(struct ncp_server *server); /* linux/fs/ncpfs/sock.c */ int ncp_request(struct ncp_server *server, int function); int ncp_connect(struct ncp_server *server); int ncp_disconnect(struct ncp_server *server); -int ncp_catch_watchdog(struct ncp_server *server); -int ncp_dont_catch_watchdog(struct ncp_server *server); -int ncp_catch_message(struct ncp_server *server); void ncp_lock_server(struct ncp_server *server); void ncp_unlock_server(struct ncp_server *server); /* linux/fs/ncpfs/mmap.c */ -int ncp_mmap(struct inode * inode, struct file * file, struct vm_area_struct * vma); +int ncp_mmap(struct inode *inode, struct file *file, struct vm_area_struct *vma); -#endif /* __KERNEL__ */ +#endif /* __KERNEL__ */ -#endif /* _LINUX_NCP_FS_H */ +#endif /* _LINUX_NCP_FS_H */ diff --git a/include/linux/ncp_fs_i.h b/include/linux/ncp_fs_i.h index 02ad1b452..3df38b287 100644 --- a/include/linux/ncp_fs_i.h +++ b/include/linux/ncp_fs_i.h @@ -13,21 +13,21 @@ #ifdef __KERNEL__ enum ncp_inode_state { - NCP_INODE_VALID = 19, /* Inode currently in use */ - NCP_INODE_LOOKED_UP, /* directly before iget */ - NCP_INODE_CACHED, /* in a path to an inode which is in use */ - NCP_INODE_INVALID + NCP_INODE_VALID = 19, /* Inode currently in use */ + NCP_INODE_LOOKED_UP, /* directly before iget */ + NCP_INODE_CACHED, /* in a path to an inode which is in use */ + NCP_INODE_INVALID }; /* * ncp fs inode data (in memory only) */ struct ncp_inode_info { - enum ncp_inode_state state; - int nused; /* for directories: - number of references in memory */ - struct ncp_inode_info *dir; - struct ncp_inode_info *next, *prev; + enum ncp_inode_state state; + int nused; /* for directories: + number of references in memory */ + struct ncp_inode_info *dir; + struct ncp_inode_info *next, *prev; struct inode *inode; struct nw_file_info finfo; }; diff --git a/include/linux/ncp_fs_sb.h b/include/linux/ncp_fs_sb.h index 6d1d7c510..cfe205547 100644 --- a/include/linux/ncp_fs_sb.h +++ b/include/linux/ncp_fs_sb.h @@ -17,60 +17,52 @@ struct ncp_server { - struct ncp_mount_data m; /* Nearly all of the mount data is of - interest for us later, so we store - it completely. */ + struct ncp_mount_data m; /* Nearly all of the mount data is of + interest for us later, so we store + it completely. */ __u8 name_space[NCP_NUMBER_OF_VOLUMES]; struct file *ncp_filp; /* File pointer to ncp socket */ - struct file *wdog_filp; /* File pointer to wdog socket */ - struct file *msg_filp; /* File pointer to message socket */ - void *data_ready; /* The wdog socket gets a new - data_ready callback. We store the - old one for checking purposes and - to reset it on unmounting. */ - - u8 sequence; - u8 task; - u16 connection; /* Remote connection number */ - - u8 completion; /* Status message from server */ - u8 conn_status; /* Bit 4 = 1 ==> Server going down, no + + u8 sequence; + u8 task; + u16 connection; /* Remote connection number */ + + u8 completion; /* Status message from server */ + u8 conn_status; /* Bit 4 = 1 ==> Server going down, no requests allowed anymore. Bit 0 = 1 ==> Server is down. */ - int buffer_size; /* Negotiated bufsize */ + int buffer_size; /* Negotiated bufsize */ - int reply_size; /* Size of last reply */ + int reply_size; /* Size of last reply */ - int packet_size; + int packet_size; unsigned char *packet; /* Here we prepare requests and receive replies */ - int lock; /* To prevent mismatch in protocols. */ + int lock; /* To prevent mismatch in protocols. */ struct wait_queue *wait; - int current_size; /* for packet preparation */ - int has_subfunction; - int ncp_reply_size; + int current_size; /* for packet preparation */ + int has_subfunction; + int ncp_reply_size; - struct ncp_inode_info root; - char root_path; /* '\0' */ + struct ncp_inode_info root; + char root_path; /* '\0' */ }; -static inline int -ncp_conn_valid(struct ncp_server *server) +static inline int ncp_conn_valid(struct ncp_server *server) { return ((server->conn_status & 0x11) == 0); } -static inline void -ncp_invalidate_conn(struct ncp_server *server) +static inline void ncp_invalidate_conn(struct ncp_server *server) { server->conn_status |= 0x01; } -#endif /* __KERNEL__ */ +#endif /* __KERNEL__ */ #endif diff --git a/include/linux/ncp_mount.h b/include/linux/ncp_mount.h index 3de288659..ed169e70a 100644 --- a/include/linux/ncp_mount.h +++ b/include/linux/ncp_mount.h @@ -13,10 +13,7 @@ #include <linux/ncp.h> #include <linux/ncp_fs_i.h> -#define NCP_MOUNT_VERSION 2 - -#define NCP_USERNAME_LEN (NCP_BINDERY_NAME_LEN) -#define NCP_PASSWORD_LEN 20 +#define NCP_MOUNT_VERSION 3 /* Values for flags */ #define NCP_MOUNT_SOFT 0x0001 @@ -25,25 +22,19 @@ struct ncp_mount_data { int version; unsigned int ncp_fd; /* The socket to the ncp port */ - unsigned int wdog_fd; /* Watchdog packets come here */ - unsigned int message_fd; /* Message notifications come here */ - uid_t mounted_uid; /* Who may umount() this filesystem? */ - - struct sockaddr_ipx serv_addr; - unsigned char server_name[NCP_BINDERY_NAME_LEN]; - - unsigned char mount_point[PATH_MAX+1]; - unsigned char mounted_vol[NCP_VOLNAME_LEN+1]; + uid_t mounted_uid; /* Who may umount() this filesystem? */ + pid_t wdog_pid; /* Who cares for our watchdog packets? */ + unsigned char mounted_vol[NCP_VOLNAME_LEN + 1]; unsigned int time_out; /* How long should I wait after sending a NCP request? */ - unsigned int retry_count; /* And how often should I retry? */ + unsigned int retry_count; /* And how often should I retry? */ unsigned int flags; - uid_t uid; - gid_t gid; - mode_t file_mode; - mode_t dir_mode; + uid_t uid; + gid_t gid; + mode_t file_mode; + mode_t dir_mode; }; #endif diff --git a/include/linux/net.h b/include/linux/net.h index a338a8efd..bd30d7804 100644 --- a/include/linux/net.h +++ b/include/linux/net.h @@ -57,38 +57,31 @@ typedef enum { #define SO_NOSPACE (1<<18) /* no space to write */ #ifdef __KERNEL__ -/* - * Internal representation of a socket. not all the fields are used by - * all configurations: - * - * server client - * conn client connected to server connected to - * iconn list of clients -unused- - * awaiting connections - * wait sleep for clients, sleep for connection, - * sleep for i/o sleep for i/o - */ -struct socket { - short type; /* SOCK_STREAM, ... */ - socket_state state; - long flags; - struct proto_ops *ops; /* protocols do most everything */ - void *data; /* protocol data */ - struct socket *conn; /* server socket connected to */ - struct socket *iconn; /* incomplete client conn.s */ - struct socket *next; - struct wait_queue **wait; /* ptr to place to wait on */ - struct inode *inode; - struct fasync_struct *fasync_list; /* Asynchronous wake up list */ - struct file *file; /* File back pointer for gc */ + +struct socket +{ + socket_state state; + + unsigned long flags; + struct proto_ops *ops; + struct inode *inode; + struct fasync_struct *fasync_list; /* Asynchronous wake up list */ + struct file *file; /* File back pointer for gc */ + struct sock *sk; + struct wait_queue *wait; + + short type; + unsigned char passcred; + unsigned char tli; }; #define SOCK_INODE(S) ((S)->inode) +struct scm_cookie; + struct proto_ops { int family; - int (*create) (struct socket *sock, int protocol); int (*dup) (struct socket *newsock, struct socket *oldsock); int (*release) (struct socket *sock, struct socket *peer); int (*bind) (struct socket *sock, struct sockaddr *umyaddr, @@ -100,8 +93,7 @@ struct proto_ops { int flags); int (*getname) (struct socket *sock, struct sockaddr *uaddr, int *usockaddr_len, int peer); - int (*select) (struct socket *sock, int sel_type, - select_table *wait); + unsigned int (*poll) (struct socket *sock, poll_table *wait); int (*ioctl) (struct socket *sock, unsigned int cmd, unsigned long arg); int (*listen) (struct socket *sock, int len); @@ -112,19 +104,37 @@ struct proto_ops { char *optval, int *optlen); int (*fcntl) (struct socket *sock, unsigned int cmd, unsigned long arg); - int (*sendmsg) (struct socket *sock, struct msghdr *m, int total_len, int nonblock, int flags); - int (*recvmsg) (struct socket *sock, struct msghdr *m, int total_len, int nonblock, int flags, int *addr_len); + int (*sendmsg) (struct socket *sock, struct msghdr *m, int total_len, struct scm_cookie *scm); + int (*recvmsg) (struct socket *sock, struct msghdr *m, int total_len, int flags, struct scm_cookie *scm); +}; + +struct net_proto_family +{ + int family; + int (*create)(struct socket *sock, int protocol); + /* These are counters for the number of different methods of + each we support */ + short authentication; + short encryption; + short encrypt_net; }; -struct net_proto { +struct net_proto +{ const char *name; /* Protocol name */ void (*init_func)(struct net_proto *); /* Bootstrap */ }; -extern int sock_wake_async(struct socket *sock, int how); -extern int sock_register(int family, struct proto_ops *ops); +extern struct net_proto_family *net_families[]; +extern int sock_wake_async(struct socket *sk, int how); +extern int sock_register(struct net_proto_family *fam); extern int sock_unregister(int family); extern struct socket *sock_alloc(void); -extern void sock_release(struct socket *sock); +extern int sock_create(int family, int type, int proto, struct socket **); +extern void sock_release(struct socket *); +extern int sock_sendmsg(struct socket *, struct msghdr *m, int len); +extern int sock_recvmsg(struct socket *, struct msghdr *m, int len, int flags); +extern int sock_readv_writev(int type, struct inode * inode, struct file * file, + const struct iovec * iov, long count, long size); #endif /* __KERNEL__ */ #endif /* _LINUX_NET_H */ diff --git a/include/linux/net_alias.h b/include/linux/net_alias.h index 67a9f9bea..54ba8525c 100644 --- a/include/linux/net_alias.h +++ b/include/linux/net_alias.h @@ -17,6 +17,9 @@ #ifndef _NET_ALIAS_H #define _NET_ALIAS_H +#include <linux/config.h> + +#ifdef CONFIG_NET_ALIAS #include <linux/types.h> #include <linux/if.h> #include <linux/netdevice.h> @@ -33,20 +36,20 @@ struct net_alias_type; /* - * main alias structure - * note that *defines* dev & devname + * Main alias structure + * Note that *defines* dev & devname. */ struct net_alias { - struct device dev; /* alias device defn*/ - char name[IFNAMSIZ]; /* device name defn */ - unsigned hash; /* my hash value: for quick rehash */ - unsigned slot; /* slot number */ - void *data; /* private data */ - struct device *main_dev; /* pointer to main device */ - struct net_alias_type *nat; /* alias type object bound */ - struct net_alias *next; /* next alias (hashed linked list) */ + struct device dev; /* alias device defn*/ + char name[IFNAMSIZ]; /* device name defn */ + unsigned hash; /* my hash value: for quick rehash */ + unsigned slot; /* slot number */ + void *data; /* private data */ + struct device *main_dev; /* pointer to main device */ + struct net_alias_type *nat; /* alias type object bound */ + struct net_alias *next; /* next alias (hashed linked list) */ }; @@ -57,59 +60,102 @@ struct net_alias struct net_alias_info { - int n_aliases; /* num aliases */ - struct device *taildev; /* my last (alias) device */ - struct net_alias *hash_tab[16]; /* hashed alias table */ + int n_aliases; /* num aliases */ + struct device *taildev; /* my last (alias) device */ + struct net_alias *hash_tab[16]; /* hashed alias table */ }; /* - * net_alias_type class - * declares a generic (AF_ independent) structure that will - * manage generic to family-specific behavior. + * net_alias_type class + * Declares a generic (AF_ independent) structure that will + * manage generic to family-specific behavior. */ struct net_alias_type { - int type; /* aliasing type: address family */ - int n_attach; /* number of aliases attached */ - char name[16]; /* af_name */ - __u32 (*get_addr32) /* get __u32 addr 'representation'*/ - (struct net_alias_type *this, struct sockaddr*); - int (*dev_addr_chk) /* address checking func: */ - (struct net_alias_type *this, struct device *, struct sockaddr *); - struct device * (*dev_select) /* closest alias selector*/ - (struct net_alias_type *this, struct device *, struct sockaddr *sa); - int (*alias_init_1) /* called after alias creation: */ - (struct net_alias_type *this,struct net_alias *alias, struct sockaddr *sa); - int (*alias_done_1) /* called before alias deletion */ - (struct net_alias_type *this, struct net_alias *alias); - int (*alias_print_1) - (struct net_alias_type *this, struct net_alias *alias, char *buf, int len); - struct net_alias_type *next; /* link */ + int type; /* aliasing type: address family */ + int n_attach; /* number of aliases attached */ + char name[16]; /* af_name */ + __u32 (*get_addr32) /* get __u32 addr 'representation'*/ + (struct net_alias_type *this, struct sockaddr*); + int (*dev_addr_chk) /* address checking func: */ + (struct net_alias_type *this, struct device *, struct sockaddr *); + struct device * (*dev_select) /* closest alias selector*/ + (struct net_alias_type *this, struct device *, struct sockaddr *sa); + int (*alias_init_1) /* called after alias creation: */ + (struct net_alias_type *this,struct net_alias *alias, struct sockaddr *sa); + int (*alias_done_1) /* called before alias deletion */ + (struct net_alias_type *this, struct net_alias *alias); + int (*alias_print_1) + (struct net_alias_type *this, struct net_alias *alias, char *buf, int len); + struct net_alias_type *next; /* link */ }; /* - * is dev an alias? + * is dev an alias? + */ + +#ifdef CONFIG_NET_ALIAS + +extern __inline__ int net_alias_is(struct device *dev) +{ + return (dev->my_alias != NULL); +} + +/* + * Does dev have aliases? */ -static __inline__ int -net_alias_is(struct device *dev) +extern __inline__ int net_alias_has(struct device *dev) { - return (dev->my_alias != NULL); + return (dev->alias_info != NULL); } +/* + * Returns MY 'true' main device + * intended for alias devices + */ + +extern __inline__ struct device *net_alias_main_dev(struct device *dev) +{ + return (net_alias_is(dev))? dev->my_alias->main_dev : dev; +} + + +/* + * Returns NEXT 'true' device + * intended for true devices + */ + +extern __inline__ struct device *net_alias_nextdev(struct device *dev) +{ + return (dev->alias_info)? dev->alias_info->taildev->next : dev->next; +} /* - * does dev have aliases? + * Sets NEXT 'true' device + * Intended for main devices (treat main device as block: dev+aliases). */ -static __inline__ int -net_alias_has(struct device *dev) +extern __inline__ struct device *net_alias_nextdev_set(struct device *dev, struct device *nextdev) { - return (dev->alias_info != NULL); + struct device *pdev = dev; + if (net_alias_has(dev)) + { + pdev = dev->alias_info->taildev; /* point to last dev alias */ + } + pdev->next = nextdev; + return nextdev; } +#else + +#define net_alias_has(dev) (0) +#define net_alias_is(dev) (0) +#define net_alias_main_dev(dev) (dev) +#endif + extern void net_alias_init(void); @@ -129,44 +175,13 @@ extern struct device * net_alias_dev_rcv_sel(struct device *main_dev, struct soc extern struct device * net_alias_dev_rcv_sel32(struct device *main_dev, int family, __u32 src, __u32 dst); -/* - * returns MY 'true' main device - * intended for alias devices - */ - -static __inline__ struct device *net_alias_main_dev(struct device *dev) -{ - return (net_alias_is(dev))? dev->my_alias->main_dev : dev; -} +#else -/* - * returns NEXT 'true' device - * intended for true devices - */ +#define net_alias_is(a) 0 +#define net_alias_main_dev(dev) (dev) +#define net_alias_has(dev) 0 -static __inline__ struct device * -net_alias_nextdev(struct device *dev) -{ - return (dev->alias_info)? dev->alias_info->taildev->next : dev->next; -} - - -/* - * sets NEXT 'true' device - * intended for main devices (treat main device as block: dev+aliases). - */ - -static __inline__ struct device * -net_alias_nextdev_set(struct device *dev, struct device *nextdev) -{ - struct device *pdev = dev; - if (net_alias_has(dev)) - { - pdev = dev->alias_info->taildev; /* point to last dev alias */ - } - pdev->next = nextdev; - return nextdev; -} +#endif #endif /* _NET_ALIAS_H */ diff --git a/include/linux/netbeui.h b/include/linux/netbeui.h new file mode 100644 index 000000000..2fb2f71b4 --- /dev/null +++ b/include/linux/netbeui.h @@ -0,0 +1,16 @@ +#ifndef _LINUX_NETBEUI_H +#define _LINUX_NETBEUI_H + +#include <linux/if.h> + +#define NB_NAME_LEN 20 /* Set this properly from the full docs when + I get them */ + +struct sockaddr_netbeui +{ + sa_family snb_family; + char snb_name[NB_NAME_LEN]; + char snb_devhint[IFNAMSIZ]; +}; + +#endif diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 55c72a1c7..3f2301ace 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -10,8 +10,8 @@ * Authors: Ross Biro, <bir7@leland.Stanford.Edu> * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> * Corey Minyard <wf-rch!minyard@relay.EU.net> - * Donald J. Becker, <becker@super.org> - * Alan Cox, <A.Cox@swansea.ac.uk> + * Donald J. Becker, <becker@cesdis.gsfc.nasa.gov> + * Alan Cox, <Alan.Cox@linux.org> * Bjorn Ekwall. <bj0rn@blox.se> * * This program is free software; you can redistribute it and/or @@ -28,10 +28,20 @@ #include <linux/if.h> #include <linux/if_ether.h> -/* for future expansion when we will have different priorities. */ -#define DEV_NUMBUFFS 3 -#define MAX_ADDR_LEN 7 +#include <asm/atomic.h> +/* + * For future expansion when we will have different priorities. + */ + +#define DEV_NUMBUFFS 3 /* Number of queues per device */ +#define MAX_ADDR_LEN 7 /* Largest hardware address length */ + +/* + * Compute the worst case header length according to the protocols + * used. + */ + #if !defined(CONFIG_AX25) && !defined(CONFIG_AX25_MODULE) && !defined(CONFIG_TR) #define LL_MAX_HEADER 32 #else @@ -55,9 +65,13 @@ #define IS_INVBCAST 4 /* Wrong netmask bcast not for us (unused)*/ #define IS_MULTICAST 5 /* Multicast IP address */ -#ifdef __KERNEL__ +/* NOTE: move to ipv4_device.h */ -#include <linux/skbuff.h> +#define IFF_IP_ADDR_OK 1 +#define IFF_IP_MASK_OK 2 +#define IFF_IP_BRD_OK 4 + +struct neighbour; /* * We tag multicasts with these structures. @@ -73,176 +87,236 @@ struct dev_mc_list struct hh_cache { - struct hh_cache *hh_next; - void *hh_arp; /* Opaque pointer, used by - * any address resolution module, - * not only ARP. - */ - int hh_refcnt; /* number of users */ + struct hh_cache *hh_next; /* Next entry */ + atomic_t hh_refcnt; /* number of users */ unsigned short hh_type; /* protocol identifier, f.e ETH_P_IP */ - char hh_uptodate; /* hh_data is valid */ - char hh_data[16]; /* cached hardware header */ + char hh_uptodate; /* hh_data is valid */ + /* cached hardware header; allow for machine alignment needs. */ + unsigned long hh_data[16/sizeof(unsigned long)]; }; /* - * The DEVICE structure. - * Actually, this whole structure is a big mistake. It mixes I/O - * data with strictly "high-level" data, and it has to know about - * almost every data structure used in the INET module. + * Network device statistics. Akin to the 2.0 ether stats but + * with byte counters. */ -struct device + +struct net_device_stats { + unsigned long rx_packets; /* total packets received */ + unsigned long tx_packets; /* total packets transmitted */ + unsigned long rx_bytes; /* total bytes received */ + unsigned long tx_bytes; /* total bytes transmitted */ + unsigned long rx_errors; /* bad packets received */ + unsigned long tx_errors; /* packet transmit problems */ + unsigned long rx_dropped; /* no space in linux buffers */ + unsigned long tx_dropped; /* no space available in linux */ + unsigned long multicast; /* multicast packets received */ + unsigned long collisions; + + /* detailed rx_errors: */ + unsigned long rx_length_errors; + unsigned long rx_over_errors; /* receiver ring buff overflow */ + unsigned long rx_crc_errors; /* recved pkt with crc error */ + unsigned long rx_frame_errors; /* recv'd frame alignment error */ + unsigned long rx_fifo_errors; /* recv'r fifo overrun */ + unsigned long rx_missed_errors; /* receiver missed packet */ + + /* detailed tx_errors */ + unsigned long tx_aborted_errors; + unsigned long tx_carrier_errors; + unsigned long tx_fifo_errors; + unsigned long tx_heartbeat_errors; + unsigned long tx_window_errors; + +}; - /* - * This is the first field of the "visible" part of this structure - * (i.e. as seen by users in the "Space.c" file). It is the name - * the interface. - */ - char *name; - - /* I/O specific fields - FIXME: Merge these and struct ifmap into one */ - unsigned long rmem_end; /* shmem "recv" end */ - unsigned long rmem_start; /* shmem "recv" start */ - unsigned long mem_end; /* shared mem end */ - unsigned long mem_start; /* shared mem start */ - unsigned long base_addr; /* device I/O address */ - unsigned char irq; /* device IRQ number */ - - /* Low-level status flags. */ - volatile unsigned char start, /* start an operation */ - interrupt; /* interrupt arrived */ - unsigned long tbusy; /* transmitter busy must be long for bitops */ - - struct device *next; - - /* The device initialization function. Called only once. */ - int (*init)(struct device *dev); - - /* Some hardware also needs these fields, but they are not part of the - usual set specified in Space.c. */ - unsigned char if_port; /* Selectable AUI, TP,..*/ - unsigned char dma; /* DMA channel */ - - struct enet_statistics* (*get_stats)(struct device *dev); - - /* - * This marks the end of the "visible" part of the structure. All - * fields hereafter are internal to the system, and may change at - * will (read: may be cleaned up at will). - */ - - /* These may be needed for future network-power-down code. */ - unsigned long trans_start; /* Time (in jiffies) of last Tx */ - unsigned long last_rx; /* Time of last Rx */ - - unsigned short flags; /* interface flags (a la BSD) */ - unsigned short family; /* address family ID (AF_INET) */ - unsigned short metric; /* routing metric (not used) */ - unsigned short mtu; /* interface MTU value */ - unsigned short type; /* interface hardware type */ - unsigned short hard_header_len; /* hardware hdr length */ - void *priv; /* pointer to private data */ - - /* Interface address info. */ - unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ - unsigned char pad; /* make dev_addr aligned to 8 bytes */ - unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address */ - unsigned char addr_len; /* hardware address length */ -#if 0 - __u32 pa_addr_arr[4]; - __u16 pa_prefix_len; -#define pa_addr pa_addr_arr[3]; -#else - unsigned long pa_addr; /* protocol address */ -#endif - unsigned long pa_brdaddr; /* protocol broadcast addr */ - unsigned long pa_dstaddr; /* protocol P-P other side addr */ - unsigned long pa_mask; /* protocol netmask */ - unsigned short pa_alen; /* protocol address length */ +#ifdef __KERNEL__ + +#include <linux/skbuff.h> + +/* + * The DEVICE structure. + * Actually, this whole structure is a big mistake. It mixes I/O + * data with strictly "high-level" data, and it has to know about + * almost every data structure used in the INET module. + * + * FIXME: cleanup struct device such that network protocol info + * moves out. + */ - struct dev_mc_list *mc_list; /* Multicast mac addresses */ - int mc_count; /* Number of installed mcasts */ +struct device +{ + + /* + * This is the first field of the "visible" part of this structure + * (i.e. as seen by users in the "Space.c" file). It is the name + * the interface. + */ + char *name; + + /* + * I/O specific fields + * FIXME: Merge these and struct ifmap into one + */ + unsigned long rmem_end; /* shmem "recv" end */ + unsigned long rmem_start; /* shmem "recv" start */ + unsigned long mem_end; /* shared mem end */ + unsigned long mem_start; /* shared mem start */ + unsigned long base_addr; /* device I/O address */ + unsigned char irq; /* device IRQ number */ + + /* Low-level status flags. */ + volatile unsigned char start, /* start an operation */ + interrupt; /* interrupt arrived */ + unsigned long tbusy; /* transmitter busy must be + long for bitops */ + + struct device *next; + + /* The device initialization function. Called only once. */ + int (*init)(struct device *dev); + + /* Interface index. Unique device identifier */ + int ifindex; + struct device *next_up; + + /* + * Some hardware also needs these fields, but they are not + * part of the usual set specified in Space.c. + */ + + unsigned char if_port; /* Selectable AUI, TP,..*/ + unsigned char dma; /* DMA channel */ + + struct net_device_stats* (*get_stats)(struct device *dev); + struct iw_statistics* (*get_wireless_stats)(struct device *dev); + + /* + * This marks the end of the "visible" part of the structure. All + * fields hereafter are internal to the system, and may change at + * will (read: may be cleaned up at will). + */ + + /* These may be needed for future network-power-down code. */ + unsigned long trans_start; /* Time (in jiffies) of last Tx */ + unsigned long last_rx; /* Time of last Rx */ + + unsigned short flags; /* interface flags (a la BSD) */ + unsigned short family; /* address family ID (AF_INET) */ + unsigned short metric; /* routing metric (not used) */ + unsigned short mtu; /* interface MTU value */ + unsigned short type; /* interface hardware type */ + unsigned short hard_header_len; /* hardware hdr length */ + void *priv; /* pointer to private data */ + + /* Interface address info. */ + unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ + unsigned char pad; /* make dev_addr aligned to 8 bytes */ + unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address */ + unsigned char addr_len; /* hardware address length */ + unsigned long pa_addr; /* protocol address */ + + unsigned long pa_brdaddr; /* protocol broadcast addr */ + unsigned long pa_dstaddr; /* protocol P-P other side addr */ + unsigned long pa_mask; /* protocol netmask */ + unsigned short pa_alen; /* protocol address length */ + + struct dev_mc_list *mc_list; /* Multicast mac addresses */ + int mc_count; /* Number of installed mcasts */ - struct ip_mc_list *ip_mc_list; /* IP multicast filter chain */ - __u32 tx_queue_len; /* Max frames per queue allowed */ + struct ip_mc_list *ip_mc_list; /* IP multicast filter chain */ + unsigned ip_flags; /* IP layer control flags */ + __u32 tx_queue_len; /* Max frames per queue allowed */ - /* For load balancing driver pair support */ - - unsigned long pkt_queue; /* Packets queued */ - struct device *slave; /* Slave device */ - struct net_alias_info *alias_info; /* main dev alias info */ - struct net_alias *my_alias; /* alias devs */ + /* For load balancing driver pair support */ - /* Pointer to the interface buffers. */ - struct sk_buff_head buffs[DEV_NUMBUFFS]; - - /* Pointers to interface service routines. */ - int (*open)(struct device *dev); - int (*stop)(struct device *dev); - int (*hard_start_xmit) (struct sk_buff *skb, - struct device *dev); - int (*hard_header) (struct sk_buff *skb, - struct device *dev, - unsigned short type, - void *daddr, - void *saddr, - unsigned len); - int (*rebuild_header)(void *eth, struct device *dev, - unsigned long raddr, struct sk_buff *skb); + unsigned long pkt_queue; /* Packets queued */ + struct device *slave; /* Slave device */ + struct net_alias_info *alias_info; /* main dev alias info */ + struct net_alias *my_alias; /* alias devs */ + + /* Protocol specific pointers */ + + void *atalk_ptr; /* Appletalk link */ + void *ip_ptr; /* Not used yet */ + + /* Pointer to the interface buffers. */ + struct sk_buff_head buffs[DEV_NUMBUFFS]; + + /* Pointers to interface service routines. */ + int (*open)(struct device *dev); + int (*stop)(struct device *dev); + int (*hard_start_xmit) (struct sk_buff *skb, + struct device *dev); + int (*hard_header) (struct sk_buff *skb, + struct device *dev, + unsigned short type, + void *daddr, + void *saddr, + unsigned len); + int (*rebuild_header)(struct sk_buff *skb); #define HAVE_MULTICAST - void (*set_multicast_list)(struct device *dev); + void (*set_multicast_list)(struct device *dev); #define HAVE_SET_MAC_ADDR - int (*set_mac_address)(struct device *dev, void *addr); + int (*set_mac_address)(struct device *dev, + void *addr); #define HAVE_PRIVATE_IOCTL - int (*do_ioctl)(struct device *dev, struct ifreq *ifr, int cmd); + int (*do_ioctl)(struct device *dev, + struct ifreq *ifr, int cmd); #define HAVE_SET_CONFIG - int (*set_config)(struct device *dev, struct ifmap *map); + int (*set_config)(struct device *dev, + struct ifmap *map); #define HAVE_HEADER_CACHE - void (*header_cache_bind)(struct hh_cache **hhp, struct device *dev, unsigned short htype, __u32 daddr); - void (*header_cache_update)(struct hh_cache *hh, struct device *dev, unsigned char * haddr); + int (*hard_header_cache)(struct dst_entry *dst, + struct neighbour *neigh, + struct hh_cache *hh); + void (*header_cache_update)(struct hh_cache *hh, + struct device *dev, + unsigned char * haddr); #define HAVE_CHANGE_MTU - int (*change_mtu)(struct device *dev, int new_mtu); + int (*change_mtu)(struct device *dev, int new_mtu); + }; -struct packet_type { - unsigned short type; /* This is really htons(ether_type). */ - struct device * dev; - int (*func) (struct sk_buff *, struct device *, - struct packet_type *); - void *data; - struct packet_type *next; +struct packet_type +{ + unsigned short type; /* This is really htons(ether_type). */ + struct device *dev; /* NULL is wildcarded here */ + int (*func) (struct sk_buff *, struct device *, + struct packet_type *); + void *data; /* Private to the packet type */ + struct packet_type *next; }; #include <linux/interrupt.h> #include <linux/notifier.h> -/* Used by dev_rint */ -#define IN_SKBUFF 1 - -extern volatile unsigned long in_bh; - -extern struct device loopback_dev; -extern struct device *dev_base; -extern struct packet_type *ptype_base[16]; +extern struct device loopback_dev; /* The loopback */ +extern struct device *dev_base; /* All devices */ +extern struct packet_type *ptype_base[16]; /* Hashed types */ +/* NOTE: move to INET specific header; + __ip_chk_addr is deprecated, do not use if it's possible. + */ -extern int ip_addr_match(unsigned long addr1, unsigned long addr2); -extern int ip_chk_addr(unsigned long addr); -extern struct device *ip_dev_bynet(unsigned long daddr, unsigned long mask); -extern unsigned long ip_my_addr(void); -extern unsigned long ip_get_mask(unsigned long addr); -extern struct device *ip_dev_find(unsigned long addr); -extern struct device *dev_getbytype(unsigned short type); +extern int __ip_chk_addr(unsigned long addr); +extern struct device *ip_dev_find(unsigned long addr, char *name); +/* This is the wrong place but it'll do for the moment */ +extern void ip_mc_allhost(struct device *dev); +extern int devinet_ioctl(unsigned int cmd, void *); +extern struct device *dev_getbyhwaddr(unsigned short type, char *hwaddr); extern void dev_add_pack(struct packet_type *pt); extern void dev_remove_pack(struct packet_type *pt); extern struct device *dev_get(const char *name); +extern struct device *dev_alloc(const char *name, int *err); +extern int dev_alloc_name(struct device *dev, const char *name); extern int dev_open(struct device *dev); extern int dev_close(struct device *dev); -extern void dev_queue_xmit(struct sk_buff *skb, struct device *dev, - int pri); +extern int dev_queue_xmit(struct sk_buff *skb); +extern void dev_loopback_xmit(struct sk_buff *skb); #define HAVE_NETIF_RX 1 extern void netif_rx(struct sk_buff *skb); @@ -255,61 +329,77 @@ extern void dev_init(void); /* Locking protection for page faults during outputs to devices unloaded during the fault */ -extern int dev_lockct; +extern atomic_t dev_lockct; /* - * These two don't currently need to be interrupt-safe + * These two don't currently need to be atomic * but they may do soon. Do it properly anyway. */ extern __inline__ void dev_lock_list(void) { - unsigned long flags; - save_flags(flags); - cli(); - dev_lockct++; - restore_flags(flags); + atomic_inc(&dev_lockct); } extern __inline__ void dev_unlock_list(void) { - unsigned long flags; - save_flags(flags); - cli(); - dev_lockct--; - restore_flags(flags); + atomic_dec(&dev_lockct); } /* * This almost never occurs, isn't in performance critical paths - * and we can thus be relaxed about it + * and we can thus be relaxed about it. + * + * FIXME: What if this is being run as a real time process ?? + * Linus: We need a way to force a yield here ? */ extern __inline__ void dev_lock_wait(void) { - while(dev_lockct) + while(atomic_read(&dev_lockct)) schedule(); } +/* + * Buffer initialisation function. This used to appear in all the + * drivers but is now an inline in case we ever want to change the + * schemes used. + */ + +extern __inline__ void dev_init_buffers(struct device *dev) +{ + int i; + for(i=0;i<DEV_NUMBUFFS;i++) + { + skb_queue_head_init(&dev->buffs[i]); + } +} + /* These functions live elsewhere (drivers/net/net_init.c, but related) */ extern void ether_setup(struct device *dev); extern void fddi_setup(struct device *dev); extern void tr_setup(struct device *dev); +extern void tr_freedev(struct device *dev); extern int ether_config(struct device *dev, struct ifmap *map); /* Support for loadable net-drivers */ extern int register_netdev(struct device *dev); extern void unregister_netdev(struct device *dev); extern int register_netdevice_notifier(struct notifier_block *nb); extern int unregister_netdevice_notifier(struct notifier_block *nb); +extern int register_trdev(struct device *dev); +extern void unregister_trdev(struct device *dev); /* Functions used for multicast support */ extern void dev_mc_upload(struct device *dev); extern void dev_mc_delete(struct device *dev, void *addr, int alen, int all); extern void dev_mc_add(struct device *dev, void *addr, int alen, int newonly); extern void dev_mc_discard(struct device *dev); -/* This is the wrong place but it'll do for the moment */ -extern void ip_mc_allhost(struct device *dev); +/* Load a device via the kerneld */ +extern void dev_load(const char *name); +extern int dev_new_index(void); +extern struct device * dev_get_by_index(int ifindex); + #endif /* __KERNEL__ */ #endif /* _LINUX_DEV_H */ diff --git a/include/linux/netlink.h b/include/linux/netlink.h new file mode 100644 index 000000000..711687af8 --- /dev/null +++ b/include/linux/netlink.h @@ -0,0 +1,20 @@ +#ifndef __LINUX_NETLINK_H +#define __LINUX_NETLINK_H + +struct nlmsghdr +{ + unsigned long nlmsg_len; /* Length of message including header */ + unsigned long nlmsg_type; /* Message type */ + unsigned long nlmsg_seq; /* Sequence number */ + unsigned long nlmsg_pid; /* Sending process PID */ + unsigned char nlmsg_data[0]; +}; + +#define NLMSG_ALIGN(len) ( ((len)+sizeof(long)-1) & ~(sizeof(long)-1) ) + +#define NLMSG_ACK 0x01 /* int - error code */ +#define NLMSG_OVERRUN 0x02 /* unsigned long[2] - start and end + * of lost message sequence numbers. + */ + +#endif diff --git a/include/linux/netrom.h b/include/linux/netrom.h index a7557ccb3..5798e575e 100644 --- a/include/linux/netrom.h +++ b/include/linux/netrom.h @@ -3,7 +3,7 @@ * For kernel AX.25 see the file ax25.h. This file requires ax25.h for the * definition of the ax25_address structure. */ - + #ifndef NETROM_KERNEL_H #define NETROM_KERNEL_H @@ -14,32 +14,33 @@ #define NETROM_T2 2 #define NETROM_N2 3 #define NETROM_HDRINCL 4 -#define NETROM_PACLEN 5 #define NETROM_T4 6 #define NETROM_IDLE 7 #define NETROM_KILL 99 -#define SIOCNRDECOBS (SIOCPROTOPRIVATE+0) -#define SIOCNRCTLCON (SIOCPROTOPRIVATE+1) +#define SIOCNRDECOBS (SIOCPROTOPRIVATE+2) +#define SIOCNRCTLCON (SIOCPROTOPRIVATE+4) struct nr_route_struct { #define NETROM_NEIGH 0 #define NETROM_NODE 1 - int type; - ax25_address callsign; - char device[16]; - unsigned int quality; - char mnemonic[7]; - ax25_address neighbour; - unsigned int obs_count; + int type; + ax25_address callsign; + char device[16]; + unsigned int quality; + char mnemonic[7]; + ax25_address neighbour; + unsigned int obs_count; + unsigned int ndigis; + ax25_address digipeaters[AX25_MAX_DIGIS]; }; struct nr_ctl_struct { - unsigned char index; - unsigned char id; - unsigned int cmd; - unsigned long arg; + unsigned char index; + unsigned char id; + unsigned int cmd; + unsigned long arg; }; #endif diff --git a/include/linux/nfs.h b/include/linux/nfs.h index 95a93e457..ea58d7b81 100644 --- a/include/linux/nfs.h +++ b/include/linux/nfs.h @@ -1,65 +1,28 @@ +/* + * NFS protocol definitions + */ #ifndef _LINUX_NFS_H #define _LINUX_NFS_H -#define NFS_PORT 2049 -#define NFS_MAXDATA 8192 -#define NFS_MAXPATHLEN 1024 -#define NFS_MAXNAMLEN 255 -#define NFS_MAXGROUPS 16 -#define NFS_FHSIZE 32 -#define NFS_COOKIESIZE 4 -#define NFS_FIFO_DEV (-1) -#define NFSMODE_FMT 0170000 -#define NFSMODE_DIR 0040000 -#define NFSMODE_CHR 0020000 -#define NFSMODE_BLK 0060000 -#define NFSMODE_REG 0100000 -#define NFSMODE_LNK 0120000 -#define NFSMODE_SOCK 0140000 -#define NFSMODE_FIFO 0010000 +#include <linux/sunrpc/msg_prot.h> + +#define NFS_PORT 2049 +#define NFS_MAXDATA 8192 +#define NFS_MAXPATHLEN 1024 +#define NFS_MAXNAMLEN 255 +#define NFS_MAXGROUPS 16 +#define NFS_FHSIZE 32 +#define NFS_COOKIESIZE 4 +#define NFS_FIFO_DEV (-1) +#define NFSMODE_FMT 0170000 +#define NFSMODE_DIR 0040000 +#define NFSMODE_CHR 0020000 +#define NFSMODE_BLK 0060000 +#define NFSMODE_REG 0100000 +#define NFSMODE_LNK 0120000 +#define NFSMODE_SOCK 0140000 +#define NFSMODE_FIFO 0010000 -#ifdef __KERNEL__ /* user programs should get these from the rpc header files */ - -#define RPC_VERSION 2 - -enum rpc_auth_flavor { - RPC_AUTH_NULL = 0, - RPC_AUTH_UNIX = 1, - RPC_AUTH_SHORT = 2 -}; - -enum rpc_msg_type { - RPC_CALL = 0, - RPC_REPLY = 1 -}; - -enum rpc_reply_stat { - RPC_MSG_ACCEPTED = 0, - RPC_MSG_DENIED = 1 -}; - -enum rpc_accept_stat { - RPC_SUCCESS = 0, - RPC_PROG_UNAVAIL = 1, - RPC_PROG_MISMATCH = 2, - RPC_PROC_UNAVAIL = 3, - RPC_GARBAGE_ARGS = 4 -}; - -enum rpc_reject_stat { - RPC_MISMATCH = 0, - RPC_AUTH_ERROR = 1 -}; - -enum rpc_auth_stat { - RPC_AUTH_BADCRED = 1, - RPC_AUTH_REJECTEDCRED = 2, - RPC_AUTH_BADVERF = 3, - RPC_AUTH_REJECTEDVERF = 4, - RPC_AUTH_TOOWEAK = 5 -}; - -#endif /* __KERNEL__ */ enum nfs_stat { NFS_OK = 0, @@ -96,6 +59,10 @@ enum nfs_ftype { NFFIFO = 8 }; +struct nfs_fh { + char data[NFS_FHSIZE]; +}; + #define NFS_PROGRAM 100003 #define NFS_VERSION 2 #define NFSPROC_NULL 0 @@ -117,54 +84,149 @@ enum nfs_ftype { #define NFSPROC_READDIR 16 #define NFSPROC_STATFS 17 -struct nfs_fh { - char data[NFS_FHSIZE]; -}; +/* Mount support for NFSroot */ +#ifdef __KERNEL__ +#define NFS_MNT_PROGRAM 100005 +#define NFS_MNT_VERSION 1 +#define NFS_MNT_PORT 627 +#define NFS_MNTPROC_MNT 1 +#define NFS_MNTPROC_UMNT 3 +#endif + +#if defined(__KERNEL__) || defined(NFS_NEED_KERNEL_TYPES) + +extern struct rpc_program nfs_program; +extern struct rpc_stat nfs_rpcstat; struct nfs_time { - u_int seconds; - u_int useconds; + __u32 seconds; + __u32 useconds; }; struct nfs_fattr { - enum nfs_ftype type; - u_int mode; - u_int nlink; - u_int uid; - u_int gid; - u_int size; - u_int blocksize; - u_int rdev; - u_int blocks; - u_int fsid; - u_int fileid; - struct nfs_time atime; - struct nfs_time mtime; - struct nfs_time ctime; + enum nfs_ftype type; + __u32 mode; + __u32 nlink; + __u32 uid; + __u32 gid; + __u32 size; + __u32 blocksize; + __u32 rdev; + __u32 blocks; + __u32 fsid; + __u32 fileid; + struct nfs_time atime; + struct nfs_time mtime; + struct nfs_time ctime; }; struct nfs_sattr { - u_int mode; - u_int uid; - u_int gid; - u_int size; - struct nfs_time atime; - struct nfs_time mtime; + __u32 mode; + __u32 uid; + __u32 gid; + __u32 size; + struct nfs_time atime; + struct nfs_time mtime; }; struct nfs_entry { - u_int fileid; - char *name; - int cookie; - int eof; + __u32 fileid; + char * name; + unsigned int length:31, + eof:1; + __u32 cookie; }; struct nfs_fsinfo { - u_int tsize; - u_int bsize; - u_int blocks; - u_int bfree; - u_int bavail; + __u32 tsize; + __u32 bsize; + __u32 blocks; + __u32 bfree; + __u32 bavail; +}; + +#ifdef NFS_NEED_XDR_TYPES + +struct nfs_sattrargs { + struct nfs_fh * fh; + struct nfs_sattr * sattr; }; +struct nfs_diropargs { + struct nfs_fh * fh; + const char * name; +}; + +struct nfs_readargs { + struct nfs_fh * fh; + __u32 offset; + __u32 count; + void * buffer; +}; + +struct nfs_writeargs { + struct nfs_fh * fh; + __u32 offset; + __u32 count; + const void * buffer; +}; + +struct nfs_createargs { + struct nfs_fh * fh; + const char * name; + struct nfs_sattr * sattr; +}; + +struct nfs_renameargs { + struct nfs_fh * fromfh; + const char * fromname; + struct nfs_fh * tofh; + const char * toname; +}; + +struct nfs_linkargs { + struct nfs_fh * fromfh; + struct nfs_fh * tofh; + const char * toname; +}; + +struct nfs_symlinkargs { + struct nfs_fh * fromfh; + const char * fromname; + const char * topath; + struct nfs_sattr * sattr; +}; + +struct nfs_readdirargs { + struct nfs_fh * fh; + __u32 cookie; + void * buffer; + unsigned int bufsiz; +}; + +struct nfs_diropok { + struct nfs_fh * fh; + struct nfs_fattr * fattr; +}; + +struct nfs_readres { + struct nfs_fattr * fattr; + unsigned int count; +}; + +struct nfs_readlinkres { + char ** string; + unsigned int * lenp; + unsigned int maxlen; + void * buffer; +}; + +struct nfs_readdirres { + void * buffer; + unsigned int bufsiz; +}; + +#endif /* NFS_NEED_XDR_TYPES */ +#endif /* __KERNEL__ */ + #endif diff --git a/include/linux/nfs3.h b/include/linux/nfs3.h new file mode 100644 index 000000000..94ec44b6a --- /dev/null +++ b/include/linux/nfs3.h @@ -0,0 +1,252 @@ +/* + * NFSv3 protocol definitions + */ +#ifndef _LINUX_NFS3_H +#define _LINUX_NFS3_H + +#include <linux/sunrpc/msg_prot.h> +#include <linux/nfs.h> + +#define NFS3_PORT 2049 +#define NFS3_MAXDATA 8192 +#define NFS3_MAXPATHLEN PATH_MAX +#define NFS3_MAXNAMLEN NAME_MAX +#define NFS3_MAXGROUPS 16 +#define NFS3_FHSIZE NFS_FHSIZE +#define NFS3_COOKIESIZE 4 +#define NFS3_FIFO_DEV (-1) +#define NFS3MODE_FMT 0170000 +#define NFS3MODE_DIR 0040000 +#define NFS3MODE_CHR 0020000 +#define NFS3MODE_BLK 0060000 +#define NFS3MODE_REG 0100000 +#define NFS3MODE_LNK 0120000 +#define NFS3MODE_SOCK 0140000 +#define NFS3MODE_FIFO 0010000 + + +enum nfs3_stat { + NFS3_OK = 0, + NFS3ERR_PERM = 1, + NFS3ERR_NOENT = 2, + NFS3ERR_IO = 5, + NFS3ERR_NXIO = 6, + NFS3ERR_EAGAIN = 11, + NFS3ERR_ACCES = 13, + NFS3ERR_EXIST = 17, + NFS3ERR_XDEV = 18, /* new in NFSv3 */ + NFS3ERR_NODEV = 19, + NFS3ERR_NOTDIR = 20, + NFS3ERR_ISDIR = 21, + NFS3ERR_INVAL = 22, /* new in NFSv3 */ + NFS3ERR_FBIG = 27, + NFS3ERR_NOSPC = 28, + NFS3ERR_ROFS = 30, + NFS3ERR_MLINK = 31, /* new in NFSv3 */ + NFS3ERR_NAMETOOLONG = 63, + NFS3ERR_NOTEMPTY = 66, + NFS3ERR_DQUOT = 69, + NFS3ERR_STALE = 70, + NFS3ERR_REMOTE = 71, /* new in NFSv3 */ + NFS3ERR_BADHANDLE = 10001,/* ditto */ + NFS3ERR_NOT_SYNC = 10002,/* ditto */ + NFS3ERR_BAD_COOKIE = 10003,/* ditto */ + NFS3ERR_NOTSUPP = 10004,/* ditto */ + NFS3ERR_TOOSMALL = 10005,/* ditto */ + NFS3ERR_SERVERFAULT = 10006,/* ditto */ + NFS3ERR_BADTYPE = 10007,/* ditto */ + NFS3ERR_JUKEBOX = 10008,/* ditto */ +}; + +enum nfs3_ftype { + NF3NON = 0, + NF3REG = 1, + NF3DIR = 2, + NF3BLK = 3, + NF3CHR = 4, + NF3LNK = 5, + NF3SOCK = 6, + NF3FIFO = 7, /* changed from NFSv2 (was 8) */ + NF3BAD = 8 +}; + +#define NFS3_VERSION 3 +#define NFSPROC_NULL 0 +#define NFSPROC_GETATTR 1 +#define NFSPROC_SETATTR 2 +#define NFSPROC_ROOT 3 +#define NFSPROC_LOOKUP 4 +#define NFSPROC_READLINK 5 +#define NFSPROC_READ 6 +#define NFSPROC_WRITECACHE 7 +#define NFSPROC_WRITE 8 +#define NFSPROC_CREATE 9 +#define NFSPROC_REMOVE 10 +#define NFSPROC_RENAME 11 +#define NFSPROC_LINK 12 +#define NFSPROC_SYMLINK 13 +#define NFSPROC_MKDIR 14 +#define NFSPROC_RMDIR 15 +#define NFSPROC_READDIR 16 +#define NFSPROC_STATFS 17 + +#if defined(__KERNEL__) || defined(NFS_NEED_KERNEL_TYPES) + +struct nfs3_fh { + __u32 size; + __u8 data[NFS3_FHSIZE]; +}; + +struct nfs3_fattr { + enum nfs3_ftype type; + __u32 mode; + __u32 nlink; + __u32 uid; + __u32 gid; + __u64 size; + __u64 used; + __u32 rdev_maj; + __u32 rdev_min; + __u32 fsid; + __u32 fileid; + struct nfs_time atime; + struct nfs_time mtime; + struct nfs_time ctime; +}; + +struct nfs3_wcc_attr { + __u64 size; + struct nfs_time mtime; + struct nfs_time ctime; +}; + +struct nfs3_wcc_data { + struct nfs3_wcc_attr before; + struct nfs3_wcc_attr after; +}; + +struct nfs3_sattr { + __u32 valid; + __u32 mode; + __u32 uid; + __u32 gid; + __u64 size; + struct nfs_time atime; + struct nfs_time mtime; +}; + +struct nfs3_entry { + __u32 fileid; + char * name; + unsigned int length; + __u32 cookie; + __u32 eof; +}; + +struct nfs3_fsinfo { + __u32 tsize; + __u32 bsize; + __u32 blocks; + __u32 bfree; + __u32 bavail; +}; + +#ifdef NFS_NEED_XDR_TYPES + +struct nfs3_sattrargs { + struct nfs_fh * fh; + struct nfs_sattr * sattr; +}; + +struct nfs3_diropargs { + struct nfs_fh * fh; + const char * name; +}; + +struct nfs3_readargs { + struct nfs_fh * fh; + __u32 offset; + __u32 count; + void * buffer; +}; + +struct nfs3_writeargs { + struct nfs_fh * fh; + __u32 offset; + __u32 count; + const void * buffer; +}; + +struct nfs3_createargs { + struct nfs_fh * fh; + const char * name; + struct nfs_sattr * sattr; +}; + +struct nfs3_renameargs { + struct nfs_fh * fromfh; + const char * fromname; + struct nfs_fh * tofh; + const char * toname; +}; + +struct nfs3_linkargs { + struct nfs_fh * fromfh; + struct nfs_fh * tofh; + const char * toname; +}; + +struct nfs3_symlinkargs { + struct nfs_fh * fromfh; + const char * fromname; + const char * topath; + struct nfs_sattr * sattr; +}; + +struct nfs3_readdirargs { + struct nfs_fh * fh; + __u32 cookie; + void * buffer; + unsigned int bufsiz; +}; + +struct nfs3_diropok { + struct nfs_fh * fh; + struct nfs_fattr * fattr; +}; + +struct nfs3_readres { + struct nfs_fattr * fattr; + unsigned int count; +}; + +struct nfs3_readlinkres { + char ** string; + unsigned int * lenp; + unsigned int maxlen; + void * buffer; +}; + +struct nfs3_readdirres { + void * buffer; + unsigned int bufsiz; +}; + +/* + * The following are for NFSv3 + */ +struct nfs3_fh { + __u32 size; + __u8 data[NFS3_FHSIZE] +}; + +struct nfs3_wcc_attr { + __u64 size; + struct nfs_time mtime; + struct nfs_time ctime; +}; + +#endif /* NFS_NEED_XDR_TYPES */ +#endif /* __KERNEL__ */ + +#endif diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 7924ecdec..94acfc5d6 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h @@ -1,6 +1,3 @@ -#ifndef _LINUX_NFS_FS_H -#define _LINUX_NFS_FS_H - /* * linux/include/linux/nfs_fs.h * @@ -9,26 +6,39 @@ * OS-specific nfs filesystem definitions and declarations */ -#include <linux/nfs.h> +#ifndef _LINUX_NFS_FS_H +#define _LINUX_NFS_FS_H +#include <linux/signal.h> +#include <linux/sched.h> +#include <linux/nfs.h> #include <linux/in.h> +#include <linux/sunrpc/debug.h> #include <linux/nfs_mount.h> /* - * The readdir cache size controls how many directory entries are cached. - * Its size is limited by the number of nfs_entry structures that can fit - * in one page, currently, the limit is 256 when using 4KB pages. + * Enable debugging support for nfs client. + * Requires RPC_DEBUG. */ +#ifdef RPC_DEBUG +# define NFS_DEBUG +#endif -#define NFS_READDIR_CACHE_SIZE 64 +/* + * NFS_MAX_DIRCACHE controls the number of simultaneously cached + * directory chunks. Each chunk holds the list of nfs_entry's returned + * in a single readdir call in a memory region of size PAGE_SIZE. + * + * Note that at most server->rsize bytes of the cache memory are used. + */ +#define NFS_MAX_DIRCACHE 16 #define NFS_MAX_FILE_IO_BUFFER_SIZE 16384 -#define NFS_DEF_FILE_IO_BUFFER_SIZE 1024 +#define NFS_DEF_FILE_IO_BUFFER_SIZE 4096 /* * The upper limit on timeouts for the exponential backoff algorithm. */ - #define NFS_MAX_RPC_TIMEOUT (6*HZ) /* @@ -36,113 +46,174 @@ * It is better not to make this too large although the optimum * depends on a usage and environment. */ - #define NFS_LOOKUP_CACHE_SIZE 64 +/* + * superblock magic number for NFS + */ #define NFS_SUPER_MAGIC 0x6969 #define NFS_SERVER(inode) (&(inode)->i_sb->u.nfs_sb.s_server) +#define NFS_CLIENT(inode) (NFS_SERVER(inode)->client) +#define NFS_ADDR(inode) (RPC_PEERADDR(NFS_CLIENT(inode))) +#define NFS_CONGESTED(inode) (RPC_CONGESTED(NFS_CLIENT(inode))) #define NFS_FH(inode) (&(inode)->u.nfs_i.fhandle) -#define NFS_RENAMED_DIR(inode) ((inode)->u.nfs_i.silly_rename_dir) + #define NFS_READTIME(inode) ((inode)->u.nfs_i.read_cache_jiffies) #define NFS_OLDMTIME(inode) ((inode)->u.nfs_i.read_cache_mtime) -#define NFS_ATTRTIMEO(inode) ((inode)->u.nfs_i.attrtimeo) -#define NFS_MINATTRTIMEO(inode) (S_ISREG((inode)->i_mode)? \ - NFS_SERVER(inode)->acregmin : \ - NFS_SERVER(inode)->acdirmin) #define NFS_CACHEINV(inode) \ do { \ NFS_READTIME(inode) = jiffies - 1000000; \ NFS_OLDMTIME(inode) = 0; \ } while (0) +#define NFS_ATTRTIMEO(inode) ((inode)->u.nfs_i.attrtimeo) +#define NFS_MINATTRTIMEO(inode) \ + (S_ISDIR(inode->i_mode)? NFS_SERVER(inode)->acdirmin \ + : NFS_SERVER(inode)->acregmin) +#define NFS_MAXATTRTIMEO(inode) \ + (S_ISDIR(inode->i_mode)? NFS_SERVER(inode)->acdirmax \ + : NFS_SERVER(inode)->acregmax) +#define NFS_FLAGS(inode) ((inode)->u.nfs_i.flags) +#define NFS_REVALIDATING(inode) (NFS_FLAGS(inode) & NFS_INO_REVALIDATE) -#ifdef __KERNEL__ +#define NFS_RENAMED_DIR(inode) ((inode)->u.nfs_i.silly_inode) +#define NFS_WRITEBACK(inode) ((inode)->u.nfs_i.writeback) + +/* + * These are the default flags for swap requests + */ +#define NFS_RPC_SWAPFLAGS (RPC_TASK_SWAPPER|RPC_TASK_ROOTCREDS) -/* linux/fs/nfs/proc.c */ +#ifdef __KERNEL__ +/* + * linux/fs/nfs/proc.c + */ extern int nfs_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, - struct nfs_fattr *fattr); + struct nfs_fattr *fattr); extern int nfs_proc_setattr(struct nfs_server *server, struct nfs_fh *fhandle, - struct nfs_sattr *sattr, struct nfs_fattr *fattr); + struct nfs_sattr *sattr, struct nfs_fattr *fattr); extern int nfs_proc_lookup(struct nfs_server *server, struct nfs_fh *dir, - const char *name, struct nfs_fh *fhandle, - struct nfs_fattr *fattr); + const char *name, struct nfs_fh *fhandle, + struct nfs_fattr *fattr); extern int nfs_proc_readlink(struct nfs_server *server, struct nfs_fh *fhandle, - int **p0, char **string, unsigned int *len, + void **p0, char **string, unsigned int *len, unsigned int maxlen); extern int nfs_proc_read(struct nfs_server *server, struct nfs_fh *fhandle, - int offset, int count, char *data, - struct nfs_fattr *fattr); -extern int nfs_proc_write(struct inode * inode, int offset, - int count, const char *data, struct nfs_fattr *fattr); + int swap, unsigned long offset, unsigned int count, + void *buffer, struct nfs_fattr *fattr); +extern int nfs_proc_write(struct nfs_server *server, struct nfs_fh *fhandle, + int swap, unsigned long offset, unsigned int count, + const void *buffer, struct nfs_fattr *fattr); extern int nfs_proc_create(struct nfs_server *server, struct nfs_fh *dir, - const char *name, struct nfs_sattr *sattr, - struct nfs_fh *fhandle, struct nfs_fattr *fattr); + const char *name, struct nfs_sattr *sattr, + struct nfs_fh *fhandle, struct nfs_fattr *fattr); extern int nfs_proc_remove(struct nfs_server *server, struct nfs_fh *dir, - const char *name); + const char *name); extern int nfs_proc_rename(struct nfs_server *server, - struct nfs_fh *old_dir, const char *old_name, - struct nfs_fh *new_dir, const char *new_name, - int must_be_dir); + struct nfs_fh *old_dir, const char *old_name, + struct nfs_fh *new_dir, const char *new_name); extern int nfs_proc_link(struct nfs_server *server, struct nfs_fh *fhandle, - struct nfs_fh *dir, const char *name); + struct nfs_fh *dir, const char *name); extern int nfs_proc_symlink(struct nfs_server *server, struct nfs_fh *dir, - const char *name, const char *path, struct nfs_sattr *sattr); + const char *name, const char *path, + struct nfs_sattr *sattr); extern int nfs_proc_mkdir(struct nfs_server *server, struct nfs_fh *dir, - const char *name, struct nfs_sattr *sattr, - struct nfs_fh *fhandle, struct nfs_fattr *fattr); + const char *name, struct nfs_sattr *sattr, + struct nfs_fh *fhandle, struct nfs_fattr *fattr); extern int nfs_proc_rmdir(struct nfs_server *server, struct nfs_fh *dir, - const char *name); + const char *name); extern int nfs_proc_readdir(struct nfs_server *server, struct nfs_fh *fhandle, - int cookie, int count, struct nfs_entry *entry); + u32 cookie, unsigned int size, struct nfs_entry *entry); extern int nfs_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle, - struct nfs_fsinfo *res); -extern int nfs_proc_read_request(struct rpc_ioreq *, struct nfs_server *, - struct nfs_fh *, unsigned long offset, - unsigned long count, __u32 *buf); -extern int nfs_proc_read_reply(struct rpc_ioreq *, struct nfs_fattr *); -extern int *rpc_header(int *p, int procedure, int program, int version, - int uid, int gid, int ngroup, gid_t *groups); -extern int *rpc_verify(int *p); - -/* linux/fs/nfs/sock.c */ + struct nfs_fsinfo *res); -extern int nfs_rpc_call(struct nfs_server *server, int *start, - int *end, int size); -extern int nfs_rpc_doio(struct nfs_server *server, struct rpc_ioreq *, - int async); - -/* linux/fs/nfs/inode.c */ +/* + * linux/fs/nfs/inode.c + */ extern struct super_block *nfs_read_super(struct super_block *sb, void *data,int); extern int init_nfs_fs(void); extern struct inode *nfs_fhget(struct super_block *sb, struct nfs_fh *fhandle, struct nfs_fattr *fattr); extern void nfs_refresh_inode(struct inode *inode, struct nfs_fattr *fattr); +extern int nfs_revalidate(struct inode *); +extern int _nfs_revalidate_inode(struct nfs_server *, struct inode *); -/* linux/fs/nfs/file.c */ - +/* + * linux/fs/nfs/file.c + */ extern struct inode_operations nfs_file_inode_operations; -/* linux/fs/nfs/dir.c */ - +/* + * linux/fs/nfs/dir.c + */ extern struct inode_operations nfs_dir_inode_operations; extern void nfs_sillyrename_cleanup(struct inode *); -extern void nfs_kfree_cache(void); - -/* linux/fs/nfs/symlink.c */ +extern void nfs_free_dircache(void); +extern void nfs_invalidate_dircache(struct inode *); +/* + * linux/fs/nfs/symlink.c + */ extern struct inode_operations nfs_symlink_inode_operations; -/* linux/fs/nfs/mmap.c */ +/* + * linux/fs/nfs/mmap.c + */ +extern int nfs_mmap(struct inode *inode, struct file *file, + struct vm_area_struct * vma); + +/* + * linux/fs/nfs/locks.c + */ +extern int nfs_lock(struct inode *inode, struct file *file, + int cmd, struct file_lock *fl); + +/* + * linux/fs/nfs/write.c + */ +extern int nfs_writepage(struct inode *, struct page *); +extern int nfs_check_error(struct inode *); +extern int nfs_flush_dirty_pages(struct inode *, off_t, off_t); +extern int nfs_truncate_dirty_pages(struct inode *, unsigned long); +extern void nfs_invalidate_pages(struct inode *); +extern int nfs_updatepage(struct inode *, struct page *, const char *, + unsigned long, unsigned int, int); -extern int nfs_mmap(struct inode * inode, struct file * file, struct vm_area_struct * vma); +/* + * linux/fs/nfs/read.c + */ +extern int nfs_readpage(struct inode *, struct page *); +extern int nfs_readpage_sync(struct inode *, struct page *); -/* linux/fs/nfs/bio.c */ +/* + * linux/fs/mount_clnt.c + * (Used only by nfsroot module) + */ +extern int nfs_mount(struct sockaddr_in *, char *, struct nfs_fh *); -extern int nfs_readpage(struct inode *, struct page *); +/* + * inline functions + */ +static inline int +nfs_revalidate_inode(struct nfs_server *server, struct inode *inode) +{ + if (jiffies - NFS_READTIME(inode) < NFS_ATTRTIMEO(inode)) + return 0; + return _nfs_revalidate_inode(server, inode); +} + +extern struct nfs_wreq * nfs_failed_requests; +static inline int +nfs_write_error(struct inode *inode) +{ + if (nfs_failed_requests == NULL) + return 0; + return nfs_check_error(inode); +} /* NFS root */ @@ -157,4 +228,26 @@ extern char nfs_root_addrs[]; #endif /* __KERNEL__ */ +/* + * NFS debug flags + */ +#define NFSDBG_VFS 0x0001 +#define NFSDBG_DIRCACHE 0x0002 +#define NFSDBG_LOOKUPCACHE 0x0004 +#define NFSDBG_PAGECACHE 0x0008 +#define NFSDBG_PROC 0x0010 +#define NFSDBG_XDR 0x0020 +#define NFSDBG_FILE 0x0040 +#define NFSDBG_ROOT 0x0080 +#define NFSDBG_ALL 0xFFFF + +#ifdef __KERNEL__ +# undef ifdebug +# ifdef NFS_DEBUG +# define ifdebug(fac) if (nfs_debug & NFSDBG_##fac) +# else +# define ifdebug(fac) if (0) +# endif +#endif /* __KERNEL */ + #endif diff --git a/include/linux/nfs_fs_i.h b/include/linux/nfs_fs_i.h index 7715c3a4d..e89bc495f 100644 --- a/include/linux/nfs_fs_i.h +++ b/include/linux/nfs_fs_i.h @@ -8,30 +8,75 @@ * nfs fs inode data in memory */ struct nfs_inode_info { - struct pipe_inode_info pipeinfo; - struct nfs_fh fhandle; + /* + * This is a place holder so named pipes on NFS filesystems + * work (more or less correctly). This must be first in the + * struct because the data is really accessed via inode->u.pipe_i. + */ + struct pipe_inode_info pipeinfo; + + /* + * The file handle + */ + struct nfs_fh fhandle; + + /* + * Various flags + */ + unsigned short flags; + /* * read_cache_jiffies is when we started read-caching this inode, * and read_cache_mtime is the mtime of the inode at that time. + * attrtimeo is for how long the cached information is assumed + * to be valid. A successful attribute revalidation doubles + * attrtimeo (up to acregmax/acdirmax), a failure resets it to + * acregmin/acdirmin. * - * We need to invalidate the cache for this inode if + * We need to revalidate the cached attrs for this inode if + * + * jiffies - read_cache_jiffies > attrtimeo + * + * and invalidate any cached data/flush out any dirty pages if + * we find that * - * jiffies - read_cache_jiffies > 30*HZ - * AND * mtime != read_cache_mtime */ - unsigned long read_cache_jiffies; - unsigned long read_cache_mtime; + unsigned long read_cache_jiffies; + unsigned long read_cache_mtime; + unsigned long attrtimeo; + /* * This is to support the clandestine rename on unlink. - * Instead of the directory inode, we might as well keep its - * NFS FH, but that requires a kmalloc. + * Instead of the directory inode, we might as well keep + * its NFS FH, but that requires a kmalloc. */ - struct inode *silly_rename_dir; + struct inode * silly_inode; + /* - * attrtimeo defines for how long the cached attributes are valid + * This is the list of dirty unwritten pages. + * NFSv3 will want to add a list for written but uncommitted + * pages. */ - unsigned long attrtimeo; + struct nfs_wreq * writeback; }; +/* + * Legal inode flag values + */ +#define NFS_INO_REVALIDATE 0x0001 /* revalidating attrs */ + +/* + * NFS lock info + */ +struct nfs_lock_info { + u32 state; + u32 flags; +}; + +/* + * Lock flag values + */ +#define NFS_LCK_GRANTED 0x0001 /* lock has been granted */ + #endif diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h index bfdba35b4..c1bedfbdf 100644 --- a/include/linux/nfs_fs_sb.h +++ b/include/linux/nfs_fs_sb.h @@ -1,34 +1,32 @@ #ifndef _NFS_FS_SB #define _NFS_FS_SB -#include <linux/rpcsock.h> #include <linux/nfs.h> +#include <linux/in.h> +/* + * NFS client parameters + * Part of this is duplicated in rpc_clnt and is therefore obsolete. + */ struct nfs_server { - struct file *file; - struct rpc_sock *rsock; - struct sockaddr toaddr ; /* Added for change to NFS code to use sendto() 1995-06-02 JSP */ - int lock; - struct wait_queue *wait; - int flags; - int rsize; - int wsize; - int timeo; - int retrans; - int acregmin; - int acregmax; - int acdirmin; - int acdirmax; - char hostname[256]; + struct rpc_clnt * client; /* RPC client handle */ + int flags; /* various flags */ + int rsize; /* read size */ + int wsize; /* write size */ + unsigned int bsize; /* server block size */ + unsigned int acregmin; /* attr cache timeouts */ + unsigned int acregmax; + unsigned int acdirmin; + unsigned int acdirmax; + char hostname[256]; /* remote hostname */ }; /* * nfs super-block data in memory */ - struct nfs_sb_info { - struct nfs_server s_server; - struct nfs_fh s_root; + struct nfs_server s_server; + struct nfs_fh s_root; }; #endif diff --git a/include/linux/nfs_mount.h b/include/linux/nfs_mount.h index b122b43dc..60493b150 100644 --- a/include/linux/nfs_mount.h +++ b/include/linux/nfs_mount.h @@ -16,36 +16,25 @@ * mount-to-kernel version compatibility. Some of these aren't used yet * but here they are anyway. */ - -#define NFS_NFS_PROGRAM 100003 /* nfsd program number */ -#define NFS_NFS_VERSION 2 /* nfsd version */ -#define NFS_NFS_PORT 2049 /* portnumber on server for nfsd */ - -#define NFS_MOUNT_PROGRAM 100005 /* mountd program number */ -#define NFS_MOUNT_VERSION 1 /* mountd version */ -#define NFS_MOUNT_PROC 1 /* mount process id */ -#define NFS_MOUNT_PORT 627 /* portnumber on server for mountd */ - -#define NFS_PMAP_PROGRAM 100000 /* portmap program number */ -#define NFS_PMAP_VERSION 2 /* portmap version */ -#define NFS_PMAP_PROC 3 /* portmap getport id */ -#define NFS_PMAP_PORT 111 /* portnumber on server for portmap */ +#define NFS_MOUNT_VERSION 3 struct nfs_mount_data { - int version; /* 1 */ - int fd; /* 1 */ - struct nfs_fh root; /* 1 */ - int flags; /* 1 */ - int rsize; /* 1 */ - int wsize; /* 1 */ - int timeo; /* 1 */ - int retrans; /* 1 */ - int acregmin; /* 1 */ - int acregmax; /* 1 */ - int acdirmin; /* 1 */ - int acdirmax; /* 1 */ - struct sockaddr_in addr; /* 1 */ - char hostname[256]; /* 1 */ + int version; /* 1 */ + int fd; /* 1 */ + struct nfs_fh root; /* 1 */ + int flags; /* 1 */ + int rsize; /* 1 */ + int wsize; /* 1 */ + int timeo; /* 1 */ + int retrans; /* 1 */ + int acregmin; /* 1 */ + int acregmax; /* 1 */ + int acdirmin; /* 1 */ + int acdirmax; /* 1 */ + struct sockaddr_in addr; /* 1 */ + char hostname[256]; /* 1 */ + int namlen; /* 2 */ + unsigned int bsize; /* 3 */ }; /* bits in the flags field */ @@ -56,5 +45,9 @@ struct nfs_mount_data { #define NFS_MOUNT_POSIX 0x0008 /* 1 */ #define NFS_MOUNT_NOCTO 0x0010 /* 1 */ #define NFS_MOUNT_NOAC 0x0020 /* 1 */ +#define NFS_MOUNT_TCP 0x0040 /* 2 */ +#define NFS_MOUNT_VER3 0x0080 /* 3 */ +#define NFS_MOUNT_KERBEROS 0x0100 /* 3 */ +#define NFS_MOUNT_NONLM 0x0200 /* 3 */ #endif diff --git a/include/linux/nfsd/auth.h b/include/linux/nfsd/auth.h new file mode 100644 index 000000000..ec2c9d7bf --- /dev/null +++ b/include/linux/nfsd/auth.h @@ -0,0 +1,45 @@ +/* + * include/linux/nfsd/auth.h + * + * nfsd-specific authentication stuff. + * uid/gid mapping not yet implemented. + * + * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> + */ + +#ifndef LINUX_NFSD_AUTH_H +#define LINUX_NFSD_AUTH_H + +#ifdef __KERNEL__ + +#define nfsd_luid(rq, uid) ((u32)(uid)) +#define nfsd_lgid(rq, gid) ((u32)(gid)) +#define nfsd_ruid(rq, uid) ((u32)(uid)) +#define nfsd_rgid(rq, gid) ((u32)(gid)) + +/* + * Set the current process's fsuid/fsgid etc to those of the NFS + * client user + */ +void nfsd_setuser(struct svc_rqst *, struct svc_export *); + +#if 0 +/* + * These must match the actual size of uid_t and gid_t + */ +#define UGID_BITS (8 * sizeof(uid_t)) +#define UGID_SHIFT 8 +#define UGID_MASK ((1 << UGID_SHIFT) - 1) +#define UGID_NRENTRIES ((1 << (UGID_BITS - UGID_SHIFT)) + 1) +#define UGID_NONE ((unsigned short)-1) + +typedef struct svc_uidmap { + uid_t * um_ruid[UGID_NRENTRIES]; + uid_t * um_luid[UGID_NRENTRIES]; + gid_t * um_rgid[UGID_NRENTRIES]; + gid_t * um_lgid[UGID_NRENTRIES]; +} svc_uidmap; +#endif + +#endif /* __KERNEL__ */ +#endif /* LINUX_NFSD_AUTH_H */ diff --git a/include/linux/nfsd/cache.h b/include/linux/nfsd/cache.h new file mode 100644 index 000000000..8e675705e --- /dev/null +++ b/include/linux/nfsd/cache.h @@ -0,0 +1,79 @@ +/* + * include/linux/nfsd/cache.h + * + * Request reply cache. This was heavily inspired by the + * implementation in 4.3BSD/4.4BSD. + * + * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> + */ + +#ifndef NFSCACHE_H +#define NFSCACHE_H + +#ifdef __KERNEL__ +#include <linux/sched.h> + +/* + * Representation of a reply cache entry. The first two members *must* + * be hash_next and hash_prev. + */ +struct svc_cacherep { + struct svc_cacherep * c_hash_next; + struct svc_cacherep * c_hash_prev; + struct svc_cacherep * c_lru_next; + struct svc_cacherep * c_lru_prev; + unsigned char c_state, /* unused, inprog, done */ + c_type, /* status, buffer */ + c_secure : 1; /* req came from port < 1024 */ + struct in_addr c_client; + u32 c_xid; + u32 c_proc; + unsigned long c_timestamp; + union { + struct svc_buf u_buffer; + u32 u_status; + } c_u; +}; + +#define c_replbuf c_u.u_buffer +#define c_replstat c_u.u_status + +/* cache entry states */ +enum { + RC_UNUSED, + RC_INPROG, + RC_DONE +}; + +/* return values */ +enum { + RC_DROPIT, + RC_REPLY, + RC_DOIT, + RC_INTR +}; + +/* + * Cache types. + * We may want to add more types one day, e.g. for diropres and + * attrstat replies. Using cache entries with fixed length instead + * of buffer pointers may be more efficient. + */ +enum { + RC_NOCACHE, + RC_REPLSTAT, + RC_REPLBUFF, +}; + +/* + * If requests are retransmitted within this interval, they're dropped. + */ +#define RC_DELAY (HZ/5) + +void nfsd_cache_init(void); +void nfsd_cache_shutdown(void); +int nfsd_cache_lookup(struct svc_rqst *, int); +void nfsd_cache_update(struct svc_rqst *, int, u32 *); + +#endif /* __KERNEL__ */ +#endif /* NFSCACHE_H */ diff --git a/include/linux/nfsd/const.h b/include/linux/nfsd/const.h new file mode 100644 index 000000000..0727e1288 --- /dev/null +++ b/include/linux/nfsd/const.h @@ -0,0 +1,86 @@ +/* + * include/linux/nfsd/nfsconst.h + * + * Various constants related to NFS. + * + * Copyright (C) 1995 Olaf Kirch <okir@monad.swb.de> + */ + +#ifndef __NFSCONST_H__ +#define __NFSCONST_H__ + +#include <linux/limits.h> +#include <linux/types.h> +#include <linux/unistd.h> +#include <linux/dirent.h> +#include <linux/fs.h> +#include <linux/nfs.h> + +/* + * Maximum protocol version supported by knfsd + */ +#define NFSSVC_MAXVERS 3 + +/* + * Maximum blocksize supported by daemon currently at 8K + */ +#define NFSSVC_MAXBLKSIZE 8192 + +#define NFS2_MAXPATHLEN 1024 +#define NFS2_MAXNAMLEN 255 +#define NFS2_FHSIZE NFS_FHSIZE +#define NFS2_COOKIESIZE 4 + +#define NFS3_MAXPATHLEN PATH_MAX +#define NFS3_MAXNAMLEN NAME_MAX +#define NFS3_FHSIZE NFS_FHSIZE +#define NFS3_COOKIEVERFSIZE 8 +#define NFS3_CREATEVERFSIZE 8 +#define NFS3_WRITEVERFSIZE 8 + +#ifdef __KERNEL__ + +#ifndef NFS_SUPER_MAGIC +# define NFS_SUPER_MAGIC 0x6969 +#endif + +/* + * NFS stats. The good thing with these values is that NFSv3 errors are + * a superset of NFSv2 errors (with the exception of NFSERR_WFLUSH which + * no-one uses anyway), so we can happily mix code as long as we make sure + * no NFSv3 errors are returned to NFSv2 clients. + */ +#define NFS_OK 0 /* v2 v3 */ +#define NFSERR_PERM 1 /* v2 v3 */ +#define NFSERR_NOENT 2 /* v2 v3 */ +#define NFSERR_IO 5 /* v2 v3 */ +#define NFSERR_NXIO 6 /* v2 v3 */ +#define NFSERR_ACCES 13 /* v2 v3 */ +#define NFSERR_EXIST 17 /* v2 v3 */ +#define NFSERR_XDEV 18 /* v3 */ +#define NFSERR_NODEV 19 /* v2 v3 */ +#define NFSERR_NOTDIR 20 /* v2 v3 */ +#define NFSERR_ISDIR 21 /* v2 v3 */ +#define NFSERR_INVAL 22 /* v3 */ +#define NFSERR_FBIG 27 /* v2 v3 */ +#define NFSERR_NOSPC 28 /* v2 v3 */ +#define NFSERR_ROFS 30 /* v2 v3 */ +#define NFSERR_MLINK 31 /* v3 */ +#define NFSERR_NAMETOOLONG 63 /* v2 v3 */ +#define NFSERR_NOTEMPTY 66 /* v2 v3 */ +#define NFSERR_DQUOT 69 /* v2 v3 */ +#define NFSERR_STALE 70 /* v2 v3 */ +#define NFSERR_REMOTE 71 /* v3 */ +#define NFSERR_WFLUSH 99 /* v2 */ +#define NFSERR_BADHANDLE 10001 /* v3 */ +#define NFSERR_NOT_SYNC 10002 /* v3 */ +#define NFSERR_BAD_COOKIE 10003 /* v3 */ +#define NFSERR_NOTSUPP 10004 /* v3 */ +#define NFSERR_TOOSMALL 10005 /* v3 */ +#define NFSERR_SERVERFAULT 10006 /* v3 */ +#define NFSERR_BADTYPE 10007 /* v3 */ +#define NFSERR_JUKEBOX 10008 /* v3 */ + +#endif /* __KERNEL__ */ + +#endif /* __NFSCONST_H__ */ diff --git a/include/linux/nfsd/debug.h b/include/linux/nfsd/debug.h new file mode 100644 index 000000000..ee4aa9178 --- /dev/null +++ b/include/linux/nfsd/debug.h @@ -0,0 +1,48 @@ +/* + * linux/include/linux/nfsd/debug.h + * + * Debugging-related stuff for nfsd + * + * Copyright (C) 1995 Olaf Kirch <okir@monad.swb.de> + */ + +#ifndef LINUX_NFSD_DEBUG_H +#define LINUX_NFSD_DEBUG_H + +#include <linux/sunrpc/debug.h> + +/* + * Enable debugging for nfsd. + * Requires RPC_DEBUG. + */ +#ifdef RPC_DEBUG +# define NFSD_DEBUG 1 +#endif + +/* + * knfsd debug flags + */ +#define NFSDDBG_SOCK 0x0001 +#define NFSDDBG_FH 0x0002 +#define NFSDDBG_EXPORT 0x0004 +#define NFSDDBG_SVC 0x0008 +#define NFSDDBG_PROC 0x0010 +#define NFSDDBG_FILEOP 0x0020 +#define NFSDDBG_AUTH 0x0040 +#define NFSDDBG_REPCACHE 0x0080 +#define NFSDDBG_XDR 0x0100 +#define NFSDDBG_LOCKD 0x0200 +#define NFSDDBG_ALL 0x7FFF +#define NFSDDBG_NOCHANGE 0xFFFF + + +#ifdef __KERNEL__ +# undef ifdebug +# ifdef NFSD_DEBUG +# define ifdebug(flag) if (nfsd_debug & NFSDDBG_##flag) +# else +# define ifdebug(flag) if (0) +# endif +#endif /* __KERNEL__ */ + +#endif /* LINUX_NFSD_DEBUG_H */ diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h new file mode 100644 index 000000000..b0e3499ec --- /dev/null +++ b/include/linux/nfsd/export.h @@ -0,0 +1,109 @@ +/* + * include/linux/nfsd/export.h + * + * Public declarations for NFS exports. The definitions for the + * syscall interface are in nfsctl.h + * + * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> + */ + +#ifndef NFSD_EXPORT_H +#define NFSD_EXPORT_H + +#include <linux/types.h> +#include <linux/socket.h> +#include <linux/in.h> +#include <linux/fs.h> + +/* + * Important limits for the exports stuff. + */ +#define NFSCLNT_IDMAX 1024 +#define NFSCLNT_ADDRMAX 16 +#define NFSCLNT_KEYMAX 32 + +/* + * Export flags. + */ +#define NFSEXP_READONLY 0x0001 +#define NFSEXP_INSECURE_PORT 0x0002 +#define NFSEXP_ROOTSQUASH 0x0004 +#define NFSEXP_ALLSQUASH 0x0008 +#define NFSEXP_ASYNC 0x0010 +#define NFSEXP_GATHERED_WRITES 0x0020 +#define NFSEXP_UIDMAP 0x0040 +#define NFSEXP_KERBEROS 0x0080 /* not available */ +#define NFSEXP_SUNSECURE 0x0100 +#define NFSEXP_CROSSMNT 0x0200 /* not available */ +#define NFSEXP_ALLFLAGS 0x03FF + + +#ifdef __KERNEL__ + +/* The following are hashtable sizes and must be powers of 2 */ +#define NFSCLNT_EXPMAX 16 + +struct svc_client { + struct svc_client * cl_next; + char cl_ident[NFSCLNT_IDMAX]; + int cl_idlen; + int cl_naddr; + struct in_addr cl_addr[NFSCLNT_ADDRMAX]; + struct svc_uidmap * cl_umap; + struct svc_export * cl_export[NFSCLNT_EXPMAX]; +}; + +struct svc_export { + struct svc_export * ex_next; + char ex_path[NFS_MAXPATHLEN+1]; + struct svc_export * ex_parent; + struct svc_client * ex_client; + int ex_flags; + struct inode * ex_inode; + dev_t ex_dev; + ino_t ex_ino; + uid_t ex_anon_uid; + gid_t ex_anon_gid; +}; + +#define EX_SECURE(exp) (!((exp)->ex_flags & NFSEXP_INSECURE_PORT)) +#define EX_ISSYNC(exp) (!((exp)->ex_flags & NFSEXP_ASYNC)) +#define EX_RDONLY(exp) ((exp)->ex_flags & NFSEXP_READONLY) +#define EX_CROSSMNT(exp) ((exp)->ex_flags & NFSEXP_CROSSMNT) +#define EX_SUNSECURE(exp) ((exp)->ex_flags & NFSEXP_SUNSECURE) +#define EX_WGATHER(exp) ((exp)->ex_flags & NFSEXP_GATHERED_WRITES) + + +/* + * Function declarations + */ +void nfsd_export_init(void); +void nfsd_export_shutdown(void); +void exp_readlock(void); +int exp_writelock(void); +void exp_unlock(void); +struct svc_client * exp_getclient(struct sockaddr_in *sin); +void exp_putclient(struct svc_client *clp); +struct svc_export * exp_get(struct svc_client *clp, dev_t dev, ino_t ino); +int exp_rootfh(struct svc_client *, dev_t, ino_t, + struct knfs_fh *); +int nfserrno(int errno); +void exp_nlmdetach(void); + + +extern __inline__ int +exp_checkaddr(struct svc_client *clp, struct in_addr addr) +{ + struct in_addr *ap = clp->cl_addr; + int i; + + for (i = clp->cl_naddr; i--; ap++) + if (ap->s_addr == addr.s_addr) + return 1; + return 0; +} + +#endif /* __KERNEL__ */ + +#endif /* NFSD_EXPORT_H */ + diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h new file mode 100644 index 000000000..ed42bb042 --- /dev/null +++ b/include/linux/nfsd/nfsd.h @@ -0,0 +1,169 @@ +/* + * linux/include/linux/nfsd/nfsd.h + * + * Hodge-podge collection of knfsd-related stuff. + * I will sort this out later. + * + * Copyright (C) 1995 Olaf Kirch <okir@monad.swb.de> + */ + +#ifndef LINUX_NFSD_NFSD_H +#define LINUX_NFSD_NFSD_H + +#include <linux/types.h> +#include <linux/unistd.h> +#include <linux/dirent.h> +#include <linux/fs.h> + +#include <linux/nfsd/debug.h> +#include <linux/nfsd/nfsfh.h> +#include <linux/nfsd/export.h> +#include <linux/nfsd/auth.h> +#include <linux/nfsd/stats.h> + +/* + * nfsd version + */ +#define NFSD_VERSION "0.4" + +/* + * Maximum number of nfsd processes + */ +#define NFSD_MAXSERVS 16 + +#ifdef __KERNEL__ +/* + * Special flags for nfsd_permission. These must be different from MAY_READ, + * MAY_WRITE, and MAY_EXEC. + */ +#define MAY_NOP 0 +#define MAY_SATTR 8 +#define MAY_TRUNC 16 +#if (MAY_SATTR | MAY_TRUNC) & (MAY_READ | MAY_WRITE | MAY_EXEC) +# error "please use a different value for MAY_SATTR or MAY_TRUNC." +#endif +#define MAY_CREATE (MAY_EXEC|MAY_WRITE) +#define MAY_REMOVE (MAY_EXEC|MAY_WRITE|MAY_TRUNC) + +/* + * Callback function for readdir + */ +struct readdir_cd { + struct svc_rqst * rqstp; + struct svc_fh * dirfh; + u32 * buffer; + int buflen; + u32 * offset; /* previous dirent->d_next */ + char plus; /* readdirplus */ + char eob; /* end of buffer */ + char dotonly; +}; +typedef int (*encode_dent_fn)(struct readdir_cd *, const char *, + int, off_t, ino_t); + +/* + * Procedure table for NFSv2 + */ +extern struct svc_procedure nfsd_procedures2[]; +extern struct svc_program nfsd_program; + +/* + * Function prototypes. + */ +int nfsd_svc(unsigned short port, int nrservs); + +void nfsd_racache_init(void); +int nfsd_lookup(struct svc_rqst *, struct svc_fh *, + const char *, int, struct svc_fh *); +int nfsd_setattr(struct svc_rqst *, struct svc_fh *, + struct iattr *); +int nfsd_create(struct svc_rqst *, struct svc_fh *, + char *name, int len, struct iattr *attrs, + int type, dev_t rdev, struct svc_fh *res); +int nfsd_open(struct svc_rqst *, struct svc_fh *, int, + int, struct file *); +void nfsd_close(struct file *); +int nfsd_read(struct svc_rqst *, struct svc_fh *, + loff_t, char *, unsigned long *); +int nfsd_write(struct svc_rqst *, struct svc_fh *, + loff_t, char *, unsigned long, int); +int nfsd_readlink(struct svc_rqst *, struct svc_fh *, + char *, int *); +int nfsd_symlink(struct svc_rqst *, struct svc_fh *, + char *name, int len, char *path, int plen, + struct svc_fh *res); +int nfsd_link(struct svc_rqst *, struct svc_fh *, + char *, int, struct svc_fh *); +int nfsd_rename(struct svc_rqst *, + struct svc_fh *, char *, int, + struct svc_fh *, char *, int); +int nfsd_remove(struct svc_rqst *, + struct svc_fh *, char *, int); +int nfsd_unlink(struct svc_rqst *, struct svc_fh *, int type, + char *name, int len); +int nfsd_truncate(struct svc_rqst *, struct svc_fh *, + unsigned long size); +int nfsd_readdir(struct svc_rqst *, struct svc_fh *, + loff_t, encode_dent_fn, + u32 *buffer, int *countp); +int nfsd_statfs(struct svc_rqst *, struct svc_fh *, + struct statfs *); +int nfsd_notify_change(struct inode *, struct iattr *); +int nfsd_permission(struct svc_export *, struct inode *, int); +void nfsd_write_inode(struct inode *); +struct inode * nfsd_iget(dev_t dev, ino_t ino); +int nfsd_parentdev(dev_t *devp); + +/* + * lockd binding + */ +void nfsd_lockd_init(void); +void nfsd_lockd_shutdown(void); +void nfsd_lockd_unexport(struct svc_client *); + + +#ifndef makedev +#define makedev(maj, min) (((maj) << 8) | (min)) +#endif + +/* + * These variables contain pre-xdr'ed values for faster operation. + * FIXME: should be replaced by macros for big-endian machines. + */ +extern u32 nfs_ok, + nfserr_perm, + nfserr_noent, + nfserr_io, + nfserr_nxio, + nfserr_acces, + nfserr_exist, + nfserr_xdev, + nfserr_nodev, + nfserr_notdir, + nfserr_isdir, + nfserr_inval, + nfserr_fbig, + nfserr_nospc, + nfserr_rofs, + nfserr_mlink, + nfserr_nametoolong, + nfserr_dquot, + nfserr_stale, + nfserr_remote, + nfserr_badhandle, + nfserr_notsync, + nfserr_badcookie, + nfserr_notsupp, + nfserr_toosmall, + nfserr_serverfault, + nfserr_badtype, + nfserr_jukebox; + +/* + * Time of server startup + */ +extern struct timeval nfssvc_boot; + +#endif /* __KERNEL__ */ + +#endif /* LINUX_NFSD_NFSD_H */ diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h new file mode 100644 index 000000000..320a2816c --- /dev/null +++ b/include/linux/nfsd/nfsfh.h @@ -0,0 +1,170 @@ +/* + * include/linux/nfsd/nfsfh.h + * + * This file describes the layout of the file handles as passed + * over the wire. + * + * Earlier versions of knfsd used to sign file handles using keyed MD5 + * or SHA. I've removed this code, because it doesn't give you more + * security than blocking external access to port 2049 on your firewall. + * + * Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de> + */ + +#ifndef NFSD_FH_H +#define NFSD_FH_H + +#include <linux/types.h> +#include <linux/string.h> +#include <linux/fs.h> +#include <linux/nfsd/const.h> +#include <linux/nfsd/debug.h> + +/* + * This is our NFSv2 file handle. + * + * The xdev and xino fields are currently used to transport the dev/ino + * of the exported inode. The xdev field is redundant, though, because + * we do not allow mount point crossing. + */ +struct nfs_fhbase { + dev_t fb_dev; + dev_t fb_xdev; + ino_t fb_ino; + ino_t fb_xino; + __u32 fb_version; +}; + +#define NFS_FH_PADDING (NFS_FHSIZE - sizeof(struct nfs_fhbase)) +struct knfs_fh { + struct nfs_fhbase fh_base; + __u8 fh_cookie[NFS_FH_PADDING]; +}; + +#define fh_dev fh_base.fb_dev +#define fh_xdev fh_base.fb_xdev +#define fh_ino fh_base.fb_ino +#define fh_xino fh_base.fb_xino +#define fh_version fh_base.fb_version + + +#ifdef __KERNEL__ + +/* + * This is the internal representation of an NFS handle used in knfsd. + * pre_mtime/post_version will be used to support wcc_attr's in NFSv3. + */ +typedef struct svc_fh { + struct knfs_fh fh_handle; /* FH data */ + struct svc_export * fh_export; /* export pointer */ + struct inode * fh_inode; /* inode */ + size_t fh_pre_size; /* size before operation */ + time_t fh_pre_mtime; /* mtime before oper */ + time_t fh_pre_ctime; /* ctime before oper */ + unsigned long fh_post_version;/* inode version after oper */ + unsigned char fh_locked; /* inode locked by us */ +} svc_fh; + +/* + * Shorthands for dprintk()'s + */ +#define SVCFH_INO(f) ((f)->fh_handle.fh_ino) +#define SVCFH_DEV(f) ((f)->fh_handle.fh_dev) + +/* + * Function prototypes + */ +u32 fh_lookup(struct svc_rqst *, struct svc_fh *, int, int); +void fh_compose(struct svc_fh *, struct svc_export *, + struct inode *); + +static __inline__ struct svc_fh * +fh_copy(struct svc_fh *dst, struct svc_fh *src) +{ + *dst = *src; + return dst; +} + +static __inline__ struct svc_fh * +fh_init(struct svc_fh *fhp) +{ + memset(fhp, 0, sizeof(*fhp)); + return fhp; +} + +/* + * Lock a file handle/inode + */ +static inline void +fh_lock(struct svc_fh *fhp) +{ + struct inode *inode = fhp->fh_inode; + + /* + dfprintk(FILEOP, "nfsd: fh_lock(%x/%ld) locked = %d\n", + SVCFH_DEV(fhp), SVCFH_INO(fhp), fhp->fh_locked); + */ + if (!fhp->fh_locked) { + down(&inode->i_sem); + if (!fhp->fh_pre_mtime) + fhp->fh_pre_mtime = inode->i_mtime; + fhp->fh_locked = 1; + } +} + +/* + * Unlock a file handle/inode + */ +static inline void +fh_unlock(struct svc_fh *fhp) +{ + struct inode *inode = fhp->fh_inode; + + if (fhp->fh_locked) { + if (!fhp->fh_post_version) + fhp->fh_post_version = inode->i_version; + fhp->fh_locked = 0; + up(&inode->i_sem); + } +} + +/* + * Release an inode + */ +#ifndef NFSD_DEBUG +static inline void +fh_put(struct svc_fh *fhp) +{ + if (fhp->fh_inode) { + fh_unlock(fhp); + iput(fhp->fh_inode); + } +} +#else +#define fh_put(fhp) __fh_put(fhp, __FILE__, __LINE__) + +static inline void +__fh_put(struct svc_fh *fhp, char *file, int line) +{ + struct inode *inode; + + if (!(inode = fhp->fh_inode)) + return; + + if (!inode->i_count) { + printk("nfsd: trying to free free inode in %s:%d\n" + " dev %04x ino %ld, mode %07o\n", + file, line, inode->i_dev, + inode->i_ino, inode->i_mode); + } else { + fh_unlock(fhp); + iput(inode); + } +} +#endif + + + +#endif /* __KERNEL__ */ + +#endif /* NFSD_FH_H */ diff --git a/include/linux/nfsd/stats.h b/include/linux/nfsd/stats.h new file mode 100644 index 000000000..ab4bd68c0 --- /dev/null +++ b/include/linux/nfsd/stats.h @@ -0,0 +1,27 @@ +/* + * linux/include/nfsd/stats.h + * + * Statistics for NFS server. + * + * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> + */ + +#ifndef LINUX_NFSD_STATS_H +#define LINUX_NFSD_STATS_H + +struct nfsd_stats { + unsigned int rchits; /* repcache hits */ + unsigned int rcmisses; /* repcache hits */ + unsigned int rcnocache; /* uncached reqs */ +}; + +#ifdef __KERNEL__ + +extern struct nfsd_stats nfsdstats; +extern struct svc_stat nfsd_svcstats; + +void nfsd_stat_init(void); +void nfsd_stat_shutdown(void); + +#endif /* __KERNEL__ */ +#endif /* LINUX_NFSD_STATS_H */ diff --git a/include/linux/nfsd/syscall.h b/include/linux/nfsd/syscall.h new file mode 100644 index 000000000..98c5d5a6e --- /dev/null +++ b/include/linux/nfsd/syscall.h @@ -0,0 +1,127 @@ +/* + * include/linux/nfsd/syscall.h + * + * This file holds all declarations for the knfsd syscall interface. + * + * Copyright (C) 1995 Olaf Kirch <okir@monad.swb.de> + */ + +#ifndef NFSD_SYSCALL_H +#define NFSD_SYSCALL_H + +#include <linux/config.h> +#include <linux/types.h> +#include <linux/socket.h> +#include <linux/nfsd/const.h> +#include <linux/nfsd/export.h> +#include <linux/nfsd/nfsfh.h> +#include <linux/nfsd/auth.h> + +/* + * Version of the syscall interface + */ +#define NFSCTL_VERSION 0x0201 + +/* + * These are the commands understood by nfsctl(). + */ +#define NFSCTL_SVC 0 /* This is a server process. */ +#define NFSCTL_ADDCLIENT 1 /* Add an NFS client. */ +#define NFSCTL_DELCLIENT 2 /* Remove an NFS client. */ +#define NFSCTL_EXPORT 3 /* export a file system. */ +#define NFSCTL_UNEXPORT 4 /* unexport a file system. */ +#define NFSCTL_UGIDUPDATE 5 /* update a client's uid/gid map. */ +#define NFSCTL_GETFH 6 /* get an fh (used by mountd) */ + + +/* SVC */ +struct nfsctl_svc { + unsigned short svc_port; + int svc_nthreads; +}; + +/* ADDCLIENT/DELCLIENT */ +struct nfsctl_client { + char cl_ident[NFSCLNT_IDMAX+1]; + int cl_naddr; + struct in_addr cl_addrlist[NFSCLNT_ADDRMAX]; + int cl_fhkeytype; + int cl_fhkeylen; + unsigned char cl_fhkey[NFSCLNT_KEYMAX]; +}; + +/* EXPORT/UNEXPORT */ +struct nfsctl_export { + char ex_client[NFSCLNT_IDMAX+1]; + char ex_path[NFS_MAXPATHLEN+1]; + dev_t ex_dev; + ino_t ex_ino; + int ex_flags; + uid_t ex_anon_uid; + gid_t ex_anon_gid; +}; + +/* UGIDUPDATE */ +struct nfsctl_uidmap { + char * ug_ident; + uid_t ug_uidbase; + int ug_uidlen; + uid_t * ug_udimap; + uid_t ug_gidbase; + int ug_gidlen; + gid_t * ug_gdimap; +}; + +/* GETFH */ +struct nfsctl_fhparm { + struct sockaddr gf_addr; + dev_t gf_dev; + ino_t gf_ino; + int gf_version; +}; + +/* + * This is the argument union. + */ +struct nfsctl_arg { + int ca_version; /* safeguard */ + union { + struct nfsctl_svc u_svc; + struct nfsctl_client u_client; + struct nfsctl_export u_export; + struct nfsctl_uidmap u_umap; + struct nfsctl_fhparm u_getfh; + unsigned int u_debug; + } u; +#define ca_svc u.u_svc +#define ca_client u.u_client +#define ca_export u.u_export +#define ca_umap u.u_umap +#define ca_getfh u.u_getfh +#define ca_authd u.u_authd +#define ca_debug u.u_debug +}; + +union nfsctl_res { + struct knfs_fh cr_getfh; + unsigned int cr_debug; +}; + +#ifdef __KERNEL__ +/* + * Kernel syscall implementation. + */ +#ifdef CONFIG_NFSD +extern asmlinkage int sys_nfsservctl(int, struct nfsctl_arg *, + union nfsctl_res *); +#else +# define sys_nfsservctl sys_ni_syscall +#endif +extern int exp_addclient(struct nfsctl_client *ncp); +extern int exp_delclient(struct nfsctl_client *ncp); +extern int exp_export(struct nfsctl_export *nxp); +extern int exp_unexport(struct nfsctl_export *nxp); + +#endif /* __KERNEL__ */ + +#endif /* NFSD_SYSCALL_H */ diff --git a/include/linux/nfsd/xdr.h b/include/linux/nfsd/xdr.h new file mode 100644 index 000000000..3ff82382e --- /dev/null +++ b/include/linux/nfsd/xdr.h @@ -0,0 +1,158 @@ +/* + * linux/inxlude/linux/nfsd/xdr.h + * + * XDR types for nfsd. This is mainly a typing exercise. + */ + +#ifndef LINUX_NFSD_H +#define LINUX_NFSD_H + +#include <linux/fs.h> +#include <linux/nfs.h> + +struct nfsd_fhandle { + struct svc_fh fh; +}; + +struct nfsd_sattrargs { + struct svc_fh fh; + struct iattr attrs; +}; + +struct nfsd_diropargs { + struct svc_fh fh; + char * name; + int len; +}; + +struct nfsd_readargs { + struct svc_fh fh; + __u32 offset; + __u32 count; + __u32 totalsize; +}; + +struct nfsd_writeargs { + svc_fh fh; + __u32 beginoffset; + __u32 offset; + __u32 totalcount; + __u8 * data; + int len; +}; + +struct nfsd_createargs { + struct svc_fh fh; + char * name; + int len; + struct iattr attrs; +}; + +struct nfsd_renameargs { + struct svc_fh ffh; + char * fname; + int flen; + struct svc_fh tfh; + char * tname; + int tlen; +}; + +struct nfsd_linkargs { + struct svc_fh ffh; + struct svc_fh tfh; + char * tname; + int tlen; +}; + +struct nfsd_symlinkargs { + struct svc_fh ffh; + char * fname; + int flen; + char * tname; + int tlen; + struct iattr attrs; +}; + +struct nfsd_readdirargs { + struct svc_fh fh; + __u32 cookie; + __u32 count; +}; + +struct nfsd_attrstat { + struct svc_fh fh; +}; + +struct nfsd_diropres { + struct svc_fh fh; +}; + +struct nfsd_readlinkres { + int len; +}; + +struct nfsd_readres { + struct svc_fh fh; + unsigned long count; +}; + +struct nfsd_readdirres { + int count; +}; + +struct nfsd_statfsres { + struct statfs stats; +}; + +/* + * Storage requirements for XDR arguments and results. + */ +union nfsd_xdrstore { + struct nfsd_sattrargs sattr; + struct nfsd_diropargs dirop; + struct nfsd_readargs read; + struct nfsd_writeargs write; + struct nfsd_createargs create; + struct nfsd_renameargs rename; + struct nfsd_linkargs link; + struct nfsd_symlinkargs symlink; + struct nfsd_readdirargs readdir; +}; + +#define NFSSVC_XDRSIZE sizeof(union nfsd_xdrstore) + +void nfsd_xdr_init(void); + +int nfssvc_decode_void(struct svc_rqst *, u32 *, void *); +int nfssvc_decode_fhandle(struct svc_rqst *, u32 *, struct svc_fh *); +int nfssvc_decode_sattrargs(struct svc_rqst *, u32 *, + struct nfsd_sattrargs *); +int nfssvc_decode_diropargs(struct svc_rqst *, u32 *, + struct nfsd_diropargs *); +int nfssvc_decode_readargs(struct svc_rqst *, u32 *, + struct nfsd_readargs *); +int nfssvc_decode_writeargs(struct svc_rqst *, u32 *, + struct nfsd_writeargs *); +int nfssvc_decode_createargs(struct svc_rqst *, u32 *, + struct nfsd_createargs *); +int nfssvc_decode_renameargs(struct svc_rqst *, u32 *, + struct nfsd_renameargs *); +int nfssvc_decode_linkargs(struct svc_rqst *, u32 *, + struct nfsd_linkargs *); +int nfssvc_decode_symlinkargs(struct svc_rqst *, u32 *, + struct nfsd_symlinkargs *); +int nfssvc_decode_readdirargs(struct svc_rqst *, u32 *, + struct nfsd_readdirargs *); +int nfssvc_encode_void(struct svc_rqst *, u32 *, void *); +int nfssvc_encode_attrstat(struct svc_rqst *, u32 *, struct nfsd_attrstat *); +int nfssvc_encode_diropres(struct svc_rqst *, u32 *, struct nfsd_diropres *); +int nfssvc_encode_readlinkres(struct svc_rqst *, u32 *, struct nfsd_readlinkres *); +int nfssvc_encode_readres(struct svc_rqst *, u32 *, struct nfsd_readres *); +int nfssvc_encode_statfsres(struct svc_rqst *, u32 *, struct nfsd_statfsres *); +int nfssvc_encode_readdirres(struct svc_rqst *, u32 *, struct nfsd_readdirres *); +int nfssvc_release_fhandle(struct svc_rqst *, u32 *, struct nfsd_fhandle *); + +int nfssvc_encode_entry(struct readdir_cd *, const char *name, + int namlen, off_t offset, ino_t ino); + +#endif /* LINUX_NFSD_H */ diff --git a/include/linux/nfsd/xdr3.h b/include/linux/nfsd/xdr3.h new file mode 100644 index 000000000..54e11c549 --- /dev/null +++ b/include/linux/nfsd/xdr3.h @@ -0,0 +1,268 @@ +/* + * linux/include/linux/nfsd/xdr3.h + * + * XDR types for NFSv3 in nfsd. + * + * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de> + */ + +#ifndef LINUX_NFSD_XDR3_H +#define LINUX_NFSD_XDR3_H + +#include <linux/nfsd/xdr.h> + +struct nfsd3_sattrargs { + struct svc_fh fh; + struct iattr attrs; + time_t guardtime; +}; + +struct nfsd3_diropargs { + struct svc_fh fh; + char * name; + int len; +}; + +struct nfsd3_accessargs { + struct svc_fh fh; + unsigned int access; +}; + +struct nfsd3_readargs { + struct svc_fh fh; + __u64 offset; + __u32 count; +}; + +struct nfsd3_writeargs { + svc_fh fh; + __u64 offset; + __u32 count; + int stable; + __u8 * data; + int len; +}; + +struct nfsd3_createargs { + struct svc_fh fh; + char * name; + int len; + int createmode; + struct iattr attrs; + __u32 * verf; +}; + +struct nfsd3_mknodargs { + struct svc_fh fh; + char * name; + int len; + __u32 ftype; + __u32 major, minor; + struct iattr attrs; +}; + +struct nfsd3_renameargs { + struct svc_fh ffh; + char * fname; + int flen; + struct svc_fh tfh; + char * tname; + int tlen; +}; + +struct nfsd3_linkargs { + struct svc_fh ffh; + struct svc_fh tfh; + char * tname; + int tlen; +}; + +struct nfsd3_symlinkargs { + struct svc_fh ffh; + char * fname; + int flen; + char * tname; + int tlen; + struct iattr attrs; +}; + +struct nfsd3_readdirargs { + struct svc_fh fh; + __u32 cookie; + __u32 dircount; + __u32 count; + __u32 * verf; +}; + +struct nfsd3_commitargs { + struct svc_fh fh; + __u64 offset; + __u64 count; +}; + +struct nfsd3_attrstat { + __u32 status; + struct svc_fh fh; +}; + +struct nfsd3_lookupres { + __u32 status; + struct svc_fh dirfh; + struct svc_fh fh; +}; + +struct nfsd3_accessres { + __u32 status; + struct svc_fh fh; + __u32 access; +}; + +struct nfsd3_readlinkres { + __u32 status; + struct svc_fh fh; + __u32 len; +}; + +struct nfsd3_readres { + __u32 status; + struct svc_fh fh; + unsigned long count; + int eof; +}; + +struct nfsd3_writeres { + __u32 status; + struct svc_fh fh; + unsigned long count; + int committed; +}; + +struct nfsd3_createres { + __u32 status; + struct svc_fh dirfh; + struct svc_fh fh; +}; + +struct nfsd3_renameres { + __u32 status; + struct svc_fh ffh; + struct svc_fh tfh; +}; + +struct nfsd3_linkres { + __u32 status; + struct svc_fh tfh; + struct svc_fh fh; +}; + +struct nfsd3_readdirres { + __u32 status; + struct svc_fh fh; + __u32 * list_end; +}; + +struct nfsd3_statfsres { + __u32 status; + struct statfs stats; + __u32 invarsec; +}; + +struct nfsd3_fsinfores { + __u32 status; + __u32 f_rtmax; + __u32 f_rtpref; + __u32 f_rtmult; + __u32 f_wtmax; + __u32 f_wtpref; + __u32 f_wtmult; + __u32 f_dtpref; + __u64 f_maxfilesize; + __u32 f_properties; +}; + +struct nfsd3_pathconfres { + __u32 status; + __u32 p_link_max; + __u32 p_name_max; + __u32 p_case_insensitive; + __u32 p_case_preserving; +}; + +struct nfsd3_commitres { + __u32 status; + struct svc_fh fh; +}; + +/* dummy type for release */ +struct nfsd3_fhandle2 { + __u32 dummy; + struct svc_fh fh1; + struct svc_fh fh2; +}; + +/* + * Storage requirements for XDR arguments and results. + */ +union nfsd3_xdrstore { + struct nfsd3_sattrargs sattrargs; + struct nfsd3_diropargs diropargs; + struct nfsd3_readargs readargs; + struct nfsd3_writeargs writeargs; + struct nfsd3_createargs createargs; + struct nfsd3_renameargs renameargs; + struct nfsd3_linkargs linkargs; + struct nfsd3_symlinkargs symlinkargs; + struct nfsd3_readdirargs readdirargs; + struct nfsd3_lookupres lookupres; + struct nfsd3_accessres accessres; + struct nfsd3_readlinkres readlinkres; + struct nfsd3_readres readres; + struct nfsd3_writeres writeres; + struct nfsd3_createres createres; + struct nfsd3_renameres renameres; + struct nfsd3_linkres linkres; + struct nfsd3_readdirres readdirres; + struct nfsd3_statfsres statfsres; + struct nfsd3_fsinfores fsinfores; + struct nfsd3_pathconfres pathconfres; + struct nfsd3_commitres commitres; +}; + +#define NFS3_SVC_XDRSIZE sizeof(union nfsd3_xdrstore) + +void nfsxdr_init(void); + +int nfs3svc_decode_fhandle(struct svc_rqst *, u32 *, struct svc_fh *); +int nfs3svc_decode_sattr3args(struct svc_rqst *, u32 *, + struct nfsd3_sattrargs *); +int nfs3svc_decode_dirop3args(struct svc_rqst *, u32 *, + struct nfsd3_diropargs *); +int nfs3svc_decode_read3args(struct svc_rqst *, u32 *, + struct nfsd3_readargs *); +int nfs3svc_decode_write3args(struct svc_rqst *, u32 *, + struct nfsd3_writeargs *); +int nfs3svc_decode_create3args(struct svc_rqst *, u32 *, + struct nfsd3_createargs *); +int nfs3svc_decode_rename3args(struct svc_rqst *, u32 *, + struct nfsd3_renameargs *); +int nfs3svc_decode_link3args(struct svc_rqst *, u32 *, + struct nfsd3_linkargs *); +int nfs3svc_decode_symlink3args(struct svc_rqst *, u32 *, + struct nfsd3_symlinkargs *); +int nfs3svc_decode_readdir3args(struct svc_rqst *, u32 *, + struct nfsd3_readdirargs *); +int nfs3svc_encode_readlinkres(struct svc_rqst *, u32 *, + struct nfsd3_readlinkres *); +int nfs3svc_encode_readres(struct svc_rqst *, u32 *, struct nfsd3_readres *); +int nfs3svc_encode_statfsres(struct svc_rqst *, u32 *, + struct nfsd3_statfsres *); +int nfs3svc_encode_readdirres(struct svc_rqst *, u32 *, + struct nfsd3_readdirres *); +int nfs3svc_release_fhandle(struct svc_rqst *, u32 *, + struct nfsd_fhandle *); +int nfs3svc_release_fhandle2(struct svc_rqst *, u32 *, + struct nfsd3_fhandle2 *); +int nfs3svc_encode_entry(struct readdir_cd *, const char *name, + int namlen, unsigned long offset, ino_t ino); + +#endif /* LINUX_NFSD_XDR3_H */ diff --git a/include/linux/notifier.h b/include/linux/notifier.h index b3c9ccf65..86db4508f 100644 --- a/include/linux/notifier.h +++ b/include/linux/notifier.h @@ -13,7 +13,7 @@ struct notifier_block { - int (*notifier_call)(struct notifier_block *this, unsigned long, void *); + int (*notifier_call)(struct notifier_block *self, unsigned long, void *); struct notifier_block *next; int priority; }; @@ -92,5 +92,22 @@ extern __inline__ int notifier_call_chain(struct notifier_block **n, unsigned lo detected a hardware crash and restarted - we can use this eg to kick tcp sessions once done */ +#define NETDEV_CHANGE 0x0004 /* Notify device state change */ +#define NETDEV_REGISTER 0x0005 +#define NETDEV_UNREGISTER 0x0006 +#define NETDEV_CHANGEMTU 0x0007 +#define NETDEV_CHANGEADDR 0x0008 + +#define SYS_DOWN 0x0001 /* Notify of system down */ +#define SYS_RESTART SYS_DOWN +#define SYS_HALT 0x0002 /* Notify of system halt */ +#define SYS_POWER_OFF 0x0003 /* Notify of system power off */ + +/* + * Publically visible notifier objects + */ + +extern struct notifier_block *boot_notifier_list; + #endif #endif diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 868874192..9af62e4a2 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -71,20 +71,12 @@ static inline struct page *find_page(struct inode * inode, unsigned long offset) static inline void remove_page_from_hash_queue(struct page * page) { - struct page **p; - struct page *next_hash, *prev_hash; - - next_hash = page->next_hash; - prev_hash = page->prev_hash; - page->next_hash = NULL; - page->prev_hash = NULL; - if (next_hash) - next_hash->prev_hash = prev_hash; - if (prev_hash) - prev_hash->next_hash = next_hash; - p = page_hash(page->inode,page->offset); - if (*p == page) - *p = next_hash; + if(page->pprev_hash) { + if(page->next_hash) + page->next_hash->pprev_hash = page->pprev_hash; + *page->pprev_hash = page->next_hash; + page->pprev_hash = NULL; + } page_cache_size--; } @@ -93,10 +85,10 @@ static inline void __add_page_to_hash_queue(struct page * page, struct page **p) page_cache_size++; set_bit(PG_referenced, &page->flags); page->age = PAGE_AGE_VALUE; - page->prev_hash = NULL; - if ((page->next_hash = *p) != NULL) - page->next_hash->prev_hash = page; + if((page->next_hash = *p) != NULL) + (*p)->pprev_hash = &page->next_hash; *p = page; + page->pprev_hash = p; } static inline void add_page_to_hash_queue(struct page * page, struct inode * inode, unsigned long offset) @@ -104,7 +96,6 @@ static inline void add_page_to_hash_queue(struct page * page, struct inode * ino __add_page_to_hash_queue(page, page_hash(inode,offset)); } - static inline void remove_page_from_inode_queue(struct page * page) { struct inode * inode = page->inode; diff --git a/include/linux/parport.h b/include/linux/parport.h new file mode 100644 index 000000000..93cc5bd51 --- /dev/null +++ b/include/linux/parport.h @@ -0,0 +1,230 @@ +/* $Id: parport.h,v 1.2.6.3 1997/04/16 21:21:03 phil Exp $ */ + +#ifndef _PARPORT_H_ +#define _PARPORT_H_ + +#include <asm/system.h> +#include <asm/ptrace.h> +#include <linux/proc_fs.h> + +/* Maximum of 8 ports per machine */ +#define PARPORT_MAX 8 + +/* Magic numbers */ +#define PARPORT_IRQ_NONE -1 +#define PARPORT_DMA_NONE -1 +#define PARPORT_DISABLE -2 + +/* Type classes for Plug-and-Play probe */ + +typedef enum { + PARPORT_CLASS_LEGACY = 0, /* Non-IEEE1284 device */ + PARPORT_CLASS_PRINTER, + PARPORT_CLASS_MODEM, + PARPORT_CLASS_NET, + PARPORT_CLASS_HDC, /* Hard disk controller */ + PARPORT_CLASS_PCMCIA, + PARPORT_CLASS_MEDIA, /* Multimedia device */ + PARPORT_CLASS_FDC, /* Floppy disk controller */ + PARPORT_CLASS_PORTS, + PARPORT_CLASS_SCANNER, + PARPORT_CLASS_DIGCAM, + PARPORT_CLASS_OTHER, /* Anything else */ + PARPORT_CLASS_UNSPEC /* No CLS field in ID */ +} parport_device_class; + +struct parport_device_info { + parport_device_class class; + char *mfr; + char *model; + char *cmdset; + char *description; +}; + +/* Definitions for parallel port sharing */ + +/* Forward declare some stuff so we can use mutually circular structures */ +struct ppd; +struct parport; + +/* Each device can have two callback functions: + * 1) a preemption function, called by the resource manager to request + * that the driver relinquish control of the port. The driver should + * return zero if it agrees to release the port, and nonzero if it + * refuses. Do not call parport_release() - the kernel will do this + * implicitly. + * + * 2) a wake-up function, called by the resource manager to tell drivers + * that the port is available to be claimed. If a driver wants to use + * the port, it should call parport_claim() here. The return value from + * this function is ignored. + */ +typedef int (*callback_func) (void *); + +/* This is an ordinary kernel IRQ handler routine. + * The dev_id field (void *) will point the the port structure + * associated with the interrupt request (to allow IRQ sharing) + * Please make code IRQ sharing as this function may be called + * when it isn't meant for you... + */ +typedef void (*irq_handler_func) (int, void *, struct pt_regs *); + +/* A parallel port device */ +struct ppd { + char *name; + struct parport *port; /* The port this is associated with */ + callback_func preempt; /* preemption function */ + callback_func wakeup; /* kick function */ + void *private; + irq_handler_func irq_func; + int flags; + unsigned char ctr; /* SPP CTR register */ + unsigned char ecr; /* ECP ECR register */ + struct ppd *next; + struct ppd *prev; +}; + +struct parport_dir{ + struct proc_dir_entry *entry; /* Directory /proc/parport/X */ + struct proc_dir_entry *irq; /* IRQ entry /proc/parport/X/irq */ + struct proc_dir_entry *devices; /* /proc/parport/X/devices */ + struct proc_dir_entry *hardware; /* /proc/parport/X/hardware */ + char name[4]; /* /proc/parport/"XXXX" */ +}; + +/* A parallel port */ +struct parport { + unsigned int base; /* base address */ + unsigned int size; /* IO extent */ + char *name; + int irq; /* interrupt (or -1 for none) */ + int dma; + unsigned int modes; + struct ppd *devices; + struct ppd *cad; /* port owner */ + struct ppd *lurker; + unsigned int ctr; /* SPP CTR register */ + unsigned int ecr; /* ECP ECR register */ + struct parport *next; + unsigned int flags; + struct parport_dir pdir; + struct parport_device_info probe_info; + int speed; /* Max Write in Bytes/s */ +}; + +/* parport_register_port registers a new parallel port at the given address (if + * one does not already exist) and returns a pointer to it. This entails + * claiming the I/O region, IRQ and DMA. + * NULL is returned if initialisation fails. + */ +struct parport *parport_register_port(unsigned long base, int irq, int dma); + +/* parport_in_use returns nonzero if there are devices attached to a port. */ +#define parport_in_use(x) ((x)->devices != NULL) + +/* parport_destroy blows away a parallel port. This fails if any devices are + * registered. + */ +void parport_destroy(struct parport *); + +/* parport_enumerate returns a pointer to the linked list of all the ports + * in this machine. + */ +struct parport *parport_enumerate(void); + +/* parport_register_device declares that a device is connected to a port, and + * tells the kernel all it needs to know. + * pf is the preemption function (may be NULL for a transient driver) + * kf is the wake-up function (may be NULL for a transient driver) + * irq_func is the interrupt handler (may be NULL for no interrupts) + * Only one lurking driver can be used on a given port. + * handle is a user pointer that gets handed to callback functions. + */ +struct ppd *parport_register_device(struct parport *port, const char *name, + callback_func pf, callback_func kf, + irq_handler_func irq_func, int flags, + void *handle); + +/* parport_deregister causes the kernel to forget about a device */ +void parport_unregister_device(struct ppd *dev); + +/* parport_claim tries to gain ownership of the port for a particular driver. + * This may fail (return non-zero) if another driver is busy. If this + * driver has registered an interrupt handler, it will be enabled. + */ +int parport_claim(struct ppd *dev); + +/* parport_release reverses a previous parport_claim. This can never fail, + * though the effects are undefined (except that they are bad) if you didn't + * previously own the port. Once you have released the port you should make + * sure that neither your code nor the hardware on the port tries to initiate + * any communication without first re-claiming the port. + * If you mess with the port state (enabling ECP for example) you should + * clean up before releasing the port. + */ +void parport_release(struct ppd *dev); + +/* The "modes" entry in parport is a bit field representing the following + * modes. + * Note that LP_ECPEPP is for the SMC EPP+ECP mode which is NOT + * 100% compatible with EPP. + */ +#define PARPORT_MODE_SPP 0x0001 +#define PARPORT_MODE_PS2 0x0002 +#define PARPORT_MODE_EPP 0x0004 +#define PARPORT_MODE_ECP 0x0008 +#define PARPORT_MODE_ECPEPP 0x0010 +#define PARPORT_MODE_ECR 0x0020 /* ECR Register Exists */ +#define PARPORT_MODE_ECPPS2 0x0040 + +/* Flags used to identify what a device does + */ +#define PARPORT_DEV_TRAN 0x0000 +#define PARPORT_DEV_LURK 0x0001 + +#define PARPORT_FLAG_COMA 1 + +extern int parport_ieee1284_nibble_mode_ok(struct parport *, unsigned char); +extern int parport_wait_peripheral(struct parport *, unsigned char, unsigned + char); + +/* Prototypes from parport_procfs */ +extern int parport_proc_init(void); +extern int parport_proc_cleanup(void); +extern int parport_proc_register(struct parport *pp); +extern int parport_proc_unregister(struct parport *pp); + +/* Prototypes from parport_ksyms.c */ +extern void dec_parport_count(void); +extern void inc_parport_count(void); + +extern int parport_probe(struct parport *port, char *buffer, int len); +extern void parport_probe_one(struct parport *port); + +/* Primitive port access functions */ +extern inline void parport_w_ctrl(struct parport *port, int val) +{ + outb(val, port->base+2); +} + +extern inline int parport_r_ctrl(struct parport *port) +{ + return inb(port->base+2); +} + +extern inline void parport_w_data(struct parport *port, int val) +{ + outb(val, port->base); +} + +extern inline int parport_r_data(struct parport *port) +{ + return inb(port->base); +} + +extern inline int parport_r_status(struct parport *port) +{ + return inb(port->base+1); +} + +#endif /* _PARPORT_H_ */ diff --git a/include/linux/pci.h b/include/linux/pci.h index 4118dfdc0..58c4e026b 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -31,14 +31,14 @@ * PCI-CPU bridge or PCI-ISA bridge. * - If you can't find the actual information in your hardware * booklet, try to read the references of the chip on the board. - * - Send all that to linux-pcisupport@cao-vlsi.ibp.fr, + * - Send all that to linux-pcisupport@cck.uni-kl.de * and I'll add your device to the list as soon as possible * * BEFORE you send a mail, please check the latest linux releases * to be sure it has not been recently added. * * Thanks - * Frederic Potter. + * Jens Maurer */ @@ -228,6 +228,11 @@ #define PCI_DEVICE_ID_NCR_53C820 0x0002 #define PCI_DEVICE_ID_NCR_53C825 0x0003 #define PCI_DEVICE_ID_NCR_53C815 0x0004 +#define PCI_DEVICE_ID_NCR_53C860 0x0006 +#define PCI_DEVICE_ID_NCR_53C896 0x000b +#define PCI_DEVICE_ID_NCR_53C895 0x000c +#define PCI_DEVICE_ID_NCR_53C885 0x000d +#define PCI_DEVICE_ID_NCR_53C875 0x000f #define PCI_VENDOR_ID_ATI 0x1002 #define PCI_DEVICE_ID_ATI_68800 0x4158 @@ -252,6 +257,7 @@ #define PCI_DEVICE_ID_TSENG_W32P_b 0x3205 #define PCI_DEVICE_ID_TSENG_W32P_c 0x3206 #define PCI_DEVICE_ID_TSENG_W32P_d 0x3207 +#define PCI_DEVICE_ID_TSENG_ET6000 0x3208 #define PCI_VENDOR_ID_WEITEK 0x100e #define PCI_DEVICE_ID_WEITEK_P9000 0x9001 @@ -268,6 +274,7 @@ #define PCI_DEVICE_ID_DEC_21152 0x0024 #define PCI_VENDOR_ID_CIRRUS 0x1013 +#define PCI_DEVICE_ID_CIRRUS_7548 0x0038 #define PCI_DEVICE_ID_CIRRUS_5430 0x00a0 #define PCI_DEVICE_ID_CIRRUS_5434_4 0x00a4 #define PCI_DEVICE_ID_CIRRUS_5434_8 0x00a8 @@ -297,11 +304,13 @@ #define PCI_VENDOR_ID_MATROX 0x102B #define PCI_DEVICE_ID_MATROX_MGA_2 0x0518 #define PCI_DEVICE_ID_MATROX_MIL 0x0519 +#define PCI_DEVICE_ID_MATROX_MYS 0x051A #define PCI_DEVICE_ID_MATROX_MGA_IMP 0x0d10 #define PCI_VENDOR_ID_CT 0x102c #define PCI_DEVICE_ID_CT_65545 0x00d8 #define PCI_DEVICE_ID_CT_65548 0x00dc +#define PCI_DEVICE_ID_CT_65550 0x00e0 #define PCI_VENDOR_ID_MIRO 0x1031 #define PCI_DEVICE_ID_MIRO_36050 0x5601 @@ -349,6 +358,10 @@ #define PCI_VENDOR_ID_OAK 0x104e #define PCI_DEVICE_ID_OAK_OTI107 0x0107 +/* Winbond have two vendor IDs! See 0x10ad as well */ +#define PCI_VENDOR_ID_WINBOND2 0x1050 +#define PCI_DEVICE_ID_WINBOND2_89C940 0x0940 + #define PCI_VENDOR_ID_PROMISE 0x105a #define PCI_DEVICE_ID_PROMISE_5300 0x5300 @@ -410,6 +423,8 @@ #define PCI_DEVICE_ID_3COM_3C595TX 0x5950 #define PCI_DEVICE_ID_3COM_3C595T4 0x5951 #define PCI_DEVICE_ID_3COM_3C595MII 0x5952 +#define PCI_DEVICE_ID_3COM_3C900TPO 0x9000 +#define PCI_DEVICE_ID_3COM_3C905TX 0x9050 #define PCI_VENDOR_ID_AL 0x10b9 #define PCI_DEVICE_ID_AL_M1445 0x1445 @@ -421,6 +436,9 @@ #define PCI_DEVICE_ID_AL_M1513 0x1513 #define PCI_DEVICE_ID_AL_M4803 0x5215 +#define PCI_VENDOR_ID_NEOMAGIC 0x10c8 +#define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_NM2070 0x0001 + #define PCI_VENDOR_ID_ASP 0x10cd #define PCI_DEVICE_ID_ASP_ABP940 0x1200 @@ -439,6 +457,7 @@ #define PCI_VENDOR_ID_INTERG 0x10ea #define PCI_DEVICE_ID_INTERG_1680 0x1680 +#define PCI_DEVICE_ID_INTERG_1682 0x1682 #define PCI_VENDOR_ID_REALTEK 0x10ec #define PCI_DEVICE_ID_REALTEK_8029 0x8029 @@ -505,6 +524,9 @@ #define PCI_DEVICE_ID_SPECIALIX_XIO 0x4000 #define PCI_DEVICE_ID_SPECIALIX_RIO 0x8000 +#define PCI_VENDOR_ID_COMPEX 0x11f6 +#define PCI_DEVICE_ID_COMPEX_RL2000 0x1401 + #define PCI_VENDOR_ID_RP 0x11fe #define PCI_DEVICE_ID_RP8OCTA 0x0001 #define PCI_DEVICE_ID_RP8INTF 0x0002 @@ -517,6 +539,13 @@ #define PCI_DEVICE_ID_CYCLOM_Z_Lo 0x0200 #define PCI_DEVICE_ID_CYCLOM_Z_Hi 0x0201 +#define PCI_VENDOR_ID_OPTIBASE 0x1255 +#define PCI_DEVICE_ID_OPTIBASE_FORGE 0x1110 +#define PCI_DEVICE_ID_OPTIBASE_FUSION 0x1210 +#define PCI_DEVICE_ID_OPTIBASE_VPLEX 0x2120 +#define PCI_DEVICE_ID_OPTIBASE_VPLEXCC 0x2120 +#define PCI_DEVICE_ID_OPTIBASE_VQUEST 0x2130 + #define PCI_VENDOR_ID_SYMPHONY 0x1c1c #define PCI_DEVICE_ID_SYMPHONY_101 0x0001 @@ -556,14 +585,20 @@ #define PCI_DEVICE_ID_INTEL_82437 0x122d #define PCI_DEVICE_ID_INTEL_82371_0 0x122e #define PCI_DEVICE_ID_INTEL_82371_1 0x1230 +#define PCI_DEVICE_ID_INTEL_430MX_0 0x1234 +#define PCI_DEVICE_ID_INTEL_430MX_1 0x1235 #define PCI_DEVICE_ID_INTEL_82441 0x1237 #define PCI_DEVICE_ID_INTEL_82439 0x1250 #define PCI_DEVICE_ID_INTEL_82371SB_0 0x7000 #define PCI_DEVICE_ID_INTEL_82371SB_1 0x7010 #define PCI_DEVICE_ID_INTEL_82371SB_2 0x7020 #define PCI_DEVICE_ID_INTEL_82437VX 0x7030 +#define PCI_DEVICE_ID_INTEL_82371AB 0x7111 #define PCI_DEVICE_ID_INTEL_P6 0x84c4 +#define PCI_VENDOR_ID_KTI 0x8e2e +#define PCI_DEVICE_ID_KTI_ET32P2 0x3000 + #define PCI_VENDOR_ID_ADAPTEC 0x9004 #define PCI_DEVICE_ID_ADAPTEC_7850 0x5078 #define PCI_DEVICE_ID_ADAPTEC_7855 0x5578 @@ -583,9 +618,10 @@ #define PCI_VENDOR_ID_ATRONICS 0x907f #define PCI_DEVICE_ID_ATRONICS_2015 0x2015 -#define PCI_VENDOR_ID_HER 0xedd8 -#define PCI_DEVICE_ID_HER_STING 0xa091 -#define PCI_DEVICE_ID_HER_STINGARK 0xa099 +#define PCI_VENDOR_ID_ARK 0xedd8 +#define PCI_DEVICE_ID_ARK_STING 0xa091 +#define PCI_DEVICE_ID_ARK_STINGARK 0xa099 +#define PCI_DEVICE_ID_ARK_2000MT 0xa0a1 /* * The PCI interface treats multi-function devices as independent diff --git a/include/linux/pcwd.h b/include/linux/pcwd.h deleted file mode 100644 index 6b77fdefa..000000000 --- a/include/linux/pcwd.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Berkshire PC Watchdog Defines - * For version 0.41 of the driver - */ - -#define PCWD_IOCTL_BASE 'W' - -#define PCWD_GETSTAT _IOR(PCWD_IOCTL_BASE, 1, int) -#define PCWD_PING _IOR(PCWD_IOCTL_BASE, 2, int) - -#define PCWD_PREVRESET 0x01 /* System previously reset by card */ -#define PCWD_TEMPSENSE 0x02 /* Temperature overheat sense */ diff --git a/include/linux/personality.h b/include/linux/personality.h index c8f09ebea..71599e3ee 100644 --- a/include/linux/personality.h +++ b/include/linux/personality.h @@ -26,7 +26,7 @@ #define PER_IRIX64 (0x000a | STICKY_TIMEOUTS) /* IRIX6 64-bit */ /* Prototype for an lcall7 syscall handler. */ -typedef asmlinkage void (*lcall7_func)(struct pt_regs *); +typedef void (*lcall7_func)(struct pt_regs *); /* Description of an execution domain - personality range supported, @@ -40,7 +40,7 @@ struct exec_domain { unsigned char pers_low, pers_high; unsigned long * signal_map; unsigned long * signal_invmap; - long *use_count; + struct module * module; struct exec_domain *next; }; diff --git a/include/linux/pi2.h b/include/linux/pi2.h new file mode 100644 index 000000000..1740cc0b2 --- /dev/null +++ b/include/linux/pi2.h @@ -0,0 +1,130 @@ + +#define DMA_BUFF_SIZE 2200 + +#define ON 1 +#define OFF 0 + + +/* Register offset info, specific to the PI + * E.g., to read the data port on channel A, use + * inportb(pichan[dev].base + CHANA + DATA) + */ +#define CHANB 0 /* Base of channel B regs */ +#define CHANA 2 /* Base of channel A regs */ + +/* 8530 ports on each channel */ +#define CTL 0 +#define DATA 1 + +#define DMAEN 0x4 /* Offset off DMA Enable register */ + +/* Timer chip offsets */ +#define TMR0 0x8 /* Offset of timer 0 register */ +#define TMR1 0x9 /* Offset of timer 1 register */ +#define TMR2 0xA /* Offset of timer 2 register */ +#define TMRCMD 0xB /* Offset of timer command register */ + +/* Timer chip equates */ +#define SC0 0x00 /* Select counter 0 */ +#define SC1 0x40 /* Select counter 1 */ +#define SC2 0x80 /* Select counter 2 */ +#define CLATCH 0x00 /* Counter latching operation */ +#define MSB 0x20 /* Read/load MSB only */ +#define LSB 0x10 /* Read/load LSB only */ +#define LSB_MSB 0x30 /* Read/load LSB, then MSB */ +#define MODE0 0x00 /* Interrupt on terminal count */ +#define MODE1 0x02 /* Programmable one shot */ +#define MODE2 0x04 /* Rate generator */ +#define MODE3 0x06 /* Square wave rate generator */ +#define MODE4 0x08 /* Software triggered strobe */ +#define MODE5 0x0a /* Hardware triggered strobe */ +#define BCD 0x01 /* BCD counter */ + +/* DMA controller registers */ +#define DMA_STAT 8 /* DMA controller status register */ +#define DMA_CMD 8 /* DMA controller command register */ +#define DMA_MASK 10 /* DMA controller mask register */ +#define DMA_MODE 11 /* DMA controller mode register */ +#define DMA_RESETFF 12 /* DMA controller first/last flip flop */ +/* DMA data */ +#define DMA_DISABLE (0x04) /* Disable channel n */ +#define DMA_ENABLE (0x00) /* Enable channel n */ +/* Single transfers, incr. address, auto init, writes, ch. n */ +#define DMA_RX_MODE (0x54) +/* Single transfers, incr. address, no auto init, reads, ch. n */ +#define DMA_TX_MODE (0x48) + +#define SINGLE 3686400 +#define DOUBLE 7372800 + +#define SIOCGPIPARAM 0x5000 /* get PI parameters */ +#define SIOCSPIPARAM 0x5001 /* set */ +#define SIOCGPIBAUD 0x5002 /* get only baud rate */ +#define SIOCSPIBAUD 0x5003 +#define SIOCGPIDMA 0x5004 /* get only DMA */ +#define SIOCSPIDMA 0x5005 +#define SIOCGPIIRQ 0x5006 /* get only IRQ */ +#define SIOCSPIIRQ 0x5007 + +struct pi_req { + int cmd; + int speed; + int clockmode; + int txdelay; + unsigned char persist; + int slotime; + int squeldelay; + int dmachan; + int irq; +}; + +#ifdef __KERNEL__ + +/* Information that needs to be kept for each channel. */ +struct pi_local { + struct net_device_stats stats; + long open_time; /* Useless example local info. */ + unsigned long xtal; + + struct mbuf *rcvbuf;/* Buffer for current rx packet */ + struct mbuf *rxdmabuf1; /* DMA rx buffer */ + struct mbuf *rxdmabuf2; /* DMA rx buffer */ + + int bufsiz; /* Size of rcvbuf */ + char *rcp; /* Pointer into rcvbuf */ + + struct sk_buff_head sndq; /* Packets awaiting transmission */ + int sndcnt; /* Number of packets on sndq */ + struct sk_buff *sndbuf; /* Current buffer being transmitted */ + char *txdmabuf; /* Transmit DMA buffer */ + char *txptr; /* Used by B port tx */ + int txcnt; + char tstate; /* Transmitter state */ +#define IDLE 0 /* Transmitter off, no data pending */ +#define ACTIVE 1 /* Transmitter on, sending data */ +#define UNDERRUN 2 /* Transmitter on, flushing CRC */ +#define FLAGOUT 3 /* CRC sent - attempt to start next frame */ +#define DEFER 4 /* Receive Active - DEFER Transmit */ +#define ST_TXDELAY 5 /* Sending leading flags */ +#define CRCOUT 6 + char rstate; /* Set when !DCD goes to 0 (TRUE) */ +/* Normal state is ACTIVE if Receive enabled */ +#define RXERROR 2 /* Error -- Aborting current Frame */ +#define RXABORT 3 /* ABORT sequence detected */ +#define TOOBIG 4 /* too large a frame to store */ + int dev; /* Device number */ + int base; /* Base of I/O registers */ + int cardbase; /* Base address of card */ + int stata; /* address of Channel A status regs */ + int statb; /* address of Channel B status regs */ + int speed; /* Line speed, bps */ + int clockmode; /* tapr 9600 modem clocking option */ + int txdelay; /* Transmit Delay 10 ms/cnt */ + unsigned char persist; /* Persistence (0-255) as a % */ + int slotime; /* Delay to wait on persistence hit */ + int squeldelay; /* Delay after XMTR OFF for squelch tail */ + struct iface *iface; /* Associated interface */ + int dmachan; /* DMA channel for this port */ +}; + +#endif diff --git a/include/linux/poll.h b/include/linux/poll.h new file mode 100644 index 000000000..2001fedfb --- /dev/null +++ b/include/linux/poll.h @@ -0,0 +1 @@ +#include <asm/poll.h> diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index 2bb90e3f5..0937a7bc1 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h @@ -1,6 +1,7 @@ #ifndef _LINUX_PROC_FS_H #define _LINUX_PROC_FS_H +#include <linux/config.h> #include <linux/fs.h> #include <linux/malloc.h> @@ -21,6 +22,7 @@ enum root_directory_inos { PROC_VERSION, PROC_CPUINFO, PROC_PCI, + PROC_MCA, PROC_SELF, /* will change inode # */ PROC_NET, PROC_SCSI, @@ -41,9 +43,13 @@ enum root_directory_inos { PROC_CMDLINE, PROC_SYS, PROC_MTAB, + PROC_SWAP, PROC_MD, PROC_RTC, - PROC_LOCKS + PROC_LOCKS, + PROC_ZORRO, + PROC_SLABINFO, + PROC_PARPORT }; enum pid_directory_inos { @@ -58,7 +64,10 @@ enum pid_directory_inos { PROC_PID_CMDLINE, PROC_PID_STAT, PROC_PID_STATM, - PROC_PID_MAPS + PROC_PID_MAPS, +#if CONFIG_AP1000 + PROC_PID_RINGBUF, +#endif }; enum pid_subdirectory_inos { @@ -69,10 +78,16 @@ enum net_directory_inos { PROC_NET_UNIX = 128, PROC_NET_ARP, PROC_NET_ROUTE, + PROC_NET_RTCLASSES, + PROC_NET_RTLOCAL, + PROC_NET_RTRULES, PROC_NET_DEV, PROC_NET_RAW, + PROC_NET_RAW6, PROC_NET_TCP, + PROC_NET_TCP6, PROC_NET_UDP, + PROC_NET_UDP6, PROC_NET_SNMP, PROC_NET_RARP, PROC_NET_IGMP, @@ -83,7 +98,7 @@ enum net_directory_inos { PROC_NET_IPFWOUT, PROC_NET_IPACCT, PROC_NET_IPMSQHST, - PROC_NET_WAVELAN, + PROC_NET_WIRELESS, PROC_NET_IPX_INTERFACE, PROC_NET_IPX_ROUTE, PROC_NET_IPX, @@ -97,13 +112,16 @@ enum net_directory_inos { PROC_NET_NR_NEIGH, PROC_NET_NR, PROC_NET_SOCKSTAT, + PROC_NET_SOCKSTAT6, PROC_NET_RTCACHE, PROC_NET_AX25_BPQETHER, PROC_NET_ALIAS_TYPES, PROC_NET_ALIASES, PROC_NET_IP_MASQ_APP, PROC_NET_RT6, + PROC_NET_RT6_TREE, PROC_NET_RT6_STATS, + PROC_NET_NDISC, PROC_NET_STRIP_STATUS, PROC_NET_STRIP_TRACE, PROC_NET_Z8530, @@ -111,6 +129,11 @@ enum net_directory_inos { PROC_NET_RS_NEIGH, PROC_NET_RS_ROUTES, PROC_NET_RS, + PROC_NET_CL2LLC, + PROC_NET_X25_LINKS, + PROC_NET_X25_ROUTES, + PROC_NET_X25, + PROC_NET_TR_RIF, PROC_NET_LAST }; @@ -137,16 +160,19 @@ enum scsi_directory_inos { PROC_SCSI_NCR53C8XX, PROC_SCSI_ULTRASTOR, PROC_SCSI_7000FASST, + PROC_SCSI_IBMMCA, PROC_SCSI_EATA2X, PROC_SCSI_AM53C974, PROC_SCSI_SSC, PROC_SCSI_NCR53C406A, PROC_SCSI_PPA, PROC_SCSI_ESP, + PROC_SCSI_QLOGICPTI, PROC_SCSI_A3000, PROC_SCSI_A2091, PROC_SCSI_GVP11, PROC_SCSI_ATARI, + PROC_SCSI_IDESCSI, PROC_SCSI_SGIWD93, PROC_SCSI_SCSI_DEBUG, PROC_SCSI_NOT_PRESENT, @@ -154,10 +180,24 @@ enum scsi_directory_inos { PROC_SCSI_LAST = (PROC_SCSI_FILE + 16) /* won't ever see more than */ }; /* 16 HBAs in one machine */ +enum mca_directory_inos { + PROC_MCA_MACHINE = (PROC_SCSI_LAST+1), + PROC_MCA_REGISTERS, + PROC_MCA_VIDEO, + PROC_MCA_SCSI, + PROC_MCA_SLOT, /* the 8 adapter slots */ + PROC_MCA_LAST = (PROC_MCA_SLOT + 8) +}; + /* Finally, the dynamically allocatable proc entries are reserved: */ #define PROC_DYNAMIC_FIRST 4096 #define PROC_NDYNAMIC 4096 +#define PROC_OPENPROM_FIRST (PROC_DYNAMIC_FIRST+PROC_NDYNAMIC) +#define PROC_OPENPROM PROC_OPENPROM_FIRST +#define PROC_NOPENPROM 4096 +#define PROC_OPENPROMD_FIRST (PROC_OPENPROM_FIRST+PROC_NOPENPROM) +#define PROC_NOPENPROMD 4096 #define PROC_SUPER_MAGIC 0x9fa0 @@ -190,17 +230,23 @@ struct proc_dir_entry { void (*fill_inode)(struct inode *); struct proc_dir_entry *next, *parent, *subdir; void *data; + int (*read_proc)(char *page, char **start, off_t off, + int count, int *eof, void *data); + int (*write_proc)(struct file *file, const char *buffer, + unsigned long count, void *data); }; extern int (* dispatch_scsi_info_ptr) (int ino, char *buffer, char **start, off_t offset, int length, int inout); extern struct proc_dir_entry proc_root; -extern struct proc_dir_entry proc_net; -extern struct proc_dir_entry proc_scsi; +extern struct proc_dir_entry *proc_net; +extern struct proc_dir_entry *proc_scsi; extern struct proc_dir_entry proc_sys; +extern struct proc_dir_entry proc_openprom; extern struct proc_dir_entry proc_pid; extern struct proc_dir_entry proc_pid_fd; +extern struct proc_dir_entry proc_mca; extern struct inode_operations proc_scsi_inode_operations; @@ -209,18 +255,16 @@ extern void proc_base_init(void); extern void proc_net_init(void); extern int proc_register(struct proc_dir_entry *, struct proc_dir_entry *); -extern int proc_register_dynamic(struct proc_dir_entry *, - struct proc_dir_entry *); extern int proc_unregister(struct proc_dir_entry *, int); static inline int proc_net_register(struct proc_dir_entry * x) { - return proc_register(&proc_net, x); + return proc_register(proc_net, x); } static inline int proc_net_unregister(int x) { - return proc_unregister(&proc_net, x); + return proc_unregister(proc_net, x); } static inline int proc_scsi_register(struct proc_dir_entry *driver, @@ -228,7 +272,7 @@ static inline int proc_scsi_register(struct proc_dir_entry *driver, { x->ops = &proc_scsi_inode_operations; if(x->low_ino < PROC_SCSI_FILE){ - return(proc_register(&proc_scsi, x)); + return(proc_register(proc_scsi, x)); }else{ return(proc_register(driver, x)); } @@ -239,7 +283,7 @@ static inline int proc_scsi_unregister(struct proc_dir_entry *driver, int x) extern void scsi_init_free(char *ptr, unsigned int size); if(x <= PROC_SCSI_FILE) - return(proc_unregister(&proc_scsi, x)); + return(proc_unregister(proc_scsi, x)); else { struct proc_dir_entry **p = &driver->subdir, *dp; int ret; @@ -273,10 +317,30 @@ extern int proc_match(int, const char *, struct proc_dir_entry *); extern int proc_readdir(struct inode *, struct file *, void *, filldir_t); extern int proc_lookup(struct inode *, const char *, int, struct inode **); +struct openpromfs_dev { + struct openpromfs_dev *next; + u32 node; + ino_t inode; + kdev_t rdev; + mode_t mode; + char name[32]; +}; +extern struct inode_operations * +proc_openprom_register(int (*readdir)(struct inode *, struct file *, void *, filldir_t), + int (*lookup)(struct inode *, const char *, int, struct inode **), + void (*use)(struct inode *, int), + struct openpromfs_dev ***); +extern void proc_openprom_deregister(void); +extern void (*proc_openprom_use)(struct inode *,int); +extern int proc_openprom_regdev(struct openpromfs_dev *); +extern int proc_openprom_unregdev(struct openpromfs_dev *); + extern struct inode_operations proc_dir_inode_operations; +extern struct inode_operations proc_file_inode_operations; extern struct inode_operations proc_net_inode_operations; extern struct inode_operations proc_netdir_inode_operations; extern struct inode_operations proc_scsi_inode_operations; +extern struct inode_operations proc_openprom_inode_operations; extern struct inode_operations proc_mem_inode_operations; extern struct inode_operations proc_sys_inode_operations; extern struct inode_operations proc_array_inode_operations; @@ -286,5 +350,21 @@ extern struct inode_operations proc_profile_inode_operations; extern struct inode_operations proc_kmsg_inode_operations; extern struct inode_operations proc_link_inode_operations; extern struct inode_operations proc_fd_inode_operations; - +#if CONFIG_AP1000 +extern struct inode_operations proc_ringbuf_inode_operations; +#endif #endif + +/* + * generic.c + */ +struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode, + struct proc_dir_entry *parent); +void remove_proc_entry(const char *name, struct proc_dir_entry *parent); + +/* + * proc_tty.c + */ +extern void proc_tty_init(void); +extern void proc_tty_register_driver(struct tty_driver *driver); +extern void proc_tty_unregister_driver(struct tty_driver *driver); diff --git a/include/linux/ps2esdi.h b/include/linux/ps2esdi.h new file mode 100644 index 000000000..c0e050b1d --- /dev/null +++ b/include/linux/ps2esdi.h @@ -0,0 +1,98 @@ +#ifndef _PS2ESDI_H_ +#define _PS2ESDI_H_ + +#define NRML_ESDI_ID 0xddff +#define INTG_ESDI_ID 0xdf9f + +#define PRIMARY_IO_BASE 0x3510 +#define ALT_IO_BASE 0x3518 + +#define ESDI_CMD_INT (io_base+0) +#define ESDI_STT_INT (io_base+0) +#define ESDI_CONTROL (io_base+2) +#define ESDI_STATUS (io_base+2) +#define ESDI_ATTN (io_base+3) +#define ESDI_INTRPT (io_base+3) + +#define STATUS_ENABLED 0x01 +#define STATUS_ALTERNATE 0x02 +#define STATUS_BUSY 0x10 +#define STATUS_STAT_AVAIL 0x08 +#define STATUS_INTR 0x01 +#define STATUS_RESET_FAIL 0xea +#define STATUS_CMD_INF 0x04 + +#define CTRL_SOFT_RESET 0xe4 +#define CTRL_HARD_RESET 0x80 +#define CTRL_EOI 0xe2 +#define CTRL_ENABLE_DMA 0x02 +#define CTRL_ENABLE_INTR 0x01 +#define CTRL_DISABLE_INTR 0x00 + +#define ATT_EOI 0x02 + +/* bits of word 0 of configuration status block. more info see p.38 of tech ref */ +#define CONFIG_IS 0x10 /* Invalid Secondary */ +#define CONFIG_ZD 0x08 /* Zero Defect */ +#define CONFIG_SF 0x04 /* Skewed Format */ +#define CONFIG_FR 0x02 /* Removable */ +#define CONFIG_RT 0x01 /* Retries */ + +#define PORT_SYS_A 0x92 +#define PORT_DMA_FN 0x18 +#define PORT_DMA_EX 0x1a + +#define ON (unsigned char)0x40 +#define OFF (unsigned char)~ON +#define LITE_ON outb(inb(PORT_SYS_A) | ON,PORT_SYS_A) +#define LITE_OFF outb((inb(PORT_SYS_A) & OFF),PORT_SYS_A) + +#define FAIL 0 +#define SUCCES 1 + +#define INT_CMD_COMPLETE 0x01 +#define INT_CMD_ECC 0x03 +#define INT_CMD_RETRY 0x05 +#define INT_CMD_FORMAT 0x06 +#define INT_CMD_ECC_RETRY 0x07 +#define INT_CMD_WARNING 0x08 +#define INT_CMD_ABORT 0x09 +#define INT_RESET 0x0A +#define INT_TRANSFER_REQ 0x0B +#define INT_CMD_FAILED 0x0C +#define INT_DMA_ERR 0x0D +#define INT_CMD_BLK_ERR 0x0E +#define INT_ATTN_ERROR 0x0F + +#define DMA_MASK_CHAN 0x90 +#define DMA_UNMASK_CHAN 0xA0 +#define DMA_WRITE_ADDR 0x20 +#define DMA_WRITE_TC 0x40 +#define DMA_WRITE_MODE 0x70 + +#define CMD_GET_DEV_CONFIG 0x09 +#define CMD_READ 0x4601 +#define CMD_WRITE 0x4602 +#define DMA_READ_16 0x4C +#define DMA_WRITE_16 0x44 + + +#define MB 1024*1024 +#define SECT_SIZE 512 + +#define ERROR 1 +#define OK 0 + +#define HDIO_GETGEO 0x0301 + +#define FALSE 0 +#define TRUE !FALSE + +struct ps2esdi_geometry { + unsigned char heads; + unsigned char sectors; + unsigned short cylinders; + unsigned long start; +}; + +#endif /* _PS2ESDI_H_ */ diff --git a/include/linux/pt.h b/include/linux/pt.h new file mode 100644 index 000000000..9ab17f501 --- /dev/null +++ b/include/linux/pt.h @@ -0,0 +1,174 @@ +/* + * pt.h: Linux device driver for the Gracilis PackeTwin + * Copyright (C) 1995 Craig Small VK2XLZ (vk2xlz@vk2xlz.ampr.org.) + * + * Please read the notice appearing at the top of the file pt.c + */ +#define DMA_BUFF_SIZE 2200 + +#define ON 1 +#define OFF 0 + + +/* Register offset info, specific to the PT + * E.g., to read the data port on channel A, use + * inportb(pichan[dev].base + CHANA + DATA) + */ +#define CHANB 0 /* Base of channel B regs */ +#define CHANA 2 /* Base of channel A regs */ + +/* 8530 ports on each channel */ +#define CTL 0 +#define DATA 1 + +#define DMAEN 0x8 /* Offset off DMA Enable register */ + +/* Timer chip offsets */ +#define TMR0 0x4 /* Offset of timer 0 register */ +#define TMR1 0x5 /* Offset of timer 1 register */ +#define TMR2 0x6 /* Offset of timer 2 register */ +#define TMRCMD 0x7 /* Offset of timer command register */ +#define INT_REG 0x8 +#define TMR1CLR 0x9 +#define TMR2CLR 0xa + +/* Interrupt register equates */ +#define PT_SCC_MSK 0x1 +#define PT_TMR1_MSK 0x2 +#define PT_TMR2_MSK 0x4 + +/* Serial/interrupt register equates */ +#define PT_DTRA_ON 0x1 +#define PT_DTRB_ON 0x2 +#define PT_EXTCLKA 0x4 +#define PT_EXTCLKB 0x8 +#define PT_LOOPA_ON 0x10 +#define PT_LOOPB_ON 0x20 +#define PT_EI 0x80 + +/* Timer chip equates */ +#define SC0 0x00 /* Select counter 0 */ +#define SC1 0x40 /* Select counter 1 */ +#define SC2 0x80 /* Select counter 2 */ +#define CLATCH 0x00 /* Counter latching operation */ +#define MSB 0x20 /* Read/load MSB only */ +#define LSB 0x10 /* Read/load LSB only */ +#define LSB_MSB 0x30 /* Read/load LSB, then MSB */ +#define MODE0 0x00 /* Interrupt on terminal count */ +#define MODE1 0x02 /* Programmable one shot */ +#define MODE2 0x04 /* Rate generator */ +#define MODE3 0x06 /* Square wave rate generator */ +#define MODE4 0x08 /* Software triggered strobe */ +#define MODE5 0x0a /* Hardware triggered strobe */ +#define BCD 0x01 /* BCD counter */ + +/* DMA controller registers */ +#define DMA_STAT 8 /* DMA controller status register */ +#define DMA_CMD 8 /* DMA controller command register */ +#define DMA_MASK 10 /* DMA controller mask register */ +#define DMA_MODE 11 /* DMA controller mode register */ +#define DMA_RESETFF 12 /* DMA controller first/last flip flop */ +/* DMA data */ +#define DMA_DISABLE (0x04) /* Disable channel n */ +#define DMA_ENABLE (0x00) /* Enable channel n */ +/* Single transfers, incr. address, auto init, writes, ch. n */ +#define DMA_RX_MODE (0x54) +/* Single transfers, incr. address, no auto init, reads, ch. n */ +#define DMA_TX_MODE (0x48) + +/* Write registers */ +#define DMA_CFG 0x08 +#define SERIAL_CFG 0x09 +#define INT_CFG 0x09 /* shares with serial config */ +#define DMA_CLR_FF 0x0a + +#define SINGLE 3686400 +#define DOUBLE 7372800 +#define XTAL ((long) 6144000L) + +#define SIOCGPIPARAM 0x5000 /* get PI parameters */ +#define SIOCSPIPARAM 0x5001 /* set */ +#define SIOCGPIBAUD 0x5002 /* get only baud rate */ +#define SIOCSPIBAUD 0x5003 +#define SIOCGPIDMA 0x5004 /* get only DMA */ +#define SIOCSPIDMA 0x5005 +#define SIOCGPIIRQ 0x5006 /* get only IRQ */ +#define SIOCSPIIRQ 0x5007 + +struct pt_req +{ + int cmd; + int speed; + int clockmode; + int txdelay; + unsigned char persist; + int slotime; + int squeldelay; + int dmachan; + int irq; +}; + +/* SCC Interrupt vectors, if we have set 'status low' */ +#define CHBTxIV 0x00 +#define CHBEXTIV 0x02 +#define CHBRxIV 0x04 +#define CHBSRCIV 0x06 +#define CHATxIV 0x08 +#define CHAEXTIV 0x0a +#define CHARxIV 0x0c +#define CHASRCIV 0x0e + + +#ifdef __KERNEL__ + +/* Information that needs to be kept for each channel. */ +struct pt_local +{ + struct net_device_stats stats; /* %%%dp*/ + long open_time; /* Useless example local info. */ + unsigned long xtal; + + struct mbuf *rcvbuf;/* Buffer for current rx packet */ + struct mbuf *rxdmabuf1; /* DMA rx buffer */ + struct mbuf *rxdmabuf2; /* DMA rx buffer */ + + int bufsiz; /* Size of rcvbuf */ + char *rcp; /* Pointer into rcvbuf */ + struct sk_buff_head sndq; /* Packets awaiting transmission */ + int sndcnt; /* Number of packets on sndq */ + struct sk_buff *sndbuf; /* Current buffer being transmitted */ + char *txdmabuf; /* Transmit DMA buffer */ + char *txptr; /* Used by B port tx */ + int txcnt; + char tstate; /* Transmitter state */ +#define IDLE 0 /* Transmitter off, no data pending */ +#define ACTIVE 1 /* Transmitter on, sending data */ +#define UNDERRUN 2 /* Transmitter on, flushing CRC */ +#define FLAGOUT 3 /* CRC sent - attempt to start next frame */ +#define DEFER 4 /* Receive Active - DEFER Transmit */ +#define ST_TXDELAY 5 /* Sending leading flags */ +#define CRCOUT 6 + char rstate; /* Set when !DCD goes to 0 (TRUE) */ +/* Normal state is ACTIVE if Receive enabled */ +#define RXERROR 2 /* Error -- Aborting current Frame */ +#define RXABORT 3 /* ABORT sequence detected */ +#define TOOBIG 4 /* too large a frame to store */ + + int dev; /* Device number */ + int base; /* Base of I/O registers */ + int cardbase; /* Base address of card */ + int stata; /* address of Channel A status regs */ + int statb; /* address of Channel B status regs */ + int speed; /* Line speed, bps */ + int clockmode; /* tapr 9600 modem clocking option */ + int txdelay; /* Transmit Delay 10 ms/cnt */ + unsigned char persist; /* Persistence (0-255) as a % */ + int slotime; /* Delay to wait on persistence hit */ + int squeldelay; /* Delay after XMTR OFF for squelch tail */ + struct iface *iface; /* Associated interface */ + int dmachan; /* DMA channel for this port */ + char saved_RR0; /* The saved version of RR) that we compare with */ + int nrzi; /* Do we use NRZI (or NRZ) */ +}; + +#endif diff --git a/include/linux/reboot.h b/include/linux/reboot.h new file mode 100644 index 000000000..7dd531688 --- /dev/null +++ b/include/linux/reboot.h @@ -0,0 +1,51 @@ +#ifndef _LINUX_REBOOT_H +#define _LINUX_REBOOT_H + +/* + * Magic values required to use _reboot() system call. + */ + +#define LINUX_REBOOT_MAGIC1 0xfee1dead +#define LINUX_REBOOT_MAGIC2 672274793 +#define LINUX_REBOOT_MAGIC2A 85072278 + + +/* + * Commands accepted by the _reboot() system call. + * + * RESTART Restart system using default command and mode. + * HALT Stop OS and give system control to ROM monitor, if any. + * CAD_ON Ctrl-Alt-Del sequence causes RESTART command. + * CAD_OFF Ctrl-Alt-Del sequence sends SIGINT to init task. + * POWER_OFF Stop OS and remove all power from system, if possible. + * RESTART2 Restart system using given command string. + */ + +#define LINUX_REBOOT_CMD_RESTART 0x01234567 +#define LINUX_REBOOT_CMD_HALT 0xCDEF0123 +#define LINUX_REBOOT_CMD_CAD_ON 0x89ABCDEF +#define LINUX_REBOOT_CMD_CAD_OFF 0x00000000 +#define LINUX_REBOOT_CMD_POWER_OFF 0x4321FEDC +#define LINUX_REBOOT_CMD_RESTART2 0xA1B2C3D4 + + +#ifdef __KERNEL__ + +#include <linux/notifier.h> + +extern struct notifier_block *reboot_notifier_list; +extern int register_reboot_notifier(struct notifier_block *); +extern int unregister_reboot_notifier(struct notifier_block *); + + +/* + * Architecture-specific implementations of sys_reboot commands. + */ + +extern void machine_restart(char *cmd); +extern void machine_halt(void); +extern void machine_power_off(void); + +#endif + +#endif /* _LINUX_REBOOT_H */ diff --git a/include/linux/romfs_fs.h b/include/linux/romfs_fs.h new file mode 100644 index 000000000..844e22f99 --- /dev/null +++ b/include/linux/romfs_fs.h @@ -0,0 +1,62 @@ +#ifndef __LINUX_ROMFS_FS_H +#define __LINUX_ROMFS_FS_H + +/* The basic structures of the romfs filesystem */ + +#define ROMBSIZE BLOCK_SIZE +#define ROMBSBITS BLOCK_SIZE_BITS +#define ROMBMASK (ROMBSIZE-1) +#define ROMFS_MAGIC 0x7275 + +#define ROMFS_MAXFN 128 + +#define __mkw(h,l) (((h)&0x00ff)<< 8|((l)&0x00ff)) +#define __mkl(h,l) (((h)&0xffff)<<16|((l)&0xffff)) +#define __mk4(a,b,c,d) htonl(__mkl(__mkw(a,b),__mkw(c,d))) +#define ROMSB_WORD0 __mk4('-','r','o','m') +#define ROMSB_WORD1 __mk4('1','f','s','-') + +/* On-disk "super block" */ + +struct romfs_super_block { + __u32 word0; + __u32 word1; + __u32 size; + __u32 checksum; + char name[0]; /* volume name */ +}; + +/* On disk inode */ + +struct romfs_inode { + __u32 next; /* low 4 bits see ROMFH_ */ + __u32 spec; + __u32 size; + __u32 checksum; + char name[0]; +}; + +#define ROMFH_TYPE 7 +#define ROMFH_HRD 0 +#define ROMFH_DIR 1 +#define ROMFH_REG 2 +#define ROMFH_SYM 3 +#define ROMFH_BLK 4 +#define ROMFH_CHR 5 +#define ROMFH_SCK 6 +#define ROMFH_FIF 7 +#define ROMFH_EXEC 8 + +/* Alignment */ + +#define ROMFH_SIZE 16 +#define ROMFH_PAD (ROMFH_SIZE-1) +#define ROMFH_MASK (~ROMFH_PAD) + +#ifdef __KERNEL__ + +/* Not much now */ +extern int init_romfs_fs(void); + +#endif /* __KERNEL__ */ +#endif diff --git a/include/linux/romfs_fs_i.h b/include/linux/romfs_fs_i.h new file mode 100644 index 000000000..1ffe4b7da --- /dev/null +++ b/include/linux/romfs_fs_i.h @@ -0,0 +1,11 @@ +#ifndef __ROMFS_FS_I +#define __ROMFS_FS_I + +/* inode in-kernel data */ + +struct romfs_inode_info { + unsigned long i_metasize; /* size of non-data area */ + unsigned long i_dataoffset; /* from the start of fs */ +}; + +#endif diff --git a/include/linux/romfs_fs_sb.h b/include/linux/romfs_fs_sb.h new file mode 100644 index 000000000..02da2280a --- /dev/null +++ b/include/linux/romfs_fs_sb.h @@ -0,0 +1,10 @@ +#ifndef __ROMFS_FS_SB +#define __ROMFS_FS_SB + +/* romfs superblock in-core data */ + +struct romfs_sb_info { + unsigned long s_maxsize; +}; + +#endif diff --git a/include/linux/rose.h b/include/linux/rose.h index ca69e1e8b..c38788c7e 100644 --- a/include/linux/rose.h +++ b/include/linux/rose.h @@ -3,26 +3,27 @@ * For kernel AX.25 see the file ax25.h. This file requires ax25.h for the * definition of the ax25_address structure. */ - + #ifndef ROSE_KERNEL_H #define ROSE_KERNEL_H #define PF_ROSE AF_ROSE #define ROSE_MTU 128 -#define ROSE_T0 1 #define ROSE_T1 2 #define ROSE_T2 3 #define ROSE_T3 4 #define ROSE_IDLE 5 #define ROSE_HDRINCL 6 +#define ROSE_HOLDBACK 7 #define ROSE_KILL 99 -#define SIOCRSCTLCON (SIOCPROTOPRIVATE+0) +#define SIOCRSCTLCON (SIOCPROTOPRIVATE+1) +#define SIOCRSL2CALL (SIOCPROTOPRIVATE+2) typedef struct { - char rose_addr[5]; + char rose_addr[5]; } rose_address; struct sockaddr_rose { @@ -34,18 +35,19 @@ struct sockaddr_rose { }; struct rose_route_struct { - rose_address address; - ax25_address neighbour; - char device[16]; - unsigned char ndigis; - ax25_address digipeaters[AX25_MAX_DIGIS]; + rose_address address; + unsigned short mask; + ax25_address neighbour; + char device[16]; + unsigned char ndigis; + ax25_address digipeaters[AX25_MAX_DIGIS]; }; struct rose_ctl_struct { - unsigned int lci; - char dev[20]; - unsigned int cmd; - unsigned long arg; + unsigned int lci; + char dev[20]; + unsigned int cmd; + unsigned long arg; }; #endif diff --git a/include/linux/route.h b/include/linux/route.h index bf677b2e0..4432d1900 100644 --- a/include/linux/route.h +++ b/include/linux/route.h @@ -26,60 +26,172 @@ /* This structure gets passed by the SIOCADDRT and SIOCDELRT calls. */ struct rtentry { - unsigned long rt_hash; /* hash key for lookups */ + unsigned long rt_pad1; struct sockaddr rt_dst; /* target address */ struct sockaddr rt_gateway; /* gateway addr (RTF_GATEWAY) */ struct sockaddr rt_genmask; /* target network mask (IP) */ - short rt_flags; - short rt_refcnt; - unsigned long rt_use; - struct ifnet *rt_ifp; + unsigned short rt_flags; + short rt_pad2; + unsigned long rt_pad3; + unsigned char rt_tos; + unsigned char rt_class; + short rt_pad4; short rt_metric; /* +1 for binary compatibility! */ char *rt_dev; /* forcing the device at add */ - unsigned long rt_mss; /* per route MTU/Window */ + unsigned long rt_mtu; /* per route MTU/Window */ +#ifndef __KERNEL__ +#define rt_mss rt_mtu /* Compatibility :-( */ +#endif unsigned long rt_window; /* Window clamping */ unsigned short rt_irtt; /* Initial RTT */ + }; -#define RTF_UP 0x0001 /* route usable */ -#define RTF_GATEWAY 0x0002 /* destination is a gateway */ -#define RTF_HOST 0x0004 /* host entry (net otherwise) */ -#define RTF_REINSTATE 0x0008 /* reinstate route after tmout */ -#define RTF_DYNAMIC 0x0010 /* created dyn. (by redirect) */ -#define RTF_MODIFIED 0x0020 /* modified dyn. (by redirect) */ -#define RTF_MSS 0x0040 /* specific MSS for this route */ -#define RTF_WINDOW 0x0080 /* per route window clamping */ -#define RTF_IRTT 0x0100 /* Initial round trip time */ -#define RTF_REJECT 0x0200 /* Reject route */ +#define RTF_UP 0x0001 /* route usable */ +#define RTF_GATEWAY 0x0002 /* destination is a gateway */ -#define RTF_ADDRCONF 0x0800 /* announced on link prefix */ -#define RTF_INVALID 0x1000 -#define RTF_DCACHE 0x2000 -#define RTF_DEFAULT 0x4000 /* Route is a default route */ -#define RTF_NEXTHOP 0x8000 /* Non gateway route with nexthop */ +#define RTF_HOST 0x0004 /* host entry (net otherwise) */ +#define RTF_REINSTATE 0x0008 /* reinstate route after tmout */ +#define RTF_DYNAMIC 0x0010 /* created dyn. (by redirect) */ +#define RTF_MODIFIED 0x0020 /* modified dyn. (by redirect) */ +#define RTF_MTU 0x0040 /* specific MTU for this route */ +#define RTF_MSS RTF_MTU /* Compatibility :-( */ +#define RTF_WINDOW 0x0080 /* per route window clamping */ +#define RTF_IRTT 0x0100 /* Initial round trip time */ +#define RTF_REJECT 0x0200 /* Reject route */ +#define RTF_STATIC 0x0400 /* Manually injected route */ +#define RTF_XRESOLVE 0x0800 /* External resolver */ +#define RTF_NOFORWARD 0x1000 /* Forwarding inhibited */ +#define RTF_THROW 0x2000 /* Go to next class */ +#define RTF_NOPMTUDISC 0x4000 /* Do not send packets with DF */ +#define RTF_MAGIC 0x8000 /* Route added/deleted authomatically, + * when interface changes its state. + */ + +/* + * <linux/ipv6_route.h> uses RTF values >= 64k + */ + +#define RTCF_VALVE 0x00200000 +#define RTCF_MASQ 0x00400000 +#define RTCF_NAT 0x00800000 +#define RTCF_DOREDIRECT 0x01000000 +#define RTCF_LOG 0x02000000 +#define RTCF_DIRECTSRC 0x04000000 + +#define RTF_LOCAL 0x80000000 +#define RTF_INTERFACE 0x40000000 +#define RTF_MULTICAST 0x20000000 +#define RTF_BROADCAST 0x10000000 +#define RTF_NAT 0x08000000 + +#define RTF_ADDRCLASSMASK 0xF8000000 +#define RT_ADDRCLASS(flags) ((__u32)flags>>23) + +#define RT_TOS(tos) ((tos)&IPTOS_TOS_MASK) + +#define RT_LOCALADDR(flags) ((flags&RTF_ADDRCLASSMASK) == (RTF_LOCAL|RTF_INTERFACE)) + +#define RT_CLASS_UNSPEC 0 +#define RT_CLASS_DEFAULT 253 + +#define RT_CLASS_MAIN 254 +#define RT_CLASS_LOCAL 255 +#define RT_CLASS_MAX 255 + +#ifdef _LINUX_IN_H /* hack to check that in.h included */ /* * This structure is passed from the kernel to user space by netlink * routing/device announcements */ -struct netlink_rtinfo +struct in_rtmsg { - unsigned long rtmsg_type; - struct sockaddr rtmsg_dst; - struct sockaddr rtmsg_gateway; - struct sockaddr rtmsg_genmask; - short rtmsg_flags; + struct in_addr rtmsg_prefix; + struct in_addr rtmsg_gateway; + unsigned rtmsg_flags; + unsigned long rtmsg_mtu; + unsigned long rtmsg_window; + unsigned short rtmsg_rtt; short rtmsg_metric; - char rtmsg_device[16]; + unsigned char rtmsg_tos; + unsigned char rtmsg_class; + unsigned char rtmsg_prefixlen; + unsigned char rtmsg_reserved; + int rtmsg_ifindex; }; -#define RTMSG_NEWROUTE 0x01 -#define RTMSG_DELROUTE 0x02 + +struct in_ifmsg +{ + struct sockaddr ifmsg_lladdr; + struct in_addr ifmsg_prefix; + struct in_addr ifmsg_brd; + unsigned ifmsg_flags; + unsigned long ifmsg_mtu; + short ifmsg_metric; + unsigned char ifmsg_prefixlen; + unsigned char ifmsg_reserved; + int ifmsg_index; + char ifmsg_name[16]; +}; + +enum rtrule_actions +{ + RTP_GO, + RTP_NAT, + RTP_DROP, + RTP_UNREACHABLE, + RTP_PROHIBIT, + RTP_MASQUERADE +}; + +#define RTRF_LOG 1 /* Log route creations */ +#define RTRF_VALVE 2 /* One-way route */ + +struct in_rtrulemsg +{ + struct in_addr rtrmsg_src; + struct in_addr rtrmsg_dst; + struct in_addr rtrmsg_srcmap; + int rtrmsg_ifindex; + unsigned char rtrmsg_srclen; + unsigned char rtrmsg_dstlen; + unsigned char rtrmsg_tos; + unsigned char rtrmsg_class; + unsigned char rtrmsg_flags; + unsigned char rtrmsg_action; + unsigned char rtrmsg_preference; + unsigned char rtrmsg_rtmsgs; + struct in_rtmsg rtrmsg_rtmsg[1]; +}; + +struct in_rtctlmsg +{ + unsigned rtcmsg_flags; + int rtcmsg_delay; +}; + +#define RTCTL_ECHO 1 /* Echo route changes */ +#define RTCTL_FLUSH 2 /* Send flush updates */ +#define RTCTL_ACK 4 /* Send acks */ +#define RTCTL_DELAY 8 /* Set netlink delay */ +#define RTCTL_OWNER 0x10 /* Set netlink reader */ +#endif + +#define RTMSG_ACK NLMSG_ACK +#define RTMSG_OVERRUN NLMSG_OVERRUN + #define RTMSG_NEWDEVICE 0x11 #define RTMSG_DELDEVICE 0x12 +#define RTMSG_NEWROUTE 0x21 +#define RTMSG_DELROUTE 0x22 +#define RTMSG_NEWRULE 0x31 +#define RTMSG_DELRULE 0x32 +#define RTMSG_CONTROL 0x40 -#define RTMSG_AR_FAILED 0x21 /* Address Resolution failed */ +#define RTMSG_AR_FAILED 0x51 /* Address Resolution failed */ #endif /* _LINUX_ROUTE_H */ diff --git a/include/linux/rpcsock.h b/include/linux/rpcsock.h index 9a7f5eae9..80f1fc4c6 100644 --- a/include/linux/rpcsock.h +++ b/include/linux/rpcsock.h @@ -53,10 +53,10 @@ struct rpc_ioreq { struct rpc_wait * rq_slot; struct sockaddr * rq_addr; int rq_alen; - struct iovec rq_svec[UIO_MAXIOV]; + struct iovec rq_svec[UIO_FASTIOV]; unsigned int rq_snr; unsigned long rq_slen; - struct iovec rq_rvec[UIO_MAXIOV]; + struct iovec rq_rvec[UIO_FASTIOV]; unsigned int rq_rnr; unsigned long rq_rlen; }; diff --git a/include/linux/sc26198.h b/include/linux/sc26198.h new file mode 100644 index 000000000..255241c61 --- /dev/null +++ b/include/linux/sc26198.h @@ -0,0 +1,533 @@ +/*****************************************************************************/ + +/* + * sc26198.h -- SC26198 UART hardware info. + * + * Copyright (C) 1995-1997 Stallion Technologies (support@stallion.oz.au). + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*****************************************************************************/ +#ifndef _SC26198_H +#define _SC26198_H +/*****************************************************************************/ + +/* + * Define the number of async ports per sc26198 uart device. + */ +#define SC26198_PORTS 8 + +/* + * Baud rate timing clocks. All derived from a master 14.7456 MHz clock. + */ +#define SC26198_MASTERCLOCK 14745600L +#define SC26198_DCLK (SC26198_MASTERCLOCK) +#define SC26198_CCLK (SC26198_MASTERCLOCK / 2) +#define SC26198_BCLK (SC26198_MASTERCLOCK / 4) + +/* + * Define internal FIFO sizes for the 26198 ports. + */ +#define SC26198_TXFIFOSIZE 16 +#define SC26198_RXFIFOSIZE 16 + +/*****************************************************************************/ + +/* + * Global register definitions. These registers are global to each 26198 + * device, not specific ports on it. + */ +#define TSTR 0x0d +#define GCCR 0x0f +#define ICR 0x1b +#define WDTRCR 0x1d +#define IVR 0x1f +#define BRGTRUA 0x84 +#define GPOSR 0x87 +#define GPOC 0x8b +#define UCIR 0x8c +#define CIR 0x8c +#define BRGTRUB 0x8d +#define GRXFIFO 0x8e +#define GTXFIFO 0x8e +#define GCCR2 0x8f +#define BRGTRLA 0x94 +#define GPOR 0x97 +#define GPOD 0x9b +#define BRGTCR 0x9c +#define GICR 0x9c +#define BRGTRLB 0x9d +#define GIBCR 0x9d +#define GITR 0x9f + +/* + * Per port channel registers. These are the register offsets within + * the port address space, so need to have the port address (0 to 7) + * inserted in bit positions 4:6. + */ +#define MR0 0x00 +#define MR1 0x01 +#define IOPCR 0x02 +#define BCRBRK 0x03 +#define BCRCOS 0x04 +#define BCRX 0x06 +#define BCRA 0x07 +#define XONCR 0x08 +#define XOFFCR 0x09 +#define ARCR 0x0a +#define RXCSR 0x0c +#define TXCSR 0x0e +#define MR2 0x80 +#define SR 0x81 +#define SCCR 0x81 +#define ISR 0x82 +#define IMR 0x82 +#define TXFIFO 0x83 +#define RXFIFO 0x83 +#define IPR 0x84 +#define IOPIOR 0x85 +#define XISR 0x86 + +/* + * For any given port calculate the address to use to access a specified + * register. This is only used for unusual access, mostly this is done + * through the assembler access routines. + */ +#define SC26198_PORTREG(port,reg) ((((port) & 0x07) << 4) | (reg)) + +/*****************************************************************************/ + +/* + * Global configuration control register bit definitions. + */ +#define GCCR_NOACK 0x00 +#define GCCR_IVRACK 0x02 +#define GCCR_IVRCHANACK 0x04 +#define GCCR_IVRTYPCHANACK 0x06 +#define GCCR_ASYNCCYCLE 0x00 +#define GCCR_SYNCCYCLE 0x40 + +/*****************************************************************************/ + +/* + * Mode register 0 bit definitions. + */ +#define MR0_ADDRNONE 0x00 +#define MR0_AUTOWAKE 0x01 +#define MR0_AUTODOZE 0x02 +#define MR0_AUTOWAKEDOZE 0x03 +#define MR0_SWFNONE 0x00 +#define MR0_SWFTX 0x04 +#define MR0_SWFRX 0x08 +#define MR0_SWFRXTX 0x0c +#define MR0_TXMASK 0x30 +#define MR0_TXEMPTY 0x00 +#define MR0_TXHIGH 0x10 +#define MR0_TXHALF 0x20 +#define MR0_TXRDY 0x00 +#define MR0_ADDRNT 0x00 +#define MR0_ADDRT 0x40 +#define MR0_SWFNT 0x00 +#define MR0_SWFT 0x80 + +/* + * Mode register 1 bit definitions. + */ +#define MR1_CS5 0x00 +#define MR1_CS6 0x01 +#define MR1_CS7 0x02 +#define MR1_CS8 0x03 +#define MR1_PAREVEN 0x00 +#define MR1_PARODD 0x04 +#define MR1_PARENB 0x00 +#define MR1_PARFORCE 0x08 +#define MR1_PARNONE 0x10 +#define MR1_PARSPECIAL 0x18 +#define MR1_ERRCHAR 0x00 +#define MR1_ERRBLOCK 0x20 +#define MR1_ISRUNMASKED 0x00 +#define MR1_ISRMASKED 0x40 +#define MR1_AUTORTS 0x80 + +/* + * Mode register 2 bit definitions. + */ +#define MR2_STOP1 0x00 +#define MR2_STOP15 0x01 +#define MR2_STOP2 0x02 +#define MR2_STOP916 0x03 +#define MR2_RXFIFORDY 0x00 +#define MR2_RXFIFOHALF 0x04 +#define MR2_RXFIFOHIGH 0x08 +#define MR2_RXFIFOFULL 0x0c +#define MR2_AUTOCTS 0x10 +#define MR2_TXRTS 0x20 +#define MR2_MODENORM 0x00 +#define MR2_MODEAUTOECHO 0x40 +#define MR2_MODELOOP 0x80 +#define MR2_MODEREMECHO 0xc0 + +/*****************************************************************************/ + +/* + * Baud Rate Generator (BRG) selector values. + */ +#define BRG_50 0x00 +#define BRG_75 0x01 +#define BRG_150 0x02 +#define BRG_200 0x03 +#define BRG_300 0x04 +#define BRG_450 0x05 +#define BRG_600 0x06 +#define BRG_900 0x07 +#define BRG_1200 0x08 +#define BRG_1800 0x09 +#define BRG_2400 0x0a +#define BRG_3600 0x0b +#define BRG_4800 0x0c +#define BRG_7200 0x0d +#define BRG_9600 0x0e +#define BRG_14400 0x0f +#define BRG_19200 0x10 +#define BRG_28200 0x11 +#define BRG_38400 0x12 +#define BRG_57600 0x13 +#define BRG_115200 0x14 +#define BRG_230400 0x15 +#define BRG_GIN0 0x16 +#define BRG_GIN1 0x17 +#define BRG_CT0 0x18 +#define BRG_CT1 0x19 +#define BRG_RX2TX316 0x1b +#define BRG_RX2TX31 0x1c + +#define SC26198_MAXBAUD 921600 + +/*****************************************************************************/ + +/* + * Command register command definitions. + */ +#define CR_NULL 0x04 +#define CR_ADDRNORMAL 0x0c +#define CR_RXRESET 0x14 +#define CR_TXRESET 0x1c +#define CR_CLEARRXERR 0x24 +#define CR_BREAKRESET 0x2c +#define CR_TXSTARTBREAK 0x34 +#define CR_TXSTOPBREAK 0x3c +#define CR_RTSON 0x44 +#define CR_RTSOFF 0x4c +#define CR_ADDRINIT 0x5c +#define CR_RXERRBLOCK 0x6c +#define CR_TXSENDXON 0x84 +#define CR_TXSENDXOFF 0x8c +#define CR_GANGXONSET 0x94 +#define CR_GANGXOFFSET 0x9c +#define CR_GANGXONINIT 0xa4 +#define CR_GANGXOFFINIT 0xac +#define CR_HOSTXON 0xb4 +#define CR_HOSTXOFF 0xbc +#define CR_CANCELXOFF 0xc4 +#define CR_ADDRRESET 0xdc +#define CR_RESETALLPORTS 0xf4 +#define CR_RESETALL 0xfc + +#define CR_RXENABLE 0x01 +#define CR_TXENABLE 0x02 + +/*****************************************************************************/ + +/* + * Channel status register. + */ +#define SR_RXRDY 0x01 +#define SR_RXFULL 0x02 +#define SR_TXRDY 0x04 +#define SR_TXEMPTY 0x08 +#define SR_RXOVERRUN 0x10 +#define SR_RXPARITY 0x20 +#define SR_RXFRAMING 0x40 +#define SR_RXBREAK 0x80 + +#define SR_RXERRS (SR_RXPARITY | SR_RXFRAMING | SR_RXOVERRUN) + +/*****************************************************************************/ + +/* + * Interrupt status register and interrupt mask register bit definitions. + */ +#define IR_TXRDY 0x01 +#define IR_RXRDY 0x02 +#define IR_RXBREAK 0x04 +#define IR_XONXOFF 0x10 +#define IR_ADDRRECOG 0x20 +#define IR_RXWATCHDOG 0x40 +#define IR_IOPORT 0x80 + +/*****************************************************************************/ + +/* + * Interrupt vector register field definitions. + */ +#define IVR_CHANMASK 0x07 +#define IVR_TYPEMASK 0x18 +#define IVR_CONSTMASK 0xc0 + +#define IVR_RXDATA 0x10 +#define IVR_RXBADDATA 0x18 +#define IVR_TXDATA 0x08 +#define IVR_OTHER 0x00 + +/*****************************************************************************/ + +/* + * BRG timer control register bit definitions. + */ +#define BRGCTCR_DISABCLK0 0x00 +#define BRGCTCR_ENABCLK0 0x08 +#define BRGCTCR_DISABCLK1 0x00 +#define BRGCTCR_ENABCLK1 0x80 + +#define BRGCTCR_0SCLK16 0x00 +#define BRGCTCR_0SCLK32 0x01 +#define BRGCTCR_0SCLK64 0x02 +#define BRGCTCR_0SCLK128 0x03 +#define BRGCTCR_0X1 0x04 +#define BRGCTCR_0X12 0x05 +#define BRGCTCR_0IO1A 0x06 +#define BRGCTCR_0GIN0 0x07 + +#define BRGCTCR_1SCLK16 0x00 +#define BRGCTCR_1SCLK32 0x10 +#define BRGCTCR_1SCLK64 0x20 +#define BRGCTCR_1SCLK128 0x30 +#define BRGCTCR_1X1 0x40 +#define BRGCTCR_1X12 0x50 +#define BRGCTCR_1IO1B 0x60 +#define BRGCTCR_1GIN1 0x70 + +/*****************************************************************************/ + +/* + * Watch dog timer enable register. + */ +#define WDTRCR_ENABALL 0xff + +/*****************************************************************************/ + +/* + * XON/XOFF interrupt status register. + */ +#define XISR_TXCHARMASK 0x03 +#define XISR_TXCHARNORMAL 0x00 +#define XISR_TXWAIT 0x01 +#define XISR_TXXOFFPEND 0x02 +#define XISR_TXXONPEND 0x03 + +#define XISR_TXFLOWMASK 0x0c +#define XISR_TXNORMAL 0x00 +#define XISR_TXSTOPPEND 0x04 +#define XISR_TXSTARTED 0x08 +#define XISR_TXSTOPPED 0x0c + +#define XISR_RXFLOWMASK 0x30 +#define XISR_RXFLOWNONE 0x00 +#define XISR_RXXONSENT 0x10 +#define XISR_RXXOFFSENT 0x20 + +#define XISR_RXXONGOT 0x40 +#define XISR_RXXOFFGOT 0x80 + +/*****************************************************************************/ + +/* + * Current interrupt register. + */ +#define CIR_TYPEMASK 0xc0 +#define CIR_TYPEOTHER 0x00 +#define CIR_TYPETX 0x40 +#define CIR_TYPERXGOOD 0x80 +#define CIR_TYPERXBAD 0xc0 + +#define CIR_RXDATA 0x80 +#define CIR_RXBADDATA 0x40 +#define CIR_TXDATA 0x40 + +#define CIR_CHANMASK 0x07 +#define CIR_CNTMASK 0x38 + +#define CIR_SUBTYPEMASK 0x38 +#define CIR_SUBNONE 0x00 +#define CIR_SUBCOS 0x08 +#define CIR_SUBADDR 0x10 +#define CIR_SUBXONXOFF 0x18 +#define CIR_SUBBREAK 0x28 + +/*****************************************************************************/ + +/* + * Global interrupting channel register. + */ +#define GICR_CHANMASK 0x07 + +/*****************************************************************************/ + +/* + * Global interrupting byte count register. + */ +#define GICR_COUNTMASK 0x0f + +/*****************************************************************************/ + +/* + * Global interrupting type register. + */ +#define GITR_RXMASK 0xc0 +#define GITR_RXNONE 0x00 +#define GITR_RXBADDATA 0x80 +#define GITR_RXGOODDATA 0xc0 +#define GITR_TXDATA 0x20 + +#define GITR_SUBTYPEMASK 0x07 +#define GITR_SUBNONE 0x00 +#define GITR_SUBCOS 0x01 +#define GITR_SUBADDR 0x02 +#define GITR_SUBXONXOFF 0x03 +#define GITR_SUBBREAK 0x05 + +/*****************************************************************************/ + +/* + * Input port change register. + */ +#define IPR_CTS 0x01 +#define IPR_DTR 0x02 +#define IPR_RTS 0x04 +#define IPR_DCD 0x08 +#define IPR_CTSCHANGE 0x10 +#define IPR_DTRCHANGE 0x20 +#define IPR_RTSCHANGE 0x40 +#define IPR_DCDCHANGE 0x80 + +#define IPR_CHANGEMASK 0xf0 + +/*****************************************************************************/ + +/* + * IO port interrupt and output register. + */ +#define IOPR_CTS 0x01 +#define IOPR_DTR 0x02 +#define IOPR_RTS 0x04 +#define IOPR_DCD 0x08 +#define IOPR_CTSCOS 0x10 +#define IOPR_DTRCOS 0x20 +#define IOPR_RTSCOS 0x40 +#define IOPR_DCDCOS 0x80 + +/*****************************************************************************/ + +/* + * IO port configuration register. + */ +#define IOPCR_SETCTS 0x00 +#define IOPCR_SETDTR 0x04 +#define IOPCR_SETRTS 0x10 +#define IOPCR_SETDCD 0x00 + +#define IOPCR_SETSIGS (IOPCR_SETRTS | IOPCR_SETRTS | IOPCR_SETDTR | IOPCR_SETDCD) + +/*****************************************************************************/ + +/* + * General purpose output select register. + */ +#define GPORS_TXC1XA 0x08 +#define GPORS_TXC16XA 0x09 +#define GPORS_RXC16XA 0x0a +#define GPORS_TXC16XB 0x0b +#define GPORS_GPOR3 0x0c +#define GPORS_GPOR2 0x0d +#define GPORS_GPOR1 0x0e +#define GPORS_GPOR0 0x0f + +/*****************************************************************************/ + +/* + * General purpose output register. + */ +#define GPOR_0 0x01 +#define GPOR_1 0x02 +#define GPOR_2 0x04 +#define GPOR_3 0x08 + +/*****************************************************************************/ + +/* + * General purpose output clock register. + */ +#define GPORC_0NONE 0x00 +#define GPORC_0GIN0 0x01 +#define GPORC_0GIN1 0x02 +#define GPORC_0IO3A 0x02 + +#define GPORC_1NONE 0x00 +#define GPORC_1GIN0 0x04 +#define GPORC_1GIN1 0x08 +#define GPORC_1IO3C 0x0c + +#define GPORC_2NONE 0x00 +#define GPORC_2GIN0 0x10 +#define GPORC_2GIN1 0x20 +#define GPORC_2IO3E 0x20 + +#define GPORC_3NONE 0x00 +#define GPORC_3GIN0 0x40 +#define GPORC_3GIN1 0x80 +#define GPORC_3IO3G 0xc0 + +/*****************************************************************************/ + +/* + * General purpose output data register. + */ +#define GPOD_0MASK 0x03 +#define GPOD_0SET1 0x00 +#define GPOD_0SET0 0x01 +#define GPOD_0SETR0 0x02 +#define GPOD_0SETIO3B 0x03 + +#define GPOD_1MASK 0x0c +#define GPOD_1SET1 0x00 +#define GPOD_1SET0 0x04 +#define GPOD_1SETR0 0x08 +#define GPOD_1SETIO3D 0x0c + +#define GPOD_2MASK 0x30 +#define GPOD_2SET1 0x00 +#define GPOD_2SET0 0x10 +#define GPOD_2SETR0 0x20 +#define GPOD_2SETIO3F 0x30 + +#define GPOD_3MASK 0xc0 +#define GPOD_3SET1 0x00 +#define GPOD_3SET0 0x40 +#define GPOD_3SETR0 0x80 +#define GPOD_3SETIO3H 0xc0 + +/*****************************************************************************/ +#endif diff --git a/include/linux/scc.h b/include/linux/scc.h index 330143da4..275cbbb77 100644 --- a/include/linux/scc.h +++ b/include/linux/scc.h @@ -1,4 +1,4 @@ -/* $Id: scc.h,v 1.28 1996/10/30 20:01:15 jreuter Exp jreuter $ */ +/* $Id: scc.h,v 1.29 1997/04/02 14:56:45 jreuter Exp jreuter $ */ #ifndef _SCC_H #define _SCC_H @@ -14,55 +14,56 @@ /* DEV ioctl() commands */ -#define SIOCSCCRESERVED (SIOCDEVPRIVATE+0) -#define SIOCSCCCFG (SIOCDEVPRIVATE+1) -#define SIOCSCCINI (SIOCDEVPRIVATE+2) -#define SIOCSCCCHANINI (SIOCDEVPRIVATE+3) -#define SIOCSCCSMEM (SIOCDEVPRIVATE+4) -#define SIOCSCCGKISS (SIOCDEVPRIVATE+5) -#define SIOCSCCSKISS (SIOCDEVPRIVATE+6) -#define SIOCSCCGSTAT (SIOCDEVPRIVATE+7) +enum SCC_ioctl_cmds { + SIOCSCCRESERVED = SIOCDEVPRIVATE, + SIOCSCCCFG, + SIOCSCCINI, + SIOCSCCCHANINI, + SIOCSCCSMEM, + SIOCSCCGKISS, + SIOCSCCSKISS, + SIOCSCCGSTAT, + SIOCSCCCAL +}; /* magic number */ #define SCC_MAGIC 0x8530 /* ;-) */ -/* KISS state machine */ - -#define KISS_IDLE 0 -#define KISS_DATA 1 -#define KISS_ESCAPE 2 -#define KISS_RXFRAME 3 - /* Device parameter control (from WAMPES) */ -#define PARAM_TXDELAY 1 -#define PARAM_PERSIST 2 -#define PARAM_SLOTTIME 3 -#define PARAM_TXTAIL 4 -#define PARAM_FULLDUP 5 -#define PARAM_SOFTDCD 6 /* was: PARAM_HW */ -#define PARAM_MUTE 7 /* ??? */ -#define PARAM_DTR 8 -#define PARAM_RTS 9 -#define PARAM_SPEED 10 -#define PARAM_ENDDELAY 11 /* ??? */ -#define PARAM_GROUP 12 -#define PARAM_IDLE 13 -#define PARAM_MIN 14 -#define PARAM_MAXKEY 15 -#define PARAM_WAIT 16 -#define PARAM_MAXDEFER 17 -#define PARAM_TX 18 -#define PARAM_HWEVENT 31 -#define PARAM_RETURN 255 /* reset kiss mode */ +enum L1_params { + PARAM_DATA, + PARAM_TXDELAY, + PARAM_PERSIST, + PARAM_SLOTTIME, + PARAM_TXTAIL, + PARAM_FULLDUP, + PARAM_SOFTDCD, /* was: PARAM_HW */ + PARAM_MUTE, /* ??? */ + PARAM_DTR, + PARAM_RTS, + PARAM_SPEED, + PARAM_ENDDELAY, /* ??? */ + PARAM_GROUP, + PARAM_IDLE, + PARAM_MIN, + PARAM_MAXKEY, + PARAM_WAIT, + PARAM_MAXDEFER, + PARAM_TX, + PARAM_HWEVENT = 31, + PARAM_RETURN = 255 /* reset kiss mode */ +}; /* fulldup parameter */ -#define KISS_DUPLEX_HALF 0 /* normal CSMA operation */ -#define KISS_DUPLEX_FULL 1 /* fullduplex, key down trx after transmission */ -#define KISS_DUPLEX_LINK 2 /* fullduplex, key down trx after 'idletime' sec */ -#define KISS_DUPLEX_OPTIMA 3 /* fullduplex, let the protocol layer control the hw */ +enum FULLDUP_modes { + KISS_DUPLEX_HALF, /* normal CSMA operation */ + KISS_DUPLEX_FULL, /* fullduplex, key down trx after transmission */ + KISS_DUPLEX_LINK, /* fullduplex, key down trx after 'idletime' sec */ + KISS_DUPLEX_OPTIMA /* fullduplex, let the protocol layer control the hw */ +}; /* misc. parameters */ @@ -71,9 +72,11 @@ /* HWEVENT parameter */ -#define HWEV_DCD_ON 0 -#define HWEV_DCD_OFF 1 -#define HWEV_ALL_SENT 2 +enum HWEVENT_opts { + HWEV_DCD_ON, + HWEV_DCD_OFF, + HWEV_ALL_SENT +}; /* channel grouping */ @@ -82,20 +85,26 @@ /* Tx/Rx clock sources */ -#define CLK_DPLL 0 /* normal halfduplex operation */ -#define CLK_EXTERNAL 1 /* external clocking (G3RUH/DF9IC modems) */ -#define CLK_DIVIDER 2 /* Rx = DPLL, Tx = divider (fullduplex with */ - /* modems without clock regeneration */ +enum CLOCK_sources { + CLK_DPLL, /* normal halfduplex operation */ + CLK_EXTERNAL, /* external clocking (G3RUH/DF9IC modems) */ + CLK_DIVIDER, /* Rx = DPLL, Tx = divider (fullduplex with */ + /* modems without clock regeneration */ + CLK_BRG /* experimental fullduplex mode with DPLL/BRG for */ + /* MODEMs without clock recovery */ +}; /* Tx state */ -#define TXS_IDLE 0 /* Transmitter off, no data pending */ -#define TXS_BUSY 1 /* waiting for permission to send / tailtime */ -#define TXS_ACTIVE 2 /* Transmitter on, sending data */ -#define TXS_NEWFRAME 3 /* reset CRC and send (next) frame */ -#define TXS_IDLE2 4 /* Transmitter on, no data pending */ -#define TXS_WAIT 5 /* Waiting for Mintime to expire */ -#define TXS_TIMEOUT 6 /* We had a transmission timeout */ +enum TX_state { + TXS_IDLE, /* Transmitter off, no data pending */ + TXS_BUSY, /* waiting for permission to send / tailtime */ + TXS_ACTIVE, /* Transmitter on, sending data */ + TXS_NEWFRAME, /* reset CRC and send (next) frame */ + TXS_IDLE2, /* Transmitter on, no data pending */ + TXS_WAIT, /* Waiting for Mintime to expire */ + TXS_TIMEOUT /* We had a transmission timeout */ +}; typedef unsigned long io_port; /* type definition for an 'io port address' */ @@ -123,7 +132,6 @@ struct scc_stat { unsigned int bufsize; /* used buffersize */ }; - struct scc_modem { long speed; /* Line speed, bps */ char clocksrc; /* 0 = DPLL, 1 = external, 2 = divider */ @@ -159,11 +167,14 @@ struct scc_mem_config { unsigned int bufsize; }; +struct scc_calibrate { + unsigned int time; + unsigned char pattern; +}; #ifdef __KERNEL__ -#define TX_ON 1 /* command for scc_key_trx() */ -#define TX_OFF 0 /* dto */ +enum {TX_OFF, TX_ON}; /* command for scc_key_trx() */ /* Vector masks in RR2B */ @@ -173,7 +184,6 @@ struct scc_mem_config { #define RXINT 0x04 #define SPINT 0x06 - #ifdef SCC_DELAY #define Inb(port) inb_p(port) #define Outb(port, val) outb_p(val, port) @@ -210,7 +220,7 @@ struct scc_channel { int init; /* channel exists? */ struct device *dev; /* link to device control structure */ - struct enet_statistics dev_stat;/* device statistics */ + struct net_device_stats dev_stat;/* device statistics */ char brand; /* manufacturer of the board */ long clock; /* used clock */ diff --git a/include/linux/sched.h b/include/linux/sched.h index 3cff32ca0..c8ec07ab4 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -104,6 +104,17 @@ struct sched_param { #ifdef __KERNEL__ +#include <asm/spinlock.h> + +/* + * This serializes "schedule()" and also protects + * the run-queue from deletions/modifications (but + * _adding_ to the beginning of the run-queue has + * a separate lock). + */ +extern rwlock_t tasklist_lock; +extern spinlock_t scheduler_lock; + extern void sched_init(void); extern void show_state(void); extern void trap_init(void); @@ -127,7 +138,7 @@ struct files_struct { struct fs_struct { int count; - unsigned short umask; + int umask; struct inode * root, * pwd; }; @@ -163,13 +174,16 @@ struct mm_struct { &init_mmap, &init_mmap, MUTEX } struct signal_struct { - int count; - struct sigaction action[32]; + atomic_t count; + struct sigaction action[32]; + spinlock_t siglock; }; + #define INIT_SIGNALS { \ - 1, \ - { {0,}, } } + ATOMIC_INIT(1), \ + { {0,}, }, \ + SPIN_LOCK_UNLOCKED } struct task_struct { /* these are hardcoded - don't touch */ @@ -245,11 +259,12 @@ struct task_struct { struct mm_struct *mm; /* signal handlers */ struct signal_struct *sig; -#ifdef __SMP__ +/* SMP state */ int processor; int last_processor; int lock_depth; /* Lock depth. We can context switch in and out of holding a syscall kernel lock... */ -#endif + /* Spinlocks for various pieces or per-task state. */ + spinlock_t sigmask_lock; /* Protects signal and blocked */ }; /* @@ -269,6 +284,7 @@ struct task_struct { #define PF_USEDFPU 0x00100000 /* Process used the FPU this quantum (SMP only) */ #define PF_DTRACE 0x00200000 /* delayed trace (used on m68k) */ +#define PF_ONSIGSTK 0x00400000 /* works on signal stack (m68k only) */ /* * Limit the stack by to some sane default: root can always @@ -310,22 +326,16 @@ struct task_struct { /* files */ &init_files, \ /* mm */ &init_mm, \ /* signals */ &init_signals, \ +/* SMP */ 0,0,0, \ } extern struct mm_struct init_mm; extern struct task_struct init_task; extern struct task_struct *task[NR_TASKS]; extern struct task_struct *last_task_used_math; -extern struct task_struct *current_set[NR_CPUS]; -/* - * On a single processor system this comes out as current_set[0] when cpp - * has finished with it, which gcc will optimise away. - * Ralf: It won't. On MIPS something like - * la reg,current_set - * lw reg,(reg) - * will be generated which is one cycle to much. FIXME somewhen laaater. - */ -#define current (current_set[smp_processor_id()]) /* Current on this processor */ + +#include <asm/current.h> + extern unsigned long volatile jiffies; extern unsigned long itimer_ticks; extern unsigned long itimer_next; @@ -374,7 +384,7 @@ extern inline int suser(void) return 0; } -extern void copy_thread(int, unsigned long, unsigned long, struct task_struct *, struct pt_regs *); +extern int copy_thread(int, unsigned long, unsigned long, struct task_struct *, struct pt_regs *); extern void flush_thread(void); extern void exit_thread(void); @@ -382,12 +392,10 @@ extern void exit_mm(struct task_struct *); extern void exit_fs(struct task_struct *); extern void exit_files(struct task_struct *); extern void exit_sighand(struct task_struct *); -extern void release_thread(struct task_struct *); extern int do_execve(char *, char **, char **, struct pt_regs *); extern int do_fork(unsigned long, unsigned long, struct pt_regs *); - /* See if we have a valid user level fd. * If it makes sense, return the file structure it references. * Otherwise return NULL. @@ -417,14 +425,15 @@ extern inline void __add_wait_queue(struct wait_queue ** p, struct wait_queue * wait->next = next; } +extern spinlock_t waitqueue_lock; + extern inline void add_wait_queue(struct wait_queue ** p, struct wait_queue * wait) { unsigned long flags; - save_flags(flags); - cli(); + spin_lock_irqsave(&waitqueue_lock, flags); __add_wait_queue(p, wait); - restore_flags(flags); + spin_unlock_irqrestore(&waitqueue_lock, flags); } extern inline void __remove_wait_queue(struct wait_queue ** p, struct wait_queue * wait) @@ -445,19 +454,18 @@ extern inline void remove_wait_queue(struct wait_queue ** p, struct wait_queue * { unsigned long flags; - save_flags(flags); - cli(); + spin_lock_irqsave(&waitqueue_lock, flags); __remove_wait_queue(p, wait); - restore_flags(flags); + spin_unlock_irqrestore(&waitqueue_lock, flags); } -extern inline void select_wait(struct wait_queue ** wait_address, select_table * p) +extern inline void poll_wait(struct wait_queue ** wait_address, poll_table * p) { - struct select_table_entry * entry; + struct poll_table_entry * entry; if (!p || !wait_address) return; - if (p->nr >= __MAX_SELECT_TABLE_ENTRIES) + if (p->nr >= __MAX_POLL_TABLE_ENTRIES) return; entry = p->entry + p->nr; entry->wait_address = wait_address; @@ -468,10 +476,10 @@ extern inline void select_wait(struct wait_queue ** wait_address, select_table * } #define REMOVE_LINKS(p) do { unsigned long flags; \ - save_flags(flags) ; cli(); \ + write_lock_irqsave(&tasklist_lock, flags); \ (p)->next_task->prev_task = (p)->prev_task; \ (p)->prev_task->next_task = (p)->next_task; \ - restore_flags(flags); \ + write_unlock_irqrestore(&tasklist_lock, flags); \ if ((p)->p_osptr) \ (p)->p_osptr->p_ysptr = (p)->p_ysptr; \ if ((p)->p_ysptr) \ @@ -481,12 +489,12 @@ extern inline void select_wait(struct wait_queue ** wait_address, select_table * } while (0) #define SET_LINKS(p) do { unsigned long flags; \ - save_flags(flags); cli(); \ + write_lock_irqsave(&tasklist_lock, flags); \ (p)->next_task = &init_task; \ (p)->prev_task = init_task.prev_task; \ init_task.prev_task->next_task = (p); \ init_task.prev_task = (p); \ - restore_flags(flags); \ + write_unlock_irqrestore(&tasklist_lock, flags); \ (p)->p_ysptr = NULL; \ if (((p)->p_osptr = (p)->p_pptr->p_cptr) != NULL) \ (p)->p_osptr->p_ysptr = p; \ diff --git a/include/linux/sdla_fr.h b/include/linux/sdla_fr.h new file mode 100644 index 000000000..bcca8d58d --- /dev/null +++ b/include/linux/sdla_fr.h @@ -0,0 +1,416 @@ +/***************************************************************************** +* sdla_fr.h Sangoma frame relay firmware API definitions. +* +* Author: Gene Kozin <74604.152@compuserve.com> +* +* Copyright: (c) 1995-1996 Sangoma Technologies Inc. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version +* 2 of the License, or (at your option) any later version. +* ============================================================================ +* Dec 23, 1996 Gene Kozin v2.0 +* Apr 29, 1996 Gene Kozin v1.0 (merged version S502 & S508 definitions). +* Sep 26, 1995 Gene Kozin Initial version. +*****************************************************************************/ +#ifndef _SDLA_FR_H +#define _SDLA_FR_H + +/*---------------------------------------------------------------------------- + * Notes: + * ------ + * 1. All structures defined in this file are byte-alined. To ensure + * portability of this code between different platforms and compilers, one + * of the following defines must be defined before including this file: + * + * Compiler Platform Define Use option + * -------- -------- ------ ---------- + * GNU C Linux _GNUC_ - + * Microsoft C DOS/Windows _MSC_ - + */ + +#ifdef _GNUC_ +# ifndef PACKED +# define PACKED __attribute__((packed)) +# endif /* PACKED */ +#else +# define PACKED +#endif +#ifdef _MSC_ +# pragma pack(1) +#endif + +/* Adapter memory layout */ +#define FR_MB_VECTOR 0xE000 /* mailbox window vector */ +#define FR502_RX_VECTOR 0xA000 /* S502 direct receive window vector */ +#define FR502_MBOX_OFFS 0xF60 /* S502 mailbox offset */ +#define FR508_MBOX_OFFS 0 /* S508 mailbox offset */ +#define FR502_FLAG_OFFS 0x1FF0 /* S502 status flags offset */ +#define FR508_FLAG_OFFS 0x1000 /* S508 status flags offset */ +#define FR502_RXMB_OFFS 0x900 /* S502 direct receive mailbox offset */ +#define FR508_TXBC_OFFS 0x1100 /* S508 Tx buffer info offset */ +#define FR508_RXBC_OFFS 0x1120 /* S508 Rx buffer info offset */ + +/* Important constants */ +#define FR502_MAX_DATA 4096 /* maximum data buffer length */ +#define FR508_MAX_DATA 4080 /* maximum data buffer length */ + +/****** Data Structures *****************************************************/ + +/*---------------------------------------------------------------------------- + * Frame relay command block. + */ +typedef struct fr_cmd +{ + unsigned char command PACKED; /* command code */ + unsigned short length PACKED; /* length of data buffer */ + unsigned char result PACKED; /* return code */ + unsigned short dlci PACKED; /* DLCI number */ + unsigned char attr PACKED; /* FECN, BECN, DE and C/R bits */ + unsigned short rxlost1 PACKED; /* frames discarded at int. level */ + unsigned long rxlost2 PACKED; /* frames discarded at app. level */ + unsigned char rsrv[2] PACKED; /* reserved for future use */ +} fr_cmd_t; + +/* 'command' field defines */ +#define FR_WRITE 0x01 +#define FR_READ 0x02 +#define FR_ISSUE_IS_FRAME 0x03 +#define FR_SET_CONFIG 0x10 +#define FR_READ_CONFIG 0x11 +#define FR_COMM_DISABLE 0x12 +#define FR_COMM_ENABLE 0x13 +#define FR_READ_STATUS 0x14 +#define FR_READ_STATISTICS 0x15 +#define FR_FLUSH_STATISTICS 0x16 +#define FR_LIST_ACTIVE_DLCI 0x17 +#define FR_FLUSH_DATA_BUFFERS 0x18 +#define FR_ADD_DLCI 0x20 +#define FR_DELETE_DLCI 0x21 +#define FR_ACTIVATE_DLCI 0x22 +#define FR_DEACTIVATE_DLCI 0x22 +#define FR_READ_MODEM_STATUS 0x30 +#define FR_SET_MODEM_STATUS 0x31 +#define FR_READ_ERROR_STATS 0x32 +#define FR_FLUSH_ERROR_STATS 0x33 +#define FR_READ_CODE_VERSION 0x40 +#define FR_SET_INTR_MODE 0x50 +#define FR_READ_INTR_MODE 0x51 + +/* 'result' field defines */ +#define FRRES_OK 0x00 /* command executed successfully */ +#define FRRES_DISABLED 0x01 /* communications not enabled */ +#define FRRES_INOPERATIVE 0x02 /* channel inoperative */ +#define FRRES_DLCI_INACTIVE 0x03 /* DLCI is inactive */ +#define FRRES_DLCI_INVALID 0x04 /* DLCI is not configured */ +#define FRRES_TOO_LONG 0x04 +#define FRRES_TOO_MANY 0x05 +#define FRRES_CIR_OVERFLOW 0x07 /* Tx throughput has exceeded CIR */ +#define FRRES_BUFFER_OVERFLOW 0x08 +#define FRRES_MODEM_FAILURE 0x10 /* DCD and/or CTS dropped */ +#define FRRES_CHANNEL_DOWN 0x11 /* channel became inoperative */ +#define FRRES_CHANNEL_UP 0x12 /* channel became operative */ +#define FRRES_DLCI_CHANGE 0x13 /* DLCI status (or number) changed */ +#define FRRES_DLCI_MISMATCH 0x14 +#define FRRES_INVALID_CMD 0x1F /* invalid command */ + +/* 'attr' field defines */ +#define FRATTR_ + +/*---------------------------------------------------------------------------- + * Frame relay mailbox. + * This structure is located at offset FR50?_MBOX_OFFS into FR_MB_VECTOR. + * For S502 it is also located at offset FR502_RXMB_OFFS into + * FR502_RX_VECTOR. + */ +typedef struct fr_mbox +{ + unsigned char opflag PACKED; /* 00h: execution flag */ + fr_cmd_t cmd PACKED; /* 01h: command block */ + unsigned char data[1] PACKED; /* 10h: variable length data buffer */ +} fr_mbox_t; + +/*---------------------------------------------------------------------------- + * S502 frame relay status flags. + * This structure is located at offset FR502_FLAG_OFFS into FR_MB_VECTOR. + */ +typedef struct fr502_flags +{ + unsigned char rsrv1[1] PACKED; /* 00h: */ + unsigned char tx_ready PACKED; /* 01h: Tx buffer available */ + unsigned char rx_ready PACKED; /* 02h: Rx frame available */ + unsigned char event PACKED; /* 03h: asynchronous event */ + unsigned char mstatus PACKED; /* 04h: modem status */ + unsigned char rsrv2[8] PACKED; /* 05h: */ + unsigned char iflag PACKED; /* 0Dh: interrupt flag */ + unsigned char imask PACKED; /* 0Eh: interrupt mask */ +} fr502_flags_t; + +/*---------------------------------------------------------------------------- + * S508 frame relay status flags. + * This structure is located at offset FR508_FLAG_OFFS into FR_MB_VECTOR. + */ +typedef struct fr508_flags +{ + unsigned char rsrv1[3] PACKED; /* 00h: reserved */ + unsigned char event PACKED; /* 03h: asynchronous event */ + unsigned char mstatus PACKED; /* 04h: modem status */ + unsigned char rsrv2[11] PACKED; /* 05h: reserved */ + unsigned char iflag PACKED; /* 10h: interrupt flag */ + unsigned char imask PACKED; /* 11h: interrupt mask */ + unsigned long tse_offs PACKED; /* 12h: Tx status element */ +} fr508_flags_t; + +/* 'event' field defines */ +#define FR_EVENT_STATUS 0x01 /* channel status change ??? */ +#define FR_EVENT_DLC_STATUS 0x02 /* DLC status change */ +#define FR_EVENT_BAD_DLCI 0x04 /* FSR included wrong DLCI */ +#define FR_EVENT_LINK_DOWN 0x40 /* DCD or CTS low */ + +/* 'mstatus' field defines */ +#define FR_MDM_DCD 0x08 /* mdm_status: DCD */ +#define FR_MDM_CTS 0x20 /* mdm_status: CTS */ + +/* 'iflag' & 'imask' fields defines */ +#define FR_INTR_RXRDY 0x01 /* Rx ready */ +#define FR_INTR_TXRDY 0x02 /* Tx ready */ +#define FR_INTR_MODEM 0x04 /* modem status change (DCD, CTS) */ +#define FR_INTR_READY 0x08 /* interface command completed */ +#define FR_INTR_DLC 0x10 /* DLC status change */ +#define FR_INTR_TIMER 0x20 /* millisecond timer */ + +/*---------------------------------------------------------------------------- + * Receive Buffer Configuration Info. S508 only! + * This structure is located at offset FR508_RXBC_OFFS into FR_MB_VECTOR. + */ +typedef struct fr_buf_info +{ + unsigned short rse_num PACKED; /* 00h: number of status elements */ + unsigned long rse_base PACKED; /* 02h: receive status array base */ + unsigned long rse_next PACKED; /* 06h: next status element */ + unsigned long buf_base PACKED; /* 0Ah: rotational buffer base */ + unsigned short reserved PACKED; /* 0Eh: */ + unsigned long buf_top PACKED; /* 10h: rotational buffer top */ +} fr_buf_info_t; + +/*---------------------------------------------------------------------------- + * Buffer Status Element. S508 only! + * Array of structures of this type is located at offset defined by the + * 'rse_base' field of the frBufInfo_t structure into absolute adapter + * memory address space. + */ +typedef struct fr_buf_ctl +{ + unsigned char flag PACKED; /* 00h: ready flag */ + unsigned short length PACKED; /* 01h: frame length */ + unsigned short dlci PACKED; /* 03h: DLCI */ + unsigned char attr PACKED; /* 05h: FECN/BECN/DE/CR */ + unsigned short tmstamp PACKED; /* 06h: time stamp */ + unsigned short rsrv[2] PACKED; /* 08h: */ + unsigned long offset PACKED; /* 0Ch: buffer absolute address */ +} fr_buf_ctl_t; + +/*---------------------------------------------------------------------------- + * Global Configuration Block. Passed to FR_SET_CONFIG command when dlci == 0. + */ +typedef struct fr_conf +{ + unsigned short station PACKED; /* 00h: CPE/Node */ + unsigned short options PACKED; /* 02h: configuration options */ + unsigned short kbps PACKED; /* 04h: baud rate in kbps */ + unsigned short port PACKED; /* 06h: RS-232/V.35 */ + unsigned short mtu PACKED; /* 08h: max. transmit length */ + unsigned short t391 PACKED; /* 0Ah: */ + unsigned short t392 PACKED; /* 0Ch: */ + unsigned short n391 PACKED; /* 0Eh: */ + unsigned short n392 PACKED; /* 10h: */ + unsigned short n393 PACKED; /* 12h: */ + unsigned short cir_fwd PACKED; /* 14h: */ + unsigned short bc_fwd PACKED; /* 16h: */ + unsigned short be_fwd PACKED; /* 18h: */ + unsigned short cir_bwd PACKED; /* 1Ah: */ + unsigned short bc_bwd PACKED; /* 1Ch: */ + unsigned short be_bwd PACKED; /* 1Eh: */ + unsigned short dlci[0] PACKED; /* 20h: */ +} fr_conf_t; + +/* 'station_type' defines */ +#define FRCFG_STATION_CPE 0 +#define FRCFG_STATION_NODE 1 + +/* 'conf_flags' defines */ +#define FRCFG_IGNORE_TX_CIR 0x0001 +#define FRCFG_IGNORE_RX_CIR 0x0002 +#define FRCFG_DONT_RETRANSMIT 0x0004 +#define FRCFG_IGNORE_CBS 0x0008 +#define FRCFG_THROUGHPUT 0x0010 /* enable throughput calculation */ +#define FRCFG_DIRECT_RX 0x0080 /* enable direct receive buffer */ +#define FRCFG_AUTO_CONFIG 0x8000 /* enable auto DLCI configuration */ + +/* 'baud_rate' defines */ +#define FRCFG_BAUD_1200 12 +#define FRCFG_BAUD_2400 24 +#define FRCFG_BAUD_4800 48 +#define FRCFG_BAUD_9600 96 +#define FRCFG_BAUD_19200 19 +#define FRCFG_BAUD_38400 38 +#define FRCFG_BAUD_56000 56 +#define FRCFG_BAUD_64000 64 +#define FRCFG_BAUD_128000 128 + +/* 'port_mode' defines */ +#define FRCFG_MODE_EXT_CLK 0x0000 +#define FRCFG_MODE_INT_CLK 0x0001 +#define FRCFG_MODE_V35 0x0000 /* S508 only */ +#define FRCFG_MODE_RS232 0x0002 /* S508 only */ + +/*---------------------------------------------------------------------------- + * Channel configuration. + * This structure is passed to the FR_SET_CONFIG command when dlci != 0. + */ +typedef struct fr_dlc_conf +{ + unsigned short conf_flags PACKED; /* 00h: configuration bits */ + unsigned short cir_fwd PACKED; /* 02h: */ + unsigned short bc_fwd PACKED; /* 04h: */ + unsigned short be_fwd PACKED; /* 06h: */ + unsigned short cir_bwd PACKED; /* 08h: */ + unsigned short bc_bwd PACKED; /* 0Ah: */ + unsigned short be_bwd PACKED; /* 0Ch: */ +} fr_dlc_conf_t; + +/*---------------------------------------------------------------------------- + * S502 Interrupt mode control block. + * This structure is passed to the FR_SET_INTR_FLAGS and returned by the + * FR_READ_INTR_FLAGS commands. + */ +typedef struct fr502_intr_ctl +{ + unsigned char mode PACKED; /* 00h: interrupt enable flags */ + unsigned short tx_len PACKED; /* 01h: required Tx buffer size */ +} fr502_intr_ctl_t; + +/*---------------------------------------------------------------------------- + * S508 Interrupt mode control block. + * This structure is passed to the FR_SET_INTR_FLAGS and returned by the + * FR_READ_INTR_FLAGS commands. + */ +typedef struct fr508_intr_ctl +{ + unsigned char mode PACKED; /* 00h: interrupt enable flags */ + unsigned short tx_len PACKED; /* 01h: required Tx buffer size */ + unsigned char irq PACKED; /* 03h: IRQ level to activate */ + unsigned char flags PACKED; /* 04h: ?? */ + unsigned short timeout PACKED; /* 05h: ms, for timer interrupt */ +} fr508_intr_ctl_t; + +/*---------------------------------------------------------------------------- + * Channel Status. + * This structure is returned by the FR_READ_STATUS command. + */ +typedef struct frDLCStatus +{ + unsigned char status PACKED; /* 00h: link/DLCI status */ + struct + { + unsigned short dlci PACKED; /* 01h: DLCI number */ + unsigned char status PACKED; /* 03h: DLCI status */ + } circuit[1] PACKED; +} frDLCStatus_t; + +/* 'status' defines */ +#define FR_LINK_INOPER 0x00 /* for global status (DLCI == 0) */ +#define FR_LINK_OPER 0x01 +#define FR_DLCI_DELETED 0x01 /* for circuit status (DLCI != 0) */ +#define FR_DLCI_ACTIVE 0x02 +#define FR_DLCI_WAITING 0x04 +#define FR_DLCI_NEW 0x08 +#define FR_DLCI_REPORT 0x40 + +/*---------------------------------------------------------------------------- + * Global Statistics Block. + * This structure is returned by the FR_READ_STATISTICS command when + * dcli == 0. + */ +typedef struct frLinkStat +{ + unsigned short rx_too_long PACKED; /* 00h: */ + unsigned short rx_dropped PACKED; /* 02h: */ + unsigned short rx_dropped2 PACKED; /* 04h: */ + unsigned short rx_bad_dlci PACKED; /* 06h: */ + unsigned short rx_bad_format PACKED; /* 08h: */ + unsigned short retransmitted PACKED; /* 0Ah: */ + unsigned short cpe_tx_FSE PACKED; /* 0Ch: */ + unsigned short cpe_tx_LIV PACKED; /* 0Eh: */ + unsigned short cpe_rx_FSR PACKED; /* 10h: */ + unsigned short cpe_rx_LIV PACKED; /* 12h: */ + unsigned short node_rx_FSE PACKED; /* 14h: */ + unsigned short node_rx_LIV PACKED; /* 16h: */ + unsigned short node_tx_FSR PACKED; /* 18h: */ + unsigned short node_tx_LIV PACKED; /* 1Ah: */ + unsigned short rx_ISF_err PACKED; /* 1Ch: */ + unsigned short rx_unsolicited PACKED; /* 1Eh: */ + unsigned short rx_SSN_err PACKED; /* 20h: */ + unsigned short rx_RSN_err PACKED; /* 22h: */ + unsigned short T391_timeouts PACKED; /* 24h: */ + unsigned short T392_timeouts PACKED; /* 26h: */ + unsigned short N392_reached PACKED; /* 28h: */ + unsigned short cpe_SSN_RSN PACKED; /* 2Ah: */ + unsigned short current_SSN PACKED; /* 2Ch: */ + unsigned short current_RSN PACKED; /* 2Eh: */ + unsigned short curreny_T391 PACKED; /* 30h: */ + unsigned short current_T392 PACKED; /* 32h: */ + unsigned short current_N392 PACKED; /* 34h: */ + unsigned short current_N393 PACKED; /* 36h: */ +} frLinkStat_t; + +/*---------------------------------------------------------------------------- + * DLCI Statistics. + * This structure is returned by the FR_READ_STATISTICS command when + * dlci != 0. + */ +typedef struct frDLCIStat +{ + unsigned long tx_frames PACKED; /* 00h: */ + unsigned long tx_bytes PACKED; /* 04h: */ + unsigned long rx_frames PACKED; /* 08h: */ + unsigned long rx_bytes PACKED; /* 0Ch: */ + unsigned long rx_dropped PACKED; /* 10h: */ + unsigned long rx_inactive PACKED; /* 14h: */ + unsigned long rx_exceed_CIR PACKED; /* 18h: */ + unsigned long rx_DE_set PACKED; /* 1Ch: */ + unsigned long tx_throughput PACKED; /* 20h: */ + unsigned long tx_calc_timer PACKED; /* 24h: */ + unsigned long rx_throughput PACKED; /* 28h: */ + unsigned long rx_calc_timer PACKED; /* 2Ch: */ +} frDLCIStat_t; + +/*---------------------------------------------------------------------------- + * Communications Error Statistics. + * This structure is returned by the FR_READ_ERROR_STATS command. + */ +typedef struct frCommStat +{ + unsigned char rx_overruns PACKED; /* 00h: */ + unsigned char rx_bad_crc PACKED; /* 01h: */ + unsigned char rx_aborts PACKED; /* 02h: */ + unsigned char rx_too_long PACKED; /* 03h: */ + unsigned char tx_aborts PACKED; /* 04h: */ + unsigned char tx_underruns PACKED; /* 05h: */ + unsigned char tx_missed_undr PACKED; /* 06h: */ + unsigned char dcd_dropped PACKED; /* 07h: */ + unsigned char cts_dropped PACKED; /* 08h: */ +} frCommStat_t; + +/*---------------------------------------------------------------------------- + * Defines for the FR_ISSUE_IS_FRAME command. + */ +#define FR_ISF_LVE 2 /* issue Link Verification Enquiry */ +#define FR_ISF_FSE 3 /* issue Full Status Enquiry */ + +#ifdef _MSC_ +# pragma pack() +#endif +#endif /* _SDLA_FR_H */ + diff --git a/include/linux/sdla_ppp.h b/include/linux/sdla_ppp.h new file mode 100644 index 000000000..267986833 --- /dev/null +++ b/include/linux/sdla_ppp.h @@ -0,0 +1,536 @@ +/***************************************************************************** +* sdla_ppp.h Sangoma PPP firmware API definitions. +* +* Author: Gene Kozin <74604.152@compuserve.com> +* +* Copyright: (c) 1995-1997 Sangoma Technologies Inc. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version +* 2 of the License, or (at your option) any later version. +* ============================================================================ +* Jan 06, 1997 Gene Kozin v2.0 +* Apr 11, 1996 Gene Kozin Initial version. +*****************************************************************************/ +#ifndef _SDLA_PPP_H +#define _SDLA_PPP_H + +/*---------------------------------------------------------------------------- + * Notes: + * ------ + * 1. All structures defined in this file are byte-alined. To ensure + * portability of this code between different platforms and compilers, one + * of the following defines must be defined before including this file: + * + * Compiler Platform Define Use option + * -------- -------- ------ ---------- + * GNU C Linux _GNUC_ - + * Microsoft C DOS/Windows _MSC_ - + */ + +#ifdef _GNUC_ +# ifndef PACKED +# define PACKED __attribute__((packed)) +# endif /* PACKED */ +#else +# define PACKED +#endif +#ifdef _MSC_ +# pragma pack(1) +#endif + +/* Adapter memory layout and important constants */ + +#define PPP502_MB_VECT 0xA000 /* mailbox window vector */ +#define PPP502_MB_OFFS 0x1C00 /* mailbox offset */ +#define PPP502_FLG_OFFS 0 /* status flags offset */ +#define PPP502_BUF_OFFS 0x0010 /* buffer info block offset */ + +#define PPP508_MB_VECT 0xE000 /* mailbox window vector */ +#define PPP508_MB_OFFS 0 /* mailbox offset */ +#define PPP508_FLG_OFFS 0x1000 /* status flags offset */ +#define PPP508_BUF_OFFS 0x1100 /* buffer info block offset */ + +#define PPP_MAX_DATA 1008 /* command block data buffer length */ + +/****** Data Structures *****************************************************/ + +/*---------------------------------------------------------------------------- + * PPP Command Block. + */ +typedef struct ppp_cmd +{ + unsigned char command PACKED; /* command code */ + unsigned short length PACKED; /* length of data buffer */ + unsigned char result PACKED; /* return code */ + unsigned char rsrv[11] PACKED; /* reserved for future use */ +} ppp_cmd_t; + +/* 'command' field defines */ +#define PPP_READ_CODE_VERSION 0x10 /* configuration commands */ +#define PPP_SET_CONFIG 0x05 +#define PPP_READ_CONFIG 0x06 +#define PPP_SET_INTR_FLAGS 0x20 +#define PPP_READ_INTR_FLAGS 0x21 +#define PPP_SET_INBOUND_AUTH 0x30 +#define PPP_SET_OUTBOUND_AUTH 0x31 +#define PPP_GET_CONNECTION_INFO 0x32 + +#define PPP_COMM_ENABLE 0x03 /* operational commands */ +#define PPP_COMM_DISABLE 0x04 +#define PPP_SEND_SIGN_FRAME 0x23 +#define PPP_READ_SIGN_RESPONSE 0x24 +#define PPP_DATALINE_MONITOR 0x33 + +#define PPP_READ_STATISTICS 0x07 /* statistics commands */ +#define PPP_FLUSH_STATISTICS 0x08 +#define PPP_READ_ERROR_STATS 0x09 +#define PPP_FLUSH_ERROR_STATS 0x0A +#define PPP_READ_PACKET_STATS 0x12 +#define PPP_FLUSH_PACKET_STATS 0x13 +#define PPP_READ_LCP_STATS 0x14 +#define PPP_FLUSH_LCP_STATS 0x15 +#define PPP_READ_LPBK_STATS 0x16 +#define PPP_FLUSH_LPBK_STATS 0x17 +#define PPP_READ_IPCP_STATS 0x18 +#define PPP_FLUSH_IPCP_STATS 0x19 +#define PPP_READ_IPXCP_STATS 0x1A +#define PPP_FLUSH_IPXCP_STATS 0x1B +#define PPP_READ_PAP_STATS 0x1C +#define PPP_FLUSH_PAP_STATS 0x1D +#define PPP_READ_CHAP_STATS 0x1E +#define PPP_FLUSH_CHAP_STATS 0x1F + +/* 'result' field defines */ +#define PPPRES_OK 0x00 /* command executed successfully */ +#define PPPRES_INVALID_STATE 0x09 /* invalid command in this context */ + +/*---------------------------------------------------------------------------- + * PPP Mailbox. + * This structure is located at offset PPP???_MB_OFFS into PPP???_MB_VECT + */ +typedef struct ppp_mbox +{ + unsigned char flag PACKED; /* 00h: command execution flag */ + ppp_cmd_t cmd PACKED; /* 01h: command block */ + unsigned char data[1] PACKED; /* 10h: variable length data buffer */ +} ppp_mbox_t; + +/*---------------------------------------------------------------------------- + * PPP Status Flags. + * This structure is located at offset PPP???_FLG_OFFS into + * PPP???_MB_VECT. + */ +typedef struct ppp_flags +{ + unsigned char iflag PACKED; /* 00: interrupt flag */ + unsigned char imask PACKED; /* 01: interrupt mask */ + unsigned char resrv PACKED; + unsigned char mstatus PACKED; /* 03: modem status */ + unsigned char lcp_state PACKED; /* 04: LCP state */ + unsigned char ppp_phase PACKED; /* 05: PPP phase */ + unsigned char ip_state PACKED; /* 06: IPCP state */ + unsigned char ipx_state PACKED; /* 07: IPXCP state */ + unsigned char pap_state PACKED; /* 08: PAP state */ + unsigned char chap_state PACKED; /* 09: CHAP state */ + unsigned short disc_cause PACKED; /* 0A: disconnection cause */ +} ppp_flags_t; + +/* 'iflag' defines */ +#define PPP_INTR_RXRDY 0x01 /* Rx ready */ +#define PPP_INTR_TXRDY 0x02 /* Tx ready */ +#define PPP_INTR_MODEM 0x04 /* modem status change (DCD, CTS) */ +#define PPP_INTR_CMD 0x08 /* interface command completed */ +#define PPP_INTR_DISC 0x10 /* data link disconnected */ +#define PPP_INTR_OPEN 0x20 /* data link open */ +#define PPP_INTR_DROP_DTR 0x40 /* DTR drop timeout expired */ + +/* 'mstatus' defines */ +#define PPP_MDM_DCD 0x08 /* mdm_status: DCD */ +#define PPP_MDM_CTS 0x20 /* mdm_status: CTS */ + +/*---------------------------------------------------------------------------- + * PPP Buffer Info. + * This structure is located at offset PPP502_BUF_OFFS into + * PPP502_MB_VECT. + */ +typedef struct ppp502_buf_info +{ + unsigned short txb_num PACKED; /* 00: number of transmit buffers */ + unsigned short txb_offs PACKED; /* 02: offset of the buffer ctl. */ + unsigned char rsrv1[4] PACKED; + unsigned short rxb_num PACKED; /* 08: number of receive buffers */ + unsigned short rxb_offs PACKED; /* 0A: offset of the buffer ctl. */ + unsigned char rsrv2[2] PACKED; + unsigned short rxb_next PACKED; /* 0E: index of the next buffer */ +} ppp502_buf_info_t; + +/*---------------------------------------------------------------------------- + * PPP Buffer Info. + * This structure is located at offset PPP508_BUF_OFFS into + * PPP508_MB_VECT. + */ +typedef struct ppp508_buf_info +{ + unsigned short txb_num PACKED; /* 00: number of transmit buffers */ + unsigned long txb_ptr PACKED; /* 02: pointer to the buffer ctl. */ + unsigned char rsrv1[26] PACKED; + unsigned short rxb_num PACKED; /* 20: number of receive buffers */ + unsigned long rxb_ptr PACKED; /* 22: pointer to the buffer ctl. */ + unsigned long rxb1_ptr PACKED; /* 26: pointer to the first buf.ctl. */ + unsigned long rxb_base PACKED; /* 2A: pointer to the buffer base */ + unsigned char rsrv2[2] PACKED; + unsigned long rxb_end PACKED; /* 30: pointer to the buffer end */ +} ppp508_buf_info_t; + +/*---------------------------------------------------------------------------- + * Transmit/Receive Buffer Control Block. + */ +typedef struct ppp_buf_ctl +{ + unsigned char flag PACKED; /* 00: 'buffer ready' flag */ + unsigned short length PACKED; /* 01: length of data */ + unsigned char reserved1[1] PACKED; /* 03: */ + unsigned char proto PACKED; /* 04: protocol */ + unsigned short timestamp PACKED; /* 05: time stamp (Rx only) */ + unsigned char reserved2[5] PACKED; /* 07: */ + union + { + unsigned short o_p[2]; /* 1C: buffer offset & page (S502) */ + unsigned long ptr; /* 1C: buffer pointer (S508) */ + } buf PACKED; +} ppp_buf_ctl_t; + +/*---------------------------------------------------------------------------- + * S502 Adapter Configuration Block (passed to the PPP_SET_CONFIG command). + */ +typedef struct ppp502_conf +{ + unsigned char line_speed PACKED; /* 00: 0 - external clk. */ + unsigned short txbuf_num PACKED; /* 01: number of Tx buffers */ + unsigned short conf_flags PACKED; /* 03: configuration bits */ + unsigned short mtu_local PACKED; /* 05: local MTU */ + unsigned short mtu_remote PACKED; /* 07: remote MTU */ + unsigned short restart_tmr PACKED; /* 09: restart timer */ + unsigned short auth_rsrt_tmr PACKED; /* 0B: authentication timer */ + unsigned short auth_wait_tmr PACKED; /* 0D: authentication timer */ + unsigned short mdm_fail_tmr PACKED; /* 0F: modem failure timer */ + unsigned short dtr_drop_tmr PACKED; /* 11: DTR drop timer */ + unsigned short connect_tmout PACKED; /* 13: connection timeout */ + unsigned short conf_retry PACKED; /* 15: max. retry */ + unsigned short term_retry PACKED; /* 17: max. retry */ + unsigned short fail_retry PACKED; /* 19: max. retry */ + unsigned short auth_retry PACKED; /* 1B: max. retry */ + unsigned char auth_options PACKED; /* 1D: authentication opt. */ + unsigned char ip_options PACKED; /* 1E: IP options */ + unsigned char ip_local[4] PACKED; /* 1F: local IP address */ + unsigned char ip_remote[4] PACKED; /* 23: remote IP address */ + unsigned char ipx_options PACKED; /* 27: IPX options */ + unsigned char ipx_netno[4] PACKED; /* 28: IPX net number */ + unsigned char ipx_local[6] PACKED; /* 2C: local IPX node number*/ + unsigned char ipx_remote[6] PACKED; /* 32: remote IPX node num.*/ + unsigned char ipx_router[48] PACKED; /* 38: IPX router name*/ +} ppp502_conf_t; + +/*---------------------------------------------------------------------------- + * S508 Adapter Configuration Block (passed to the PPP_SET_CONFIG command). + */ +typedef struct ppp508_conf +{ + unsigned long line_speed PACKED; /* 00: baud rate, bps */ + unsigned short txbuf_percent PACKED; /* 04: % of Tx buffer */ + unsigned short conf_flags PACKED; /* 06: configuration bits */ + unsigned short mtu_local PACKED; /* 08: local MTU */ + unsigned short mtu_remote PACKED; /* 0A: remote MTU */ + unsigned short restart_tmr PACKED; /* 0C: restart timer */ + unsigned short auth_rsrt_tmr PACKED; /* 0E: authentication timer */ + unsigned short auth_wait_tmr PACKED; /* 10: authentication timer */ + unsigned short mdm_fail_tmr PACKED; /* 12: modem failure timer */ + unsigned short dtr_drop_tmr PACKED; /* 14: DTR drop timer */ + unsigned short connect_tmout PACKED; /* 16: connection timeout */ + unsigned short conf_retry PACKED; /* 18: max. retry */ + unsigned short term_retry PACKED; /* 1A: max. retry */ + unsigned short fail_retry PACKED; /* 1C: max. retry */ + unsigned short auth_retry PACKED; /* 1E: max. retry */ + unsigned char auth_options PACKED; /* 20: authentication opt. */ + unsigned char ip_options PACKED; /* 21: IP options */ + unsigned char ip_local[4] PACKED; /* 22: local IP address */ + unsigned char ip_remote[4] PACKED; /* 26: remote IP address */ + unsigned char ipx_options PACKED; /* 2A: IPX options */ + unsigned char ipx_netno[4] PACKED; /* 2B: IPX net number */ + unsigned char ipx_local[6] PACKED; /* 2F: local IPX node number*/ + unsigned char ipx_remote[6] PACKED; /* 35: remote IPX node num.*/ + unsigned char ipx_router[48] PACKED; /* 3B: IPX router name*/ + unsigned long alt_cpu_clock PACKED; /* 6B: */ +} ppp508_conf_t; + +/* 'line_speed' field */ +#define PPP_BITRATE_1200 0x01 +#define PPP_BITRATE_2400 0x02 +#define PPP_BITRATE_4800 0x03 +#define PPP_BITRATE_9600 0x04 +#define PPP_BITRATE_19200 0x05 +#define PPP_BITRATE_38400 0x06 +#define PPP_BITRATE_45000 0x07 +#define PPP_BITRATE_56000 0x08 +#define PPP_BITRATE_64000 0x09 +#define PPP_BITRATE_74000 0x0A +#define PPP_BITRATE_112000 0x0B +#define PPP_BITRATE_128000 0x0C +#define PPP_BITRATE_156000 0x0D + +/* Defines for the 'conf_flags' field */ +#define PPP_IGNORE_TX_ABORT 0x01 /* don't re-transmit aborted frames */ +#define PPP_ENABLE_TX_STATS 0x02 /* enable Tx statistics */ +#define PPP_ENABLE_RX_STATS 0x04 /* enable Rx statistics */ +#define PPP_ENABLE_TIMESTAMP 0x08 /* enable timestamp */ + +/* 'ip_options' defines */ +#define PPP_LOCAL_IP_LOCAL 0x01 +#define PPP_LOCAL_IP_REMOTE 0x02 +#define PPP_REMOTE_IP_LOCAL 0x04 +#define PPP_REMOTE_IP_REMOTE 0x08 + +/* 'ipx_options' defines */ +#define PPP_REMOTE_IPX_NETNO 0x01 +#define PPP_REMOTE_IPX_LOCAL 0x02 +#define PPP_REMOTE_IPX_REMOTE 0x04 +#define PPP_IPX_ROUTE_RIP_SAP 0x08 +#define PPP_IPX_ROUTE_NLSP 0x10 +#define PPP_IPX_ROUTE_DEFAULT 0x20 +#define PPP_IPX_CONF_COMPLETE 0x40 +#define PPP_IPX_ENABLE 0x80 + +/*---------------------------------------------------------------------------- + * S502 Adapter Configuration Block (returned by the PPP_READ_CONFIG command). + */ +typedef struct ppp502_get_conf +{ + ppp502_conf_t conf PACKED; /* 00: requested config. */ + unsigned short txb_num PACKED; /* 68: number of Tx buffers */ + unsigned short rxb_num PACKED; /* 6A: number of Rx buffers */ +} ppp502_get_conf_t; + +/*---------------------------------------------------------------------------- + * S508 Adapter Configuration Block (returned by the PPP_READ_CONFIG command). + */ +typedef struct ppp508_get_conf +{ + unsigned long bps PACKED; /* 00: baud rate, bps */ + ppp508_conf_t conf PACKED; /* 04: requested config. */ + unsigned short txb_num PACKED; /* 6F: number of Tx buffers */ + unsigned short rxb_num PACKED; /* 71: number of Rx buffers */ +} ppp508_get_conf_t; + +/*---------------------------------------------------------------------------- + * S502 Operational Statistics (returned by the PPP_READ_STATISTIC command). + */ +typedef struct ppp502_Stats +{ + unsigned short rx_lost_intr PACKED; /* 00: */ + unsigned short rx_lost_buff PACKED; /* 02: */ + unsigned short tx_abort PACKED; /* 04: */ + unsigned long tx_frames PACKED; /* 06: */ + unsigned long tx_bytes PACKED; /* 0A: */ + unsigned long rx_frames PACKED; /* 0E: */ + unsigned long rx_bytes PACKED; /* 12: */ +} ppp502_Stats_t; + +/*---------------------------------------------------------------------------- + * S508 Operational Statistics (returned by the PPP_READ_STATISTIC command). + */ +typedef struct ppp508_stats +{ + unsigned short reserved1 PACKED; /* 00: */ + unsigned short rx_bad_len PACKED; /* 02: */ + unsigned short reserved2 PACKED; /* 04: */ + unsigned long tx_frames PACKED; /* 06: */ + unsigned long tx_bytes PACKED; /* 0A: */ + unsigned long rx_frames PACKED; /* 0E: */ + unsigned long rx_bytes PACKED; /* 12: */ +} ppp508_stats_t; + +/*---------------------------------------------------------------------------- + * Adapter Error Statistics (returned by the PPP_READ_ERROR_STATS command). + */ +typedef struct ppp_err_stats +{ + unsigned char rx_overrun PACKED; /* 00: Rx overrun errors */ + unsigned char rx_bad_crc PACKED; /* 01: Rx CRC errors */ + unsigned char rx_abort PACKED; /* 02: Rx aborted frames */ + unsigned char rx_lost PACKED; /* 03: Rx frames lost */ + unsigned char tx_abort PACKED; /* 04: Tx aborted frames */ + unsigned char tx_underrun PACKED; /* 05: Tx underrun errors */ + unsigned char tx_missed_intr PACKED; /* 06: Tx underruns missed */ + unsigned char reserved PACKED; /* 07: Tx underruns missed */ + unsigned char dcd_trans PACKED; /* 08: DCD transitions */ + unsigned char cts_trans PACKED; /* 09: CTS transitions */ +} ppp_err_stats_t; + +/*---------------------------------------------------------------------------- + * Packet Statistics (returned by the PPP_READ_PACKET_STATS command). + */ +typedef struct ppp_pkt_stats +{ + unsigned short rx_bad_header PACKED; /* 00: */ + unsigned short rx_prot_unknwn PACKED; /* 02: */ + unsigned short rx_too_large PACKED; /* 04: */ + unsigned short rx_lcp PACKED; /* 06: */ + unsigned short tx_lcp PACKED; /* 08: */ + unsigned short rx_ipcp PACKED; /* 0A: */ + unsigned short tx_ipcp PACKED; /* 0C: */ + unsigned short rx_ipxcp PACKED; /* 0E: */ + unsigned short tx_ipxcp PACKED; /* 10: */ + unsigned short rx_pap PACKED; /* 12: */ + unsigned short tx_pap PACKED; /* 14: */ + unsigned short rx_chap PACKED; /* 16: */ + unsigned short tx_chap PACKED; /* 18: */ + unsigned short rx_lqr PACKED; /* 1A: */ + unsigned short tx_lqr PACKED; /* 1C: */ + unsigned short rx_ip PACKED; /* 1E: */ + unsigned short tx_ip PACKED; /* 20: */ + unsigned short rx_ipx PACKED; /* 22: */ + unsigned short tx_ipx PACKED; /* 24: */ +} ppp_pkt_stats_t; + +/*---------------------------------------------------------------------------- + * LCP Statistics (returned by the PPP_READ_LCP_STATS command). + */ +typedef struct ppp_lcp_stats +{ + unsigned short rx_unknown PACKED; /* 00: unknown LCP type */ + unsigned short rx_conf_rqst PACKED; /* 02: Configure-Request */ + unsigned short rx_conf_ack PACKED; /* 04: Configure-Ack */ + unsigned short rx_conf_nak PACKED; /* 06: Configure-Nak */ + unsigned short rx_conf_rej PACKED; /* 08: Configure-Reject */ + unsigned short rx_term_rqst PACKED; /* 0A: Terminate-Request */ + unsigned short rx_term_ack PACKED; /* 0C: Terminate-Ack */ + unsigned short rx_code_rej PACKED; /* 0E: Code-Reject */ + unsigned short rx_proto_rej PACKED; /* 10: Protocol-Reject */ + unsigned short rx_echo_rqst PACKED; /* 12: Echo-Request */ + unsigned short rx_echo_reply PACKED; /* 14: Echo-Reply */ + unsigned short rx_disc_rqst PACKED; /* 16: Discard-Request */ + unsigned short tx_conf_rqst PACKED; /* 18: Configure-Request */ + unsigned short tx_conf_ack PACKED; /* 1A: Configure-Ack */ + unsigned short tx_conf_nak PACKED; /* 1C: Configure-Nak */ + unsigned short tx_conf_rej PACKED; /* 1E: Configure-Reject */ + unsigned short tx_term_rqst PACKED; /* 20: Terminate-Request */ + unsigned short tx_term_ack PACKED; /* 22: Terminate-Ack */ + unsigned short tx_code_rej PACKED; /* 24: Code-Reject */ + unsigned short tx_proto_rej PACKED; /* 26: Protocol-Reject */ + unsigned short tx_echo_rqst PACKED; /* 28: Echo-Request */ + unsigned short tx_echo_reply PACKED; /* 2A: Echo-Reply */ + unsigned short tx_disc_rqst PACKED; /* 2E: Discard-Request */ + unsigned short rx_too_large PACKED; /* 30: packets too large */ + unsigned short rx_ack_inval PACKED; /* 32: invalid Conf-Ack */ + unsigned short rx_rej_inval PACKED; /* 34: invalid Conf-Reject */ + unsigned short rx_rej_badid PACKED; /* 36: Conf-Reject w/bad ID */ +} ppp_lcp_stats_t; + +/*---------------------------------------------------------------------------- + * Loopback Error Statistics (returned by the PPP_READ_LPBK_STATS command). + */ +typedef struct ppp_lpbk_stats +{ + unsigned short conf_magic PACKED; /* 00: */ + unsigned short loc_echo_rqst PACKED; /* 02: */ + unsigned short rem_echo_rqst PACKED; /* 04: */ + unsigned short loc_echo_reply PACKED; /* 06: */ + unsigned short rem_echo_reply PACKED; /* 08: */ + unsigned short loc_disc_rqst PACKED; /* 0A: */ + unsigned short rem_disc_rqst PACKED; /* 0C: */ + unsigned short echo_tx_collsn PACKED; /* 0E: */ + unsigned short echo_rx_collsn PACKED; /* 10: */ +} ppp_lpbk_stats_t; + +/*---------------------------------------------------------------------------- + * Protocol Statistics (returned by the PPP_READ_IPCP_STATS and + * PPP_READ_IPXCP_STATS commands). + */ +typedef struct ppp_prot_stats +{ + unsigned short rx_unknown PACKED; /* 00: unknown type */ + unsigned short rx_conf_rqst PACKED; /* 02: Configure-Request */ + unsigned short rx_conf_ack PACKED; /* 04: Configure-Ack */ + unsigned short rx_conf_nak PACKED; /* 06: Configure-Nak */ + unsigned short rx_conf_rej PACKED; /* 08: Configure-Reject */ + unsigned short rx_term_rqst PACKED; /* 0A: Terminate-Request */ + unsigned short rx_term_ack PACKED; /* 0C: Terminate-Ack */ + unsigned short rx_code_rej PACKED; /* 0E: Code-Reject */ + unsigned short reserved PACKED; /* 10: */ + unsigned short tx_conf_rqst PACKED; /* 12: Configure-Request */ + unsigned short tx_conf_ack PACKED; /* 14: Configure-Ack */ + unsigned short tx_conf_nak PACKED; /* 16: Configure-Nak */ + unsigned short tx_conf_rej PACKED; /* 18: Configure-Reject */ + unsigned short tx_term_rqst PACKED; /* 1A: Terminate-Request */ + unsigned short tx_term_ack PACKED; /* 1C: Terminate-Ack */ + unsigned short tx_code_rej PACKED; /* 1E: Code-Reject */ + unsigned short rx_too_large PACKED; /* 20: packets too large */ + unsigned short rx_ack_inval PACKED; /* 22: invalid Conf-Ack */ + unsigned short rx_rej_inval PACKED; /* 24: invalid Conf-Reject */ + unsigned short rx_rej_badid PACKED; /* 26: Conf-Reject w/bad ID */ +} ppp_prot_stats_t; + +/*---------------------------------------------------------------------------- + * PAP Statistics (returned by the PPP_READ_PAP_STATS command). + */ +typedef struct ppp_pap_stats +{ + unsigned short rx_unknown PACKED; /* 00: unknown type */ + unsigned short rx_auth_rqst PACKED; /* 02: Authenticate-Request */ + unsigned short rx_auth_ack PACKED; /* 04: Authenticate-Ack */ + unsigned short rx_auth_nak PACKED; /* 06: Authenticate-Nak */ + unsigned short reserved PACKED; /* 08: */ + unsigned short tx_auth_rqst PACKED; /* 0A: Authenticate-Request */ + unsigned short tx_auth_ack PACKED; /* 0C: Authenticate-Ack */ + unsigned short tx_auth_nak PACKED; /* 0E: Authenticate-Nak */ + unsigned short rx_too_large PACKED; /* 10: packets too large */ + unsigned short rx_bad_peerid PACKED; /* 12: invalid peer ID */ + unsigned short rx_bad_passwd PACKED; /* 14: invalid password */ +} ppp_pap_stats_t; + +/*---------------------------------------------------------------------------- + * CHAP Statistics (returned by the PPP_READ_CHAP_STATS command). + */ +typedef struct ppp_chap_stats +{ + unsigned short rx_unknown PACKED; /* 00: unknown type */ + unsigned short rx_challenge PACKED; /* 02: Authenticate-Request */ + unsigned short rx_response PACKED; /* 04: Authenticate-Ack */ + unsigned short rx_success PACKED; /* 06: Authenticate-Nak */ + unsigned short rx_failure PACKED; /* 08: Authenticate-Nak */ + unsigned short reserved PACKED; /* 0A: */ + unsigned short tx_challenge PACKED; /* 0C: Authenticate-Request */ + unsigned short tx_response PACKED; /* 0E: Authenticate-Ack */ + unsigned short tx_success PACKED; /* 10: Authenticate-Nak */ + unsigned short tx_failure PACKED; /* 12: Authenticate-Nak */ + unsigned short rx_too_large PACKED; /* 14: packets too large */ + unsigned short rx_bad_peerid PACKED; /* 16: invalid peer ID */ + unsigned short rx_bad_passwd PACKED; /* 18: invalid password */ + unsigned short rx_bad_md5 PACKED; /* 1A: invalid MD5 format */ + unsigned short rx_bad_resp PACKED; /* 1C: invalid response */ +} ppp_chap_stats_t; + +/*---------------------------------------------------------------------------- + * Connection Information (returned by the PPP_GET_CONNECTION_INFO command). + */ +typedef struct ppp_conn_info +{ + unsigned short remote_mru PACKED; /* 00: */ + unsigned char ip_options PACKED; /* 02: */ + unsigned char ip_local[4] PACKED; /* 03: */ + unsigned char ip_remote[4] PACKED; /* 07: */ + unsigned char ipx_options PACKED; /* 0B: */ + unsigned char ipx_network[4] PACKED; /* 0C: */ + unsigned char ipx_local[6] PACKED; /* 10: */ + unsigned char ipx_remote[6] PACKED; /* 16: */ + unsigned char ipx_router[48] PACKED; /* 1C: */ + unsigned char auth_status PACKED; /* 4C: */ + unsigned char peer_id[0] PACKED; /* 4D: */ +} ppp_conn_info_t; + +#ifdef _MSC_ +# pragma pack() +#endif +#endif /* _SDLA_PPP_H */ diff --git a/include/linux/sdla_x25.h b/include/linux/sdla_x25.h new file mode 100644 index 000000000..424e9fe6a --- /dev/null +++ b/include/linux/sdla_x25.h @@ -0,0 +1,624 @@ +/***************************************************************************** +* sdla_x25.h Sangoma X.25 firmware API definitions. +* +* Author: Gene Kozin <74604.152@compuserve.com> +* +* Copyright: (c) 1995-1996 Sangoma Technologies Inc. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version +* 2 of the License, or (at your option) any later version. +* ============================================================================ +* Dec 13, 1996 Gene Kozin Initial version +*****************************************************************************/ +#ifndef _SDLA_X25_H +#define _SDLA_X25_H + +/*---------------------------------------------------------------------------- + * Notes: + * ------ + * 1. All structures defined in this file are byte-alined. To ensure + * portability of this code between different platforms and compilers, one + * of the following defines must be defined before including this file: + * + * Compiler Platform Define Use option + * -------- -------- ------ ---------- + * GNU C Linux _GNUC_ - + * Microsoft C DOS/Windows _MSC_ - + * + */ + +#ifdef _GNUC_ +# ifndef PACKED +# define PACKED __attribute__((packed)) +# endif /* PACKED */ +#else +# define PACKED +#endif +#ifdef _MSC_ +# pragma pack(1) +#endif + +/****** CONSTANTS DEFINITIONS ***********************************************/ + +#define X25_MAX_CHAN 255 /* max number of open X.25 circuits */ +#define X25_MAX_DATA 1024 /* max length of X.25 data buffer */ + +/* + * X.25 shared memory layout. + */ +#define X25_MBOX_OFFS 0x16B0 /* general mailbox block */ +#define X25_RXMBOX_OFFS 0x1AD0 /* receive mailbox */ +#define X25_STATUS_OFFS 0x1EF0 /* X.25 status structure */ + +/****** DATA STRUCTURES *****************************************************/ + +/*---------------------------------------------------------------------------- + * X.25 Command Block. + */ +typedef struct X25Cmd +{ + unsigned char command PACKED; /* command code */ + unsigned short length PACKED; /* transfer data length */ + unsigned char result PACKED; /* return code */ + unsigned char pf PACKED; /* P/F bit */ + unsigned short lcn PACKED; /* logical channel */ + unsigned char qdm PACKED; /* Q/D/M bits */ + unsigned char cause PACKED; /* cause field */ + unsigned char diagn PACKED; /* diagnostics */ + unsigned char pktType PACKED; /* packet type */ + unsigned char resrv[4] PACKED; /* reserved */ +} TX25Cmd; + +/* + * Defines for the 'command' field. + */ +/*----- General commands --------------*/ +#define X25_SET_GLOBAL_VARS 0x0B /* set global variables */ +#define X25_READ_MODEM_STATUS 0x0C /* read modem status */ +#define X25_READ_CODE_VERSION 0x15 /* read firmware version number */ +#define X25_TRACE_CONFIGURE 0x14 /* configure trace facility */ +#define X25_READ_TRACE_DATA 0x16 /* read trace data */ +#define X25_SET_INTERRUPT_MODE 0x17 /* set interrupt generation mode */ +#define X25_READ_INTERRUPT_MODE 0x18 /* read interrupt generation mode */ +/*----- HDLC-level commands -----------*/ +#define X25_HDLC_LINK_CONFIGURE 0x01 /* configure HDLC link level */ +#define X25_HDLC_LINK_OPEN 0x02 /* open HDLC link */ +#define X25_HDLC_LINK_CLOSE 0x03 /* close HDLC link */ +#define X25_HDLC_LINK_SETUP 0x04 /* set up HDLC link */ +#define X25_HDLC_LINK_DISC 0x05 /* disconnect DHLC link */ +#define X25_HDLC_LINK_STATUS 0x06 /* read DHLC link status */ +#define X25_HDLC_READ_STATS 0x07 /* read operational statistics */ +#define X25_HDLC_FLUSH_STATS 0x08 /* flush operational statistics */ +#define X25_HDLC_READ_COMM_ERR 0x09 /* read error statistics */ +#define X25_HDLC_FLUSH_COMM_ERR 0x0A /* flush error statistics */ +#define X25_HDLC_FLUSH_BUFFERS 0x0D /* flush HDLC-level data buffers */ +#define X25_HDLC_SPRVS_CNT_STAT 0x0F /* read surervisory count status */ +#define X25_HDLC_SEND_UI_FRAME 0x10 /* send unnumbered information frame */ +#define X25_HDLC_WRITE 0x11 /* send HDLC information frame */ +#define X25_HDLC_READ 0x21 /* read HDLC information frame */ +#define X25_HDLC_READ_CONFIG 0x12 /* read HDLC configuration */ +#define X25_HDLC_SET_CONFIG 0x13 /* set HDLC configuration */ +/*----- X.25-level commands -----------*/ +#define X25_READ 0x22 /* read X.25 packet */ +#define X25_WRITE 0x23 /* send X.25 packet */ +#define X25_PLACE_CALL 0x30 /* place a call on SVC */ +#define X25_ACCEPT_CALL 0x31 /* accept incomming call */ +#define X25_CLEAR_CALL 0x32 /* clear call */ +#define X25_CLEAR_CONFRM 0x33 /* send clear confirmation packet */ +#define X25_RESET 0x34 /* send reset request packet */ +#define X25_RESET_CONFRM 0x35 /* send reset confirmation packet */ +#define X25_RESTART 0x36 /* send restart request packet */ +#define X25_RESTART_CONFRM 0x37 /* send restart confirmation packet */ +#define X25_INTERRUPT 0x38 /* send interrupt request packet */ +#define X25_INTERRUPT_CONFRM 0x39 /* send interrupt confirmation pkt */ +#define X25_REGISTRATION_RQST 0x3A /* send registration request packet */ +#define X25_REGISTRATION_CONFRM 0x3B /* send registration confirmation */ +#define X25_IS_DATA_AVAILABLE 0x40 /* querry receive queue */ +#define X25_INCOMMING_CALL_CTL 0x41 /* select incomming call options */ +#define X25_CONFIGURE_PVC 0x42 /* configure PVC */ +#define X25_GET_ACTIVE_CHANNELS 0x43 /* get a list of active circuits */ +#define X25_READ_CHANNEL_CONFIG 0x44 /* read virt. circuit configuration */ +#define X25_FLUSH_DATA_BUFFERS 0x45 /* flush X.25-level data buffers */ +#define X25_READ_HISTORY_TABLE 0x46 /* read asynchronous event log */ +#define X25_HISTORY_TABLE_CTL 0x47 /* control asynchronous event log */ +#define X25_GET_TX_D_BIT_STATUS 0x48 /* is packet with D-bit acknowleged */ +#define X25_READ_STATISTICS 0x49 /* read X.25-level statistics */ +#define X25_FLUSH_STATISTICS 0x4A /* flush X.25-level statistics */ +#define X25_READ_CONFIGURATION 0x50 /* read HDLC & X.25 configuration */ +#define X25_SET_CONFIGURATION 0x51 /* set HDLC & X.25 configuration */ + +/* + * Defines for the 'result' field. + */ +/*----- General results ---------------*/ +#define X25RES_OK 0x00 +#define X25RES_ERROR 0x01 +#define X25RES_LINK_NOT_IN_ABM 0x02 /* link is not in ABM mode */ +#define X25RES_LINK_CLOSED 0x03 +#define X25RES_INVAL_LENGTH 0x04 +#define X25RES_INVAL_CMD 0x05 +#define X25RES_UNNUMBERED_FRAME 0x06 /* unnunbered frame received */ +#define X25RES_FRM_REJECT_MODE 0x07 /* link is in Frame Reject mode */ +#define X25RES_MODEM_FAILURE 0x08 /* DCD and/or CTS dropped */ +#define X25RES_N2_RETRY_LIMIT 0x09 /* N2 retry limit has been exceeded */ +#define X25RES_INVAL_LCN 0x30 /* invalid logical channel number */ +#define X25RES_INVAL_STATE 0x31 /* channel is not in data xfer mode */ +#define X25RES_INVAL_DATA_LEN 0x32 /* invalid data length */ +#define X25RES_NOT_READY 0x33 /* no data available / buffers full */ +#define X25RES_NETWORK_DOWN 0x34 +#define X25RES_CHANNEL_IN_USE 0x35 /* there is data queued on this LCN */ +#define X25RES_REGST_NOT_SUPPRT 0x36 /* registration not supported */ +#define X25RES_INVAL_FORMAT 0x37 /* invalid packet format */ +#define X25RES_D_BIT_NOT_SUPPRT 0x38 /* D-bit pragmatics not supported */ +#define X25RES_FACIL_NOT_SUPPRT 0x39 /* Call facility not supported */ +#define X25RES_INVAL_CALL_ARG 0x3A /* errorneous call arguments */ +#define X25RES_INVAL_CALL_DATA 0x3B /* errorneous call user data */ +#define X25RES_ASYNC_PACKET 0x40 /* asynchronous packet received */ +#define X25RES_PROTO_VIOLATION 0x41 /* protocol violation occured */ +#define X25RES_PKT_TIMEOUT 0x42 /* X.25 packet time out */ +#define X25RES_PKT_RETRY_LIMIT 0x43 /* X.25 packet retry limit exceeded */ +/*----- Command-dependant results -----*/ +#define X25RES_LINK_DISC 0x00 /* HDLC_LINK_STATUS */ +#define X25RES_LINK_IN_ABM 0x01 /* HDLC_LINK_STATUS */ +#define X25RES_NO_DATA 0x01 /* HDLC_READ/READ_TRACE_DATA*/ +#define X25RES_TRACE_INACTIVE 0x02 /* READ_TRACE_DATA */ +#define X25RES_LINK_IS_OPEN 0x01 /* HDLC_LINK_OPEN */ +#define X25RES_LINK_IS_DISC 0x02 /* HDLC_LINK_DISC */ +#define X25RES_LINK_IS_CLOSED 0x03 /* HDLC_LINK_CLOSE */ +#define X25RES_INVAL_PARAM 0x31 /* INCOMMING_CALL_CTL */ +#define X25RES_INVAL_CONFIG 0x35 /* REGISTR_RQST/CONFRM */ + +/* + * Defines for the 'qdm_bits' field. + */ +#define X25CMD_Q_BIT_MASK 0x04 +#define X25CMD_D_BIT_MASK 0x02 +#define X25CMD_M_BIT_MASK 0x01 + +/* + * Defines for the 'pkt_type' field. + */ +/*----- Asynchronous events ------*/ +#define ASE_CLEAR_RQST 0x02 +#define ASE_RESET_RQST 0x04 +#define ASE_RESTART_RQST 0x08 +#define ASE_INTERRUPT 0x10 +#define ASE_DTE_REGISTR_RQST 0x20 +#define ASE_CALL_RQST 0x30 +#define ASE_CALL_ACCEPTED 0x31 +#define ASE_CLEAR_CONFRM 0x32 +#define ASE_RESET_CONFRM 0x33 +#define ASE_RESTART_CONFRM 0x34 +#define ASE_INTERRUPT_CONFRM 0x35 +#define ASE_DCE_REGISTR_CONFRM 0x36 +#define ASE_DIAGNOSTIC 0x37 +#define ASE_CALL_AUTO_CLEAR 0x38 +#define AUTO_RESPONSE_FLAG 0x80 +/*----- Time-Out events ----------*/ +#define TOE_RESTART_RQST 0x03 +#define TOE_CALL_RQST 0x05 +#define TOE_CLEAR_RQST 0x08 +#define TOE_RESET_RQST 0x0A +/*----- Protocol Violation events */ +#define PVE_CLEAR_RQST 0x32 +#define PVE_RESET_RQST 0x33 +#define PVE_RESTART_RQST 0x34 +#define PVE_DIAGNOSTIC 0x37 + +/*---------------------------------------------------------------------------- + * X.25 Mailbox. + * This structure is located at offsets X25_MBOX_OFFS and X25_RXMBOX_OFFS + * into shared memory window. + */ +typedef struct X25Mbox +{ + unsigned char opflag PACKED; /* 00h: execution flag */ + TX25Cmd cmd PACKED; /* 01h: command block */ + unsigned char data[1] PACKED; /* 10h: data buffer */ +} TX25Mbox; + +/*---------------------------------------------------------------------------- + * X.25 Time Stamp Structure. + */ +typedef struct X25TimeStamp +{ + unsigned char month PACKED; + unsigned char date PACKED; + unsigned char sec PACKED; + unsigned char min PACKED; + unsigned char hour PACKED; +} TX25TimeStamp; + +/*---------------------------------------------------------------------------- + * X.25 Status Block. + * This structure is located at offset X25_STATUS_OFF into shared memory + * window. + */ +typedef struct X25Status +{ + unsigned short pvc_map PACKED; /* 00h: PVC map */ + unsigned short icc_map PACKED; /* 02h: Incomming Chan. map */ + unsigned short twc_map PACKED; /* 04h: Two-way Cnan. map */ + unsigned short ogc_map PACKED; /* 06h: Outgoing Chan. map */ + TX25TimeStamp tstamp PACKED; /* 08h: timestamp (BCD) */ + unsigned char iflags PACKED; /* 0Dh: interrupt flags */ + unsigned char resrv[2] PACKED; /* 0Eh: */ + unsigned char gflags PACKED; /* 10h: misc. HDLC/X25 flags */ + unsigned char cflags[X25_MAX_CHAN] PACKED; /* channel status bytes */ +} TX25Status; + +/* + * Bitmasks for the 'iflags' field. + */ +#define X25_RX_INTR 0x01 /* receive interrupt */ +#define X25_TX_INTR 0x02 /* transmit interrupt */ +#define X25_MODEM_INTR 0x04 /* modem status interrupt (CTS/DCD) */ +#define X25_EVENT_INTR 0x10 /* asyncronous event encountered */ +#define X25_CMD_INTR 0x08 /* interface command complete */ + +/* + * Bitmasks for the 'gflags' field. + */ +#define X25_HDLC_ABM 0x01 /* HDLC is in ABM mode */ +#define X25_RX_READY 0x02 /* X.25 data available */ +#define X25_TRACE_READY 0x08 /* trace data available */ +#define X25_EVENT_IND 0x20 /* asynchronous event indicator */ +#define X25_TX_READY 0x40 /* space is available in Tx buf.*/ + +/* + * Bitmasks for the 'cflags' field. + */ +#define X25_XFER_MODE 0x80 /* channel is in data transfer mode */ +#define X25_TXWIN_OPEN 0x40 /* transmit window open */ +#define X25_RXBUF_MASK 0x3F /* number of data buffers available */ + +/***************************************************************************** + * Following definitions structurize contents of the TX25Mbox.data field for + * different X.25 interface commands. + ****************************************************************************/ + +/* --------------------------------------------------------------------------- + * X25_SET_GLOBAL_VARS Command. + */ +typedef struct X25GlobalVars +{ + unsigned char resrv PACKED; /* 00h: reserved */ + unsigned char dtrCtl PACKED; /* 01h: DTR control code */ + unsigned char resErr PACKED; /* 01h: '1' - reset modem error */ +} TX25GlobalVars; + +/* + * Defines for the 'dtrCtl' field. + */ +#define X25_RAISE_DTR 0x01 +#define X25_DROP_DTR 0x02 + +/* --------------------------------------------------------------------------- + * X25_READ_MODEM_STATUS Command. + */ +typedef struct X25ModemStatus +{ + unsigned char status PACKED; /* 00h: modem status */ +} TX25ModemStatus; + +/* + * Defines for the 'status' field. + */ +#define X25_CTS_MASK 0x20 +#define X25_DCD_MASK 0x08 + +/* --------------------------------------------------------------------------- + * X25_HDLC_LINK_STATUS Command. + */ +typedef struct X25LinkStatus +{ + unsigned char txQueued PACKED; /* 00h: queued Tx I-frames*/ + unsigned char rxQueued PACKED; /* 01h: queued Rx I-frames*/ + unsigned char station PACKED; /* 02h: DTE/DCE config. */ + unsigned char reserved PACKED; /* 03h: reserved */ + unsigned char sfTally PACKED; /* 04h: supervisory frame tally */ +} TX25LinkStatus; + +/* + * Defines for the 'station' field. + */ +#define X25_STATION_DTE 0x01 /* station configured as DTE */ +#define X25_STATION_DCE 0x02 /* station configured as DCE */ + +/* --------------------------------------------------------------------------- + * X25_HDLC_READ_STATS Command. + */ +typedef struct HdlcStats +{ /* a number of ... */ + unsigned short rxIFrames PACKED; /* 00h: ready Rx I-frames */ + unsigned short rxNoseq PACKED; /* 02h: frms out-of-sequence */ + unsigned short rxNodata PACKED; /* 04h: I-frms without data */ + unsigned short rxDiscarded PACKED; /* 06h: discarded frames */ + unsigned short rxTooLong PACKED; /* 08h: frames too long */ + unsigned short rxBadAddr PACKED; /* 0Ah: frms with inval.addr*/ + unsigned short txAcked PACKED; /* 0Ch: acknowledged I-frms */ + unsigned short txRetransm PACKED; /* 0Eh: re-transmit. I-frms */ + unsigned short t1Timeout PACKED; /* 10h: T1 timeouts */ + unsigned short rxSABM PACKED; /* 12h: received SABM frames */ + unsigned short rxDISC PACKED; /* 14h: received DISC frames */ + unsigned short rxDM PACKED; /* 16h: received DM frames */ + unsigned short rxFRMR PACKED; /* 18h: FRMR frames received */ + unsigned short txSABM PACKED; /* 1Ah: transm. SABM frames*/ + unsigned short txDISC PACKED; /* 1Ch: transm. DISC frames*/ + unsigned short txDM PACKED; /* 1Eh: transm. DM frames */ + unsigned short txFRMR PACKED; /* 20h: transm. FRMR frames*/ +} THdlcStats; + +/* --------------------------------------------------------------------------- + * X25_HDLC_READ_COMM_ERR Command. + */ +typedef struct HdlcCommErr +{ /* a number of ... */ + unsigned char rxOverrun PACKED; /* 00h: Rx overrun errors */ + unsigned char rxBadCrc PACKED; /* 01h: Rx CRC errors */ + unsigned char rxAborted PACKED; /* 02h: Rx aborted frames */ + unsigned char rxDropped PACKED; /* 03h: frames lost */ + unsigned char txAborted PACKED; /* 04h: Tx aborted frames */ + unsigned char txUnderrun PACKED; /* 05h: Tx underrun errors */ + unsigned char txMissIntr PACKED; /* 06h: missed underrun ints */ + unsigned char reserved PACKED; /* 07h: reserved */ + unsigned char droppedDCD PACKED; /* 08h: times DCD dropped */ + unsigned char droppedCTS PACKED; /* 09h: times CTS dropped */ +} THdlcCommErr; + +/* --------------------------------------------------------------------------- + * X25_SET_CONFIGURATION & X25_READ_CONFIGURATION Commands. + */ +typedef struct X25Config +{ + unsigned char baudRate PACKED; /* 00h: */ + unsigned char t1 PACKED; /* 01h: */ + unsigned char t2 PACKED; /* 02h: */ + unsigned char n2 PACKED; /* 03h: */ + unsigned short hdlcMTU PACKED; /* 04h: */ + unsigned char hdlcWindow PACKED; /* 06h: */ + unsigned char t4 PACKED; /* 07h: */ + unsigned char autoModem PACKED; /* 08h: */ + unsigned char autoHdlc PACKED; /* 09h: */ + unsigned char hdlcOptions PACKED; /* 0Ah: */ + unsigned char station PACKED; /* 0Bh: */ + unsigned char pktWindow PACKED; /* 0Ch: */ + unsigned short defPktSize PACKED; /* 0Dh: */ + unsigned short pktMTU PACKED; /* 0Fh: */ + unsigned short loPVC PACKED; /* 11h: */ + unsigned short hiPVC PACKED; /* 13h: */ + unsigned short loIncommingSVC PACKED; /* 15h: */ + unsigned short hiIncommingSVC PACKED; /* 17h: */ + unsigned short loTwoWaySVC PACKED; /* 19h: */ + unsigned short hiTwoWaySVC PACKED; /* 1Bh: */ + unsigned short loOutgoingSVC PACKED; /* 1Dh: */ + unsigned short hiOutgoingSVC PACKED; /* 1Fh: */ + unsigned short options PACKED; /* 21h: */ + unsigned char responseOpt PACKED; /* 23h: */ + unsigned short facil1 PACKED; /* 24h: */ + unsigned short facil2 PACKED; /* 26h: */ + unsigned short ccittFacil PACKED; /* 28h: */ + unsigned short otherFacil PACKED; /* 2Ah: */ + unsigned short ccittCompat PACKED; /* 2Ch: */ + unsigned char t10t20 PACKED; /* 2Eh: */ + unsigned char t11t21 PACKED; /* 2Fh: */ + unsigned char t12t22 PACKED; /* 30h: */ + unsigned char t13t23 PACKED; /* 31h: */ + unsigned char t16t26 PACKED; /* 32H: */ + unsigned char t28 PACKED; /* 33h: */ + unsigned char r10r20 PACKED; /* 34h: */ + unsigned char r12r22 PACKED; /* 35h: */ + unsigned char r13r23 PACKED; /* 36h: */ +} TX25Config; + +/* --------------------------------------------------------------------------- + * X25_READ_CHANNEL_CONFIG Command. + */ +typedef struct X25ChanAlloc /*----- Channel allocation -*/ +{ + unsigned short loPVC PACKED; /* 00h: lowest PVC number */ + unsigned short hiPVC PACKED; /* 02h: highest PVC number */ + unsigned short loIncommingSVC PACKED; /* 04h: lowest incoming SVC */ + unsigned short hiIncommingSVC PACKED; /* 06h: highest incoming SVC */ + unsigned short loTwoWaySVC PACKED; /* 08h: lowest two-way SVC */ + unsigned short hiTwoWaySVC PACKED; /* 0Ah: highest two-way SVC */ + unsigned short loOutgoingSVC PACKED; /* 0Ch: lowest outgoing SVC */ + unsigned short hiOutgoingSVC PACKED; /* 0Eh: highest outgoing SVC */ +} TX25ChanAlloc; + +typedef struct X25ChanCfg /*------ Channel configuration -----*/ +{ + unsigned char type PACKED; /* 00h: channel type */ + unsigned char txConf PACKED; /* 01h: Tx packet and window sizes */ + unsigned char rxConf PACKED; /* 01h: Rx packet and window sizes */ +} TX25ChanCfg; + +/* + * Defines for the 'type' field. + */ +#define X25_PVC 0x01 /* PVC */ +#define X25_SVC_IN 0x03 /* Incoming SVC */ +#define X25_SVC_TWOWAY 0x07 /* Two-way SVC */ +#define X25_SVC_OUT 0x0B /* Outgoing SVC */ + +/*---------------------------------------------------------------------------- + * X25_READ_STATISTICS Command. + */ +typedef struct X25Stats +{ /* number of packets Tx/Rx'ed */ + unsigned short txRestartRqst PACKED; /* 00h: Restart Request */ + unsigned short rxRestartRqst PACKED; /* 02h: Restart Request */ + unsigned short txRestartConf PACKED; /* 04h: Restart Confirmation */ + unsigned short rxRestartConf PACKED; /* 06h: Restart Confirmation */ + unsigned short txResetRqst PACKED; /* 08h: Reset Request */ + unsigned short rxResetRqst PACKED; /* 0Ah: Reset Request */ + unsigned short txResetConf PACKED; /* 0Ch: Reset Confirmation */ + unsigned short rxResetConf PACKED; /* 0Eh: Reset Confirmation */ + unsigned short txCallRequest PACKED; /* 10h: Call Request */ + unsigned short rxCallRequest PACKED; /* 12h: Call Request */ + unsigned short txCallAccept PACKED; /* 14h: Call Accept */ + unsigned short rxCallAccept PACKED; /* 16h: Call Accept */ + unsigned short txClearRqst PACKED; /* 18h: Clear Request */ + unsigned short rxClearRqst PACKED; /* 1Ah: Clear Request */ + unsigned short txClearConf PACKED; /* 1Ch: Clear Confirmation */ + unsigned short rxClearConf PACKED; /* 1Eh: Clear Confirmation */ + unsigned short txDiagnostic PACKED; /* 20h: Diagnostic */ + unsigned short rxDiagnostic PACKED; /* 22h: Diagnostic */ + unsigned short txRegRqst PACKED; /* 24h: Registration Request */ + unsigned short rxRegRqst PACKED; /* 26h: Registration Request */ + unsigned short txRegConf PACKED; /* 28h: Registration Confirm.*/ + unsigned short rxRegConf PACKED; /* 2Ah: Registration Confirm.*/ + unsigned short txInterrupt PACKED; /* 2Ch: Interrupt */ + unsigned short rxInterrupt PACKED; /* 2Eh: Interrupt */ + unsigned short txIntrConf PACKED; /* 30h: Interrupt Confirm. */ + unsigned short rxIntrConf PACKED; /* 32h: Interrupt Confirm. */ + unsigned short txData PACKED; /* 34h: Data */ + unsigned short rxData PACKED; /* 36h: Data */ + unsigned short txRR PACKED; /* 38h: RR */ + unsigned short rxRR PACKED; /* 3Ah: RR */ + unsigned short txRNR PACKED; /* 3Ch: RNR */ + unsigned short rxRNR PACKED; /* 3Eh: RNR */ +} X25Stats; + +/*---------------------------------------------------------------------------- + * X25_READ_HISTORY_TABLE Command. + */ +typedef struct X25EventLog +{ + unsigned char type PACKED; /* 00h: transaction type */ + unsigned short lcn PACKED; /* 01h: logical channel num */ + unsigned char packet PACKED; /* 03h: async packet type */ + unsigned char cause PACKED; /* 04h: X.25 cause field */ + unsigned char diag PACKED; /* 05h: X.25 diag field */ + TX25TimeStamp ts PACKED; /* 06h: time stamp */ +} TX25EventLog; + +/* + * Defines for the 'type' field. + */ +#define X25LOG_INCOMMING 0x00 +#define X25LOG_APPLICATION 0x01 +#define X25LOG_AUTOMATIC 0x02 +#define X25LOG_ERROR 0x04 +#define X25LOG_TIMEOUT 0x08 +#define X25LOG_RECOVERY 0x10 + +/* + * Defines for the 'packet' field. + */ +#define X25LOG_CALL_RQST 0x0B +#define X25LOG_CALL_ACCEPTED 0x0F +#define X25LOG_CLEAR_RQST 0x13 +#define X25LOG_CLEAR_CONFRM 0x17 +#define X25LOG_RESET_RQST 0x1B +#define X25LOG_RESET_CONFRM 0x1F +#define X25LOG_RESTART_RQST 0xFB +#define X25LOG_RESTART_COMFRM 0xFF +#define X25LOG_DIAGNOSTIC 0xF1 +#define X25LOG_DTE_REG_RQST 0xF3 +#define X25LOG_DTE_REG_COMFRM 0xF7 + +/* --------------------------------------------------------------------------- + * X25_TRACE_CONFIGURE Command. + */ +typedef struct X25TraceCfg +{ + unsigned char flags PACKED; /* 00h: trace configuration flags */ + unsigned char timeout PACKED; /* 01h: timeout for trace delay mode*/ +} TX25TraceCfg; + +/* + * Defines for the 'flags' field. + */ +#define X25_TRC_ENABLE 0x01 /* bit0: '1' - trace enabled */ +#define X25_TRC_TIMESTAMP 0x02 /* bit1: '1' - time stamping enabled*/ +#define X25_TRC_DELAY 0x04 /* bit2: '1' - trace delay enabled */ +#define X25_TRC_DATA 0x08 /* bit3: '1' - trace data packets */ +#define X25_TRC_SUPERVISORY 0x10 /* bit4: '1' - trace suprvisory pkts*/ +#define X25_TRC_ASYNCHRONOUS 0x20 /* bit5: '1' - trace asynch. packets*/ +#define X25_TRC_HDLC 0x40 /* bit6: '1' - trace all packets */ +#define X25_TRC_READ 0x80 /* bit7: '1' - get current config. */ + +/* --------------------------------------------------------------------------- + * X25_READ_TRACE_DATA Command. + */ +typedef struct X25Trace /*----- Trace data structure -------*/ +{ + unsigned short length PACKED; /* 00h: trace data length */ + unsigned char type PACKED; /* 02h: trace type */ + unsigned char lost_cnt PACKED; /* 03h: N of traces lost */ + TX25TimeStamp tstamp PACKED; /* 04h: mon/date/sec/min/hour */ + unsigned short millisec PACKED; /* 09h: ms time stamp */ + unsigned char data[0] PACKED; /* 0Bh: traced frame */ +} TX25Trace; + +/* + * Defines for the 'type' field. + */ +#define X25_TRC_TYPE_MASK 0x0F /* bits 0..3: trace type */ +#define X25_TRC_TYPE_RX_FRAME 0x00 /* received frame trace */ +#define X25_TRC_TYPE_TX_FRAME 0x01 /* transmitted frame */ +#define X25_TRC_TYPE_ERR_FRAME 0x02 /* error frame */ + +#define X25_TRC_ERROR_MASK 0xF0 /* bits 4..7: error code */ +#define X25_TRCERR_RX_ABORT 0x10 /* receive abort error */ +#define X25_TRCERR_RX_BADCRC 0x20 /* receive CRC error */ +#define X25_TRCERR_RX_OVERRUN 0x30 /* receiver overrun error */ +#define X25_TRCERR_RX_TOO_LONG 0x40 /* excessive frame length error */ +#define X25_TRCERR_TX_ABORT 0x70 /* aborted frame transmittion error */ +#define X25_TRCERR_TX_UNDERRUN 0x80 /* transmit underrun error */ + +/***************************************************************************** + * Following definitions describe HDLC frame and X.25 packet formats. + ****************************************************************************/ + +typedef struct HDLCFrame /*----- DHLC Frame Format ----------*/ +{ + unsigned char addr PACKED; /* address field */ + unsigned char cntl PACKED; /* control field */ + unsigned char data[0] PACKED; +} THDLCFrame; + +typedef struct X25Pkt /*----- X.25 Paket Format ----------*/ +{ + unsigned char lcn_hi PACKED; /* 4 MSB of Logical Channel Number */ + unsigned char lcn_lo PACKED; /* 8 LSB of Logical Channel Number */ + unsigned char type PACKED; + unsigned char data[0] PACKED; +} TX25Pkt; + +/* + * Defines for the 'lcn_hi' field. + */ +#define X25_Q_BIT_MASK 0x80 /* Data Qualifier Bit mask */ +#define X25_D_BIT_MASK 0x40 /* Delivery Confirmation Bit mask */ +#define X25_M_BITS_MASK 0x30 /* Modulo Bits mask */ +#define X25_LCN_MSB_MASK 0x0F /* LCN most significant bits mask */ + +/* + * Defines for the 'type' field. + */ +#define X25PKT_DATA 0x01 /* Data packet mask */ +#define X25PKT_SUPERVISORY 0x02 /* Supervisory packet mask */ +#define X25PKT_CALL_RQST 0x0B /* Call Request/Incoming */ +#define X25PKT_CALL_ACCEPTED 0x0F /* Call Accepted/Connected */ +#define X25PKT_CLEAR_RQST 0x13 /* Clear Request/Indication */ +#define X25PKT_CLEAR_CONFRM 0x17 /* Clear Confirmation */ +#define X25PKT_RESET_RQST 0x1B /* Reset Request/Indication */ +#define X25PKT_RESET_CONFRM 0x1F /* Reset Confirmation */ +#define X25PKT_RESTART_RQST 0xFB /* Restart Request/Indication */ +#define X25PKT_RESTART_CONFRM 0xFF /* Restart Confirmation */ +#define X25PKT_INTERRUPT 0x23 /* Interrupt */ +#define X25PKT_INTERRUPT_CONFRM 0x27 /* Interrupt Confirmation */ +#define X25PKT_DIAGNOSTIC 0xF1 /* Diagnostic */ +#define X25PKT_REGISTR_RQST 0xF3 /* Registration Request */ +#define X25PKT_REGISTR_CONFRM 0xF7 /* Registration Confirmation */ +#define X25PKT_RR_MASKED 0x01 /* Receive Ready packet after masking */ +#define X25PKT_RNR_MASKED 0x05 /* Receive Not Ready after masking */ + +#ifdef _MSC_ +# pragma pack() +#endif +#endif /* _SDLA_X25_H */ diff --git a/include/linux/sdladrv.h b/include/linux/sdladrv.h new file mode 100644 index 000000000..af18e4b9f --- /dev/null +++ b/include/linux/sdladrv.h @@ -0,0 +1,61 @@ +/***************************************************************************** +* sdladrv.h SDLA Support Module. Kernel API Definitions. +* +* Author: Gene Kozin <genek@compuserve.com> +* +* Copyright: (c) 1995-1996 Sangoma Technologies Inc. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version +* 2 of the License, or (at your option) any later version. +* ============================================================================ +* Dec 11, 1996 Gene Kozin Complete overhaul. +* Oct 17, 1996 Gene Kozin Minor bug fixes. +* Jun 12, 1996 Gene Kozin Added support for S503 card. +* Dec 06, 1995 Gene Kozin Initial version. +*****************************************************************************/ +#ifndef _SDLADRV_H +#define _SDLADRV_H + +#define SDLA_MAXIORANGE 4 /* maximum I/O port range */ +#define SDLA_WINDOWSIZE 0x2000 /* default dual-port memory window size */ + +/****** Data Structures *****************************************************/ + +/*---------------------------------------------------------------------------- + * Adapter hardware configuration. Pointer to this structure is passed to all + * APIs. + */ +typedef struct sdlahw +{ + unsigned type; /* adapter type */ + unsigned fwid; /* firmware ID */ + unsigned port; /* adapter I/O port base */ + int irq; /* interrupt request level */ + unsigned long dpmbase; /* dual-port memory base */ + unsigned dpmsize; /* dual-port memory size */ + unsigned pclk; /* CPU clock rate, kHz */ + unsigned long memory; /* memory size */ + unsigned long vector; /* local offset of the DPM window */ + unsigned io_range; /* I/O port range */ + unsigned char regs[SDLA_MAXIORANGE]; /* was written to registers */ + unsigned reserved[5]; +} sdlahw_t; + +/****** Function Prototypes *************************************************/ + +extern int sdla_setup (sdlahw_t* hw, void* sfm, unsigned len); +extern int sdla_down (sdlahw_t* hw); +extern int sdla_inten (sdlahw_t* hw); +extern int sdla_intde (sdlahw_t* hw); +extern int sdla_intack (sdlahw_t* hw); +extern int sdla_intr (sdlahw_t* hw); +extern int sdla_mapmem (sdlahw_t* hw, unsigned long addr); +extern int sdla_peek (sdlahw_t* hw, unsigned long addr, void* buf, + unsigned len); +extern int sdla_poke (sdlahw_t* hw, unsigned long addr, void* buf, + unsigned len); +extern int sdla_exec (void* opflag); + +#endif /* _SDLADRV_H */ diff --git a/include/linux/sdlasfm.h b/include/linux/sdlasfm.h new file mode 100644 index 000000000..65e7f30a8 --- /dev/null +++ b/include/linux/sdlasfm.h @@ -0,0 +1,92 @@ +/***************************************************************************** +* sdlasfm.h WANPIPE(tm) Multiprotocol WAN Link Driver. +* Definitions for the SDLA Firmware Module (SFM). +* +* Author: Gene Kozin <74604.152@compuserve.com> +* +* Copyright: (c) 1995-1996 Sangoma Technologies Inc. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version +* 2 of the License, or (at your option) any later version. +* ============================================================================ +* Dec 11, 1996 Gene Kozin Cosmetic changes +* Apr 16, 1996 Gene Kozin Changed adapter & firmware IDs. Version 2 +* Dec 15, 1995 Gene Kozin Structures chaned +* Nov 09, 1995 Gene Kozin Initial version. +*****************************************************************************/ +#ifndef _SDLASFM_H +#define _SDLASFM_H + +/****** Defines *************************************************************/ + +#define SFM_VERSION 2 +#define SFM_SIGNATURE "SFM - Sangoma SDLA Firmware Module" + +/* min/max */ +#define SFM_IMAGE_SIZE 0x8000 /* max size of SDLA code image file */ +#define SFM_DESCR_LEN 256 /* max length of description string */ +#define SFM_MAX_SDLA 16 /* max number of compatible adapters */ + +/* Adapter types */ +#define SDLA_S502A 5020 +#define SDLA_S502E 5021 +#define SDLA_S503 5030 +#define SDLA_S508 5080 +#define SDLA_S507 5070 +#define SDLA_S509 5090 + +/* Firmware identification numbers: + * 0 .. 999 Test & Diagnostics + * 1000 .. 1999 Streaming HDLC + * 2000 .. 2999 Bisync + * 3000 .. 3999 SDLC + * 4000 .. 4999 HDLC + * 5000 .. 5999 X.25 + * 6000 .. 6999 Frame Relay + * 7000 .. 7999 PPP + */ +#define SFID_CALIB502 200 +#define SFID_STRM502 1200 +#define SFID_STRM508 1800 +#define SFID_BSC502 2200 +#define SFID_SDLC502 3200 +#define SFID_HDLC502 4200 +#define SFID_X25_502 5200 +#define SFID_X25_508 5800 +#define SFID_FR502 6200 +#define SFID_FR508 6800 +#define SFID_PPP502 7200 +#define SFID_PPP508 7800 + +/****** Data Types **********************************************************/ + +typedef struct sfm_info /* firmware module information */ +{ + unsigned short codeid; /* firmware ID */ + unsigned short version; /* firmaware version number */ + unsigned short adapter[SFM_MAX_SDLA]; /* 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 short codesize; /* code size */ + unsigned short dataoffs; /* configuration data load offset */ + unsigned short datasize; /* configuration data size */ +} sfm_info_t; + +typedef struct sfm /* SDLA firmware file structire */ +{ + char signature[80]; /* SFM file signature */ + unsigned short version; /* file format version */ + unsigned short checksum; /* info + image */ + unsigned short reserved[6]; /* reserved */ + char descr[SFM_DESCR_LEN]; /* description string */ + sfm_info_t info; /* firmware module info */ + unsigned char image[1]; /* code image (variable size) */ +} sfm_t; + +#endif /* _SDLASFM_H */ + diff --git a/include/linux/serial.h b/include/linux/serial.h index 141c6706c..372a06e51 100644 --- a/include/linux/serial.h +++ b/include/linux/serial.h @@ -123,7 +123,10 @@ struct serial_multiport_struct { */ struct serial_icounter_struct { int cts, dsr, rng, dcd; - int reserved[16]; + int rx, tx; + int frame, overrun, parity, brk; + int buf_overrun; + int reserved[9]; }; @@ -144,7 +147,9 @@ struct serial_icounter_struct { * Counters of the input lines (CTS, DSR, RI, CD) interrupts */ struct async_icount { - __u32 cts, dsr, rng, dcd; + __u32 cts, dsr, rng, dcd, tx, rx; + __u32 frame, parity, overrun, brk; + __u32 buf_overrun; }; struct serial_state { @@ -178,13 +183,13 @@ struct async_struct { int read_status_mask; int ignore_status_mask; int timeout; + int quot; int x_char; /* xon/xoff character */ int close_delay; unsigned short closing_wait; unsigned short closing_wait2; int IER; /* Interrupt Enable Register */ int MCR; /* Modem control register */ - int MCR_noint; /* MCR with interrupts off */ unsigned long event; unsigned long last_active; int line; @@ -236,5 +241,6 @@ struct rs_multiport_struct { /* Export to allow PCMCIA to use this - Dave Hinds */ extern int register_serial(struct serial_struct *req); extern void unregister_serial(int line); + #endif /* __KERNEL__ */ #endif /* _LINUX_SERIAL_H */ diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 57302ca98..86a5e6417 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -20,12 +20,9 @@ #include <asm/atomic.h> #include <asm/types.h> -#define CONFIG_SKB_CHECK 0 - #define HAVE_ALLOC_SKB /* For the drivers to know */ #define HAVE_ALIGNABLE_SKB /* Ditto 8) */ - #define FREE_READ 1 #define FREE_WRITE 0 @@ -39,71 +36,61 @@ struct sk_buff_head struct sk_buff * prev; __u32 qlen; /* Must be same length as a pointer for using debugging */ -#if CONFIG_SKB_CHECK - int magic_debug_cookie; -#endif }; - struct sk_buff { struct sk_buff * next; /* Next buffer in list */ struct sk_buff * prev; /* Previous buffer in list */ struct sk_buff_head * list; /* List we are on */ -#if CONFIG_SKB_CHECK - int magic_debug_cookie; -#endif - struct sk_buff *link3; /* Link for IP protocol level buffer chains */ struct sock *sk; /* Socket we are owned by */ unsigned long when; /* used to compute rtt's */ struct timeval stamp; /* Time we arrived */ struct device *dev; /* Device we arrived on/are leaving by */ - union + + /* Transport layer header */ + union { struct tcphdr *th; - struct ethhdr *eth; - struct iphdr *iph; struct udphdr *uh; + struct icmphdr *icmph; + struct igmphdr *igmph; + struct iphdr *ipiph; + struct spxhdr *spxh; unsigned char *raw; - /* for passing file handles in a unix domain socket */ - void *filp; } h; + + /* Network layer header */ + union + { + struct iphdr *iph; + struct ipv6hdr *ipv6h; + struct arphdr *arph; + struct ipxhdr *ipxh; + unsigned char *raw; + } nh; + /* Link layer header */ union { - /* As yet incomplete physical layer views */ - unsigned char *raw; struct ethhdr *ethernet; + unsigned char *raw; } mac; - - struct iphdr *ip_hdr; /* For IPPROTO_RAW */ -#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) - struct ipv6hdr *ipv6_hdr; - - /* - * It would be inefficient to store the nexthop address in every - * skb. Instead we store a pointer to the respective neighbour - * cache entry. This might make ndisc cache management harder. - */ - - struct neighbour *nexthop; -#endif - unsigned int len; /* Length of actual data */ - unsigned int csum; /* Checksum */ - __u32 saddr; /* IP source address */ - __u32 daddr; /* IP target address */ - __u32 raddr; /* IP next hop address */ + + struct dst_entry *dst; + char cb[32]; + __u32 seq; /* TCP sequence number */ __u32 end_seq; /* seq [+ fin] [+ syn] + datalen */ __u32 ack_seq; /* TCP ack sequence number */ - unsigned char proto_priv[16]; /* Protocol private data */ - volatile char acked, /* Are we acked ? */ - used, /* Are we in use ? */ - free, /* How to free this buffer */ + + unsigned int len; /* Length of actual data */ + unsigned int csum; /* Checksum */ + volatile char used, /* Are we in use ? */ arp; /* Has IP/ARP resolution finished */ unsigned char tries, /* Times tried */ - lock, /* Are we locked ? */ - localroute, /* Local routing asserted for this frame */ + inclone, /* Inline clone */ + priority, pkt_type, /* Packet class */ pkt_bridged, /* Tracker for bridging */ ip_summed; /* Driver fed us an IP checksum */ @@ -112,9 +99,10 @@ struct sk_buff #define PACKET_MULTICAST 2 /* To group */ #define PACKET_OTHERHOST 3 /* To someone else */ #define PACKET_NDISC 17 /* Outgoing NDISC packet */ - unsigned short users; /* User count - see datagram.c,tcp.c */ + atomic_t users; /* User count - see datagram.c,tcp.c */ unsigned short protocol; /* Packet protocol from driver. */ - unsigned short truesize; /* Buffer size */ + unsigned short security; /* Security level of packet */ + unsigned int truesize; /* Buffer size */ atomic_t count; /* reference count */ struct sk_buff *data_skb; /* Link to the actual data skb */ @@ -123,10 +111,16 @@ struct sk_buff unsigned char *tail; /* Tail pointer */ unsigned char *end; /* End pointer */ void (*destructor)(struct sk_buff *); /* Destruct function */ - __u16 redirport; /* Redirect port */ - __u16 inclone; /* Inline clone */ #define SKB_CLONE_ORIG 1 #define SKB_CLONE_INLINE 2 + +#if defined(CONFIG_SHAPER) || defined(CONFIG_SHAPER_MODULE) + __u32 shapelatency; /* Latency on frame */ + __u32 shapeclock; /* Time it should go out */ + __u32 shapelen; /* Frame length in clocks */ + __u32 shapestamp; /* Stamp for shaper */ + __u16 shapepend; /* Pending */ +#endif }; #ifdef CONFIG_SKB_LARGE @@ -137,12 +131,6 @@ struct sk_buff #define SK_RMEM_MAX 32767 #endif -#if CONFIG_SKB_CHECK -#define SK_FREED_SKB 0x0DE2C0DE -#define SK_GOOD_SKB 0xDEC0DED1 -#define SK_HEAD_SKB 0x12231298 -#endif - #ifdef __KERNEL__ /* * Handling routines are only of interest to the kernel @@ -154,7 +142,7 @@ struct sk_buff #if 0 extern void print_skb(struct sk_buff *); #endif -extern void kfree_skb(struct sk_buff *skb, int rw); +extern void __kfree_skb(struct sk_buff *skb); extern void skb_queue_head_init(struct sk_buff_head *list); extern void skb_queue_head(struct sk_buff_head *list,struct sk_buff *buf); extern void skb_queue_tail(struct sk_buff_head *list,struct sk_buff *buf); @@ -169,10 +157,8 @@ extern struct sk_buff * dev_alloc_skb(unsigned int size); extern void kfree_skbmem(struct sk_buff *skb); extern struct sk_buff * skb_clone(struct sk_buff *skb, int priority); extern struct sk_buff * skb_copy(struct sk_buff *skb, int priority); -extern void skb_device_lock(struct sk_buff *skb); -extern void skb_device_unlock(struct sk_buff *skb); -extern void dev_kfree_skb(struct sk_buff *skb, int mode); -extern int skb_device_locked(struct sk_buff *skb); +extern struct sk_buff * skb_realloc_headroom(struct sk_buff *skb, int newheadroom); +#define dev_kfree_skb(a, b) kfree_skb((a), (b)) extern unsigned char * skb_put(struct sk_buff *skb, unsigned int len); extern unsigned char * skb_push(struct sk_buff *skb, unsigned int len); extern unsigned char * skb_pull(struct sk_buff *skb, unsigned int len); @@ -186,10 +172,33 @@ extern __inline__ int skb_queue_empty(struct sk_buff_head *list) return (list->next == (struct sk_buff *) list); } +extern __inline__ void kfree_skb(struct sk_buff *skb, int rw) +{ + if (atomic_dec_and_test(&skb->users)) + __kfree_skb(skb); +} + +extern __inline__ int skb_cloned(struct sk_buff *skb) +{ + return (atomic_read(&skb->data_skb->count) != 1); +} + +extern __inline__ int skb_shared(struct sk_buff *skb) +{ + return (atomic_read(&skb->users) != 1); +} + +/* + * Copy shared buffers into a new sk_buff. We effectively do COW on + * packets to handle cases where we have a local reader and forward + * and a couple of other messy ones. The normal one is tcpdumping + * a packet thats being forwarded. + */ + extern __inline__ struct sk_buff *skb_unshare(struct sk_buff *skb, int pri, int dir) { struct sk_buff *nskb; - if(skb->users==1) + if(!skb_cloned(skb)) return skb; nskb=skb_copy(skb, pri); kfree_skb(skb, dir); /* Free our shared copy */ @@ -202,6 +211,7 @@ extern __inline__ struct sk_buff *skb_unshare(struct sk_buff *skb, int pri, int * list and someone else may run off with it. For an interrupt * type system cli() peek the buffer copy the data and sti(); */ + extern __inline__ struct sk_buff *skb_peek(struct sk_buff_head *list_) { struct sk_buff *list = ((struct sk_buff *)list_)->next; @@ -219,14 +229,6 @@ extern __inline__ __u32 skb_queue_len(struct sk_buff_head *list_) return(list_->qlen); } -#if CONFIG_SKB_CHECK -extern int skb_check(struct sk_buff *skb,int,int, char *); -#define IS_SKB(skb) skb_check((skb), 0, __LINE__,__FILE__) -#define IS_SKB_HEAD(skb) skb_check((skb), 1, __LINE__,__FILE__) -#else -#define IS_SKB(skb) -#define IS_SKB_HEAD(skb) - extern __inline__ void skb_queue_head_init(struct sk_buff_head *list) { list->prev = (struct sk_buff *)list; @@ -422,7 +424,7 @@ extern __inline__ unsigned char *skb_put(struct sk_buff *skb, unsigned int len) { __label__ here; panic(skb_put_errstr,&&here,len); -here: +here: ; } return tmp; } @@ -436,7 +438,7 @@ extern __inline__ unsigned char *skb_push(struct sk_buff *skb, unsigned int len) { __label__ here; panic(skb_push_errstr, &&here,len); -here: +here: ; } return skb->data; } @@ -474,10 +476,43 @@ extern __inline__ void skb_trim(struct sk_buff *skb, unsigned int len) } } -#endif +/* dev_tint can lock buffer at any moment, + * so that cli(), unlink it and sti(), + * now it is safe. + */ + +extern __inline__ int skb_steal(struct sk_buff *skb) +{ + unsigned long flags; + + save_flags(flags); + cli(); + if (skb->next) { + skb_unlink(skb); + atomic_dec(&skb->users); + } + restore_flags(flags); + return 1; +} + +extern __inline__ void __skb_steal(struct sk_buff *skb) +{ + if (skb->next) { + skb_unlink(skb); + atomic_dec(&skb->users); + } +} + +extern __inline__ void skb_orphan(struct sk_buff *skb) +{ + if (skb->destructor) + skb->destructor(skb); + skb->destructor = NULL; + skb->sk = NULL; +} extern struct sk_buff * skb_recv_datagram(struct sock *sk,unsigned flags,int noblock, int *err); -extern int datagram_select(struct sock *sk, int sel_type, select_table *wait); +extern unsigned int datagram_poll(struct socket *sock, poll_table *wait); extern int skb_copy_datagram(struct sk_buff *from, int offset, char *to,int size); extern int skb_copy_datagram_iovec(struct sk_buff *from, int offset, struct iovec *to,int size); extern void skb_free_datagram(struct sock * sk, struct sk_buff *skb); diff --git a/include/linux/slab.h b/include/linux/slab.h new file mode 100644 index 000000000..ccd2ba1d3 --- /dev/null +++ b/include/linux/slab.h @@ -0,0 +1,60 @@ +/* + * linux/mm/slab.h + * Written by Mark Hemment, 1996. + * (markhe@nextd.demon.co.uk) + */ + +#if !defined(_LINUX_SLAB_H) +#define _LINUX_SLAB_H + +#if defined(__KERNEL__) + +typedef struct kmem_cache_s kmem_cache_t; + +#include <linux/mm.h> + +/* flags for kmem_cache_alloc() */ +#define SLAB_BUFFER GFP_BUFFER /* 0x00 */ +#define SLAB_ATOMIC GFP_ATOMIC /* 0x01 */ +#define SLAB_USER GFP_USER /* 0x02 */ +#define SLAB_KERNEL GFP_KERNEL /* 0x03 */ +#define SLAB_NOBUFFER GFP_NOBUFFER /* 0x04 */ +#define SLAB_NFS GFP_NFS /* 0x05 */ +#define SLAB_DMA GFP_DMA /* 0x08 */ +#define SLAB_LEVEL_MASK GFP_LEVEL_MASK /* 0x0f */ +#define SLAB_NO_GROW 0x00001000UL /* don't add another slab during an alloc */ + +/* flags to pass to kmem_cache_create(). + * The first 3 are only valid when the allocator has been build + * SLAB_DEBUG_SUPPORT. + */ +#define SLAB_DEBUG_FREE 0x00000100UL /* Peform time consuming ptr checks on free */ +#define SLAB_DEBUG_INITIAL 0x00000200UL /* Call constructor, on release, to conform state */ +#define SLAB_RED_ZONE 0x00000400UL /* Red zone objs in a cache */ +#define SLAB_HWCACHE_ALIGN 0x00000800UL /* align objs on an hw cache line */ + +/* flags passed to a constructor func */ +#define SLAB_CTOR_CONSTRUCTOR 0x001UL /* if not set, then deconstructor */ +#define SLAB_CTOR_ATOMIC 0x002UL /* tell constructor it can't sleep */ +#define SLAB_DTOR_ATOMIC 0x002UL /* tell deconstructor it can't sleep */ +#define SLAB_CTOR_VERIFY 0x004UL /* tell constructor it's a verify call */ + +/* prototypes */ +extern long kmem_cache_init(long, long); +extern void kmem_cache_sizes_init(void); +extern struct kmem_cache_s *kmem_cache_create(const char *, unsigned long, unsigned long, unsigned long, void (*)(void *, int, unsigned long), void (*)(void *, int, unsigned long)); +extern int kmem_cache_destroy(struct kmem_cache_s *); +extern int kmem_cache_shrink(struct kmem_cache_s *, int); +extern void *kmem_cache_alloc(struct kmem_cache_s *, unsigned long); +extern void kmem_cache_free(struct kmem_cache_s *, void *); +extern void *kmem_alloc(unsigned long, unsigned long); +extern void kmem_free(void *, unsigned long); +extern int kmem_cache_reap(int, int, int); +extern int get_slabinfo(char *); + +/* System wide slabs. */ +extern kmem_cache_t *vm_area_cachep; + +#endif /* __KERNEL__ */ + +#endif /* _LINUX_SLAB_H */ diff --git a/include/linux/smp_lock.h b/include/linux/smp_lock.h index 14c9f5b47..f49013267 100644 --- a/include/linux/smp_lock.h +++ b/include/linux/smp_lock.h @@ -1,9 +1,6 @@ #ifndef __LINUX_SMPLOCK_H #define __LINUX_SMPLOCK_H -#ifdef __SMP__ -#include <asm/pgtable.h> #include <asm/smp_lock.h> -#endif #endif diff --git a/include/linux/socket.h b/include/linux/socket.h index 21d7169bb..756d4cca6 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h @@ -4,6 +4,7 @@ #include <asm/socket.h> /* arch-dependent defines */ #include <linux/sockios.h> /* the SIOCxxx I/O controls */ #include <linux/uio.h> /* iovec support */ +#include <linux/types.h> /* pid_t */ typedef unsigned short sa_family_t; @@ -33,10 +34,10 @@ struct msghdr void * msg_name; /* Socket name */ int msg_namelen; /* Length of name */ struct iovec * msg_iov; /* Data blocks */ - size_t msg_iovlen; /* Number of blocks */ + __kernel_size_t msg_iovlen; /* Number of blocks */ void * msg_control; /* Per protocol magic (eg BSD file descriptor passing) */ - size_t msg_controllen; /* Length of rights list */ - int msg_flags; /* 4.4 BSD item we dont use */ + __kernel_size_t msg_controllen; /* Length of cmsg list */ + unsigned msg_flags; }; /* @@ -46,7 +47,7 @@ struct msghdr */ struct cmsghdr { - size_t cmsg_len; /* data byte count, including hdr */ + __kernel_size_t cmsg_len; /* data byte count, including hdr */ int cmsg_level; /* originating protocol */ int cmsg_type; /* protocol-specific type */ unsigned char cmsg_data[0]; @@ -57,11 +58,38 @@ struct cmsghdr { * Table 5-14 of POSIX 1003.1g */ -#define CMSG_DATA(cmsg) cmsg->cmsg_data +#define CMSG_DATA(cmsg) (cmsg)->cmsg_data #define CMSG_NXTHDR(mhdr, cmsg) cmsg_nxthdr(mhdr, cmsg) -#define CMSG_FIRST(mhdr) ((struct cmsghdr *) (mhdr)->msg_control) -extern __inline__ struct cmsghdr * cmsg_nxthdr(struct msghdr *mhdr, +#define CMSG_ALIGN(len) ( ((len)+sizeof(long)-1) & ~(sizeof(long)-1) ) + +/* Stevens's Adv. API specifies CMSG_SPACE & CMSG_LENGTH, + * I cannot understand, what the differenece? --ANK + */ + +#define CMSG_SPACE(len) CMSG_ALIGN((len)+sizeof(struct cmsghdr)) +#define CMSG_LENGTH(len) CMSG_ALIGN((len)+sizeof(struct cmsghdr)) + +#define CMSG_FIRSTHDR(msg) ((msg)->msg_controllen >= sizeof(struct cmsghdr) ? \ + (struct cmsghdr *)(msg)->msg_control : \ + (struct cmsghdr *)NULL) + +/* + * This mess will go away with glibc + */ + +#ifdef __KERNEL__ +#define KINLINE extern __inline__ +#else +#define KINLINE static +#endif + + +/* + * Get the next cmsg header + */ + +KINLINE struct cmsghdr * cmsg_nxthdr(struct msghdr *mhdr, struct cmsghdr *cmsg) { unsigned char * ptr; @@ -70,16 +98,25 @@ extern __inline__ struct cmsghdr * cmsg_nxthdr(struct msghdr *mhdr, { return NULL; } - ptr = ((unsigned char *) cmsg) + cmsg->cmsg_len; + ptr = ((unsigned char *) cmsg) + CMSG_ALIGN(cmsg->cmsg_len); if (ptr >= (unsigned char *) mhdr->msg_control + mhdr->msg_controllen) return NULL; return (struct cmsghdr *) ptr; } -/* Control Messages */ +/* "Socket"-level control message types: */ -#define SCM_RIGHTS 1 +#define SCM_RIGHTS 0x01 /* rw: access rights (array of int) */ +#define SCM_CREDENTIALS 0x02 /* rw: struct ucred */ +#define SCM_CONNECT 0x03 /* rw: struct scm_connect */ + +struct ucred +{ + __kernel_pid_t pid; + __kernel_uid_t uid; + __kernel_gid_t gid; +}; /* Supported address families. */ @@ -98,6 +135,7 @@ extern __inline__ struct cmsghdr * cmsg_nxthdr(struct msghdr *mhdr, #define AF_ROSE 11 /* Amateur Radio X.25 PLP */ #define AF_DECNET 12 /* Reserved for DECnet project */ #define AF_NETBEUI 13 /* Reserved for 802.2LLC project*/ +#define AF_SECURITY 14 /* Security callback pseudo AF */ #define AF_MAX 32 /* For now.. */ /* Protocol families, same as address families. */ @@ -113,9 +151,10 @@ extern __inline__ struct cmsghdr * cmsg_nxthdr(struct msghdr *mhdr, #define PF_AAL5 AF_AAL5 #define PF_X25 AF_X25 #define PF_INET6 AF_INET6 -#define PR_ROSE AF_ROSE +#define PF_ROSE AF_ROSE #define PF_DECNET AF_DECNET #define PF_NETBEUI AF_NETBEUI +#define PF_SECURITY AF_SECURITY #define PF_MAX AF_MAX @@ -126,17 +165,25 @@ extern __inline__ struct cmsghdr * cmsg_nxthdr(struct msghdr *mhdr, Added those for 1003.1g not all are supported yet */ -enum -{ - MSG_OOB = 0x01, /* Process out-of-band data. */ - MSG_PEEK = 0x02, /* Peek at incoming messages. */ - MSG_DONTROUTE = 0x04, /* Don't use local routing. */ - MSG_CTRUNC = 0x08, /* We need to support this for BSD oddments */ - MSG_PROXY = 0x10, /* Supply or ask second address. */ - MSG_EOR = 0x20, /* End of record */ - MSG_TRUNC = 0x40, /* Data was discarded before delivery */ - MSG_WAITALL = 0x80, /* Wait for a full request */ -}; +#define MSG_OOB 1 +#define MSG_PEEK 2 +#define MSG_DONTROUTE 4 +#define MSG_CTRUNC 8 +#define MSG_PROXY 0x10 /* Supply or ask second address. */ +#define MSG_TRUNC 0x20 +#define MSG_DONTWAIT 0x40 /* Nonblocking io */ +#define MSG_EOR 0x80 /* End of record */ +#define MSG_WAITALL 0x100 /* Wait for a full request */ +#define MSG_FIN 0x200 +#define MSG_SYN 0x400 +#define MSG_URG 0x800 +#define MSG_RST 0x1000 + +#define MSG_CTLIGNORE 0x80000000 + +#define MSG_EOF MSG_FIN +#define MSG_CTLFLAGS (MSG_OOB|MSG_URG|MSG_FIN|MSG_SYN|MSG_RST) + /* Setsockoptions(2) level. Thanks to BSD these must match IPPROTO_xxx */ #define SOL_IP 0 @@ -153,27 +200,6 @@ enum #define SOL_TCP 6 #define SOL_UDP 17 -/* IP options */ -#define IP_TOS 1 -#define IPTOS_LOWDELAY 0x10 -#define IPTOS_THROUGHPUT 0x08 -#define IPTOS_RELIABILITY 0x04 -#define IPTOS_MINCOST 0x02 -#define IP_TTL 2 -#define IP_HDRINCL 3 -#define IP_OPTIONS 4 - -#define IP_MULTICAST_IF 32 -#define IP_MULTICAST_TTL 33 -#define IP_MULTICAST_LOOP 34 -#define IP_ADD_MEMBERSHIP 35 -#define IP_DROP_MEMBERSHIP 36 - -/* These need to appear somewhere around here */ -#define IP_DEFAULT_MULTICAST_TTL 1 -#define IP_DEFAULT_MULTICAST_LOOP 1 -#define IP_MAX_MEMBERSHIPS 20 - /* IPX options */ #define IPX_TYPE 1 @@ -199,5 +225,6 @@ extern int verify_iovec(struct msghdr *m, struct iovec *iov, char *address, int extern int memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len); extern int move_addr_to_user(void *kaddr, int klen, void *uaddr, int *ulen); extern int move_addr_to_kernel(void *uaddr, int ulen, void *kaddr); +extern void put_cmsg(struct msghdr*, int level, int type, int len, void *data); #endif #endif /* _LINUX_SOCKET_H */ diff --git a/include/linux/sockios.h b/include/linux/sockios.h index 3ec71128e..5be29bc57 100644 --- a/include/linux/sockios.h +++ b/include/linux/sockios.h @@ -23,6 +23,7 @@ /* Routing table calls. */ #define SIOCADDRT 0x890B /* add routing table entry */ #define SIOCDELRT 0x890C /* delete routing table entry */ +#define SIOCRTMSG 0x890D /* call to routing system */ /* Socket configuration controls. */ #define SIOCGIFNAME 0x8910 /* get iface name */ diff --git a/include/linux/soundcard.h b/include/linux/soundcard.h index 3b6af75fa..bb338c462 100644 --- a/include/linux/soundcard.h +++ b/include/linux/soundcard.h @@ -1,7 +1,7 @@ #ifndef SOUNDCARD_H #define SOUNDCARD_H /* - * Copyright by Hannu Savolainen 1993-1996 + * Copyright by Hannu Savolainen 1993-1997 * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -33,7 +33,7 @@ * Use ioctl(fd, OSS_GETVERSION, &int) to get the version number of * the currently active driver. */ -#define SOUND_VERSION 0x030700 +#define SOUND_VERSION 0x0307f1 #define OPEN_SOUND_SYSTEM /* In Linux we need to be prepared for cross compiling */ @@ -76,13 +76,18 @@ */ #ifndef _SIOWR -#if defined(_IOWR) && !defined(sun) +#if defined(_IOWR) && !defined(sun) && !defined(sparc) /* Use already defined ioctl defines if they exist (except with Sun) */ #define SIOCPARM_MASK IOCPARM_MASK #define SIOC_VOID IOC_VOID #define SIOC_OUT IOC_OUT #define SIOC_IN IOC_IN #define SIOC_INOUT IOC_INOUT +#define _SIOC_SIZE _IOC_SIZE +#define _SIOC_DIR _IOC_DIR +#define _SIOC_NONE _IOC_NONE +#define _SIOC_READ _IOC_READ +#define _SIOC_WRITE _IOC_WRITE #define _SIO _IO #define _SIOR _IOR #define _SIOW _IOW @@ -93,7 +98,7 @@ * and the size of any in or out parameters in the upper * word. The high 2 bits of the upper word are used * to encode the in/out status of the parameter; for now - * we restrict parameters to at most 128 bytes. + * we restrict parameters to at most 8191 bytes. */ /* #define SIOCTYPE (0xff<<8) */ #define SIOCPARM_MASK 0x1fff /* parameters must be < 8192 bytes */ @@ -107,6 +112,11 @@ #define _SIOW(x,y,t) ((int)(SIOC_IN|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y)) /* this should be _SIORW, but stdio got there first */ #define _SIOWR(x,y,t) ((int)(SIOC_INOUT|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y)) +#define _SIOC_SIZE(x) ((x>>16)&SIOCPARM_MASK) +#define _SIOC_DIR(x) (x & 0xf0000000) +#define _SIOC_NONE SIOC_VOID +#define _SIOC_READ SIOC_OUT +#define _SIOC_WRITE SIOC_IN # endif /* _IOWR */ #endif /* !_SIOWR */ @@ -129,6 +139,7 @@ #define SNDCTL_SEQ_PANIC _SIO ('Q',17) #define SNDCTL_SEQ_OUTOFBAND _SIOW ('Q',18, struct seq_event_rec) #define SNDCTL_SEQ_GETTIME _SIOR ('Q',19, int) +#define SNDCTL_SYNTH_ID _SIOWR('Q',20, struct synth_info) struct seq_event_rec { unsigned char arr[8]; @@ -166,13 +177,13 @@ * Sample loading mechanism for internal synthesizers (/dev/sequencer) * The following patch_info structure has been designed to support * Gravis UltraSound. It tries to be universal format for uploading - * sample based patches but is propably too limited. + * sample based patches but is probably too limited. */ struct patch_info { - unsigned short key; /* Use GUS_PATCH here */ -#define GUS_PATCH _PATCHKEY(0x04) -#define OBSOLETE_GUS_PATCH _PATCHKEY(0x02) + unsigned short key; /* Use WAVE_PATCH here */ +#define WAVE_PATCH _PATCHKEY(0x04) +#define GUS_PATCH WAVE_PATCH short device_no; /* Synthesizer number */ short instr_no; /* Midi pgm# */ @@ -189,6 +200,7 @@ struct patch_info { #define WAVE_LOOP_BACK 0x10 /* bit 4 = Set is looping backward. */ #define WAVE_SUSTAIN_ON 0x20 /* bit 5 = Turn sustaining on. (Env. pts. 3)*/ #define WAVE_ENVELOPES 0x40 /* bit 6 = Enable envelopes - 1 */ +#define WAVE_FAST_RELEASE 0x80 /* bit 7 = Shut off immediately after note off */ /* (use the env_rate/env_offs fields). */ /* Linux specific bits */ #define WAVE_VIBRATO 0x00010000 /* The vibrato info is valid */ @@ -257,7 +269,7 @@ struct patch_info { }; struct sysex_info { - short key; /* Use GUS_PATCH here */ + short key; /* Use SYSEX_PATCH or MAUI_PATCH here */ #define SYSEX_PATCH _PATCHKEY(0x05) #define MAUI_PATCH _PATCHKEY(0x06) short device_no; /* Synthesizer number */ @@ -413,8 +425,8 @@ struct sysex_info { * Set the key field of the structure to FM_PATCH. The device field is used to * route the patch to the corresponding device. * - * For Gravis UltraSound use struct patch_info. Initialize the key field - * to GUS_PATCH. + * For wave table use struct patch_info. Initialize the key field + * to WAVE_PATCH. */ #define SEQ_PRIVATE 0xfe /* Low level HW dependent events (8 bytes) */ #define SEQ_EXTENDED 0xff /* Extended events (8 bytes) OBSOLETE */ @@ -447,7 +459,8 @@ struct synth_info { /* Read only */ #define FM_TYPE_OPL3 0x01 #define MIDI_TYPE_MPU401 0x401 -#define SAMPLE_TYPE_GUS 0x10 +#define SAMPLE_TYPE_BASIC 0x10 +#define SAMPLE_TYPE_GUS SAMPLE_TYPE_BASIC int perc_mode; /* No longer supported */ int nr_voices; @@ -572,6 +585,22 @@ typedef struct buffmem_desc { #define SNDCTL_DSP_SETSYNCRO _SIO ('P', 21) #define SNDCTL_DSP_SETDUPLEX _SIO ('P', 22) +/* + * Application's profile defines the way how playback underrun situations should be handled. + * + * APF_NORMAL (the default) and APF_NETWORK make the driver to cleanup the + * playback buffer whenever an underrun occurs. This consumes some time + * preven's looping the existing buffer. + * APF_CPUINTENS is intended to be set by CPU intensive applications which + * are likely to run out of time occasionally. In this mode the buffer cleanup is + * disabled which saves CPU time but also let's the previous buffer content to + * be played during the "pause" after the underrun. + */ +#define SNDCTL_DSP_PROFILE _SIOW ('P', 23, int) +#define APF_NORMAL 0 /* Normal applications */ +#define APF_NETWORK 1 /* Underruns probably caused by an "external" delay */ +#define APF_CPUINTENS 2 /* Underruns probably caused by "overheating" the CPU */ + #define SOUND_PCM_READ_RATE _SIOR ('P', 2, int) #define SOUND_PCM_READ_CHANNELS _SIOR ('P', 6, int) #define SOUND_PCM_READ_BITS _SIOR ('P', 5, int) @@ -928,10 +957,45 @@ typedef struct mixer_vol_table { * * These macros define the API which should be used when possible. */ +#define SEQ_DECLAREBUF() SEQ_USE_EXTBUF() -#ifndef USE_SIMPLE_MACROS void seqbuf_dump(void); /* This function must be provided by programs */ +extern int OSS_init(int seqfd, int buflen); +extern void OSS_seqbuf_dump(int fd, unsigned char *buf, int buflen); +extern void OSS_seq_advbuf(int len, int fd, unsigned char *buf, int buflen); +extern void OSS_seq_needbuf(int len, int fd, unsigned char *buf, int buflen); +extern void OSS_patch_caching(int dev, int chn, int patch, + int fd, unsigned char *buf, int buflen); +extern void OSS_drum_caching(int dev, int chn, int patch, + int fd, unsigned char *buf, int buflen); +extern void OSS_write_patch(int fd, unsigned char *buf, int len); +extern int OSS_write_patch2(int fd, unsigned char *buf, int len); + +#define SEQ_PM_DEFINES int __foo_bar___ +#ifdef OSSLIB +# define SEQ_USE_EXTBUF() \ + extern unsigned char *_seqbuf; \ + extern int _seqbuflen;extern int _seqbufptr +# define SEQ_DEFINEBUF(len) SEQ_USE_EXTBUF();static int _requested_seqbuflen=len +# define _SEQ_ADVBUF(len) OSS_seq_advbuf(len, seqfd, _seqbuf, _seqbuflen) +# define _SEQ_NEEDBUF(len) OSS_seq_needbuf(len, seqfd, _seqbuf, _seqbuflen) +# define SEQ_DUMPBUF() OSS_seqbuf_dump(seqfd, _seqbuf, _seqbuflen) + +# define SEQ_LOAD_GMINSTR(dev, instr) \ + OSS_patch_caching(dev, -1, instr, seqfd, _seqbuf, _seqbuflen) +# define SEQ_LOAD_GMDRUM(dev, drum) \ + OSS_drum_caching(dev, -1, drum, seqfd, _seqbuf, _seqbuflen) +#else /* !OSSLIB */ + +# define SEQ_LOAD_GMINSTR(dev, instr) +# define SEQ_LOAD_GMDRUM(dev, drum) + +# define SEQ_USE_EXTBUF() \ + extern unsigned char _seqbuf[]; \ + extern int _seqbuflen;extern int _seqbufptr + +#ifndef USE_SIMPLE_MACROS /* Sample seqbuf_dump() implementation: * * SEQ_DEFINEBUF (2048); -- Defines a buffer for 2048 bytes @@ -952,8 +1016,6 @@ void seqbuf_dump(void); /* This function must be provided by programs */ */ #define SEQ_DEFINEBUF(len) unsigned char _seqbuf[len]; int _seqbuflen = len;int _seqbufptr = 0 -#define SEQ_USE_EXTBUF() extern unsigned char _seqbuf[]; extern int _seqbuflen;extern int _seqbufptr -#define SEQ_DECLAREBUF() SEQ_USE_EXTBUF() #define _SEQ_NEEDBUF(len) if ((_seqbufptr+(len)) > _seqbuflen) seqbuf_dump() #define _SEQ_ADVBUF(len) _seqbufptr += len #define SEQ_DUMPBUF seqbuf_dump @@ -974,6 +1036,7 @@ void seqbuf_dump(void); /* This function must be provided by programs */ */ #define _SEQ_NEEDBUF(len) /* empty */ #endif +#endif /* !OSSLIB */ #define SEQ_VOLUME_MODE(dev, mode) {_SEQ_NEEDBUF(8);\ _seqbuf[_seqbufptr] = SEQ_EXTENDED;\ @@ -1041,18 +1104,30 @@ void seqbuf_dump(void); /* This function must be provided by programs */ * cause fatal problems with some other devices (such as MPU401). */ #define SEQ_SYSEX(dev, buf, len) \ - {int i, l=(len); if (l>6)l=6;\ + {int ii, ll=(len); \ + unsigned char *bufp=buf;\ + if (ll>6)ll=6;\ _SEQ_NEEDBUF(8);\ _seqbuf[_seqbufptr] = EV_SYSEX;\ - for(i=0;i<l;i++)_seqbuf[_seqbufptr+i+1] = (buf)[i];\ - for(i=l;i<6;i++)_seqbuf[_seqbufptr+i+1] = 0xff;\ + _seqbuf[_seqbufptr+1] = (dev);\ + for(ii=0;ii<ll;ii++)\ + _seqbuf[_seqbufptr+ii+2] = bufp[ii];\ + for(ii=ll;ii<6;ii++)\ + _seqbuf[_seqbufptr+ii+2] = 0xff;\ _SEQ_ADVBUF(8);} #define SEQ_CHN_PRESSURE(dev, chn, pressure) \ _CHN_COMMON(dev, MIDI_CHN_PRESSURE, chn, pressure, 0, 0) -#define SEQ_SET_PATCH(dev, chn, patch) \ +#define SEQ_SET_PATCH SEQ_PGM_CHANGE +#ifdef OSSLIB +# define SEQ_PGM_CHANGE(dev, chn, patch) \ + {OSS_patch_caching(dev, chn, patch, seqfd, _seqbuf, _seqbuflen); \ + _CHN_COMMON(dev, MIDI_PGM_CHANGE, chn, patch, 0, 0);} +#else +# define SEQ_PGM_CHANGE(dev, chn, patch) \ _CHN_COMMON(dev, MIDI_PGM_CHANGE, chn, patch, 0, 0) +#endif #define SEQ_CONTROL(dev, chn, controller, value) \ _CHN_COMMON(dev, MIDI_CTL_CHANGE, chn, controller, 0, value) @@ -1130,10 +1205,19 @@ void seqbuf_dump(void); /* This function must be provided by programs */ /* * Patch loading. */ -#define SEQ_WRPATCH(patchx, len) {if (_seqbufptr) seqbuf_dump();\ - if (write(seqfd, (char*)(patchx), len)==-1) \ - perror("Write patch: /dev/sequencer");} -#define SEQ_WRPATCH2(patchx, len) (seqbuf_dump(), write(seqfd, (char*)(patchx), len)) +#ifdef OSSLIB +# define SEQ_WRPATCH(patchx, len) \ + OSS_write_patch(seqfd, (char*)(patchx), len) +# define SEQ_WRPATCH2(patchx, len) \ + OSS_write_patch2(seqfd, (char*)(patchx), len) +#else +# define SEQ_WRPATCH(patchx, len) \ + {if (_seqbufptr) SEQ_DUMPBUF();\ + if (write(seqfd, (char*)(patchx), len)==-1) \ + perror("Write patch: /dev/sequencer");} +# define SEQ_WRPATCH2(patchx, len) \ + (SEQ_DUMPBUF(), write(seqfd, (char*)(patchx), len)) +#endif #endif #endif diff --git a/include/linux/soundmodem.h b/include/linux/soundmodem.h index 0bea35fce..43ad5e3a2 100644 --- a/include/linux/soundmodem.h +++ b/include/linux/soundmodem.h @@ -15,9 +15,10 @@ */ struct sm_debug_data { - unsigned long debug1; - unsigned long debug2; - long debug3; + unsigned int int_rate; + unsigned int mod_cycles; + unsigned int demod_cycles; + unsigned int dma_residue; }; struct sm_diag_data { @@ -54,26 +55,12 @@ struct sm_ioctl { /* -------------------------------------------------------------------- */ /* - * config: hardware - */ -#define SM_HARDWARE_INVALID -1 -#define SM_HARDWARE_SBC 0 -#define SM_HARDWARE_WSS 1 -#define SM_HARDWARE_WSSFDX 2 /* currently does not work! */ - -/* - * config: mode - */ -#define SM_MODE_INVALID -1 -#define SM_MODE_AFSK1200 0 -#define SM_MODE_FSK9600 1 - -/* * diagnose modes */ -#define SM_DIAGMODE_OFF 0 -#define SM_DIAGMODE_INPUT 1 -#define SM_DIAGMODE_DEMOD 2 +#define SM_DIAGMODE_OFF 0 +#define SM_DIAGMODE_INPUT 1 +#define SM_DIAGMODE_DEMOD 2 +#define SM_DIAGMODE_CONSTELLATION 3 /* * diagnose flags @@ -86,6 +73,7 @@ struct sm_ioctl { */ #define SM_MIXER_INVALID 0 #define SM_MIXER_AD1848 0x10 +#define SM_MIXER_CRYSTAL 0x11 #define SM_MIXER_CT1335 0x20 #define SM_MIXER_CT1345 0x21 #define SM_MIXER_CT1745 0x22 @@ -93,8 +81,6 @@ struct sm_ioctl { /* * ioctl values */ -#define SMCTL_GETMODEMTYPE 0x80 -#define SMCTL_SETMODEMTYPE 0x81 #define SMCTL_DIAGNOSE 0x82 #define SMCTL_GETMIXER 0x83 #define SMCTL_SETMIXER 0x84 diff --git a/include/linux/stallion.h b/include/linux/stallion.h index b1aa738bc..f277551fe 100644 --- a/include/linux/stallion.h +++ b/include/linux/stallion.h @@ -3,6 +3,7 @@ /* * stallion.h -- stallion multiport serial driver. * + * Copyright (C) 1996-1997 Stallion Technologies (support@stallion.oz.au). * Copyright (C) 1994-1996 Greg Ungerer (gerg@stallion.oz.au). * * This program is free software; you can redistribute it and/or modify @@ -30,6 +31,7 @@ */ #define STL_MAXBRDS 4 #define STL_MAXPANELS 4 +#define STL_MAXBANKS 8 #define STL_PORTSPERPANEL 16 #define STL_MAXPORTS 64 #define STL_MAXDEVS (STL_MAXBRDS * STL_MAXPORTS) @@ -65,7 +67,7 @@ typedef struct { * is associated with, this makes it (fairly) easy to get back to the * board/panel info for a port. */ -typedef struct { +typedef struct stlport { unsigned long magic; int portnr; int panelnr; @@ -87,8 +89,11 @@ typedef struct { unsigned int sigs; unsigned int rxignoremsk; unsigned int rxmarkmsk; + unsigned int imr; + unsigned int crenable; unsigned long clk; unsigned long hwid; + void *uartp; struct tty_struct *tty; struct wait_queue *open_wait; struct wait_queue *close_wait; @@ -99,27 +104,31 @@ typedef struct { stlrq_t tx; } stlport_t; -typedef struct { +typedef struct stlpanel { unsigned long magic; int panelnr; int brdnr; int pagenr; int nrports; int iobase; + void *uartp; + void (*isr)(struct stlpanel *panelp, unsigned int iobase); unsigned int hwid; unsigned int ackmask; stlport_t *ports[STL_PORTSPERPANEL]; } stlpanel_t; -typedef struct { +typedef struct stlbrd { unsigned long magic; int brdnr; int brdtype; int state; int nrpanels; int nrports; + int nrbnks; int irq; int irqtype; + void (*isr)(struct stlbrd *brdp); unsigned int ioaddr1; unsigned int ioaddr2; unsigned int iostatus; @@ -127,6 +136,9 @@ typedef struct { unsigned int ioctrlval; unsigned int hwid; unsigned long clk; + unsigned int bnkpageaddr[STL_MAXBANKS]; + unsigned int bnkstataddr[STL_MAXBANKS]; + stlpanel_t *bnk2panel[STL_MAXBANKS]; stlpanel_t *panels[STL_MAXPANELS]; } stlbrd_t; diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h new file mode 100644 index 000000000..3bea6651d --- /dev/null +++ b/include/linux/sunrpc/auth.h @@ -0,0 +1,99 @@ +/* + * linux/include/linux/auth.h + * + * Declarations for the RPC authentication machinery. + * + * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de> + */ + +#ifndef _LINUX_SUNRPC_AUTH_H +#define _LINUX_SUNRPC_AUTH_H + +#ifdef __KERNEL__ + +#include <linux/config.h> +#include <linux/sunrpc/sched.h> + + +/* + * Client user credentials + */ +struct rpc_cred { + struct rpc_cred * cr_next; /* linked list */ + unsigned long cr_expire; /* when to gc */ + unsigned short cr_count; /* ref count */ + unsigned short cr_flags; /* various flags */ + + uid_t cr_uid; + + /* per-flavor data */ +}; +#define RPCAUTH_CRED_LOCKED 0x0001 +#define RPCAUTH_CRED_UPTODATE 0x0002 +#define RPCAUTH_CRED_DEAD 0x0004 + +/* + * Client authentication handle + */ +#define RPC_CREDCACHE_NR 8 +struct rpc_auth { + struct rpc_cred * au_credcache[RPC_CREDCACHE_NR]; + unsigned long au_expire; /* cache expiry interval */ + unsigned long au_nextgc; /* next garbage collection */ + unsigned int au_cslack; /* call cred size estimate */ + unsigned int au_rslack; /* reply verf size guess */ + unsigned int au_flags; /* various flags */ + struct rpc_authops * au_ops; /* operations */ + + /* per-flavor data */ +}; +#define RPC_AUTH_PROC_CREDS 0x0010 /* process creds (including + * uid/gid, fs[ug]id, gids) + */ + +/* + * Client authentication ops + */ +struct rpc_authops { + unsigned int au_flavor; /* flavor (RPC_AUTH_*) */ +#ifdef RPC_DEBUG + char * au_name; +#endif + struct rpc_auth * (*create)(struct rpc_clnt *); + void (*destroy)(struct rpc_auth *); + + struct rpc_cred * (*crcreate)(struct rpc_task *); + void (*crdestroy)(struct rpc_cred *); + + int (*crmatch)(struct rpc_task *, struct rpc_cred*); + u32 * (*crmarshal)(struct rpc_task *, u32 *, int); + int (*crrefresh)(struct rpc_task *); + u32 * (*crvalidate)(struct rpc_task *, u32 *); +}; + +extern struct rpc_authops authunix_ops; +extern struct rpc_authops authnull_ops; +#ifdef CONFIG_SUNRPC_SECURE +extern struct rpc_authops authdes_ops; +#endif + +int rpcauth_register(struct rpc_authops *); +int rpcauth_unregister(struct rpc_authops *); +struct rpc_auth * rpcauth_create(unsigned int, struct rpc_clnt *); +void rpcauth_destroy(struct rpc_auth *); +struct rpc_cred * rpcauth_lookupcred(struct rpc_task *); +void rpcauth_holdcred(struct rpc_task *); +void rpcauth_releasecred(struct rpc_task *); +int rpcauth_matchcred(struct rpc_task *, struct rpc_cred *); +u32 * rpcauth_marshcred(struct rpc_task *, u32 *); +u32 * rpcauth_checkverf(struct rpc_task *, u32 *); +int rpcauth_refreshcred(struct rpc_task *); +void rpcauth_invalcred(struct rpc_task *); +int rpcauth_uptodatecred(struct rpc_task *); +void rpcauth_init_credcache(struct rpc_auth *); +void rpcauth_free_credcache(struct rpc_auth *); +void rpcauth_insert_credcache(struct rpc_auth *, + struct rpc_cred *); + +#endif /* __KERNEL__ */ +#endif /* _LINUX_SUNRPC_AUTH_H */ diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h new file mode 100644 index 000000000..17e80e975 --- /dev/null +++ b/include/linux/sunrpc/clnt.h @@ -0,0 +1,135 @@ +/* + * linux/include/linux/sunrpc/clnt.h + * + * Declarations for the high-level RPC client interface + * + * Copyright (C) 1995, 1996, Olaf Kirch <okir@monad.swb.de> + */ + +#ifndef _LINUX_SUNRPC_CLNT_H +#define _LINUX_SUNRPC_CLNT_H + +#include <linux/sunrpc/msg_prot.h> +#include <linux/sunrpc/sched.h> +#include <linux/sunrpc/xprt.h> +#include <linux/sunrpc/auth.h> +#include <linux/sunrpc/stats.h> +#include <linux/sunrpc/xdr.h> + +/* + * This defines an RPC port mapping + */ +struct rpc_portmap { + __u32 pm_prog; + __u32 pm_vers; + __u32 pm_prot; + __u32 pm_port; +}; + +/* + * The high-level client handle + */ +struct rpc_clnt { + struct rpc_xprt * cl_xprt; /* transport */ + struct rpc_procinfo * cl_procinfo; /* procedure info */ + u32 cl_maxproc; /* max procedure number */ + + char * cl_server; /* server machine name */ + char * cl_protname; /* protocol name */ + struct rpc_auth * cl_auth; /* authenticator */ + struct rpc_portmap cl_pmap; /* port mapping */ + struct rpc_stat * cl_stats; /* statistics */ + + unsigned int cl_softrtry : 1,/* soft timeouts */ + cl_intr : 1,/* interruptible */ + cl_chatty : 1,/* be verbose */ + cl_autobind : 1,/* use getport() */ + cl_binding : 1,/* doing a getport() */ + cl_oneshot : 1,/* dispose after use */ + cl_dead : 1;/* abandoned */ + unsigned long cl_hardmax; /* max hard timeout */ + + struct rpc_wait_queue cl_bindwait; /* waiting on getport() */ + unsigned int cl_users; /* number of references */ +}; +#define cl_timeout cl_xprt->timeout +#define cl_prog cl_pmap.pm_prog +#define cl_vers cl_pmap.pm_vers +#define cl_port cl_pmap.pm_port +#define cl_prot cl_pmap.pm_prot + +/* + * General RPC program info + */ +#define RPC_MAXVERSION 4 +struct rpc_program { + char * name; /* protocol name */ + u32 number; /* program number */ + unsigned int nrvers; /* number of versions */ + struct rpc_version ** version; /* version array */ + struct rpc_stat * stats; /* statistics */ +}; + +struct rpc_version { + u32 number; /* version number */ + unsigned int nrprocs; /* number of procs */ + struct rpc_procinfo * procs; /* procedure array */ +}; + +/* + * Procedure information + */ +struct rpc_procinfo { + char * p_procname; /* procedure name */ + kxdrproc_t p_encode; /* XDR encode function */ + kxdrproc_t p_decode; /* XDR decode function */ + unsigned int p_bufsiz; /* req. buffer size */ + unsigned int p_count; /* call count */ +}; + +#define rpcproc_bufsiz(clnt, proc) ((clnt)->cl_procinfo[proc].p_bufsiz) +#define rpcproc_encode(clnt, proc) ((clnt)->cl_procinfo[proc].p_encode) +#define rpcproc_decode(clnt, proc) ((clnt)->cl_procinfo[proc].p_decode) +#define rpcproc_name(clnt, proc) ((clnt)->cl_procinfo[proc].p_procname) +#define rpcproc_count(clnt, proc) ((clnt)->cl_procinfo[proc].p_count) + +#define RPC_CONGESTED(clnt) (RPCXPRT_CONGESTED((clnt)->cl_xprt)) +#define RPC_PEERADDR(clnt) (&(clnt)->cl_xprt->addr) + +#ifdef __KERNEL__ + +struct rpc_clnt *rpc_create_client(struct rpc_xprt *xprt, char *servname, + struct rpc_program *info, + u32 version, int authflavor); +int rpc_shutdown_client(struct rpc_clnt *); +int rpc_destroy_client(struct rpc_clnt *); +void rpc_release_client(struct rpc_clnt *); +void rpc_getport(struct rpc_task *, struct rpc_clnt *); +int rpc_register(u32, u32, int, unsigned short, int *); + +int rpc_call(struct rpc_clnt *clnt, u32 proc, + void *argp, void *resp, int flags); +int rpc_call_async(struct rpc_task *task, u32 proc, + void *argp, void *resp, int flags); +void rpc_call_setup(struct rpc_task *task, u32 proc, + void *argp, void *resp, int flags); +int rpc_do_call(struct rpc_clnt *clnt, u32 proc, + void *argp, void *resp, int flags, + rpc_action callback, void *clntdata); +void rpc_restart_call(struct rpc_task *); +#define rpc_call(clnt, proc, argp, resp, flags) \ + rpc_do_call(clnt, proc, argp, resp, flags, NULL, NULL) + +extern __inline__ void +rpc_set_timeout(struct rpc_clnt *clnt, unsigned int retr, unsigned long incr) +{ + xprt_set_timeout(&clnt->cl_timeout, retr, incr); +} + +/* + * Helper function for NFSroot support + */ +int rpc_getport_external(struct sockaddr_in *, __u32, __u32, int); + +#endif /* __KERNEL__ */ +#endif /* _LINUX_SUNRPC_CLNT_H */ diff --git a/include/linux/sunrpc/debug.h b/include/linux/sunrpc/debug.h new file mode 100644 index 000000000..c82289283 --- /dev/null +++ b/include/linux/sunrpc/debug.h @@ -0,0 +1,91 @@ +/* + * linux/include/linux/sunrpc/debug.h + * + * Debugging support for sunrpc module + * + * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de> + */ + +#ifndef _LINUX_SUNRPC_DEBUG_H_ +#define _LINUX_SUNRPC_DEBUG_H_ + +#include <linux/timer.h> +#include <linux/tqueue.h> + +/* + * Enable RPC debugging/profiling. + */ +#define RPC_DEBUG +/* #define RPC_PROFILE */ + +/* + * RPC debug facilities + */ +#define RPCDBG_XPRT 0x0001 +#define RPCDBG_CALL 0x0002 +#define RPCDBG_DEBUG 0x0004 +#define RPCDBG_NFS 0x0008 +#define RPCDBG_AUTH 0x0010 +#define RPCDBG_PMAP 0x0020 +#define RPCDBG_SCHED 0x0040 +#define RPCDBG_SVCSOCK 0x0100 +#define RPCDBG_SVCDSP 0x0200 +#define RPCDBG_MISC 0x0400 +#define RPCDBG_ALL 0x7fff + +#ifdef __KERNEL__ + +/* + * Debugging macros etc + */ +#ifdef RPC_DEBUG +extern unsigned int rpc_debug; +extern unsigned int nfs_debug; +extern unsigned int nfsd_debug; +extern unsigned int nlm_debug; +#endif + +#define dprintk(args...) dfprintk(FACILITY, ## args) + +#undef ifdebug +#ifdef RPC_DEBUG +# define ifdebug(fac) if (rpc_debug & RPCDBG_##fac) +# define dfprintk(fac, args...) do { ifdebug(fac) printk(## args); } while(0) +# define RPC_IFDEBUG(x) x +#else +# define dfprintk(fac, args...) do ; while (0) +# define RPC_IFDEBUG(x) +#endif + +#ifdef RPC_PROFILE +# define pprintk(args...) printk(## args) +#else +# define pprintk(args...) do ; while (0) +#endif + +/* + * Sysctl interface for RPC debugging + */ +#ifdef RPC_DEBUG +void rpc_register_sysctl(void); +void rpc_unregister_sysctl(void); +#endif + +#endif /* __KERNEL__ */ + +/* + * Declarations for the sysctl debug interface, which allows to read or + * change the debug flags for rpc, nfs, nfsd, and lockd. Since the sunrpc + * module currently registers its sysctl table dynamically, the sysctl path + * for module FOO is <CTL_SUNRPC, CTL_FOODEBUG>. + */ +#define CTL_SUNRPC 7249 /* arbitrary and hopefully unused */ + +enum { + CTL_RPCDEBUG = 1, + CTL_NFSDEBUG, + CTL_NFSDDEBUG, + CTL_NLMDEBUG, +}; + +#endif /* _LINUX_SUNRPC_DEBUG_H_ */ diff --git a/include/linux/sunrpc/msg_prot.h b/include/linux/sunrpc/msg_prot.h new file mode 100644 index 000000000..d513a7671 --- /dev/null +++ b/include/linux/sunrpc/msg_prot.h @@ -0,0 +1,62 @@ +/* + * linux/include/net/sunrpc/msg_prot.h + * + * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de> + */ + +#ifndef _LINUX_SUNRPC_MSGPROT_H_ +#define _LINUX_SUNRPC_MSGPROT_H_ + +#ifdef __KERNEL__ /* user programs should get these from the rpc header files */ + +#define RPC_VERSION 2 + +enum rpc_auth_flavor { + RPC_AUTH_NULL = 0, + RPC_AUTH_UNIX = 1, + RPC_AUTH_SHORT = 2, + RPC_AUTH_DES = 3, + RPC_AUTH_KRB = 4, +}; + +enum rpc_msg_type { + RPC_CALL = 0, + RPC_REPLY = 1 +}; + +enum rpc_reply_stat { + RPC_MSG_ACCEPTED = 0, + RPC_MSG_DENIED = 1 +}; + +enum rpc_accept_stat { + RPC_SUCCESS = 0, + RPC_PROG_UNAVAIL = 1, + RPC_PROG_MISMATCH = 2, + RPC_PROC_UNAVAIL = 3, + RPC_GARBAGE_ARGS = 4, + RPC_SYSTEM_ERR = 5 +}; + +enum rpc_reject_stat { + RPC_MISMATCH = 0, + RPC_AUTH_ERROR = 1 +}; + +enum rpc_auth_stat { + RPC_AUTH_OK = 0, + RPC_AUTH_BADCRED = 1, + RPC_AUTH_REJECTEDCRED = 2, + RPC_AUTH_BADVERF = 3, + RPC_AUTH_REJECTEDVERF = 4, + RPC_AUTH_TOOWEAK = 5 +}; + +#define RPC_PMAP_PROGRAM 100000 +#define RPC_PMAP_VERSION 2 +#define RPC_PMAP_PORT 111 + +#define RPC_MAXNETNAMELEN 256 + +#endif /* __KERNEL__ */ +#endif /* _LINUX_SUNRPC_MSGPROT_H_ */ diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h new file mode 100644 index 000000000..759da3c70 --- /dev/null +++ b/include/linux/sunrpc/sched.h @@ -0,0 +1,170 @@ +/* + * linux/include/linux/sunrpc/sched.h + * + * Scheduling primitives for kernel Sun RPC. + * + * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de> + */ + +#ifndef _LINUX_SUNRPC_SCHED_H_ +#define _LINUX_SUNRPC_SCHED_H_ + +#include <linux/timer.h> +#include <linux/tqueue.h> +#include <linux/sunrpc/types.h> + +/* + * Define this if you want to test the fast scheduler for async calls. + * This is still experimental and may not work. + */ +#undef CONFIG_RPC_FASTSCHED + +/* + * This is the RPC task struct + */ +struct rpc_task { + struct rpc_task * tk_prev; /* wait queue links */ + struct rpc_task * tk_next; +#ifdef RPC_DEBUG + unsigned long tk_magic; /* 0xf00baa */ +#endif + struct rpc_task * tk_next_task; /* global list of tasks */ + struct rpc_task * tk_prev_task; /* global list of tasks */ + struct rpc_clnt * tk_client; /* RPC client */ + struct rpc_rqst * tk_rqstp; /* RPC request */ + struct rpc_cred * tk_cred; /* RPC credentials */ + int tk_status; /* result of last operation */ + struct rpc_wait_queue * tk_rpcwait; /* RPC wait queue we're on */ + + /* + * RPC call state + */ + u32 tk_proc; /* procedure number */ + u32 * tk_buffer; /* XDR buffer */ + void * tk_argp; /* argument storage */ + void * tk_resp; /* result storage */ + u8 tk_garb_retry, + tk_cred_retry, + tk_suid_retry; + + /* + * callback to be executed after waking up + * action next procedure for async tasks + * exit exit async task and report to caller + */ + void (*tk_callback)(struct rpc_task *); + void (*tk_action)(struct rpc_task *); + void (*tk_exit)(struct rpc_task *); + void * tk_calldata; + + /* + * tk_timer is used for async processing by the RPC scheduling + * primitives. You should not access this directly unless + * you have a pathological interest in kernel oopses. + */ + struct timer_list tk_timer; /* kernel timer */ + struct wait_queue * tk_wait; /* sync: sleep on this q */ + unsigned long tk_timeout; /* timeout for rpc_sleep() */ + unsigned short tk_flags; /* misc flags */ +#ifdef RPC_DEBUG + unsigned short tk_pid; /* debugging aid */ +#endif +}; +#define tk_auth tk_client->cl_auth +#define tk_xprt tk_client->cl_xprt + +typedef void (*rpc_action)(struct rpc_task *); + +/* + * RPC task flags + */ +#define RPC_TASK_RUNNING 0x0001 /* is running */ +#define RPC_TASK_ASYNC 0x0002 /* is an async task */ +#define RPC_TASK_CALLBACK 0x0004 /* invoke callback */ +#define RPC_TASK_SWAPPER 0x0008 /* is swapping in/out */ +#define RPC_TASK_SETUID 0x0010 /* is setuid process */ +#define RPC_TASK_CHILD 0x0020 /* is child of other task */ +#define RPC_CALL_REALUID 0x0040 /* try using real uid */ +#define RPC_CALL_MAJORSEEN 0x0080 /* major timeout seen */ +#define RPC_TASK_ROOTCREDS 0x0100 /* force root creds */ +#define RPC_TASK_DYNAMIC 0x0200 /* task was kmalloc'ed */ +#define RPC_TASK_KILLED 0x0400 /* task was killed */ + +#define RPC_IS_RUNNING(t) ((t)->tk_flags & RPC_TASK_RUNNING) +#define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC) +#define RPC_IS_SETUID(t) ((t)->tk_flags & RPC_TASK_SETUID) +#define RPC_IS_CHILD(t) ((t)->tk_flags & RPC_TASK_CHILD) +#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER) +#define RPC_DO_CALLBACK(t) ((t)->tk_flags & RPC_TASK_CALLBACK) +#define RPC_DO_ROOTOVERRIDE(t) ((t)->tk_flags & RPC_TASK_ROOTCREDS) +#define RPC_ASSASSINATED(t) ((t)->tk_flags & RPC_TASK_KILLED) + +/* + * RPC synchronization objects + */ +struct rpc_wait_queue { + struct rpc_task * task; +#ifdef RPC_DEBUG + char * name; +#endif +}; + +#ifndef RPC_DEBUG +# define RPC_INIT_WAITQ(name) ((struct rpc_wait_queue) { NULL }) +#else +# define RPC_INIT_WAITQ(name) ((struct rpc_wait_queue) { NULL, name }) +#endif + +/* + * Function prototypes + */ +struct rpc_task *rpc_new_task(struct rpc_clnt *, rpc_action, int flags); +struct rpc_task *rpc_new_child(struct rpc_clnt *, struct rpc_task *parent); +void rpc_init_task(struct rpc_task *, struct rpc_clnt *, + rpc_action exitfunc, int flags); +void rpc_release_task(struct rpc_task *); +void rpc_killall_tasks(struct rpc_clnt *); +void rpc_execute(struct rpc_task *); +void rpc_run_child(struct rpc_task *parent, struct rpc_task *child, + rpc_action action); +void rpc_add_wait_queue(struct rpc_wait_queue *, struct rpc_task *); +void rpc_remove_wait_queue(struct rpc_task *); +void rpc_sleep_on(struct rpc_wait_queue *, struct rpc_task *, + rpc_action action, rpc_action timer); +void rpc_cond_wait(struct rpc_wait_queue *, struct rpc_task *, + unsigned char *, + rpc_action action, rpc_action timer); +void rpc_wake_up_task(struct rpc_task *); +void rpc_wake_up(struct rpc_wait_queue *); +struct rpc_task *rpc_wake_up_next(struct rpc_wait_queue *); +void rpc_wake_up_status(struct rpc_wait_queue *, int); +void rpc_add_timer(struct rpc_task *, rpc_action); +void rpc_del_timer(struct rpc_task *); +void rpc_delay(struct rpc_task *, unsigned long); +void * rpc_allocate(unsigned int flags, unsigned int); +void rpc_free(void *); +void rpciod_up(void); +void rpciod_down(void); + +extern __inline__ void * +rpc_malloc(struct rpc_task *task, unsigned int size) +{ + return rpc_allocate(task->tk_flags, size); +} + +extern __inline__ void +rpc_exit(struct rpc_task *task, int status) +{ + task->tk_status = status; + task->tk_action = NULL; +} + +#ifdef RPC_DEBUG +extern __inline__ char * +rpc_qname(struct rpc_wait_queue *q) +{ + return q->name? q->name : "unknown"; +} +#endif + +#endif /* _LINUX_SUNRPC_SCHED_H_ */ diff --git a/include/linux/sunrpc/stats.h b/include/linux/sunrpc/stats.h new file mode 100644 index 000000000..d0ced9fe4 --- /dev/null +++ b/include/linux/sunrpc/stats.h @@ -0,0 +1,55 @@ +/* + * linux/include/linux/sunrpc/stats.h + * + * Client statistics collection for SUN RPC + * + * Copyright (C) 1996 Olaf Kirch <okir@monad.swb.de> + */ + +#ifndef _LINUX_SUNRPC_STATS_H +#define _LINUX_SUNRPC_STATS_H + +#include <linux/proc_fs.h> + +struct rpc_stat { + struct rpc_program * program; + + unsigned int netcnt, + netudpcnt, + nettcpcnt, + nettcpconn, + netreconn; + unsigned int rpccnt, + rpcretrans, + rpcauthrefresh, + rpcgarbage; +}; + +struct svc_stat { + struct svc_program * program; + + unsigned int netcnt, + netudpcnt, + nettcpcnt, + nettcpconn; + unsigned int rpccnt, + rpcbadfmt, + rpcbadauth, + rpcbadclnt; +}; + +void rpc_proc_init(void); +void rpc_proc_exit(void); + +struct proc_dir_entry * rpc_proc_register(struct rpc_stat *); +void rpc_proc_unregister(const char *); +int rpc_proc_read(char *, char **, off_t, int, + int *, void *); +void rpc_proc_zero(struct rpc_program *); +struct proc_dir_entry * svc_proc_register(struct svc_stat *); +void svc_proc_unregister(const char *); +int svc_proc_read(char *, char **, off_t, int, + int *, void *); +void svc_proc_zero(struct svc_program *); + +#endif /* _LINUX_SUNRPC_STATS_H */ diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h new file mode 100644 index 000000000..7c9a1e525 --- /dev/null +++ b/include/linux/sunrpc/svc.h @@ -0,0 +1,180 @@ +/* + * linux/include/linux/sunrpc/svc.h + * + * RPC server declarations. + * + * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> + */ + + +#ifndef SUNRPC_SVC_H +#define SUNRPC_SVC_H + +#include <linux/sunrpc/types.h> +#include <linux/sunrpc/xdr.h> +#include <linux/sunrpc/svcauth.h> + +/* + * RPC service. + * + * An RPC service is a ``daemon,'' possibly multithreaded, which + * receives and processes incoming RPC messages. + * It has one or more transport sockets associated with it, and maintains + * a list of idle threads waiting for input. + * + * We currently do not support more than one RPC program per daemon. + */ +struct svc_serv { + struct svc_rqst * sv_threads; /* idle server threads */ + struct svc_sock * sv_sockets; /* pending sockets */ + struct svc_program * sv_program; /* RPC program */ + struct svc_stat * sv_stats; /* RPC statistics */ + unsigned int sv_nrthreads; /* # of server threads */ + unsigned int sv_bufsz; /* datagram buffer size */ + unsigned int sv_xdrsize; /* XDR buffer size */ + + struct svc_sock * sv_allsocks; /* all sockets */ + + char * sv_name; /* service name */ +}; + +/* + * Maximum payload size supported by a kernel RPC server. + * This is use to determine the max number of pages nfsd is + * willing to return in a single READ operation. + */ +#define RPCSVC_MAXPAYLOAD 16384u + +/* + * Buffer to store RPC requests or replies in. + * Each server thread has one of these beasts. + * + * Area points to the allocated memory chunk currently owned by the + * buffer. Base points to the buffer containing the request, which is + * different from area when directly reading from an sk_buff. buf is + * the current read/write position while processing an RPC request. + * + * The array of iovecs can hold additional data that the server process + * may not want to copy into the RPC reply buffer, but pass to the + * network sendmsg routines directly. The prime candidate for this + * will of course be NFS READ operations, but one might also want to + * do something about READLINK and READDIR. It might be worthwhile + * to implement some generic readdir cache in the VFS layer... + * + * On the receiving end of the RPC server, the iovec may be used to hold + * the list of IP fragments once we get to process fragmented UDP + * datagrams directly. + */ +#define RPCSVC_MAXIOV ((RPCSVC_MAXPAYLOAD+PAGE_SIZE-1)/PAGE_SIZE + 1) +struct svc_buf { + u32 * area; /* allocated memory */ + u32 * base; /* base of RPC datagram */ + int buflen; /* total length of buffer */ + u32 * buf; /* read/write pointer */ + int len; /* current end of buffer */ + + /* iovec for zero-copy NFS READs */ + struct iovec iov[RPCSVC_MAXIOV]; + int nriov; +}; +#define svc_getlong(argp, val) { (val) = *(argp)->buf++; (argp)->len--; } +#define svc_putlong(resp, val) { *(resp)->buf++ = (val); (resp)->len++; } + +/* + * The context of a single thread, including the request currently being + * processed. + * NOTE: First two items must be prev/next. + */ +struct svc_rqst { + struct svc_rqst * rq_prev; /* idle list */ + struct svc_rqst * rq_next; + struct svc_sock * rq_sock; /* socket */ + struct sockaddr_in rq_addr; /* peer address */ + int rq_addrlen; + + struct svc_serv * rq_server; /* RPC service definition */ + struct svc_procedure * rq_procinfo; /* procedure info */ + struct svc_cred rq_cred; /* auth info */ + struct sk_buff * rq_skbuff; /* fast recv inet buffer */ + struct svc_buf rq_defbuf; /* default buffer */ + struct svc_buf rq_argbuf; /* argument buffer */ + struct svc_buf rq_resbuf; /* result buffer */ + u32 rq_xid; /* transmission id */ + u32 rq_prog; /* program number */ + u32 rq_vers; /* program version */ + u32 rq_proc; /* procedure number */ + u32 rq_prot; /* IP protocol */ + unsigned short rq_verfed : 1, /* reply has verifier */ + rq_userset : 1, /* auth->setuser OK */ + rq_secure : 1; /* secure port */ + + void * rq_argp; /* decoded arguments */ + void * rq_resp; /* xdr'd results */ + + /* Catering to nfsd */ + struct svc_client * rq_client; /* RPC peer info */ + struct svc_cacherep * rq_cacherep; /* cache info */ + + struct wait_queue * rq_wait; /* synchronozation */ +}; + +/* + * RPC program + */ +struct svc_program { + u32 pg_prog; /* program number */ + unsigned int pg_lovers; /* lowest version */ + unsigned int pg_hivers; /* lowest version */ + unsigned int pg_nvers; /* number of versions */ + struct svc_version ** pg_vers; /* version array */ + char * pg_name; /* service name */ + struct svc_stat * pg_stats; /* rpc statistics */ +}; + +/* + * RPC program version + */ +struct svc_version { + u32 vs_vers; /* version number */ + u32 vs_nproc; /* number of procedures */ + struct svc_procedure * vs_proc; /* per-procedure info */ + + /* Override dispatch function (e.g. when caching replies). + * A return value of 0 means drop the request. + * vs_dispatch == NULL means use default dispatcher. + */ + int (*vs_dispatch)(struct svc_rqst *, u32 *); +}; + +/* + * RPC procedure info + */ +typedef int (*svc_procfunc)(struct svc_rqst *, void *argp, void *resp); +struct svc_procedure { + svc_procfunc pc_func; /* process the request */ + kxdrproc_t pc_decode; /* XDR decode args */ + kxdrproc_t pc_encode; /* XDR encode result */ + kxdrproc_t pc_release; /* XDR free result */ + unsigned int pc_argsize; /* argument struct size */ + unsigned int pc_ressize; /* result struct size */ + unsigned int pc_count; /* call count */ + unsigned int pc_cachetype; /* cache info (NFS) */ +}; + +/* + * This is the RPC server thread function prototype + */ +typedef void (*svc_thread_fn)(struct svc_rqst *); + +/* + * Function prototypes. + */ +struct svc_serv * svc_create(struct svc_program *, unsigned int, unsigned int); +int svc_create_thread(svc_thread_fn, struct svc_serv *); +void svc_exit_thread(struct svc_rqst *); +void svc_destroy(struct svc_serv *); +int svc_process(struct svc_serv *, struct svc_rqst *); +int svc_register(struct svc_serv *, int, unsigned short); +void svc_wake_up(struct svc_serv *); + +#endif /* SUNRPC_SVC_H */ diff --git a/include/linux/sunrpc/svcauth.h b/include/linux/sunrpc/svcauth.h new file mode 100644 index 000000000..1db19cb1e --- /dev/null +++ b/include/linux/sunrpc/svcauth.h @@ -0,0 +1,48 @@ +/* + * linux/include/linux/sunrpc/svcauth.h + * + * RPC server-side authentication stuff. + * + * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> + */ + +#ifndef _LINUX_SUNRPC_SVCAUTH_H_ +#define _LINUX_SUNRPC_SVCAUTH_H_ + +#ifdef __KERNEL__ + +#include <linux/sunrpc/msg_prot.h> + +struct svc_cred { + u32 cr_flavor; + uid_t cr_uid; + gid_t cr_gid; + gid_t cr_groups[NGROUPS]; +}; + +struct svc_rqst; /* forward decl */ + +void svc_authenticate(struct svc_rqst *rqstp, u32 *statp, u32 *authp); +int svc_auth_register(u32 flavor, void (*)(struct svc_rqst *,u32 *,u32 *)); +void svc_auth_unregister(u32 flavor); + +#if 0 +/* + * Decoded AUTH_UNIX data. This is different from what's in the RPC lib. + */ +#define NGRPS 16 +struct authunix_parms { + u32 aup_stamp; + u32 aup_uid; + u32 aup_gid; + u32 aup_len; + u32 aup_gids[NGRPS]; +}; + +struct svc_authops * auth_getops(u32 flavor); +#endif + + +#endif /* __KERNEL__ */ + +#endif /* _LINUX_SUNRPC_SVCAUTH_H_ */ diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h new file mode 100644 index 000000000..8445f2b10 --- /dev/null +++ b/include/linux/sunrpc/svcsock.h @@ -0,0 +1,58 @@ +/* + * linux/include/linux/sunrpc/svcsock.h + * + * RPC server socket I/O. + * + * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> + */ + +#ifndef SUNRPC_SVCSOCK_H +#define SUNRPC_SVCSOCK_H + +#include <linux/sunrpc/svc.h> + +/* + * RPC server socket. + * NOTE: First two items must be prev/next. + */ +struct svc_sock { + struct svc_sock * sk_prev; /* list of ready sockets */ + struct svc_sock * sk_next; + struct svc_sock * sk_list; /* list of all sockets */ + struct socket * sk_sock; /* berkeley socket layer */ + struct sock * sk_sk; /* INET layer */ + + struct svc_serv * sk_server; /* service for this socket */ + unsigned char sk_inuse; /* use count */ + unsigned char sk_busy; /* enqueued/receiving */ + unsigned char sk_conn; /* conn pending */ + unsigned char sk_close; /* dead or dying */ + int sk_data; /* data pending */ + unsigned int sk_temp : 1, /* temp socket */ + sk_qued : 1, /* on serv->sk_sockets */ + sk_dead : 1; /* socket closed */ + int (*sk_recvfrom)(struct svc_rqst *rqstp); + int (*sk_sendto)(struct svc_rqst *rqstp); + + /* We keep the old state_change and data_ready CB's here */ + void (*sk_ostate)(struct sock *); + void (*sk_odata)(struct sock *, int bytes); + + /* private TCP part */ + unsigned long sk_reclen; /* length of record */ + int sk_tcplen; /* current read length */ + + /* Debugging */ + struct svc_rqst * sk_rqstp; +}; + +/* + * Function prototypes. + */ +int svc_create_socket(struct svc_serv *, int, struct sockaddr_in *); +void svc_delete_socket(struct svc_sock *); +int svc_recv(struct svc_serv *, struct svc_rqst *); +int svc_send(struct svc_rqst *); +void svc_drop(struct svc_rqst *); + +#endif /* SUNRPC_SVCSOCK_H */ diff --git a/include/linux/sunrpc/types.h b/include/linux/sunrpc/types.h new file mode 100644 index 000000000..3183a3109 --- /dev/null +++ b/include/linux/sunrpc/types.h @@ -0,0 +1,75 @@ +/* + * linux/include/linux/sunrpc/types.h + * + * Generic types and misc stuff for RPC. + * + * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de> + */ + +#ifndef _LINUX_SUNRPC_TYPES_H_ +#define _LINUX_SUNRPC_TYPES_H_ + +#include <linux/timer.h> +#include <linux/tqueue.h> +#include <linux/sunrpc/debug.h> + +/* + * These are the RPC list manipulation primitives used everywhere. + */ +struct rpc_listitem { + struct rpc_listitem * prev; + struct rpc_listitem * next; +}; + +extern __inline__ void +__rpc_append_list(struct rpc_listitem **q, struct rpc_listitem *item) +{ + struct rpc_listitem *next, *prev; + + if (!(next = *q)) { + *q = item->next = item->prev = item; + } else { + prev = next->prev; + prev->next = item; + next->prev = item; + item->next = next; + item->prev = prev; + } +} + +extern __inline__ void +__rpc_insert_list(struct rpc_listitem **q, struct rpc_listitem *item) +{ + __rpc_append_list(q, item); + *q = item; +} + +extern __inline__ void +__rpc_remove_list(struct rpc_listitem **q, struct rpc_listitem *item) +{ + struct rpc_listitem *prev = item->prev, + *next = item->next; + + if (item != prev) { + next->prev = prev; + prev->next = next; + } else { + next = NULL; + } + if (*q == item) + *q = next; +} + +#define rpc_insert_list(q, i) \ + __rpc_insert_list((struct rpc_listitem **) q, (struct rpc_listitem *) i) +#define rpc_append_list(q, i) \ + __rpc_append_list((struct rpc_listitem **) q, (struct rpc_listitem *) i) +#define rpc_remove_list(q, i) \ + __rpc_remove_list((struct rpc_listitem **) q, (struct rpc_listitem *) i) + +/* + * Shorthands + */ +#define signalled() (current->signal & ~current->blocked) + +#endif /* _LINUX_SUNRPC_TYPES_H_ */ diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h new file mode 100644 index 000000000..b316103d5 --- /dev/null +++ b/include/linux/sunrpc/xdr.h @@ -0,0 +1,79 @@ +/* + * include/linux/sunrpc/xdr.h + * + * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> + */ + +#ifndef _SUNRPC_XDR_H_ +#define _SUNRPC_XDR_H_ + +#ifdef __KERNEL__ + +#include <linux/uio.h> + +/* + * Buffer adjustment + */ +#define XDR_QUADLEN(l) (((l) + 3) >> 2) + +/* + * Generic opaque `network object.' At the kernel level, this type + * is used only by lockd. + */ +#define XDR_MAX_NETOBJ 1024 +struct xdr_netobj { + unsigned int len; + u8 * data; +}; + +/* + * This is the generic XDR function. rqstp is either a rpc_rqst (client + * side) or svc_rqst pointer (server side). + * Encode functions always assume there's enough room in the buffer. + */ +typedef int (*kxdrproc_t)(void *rqstp, u32 *data, void *obj); + +/* + * These variables contain pre-xdr'ed values for faster operation. + * FIXME: should be replaced by macros for big-endian machines. + */ +extern u32 xdr_zero, xdr_one, xdr_two; + +extern u32 rpc_success, + rpc_prog_unavail, + rpc_prog_mismatch, + rpc_proc_unavail, + rpc_garbage_args, + rpc_system_err; + +extern u32 rpc_auth_ok, + rpc_autherr_badcred, + rpc_autherr_rejectedcred, + rpc_autherr_badverf, + rpc_autherr_rejectedverf, + rpc_autherr_tooweak, + rpc_autherr_dropit; + +void xdr_init(void); + +/* + * Miscellaneous XDR helper functions + */ +u32 * xdr_encode_string(u32 *p, const char *s); +u32 * xdr_decode_string(u32 *p, char **sp, int *lenp, int maxlen); +u32 * xdr_encode_netobj(u32 *p, const struct xdr_netobj *); +u32 * xdr_decode_netobj(u32 *p, struct xdr_netobj *); +u32 * xdr_decode_netobj_fixed(u32 *p, void *obj, unsigned int len); + +/* + * Adjust iovec to reflect end of xdr'ed data (RPC client XDR) + */ +static inline int +xdr_adjust_iovec(struct iovec *iov, u32 *p) +{ + return iov->iov_len = ((u8 *) p - (u8 *) iov->iov_base); +} + +#endif /* __KERNEL__ */ + +#endif /* _SUNRPC_XDR_H_ */ diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h new file mode 100644 index 000000000..a470260b0 --- /dev/null +++ b/include/linux/sunrpc/xprt.h @@ -0,0 +1,195 @@ +/* + * linux/include/linux/sunrpc/clnt_xprt.h + * + * Declarations for the RPC transport interface. + * + * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> + */ + +#ifndef _LINUX_SUNRPC_XPRT_H +#define _LINUX_SUNRPC_XPRT_H + +#include <linux/uio.h> +#include <linux/socket.h> +#include <linux/in.h> +#include <linux/sunrpc/sched.h> + +/* + * Maximum number of iov's we use. + */ +#define MAX_IOVEC 8 + +/* + * The transport code maintains an estimate on the maximum number of out- + * standing RPC requests, using a smoothed version of the congestion + * avoidance implemented in 44BSD. This is basically the Van Jacobson + * slow start algorithm: If a retransmit occurs, the congestion window is + * halved; otherwise, it is incremented by 1/cwnd when + * + * - a reply is received and + * - a full number of requests are outstanding and + * - the congestion window hasn't been updated recently. + * + * Upper procedures may check whether a request would block waiting for + * a free RPC slot by using the RPC_CONGESTED() macro. + * + * Note: on machines with low memory we should probably use a smaller + * MAXREQS value: At 32 outstanding reqs with 8 megs of RAM, fragment + * reassembly will frequently run out of memory. + * Come Linux 2.1, we'll handle fragments directly. + */ +#define RPC_MAXCONG 16 +#define RPC_MAXREQS (RPC_MAXCONG + 1) +#define RPC_CWNDSCALE 256 +#define RPC_MAXCWND (RPC_MAXCONG * RPC_CWNDSCALE) +#define RPC_INITCWND RPC_CWNDSCALE +#define RPCXPRT_CONGESTED(xprt) \ + ((xprt)->cong >= ((xprt)->nocong? RPC_MAXCWND : (xprt)->cwnd)) + +/* Default timeout values */ +#define RPC_MAX_UDP_TIMEOUT (6*HZ) +#define RPC_MAX_TCP_TIMEOUT (600*HZ) + +/* RPC call and reply header size as number of 32bit words (verifier + * size computed separately) + */ +#define RPC_CALLHDRSIZE 6 +#define RPC_REPHDRSIZE 4 + +/* + * This describes a timeout strategy + */ +struct rpc_timeout { + unsigned long to_current, /* current timeout */ + to_initval, /* initial timeout */ + to_maxval, /* max timeout */ + to_increment, /* if !exponential */ + to_resrvval; /* reserve timeout */ + short to_retries; /* max # of retries */ + unsigned char to_exponential; +}; + +/* + * This is the RPC buffer + */ +struct rpc_iov { + struct iovec io_vec[MAX_IOVEC]; + unsigned int io_nr; + unsigned int io_len; +}; + +/* + * This describes a complete RPC request + */ +struct rpc_rqst { + /* + * This is the user-visible part + */ + struct rpc_xprt * rq_xprt; /* RPC client */ + struct rpc_timeout rq_timeout; /* timeout parms */ + struct rpc_iov rq_snd_buf; /* send buffer */ + struct rpc_iov rq_rcv_buf; /* recv buffer */ + + /* + * This is the private part + */ + struct rpc_task * rq_task; /* RPC task data */ + __u32 rq_xid; /* request XID */ + struct rpc_rqst * rq_next; /* free list */ + unsigned char rq_gotit; /* reply received */ + unsigned char rq_damaged; /* being received */ + + /* + * For authentication (e.g. auth_des) + */ + u32 rq_creddata[2]; + +#ifdef RPC_PROFILE + unsigned long rq_xtime; /* when transmitted */ +#endif +}; +#define rq_svec rq_snd_buf.io_vec +#define rq_snr rq_snd_buf.io_nr +#define rq_slen rq_snd_buf.io_len +#define rq_rvec rq_rcv_buf.io_vec +#define rq_rnr rq_rcv_buf.io_nr +#define rq_rlen rq_rcv_buf.io_len + +struct rpc_xprt { + struct rpc_xprt * link; /* list of all clients */ + + struct file * file; /* VFS layer */ + struct socket * sock; /* BSD socket layer */ + struct sock * inet; /* INET layer */ + + struct rpc_timeout timeout; /* timeout parms */ + struct sockaddr_in addr; /* server address */ + int prot; /* IP protocol */ + + unsigned long cong; /* current congestion */ + unsigned long cwnd; /* congestion window */ + unsigned long congtime; /* hold cwnd until then */ + + struct rpc_wait_queue sending; /* requests waiting to send */ + struct rpc_wait_queue pending; /* requests in flight */ + struct rpc_wait_queue backlog; /* waiting for slot */ + struct rpc_wait_queue reconn; /* waiting for reconnect */ + struct rpc_rqst * free; /* free slots */ + struct rpc_rqst slot[RPC_MAXREQS]; + unsigned char connected; /* TCP: connected */ + unsigned char write_space; /* TCP: can send */ + unsigned int shutdown : 1, /* being shut down */ + nocong : 1, /* no congestion control */ + stream : 1, /* TCP */ + tcp_more : 1, /* more record fragments */ + connecting : 1; /* being reconnected */ + + /* + * State of TCP reply receive stuff + */ + union { /* record marker & XID */ + u32 header[2]; + u8 * data[8]; + } tcp_recm; + struct rpc_rqst * tcp_rqstp; + struct iovec tcp_iovec[MAX_IOVEC]; + u32 tcp_total; /* overall record length */ + u32 tcp_reclen; /* fragment length */ + u32 tcp_offset; /* fragment offset */ + u32 tcp_copied; /* copied to request */ + + /* + * TCP send stuff + */ + struct rpc_iov snd_buf; /* send buffer */ + struct rpc_task * snd_task; /* Task blocked in send */ + + void (*old_data_ready)(struct sock *, int); + void (*old_state_change)(struct sock *); + void (*old_write_space)(struct sock *); +}; +#define tcp_reclen tcp_recm.header[0] +#define tcp_xid tcp_recm.header[1] + +#ifdef __KERNEL__ + +struct rpc_xprt * xprt_create(struct file *socket, + struct sockaddr_in *addr, + struct rpc_timeout *toparms); +struct rpc_xprt * xprt_create_proto(int proto, struct sockaddr_in *addr, + struct rpc_timeout *toparms); +int xprt_destroy(struct rpc_xprt *); +void xprt_default_timeout(struct rpc_timeout *, int); +void xprt_set_timeout(struct rpc_timeout *, unsigned int, + unsigned long); + +int xprt_reserve(struct rpc_task *); +void xprt_transmit(struct rpc_task *); +void xprt_receive(struct rpc_task *); +int xprt_adjust_timeout(struct rpc_timeout *); +void xprt_release(struct rpc_task *); +void xprt_reconnect(struct rpc_task *); + +#endif /* __KERNEL__*/ + +#endif /* _LINUX_SUNRPC_XPRT_H */ diff --git a/include/linux/swap.h b/include/linux/swap.h index 18fe74e8e..b0bdc40b6 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -19,6 +19,7 @@ struct swap_info_struct { unsigned int flags; kdev_t swap_device; + char *swap_filename; struct inode * swap_file; unsigned char * swap_map; unsigned char * swap_lockmap; diff --git a/include/linux/swapctl.h b/include/linux/swapctl.h index c85aa6c24..e71dcd067 100644 --- a/include/linux/swapctl.h +++ b/include/linux/swapctl.h @@ -31,17 +31,6 @@ typedef struct swap_control_v5 typedef struct swap_control_v5 swap_control_t; extern swap_control_t swap_control; -typedef struct kswapd_control_v1 -{ - unsigned int maxpages; - unsigned int pages_buff; - unsigned int pages_shm; - unsigned int pages_mmap; - unsigned int pages_swap; -} kswapd_control_v1; -typedef kswapd_control_v1 kswapd_control_t; -extern kswapd_control_t kswapd_ctl; - typedef struct swapstat_v1 { unsigned int wakeups; diff --git a/include/linux/symtab_begin.h b/include/linux/symtab_begin.h deleted file mode 100644 index 65a87008c..000000000 --- a/include/linux/symtab_begin.h +++ /dev/null @@ -1,45 +0,0 @@ -#include <linux/linkage.h> - -#ifdef MODVERSIONS -# undef _set_ver -# undef X -/* - * These two macros _will_ get enough arguments from the X* macros - * since "sym" expands to "symaddr, symstr" from the #define in *.ver - */ -# define _basic_version(symaddr,symstr) symaddr, symstr -# define _alias_version(really,symaddr,symstr) (void *) & really , symstr - -# ifndef __GENKSYMS__ -# ifdef MODULE -# define _set_ver(sym,ver) \ - (void *) & sym ## _R ## ver, SYMBOL_NAME_STR(sym) "_R" #ver -# else /* !MODULE */ -# define _set_ver(sym,ver) \ - (void *) & sym, SYMBOL_NAME_STR(sym) "_R" #ver -# endif /* !MODULE */ -# define X(sym) { _basic_version(sym) } -/* - * For _really_ stacked modules: - * - * Use "Xalias(local_symbol, symbol_from_other_module)" - * to make subsequent modules really use "local_symbol" - * when they think that they are using "symbol_from_other_module" - * - * The "aliasing" module can still use "symbol_from_other_module", - * but can now replace and/or modify the behaviour of that symbol. - */ -# define Xalias(really,sym) { _alias_version(really,sym) } -# endif /* !__GENKSYMS__ */ -#else /* !MODVERSIONS */ -# define X(sym) { (void *) & sym, SYMBOL_NAME_STR(sym)} -# define Xalias(really,sym) { (void *) & really, SYMBOL_NAME_STR(sym)} -#endif /* MODVERSIONS */ -/* - * Some symbols always need to be unversioned. This includes - * compiler generated calls to functions. - */ -#define XNOVERS(sym) { (void *) & sym, SYMBOL_NAME_STR(sym)} - -#define EMPTY {0,0} - 0, 0, 0, { diff --git a/include/linux/symtab_end.h b/include/linux/symtab_end.h deleted file mode 100644 index 91b92e298..000000000 --- a/include/linux/symtab_end.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifdef MODVERSIONS -#undef _set_ver -#if defined(MODULE) && !defined(__GENKSYMS__) -#define _set_ver(sym,vers) sym ## _R ## vers -#else -#define _set_ver(a,b) a -#endif -#endif /* MODVERSIONS */ -#undef X -#undef EMPTY - /* mark end of table, last entry above ended with a comma! */ - { (void *)0, (char *)0 } - }, - /* no module refs, insmod will take care of that instead! */ - { { (struct module *)0, (struct module_ref *)0 } } diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index b16ddb71f..0e01fba0f 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -28,61 +28,80 @@ struct __sysctl_args { /* For internal pattern-matching use only: */ #ifdef __KERNEL__ #define CTL_ANY -1 /* Matches any name */ -#define CTL_NONE 0 +#define CTL_NONE 0 #endif -#define CTL_KERN 1 /* General kernel info and control */ -#define CTL_VM 2 /* VM management */ -#define CTL_NET 3 /* Networking */ -#define CTL_PROC 4 /* Process info */ -#define CTL_FS 5 /* Filesystems */ -#define CTL_DEBUG 6 /* Debugging */ -#define CTL_DEV 7 /* Devices */ -#define CTL_MAXID 8 +enum +{ + CTL_KERN=1, /* General kernel info and control */ + CTL_VM, /* VM management */ + CTL_NET, /* Networking */ + CTL_PROC, /* Process info */ + CTL_FS, /* Filesystems */ + CTL_DEBUG, /* Debugging */ + CTL_DEV, /* Devices */ +}; + /* CTL_KERN names: */ -#define KERN_OSTYPE 1 /* string: system version */ -#define KERN_OSRELEASE 2 /* string: system release */ -#define KERN_OSREV 3 /* int: system revision */ -#define KERN_VERSION 4 /* string: compile time info */ -#define KERN_SECUREMASK 5 /* struct: maximum rights mask */ -#define KERN_PROF 6 /* table: profiling information */ -#define KERN_NODENAME 7 -#define KERN_DOMAINNAME 8 -#define KERN_NRINODE 9 -#define KERN_MAXINODE 10 -#define KERN_NRFILE 11 -#define KERN_MAXFILE 12 -#define KERN_MAXID 13 -#define KERN_SECURELVL 14 /* int: system security level */ -#define KERN_PANIC 15 /* int: panic timeout */ -#define KERN_REALROOTDEV 16 /* real root device to mount after initrd */ -#define KERN_NFSRNAME 17 /* NFS root name */ -#define KERN_NFSRADDRS 18 /* NFS root addresses */ -#define KERN_JAVA_INTERPRETER 19 /* path to Java(tm) interpreter */ -#define KERN_JAVA_APPLETVIEWER 20 /* path to Java(tm) appletviewer */ +enum +{ + KERN_OSTYPE=1, /* string: system version */ + KERN_OSRELEASE, /* string: system release */ + KERN_OSREV, /* int: system revision */ + KERN_VERSION, /* string: compile time info */ + KERN_SECUREMASK, /* struct: maximum rights mask */ + KERN_PROF, /* table: profiling information */ + KERN_NODENAME, + KERN_DOMAINNAME, + KERN_NRINODE, + KERN_MAXINODE, + KERN_NRFILE, + KERN_MAXFILE, + KERN_SECURELVL, /* int: system security level */ + KERN_PANIC, /* int: panic timeout */ + KERN_REALROOTDEV, /* real root device to mount after initrd */ + KERN_NFSRNAME, /* NFS root name */ + KERN_NFSRADDRS, /* NFS root addresses */ + KERN_JAVA_INTERPRETER, /* path to Java(tm) interpreter */ + KERN_JAVA_APPLETVIEWER, /* path to Java(tm) appletviewer */ + KERN_SPARC_REBOOT, /* reboot command on Sparc */ + KERN_CTLALTDEL, /* int: allow ctl-alt-del to reboot */ + KERN_PRINTK, /* sturct: control printk logging parameters */ +}; + /* CTL_VM names: */ -#define VM_SWAPCTL 1 /* struct: Set vm swapping control */ -#define VM_KSWAPD 2 /* struct: control background pageout */ -#define VM_FREEPG 3 /* struct: Set free page thresholds */ -#define VM_BDFLUSH 4 /* struct: Control buffer cache flushing */ -#define VM_MAXID 5 +enum +{ + VM_SWAPCTL=1, /* struct: Set vm swapping control */ + VM_KSWAPD, /* struct: control background pageout */ + VM_SWAPOUT, /* int: Background pageout interval */ + VM_FREEPG, /* struct: Set free page thresholds */ + VM_BDFLUSH, /* struct: Control buffer cache flushing */ + VM_OVERCOMMIT_MEMORY, /* Turn off the virtual memory safety limit */ +}; + /* CTL_NET names: */ -#define NET_CORE 1 -#define NET_ETHER 2 -#define NET_802 3 -#define NET_UNIX 4 -#define NET_IPV4 5 -#define NET_IPX 6 -#define NET_ATALK 7 -#define NET_NETROM 8 -#define NET_AX25 9 -#define NET_BRIDGE 10 -#define NET_IPV6 11 -#define NET_ROSE 12 -#define NET_X25 13 +enum +{ + NET_CORE=1, + NET_ETHER, + NET_802, + NET_UNIX, + NET_IPV4, + NET_IPX, + NET_ATALK, + NET_NETROM, + NET_AX25, + NET_BRIDGE, + NET_IPV6, + NET_ROSE, + NET_X25, + NET_TR, +}; + /* /proc/sys/net/core */ @@ -93,52 +112,121 @@ struct __sysctl_args { /* /proc/sys/net/unix */ /* /proc/sys/net/ipv4 */ -#define NET_IPV4_ARP_RES_TIME 1 -#define NET_IPV4_ARP_DEAD_RES_TIME 2 -#define NET_IPV4_ARP_MAX_TRIES 3 -#define NET_IPV4_ARP_TIMEOUT 4 -#define NET_IPV4_ARP_CHECK_INTERVAL 5 -#define NET_IPV4_ARP_CONFIRM_INTERVAL 6 -#define NET_IPV4_ARP_CONFIRM_TIMEOUT 7 -#define NET_IPV4_TCP_VEGAS_CONG_AVOID 8 +enum +{ + NET_IPV4_ARP_RES_TIME=1, + NET_IPV4_ARP_DEAD_RES_TIME, + NET_IPV4_ARP_MAX_TRIES, + NET_IPV4_ARP_TIMEOUT, + NET_IPV4_ARP_CHECK_INTERVAL, + NET_IPV4_ARP_CONFIRM_INTERVAL, + NET_IPV4_ARP_CONFIRM_TIMEOUT, + NET_IPV4_TCP_HOE_RETRANSMITS, + NET_IPV4_TCP_SACK, + NET_IPV4_TCP_TSACK, + NET_IPV4_TCP_TIMESTAMPS, + NET_IPV4_TCP_WINDOW_SCALING, + NET_IPV4_TCP_VEGAS_CONG_AVOID, + NET_IPV4_FORWARDING, + NET_IPV4_DEFAULT_TTL, + NET_IPV4_RFC1812_FILTER, + NET_IPV4_LOG_MARTIANS, + NET_IPV4_SOURCE_ROUTE, + NET_IPV4_ADDRMASK_AGENT, + NET_IPV4_BOOTP_AGENT, + NET_IPV4_BOOTP_RELAY, + NET_IPV4_FIB_MODEL, + NET_IPV4_NO_PMTU_DISC, + NET_IPV4_ACCEPT_REDIRECTS, + NET_IPV4_SECURE_REDIRECTS, + NET_IPV4_RFC1620_REDIRECTS, +}; + /* /proc/sys/net/ipv6 */ -#define NET_IPV6_FORWARDING 1 -#define NET_IPV6_HOPLIMIT 2 +enum { + NET_IPV6_FORWARDING = 1, + NET_IPV6_HOPLIMIT, + + NET_IPV6_ACCEPT_RA, + NET_IPV6_ACCEPT_REDIRECTS, + + NET_IPV6_ND_MAX_MCAST_SOLICIT, + NET_IPV6_ND_MAX_UCAST_SOLICIT, + NET_IPV6_ND_RETRANS_TIME, + NET_IPV6_ND_REACHABLE_TIME, + NET_IPV6_ND_DELAY_PROBE_TIME, + + NET_IPV6_AUTOCONF, + NET_IPV6_DAD_TRANSMITS, + NET_IPV6_RTR_SOLICITS, + NET_IPV6_RTR_SOLICIT_INTERVAL, + NET_IPV6_RTR_SOLICIT_DELAY, +}; + /* /proc/sys/net/ipx */ /* /proc/sys/net/appletalk */ /* /proc/sys/net/netrom */ -#define NET_NETROM_DEFAULT_PATH_QUALITY 1 -#define NET_NETROM_OBSOLESCENCE_COUNT_INITIALISER 2 -#define NET_NETROM_NETWORK_TTL_INITIALISER 3 -#define NET_NETROM_TRANSPORT_TIMEOUT 4 -#define NET_NETROM_TRANSPORT_MAXIMUM_TRIES 5 -#define NET_NETROM_TRANSPORT_ACKNOWLEDGE_DELAY 6 -#define NET_NETROM_TRANSPORT_BUSY_DELAY 7 -#define NET_NETROM_TRANSPORT_REQUESTED_WINDOW_SIZE 8 -#define NET_NETROM_TRANSPORT_NO_ACTIVITY_TIMEOUT 9 -#define NET_NETROM_TRANSPORT_PACKET_LENGTH 10 -#define NET_NETROM_ROUTING_CONTROL 11 +enum { + NET_NETROM_DEFAULT_PATH_QUALITY = 1, + NET_NETROM_OBSOLESCENCE_COUNT_INITIALISER, + NET_NETROM_NETWORK_TTL_INITIALISER, + NET_NETROM_TRANSPORT_TIMEOUT, + NET_NETROM_TRANSPORT_MAXIMUM_TRIES, + NET_NETROM_TRANSPORT_ACKNOWLEDGE_DELAY, + NET_NETROM_TRANSPORT_BUSY_DELAY, + NET_NETROM_TRANSPORT_REQUESTED_WINDOW_SIZE, + NET_NETROM_TRANSPORT_NO_ACTIVITY_TIMEOUT, + NET_NETROM_ROUTING_CONTROL, + NET_NETROM_LINK_FAILS_COUNT +}; /* /proc/sys/net/ax25 */ -/* Values are generated dynamically */ +enum { + NET_AX25_IP_DEFAULT_MODE = 1, + NET_AX25_DEFAULT_MODE, + NET_AX25_BACKOFF_TYPE, + NET_AX25_CONNECT_MODE, + NET_AX25_STANDARD_WINDOW, + NET_AX25_EXTENDED_WINDOW, + NET_AX25_T1_TIMEOUT, + NET_AX25_T2_TIMEOUT, + NET_AX25_T3_TIMEOUT, + NET_AX25_IDLE_TIMEOUT, + NET_AX25_N2, + NET_AX25_PACLEN, + NET_AX25_PROTOCOL, + NET_AX25_DAMA_SLAVE_TIMEOUT +}; /* /proc/sys/net/rose */ -#define NET_ROSE_RESTART_REQUEST_TIMEOUT 1 -#define NET_ROSE_CALL_REQUEST_TIMEOUT 2 -#define NET_ROSE_RESET_REQUEST_TIMEOUT 3 -#define NET_ROSE_CLEAR_REQUEST_TIMEOUT 4 -#define NET_ROSE_NO_ACTIVITY_TIMEOUT 5 -#define NET_ROSE_ROUTING_CONTROL 6 +enum { + NET_ROSE_RESTART_REQUEST_TIMEOUT = 1, + NET_ROSE_CALL_REQUEST_TIMEOUT, + NET_ROSE_RESET_REQUEST_TIMEOUT, + NET_ROSE_CLEAR_REQUEST_TIMEOUT, + NET_ROSE_NO_ACTIVITY_TIMEOUT, + NET_ROSE_ACK_HOLD_BACK_TIMEOUT, + NET_ROSE_ROUTING_CONTROL, + NET_ROSE_LINK_FAIL_TIMEOUT +}; /* /proc/sys/net/x25 */ -#define NET_X25_RESTART_REQUEST_TIMEOUT 1 -#define NET_X25_CALL_REQUEST_TIMEOUT 2 -#define NET_X25_RESET_REQUEST_TIMEOUT 3 -#define NET_X25_CLEAR_REQUEST_TIMEOUT 4 -#define NET_X25_ACK_HOLDBACK_TIMEOUT 5 +enum { + NET_X25_RESTART_REQUEST_TIMEOUT = 1, + NET_X25_CALL_REQUEST_TIMEOUT, + NET_X25_RESET_REQUEST_TIMEOUT, + NET_X25_CLEAR_REQUEST_TIMEOUT, + NET_X25_ACK_HOLD_BACK_TIMEOUT +}; + +/* /proc/sys/net/token-ring */ +enum +{ + NET_TR_RIF_TIMEOUT=1 +}; /* CTL_PROC names: */ @@ -151,7 +239,7 @@ struct __sysctl_args { #ifdef __KERNEL__ extern asmlinkage int sys_sysctl(struct __sysctl_args *); -extern void init_sysctl(void); +extern void sysctl_init(void); typedef struct ctl_table ctl_table; diff --git a/include/linux/tasks.h b/include/linux/tasks.h index 4540e34f0..4a82ad4e0 100644 --- a/include/linux/tasks.h +++ b/include/linux/tasks.h @@ -16,4 +16,10 @@ #define MAX_TASKS_PER_USER (NR_TASKS/2) #define MIN_TASKS_LEFT_FOR_ROOT 4 + +/* + * This controls the maximum pid allocated to a process + */ +#define PID_MAX 0x8000 + #endif diff --git a/include/linux/time.h b/include/linux/time.h index 7482f8e2e..0ecf7bbba 100644 --- a/include/linux/time.h +++ b/include/linux/time.h @@ -24,10 +24,10 @@ struct timezone { #define NFDBITS __NFDBITS #ifdef __KERNEL__ -void do_gettimeofday(struct timeval *tv); -void do_settimeofday(struct timeval *tv); -void get_fast_time(struct timeval *tv); -void (*do_get_fast_time)(struct timeval *); +extern void do_gettimeofday(struct timeval *tv); +extern void do_settimeofday(struct timeval *tv); +extern void get_fast_time(struct timeval *tv); +extern void (*do_get_fast_time)(struct timeval *); #endif #ifdef __KERNEL__ diff --git a/include/linux/timex.h b/include/linux/timex.h index ff5420832..c6e1527f6 100644 --- a/include/linux/timex.h +++ b/include/linux/timex.h @@ -17,6 +17,9 @@ /* * Modification history timex.h * + * 9 Jan 97 Adrian Sun + * Shifted LATCH define to allow access to alpha machines. + * * 26 Sep 94 David L. Mills * Added defines for hybrid phase/frequency-lock loop. * @@ -122,15 +125,16 @@ #define PPS_VALID 120 /* pps signal watchdog max (s) */ #define MAXGLITCH 30 /* pps signal glitch max (s) */ +/* LATCH is used in the interval timer and ftape setup. */ +#define CLOCK_TICK_RATE 1193180 /* Underlying HZ */ +#define LATCH ((CLOCK_TICK_RATE + HZ/2) / HZ) /* For divider */ + #ifndef __alpha__ /* * This definitively is wrong for the Alpha and none of the * kernel code seems to reference this anymore. */ -#define CLOCK_TICK_RATE 1193180 /* Underlying HZ */ #define CLOCK_TICK_FACTOR 20 /* Factor of both 1000000 and CLOCK_TICK_RATE */ -#define LATCH ((CLOCK_TICK_RATE + HZ/2) / HZ) /* For divider */ - #define FINETUNE ((((((long)LATCH * HZ - CLOCK_TICK_RATE) << SHIFT_HZ) * \ (1000000/CLOCK_TICK_FACTOR) / (CLOCK_TICK_RATE/CLOCK_TICK_FACTOR)) \ << (SHIFT_SCALE-SHIFT_HZ)) / HZ) diff --git a/include/linux/tpqic02.h b/include/linux/tpqic02.h index d25fd465a..fe13ad6e0 100644 --- a/include/linux/tpqic02.h +++ b/include/linux/tpqic02.h @@ -1,4 +1,4 @@ -/* $Id: tpqic02.h,v 0.25 1994/07/21 02:16:30 root Exp root $ +/* $Id: tpqic02.h,v 1.5 1996/12/14 23:01:38 root Exp root $ * * Include file for QIC-02 driver for Linux. * @@ -12,7 +12,7 @@ #include <linux/config.h> -#if CONFIG_QIC02_TAPE +#if CONFIG_QIC02_TAPE || CONFIG_QIC02_TAPE_MODULE /* need to have QIC02_TAPE_DRIVE and QIC02_TAPE_IFC expand to something */ #include <linux/mtio.h> @@ -28,6 +28,9 @@ * * Support for Mountain controllers was added by Erik Jacobson * and severely hacked by me. -- hhb + * + * Support for Emerald controllers by Alan Bain <afrb2@chiark.chu.cam.ac.uk> + * with more hacks by me. -- hhb */ #define WANGTEK 1 /* don't know about Wangtek QIC-36 */ #define EVEREX (WANGTEK+1) /* I heard *some* of these are identical */ @@ -39,6 +42,11 @@ #define ARCHIVE_SC499 ARCHIVE /* SC402 and SC499R should be identical */ #define MOUNTAIN 5 /* Mountain Computer Interface */ +#define EMERALD 6 /* Emerald Interface card */ + + + +#define QIC02_TAPE_PORT_RANGE 8 /* number of IO locations to reserve */ /*********** START OF USER CONFIGURABLE SECTION ************/ @@ -205,6 +213,7 @@ #define WT_QIC02_DATA_PORT (QIC02_TAPE_PORT+1) /* status register bits (Active LOW!) */ +#define WT_QIC02_STAT_POLARITY 0 #define WT_QIC02_STAT_READY 0x01 #define WT_QIC02_STAT_EXCEPTION 0x02 #define WT_QIC02_STAT_MASK (WT_QIC02_STAT_READY|WT_QIC02_STAT_EXCEPTION) @@ -221,6 +230,31 @@ #define WT_CTL_DMA3 0x10 /* enable dma chan3 */ #define WT_CTL_DMA1 0x08 /* enable dma chan1 or chan2 */ +/* EMERALD interface card specifics + * Much like Wangtek, only different polarity and bit locations + */ +#define EMR_QIC02_STAT_PORT (QIC02_TAPE_PORT) +#define EMR_QIC02_CTL_PORT (QIC02_TAPE_PORT) +#define EMR_QIC02_CMD_PORT (QIC02_TAPE_PORT+1) +#define EMR_QIC02_DATA_PORT (QIC02_TAPE_PORT+1) + +/* status register bits (Active High!) */ +#define EMR_QIC02_STAT_POLARITY 1 +#define EMR_QIC02_STAT_READY 0x01 +#define EMR_QIC02_STAT_EXCEPTION 0x02 +#define EMR_QIC02_STAT_MASK (EMR_QIC02_STAT_READY|EMR_QIC02_STAT_EXCEPTION) + +#define EMR_QIC02_STAT_RESETMASK 0x07 +#define EMR_QIC02_STAT_RESETVAL (EMR_QIC02_STAT_RESETMASK & ~EMR_QIC02_STAT_EXCEPTION) + +/* controller register (QIC02_CTL_PORT) bits */ +#define EMR_QIC02_CTL_RESET 0x02 +#define EMR_QIC02_CTL_REQUEST 0x04 +#define EMR_CTL_ONLINE 0x01 +#define EMR_CTL_CMDOFF 0xC0 + +#define EMR_CTL_DMA3 0x10 /* enable dma chan3 */ +#define EMR_CTL_DMA1 0x08 /* enable dma chan1 or chan2 */ @@ -234,6 +268,7 @@ #define AR_RESET_DMA_PORT (QIC02_TAPE_PORT+3) /* STAT port bits */ +#define AR_QIC02_STAT_POLARITY 0 #define AR_STAT_IRQF 0x80 /* active high, interrupt request flag */ #define AR_QIC02_STAT_READY 0x40 /* active low */ #define AR_QIC02_STAT_EXCEPTION 0x20 /* active low */ @@ -266,6 +301,7 @@ #define MTN_W_DMA_WRITE_PORT (QIC02_TAPE_PORT+3) /* STAT port bits */ +#define MTN_QIC02_STAT_POLARITY 0 #define MTN_QIC02_STAT_READY 0x02 /* active low */ #define MTN_QIC02_STAT_EXCEPTION 0x04 /* active low */ #define MTN_QIC02_STAT_MASK (MTN_QIC02_STAT_READY|MTN_QIC02_STAT_EXCEPTION) @@ -274,7 +310,7 @@ #define MTN_QIC02_STAT_RESETMASK 0x07 /* check RDY,EXC,DMADONE */ #define MTN_QIC02_STAT_RESETVAL ((MTN_QIC02_STAT_RESETMASK & ~MTN_QIC02_STAT_EXCEPTION) | MTN_STAT_DMADONE) - /* CTL port bits */ +/* CTL port bits */ #define MTN_QIC02_CTL_RESET_NOT 0x80 /* drive reset, active low */ #define MTN_QIC02_CTL_RESET 0x80 /* Fodder #definition to keep gcc happy */ @@ -294,6 +330,7 @@ # define QIC02_TAPE_DEBUG (qic02_tape_debug) # if QIC02_TAPE_IFC == WANGTEK +# define QIC02_STAT_POLARITY WT_QIC02_STAT_POLARITY # define QIC02_STAT_PORT WT_QIC02_STAT_PORT # define QIC02_CTL_PORT WT_QIC02_CTL_PORT # define QIC02_CMD_PORT WT_QIC02_CMD_PORT @@ -320,7 +357,36 @@ # error Unsupported or incorrect DMA configuration. # endif +# elif QIC02_TAPE_IFC == EMERALD +# define QIC02_STAT_POLARITY EMR_QIC02_STAT_POLARITY +# define QIC02_STAT_PORT EMR_QIC02_STAT_PORT +# define QIC02_CTL_PORT EMR_QIC02_CTL_PORT +# define QIC02_CMD_PORT EMR_QIC02_CMD_PORT +# define QIC02_DATA_PORT EMR_QIC02_DATA_PORT + +# define QIC02_STAT_READY EMR_QIC02_STAT_READY +# define QIC02_STAT_EXCEPTION EMR_QIC02_STAT_EXCEPTION +# define QIC02_STAT_MASK EMR_QIC02_STAT_MASK +# define QIC02_STAT_RESETMASK EMR_QIC02_STAT_RESETMASK +# define QIC02_STAT_RESETVAL EMR_QIC02_STAT_RESETVAL + +# define QIC02_CTL_RESET EMR_QIC02_CTL_RESET +# define QIC02_CTL_REQUEST EMR_QIC02_CTL_REQUEST + +# if QIC02_TAPE_DMA == 3 +# ifdef QIC02_TAPE_DMA3_FIX +# define EMR_CTL_DMA EMR_CTL_DMA1 +# else +# define EMR_CTL_DMA EMR_CTL_DMA3 +# endif +# elif QIC02_TAPE_DMA == 1 +# define EMR_CTL_DMA EMR_CTL_DMA1 +# else +# error Unsupported or incorrect DMA configuration. +# endif + # elif QIC02_TAPE_IFC == ARCHIVE +# define QIC02_STAT_POLARITY AR_QIC02_STAT_POLARITY # define QIC02_STAT_PORT AR_QIC02_STAT_PORT # define QIC02_CTL_PORT AR_QIC02_CTL_PORT # define QIC02_CMD_PORT AR_QIC02_CMD_PORT @@ -340,6 +406,7 @@ # endif # elif QIC02_TAPE_IFC == MOUNTAIN +# define QIC02_STAT_POLARITY MTN_QIC02_STAT_POLARITY # define QIC02_STAT_PORT MTN_QIC02_STAT_PORT # define QIC02_CTL_PORT MTN_QIC02_CTL_PORT # define QIC02_CMD_PORT MTN_QIC02_CMD_PORT @@ -393,6 +460,7 @@ # define QIC02_CMD_PORT (qic02_tape_ccb.port_cmd) # define QIC02_DATA_PORT (qic02_tape_ccb.port_data) +# define QIC02_STAT_POLARITY (qic02_tape_ccb.stat_polarity) # define QIC02_STAT_READY (qic02_tape_ccb.stat_ready) # define QIC02_STAT_EXCEPTION (qic02_tape_ccb.stat_exception) # define QIC02_STAT_MASK (qic02_tape_ccb.stat_mask) @@ -617,10 +685,10 @@ typedef char flag; /* NR_BLK_BUF is a `tuneable parameter'. If you're really low on * kernel space, you could decrease it to 1, or if you got a very - * slow machine, you could increase it up to 128 blocks. Less kernel + * slow machine, you could increase it up to 127 blocks. Less kernel * buffer blocks result in more context-switching. */ -#define NR_BLK_BUF 20 /* max 128 blocks */ +#define NR_BLK_BUF 20 /* max 127 blocks */ #define TAPE_BLKSIZE 512 /* streamer tape block size (fixed) */ #define TPQBUF_SIZE (TAPE_BLKSIZE*NR_BLK_BUF) /* buffer size */ @@ -642,6 +710,7 @@ struct qic02_ccb { unsigned short port_data; /* Data port address */ /* status register bits */ + unsigned short stat_polarity; /* invert status bits or not */ unsigned short stat_ready; /* drive ready */ unsigned short stat_exception; /* drive signals exception */ unsigned short stat_mask; @@ -656,8 +725,12 @@ struct qic02_ccb { unsigned short dma_enable_value; }; - +#if MODULE +static int qic02_tape_init(void); +#else extern int qic02_tape_init(void); /* for mem.c */ +#endif + #endif /* CONFIG_QIC02_TAPE */ diff --git a/include/linux/tqueue.h b/include/linux/tqueue.h index 8bd4e7f30..acebad9f2 100644 --- a/include/linux/tqueue.h +++ b/include/linux/tqueue.h @@ -15,6 +15,7 @@ #include <asm/bitops.h> #include <asm/system.h> +#include <asm/spinlock.h> /* * New proposed "bottom half" handlers: @@ -74,48 +75,20 @@ extern task_queue tq_timer, tq_immediate, tq_scheduler, tq_disk; * interrupt. */ -/* - * queue_task_irq: put the bottom half handler "bh_pointer" on the list - * "bh_list". You may call this function only from an interrupt - * handler or a bottom half handler. - */ -extern __inline__ void queue_task_irq(struct tq_struct *bh_pointer, - task_queue *bh_list) -{ - if (!set_bit(0,&bh_pointer->sync)) { - bh_pointer->next = *bh_list; - *bh_list = bh_pointer; - } -} - -/* - * queue_task_irq_off: put the bottom half handler "bh_pointer" on the list - * "bh_list". You may call this function only when interrupts are off. - */ -extern __inline__ void queue_task_irq_off(struct tq_struct *bh_pointer, - task_queue *bh_list) -{ - if (!(bh_pointer->sync & 1)) { - bh_pointer->sync = 1; - bh_pointer->next = *bh_list; - *bh_list = bh_pointer; - } -} - +extern spinlock_t tqueue_lock; /* - * queue_task: as queue_task_irq, but can be called from anywhere. + * queue_task */ extern __inline__ void queue_task(struct tq_struct *bh_pointer, task_queue *bh_list) { if (!set_bit(0,&bh_pointer->sync)) { unsigned long flags; - save_flags(flags); - cli(); + spin_lock_irqsave(&tqueue_lock, flags); bh_pointer->next = *bh_list; *bh_list = bh_pointer; - restore_flags(flags); + spin_unlock_irqrestore(&tqueue_lock, flags); } } diff --git a/include/linux/trdevice.h b/include/linux/trdevice.h index 96801763d..77e4efb5d 100644 --- a/include/linux/trdevice.h +++ b/include/linux/trdevice.h @@ -3,7 +3,7 @@ * operating system. NET is implemented using the BSD Socket * interface as the means of communication with the user level. * - * Definitions for the Ethernet handlers. + * Definitions for the Token-ring handlers. * * Version: @(#)eth.h 1.0.4 05/13/93 * @@ -31,10 +31,11 @@ extern int tr_header(struct sk_buff *skb, struct device *dev, unsigned short type, void *daddr, void *saddr, unsigned len); -extern int tr_rebuild_header(void *buff, struct device *dev, - unsigned long raddr, struct sk_buff *skb); +extern int tr_rebuild_header(struct sk_buff *skb); extern unsigned short tr_type_trans(struct sk_buff *skb, struct device *dev); +extern struct device * init_trdev(struct device *, int); + #endif #endif /* _LINUX_TRDEVICE_H */ diff --git a/include/linux/tty.h b/include/linux/tty.h index 04c78e1ae..7546d632d 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -219,7 +219,7 @@ struct tty_struct { unsigned long flags; int count; struct winsize winsize; - unsigned char stopped:1, hw_stopped:1, packet:1; + unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1; unsigned char ctrl_status; struct tty_struct *link; @@ -286,7 +286,6 @@ extern struct tty_ldisc ldiscs[]; extern int fg_console, last_console, want_console; extern int kmsg_redirect; -extern struct wait_queue * keypress_wait; extern unsigned long con_init(unsigned long); @@ -300,6 +299,7 @@ extern int cy_init(void); extern int stl_init(void); extern int stli_init(void); extern int riscom8_init(void); +extern int espserial_init(void); extern int tty_paranoia_check(struct tty_struct *tty, kdev_t device, const char *routine); @@ -335,17 +335,18 @@ extern int n_tty_ioctl(struct tty_struct * tty, struct file * file, /* serial.c */ -extern int rs_open(struct tty_struct * tty, struct file * filp); +extern long serial_console_init(long kmem_start, long kmem_end); -/* pty.c */ +/* pcxx.c */ -extern int pty_open(struct tty_struct * tty, struct file * filp); extern int pcxe_open(struct tty_struct *tty, struct file *filp); /* console.c */ -extern int con_open(struct tty_struct * tty, struct file * filp); extern void update_screen(int new_console); + +/* printk.c */ + extern void console_print(const char *); /* vt.c */ diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h index 244122047..a2313af6a 100644 --- a/include/linux/tty_driver.h +++ b/include/linux/tty_driver.h @@ -107,6 +107,7 @@ struct tty_driver { int magic; /* magic number for this structure */ + const char *driver_name; const char *name; int name_base; /* offset of printed name */ short major; /* major device number */ @@ -117,6 +118,7 @@ struct tty_driver { struct termios init_termios; /* Initial termios */ int flags; /* tty driver flags */ int *refcount; /* for loadable tty drivers */ + struct proc_dir_entry *proc_entry; /* /proc fs entry */ struct tty_driver *other; /* only used for the PTY driver */ /* @@ -150,6 +152,10 @@ struct tty_driver { void (*set_ldisc)(struct tty_struct *tty); void (*wait_until_sent)(struct tty_struct *tty, int timeout); void (*send_xchar)(struct tty_struct *tty, char ch); + int (*read_proc)(char *page, char **start, off_t off, + int count, int *eof, void *data); + int (*write_proc)(struct file *file, const char *buffer, + unsigned long count, void *data); /* * linked list pointers @@ -197,4 +203,8 @@ struct tty_driver { #define PTY_TYPE_MASTER 0x0001 #define PTY_TYPE_SLAVE 0x0002 +/* serial subtype definitions */ +#define SERIAL_TYPE_NORMAL 1 +#define SERIAL_TYPE_CALLOUT 2 + #endif /* #ifdef _LINUX_TTY_DRIVER_H */ diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h index 05a33261d..bc8e912ca 100644 --- a/include/linux/tty_ldisc.h +++ b/include/linux/tty_ldisc.h @@ -64,13 +64,12 @@ * This function notifies the line discpline that a change has * been made to the termios stucture. * - * int (*select)(struct tty_struct * tty, struct inode * inode, - * struct file * file, int sel_type, - * struct select_table_struct *wait); + * int (*poll)(struct tty_struct * tty, struct file * file, + * poll_table *wait); * - * This function is called when a user attempts to select on a + * This function is called when a user attempts to select/poll on a * tty device. It is solely the responsibility of the line - * discipline to handle select requests. + * discipline to handle poll requests. * * void (*receive_buf)(struct tty_struct *, const unsigned char *cp, * char *fp, int count); @@ -103,6 +102,7 @@ struct tty_ldisc { int magic; + char *name; int num; int flags; /* @@ -119,9 +119,7 @@ struct tty_ldisc { int (*ioctl)(struct tty_struct * tty, struct file * file, unsigned int cmd, unsigned long arg); void (*set_termios)(struct tty_struct *tty, struct termios * old); - int (*select)(struct tty_struct * tty, struct inode * inode, - struct file * file, int sel_type, - struct select_table_struct *wait); + unsigned int (*poll)(struct tty_struct *, struct file *, poll_table *); /* * The following routines are called from below. diff --git a/include/linux/uio.h b/include/linux/uio.h index 5fbc2f7f1..beaafffd3 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h @@ -1,6 +1,8 @@ #ifndef __LINUX_UIO_H #define __LINUX_UIO_H +#include <linux/types.h> + /* * Berkeley style UIO structures - Alan Cox 1994. * @@ -17,14 +19,19 @@ struct iovec { void *iov_base; /* BSD uses caddr_t (1003.1g requires void *) */ - size_t iov_len; /* Must be size_t (1003.1g) */ + __kernel_size_t iov_len; /* Must be size_t (1003.1g) */ }; /* * UIO_MAXIOV shall be at least 16 1003.1g (5.4.1.1) */ +#define UIO_FASTIOV 8 +#define UIO_MAXIOV 1024 +#if 0 #define UIO_MAXIOV 16 /* Maximum iovec's in one operation 16 matches BSD */ + /* Beg pardon: BSD has 1024 --ANK */ +#endif #endif diff --git a/include/linux/ultrasound.h b/include/linux/ultrasound.h index 9021ae919..6b7703e75 100644 --- a/include/linux/ultrasound.h +++ b/include/linux/ultrasound.h @@ -6,7 +6,7 @@ * and not portable. */ /* - * Copyright (C) by Hannu Savolainen 1993-1996 + * Copyright (C) by Hannu Savolainen 1993-1997 * * OSS/Free for Linux is distributed under the GNU GENERAL PUBLIC LICENSE (GPL) * Version 2 (June 1991). See the "COPYING" file distributed with this software diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h index 7fc973198..fcc6ad09f 100644 --- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h @@ -20,13 +20,17 @@ int vread(char *buf, char *addr, int count); extern inline void set_pgdir(unsigned long address, pgd_t entry) { +#if !defined(__mc68000__) && !defined(__sparc_v9__) struct task_struct * p; + read_lock(&tasklist_lock); for_each_task(p) { if (!p->mm) continue; *pgd_offset(p->mm,address) = entry; } + read_unlock(&tasklist_lock); +#endif } #endif diff --git a/include/linux/wait.h b/include/linux/wait.h index be24fa242..0a0d11fc9 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h @@ -28,17 +28,17 @@ static inline int waitqueue_active(struct wait_queue **q) return head && head != WAIT_QUEUE_HEAD(q); } -struct select_table_entry { +struct poll_table_entry { struct wait_queue wait; struct wait_queue ** wait_address; }; -typedef struct select_table_struct { +typedef struct poll_table_struct { unsigned int nr; - struct select_table_entry * entry; -} select_table; + struct poll_table_entry * entry; +} poll_table; -#define __MAX_SELECT_TABLE_ENTRIES (PAGE_SIZE / sizeof (struct select_table_entry)) +#define __MAX_POLL_TABLE_ENTRIES (PAGE_SIZE / sizeof (struct poll_table_entry)) #endif /* __KERNEL__ */ diff --git a/include/linux/wanpipe.h b/include/linux/wanpipe.h new file mode 100644 index 000000000..f36642161 --- /dev/null +++ b/include/linux/wanpipe.h @@ -0,0 +1,131 @@ +/***************************************************************************** +* wanpipe.h WANPIPE(tm) Multiprotocol WAN Link Driver. +* User-level API definitions. +* +* Author: Gene Kozin <genek@compuserve.com> +* +* Copyright: (c) 1995-1997 Sangoma Technologies Inc. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version +* 2 of the License, or (at your option) any later version. +* ============================================================================ +* Jan 02, 1997 Gene Kozin Version 3.0.0 +*****************************************************************************/ +#ifndef _WANPIPE_H +#define _WANPIPE_H + +#include <linux/wanrouter.h> + +/* Defines */ +#define WANPIPE_MAGIC 0x414C4453L /* signatire: 'SDLA' reversed */ + +/* IOCTL numbers (up to 16) */ +#define WANPIPE_DUMP (ROUTER_USER+0) /* dump adapter's memory */ +#define WANPIPE_EXEC (ROUTER_USER+1) /* execute firmware command */ + +/* + * Data structures for IOCTL calls. + */ + +typedef struct sdla_dump /* WANPIPE_DUMP */ +{ + unsigned long magic; /* for verification */ + unsigned long offset; /* absolute adapter memory address */ + unsigned long length; /* block length */ + void* ptr; /* -> buffer */ +} sdla_dump_t; + +typedef struct sdla_exec /* WANPIPE_EXEC */ +{ + unsigned long magic; /* for verification */ + void* cmd; /* -> command structure */ + void* data; /* -> data buffer */ +} sdla_exec_t; + +#ifdef __KERNEL__ +/****** Kernel Interface ****************************************************/ + +#include <linux/sdladrv.h> /* SDLA support module API definitions */ +#include <linux/sdlasfm.h> /* SDLA firmware module definitions */ + +#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) +#define is_alpha(ch) ((((ch)>=(unsigned)'a'&&(ch)<=(unsigned)'z')||\ + ((ch)>=(unsigned)'A'&&(ch)<=(unsigned)'Z'))?1:0) +#define is_hex_digit(ch) ((((ch)>=(unsigned)'0'&&(ch)<=(unsigned)'9')||\ + ((ch)>=(unsigned)'a'&&(ch)<=(unsigned)'f')||\ + ((ch)>=(unsigned)'A'&&(ch)<=(unsigned)'F'))?1:0) + +/****** Data Structures *****************************************************/ + +/* Adapter Data Space. + * This structure is needed because we handle multiple cards, otherwise + * static data would do it. + */ +typedef struct sdla +{ + char devname[WAN_DRVNAME_SZ+1]; /* card name */ + sdlahw_t hw; /* hardware configuration */ + wan_device_t wandev; /* WAN device data space */ + unsigned open_cnt; /* number of open interfaces */ + unsigned long state_tick; /* link state timestamp */ + char in_isr; /* interrupt-in-service flag */ + void* mbox; /* -> mailbox */ + void* rxmb; /* -> receive mailbox */ + void* flags; /* -> adapter status flags */ + void (*isr)(struct sdla* card); /* interrupt service routine */ + void (*poll)(struct sdla* card); /* polling routine */ + int (*exec)(struct sdla* card, void* u_cmd, void* u_data); + union + { + struct + { /****** X.25 specific data **********/ + unsigned lo_pvc; + unsigned hi_pvc; + unsigned lo_svc; + unsigned hi_svc; + } x; + struct + { /****** frame relay specific data ***/ + void* rxmb_base; /* -> first Rx buffer */ + void* rxmb_last; /* -> last Rx buffer */ + unsigned rx_base; /* S508 receive buffer base */ + unsigned rx_top; /* S508 receive buffer end */ + unsigned short node_dlci; + unsigned short dlci_num; + } f; + struct /****** PPP-specific data ***********/ + { + char if_name[WAN_IFNAME_SZ+1]; /* interface name */ + void* txbuf; /* -> current Tx buffer */ + void* txbuf_base; /* -> first Tx buffer */ + void* txbuf_last; /* -> last Tx buffer */ + void* rxbuf_base; /* -> first Rx buffer */ + void* rxbuf_last; /* -> last Rx buffer */ + unsigned rx_base; /* S508 receive buffer base */ + unsigned rx_top; /* S508 receive buffer end */ + } p; + } u; +} sdla_t; + +/****** Public Functions ****************************************************/ + +void wanpipe_open (sdla_t* card); /* wpmain.c */ +void wanpipe_close (sdla_t* card); /* wpmain.c */ +void wanpipe_set_state (sdla_t* card, int state); /* wpmain.c */ + +int wpx_init (sdla_t* card, wandev_conf_t* conf); /* wpx.c */ +int wpf_init (sdla_t* card, wandev_conf_t* conf); /* wpf.c */ +int wpp_init (sdla_t* card, wandev_conf_t* conf); /* wpp.c */ + +#endif /* __KERNEL__ */ +#endif /* _WANPIPE_H */ + diff --git a/include/linux/wanrouter.h b/include/linux/wanrouter.h new file mode 100644 index 000000000..444608afb --- /dev/null +++ b/include/linux/wanrouter.h @@ -0,0 +1,332 @@ +/***************************************************************************** +* wanrouter.h Definitions for the WAN Multiprotocol Router Module. +* This module provides API and common services for WAN Link +* Drivers and is completely hardware-independent. +* +* Author: Gene Kozin <genek@compuserve.com> +* +* Copyright: (c) 1995-1997 Sangoma Technologies Inc. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version +* 2 of the License, or (at your option) any later version. +* ============================================================================ +* Jan 02, 1997 Gene Kozin Initial version (based on wanpipe.h). +*****************************************************************************/ +#ifndef _ROUTER_H +#define _ROUTER_H + +#define ROUTER_NAME "wanrouter" /* in case we ever change it */ +#define ROUTER_VERSION 1 /* version number */ +#define ROUTER_RELEASE 0 /* release (minor version) number */ +#define ROUTER_IOCTL 'W' /* for IOCTL calls */ +#define ROUTER_MAGIC 0x524D4157L /* signature: 'WANR' reversed */ + +/* IOCTL codes for /proc/router/<device> entries (up to 255) */ +enum router_ioctls +{ + ROUTER_SETUP = ROUTER_IOCTL<<8, /* configure device */ + ROUTER_DOWN, /* shut down device */ + ROUTER_STAT, /* get device status */ + ROUTER_IFNEW, /* add interface */ + ROUTER_IFDEL, /* delete interface */ + ROUTER_IFSTAT, /* get interface status */ + ROUTER_USER = (ROUTER_IOCTL<<8)+16, /* driver-specific calls */ + ROUTER_USER_MAX = (ROUTER_IOCTL<<8)+31 +}; + +/* NLPID for packet encapsulation (ISO/IEC TR 9577) */ +#define NLPID_IP 0xCC /* Internet Protocol Datagram */ +#define NLPID_SNAP 0x80 /* IEEE Subnetwork Access Protocol */ +#define NLPID_CLNP 0x81 /* ISO/IEC 8473 */ +#define NLPID_ESIS 0x82 /* ISO/IEC 9542 */ +#define NLPID_ISIS 0x83 /* ISO/IEC ISIS */ +#define NLPID_Q933 0x08 /* CCITT Q.933 */ + +/* Miscellaneous */ +#define WAN_IFNAME_SZ 15 /* max length of the interface name */ +#define WAN_DRVNAME_SZ 15 /* max length of the link driver name */ +#define WAN_ADDRESS_SZ 31 /* max length of the WAN media address */ + +/****** Data Types **********************************************************/ + +/*---------------------------------------------------------------------------- + * X.25-specific link-level configuration. + */ +typedef struct wan_x25_conf +{ + unsigned lo_pvc; /* lowest permanent circuit number */ + unsigned hi_pvc; /* highest permanent circuit number */ + unsigned lo_svc; /* lowest switched circuit number */ + unsigned hi_svc; /* highest switched circuit number */ + unsigned hdlc_window; /* HDLC window size (1..7) */ + unsigned pkt_window; /* X.25 packet window size (1..7) */ + unsigned t1; /* HDLC timer T1, sec (1..30) */ + unsigned t2; /* HDLC timer T2, sec (0..29) */ + unsigned t4; /* HDLC supervisory frame timer = T4 * T1 */ + unsigned n2; /* HDLC retransmission limit (1..30) */ + unsigned t10_t20; /* X.25 RESTART timeout, sec (1..255) */ + unsigned t11_t21; /* X.25 CALL timeout, sec (1..255) */ + unsigned t12_t22; /* X.25 RESET timeout, sec (1..255) */ + unsigned t13_t23; /* X.25 CLEAR timeout, sec (1..255) */ + unsigned t16_t26; /* X.25 INTERRUPT timeout, sec (1..255) */ + unsigned t28; /* X.25 REGISTRATION timeout, sec (1..255) */ + unsigned r10_r20; /* RESTART retransmission limit (0..250) */ + unsigned r12_r22; /* RESET retransmission limit (0..250) */ + unsigned r13_r23; /* CLEAR retransmission limit (0..250) */ + unsigned ccitt_compat; /* compatibility mode: 1988/1984/1980 */ +} wan_x25_conf_t; + +/*---------------------------------------------------------------------------- + * Frame relay specific link-level configuration. + */ +typedef struct wan_fr_conf +{ + unsigned cir; /* committed information rate */ + unsigned signalling; /* local in-channel signalling type */ + unsigned t391; /* link integrity verification timer */ + unsigned t392; /* polling verification timer */ + unsigned n391; /* full status polling cycle counter */ + unsigned n392; /* error threshold counter */ + unsigned n393; /* monitored events counter */ + unsigned dlci; /* first DLC number (access node) */ + unsigned dlci_num; /* number of DLCs (access node) */ +} wan_fr_conf_t; + +/*---------------------------------------------------------------------------- + * PPP-specific link-level configuration. + */ +typedef struct wan_ppp_conf +{ + unsigned restart_tmr; /* restart timer */ + unsigned auth_rsrt_tmr; /* authentication timer */ + unsigned auth_wait_tmr; /* authentication timer */ + unsigned mdm_fail_tmr; /* modem failure timer */ + unsigned dtr_drop_tmr; /* DTR drop timer */ + unsigned connect_tmout; /* connection timeout */ + unsigned conf_retry; /* max. retry */ + unsigned term_retry; /* max. retry */ + unsigned fail_retry; /* max. retry */ + unsigned auth_retry; /* max. retry */ + unsigned auth_options; /* authentication opt. */ + unsigned ip_options; /* IP options */ +} wan_ppp_conf_t; + +/*---------------------------------------------------------------------------- + * WAN device configuration. Passed to ROUTER_SETUP IOCTL. + */ +typedef struct wandev_conf +{ + unsigned magic; /* magic number (for verification) */ + unsigned config_id; /* configuration structure identifier */ + /****** hardware configuration ******/ + unsigned ioport; /* adapter I/O port base */ + unsigned long maddr; /* dual-port memory address */ + unsigned msize; /* dual-port memory size */ + int irq; /* interrupt request level */ + int dma; /* DMA request level */ + unsigned bps; /* data transfer rate */ + unsigned mtu; /* maximum transmit unit size */ + char interface; /* RS-232/V.35, etc. */ + char clocking; /* external/internal */ + char line_coding; /* NRZ/NRZI/FM0/FM1, etc. */ + char station; /* DTE/DCE, primary/secondary, etc. */ + char connection; /* permanent/switched/on-demand */ + unsigned hw_opt[4]; /* other hardware options */ + unsigned reserved[4]; + /****** arbitrary data ***************/ + unsigned data_size; /* data buffer size */ + void* data; /* data buffer, e.g. firmware */ + union /****** protocol-specific ************/ + { + wan_x25_conf_t x25; /* X.25 configuration */ + wan_ppp_conf_t ppp; /* PPP configuration */ + wan_fr_conf_t fr; /* frame relay configuration */ + } u; +} wandev_conf_t; + +/* 'config_id' definitions */ +#define WANCONFIG_X25 101 /* X.25 link */ +#define WANCONFIG_FR 102 /* frame relay link */ +#define WANCONFIG_PPP 103 /* synchronous PPP link */ + +/* + * Configuration options defines. + */ +/* general options */ +#define WANOPT_OFF 0 +#define WANOPT_ON 1 +#define WANOPT_NO 0 +#define WANOPT_YES 1 + +/* intercace options */ +#define WANOPT_RS232 0 +#define WANOPT_V35 1 + +/* data encoding options */ +#define WANOPT_NRZ 0 +#define WANOPT_NRZI 1 +#define WANOPT_FM0 2 +#define WANOPT_FM1 3 + +/* link type options */ +#define WANOPT_POINTTOPOINT 0 /* RTS always active */ +#define WANOPT_MULTIDROP 1 /* RTS is active when transmitting */ + +/* clocking options */ +#define WANOPT_EXTERNAL 0 +#define WANOPT_INTERNAL 1 + +/* station options */ +#define WANOPT_DTE 0 +#define WANOPT_DCE 1 +#define WANOPT_CPE 0 +#define WANOPT_NODE 1 +#define WANOPT_SECONDARY 0 +#define WANOPT_PRIMARY 1 + +/* connection options */ +#define WANOPT_PERMANENT 0 /* DTR always active */ +#define WANOPT_SWITCHED 1 /* use DTR to setup link (dial-up) */ +#define WANOPT_ONDEMAND 2 /* activate DTR only before sending */ + +/* frame relay in-channel signalling */ +#define WANOPT_FR_ANSI 0 /* ANSI T1.617 Annex D */ +#define WANOPT_FR_Q933 1 /* ITU Q.933A */ +#define WANOPT_FR_LMI 2 /* LMI */ + +/*---------------------------------------------------------------------------- + * WAN Link Status Info (for ROUTER_STAT IOCTL). + */ +typedef struct wandev_stat +{ + unsigned state; /* link state */ + unsigned ndev; /* number of configured interfaces */ + + /* link/interface configuration */ + unsigned connection; /* permanent/switched/on-demand */ + unsigned media_type; /* Frame relay/PPP/X.25/SDLC, etc. */ + unsigned mtu; /* max. transmit unit for this device */ + + /* physical level statistics */ + unsigned modem_status; /* modem status */ + unsigned rx_frames; /* received frames count */ + unsigned rx_overruns; /* receiver overrun error count */ + unsigned rx_crc_err; /* receive CRC error count */ + unsigned rx_aborts; /* received aborted frames count */ + unsigned rx_bad_length; /* unexpetedly long/short frames count */ + unsigned rx_dropped; /* frames discarded at device level */ + unsigned tx_frames; /* transmitted frames count */ + unsigned tx_underruns; /* aborted transmissions (underruns) count */ + unsigned tx_timeouts; /* transmission timeouts */ + unsigned tx_rejects; /* other transmit errors */ + + /* media level statistics */ + unsigned rx_bad_format; /* frames with invalid format */ + unsigned rx_bad_addr; /* frames with invalid media address */ + unsigned tx_retries; /* frames re-transmitted */ + unsigned reserved[16]; /* reserved for future use */ +} wandev_stat_t; + +/* 'state' defines */ +enum wan_states +{ + WAN_UNCONFIGURED, /* link/channel is not configured */ + WAN_DISCONNECTED, /* link/channel is disconnected */ + WAN_CONNECTING, /* connection is in progress */ + WAN_CONNECTED, /* link/channel is operational */ + WAN_LIMIT /* for verification only */ +}; + +/* 'modem_status' masks */ +#define WAN_MODEM_CTS 0x0001 /* CTS line active */ +#define WAN_MODEM_DCD 0x0002 /* DCD line active */ +#define WAN_MODEM_DTR 0x0010 /* DTR line active */ +#define WAN_MODEM_RTS 0x0020 /* RTS line active */ + +/*---------------------------------------------------------------------------- + * WAN interface (logical channel) configuration (for ROUTER_IFNEW IOCTL). + */ +typedef struct wanif_conf +{ + unsigned magic; /* magic number */ + unsigned config_id; /* configuration identifier */ + char name[WAN_IFNAME_SZ+1]; /* interface name, ASCIIZ */ + char addr[WAN_ADDRESS_SZ+1]; /* media address, ASCIIZ */ + unsigned idle_timeout; /* sec, before disconnecting */ + unsigned hold_timeout; /* sec, before re-connecting */ + int reserved[8]; /* reserved for future extensions */ +} wanif_conf_t; + +#ifdef __KERNEL__ +/****** Kernel Interface ****************************************************/ + +#include <linux/fs.h> /* support for device drivers */ +#include <linux/proc_fs.h> /* proc filesystem pragmatics */ +#include <linux/inet.h> /* in_aton(), in_ntoa() prototypes */ +#include <linux/netdevice.h> /* support for network drivers */ + +/*---------------------------------------------------------------------------- + * WAN device data space. + */ +typedef struct wan_device +{ + unsigned magic; /* magic number */ + char* name; /* -> WAN device name (ASCIIZ) */ + void* private; /* -> driver private data */ + /****** hardware configuration ******/ + unsigned ioport; /* adapter I/O port base #1 */ + unsigned long maddr; /* dual-port memory address */ + unsigned msize; /* dual-port memory size */ + int irq; /* interrupt request level */ + int dma; /* DMA request level */ + unsigned bps; /* data transfer rate */ + unsigned mtu; /* max physical transmit unit size */ + char interface; /* RS-232/V.35, etc. */ + char clocking; /* external/internal */ + char line_coding; /* NRZ/NRZI/FM0/FM1, etc. */ + char station; /* DTE/DCE, primary/secondary, etc. */ + char connection; /* permanent/switched/on-demand */ + unsigned hw_opt[4]; /* other hardware options */ + /****** status and statistics *******/ + char state; /* device state */ + unsigned modem_status; /* modem status */ + struct enet_statistics stats; /* interface statistics */ + unsigned reserved[16]; /* reserved for future use */ + unsigned critical; /* critical section flag */ + /****** device management methods ***/ + int (*setup) (struct wan_device* wandev, wandev_conf_t* conf); + int (*shutdown) (struct wan_device* wandev); + int (*update) (struct wan_device* wandev); + int (*ioctl) (struct wan_device* wandev, unsigned cmd, + unsigned long arg); + int (*new_if) (struct wan_device* wandev, struct device* dev, + wanif_conf_t* conf); + int (*del_if) (struct wan_device* wandev, struct device* dev); + /****** maintained by the router ****/ + struct wan_device* next; /* -> next device */ + struct device* dev; /* list of network interfaces */ + unsigned ndev; /* number of interfaces */ + struct proc_dir_entry dent; /* proc filesystem entry */ +} wan_device_t; + +/* Init Point */ +extern void wanrouter_init(void); + +/* Public functions available for device drivers */ +extern int register_wan_device (wan_device_t* wandev); +extern int unregister_wan_device (char* name); +unsigned short wanrouter_type_trans (struct sk_buff* skb, struct device* dev); +int wanrouter_encapsulate (struct sk_buff* skb, struct device* dev); + +/* Proc interface functions. These must not be called by the drivers! */ +extern int wanrouter_proc_init (void); +extern void wanrouter_proc_cleanup (void); +extern int wanrouter_proc_add (wan_device_t* wandev); +extern int wanrouter_proc_delete (wan_device_t* wandev); +extern int wanrouter_ioctl(struct inode* inode, struct file* file, + unsigned int cmd, unsigned long arg); + +#endif /* __KERNEL__ */ +#endif /* _ROUTER_H */ diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h new file mode 100644 index 000000000..3f358258b --- /dev/null +++ b/include/linux/watchdog.h @@ -0,0 +1,40 @@ +/* + * Generic watchdog defines. Derived from.. + * + * Berkshire PC Watchdog Defines + * by Ken Hollis <khollis@bitgate.com> + * + */ + +#include <linux/ioctl.h> + +#define WATCHDOG_IOCTL_BASE 'W' + +struct watchdog_info { + u32 options; /* Options the card/driver supports */ + u32 firmware_version; /* Firmware version of the card */ + u8 identity[32]; /* Identity of the board */ +}; + +#define WDIOC_GETSUPPORT _IOR(WATCHDOG_IOCTL_BASE, 0, struct watchdog_info) +#define WDIOC_GETSTATUS _IOR(WATCHDOG_IOCTL_BASE, 1, int) +#define WDIOC_GETBOOTSTATUS _IOR(WATCHDOG_IOCTL_BASE, 2, int) +#define WDIOC_GETTEMP _IOR(WATCHDOG_IOCTL_BASE, 3, int) +#define WDIOC_SETOPTIONS _IOR(WATCHDOG_IOCTL_BASE, 4, int) +#define WDIOC_KEEPALIVE _IOR(WATCHDOG_IOCTL_BASE, 5, int) + +#define WDIOF_UNKNOWN -1 /* Unknown flag error */ +#define WDIOS_UNKNOWN -1 /* Unknown status error */ + +#define WDIOF_OVERHEAT 0x0001 /* Reset due to CPU overheat */ +#define WDIOF_FANFAULT 0x0002 /* Fan failed */ +#define WDIOF_EXTERN1 0x0004 /* External relay 1 */ +#define WDIOF_EXTERN2 0x0008 /* External relay 2 */ +#define WDIOF_POWERUNDER 0x0010 /* Power bad/power fault */ +#define WDIOF_CARDRESET 0x0020 /* Card previously reset the CPU */ +#define WDIOF_POWEROVER 0x0040 /* Power over voltage */ +#define WDIOF_KEEPALIVEPING 0x8000 /* Keep alive ping reply */ + +#define WDIOS_DISABLECARD 0x0001 /* Turn off the watchdog timer */ +#define WDIOS_ENABLECARD 0x0002 /* Turn on the watchdog timer */ +#define WDIOS_TEMPPANIC 0x0004 /* Kernel panic on temperature trip */ diff --git a/include/linux/wireless.h b/include/linux/wireless.h new file mode 100644 index 000000000..b15f2a0db --- /dev/null +++ b/include/linux/wireless.h @@ -0,0 +1,321 @@ +/* + * This file define a set of standard wireless extensions + * + * Version : 4 12.2.97 + * + * Authors : Jean Tourrilhes - HPLB - <jt@hplb.hpl.hp.com> + */ + +#ifndef _LINUX_WIRELESS_H +#define _LINUX_WIRELESS_H + +/************************** DOCUMENTATION **************************/ +/* + * Basically, the wireless extensions are for now a set of standard ioctl + * call + /proc/net/wireless + * + * The entry /proc/net/wireless give statistics and information on the + * driver. + * This is better than having each driver having its entry because + * its centralised and we may remove the driver module safely. + * + * Ioctl are used to configure the driver and issue commands. This is + * better than command line options of insmod because we may want to + * change dynamically (while the driver is running) some parameters. + * + * The ioctl mechanimsm are copied from standard devices ioctl. + * We have the list of command plus a structure descibing the + * data exchanged... + * Note that to add these ioctl, I was obliged to modify : + * net/core/dev.c (two place + add include) + * net/ipv4/af_inet.c (one place + add include) + * + * /proc/net/wireless is a copy of /proc/net/dev. + * We have a structure for data passed from the driver to /proc/net/wireless + * Too add this, I've modified : + * net/core/dev.c (two other places) + * include/linux/netdevice.h (one place) + * include/linux/proc_fs.h (one place) + * + * Do not add here things that are redundant with other mechanisms + * (drivers init, ifconfig, /proc/net/dev, ...) and with are not + * wireless specific. + * + * These wireless extensions are not magic : each driver has to provide + * support for them... + * + * IMPORTANT NOTE : As everything in the kernel, this is very much a + * work in progress. Contact me if you have ideas of improvements... + */ + +/***************************** INCLUDES *****************************/ + +#include <linux/types.h> /* for "caddr_t" et al */ +#include <linux/socket.h> /* for "struct sockaddr" et al */ +#include <linux/if.h> /* for IFNAMSIZ and co... */ + +/**************************** CONSTANTS ****************************/ + +/* --------------------------- VERSION --------------------------- */ +/* + * This constant is used to know the availability of the wireless + * extensions and to know which version of wireless extensions it is + * (there is some stuff that will be added in the future...) + * I just plan to increment with each new version. + */ +#define WIRELESS_EXT 5 + +/* + * Changes : + * + * V2 to V3 + * -------- + * Alan Cox start some incompatibles changes. I've integrated a bit more. + * - Encryption renamed to Encode to avoid US regulation problems + * - Frequency changed from float to struct to avoid problems on old 386 + * + * V3 to V4 + * -------- + * - Add sensitivity + * + * V4 to V5 + * -------- + * - Missing encoding definitions in range + * - Access points stuff + */ + +/* -------------------------- IOCTL LIST -------------------------- */ + +/* Basic operations */ +#define SIOCSIWNAME 0x8B00 /* Unused ??? */ +#define SIOCGIWNAME 0x8B01 /* get name */ +#define SIOCSIWNWID 0x8B02 /* set network id */ +#define SIOCGIWNWID 0x8B03 /* get network id */ +#define SIOCSIWFREQ 0x8B04 /* set channel/frequency */ +#define SIOCGIWFREQ 0x8B05 /* get channel/frequency */ +#define SIOCSIWENCODE 0x8B06 /* set encoding info */ +#define SIOCGIWENCODE 0x8B07 /* get encoding info */ +#define SIOCSIWSENS 0x8B08 /* set sensitivity */ +#define SIOCGIWSENS 0x8B09 /* get sensitivity */ + +/* Informative stuff */ +#define SIOCSIWRANGE 0x8B0A /* Unused ??? */ +#define SIOCGIWRANGE 0x8B0B /* Get range of parameters */ +#define SIOCSIWPRIV 0x8B0C /* Unused ??? */ +#define SIOCGIWPRIV 0x8B0D /* get private ioctl interface info */ + +/* Mobile IP support */ +#define SIOCSIWSPY 0x8B10 /* set spy addresses */ +#define SIOCGIWSPY 0x8B11 /* get spy info (quality of link) */ + +/* Access Point manipulation */ +#define SIOCSIWAP 0x8B14 /* set access point hardware addresses */ +#define SIOCGIWAP 0x8B15 /* get access point hardware addresses */ +#define SIOCGIWAPLIST 0x8B17 /* get list of access point in range */ + +/* ------------------------- IOCTL STUFF ------------------------- */ + +/* The first and the last (range) */ +#define SIOCIWFIRST 0x8B00 +#define SIOCIWLAST 0x8B17 + +/* Even : get (world access), odd : set (root access) */ +#define IW_IS_SET(cmd) (!((cmd) & 0x1)) +#define IW_IS_GET(cmd) ((cmd) & 0x1) + +/* ------------------------- PRIVATE INFO ------------------------- */ +/* + * The following is used with SIOCGIWPRIV. It allow a driver to define + * the interface (name, type of data) for its private ioctl. + * Privates ioctl are SIOCDEVPRIVATE -> SIOCDEVPRIVATE + 0xF + */ + +#define IW_PRIV_TYPE_MASK 0x7000 /* Type of arguments */ +#define IW_PRIV_TYPE_NONE 0x0000 +#define IW_PRIV_TYPE_BYTE 0x1000 /* Char as number */ +#define IW_PRIV_TYPE_CHAR 0x2000 /* Char as character */ +#define IW_PRIV_TYPE_INT 0x4000 /* 32 bits int */ +#define IW_PRIV_TYPE_FLOAT 0x5000 + +#define IW_PRIV_SIZE_FIXED 0x0800 /* Variable or fixed nuber of args */ + +#define IW_PRIV_SIZE_MASK 0x07FF /* Max number of those args */ + +/* + * Note : if the number of args is fixed and the size < 16 octets, + * instead of passing a pointer we will put args in the iwreq struct... + */ + +/* ----------------------- OTHER CONSTANTS ----------------------- */ + +/* Maximum frequencies in the range struct */ +#define IW_MAX_FREQUENCIES 16 +/* Note : if you have something like 80 frequencies, + * don't increase this constant and don't fill the frequency list. + * The user will be able to set by channel anyway... */ + +/* Maximum of address that you may set with SPY */ +#define IW_MAX_SPY 8 + +/****************************** TYPES ******************************/ + +/* --------------------------- SUBTYPES --------------------------- */ +/* + * A frequency + * For numbers lower than 10^9, we encode the number in 'mant' and + * set 'exp' to 0 + * For number greater than 10^9, we divide it by a power of 10. + * The power of 10 is in 'exp', the result is in 'mant'. + */ +struct iw_freq +{ + __u32 m; /* Mantissa */ + __u16 e; /* Exponent */ +}; + +/* + * Quality of the link + */ +struct iw_quality +{ + __u8 qual; /* link quality (SNR or better...) */ + __u8 level; /* signal level */ + __u8 noise; /* noise level */ + __u8 updated; /* Flags to know if updated */ +}; + +/* + * Packet discarded in the wireless adapter due to + * "wireless" specific problems... + */ +struct iw_discarded +{ + __u32 nwid; /* Wrong nwid */ + __u32 code; /* Unable to code/decode */ + __u32 misc; /* Others cases */ +}; + +/* + * Encoding information (setting and so on) + * Encoding might be hardware encryption, scrambing or others + */ +struct iw_encoding +{ + __u8 method; /* Algorithm number / key used */ + __u64 code; /* Data/key used for algorithm */ +}; + + +/* ------------------------ WIRELESS STATS ------------------------ */ +/* + * Wireless statistics (used for /proc/net/wireless) + */ +struct iw_statistics +{ + __u8 status; /* Status + * - device dependant for now */ + + struct iw_quality qual; /* Quality of the link + * (instant/mean/max) */ + struct iw_discarded discard; /* Packet discarded counts */ +}; + +/* ------------------------ IOCTL REQUEST ------------------------ */ +/* + * The structure to exchange data for ioctl. + * This structure is the same as 'struct ifreq', but (re)defined for + * convenience... + * + * Note that it should fit on the same memory footprint ! + * You should check this when increasing the above structures (16 octets) + * 16 octets = 128 bits. Warning, pointers might be 64 bits wide... + */ +struct iwreq +{ + union + { + char ifrn_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + } ifr_ifrn; + + /* Data part */ + union + { + /* Config - generic */ + char name[IFNAMSIZ]; + /* Name : used to verify the presence of wireless extensions. + * Name of the protocol/provider... */ + + struct /* network id (or domain) : used to to */ + { /* create logical channels on the air */ + __u32 nwid; /* value */ + __u8 on; /* active/unactive nwid */ + } nwid; + + struct iw_freq freq; /* frequency or channel : + * 0-1000 = channel + * > 1000 = frequency in Hz */ + + struct iw_encoding encoding; /* Encoding stuff */ + + __u32 sensitivity; /* signal level threshold */ + + struct sockaddr ap_addr; /* Access point address */ + + struct /* For all data bigger than 16 octets */ + { + caddr_t pointer; /* Pointer to the data + * (in user space) */ + __u16 length; /* fields or byte size */ + __u16 flags; /* Unused */ + } data; + } u; +}; + +/* -------------------------- IOCTL DATA -------------------------- */ +/* + * For those ioctl which want to exchange mode data that what could + * fit in the above structure... + */ + +/* + * Range of parameters + */ + +struct iw_range +{ + /* Informative stuff (to choose between different interface) */ + __u32 throughput; /* To give an idea... */ + + /* NWID (or domain id) */ + __u32 min_nwid; /* Minimal NWID we are able to set */ + __u32 max_nwid; /* Maximal NWID we are able to set */ + + /* Frequency */ + __u16 num_channels; /* Number of channels [0; num - 1] */ + __u8 num_frequency; /* Number of entry in the list */ + struct iw_freq freq[IW_MAX_FREQUENCIES]; /* list */ + /* Note : this frequency list doesn't need to fit channel numbers */ + + /* signal level threshold range */ + __u32 sensitivity; + + /* Quality of link & SNR stuff */ + struct iw_quality max_qual; /* Quality of the link */ + + /* Encoder stuff */ + struct iw_encoding max_encoding; /* Encoding max range */ +}; + +/* + * Private ioctl interface information + */ + +struct iw_priv_args +{ + __u32 cmd; /* Number of the ioctl to issue */ + __u16 set_args; /* Type and number of args */ + __u16 get_args; /* Type and number of args */ + char name[IFNAMSIZ]; /* Name of the extension */ +}; + +#endif /* _LINUX_WIRELESS_H */ diff --git a/include/linux/x25.h b/include/linux/x25.h new file mode 100644 index 000000000..6af8e9a5b --- /dev/null +++ b/include/linux/x25.h @@ -0,0 +1,117 @@ +/* + * These are the public elements of the Linux kernel X.25 implementation. + */ + +#ifndef X25_KERNEL_H +#define X25_KERNEL_H + +#define PF_X25 AF_X25 + +#define SIOCX25GSUBSCRIP (SIOCPROTOPRIVATE + 0) +#define SIOCX25SSUBSCRIP (SIOCPROTOPRIVATE + 1) +#define SIOCX25GFACILITIES (SIOCPROTOPRIVATE + 2) +#define SIOCX25SFACILITIES (SIOCPROTOPRIVATE + 3) +#define SIOCX25GCALLUSERDATA (SIOCPROTOPRIVATE + 4) +#define SIOCX25SCALLUSERDATA (SIOCPROTOPRIVATE + 5) + +/* + * Values for {get,set}sockopt. + */ +#define X25_QBITINCL 1 + +/* + * X.25 Packet Size values. + */ +#define X25_PS16 4 +#define X25_PS32 5 +#define X25_PS64 6 +#define X25_PS128 7 +#define X25_PS256 8 +#define X25_PS512 9 +#define X25_PS1024 10 +#define X25_PS2048 11 +#define X25_PS4096 12 + +/* + * X.25 Reset error and diagnostic codes. + */ +#define X25_ERR_RESET 100 /* Call Reset */ +#define X25_ERR_ROUT 101 /* Out of Order */ +#define X25_ERR_RRPE 102 /* Remote Procedure Error */ +#define X25_ERR_RLPE 103 /* Local Procedure Error */ +#define X25_ERR_RNCG 104 /* Network Congestion */ +#define X25_ERR_RRDO 105 /* Remote DTE Operational */ +#define X25_ERR_RNOP 106 /* Network Operational */ +#define X25_ERR_RINV 107 /* Invalid Call */ +#define X25_ERR_RNOO 108 /* Network Out of Order */ + +/* + * X.25 Clear error and diagnostic codes. + */ +#define X25_ERR_CLEAR 110 /* Call Cleared */ +#define X25_ERR_CBUSY 111 /* Number Busy */ +#define X25_ERR_COUT 112 /* Out of Order */ +#define X25_ERR_CRPE 113 /* Remote Procedure Error */ +#define X25_ERR_CRRC 114 /* Collect Call Refused */ +#define X25_ERR_CINV 115 /* Invalid Call */ +#define X25_ERR_CNFS 116 /* Invalid Fast Select */ +#define X25_ERR_CSA 117 /* Ship Absent */ +#define X25_ERR_CIFR 118 /* Invalid Facility Request */ +#define X25_ERR_CAB 119 /* Access Barred */ +#define X25_ERR_CLPE 120 /* Local Procedure Error */ +#define X25_ERR_CNCG 121 /* Network Congestion */ +#define X25_ERR_CNOB 122 /* Not Obtainable */ +#define X25_ERR_CROO 123 /* RPOA Out of Order */ + +/* + * An X.121 address, it is held as ASCII text, null terminated, up to 15 + * digits and a null terminator. + */ +typedef struct { + char x25_addr[16]; +} x25_address; + +/* + * Linux X.25 Address structure, used for bind, and connect mostly. + */ +struct sockaddr_x25 { + sa_family_t sx25_family; /* Must be AF_X25 */ + x25_address sx25_addr; /* X.121 Address */ +}; + +/* + * DTE/DCE subscription options. + */ +struct x25_subscrip_struct { + char device[200]; + unsigned int extended; +}; + +/* + * Routing table control structure. + */ +struct x25_route_struct { + x25_address address; + unsigned int sigdigits; + char device[200]; +}; + +/* + * Facilities structure. + */ +struct x25_facilities { + unsigned int winsize_in, winsize_out; + unsigned int pacsize_in, pacsize_out; + unsigned int throughput; + unsigned int reverse; +}; + +/* + * Call User Data structure. + */ +struct x25_calluserdata { + unsigned int cudlength; + unsigned char cuddata[128]; +}; + +#endif diff --git a/include/linux/xia_fs.h b/include/linux/xia_fs.h deleted file mode 100644 index 84015a2bf..000000000 --- a/include/linux/xia_fs.h +++ /dev/null @@ -1,121 +0,0 @@ -#ifndef _XIA_FS_H -#define _XIA_FS_H - -/* - * include/linux/xia_fs.h - * - * Copyright (C) Q. Frank Xia, 1993. - * - * Based on Linus' minix_fs.h. - * Copyright (C) Linus Torvalds, 1991, 1992. - */ - -#define _XIAFS_SUPER_MAGIC 0x012FD16D -#define _XIAFS_ROOT_INO 1 -#define _XIAFS_BAD_INO 2 - -#define _XIAFS_NAME_LEN 248 - -#define _XIAFS_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof(struct xiafs_inode))) - -struct xiafs_inode { /* 64 bytes */ - mode_t i_mode; - nlink_t i_nlinks; - uid_t i_uid; - gid_t i_gid; - size_t i_size; /* 8 */ - time_t i_ctime; - time_t i_atime; - time_t i_mtime; - daddr_t i_zone[8]; - daddr_t i_ind_zone; - daddr_t i_dind_zone; -}; - -/* - * linux super-block data on disk - */ -struct xiafs_super_block { - u_char s_boot_segment[512]; /* 1st sector reserved for boot */ - u_long s_zone_size; /* 0: the name says it */ - u_long s_nzones; /* 1: volume size, zone aligned */ - u_long s_ninodes; /* 2: # of inodes */ - u_long s_ndatazones; /* 3: # of data zones */ - u_long s_imap_zones; /* 4: # of imap zones */ - u_long s_zmap_zones; /* 5: # of zmap zones */ - u_long s_firstdatazone; /* 6: first data zone */ - u_long s_zone_shift; /* 7: z size = 1KB << z shift */ - u_long s_max_size; /* 8: max size of a single file */ - u_long s_reserved0; /* 9: reserved */ - u_long s_reserved1; /* 10: */ - u_long s_reserved2; /* 11: */ - u_long s_reserved3; /* 12: */ - u_long s_firstkernzone; /* 13: first kernel zone */ - u_long s_kernzones; /* 14: kernel size in zones */ - u_long s_magic; /* 15: magic number for xiafs */ -}; - -struct xiafs_direct { - ino_t d_ino; - u_short d_rec_len; - u_char d_name_len; - char d_name[_XIAFS_NAME_LEN+1]; -}; - -#ifdef __KERNEL__ - -extern int xiafs_lookup(struct inode * dir,const char * name, int len, - struct inode ** result); -extern int xiafs_create(struct inode * dir,const char * name, int len, int mode, - struct inode ** result); -extern int xiafs_mkdir(struct inode * dir, const char * name, int len, int mode); -extern int xiafs_rmdir(struct inode * dir, const char * name, int len); -extern int xiafs_unlink(struct inode * dir, const char * name, int len); -extern int xiafs_symlink(struct inode * inode, const char * name, int len, - const char * symname); -extern int xiafs_link(struct inode * oldinode, struct inode * dir, - const char * name, int len); -extern int xiafs_mknod(struct inode * dir, const char * name, int len, - int mode, int rdev); -extern int xiafs_rename(struct inode * old_dir, const char * old_name, - int old_len, struct inode * new_dir, - const char * new_name, int new_len, - int must_be_dir); -extern struct inode * xiafs_new_inode(struct inode * dir); -extern void xiafs_free_inode(struct inode * inode); -extern unsigned long xiafs_count_free_inodes(struct super_block *sb); -extern int xiafs_new_zone(struct super_block * sb, u_long prev_addr); -extern void xiafs_free_zone(struct super_block * sb, int block); -extern unsigned long xiafs_count_free_zones(struct super_block *sb); - -extern int xiafs_bmap(struct inode *,int); - -extern struct buffer_head * xiafs_getblk(struct inode *, int, int); -extern struct buffer_head * xiafs_bread(struct inode *, int, int); - -extern void xiafs_truncate(struct inode *); -extern void xiafs_put_super(struct super_block *); -extern struct super_block *xiafs_read_super(struct super_block *,void *,int); -extern int init_xiafs_fs(void); -extern void xiafs_read_inode(struct inode *); -extern void xiafs_write_inode(struct inode *); -extern void xiafs_put_inode(struct inode *); -extern void xiafs_statfs(struct super_block *, struct statfs *, int); -extern int xiafs_sync_inode(struct inode *); -extern int xiafs_sync_file(struct inode *, struct file *); - -extern struct inode_operations xiafs_file_inode_operations; -extern struct inode_operations xiafs_dir_inode_operations; -extern struct inode_operations xiafs_symlink_inode_operations; - -#endif /* __KERNEL__ */ - -#endif /* _XIA_FS_H */ - - - - - - - - diff --git a/include/linux/xia_fs_i.h b/include/linux/xia_fs_i.h deleted file mode 100644 index 3000a44a5..000000000 --- a/include/linux/xia_fs_i.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef _XIA_FS_I_H -#define _XIA_FS_I_H - -/* - * include/linux/xia_fs_i.h - * - * Copyright (C) Q. Frank Xia, 1993. - * - * Based on Linus' minix_fs_i.h. - * Copyright (C) Linus Torvalds, 1991, 1992. - */ - -struct xiafs_inode_info { /* for data zone pointers */ - unsigned long i_zone[8]; - unsigned long i_ind_zone; - unsigned long i_dind_zone; -}; - -#endif /* _XIA_FS_I_H */ diff --git a/include/linux/xia_fs_sb.h b/include/linux/xia_fs_sb.h deleted file mode 100644 index 1166ae965..000000000 --- a/include/linux/xia_fs_sb.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef _XIA_FS_SB_H -#define _XIA_FS_SB_H - -/* - * include/linux/xia_fs_sb.h - * - * Copyright (C) Q. Frank Xia, 1993. - * - * Based on Linus' minix_fs_sb.h. - * Copyright (C) Linus Torvalds, 1991, 1992. - */ - -#define _XIAFS_IMAP_SLOTS 8 -#define _XIAFS_ZMAP_SLOTS 32 - -struct xiafs_sb_info { - u_long s_nzones; - u_long s_ninodes; - u_long s_ndatazones; - u_long s_imap_zones; - u_long s_zmap_zones; - u_long s_firstdatazone; - u_long s_zone_shift; - u_long s_max_size; /* 32 bytes */ - struct buffer_head * s_imap_buf[_XIAFS_IMAP_SLOTS]; /* 32 bytes */ - struct buffer_head * s_zmap_buf[_XIAFS_ZMAP_SLOTS]; /* 128 bytes */ - int s_imap_iznr[_XIAFS_IMAP_SLOTS]; /* 32 bytes */ - int s_zmap_zznr[_XIAFS_ZMAP_SLOTS]; /* 128 bytes */ - u_char s_imap_cached; /* flag for cached imap */ - u_char s_zmap_cached; /* flag for cached imap */ -}; - -#endif /* _XIA_FS_SB_H */ - - - diff --git a/include/linux/zorro.h b/include/linux/zorro.h new file mode 100644 index 000000000..e19289877 --- /dev/null +++ b/include/linux/zorro.h @@ -0,0 +1,1278 @@ +/* + * linux/zorro.h -- Amiga AutoConfig (Zorro) Expansion Device Definitions + * + * Copyright (C) 1995 Geert Uytterhoeven + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file COPYING in the main directory of this archive + * for more details. + */ + +#ifndef __ZORRO_H +#define __ZORRO_H + +#ifndef __ASSEMBLY__ + +/* + * Defined Board Manufacturers + * + * Please update arch/m68k/amiga/zorro.c if you make changes here + * Many IDs were obtained from ExpName/Identify ((C) Richard Körber) + * and by looking at the NetBSD-Amiga kernel sources + */ + +#define MANUF_PACIFIC (0x00D3) /* Pacific Peripherals */ +#define PROD_SE_2000_A500 (0x00) /* SE 2000 A500 */ +#define PROD_PACIFIC_HD (0x0A) /* HD Controller */ + +#define MANUF_KUPKE (0x00DD) /* Kupke */ +#define PROD_GOLEM_BOX_2 (0x00) /* Golem RAM Box 2MB */ + +#define MANUF_MEMPHIS (0x0100) /* Memphis */ +#define PROD_STORMBRINGER (0x00) /* Stormbringer */ + +#define MANUF_3_STATE (0x0200) /* 3-State */ +#define PROD_MEGAMIX_2000 (0x02) /* Megamix 2000 RAM */ + +#define MANUF_COMMODORE2 (0x0201) /* Commodore Braunschweig */ +#define PROD_A2088 (0x01) /* CBM A2088 XT Bridgeboard */ +#define PROD_A2286 (0x02) /* CBM A2286 AT Bridgeboard */ +#define PROD_A4091_2 (0x54) /* CBM A4091 SCSI Controller */ +#define PROD_A2386SX (0x67) /* CBM A2386-SX Bridgeboard */ + +#define MANUF_COMMODORE (0x0202) /* Commodore West Chester */ +#define PROD_A2090A (0x01) /* CBM A2090/A2090A HD Controller */ +#define PROD_A590 (0x02) /* CBM A590 SCSI Controller */ +#define PROD_A2091 (0x03) /* CBM A2091 SCSI Controller */ +#define PROD_A2090B (0x04) /* CBM A2090B 2090 Autoboot Card */ +#define PROD_ARCNET (0x09) /* CBM A2060 Arcnet Card */ +#define PROD_CBMRAM (0x0A) /* CBM A2052/58.RAM | 590/2091.RAM */ +#define PROD_A560RAM (0x20) /* CBM A560 Memory Module */ +#define PROD_A2232PROTO (0x45) /* CBM A2232 Serial Prototype */ +#define PROD_A2232 (0x46) /* CBM A2232 Serial Production */ +#define PROD_A2620 (0x50) /* CBM A2620 68020/RAM Card */ +#define PROD_A2630 (0x51) /* CBM A2630 68030/RAM Card */ +#define PROD_A4091 (0x54) /* CBM A4091 SCSI Controller */ +#define PROD_A2065_2 (0x5A) /* A2065 Ethernet Card */ +#define PROD_ROMULATOR (0x60) /* CBM Romulator Card */ +#define PROD_A3000TESTFIX (0x61) /* CBM A3000 Test Fixture */ +#define PROD_A2386SX_2 (0x67) /* A2386-SX Bridgeboard */ +#define PROD_A2065 (0x70) /* CBM A2065 Ethernet Card */ + +#define MANUF_COMMODORE3 (0x0203) /* Commodore West Chester */ +#define PROD_A2090A_CM (0x03) /* A2090A Combitec/MacroSystem */ + +#define MANUF_KCS (0x02FF) /* Kolff Computer Supplies */ +#define PROD_POWER_BOARD (0x00) /* KCS Power PC Board */ + +#define MANUF_CARDCO (0x03EC) /* Cardco */ +#define PROD_KRONOS_2000_SCSI (0x04) /* Kronos 2000 SCSI Controller */ +#define PROD_A1000_SCSI (0x0C) /* A1000 SCSI Controller */ +#define PROD_ESCORT_SCSI (0x0E) /* Escort SCSI Controller */ +#define PROD_CC_A2410 (0xF5) /* Cardco A2410 Hires Graphics Card */ + +#define MANUF_A_SQUARED (0x03ED) /* A-Squared */ +#define PROD_LIVE_2000 (0x01) /* Live! 2000 */ + +#define MANUF_COMSPEC (0x03EE) /* ComSpec Communications */ +#define PROD_AX2000 (0x01) /* AX2000 */ + +#define MANUF_ANAKIN (0x03F1) /* Anakin */ +#define PROD_EASYL (0x01) /* Easyl Tablet */ + +#define MANUF_MICROBOTICS (0x03F2) /* MicroBotics */ +#define PROD_STARBOARD_II (0x00) /* StarBoard II */ +#define PROD_STARDRIVE (0x02) /* StarDrive */ +#define PROD_8_UP_A (0x03) /* 8-Up (Rev A) */ +#define PROD_8_UP_Z (0x04) /* 8-Up (Rev Z) */ +#define PROD_DELTA_RAM (0x20) /* Delta Card RAM */ +#define PROD_8_STAR_RAM (0x40) /* 8-Star RAM */ +#define PROD_8_STAR (0x41) /* 8-Star */ +#define PROD_VXL_RAM (0x44) /* VXL RAM */ +#define PROD_VXL_30 (0x45) /* VXL-30 Turbo Board */ +#define PROD_DELTA (0x60) /* Delta Card */ +#define PROD_MBX_1200 (0x81) /* MBX 1200 */ +#define PROD_HARDFRAME_2000 (0x9E) /* Hardframe 2000 */ +#define PROD_MBX_1200_2 (0xC1) /* MBX 1200 */ + +#define MANUF_ACCESS (0x03F4) /* Access Associates */ + +#define MANUF_EXPANSION_TECH (0x03F6) /* Expansion Technologies */ + +#define MANUF_ASDG (0x03FF) /* ASDG */ +#define PROD_ASDG_MEMORY (0x01) /* Memory Expansion */ +#define PROD_ASDG_MEMORY_2 (0x02) /* Memory Expansion */ +#define PROD_LAN_ROVER (0xFE) /* Lan Rover Ethernet */ +#define PROD_TWIN_X (0xFF) /* Twin-X Serial Card */ + +#define MANUF_IMTRONICS (0x0404) /* Imtronics */ +#define PROD_HURRICANE_2800 (0x39) /* Hurricane 2800 68030 */ +#define PROD_HURRICANE_2800_2 (0x57) /* Hurricane 2800 68030 */ + +#define MANUF_UNIV_OF_LOWELL (0x0406) /* University of Lowell */ +#define PROD_A2410 (0x00) /* CBM A2410 Hires Graphics Card */ + +#define MANUF_AMERISTAR (0x041D) /* Ameristar */ +#define PROD_AMERISTAR2065 (0x01) /* A2065 Ethernet Card */ +#define PROD_A560 (0x09) /* Arcnet Card */ +#define PROD_A4066 (0x0A) /* A4066 Ethernet Card */ + +#define MANUF_SUPRA (0x0420) /* Supra */ +#define PROD_SUPRADRIVE_4x4 (0x01) /* SupraDrive 4x4 SCSI Controller */ +#define PROD_SUPRA_2000 (0x03) /* 2000 DMA HD */ +#define PROD_SUPRA_500 (0x05) /* 500 HD/RAM */ +#define PROD_SUPRA_500XP (0x09) /* 500XP/2000 RAM */ +#define PROD_SUPRA_500RX (0x0A) /* 500RX/2000 RAM */ +#define PROD_SUPRA_2400ZI (0x0B) /* 2400zi Modem */ +#define PROD_WORDSYNC (0x0C) /* Supra Wordsync SCSI Controller */ +#define PROD_WORDSYNC_II (0x0D) /* Supra Wordsync II SCSI Controller */ +#define PROD_SUPRA_2400ZIPLUS (0x10) /* 2400zi+ Modem */ + +#define MANUF_CSA (0x0422) /* Computer Systems Ass. */ +#define PROD_MAGNUM (0x11) /* Magnum 40 SCSI Controller */ +#define PROD_12GAUGE (0x15) /* 12 Gauge SCSI Controller */ + +#define MANUF_MTEC2 (0x0502) /* M-Tech */ +#define PROD_AT500_2 (0x03) /* AT500 RAM */ + +#define MANUF_GVP3 (0x06E1) /* Great Valley Products */ +#define PROD_IMPACT (0x08) /* Impact SCSI/Memory */ + +#define MANUF_BYTEBOX (0x07DA) /* ByteBox */ +#define PROD_BYTEBOX_A500 (0x00) /* A500 */ + +#define MANUF_HACKER (0x07DB) /* Test only: no product definitions */ + +#define MANUF_POWER_COMPUTING (0x07DC) /* Power Computing (DKB) */ +#define PROD_DKB_3128 (0x0E) /* DKB 3128 RAM */ +#define PROD_RAPID_FIRE (0x0F) /* Rapid Fire SCSI Controller */ +#define PROD_DKB_1202 (0x10) /* DKB 1202 RAM */ +#define PROD_VIPER_II_COBRA (0x12) /* Viper II Turbo Board (DKB Cobra) */ +#define PROD_WILDFIRE_060 (0x17) /* WildFire 060 Turbo Board */ +#define PROD_WILDFIRE_060_2 (0xFF) /* WildFire 060 Turbo Board */ + +#define MANUF_GVP (0x07E1) /* Great Valley Products */ +#define PROD_IMPACT_I_4K (0x01) /* Impact Series-I SCSI 4K */ +#define PROD_IMPACT_I_16K_2 (0x02) /* Impact Series-I SCSI 16K/2 */ +#define PROD_IMPACT_I_16K_3 (0x03) /* Impact Series-I SCSI 16K/3 */ +#define PROD_IMPACT_3001_IDE (0x08) /* Impact 3001 IDE */ +#define PROD_IMPACT_3001_RAM (0x09) /* Impact 3001 RAM */ +#define PROD_GVPIISCSI (0x0B) /* GVP Series II SCSI Controller */ +#define PROD_GVPIISCSI_2 (0x09) /* evidence that the driver works + for this product code also */ +#define PROD_GVPIIRAM (0x0A) /* GVP Series II RAM */ +#define PROD_GVP (0x0B) /* This code is used by a wide range of + GVP products - use the epc to + identify it correctly */ +#define PROD_GVP_A2000_030 (0x0D) /* GVP A2000 68030 Turbo Board */ +#define PROD_IMPACT_3001_IDE_2 (0x0D) /* Impact 3001 IDE */ +#define PROD_GFORCE_040_SCSI (0x16) /* GForce 040 with SCSI (new) */ +#define PROD_GVPIV_24 (0x20) /* GVP IV-24 Graphics Board */ +#define PROD_GFORCE_040 (0xFF) /* GForce 040 Turbo Board */ +/* #define PROD_GVPIO_EXT (0xFF)*/ /* GVP I/O Extender */ + +#define MANUF_SYNERGY (0x07E5) /* Synergy */ + +#define MANUF_XETEC (0x07E6) /* Xetec */ +#define PROD_FASTCARD_SCSI (0x01) /* FastCard SCSI Controller */ +#define PROD_FASTCARD_RAM (0x02) /* FastCard RAM */ + +#define MANUF_PPI (0x07EA) /* Progressive Peripherals Inc. */ +#define PROD_MERCURY (0x00) /* Mercury Turbo Board */ +#define PROD_PPS_A3000_040 (0x01) /* PP&S A3000 68040 Turbo Board */ +#define PROD_PPS_A2000_040 (0x69) /* PP&S A2000 68040 Turbo Board */ +#define PROD_ZEUS (0x96) /* Zeus SCSI Controller */ +#define PROD_PPS_A500_040 (0xBB) /* PP&S A500 68040 Turbo Board */ + +#define MANUF_XEBEC (0x07EC) /* Xebec */ + +#define MANUF_SPIRIT (0x07F2) /* Spirit */ +#define PROD_HDA_506 (0x04) /* HDA 506 Harddisk */ +#define PROD_OCTABYTE_RAM (0x06) /* OctaByte RAM */ + +#define MANUF_BSC (0x07FE) /* BSC */ +#define PROD_ALF_3_SCSI (0x03) /* BSC ALF 3 SCSI Controller */ + +#define MANUF_BSC3 (0x0801) /* BSC */ +#define PROD_ALF_2_SCSI (0x01) /* ALF 2 SCSI Controller */ +#define PROD_ALF_2_SCSI_2 (0x02) /* ALF 2 SCSI Controller */ +#define PROD_ALF_3_SCSI_2 (0x03) /* ALF 3 SCSI Controller */ + +#define MANUF_C_LTD (0x0802) /* C Ltd. */ +#define PROD_KRONOS_SCSI (0x04) /* Kronos SCSI Controller */ +#define PROD_A1000_SCSI_2 (0x0C) /* A1000 SCSI Controller */ + +#define MANUF_JOCHHEIM (0x0804) /* Jochheim */ +#define PROD_JOCHHEIM_RAM (0x01) /* Jochheim RAM */ + +#define MANUF_CHECKPOINT (0x0807) /* Checkpoint Technologies */ +#define PROD_SERIAL_SOLUTION (0x00) /* Serial Solution */ + +#define MANUF_ICD (0x0817) /* ICD */ +#define PROD_ADVANTAGE_2000 (0x01) /* Advantage 2000 SCSI Controller */ + +#define MANUF_KUPKE2 (0x0819) /* Kupke */ +#define PROD_KUPKE_SCSI_II (0x02) /* Golem SCSI-II Controller */ +#define PROD_GOLEM_BOX (0x03) /* Golem Box */ +#define PROD_KUPKE_TURBO (0x04) /* 030/882 Turbo Board */ +#define PROD_KUPKE_SCSI_AT (0x05) /* SCSI/AT Controller */ + +#define MANUF_GVP4 (0x081D) /* Great Valley Products */ +#define PROD_A2000_RAM8 (0x09) /* A2000-RAM8/2 */ + +#define MANUF_INTERWORKS_NET (0x081E) /* Interworks Network */ + +#define MANUF_HARDITAL (0x0820) /* Hardital Synthesis */ +#define PROD_TQM (0x14) /* TQM 68030+68882 Turbo Board */ + +#define MANUF_BSC2 (0x082C) /* BSC */ +#define PROD_OKTAGON_SCSI (0x05) /* BSC Oktagon 2008 SCSI Controller */ +#define PROD_TANDEM (0x06) /* BSC Tandem AT-2008/508 IDE */ +#define PROD_ALPHA_RAM_1200 (0x07) /* Alpha RAM 1200 */ +#define PROD_OKTAGON_RAM (0x08) /* BSC Oktagon 2008 RAM */ +#define PROD_MULTIFACE_I (0x10) /* Alfa Data MultiFace I */ +#define PROD_MULTIFACE_II (0x11) /* Alfa Data MultiFace II */ +#define PROD_MULTIFACE_III (0x12) /* Alfa Data MultiFace III */ +#define PROD_BSC_FRAEMBUFFER (0x20) /* Framebuffer */ +#define PROD_GRAFFITI_RAM (0x21) /* Graffiti Graphics Board */ +#define PROD_GRAFFITI_REG (0x22) +#define PROD_ISDN_MASTERCARD (0x40) /* BSC ISDN MasterCard */ +#define PROD_ISDN_MASTERCARD_2 (0x41) /* BSC ISDN MasterCard II */ + +#define MANUF_ADV_SYS_SOFT (0x0836) /* Advanced Systems & Software */ +#define PROD_NEXUS_SCSI (0x01) /* Nexus SCSI Controller */ +#define PROD_NEXUS_RAM (0x08) /* Nexus RAM */ + +#define MANUF_IMPULSE (0x0838) /* Impulse */ +#define PROD_FIRECRACKER_24 (0x00) /* FireCracker 24 */ + +#define MANUF_IVS (0x0840) /* IVS */ +#define PROD_GRANDSLAM_PIC_2 (0x02) /* GrandSlam PIC 2 RAM */ +#define PROD_GRANDSLAM_PIC_1 (0x04) /* GrandSlam PIC 1 RAM */ +#define PROD_IVS_OVERDRIVE (0x10) /* OverDrive HD */ +#define PROD_TRUMPCARD_CLASSIC (0x30) /* Trumpcard Classic SCSI Controller */ +#define PROD_TRUMPCARD_PRO (0x34) /* Trumpcard Pro SCSI Controller */ +#define PROD_META_4 (0x40) /* Meta-4 RAM */ +#define PROD_WAVETOOLS (0xBF) /* Wavetools Sound Board */ +#define PROD_VECTOR (0xF3) /* Vector SCSI Controller */ +#define PROD_VECTOR_2 (0xF4) /* Vector SCSI Controller */ + +#define MANUF_VECTOR (0x0841) /* Vector */ +#define PROD_CONNECTION (0xE3) /* Connection Serial IO */ + +#define MANUF_XPERT_PRODEV (0x0845) /* XPert/ProDev */ +#define PROD_VISIONA_RAM (0x01) /* Visiona Graphics Board */ +#define PROD_VISIONA_REG (0x02) +#define PROD_MERLIN_RAM (0x03) /* Merlin Graphics Board */ +#define PROD_MERLIN_REG (0x04) +#define PROD_MERLIN_REG_2 (0xC9) + +#define MANUF_HYDRA_SYSTEMS (0x0849) /* Hydra Systems */ +#define PROD_AMIGANET (0x01) /* Amiganet Board */ + +#define MANUF_SUNRIZE (0x084F) /* Sunrize Industries */ +#define PROD_AD1012 (0x01) /* AD1012 Sound Board */ +#define PROD_AD516 (0x02) /* AD516 Sound Board */ +#define PROD_DD512 (0x03) /* DD512 Sound Board */ + +#define MANUF_TRICERATOPS (0x0850) /* Triceratops */ +#define PROD_TRICERATOPS (0x01) /* Triceratops Multi I/O Board */ + +#define MANUF_APPLIED_MAGIC (0x0851) /* Applied Magic Inc */ +#define PROD_DMI_RESOLVER (0x01) /* DMI Resolver Graphics Board */ +#define PROD_DIGITAL_BCASTER (0x06) /* Digital Broadcaster */ + +#define MANUF_GFX_BASE (0x085E) /* GFX-Base */ +#define PROD_GDA_1_RAM (0x00) /* GDA-1 Graphics Board */ +#define PROD_GDA_1_REG (0x01) + +#define MANUF_ROCTEC (0x0860) /* RocTec */ +#define PROD_RH_800C (0x01) /* RH 800C Hard Disk Controller */ +#define PROD_RH_800C_RAM (0x01) /* RH 800C RAM */ + +#define MANUF_HELFRICH1 (0x0861) /* Helfrich */ +#define PROD_RAINBOW3 (0x21) /* Rainbow3 Graphics Board */ + +#define MANUF_SW_RESULT_ENTS (0x0866) /* Software Result Enterprises */ +#define PROD_GG2PLUS (0x01) /* GG2+ Bus Converter */ + +#define MANUF_MASOBOSHI (0x086D) /* Masoboshi */ +#define PROD_MASTER_CARD_RAM (0x03) /* Master Card RAM */ +#define PROD_MASTER_CARD_SCSI (0x04) /* Master Card SCSI Controller */ +#define PROD_MVD_819 (0x07) /* MVD 819 */ + +#define MANUF_DELACOMP (0x0873) /* DelaComp */ +#define PROD_DELACOMP_RAM_2000 (0x01) /* RAM Expansion 2000 */ + +#define MANUF_VILLAGE_TRONIC (0x0877) /* Village Tronic */ +#define PROD_DOMINO_RAM (0x01) /* Domino Graphics Board */ +#define PROD_DOMINO_REG (0x02) +#define PROD_PICASSO_II_RAM (0x0B) /* Picasso II/II+ Graphics Board */ +#define PROD_PICASSO_II_REG (0x0C) +#define PROD_PICASSO_II_SEGM (0x0D) /* Picasso II/II+ (Segmented Mode) */ +#define PROD_PICASSO_IV (0x15) /* Picassio IV Graphics Board */ +#define PROD_PICASSO_IV_2 (0x16) +#define PROD_PICASSO_IV_3 (0x17) +#define PROD_PICASSO_IV_4 (0x18) +#define PROD_ARIADNE (0xC9) /* Ariadne Ethernet */ + +#define MANUF_UTILITIES_ULTD (0x087B) /* Utilities Unlimited */ +#define PROD_EMPLANT_DELUXE (0x15) /* Emplant Deluxe SCSI Controller */ +#define PROD_EMPLANT_DELUXE2 (0x20) /* Emplant Deluxe SCSI Controller */ + +#define MANUF_AMITRIX (0x0880) /* Amitrix */ +#define PROD_AMITRIX_MULTI_IO (0x01) /* Multi-IO */ +#define PROD_AMITRIX_CD_RAM (0x02) /* CD-RAM Memory */ + +#define MANUF_ARMAX (0x0885) /* ArMax */ +#define PROD_OMNIBUS (0x00) /* OmniBus Graphics Board */ + +#define MANUF_NEWTEK (0x088F) /* NewTek */ +#define PROD_VIDEOTOASTER (0x00) /* VideoToaster */ + +#define MANUF_MTEC (0x0890) /* M-Tech Germany */ +#define PROD_AT500 (0x01) /* AT500 IDE Controller */ +#define PROD_MTEC_68030 (0x03) /* 68030 Turbo Board */ +#define PROD_MTEC_68020I (0x06) /* 68020i Turbo Board */ +#define PROD_MTEC_T1230 (0x20) /* A1200 T68030/42 RTC Turbo Board */ +#define PROD_MTEC_RAM (0x22) /* MTEC 8MB RAM */ + +#define MANUF_GVP2 (0x0891) /* Great Valley Products */ +#define PROD_SPECTRUM_RAM (0x01) /* EGS 28/24 Spectrum Graphics Board */ +#define PROD_SPECTRUM_REG (0x02) + +#define MANUF_HELFRICH2 (0x0893) /* Helfrich */ +#define PROD_PICCOLO_RAM (0x05) /* Piccolo Graphics Board */ +#define PROD_PICCOLO_REG (0x06) +#define PROD_PEGGY_PLUS (0x07) /* PeggyPlus MPEG Decoder Board */ +#define PROD_VIDEOCRUNCHER (0x08) /* VideoCruncher */ +#define PROD_SD64_RAM (0x0A) /* SD64 Graphics Board */ +#define PROD_SD64_REG (0x0B) + +#define MANUF_MACROSYSTEMS (0x089B) /* MacroSystems USA */ +#define PROD_WARP_ENGINE (0x13) /* Warp Engine 40xx SCSI Controller */ + +#define MANUF_ELBOX (0x089E) /* ElBox Computer */ +#define PROD_ELBOX_1200 (0x06) /* Elbox 1200/4 RAM */ + +#define MANUF_HARMS_PROF (0x0A00) /* Harms Professional */ +#define PROD_HARMS_030_PLUS (0x10) /* 030 plus */ +#define PROD_3500_TURBO (0xD0) /* 3500 Turbo board */ + +#define MANUF_MICRONIK (0x0A50) /* Micronik */ +#define PROD_RCA_120 (0x0A) /* RCA 120 RAM */ + +#define MANUF_MEGA_MICRO (0x1000) /* MegaMicro */ +#define PROD_SCRAM_500_SCSI (0x03) /* SCRAM 500 SCSI Controller */ +#define PROD_SCRAM_500_RAM (0x04) /* SCRAM 500 RAM */ + +#define MANUF_IMTRONICS2 (0x1028) /* Imtronics */ +#define PROD_HURRICANE_2800_3 (0x39) /* Hurricane 2800 68030 */ +#define PROD_HURRICANE_2800_4 (0x57) /* Hurricane 2800 68030 */ + +#define MANUF_KUPKE3 (0x1248) /* Kupke */ +#define PROD_GOLEM_3000 (0x01) /* Golem HD 3000 */ + +#define MANUF_ITH (0x1388) /* ITH */ +#define PROD_ISDN_MASTER_II (0x01) /* ISDN-Master II */ + +#define MANUF_VMC (0x1389) /* VMC */ +#define PROD_ISDN_BLASTER_Z2 (0x01) /* ISDN Blaster Z2 */ +#define PROD_HYPERCOM_4 (0x02) /* HyperCom 4 */ + +#define MANUF_INFORMATION (0x157C) /* Information */ +#define PROD_ISDN_ENGINE_I (0x64) /* ISDN Engine I */ + +#define MANUF_VORTEX (0x2017) /* Vortex */ +#define PROD_GOLDEN_GATE_386SX (0x07) /* Golden Gate 80386SX Board */ +#define PROD_GOLDEN_GATE_RAM (0x08) /* Golden Gate RAM */ +#define PROD_GOLDEN_GATE_486 (0x09) /* Golden Gate 80486 Board */ + +#define MANUF_DATAFLYER (0x2062) /* DataFlyer */ +#define PROD_DATAFLYER_4000SXS (0x01) /* DataFlyer 4000SX SCSI Controller */ +#define PROD_DATAFLYER_4000SXR (0x02) /* DataFlyer 4000SX RAM */ + +#define MANUF_READYSOFT (0x2100) /* ReadySoft */ +#define PROD_AMAX (0x01) /* AMax II/IV */ + +#define MANUF_PHASE5 (0x2140) /* Phase5 */ +#define PROD_BLIZZARD_RAM (0x01) /* Blizzard RAM */ +#define PROD_BLIZZARD (0x02) /* Blizzard */ +#define PROD_BLIZZARD_1220_IV (0x06) /* Blizzard 1220-IV Turbo Board */ +#define PROD_FASTLANE_RAM (0x0A) /* FastLane RAM */ +#define PROD_FASTLANE_SCSI (0x0B) /* FastLane/Blizzard 1230-II SCSI/CyberSCSI */ +#define PROD_CYBERSTORM_SCSI (0x0C) /* Blizzard 1220/CyberStorm */ +#define PROD_BLIZZARD_1230_III (0x0D) /* Blizzard 1230-III Turbo Board */ +#define PROD_BLIZZARD_1230_IV (0x11) /* Blizzard 1230-IV/1260 Turbo Board */ +#define PROD_BLIZZARD_2060SCSI (0x18) /* Blizzard 2060 SCSI Controller */ +#define PROD_CYBERSTORM_II (0x19) /* CyberStorm Mk II */ +#define PROD_CYBERVISION (0x22) /* CyberVision64 Graphics Board */ +#define PROD_CYBERVISION3D_PRT (0x32) /* CyberVision64-3D Prototype */ +#define PROD_CYBERVISION3D (0x43) /* CyberVision64-3D Graphics Board */ + +#define MANUF_DPS (0x2169) /* DPS */ +#define PROD_DPS_PAR (0x01) /* Personal Animation Recorder */ + +#define MANUF_APOLLO2 (0x2200) /* Apollo */ +#define PROD_A620 (0x00) /* A620 68020 Accelerator */ +#define PROD_A620_2 (0x01) /* A620 68020 Accelerator */ + +#define MANUF_APOLLO (0x2222) /* Apollo */ +#define PROD_AT_APOLLO (0x22) /* AT-Apollo */ +#define PROD_APOLLO_TURBO (0x23) /* Apollo Turbo Board */ + +#define MANUF_PETSOFF (0x38A5) /* Petsoff LP */ +#define PROD_DELFINA (0x00) /* Delfina DSP */ + +#define MANUF_UWE_GERLACH (0x3FF7) /* Uwe Gerlach */ +#define PROD_UG_RAM_ROM (0xd4) /* RAM/ROM */ + +#define MANUF_MACROSYSTEMS2 (0x4754) /* MacroSystems Germany */ +#define PROD_MAESTRO (0x03) /* Maestro */ +#define PROD_VLAB (0x04) /* VLab */ +#define PROD_MAESTRO_PRO (0x05) /* Maestro Pro */ +#define PROD_RETINA_Z2 (0x06) /* Retina Z2 Graphics Board */ +#define PROD_MULTI_EVOLUTION (0x08) /* MultiEvolution */ +#define PROD_TOCCATA (0x0C) /* Toccata Sound Board */ +#define PROD_RETINA_Z3 (0x10) /* Retina Z3 Graphics Board */ +#define PROD_VLAB_MOTION (0x12) /* VLab Motion */ +#define PROD_ALTAIS (0x13) /* Altais Graphics Board */ +#define PROD_FALCON_040 (0xFD) /* Falcon '040 Turbo Board */ + +#define MANUF_COMBITEC (0x6766) /* Combitec */ + +#define MANUF_SKI (0x8000) /* SKI Peripherals */ +#define PROD_MAST_FIREBALL (0x08) /* M.A.S.T. Fireball SCSI Controller */ +#define PROD_SKI_SCSI_SERIAL (0x80) /* SCSI / Dual Serial */ + +#define MANUF_CAMERON (0xAA01) /* Cameron */ +#define PROD_PERSONAL_A4 (0x10) /* Personal A4 */ + +#define MANUF_REIS_WARE (0xAA11) /* Reis-Ware */ +#define PROD_RW_HANDYSCANNER (0x11) /* Handyscanner */ + + +/* Illegal Manufacturer IDs. These do NOT appear in arch/m68k/amiga/zorro.c! */ + +#define MANUF_HACKER_INC (0x07DB) /* Hacker Inc. */ +#define PROD_HACKER_SCSI (0x01) /* Hacker Inc. SCSI Controller */ + +#define MANUF_RES_MNGT_FORCE (0x07DB) /* Resource Management Force */ +#define PROD_QUICKNET (0x02) /* QuickNet Ethernet */ + +#define MANUF_VECTOR2 (0x07DB) /* Vector */ +#define PROD_CONNECTION_2 (0xE0) /* Vector Connection */ +#define PROD_CONNECTION_3 (0xE1) /* Vector Connection */ +#define PROD_CONNECTION_4 (0xE2) /* Vector Connection */ +#define PROD_CONNECTION_5 (0xE3) /* Vector Connection */ + + +/* + * GVP's identifies most of their product through the 'extended + * product code' (epc). The epc has to be and'ed with the GVP_PRODMASK + * before the identification. + */ + +#define GVP_PRODMASK (0xf8) +#define GVP_SCSICLKMASK (0x01) + +enum GVP_ident { + GVP_GFORCE_040 = 0x20, + GVP_GFORCE_040_SCSI = 0x30, + GVP_A1291_SCSI = 0x40, + GVP_COMBO_R4 = 0x60, + GVP_COMBO_R4_SCSI = 0x70, + GVP_PHONEPAK = 0x78, + GVP_IOEXT = 0x98, + GVP_GFORCE_030 = 0xa0, + GVP_GFORCE_030_SCSI = 0xb0, + GVP_A530 = 0xc0, + GVP_A530_SCSI = 0xd0, + GVP_COMBO_R3 = 0xe0, + GVP_COMBO_R3_SCSI = 0xf0, + GVP_SERIESII = 0xf8, +}; + +enum GVP_flags { + GVP_IO = 0x01, + GVP_ACCEL = 0x02, + GVP_SCSI = 0x04, + GVP_24BITDMA = 0x08, + GVP_25BITDMA = 0x10, + GVP_NOBANK = 0x20, + GVP_14MHZ = 0x40, +}; + + +struct Node { + struct Node *ln_Succ; /* Pointer to next (successor) */ + struct Node *ln_Pred; /* Pointer to previous (predecessor) */ + u_char ln_Type; + char ln_Pri; /* Priority, for sorting */ + char *ln_Name; /* ID string, null terminated */ +}; + +struct ExpansionRom { + /* -First 16 bytes of the expansion ROM */ + u_char er_Type; /* Board type, size and flags */ + u_char er_Product; /* Product number, assigned by manufacturer */ + u_char er_Flags; /* Flags */ + u_char er_Reserved03; /* Must be zero ($ff inverted) */ + u_short er_Manufacturer; /* Unique ID,ASSIGNED BY COMMODORE-AMIGA! */ + u_long er_SerialNumber; /* Available for use by manufacturer */ + u_short er_InitDiagVec; /* Offset to optional "DiagArea" structure */ + u_char er_Reserved0c; + u_char er_Reserved0d; + u_char er_Reserved0e; + u_char er_Reserved0f; +}; + +/* er_Type board type bits */ +#define ERT_TYPEMASK 0xc0 +#define ERT_ZORROII 0xc0 +#define ERT_ZORROIII 0x80 + +/* other bits defined in er_Type */ +#define ERTB_MEMLIST 5 /* Link RAM into free memory list */ +#define ERTF_MEMLIST (1<<5) + +struct ConfigDev { + struct Node cd_Node; + u_char cd_Flags; /* (read/write) */ + u_char cd_Pad; /* reserved */ + struct ExpansionRom cd_Rom; /* copy of board's expansion ROM */ + void *cd_BoardAddr; /* where in memory the board was placed */ + u_long cd_BoardSize; /* size of board in bytes */ + u_short cd_SlotAddr; /* which slot number (PRIVATE) */ + u_short cd_SlotSize; /* number of slots (PRIVATE) */ + void *cd_Driver; /* pointer to node of driver */ + struct ConfigDev *cd_NextCD; /* linked list of drivers to config */ + u_long cd_Unused[4]; /* for whatever the driver wants */ +}; + +#else /* __ASSEMBLY__ */ + +LN_Succ = 0 +LN_Pred = LN_Succ+4 +LN_Type = LN_Pred+4 +LN_Pri = LN_Type+1 +LN_Name = LN_Pri+1 +LN_sizeof = LN_Name+4 + +ER_Type = 0 +ER_Product = ER_Type+1 +ER_Flags = ER_Product+1 +ER_Reserved03 = ER_Flags+1 +ER_Manufacturer = ER_Reserved03+1 +ER_SerialNumber = ER_Manufacturer+2 +ER_InitDiagVec = ER_SerialNumber+4 +ER_Reserved0c = ER_InitDiagVec+2 +ER_Reserved0d = ER_Reserved0c+1 +ER_Reserved0e = ER_Reserved0d+1 +ER_Reserved0f = ER_Reserved0e+1 +ER_sizeof = ER_Reserved0f+1 + +CD_Node = 0 +CD_Flags = CD_Node+LN_sizeof +CD_Pad = CD_Flags+1 +CD_Rom = CD_Pad+1 +CD_BoardAddr = CD_Rom+ER_sizeof +CD_BoardSize = CD_BoardAddr+4 +CD_SlotAddr = CD_BoardSize+4 +CD_SlotSize = CD_SlotAddr+2 +CD_Driver = CD_SlotSize+2 +CD_NextCD = CD_Driver+4 +CD_Unused = CD_NextCD+4 +CD_sizeof = CD_Unused+(4*4) + +#endif /* __ASSEMBLY__ */ + +#ifndef __ASSEMBLY__ + +#define ZORRO_NUM_AUTO 16 + +#ifdef __KERNEL__ + +extern int zorro_num_autocon; /* # of autoconfig devices found */ +extern struct ConfigDev zorro_autocon[ZORRO_NUM_AUTO]; + + +/* + * Zorro Functions + */ + +extern int zorro_find(int manuf, int prod, int part, int index); +extern struct ConfigDev *zorro_get_board(int key); +extern void zorro_config_board(int key, int part); +extern void zorro_unconfig_board(int key, int part); + + +/* + * Bitmask indicating portions of available Zorro II RAM that are unused + * by the system. Every bit represents a 64K chunk, for a maximum of 8MB + * (128 chunks, physical 0x00200000-0x009fffff). + * + * If you want to use (= allocate) portions of this RAM, you should clear + * the corresponding bits. + */ + +extern u_long zorro_unused_z2ram[4]; + +#define Z2RAM_START (0x00200000) +#define Z2RAM_END (0x00a00000) +#define Z2RAM_SIZE (0x00800000) +#define Z2RAM_CHUNKSIZE (0x00010000) +#define Z2RAM_CHUNKMASK (0x0000ffff) +#define Z2RAM_CHUNKSHIFT (16) + + +/* + * Verbose Board Identification + */ + +extern void zorro_identify(void); +extern int zorro_get_list(char *buffer); + +#endif /* !__ASSEMBLY__ */ +#endif /* __KERNEL__ */ + +#endif /* __ZORRO_H */ +/* + * linux/zorro.h -- Amiga AutoConfig (Zorro) Expansion Device Definitions + * + * Copyright (C) 1995 Geert Uytterhoeven + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file COPYING in the main directory of this archive + * for more details. + */ + +#ifndef __ZORRO_H +#define __ZORRO_H + +#ifndef __ASSEMBLY__ + +/* + * Defined Board Manufacturers + * + * Please update arch/m68k/amiga/zorro.c if you make changes here + * Many IDs were obtained from ExpName/Identify ((C) Richard Körber) + * and by looking at the NetBSD-Amiga kernel sources + */ + +#define MANUF_PACIFIC (0x00D3) /* Pacific Peripherals */ +#define PROD_SE_2000_A500 (0x00) /* SE 2000 A500 */ +#define PROD_PACIFIC_HD (0x0A) /* HD Controller */ + +#define MANUF_KUPKE (0x00DD) /* Kupke */ +#define PROD_GOLEM_BOX_2 (0x00) /* Golem RAM Box 2MB */ + +#define MANUF_MEMPHIS (0x0100) /* Memphis */ +#define PROD_STORMBRINGER (0x00) /* Stormbringer */ + +#define MANUF_3_STATE (0x0200) /* 3-State */ +#define PROD_MEGAMIX_2000 (0x02) /* Megamix 2000 RAM */ + +#define MANUF_COMMODORE2 (0x0201) /* Commodore Braunschweig */ +#define PROD_A2088 (0x01) /* CBM A2088 XT Bridgeboard */ +#define PROD_A2286 (0x02) /* CBM A2286 AT Bridgeboard */ +#define PROD_A4091_2 (0x54) /* CBM A4091 SCSI Controller */ +#define PROD_A2386SX (0x67) /* CBM A2386-SX Bridgeboard */ + +#define MANUF_COMMODORE (0x0202) /* Commodore West Chester */ +#define PROD_A2090A (0x01) /* CBM A2090/A2090A HD Controller */ +#define PROD_A590 (0x02) /* CBM A590 SCSI Controller */ +#define PROD_A2091 (0x03) /* CBM A2091 SCSI Controller */ +#define PROD_A2090B (0x04) /* CBM A2090B 2090 Autoboot Card */ +#define PROD_ARCNET (0x09) /* CBM A2060 Arcnet Card */ +#define PROD_CBMRAM (0x0A) /* CBM A2052/58.RAM | 590/2091.RAM */ +#define PROD_A560RAM (0x20) /* CBM A560 Memory Module */ +#define PROD_A2232PROTO (0x45) /* CBM A2232 Serial Prototype */ +#define PROD_A2232 (0x46) /* CBM A2232 Serial Production */ +#define PROD_A2620 (0x50) /* CBM A2620 68020/RAM Card */ +#define PROD_A2630 (0x51) /* CBM A2630 68030/RAM Card */ +#define PROD_A4091 (0x54) /* CBM A4091 SCSI Controller */ +#define PROD_A2065_2 (0x5A) /* A2065 Ethernet Card */ +#define PROD_ROMULATOR (0x60) /* CBM Romulator Card */ +#define PROD_A3000TESTFIX (0x61) /* CBM A3000 Test Fixture */ +#define PROD_A2386SX_2 (0x67) /* A2386-SX Bridgeboard */ +#define PROD_A2065 (0x70) /* CBM A2065 Ethernet Card */ + +#define MANUF_COMMODORE3 (0x0203) /* Commodore West Chester */ +#define PROD_A2090A_CM (0x03) /* A2090A Combitec/MacroSystem */ + +#define MANUF_KCS (0x02FF) /* Kolff Computer Supplies */ +#define PROD_POWER_BOARD (0x00) /* KCS Power PC Board */ + +#define MANUF_CARDCO (0x03EC) /* Cardco */ +#define PROD_KRONOS_2000_SCSI (0x04) /* Kronos 2000 SCSI Controller */ +#define PROD_A1000_SCSI (0x0C) /* A1000 SCSI Controller */ +#define PROD_ESCORT_SCSI (0x0E) /* Escort SCSI Controller */ +#define PROD_CC_A2410 (0xF5) /* Cardco A2410 Hires Graphics Card */ + +#define MANUF_A_SQUARED (0x03ED) /* A-Squared */ +#define PROD_LIVE_2000 (0x01) /* Live! 2000 */ + +#define MANUF_COMSPEC (0x03EE) /* ComSpec Communications */ +#define PROD_AX2000 (0x01) /* AX2000 */ + +#define MANUF_ANAKIN (0x03F1) /* Anakin */ +#define PROD_EASYL (0x01) /* Easyl Tablet */ + +#define MANUF_MICROBOTICS (0x03F2) /* MicroBotics */ +#define PROD_STARBOARD_II (0x00) /* StarBoard II */ +#define PROD_STARDRIVE (0x02) /* StarDrive */ +#define PROD_8_UP_A (0x03) /* 8-Up (Rev A) */ +#define PROD_8_UP_Z (0x04) /* 8-Up (Rev Z) */ +#define PROD_DELTA_RAM (0x20) /* Delta Card RAM */ +#define PROD_8_STAR_RAM (0x40) /* 8-Star RAM */ +#define PROD_8_STAR (0x41) /* 8-Star */ +#define PROD_VXL_RAM (0x44) /* VXL RAM */ +#define PROD_VXL_30 (0x45) /* VXL-30 Turbo Board */ +#define PROD_DELTA (0x60) /* Delta Card */ +#define PROD_MBX_1200 (0x81) /* MBX 1200 */ +#define PROD_HARDFRAME_2000 (0x9E) /* Hardframe 2000 */ +#define PROD_MBX_1200_2 (0xC1) /* MBX 1200 */ + +#define MANUF_ACCESS (0x03F4) /* Access Associates */ + +#define MANUF_EXPANSION_TECH (0x03F6) /* Expansion Technologies */ + +#define MANUF_ASDG (0x03FF) /* ASDG */ +#define PROD_ASDG_MEMORY (0x01) /* Memory Expansion */ +#define PROD_ASDG_MEMORY_2 (0x02) /* Memory Expansion */ +#define PROD_LAN_ROVER (0xFE) /* Lan Rover Ethernet */ +#define PROD_TWIN_X (0xFF) /* Twin-X Serial Card */ + +#define MANUF_IMTRONICS (0x0404) /* Imtronics */ +#define PROD_HURRICANE_2800 (0x39) /* Hurricane 2800 68030 */ +#define PROD_HURRICANE_2800_2 (0x57) /* Hurricane 2800 68030 */ + +#define MANUF_UNIV_OF_LOWELL (0x0406) /* University of Lowell */ +#define PROD_A2410 (0x00) /* CBM A2410 Hires Graphics Card */ + +#define MANUF_AMERISTAR (0x041D) /* Ameristar */ +#define PROD_AMERISTAR2065 (0x01) /* A2065 Ethernet Card */ +#define PROD_A560 (0x09) /* Arcnet Card */ +#define PROD_A4066 (0x0A) /* A4066 Ethernet Card */ + +#define MANUF_SUPRA (0x0420) /* Supra */ +#define PROD_SUPRADRIVE_4x4 (0x01) /* SupraDrive 4x4 SCSI Controller */ +#define PROD_SUPRA_2000 (0x03) /* 2000 DMA HD */ +#define PROD_SUPRA_500 (0x05) /* 500 HD/RAM */ +#define PROD_SUPRA_500XP (0x09) /* 500XP/2000 RAM */ +#define PROD_SUPRA_500RX (0x0A) /* 500RX/2000 RAM */ +#define PROD_SUPRA_2400ZI (0x0B) /* 2400zi Modem */ +#define PROD_WORDSYNC (0x0C) /* Supra Wordsync SCSI Controller */ +#define PROD_WORDSYNC_II (0x0D) /* Supra Wordsync II SCSI Controller */ +#define PROD_SUPRA_2400ZIPLUS (0x10) /* 2400zi+ Modem */ + +#define MANUF_CSA (0x0422) /* Computer Systems Ass. */ +#define PROD_MAGNUM (0x11) /* Magnum 40 SCSI Controller */ +#define PROD_12GAUGE (0x15) /* 12 Gauge SCSI Controller */ + +#define MANUF_MTEC2 (0x0502) /* M-Tech */ +#define PROD_AT500_2 (0x03) /* AT500 RAM */ + +#define MANUF_GVP3 (0x06E1) /* Great Valley Products */ +#define PROD_IMPACT (0x08) /* Impact SCSI/Memory */ + +#define MANUF_BYTEBOX (0x07DA) /* ByteBox */ +#define PROD_BYTEBOX_A500 (0x00) /* A500 */ + +#define MANUF_HACKER (0x07DB) /* Test only: no product definitions */ + +#define MANUF_POWER_COMPUTING (0x07DC) /* Power Computing (DKB) */ +#define PROD_DKB_3128 (0x0E) /* DKB 3128 RAM */ +#define PROD_RAPID_FIRE (0x0F) /* Rapid Fire SCSI Controller */ +#define PROD_DKB_1202 (0x10) /* DKB 1202 RAM */ +#define PROD_VIPER_II_COBRA (0x12) /* Viper II Turbo Board (DKB Cobra) */ +#define PROD_WILDFIRE_060 (0x17) /* WildFire 060 Turbo Board */ +#define PROD_WILDFIRE_060_2 (0xFF) /* WildFire 060 Turbo Board */ + +#define MANUF_GVP (0x07E1) /* Great Valley Products */ +#define PROD_IMPACT_I_4K (0x01) /* Impact Series-I SCSI 4K */ +#define PROD_IMPACT_I_16K_2 (0x02) /* Impact Series-I SCSI 16K/2 */ +#define PROD_IMPACT_I_16K_3 (0x03) /* Impact Series-I SCSI 16K/3 */ +#define PROD_IMPACT_3001_IDE (0x08) /* Impact 3001 IDE */ +#define PROD_IMPACT_3001_RAM (0x09) /* Impact 3001 RAM */ +#define PROD_GVPIISCSI (0x0B) /* GVP Series II SCSI Controller */ +#define PROD_GVPIISCSI_2 (0x09) /* evidence that the driver works + for this product code also */ +#define PROD_GVPIIRAM (0x0A) /* GVP Series II RAM */ +#define PROD_GVP (0x0B) /* This code is used by a wide range of + GVP products - use the epc to + identify it correctly */ +#define PROD_GVP_A2000_030 (0x0D) /* GVP A2000 68030 Turbo Board */ +#define PROD_IMPACT_3001_IDE_2 (0x0D) /* Impact 3001 IDE */ +#define PROD_GFORCE_040_SCSI (0x16) /* GForce 040 with SCSI (new) */ +#define PROD_GVPIV_24 (0x20) /* GVP IV-24 Graphics Board */ +#define PROD_GFORCE_040 (0xFF) /* GForce 040 Turbo Board */ +/* #define PROD_GVPIO_EXT (0xFF)*/ /* GVP I/O Extender */ + +#define MANUF_SYNERGY (0x07E5) /* Synergy */ + +#define MANUF_XETEC (0x07E6) /* Xetec */ +#define PROD_FASTCARD_SCSI (0x01) /* FastCard SCSI Controller */ +#define PROD_FASTCARD_RAM (0x02) /* FastCard RAM */ + +#define MANUF_PPI (0x07EA) /* Progressive Peripherals Inc. */ +#define PROD_MERCURY (0x00) /* Mercury Turbo Board */ +#define PROD_PPS_A3000_040 (0x01) /* PP&S A3000 68040 Turbo Board */ +#define PROD_PPS_A2000_040 (0x69) /* PP&S A2000 68040 Turbo Board */ +#define PROD_ZEUS (0x96) /* Zeus SCSI Controller */ +#define PROD_PPS_A500_040 (0xBB) /* PP&S A500 68040 Turbo Board */ + +#define MANUF_XEBEC (0x07EC) /* Xebec */ + +#define MANUF_SPIRIT (0x07F2) /* Spirit */ +#define PROD_HDA_506 (0x04) /* HDA 506 Harddisk */ +#define PROD_OCTABYTE_RAM (0x06) /* OctaByte RAM */ + +#define MANUF_BSC (0x07FE) /* BSC */ +#define PROD_ALF_3_SCSI (0x03) /* BSC ALF 3 SCSI Controller */ + +#define MANUF_BSC3 (0x0801) /* BSC */ +#define PROD_ALF_2_SCSI (0x01) /* ALF 2 SCSI Controller */ +#define PROD_ALF_2_SCSI_2 (0x02) /* ALF 2 SCSI Controller */ +#define PROD_ALF_3_SCSI_2 (0x03) /* ALF 3 SCSI Controller */ + +#define MANUF_C_LTD (0x0802) /* C Ltd. */ +#define PROD_KRONOS_SCSI (0x04) /* Kronos SCSI Controller */ +#define PROD_A1000_SCSI_2 (0x0C) /* A1000 SCSI Controller */ + +#define MANUF_JOCHHEIM (0x0804) /* Jochheim */ +#define PROD_JOCHHEIM_RAM (0x01) /* Jochheim RAM */ + +#define MANUF_CHECKPOINT (0x0807) /* Checkpoint Technologies */ +#define PROD_SERIAL_SOLUTION (0x00) /* Serial Solution */ + +#define MANUF_ICD (0x0817) /* ICD */ +#define PROD_ADVANTAGE_2000 (0x01) /* Advantage 2000 SCSI Controller */ + +#define MANUF_KUPKE2 (0x0819) /* Kupke */ +#define PROD_KUPKE_SCSI_II (0x02) /* Golem SCSI-II Controller */ +#define PROD_GOLEM_BOX (0x03) /* Golem Box */ +#define PROD_KUPKE_TURBO (0x04) /* 030/882 Turbo Board */ +#define PROD_KUPKE_SCSI_AT (0x05) /* SCSI/AT Controller */ + +#define MANUF_GVP4 (0x081D) /* Great Valley Products */ +#define PROD_A2000_RAM8 (0x09) /* A2000-RAM8/2 */ + +#define MANUF_INTERWORKS_NET (0x081E) /* Interworks Network */ + +#define MANUF_HARDITAL (0x0820) /* Hardital Synthesis */ +#define PROD_TQM (0x14) /* TQM 68030+68882 Turbo Board */ + +#define MANUF_BSC2 (0x082C) /* BSC */ +#define PROD_OKTAGON_SCSI (0x05) /* BSC Oktagon 2008 SCSI Controller */ +#define PROD_TANDEM (0x06) /* BSC Tandem AT-2008/508 IDE */ +#define PROD_ALPHA_RAM_1200 (0x07) /* Alpha RAM 1200 */ +#define PROD_OKTAGON_RAM (0x08) /* BSC Oktagon 2008 RAM */ +#define PROD_MULTIFACE_I (0x10) /* Alfa Data MultiFace I */ +#define PROD_MULTIFACE_II (0x11) /* Alfa Data MultiFace II */ +#define PROD_MULTIFACE_III (0x12) /* Alfa Data MultiFace III */ +#define PROD_BSC_FRAEMBUFFER (0x20) /* Framebuffer */ +#define PROD_GRAFFITI_RAM (0x21) /* Graffiti Graphics Board */ +#define PROD_GRAFFITI_REG (0x22) +#define PROD_ISDN_MASTERCARD (0x40) /* BSC ISDN MasterCard */ +#define PROD_ISDN_MASTERCARD_2 (0x41) /* BSC ISDN MasterCard II */ + +#define MANUF_ADV_SYS_SOFT (0x0836) /* Advanced Systems & Software */ +#define PROD_NEXUS_SCSI (0x01) /* Nexus SCSI Controller */ +#define PROD_NEXUS_RAM (0x08) /* Nexus RAM */ + +#define MANUF_IMPULSE (0x0838) /* Impulse */ +#define PROD_FIRECRACKER_24 (0x00) /* FireCracker 24 */ + +#define MANUF_IVS (0x0840) /* IVS */ +#define PROD_GRANDSLAM_PIC_2 (0x02) /* GrandSlam PIC 2 RAM */ +#define PROD_GRANDSLAM_PIC_1 (0x04) /* GrandSlam PIC 1 RAM */ +#define PROD_IVS_OVERDRIVE (0x10) /* OverDrive HD */ +#define PROD_TRUMPCARD_CLASSIC (0x30) /* Trumpcard Classic SCSI Controller */ +#define PROD_TRUMPCARD_PRO (0x34) /* Trumpcard Pro SCSI Controller */ +#define PROD_META_4 (0x40) /* Meta-4 RAM */ +#define PROD_WAVETOOLS (0xBF) /* Wavetools Sound Board */ +#define PROD_VECTOR (0xF3) /* Vector SCSI Controller */ +#define PROD_VECTOR_2 (0xF4) /* Vector SCSI Controller */ + +#define MANUF_VECTOR (0x0841) /* Vector */ +#define PROD_CONNECTION (0xE3) /* Connection Serial IO */ + +#define MANUF_XPERT_PRODEV (0x0845) /* XPert/ProDev */ +#define PROD_VISIONA_RAM (0x01) /* Visiona Graphics Board */ +#define PROD_VISIONA_REG (0x02) +#define PROD_MERLIN_RAM (0x03) /* Merlin Graphics Board */ +#define PROD_MERLIN_REG (0x04) +#define PROD_MERLIN_REG_2 (0xC9) + +#define MANUF_HYDRA_SYSTEMS (0x0849) /* Hydra Systems */ +#define PROD_AMIGANET (0x01) /* Amiganet Board */ + +#define MANUF_SUNRIZE (0x084F) /* Sunrize Industries */ +#define PROD_AD1012 (0x01) /* AD1012 Sound Board */ +#define PROD_AD516 (0x02) /* AD516 Sound Board */ +#define PROD_DD512 (0x03) /* DD512 Sound Board */ + +#define MANUF_TRICERATOPS (0x0850) /* Triceratops */ +#define PROD_TRICERATOPS (0x01) /* Triceratops Multi I/O Board */ + +#define MANUF_APPLIED_MAGIC (0x0851) /* Applied Magic Inc */ +#define PROD_DMI_RESOLVER (0x01) /* DMI Resolver Graphics Board */ +#define PROD_DIGITAL_BCASTER (0x06) /* Digital Broadcaster */ + +#define MANUF_GFX_BASE (0x085E) /* GFX-Base */ +#define PROD_GDA_1_RAM (0x00) /* GDA-1 Graphics Board */ +#define PROD_GDA_1_REG (0x01) + +#define MANUF_ROCTEC (0x0860) /* RocTec */ +#define PROD_RH_800C (0x01) /* RH 800C Hard Disk Controller */ +#define PROD_RH_800C_RAM (0x01) /* RH 800C RAM */ + +#define MANUF_HELFRICH1 (0x0861) /* Helfrich */ +#define PROD_RAINBOW3 (0x21) /* Rainbow3 Graphics Board */ + +#define MANUF_SW_RESULT_ENTS (0x0866) /* Software Result Enterprises */ +#define PROD_GG2PLUS (0x01) /* GG2+ Bus Converter */ + +#define MANUF_MASOBOSHI (0x086D) /* Masoboshi */ +#define PROD_MASTER_CARD_RAM (0x03) /* Master Card RAM */ +#define PROD_MASTER_CARD_SCSI (0x04) /* Master Card SCSI Controller */ +#define PROD_MVD_819 (0x07) /* MVD 819 */ + +#define MANUF_DELACOMP (0x0873) /* DelaComp */ +#define PROD_DELACOMP_RAM_2000 (0x01) /* RAM Expansion 2000 */ + +#define MANUF_VILLAGE_TRONIC (0x0877) /* Village Tronic */ +#define PROD_DOMINO_RAM (0x01) /* Domino Graphics Board */ +#define PROD_DOMINO_REG (0x02) +#define PROD_PICASSO_II_RAM (0x0B) /* Picasso II/II+ Graphics Board */ +#define PROD_PICASSO_II_REG (0x0C) +#define PROD_PICASSO_II_SEGM (0x0D) /* Picasso II/II+ (Segmented Mode) */ +#define PROD_PICASSO_IV (0x15) /* Picassio IV Graphics Board */ +#define PROD_PICASSO_IV_2 (0x16) +#define PROD_PICASSO_IV_3 (0x17) +#define PROD_PICASSO_IV_4 (0x18) +#define PROD_ARIADNE (0xC9) /* Ariadne Ethernet */ + +#define MANUF_UTILITIES_ULTD (0x087B) /* Utilities Unlimited */ +#define PROD_EMPLANT_DELUXE (0x15) /* Emplant Deluxe SCSI Controller */ +#define PROD_EMPLANT_DELUXE2 (0x20) /* Emplant Deluxe SCSI Controller */ + +#define MANUF_AMITRIX (0x0880) /* Amitrix */ +#define PROD_AMITRIX_MULTI_IO (0x01) /* Multi-IO */ +#define PROD_AMITRIX_CD_RAM (0x02) /* CD-RAM Memory */ + +#define MANUF_ARMAX (0x0885) /* ArMax */ +#define PROD_OMNIBUS (0x00) /* OmniBus Graphics Board */ + +#define MANUF_NEWTEK (0x088F) /* NewTek */ +#define PROD_VIDEOTOASTER (0x00) /* VideoToaster */ + +#define MANUF_MTEC (0x0890) /* M-Tech Germany */ +#define PROD_AT500 (0x01) /* AT500 IDE Controller */ +#define PROD_MTEC_68030 (0x03) /* 68030 Turbo Board */ +#define PROD_MTEC_68020I (0x06) /* 68020i Turbo Board */ +#define PROD_MTEC_T1230 (0x20) /* A1200 T68030/42 RTC Turbo Board */ +#define PROD_MTEC_RAM (0x22) /* MTEC 8MB RAM */ + +#define MANUF_GVP2 (0x0891) /* Great Valley Products */ +#define PROD_SPECTRUM_RAM (0x01) /* EGS 28/24 Spectrum Graphics Board */ +#define PROD_SPECTRUM_REG (0x02) + +#define MANUF_HELFRICH2 (0x0893) /* Helfrich */ +#define PROD_PICCOLO_RAM (0x05) /* Piccolo Graphics Board */ +#define PROD_PICCOLO_REG (0x06) +#define PROD_PEGGY_PLUS (0x07) /* PeggyPlus MPEG Decoder Board */ +#define PROD_VIDEOCRUNCHER (0x08) /* VideoCruncher */ +#define PROD_SD64_RAM (0x0A) /* SD64 Graphics Board */ +#define PROD_SD64_REG (0x0B) + +#define MANUF_MACROSYSTEMS (0x089B) /* MacroSystems USA */ +#define PROD_WARP_ENGINE (0x13) /* Warp Engine 40xx SCSI Controller */ + +#define MANUF_ELBOX (0x089E) /* ElBox Computer */ +#define PROD_ELBOX_1200 (0x06) /* Elbox 1200/4 RAM */ + +#define MANUF_HARMS_PROF (0x0A00) /* Harms Professional */ +#define PROD_HARMS_030_PLUS (0x10) /* 030 plus */ +#define PROD_3500_TURBO (0xD0) /* 3500 Turbo board */ + +#define MANUF_MICRONIK (0x0A50) /* Micronik */ +#define PROD_RCA_120 (0x0A) /* RCA 120 RAM */ + +#define MANUF_MEGA_MICRO (0x1000) /* MegaMicro */ +#define PROD_SCRAM_500_SCSI (0x03) /* SCRAM 500 SCSI Controller */ +#define PROD_SCRAM_500_RAM (0x04) /* SCRAM 500 RAM */ + +#define MANUF_IMTRONICS2 (0x1028) /* Imtronics */ +#define PROD_HURRICANE_2800_3 (0x39) /* Hurricane 2800 68030 */ +#define PROD_HURRICANE_2800_4 (0x57) /* Hurricane 2800 68030 */ + +#define MANUF_KUPKE3 (0x1248) /* Kupke */ +#define PROD_GOLEM_3000 (0x01) /* Golem HD 3000 */ + +#define MANUF_ITH (0x1388) /* ITH */ +#define PROD_ISDN_MASTER_II (0x01) /* ISDN-Master II */ + +#define MANUF_VMC (0x1389) /* VMC */ +#define PROD_ISDN_BLASTER_Z2 (0x01) /* ISDN Blaster Z2 */ +#define PROD_HYPERCOM_4 (0x02) /* HyperCom 4 */ + +#define MANUF_INFORMATION (0x157C) /* Information */ +#define PROD_ISDN_ENGINE_I (0x64) /* ISDN Engine I */ + +#define MANUF_VORTEX (0x2017) /* Vortex */ +#define PROD_GOLDEN_GATE_386SX (0x07) /* Golden Gate 80386SX Board */ +#define PROD_GOLDEN_GATE_RAM (0x08) /* Golden Gate RAM */ +#define PROD_GOLDEN_GATE_486 (0x09) /* Golden Gate 80486 Board */ + +#define MANUF_DATAFLYER (0x2062) /* DataFlyer */ +#define PROD_DATAFLYER_4000SXS (0x01) /* DataFlyer 4000SX SCSI Controller */ +#define PROD_DATAFLYER_4000SXR (0x02) /* DataFlyer 4000SX RAM */ + +#define MANUF_READYSOFT (0x2100) /* ReadySoft */ +#define PROD_AMAX (0x01) /* AMax II/IV */ + +#define MANUF_PHASE5 (0x2140) /* Phase5 */ +#define PROD_BLIZZARD_RAM (0x01) /* Blizzard RAM */ +#define PROD_BLIZZARD (0x02) /* Blizzard */ +#define PROD_BLIZZARD_1220_IV (0x06) /* Blizzard 1220-IV Turbo Board */ +#define PROD_FASTLANE_RAM (0x0A) /* FastLane RAM */ +#define PROD_FASTLANE_SCSI (0x0B) /* FastLane/Blizzard 1230-II SCSI/CyberSCSI */ +#define PROD_CYBERSTORM_SCSI (0x0C) /* Blizzard 1220/CyberStorm */ +#define PROD_BLIZZARD_1230_III (0x0D) /* Blizzard 1230-III Turbo Board */ +#define PROD_BLIZZARD_1230_IV (0x11) /* Blizzard 1230-IV/1260 Turbo Board */ +#define PROD_BLIZZARD_2060SCSI (0x18) /* Blizzard 2060 SCSI Controller */ +#define PROD_CYBERSTORM_II (0x19) /* CyberStorm Mk II */ +#define PROD_CYBERVISION (0x22) /* CyberVision64 Graphics Board */ +#define PROD_CYBERVISION3D_PRT (0x32) /* CyberVision64-3D Prototype */ +#define PROD_CYBERVISION3D (0x43) /* CyberVision64-3D Graphics Board */ + +#define MANUF_DPS (0x2169) /* DPS */ +#define PROD_DPS_PAR (0x01) /* Personal Animation Recorder */ + +#define MANUF_APOLLO2 (0x2200) /* Apollo */ +#define PROD_A620 (0x00) /* A620 68020 Accelerator */ +#define PROD_A620_2 (0x01) /* A620 68020 Accelerator */ + +#define MANUF_APOLLO (0x2222) /* Apollo */ +#define PROD_AT_APOLLO (0x22) /* AT-Apollo */ +#define PROD_APOLLO_TURBO (0x23) /* Apollo Turbo Board */ + +#define MANUF_PETSOFF (0x38A5) /* Petsoff LP */ +#define PROD_DELFINA (0x00) /* Delfina DSP */ + +#define MANUF_UWE_GERLACH (0x3FF7) /* Uwe Gerlach */ +#define PROD_UG_RAM_ROM (0xd4) /* RAM/ROM */ + +#define MANUF_MACROSYSTEMS2 (0x4754) /* MacroSystems Germany */ +#define PROD_MAESTRO (0x03) /* Maestro */ +#define PROD_VLAB (0x04) /* VLab */ +#define PROD_MAESTRO_PRO (0x05) /* Maestro Pro */ +#define PROD_RETINA_Z2 (0x06) /* Retina Z2 Graphics Board */ +#define PROD_MULTI_EVOLUTION (0x08) /* MultiEvolution */ +#define PROD_TOCCATA (0x0C) /* Toccata Sound Board */ +#define PROD_RETINA_Z3 (0x10) /* Retina Z3 Graphics Board */ +#define PROD_VLAB_MOTION (0x12) /* VLab Motion */ +#define PROD_ALTAIS (0x13) /* Altais Graphics Board */ +#define PROD_FALCON_040 (0xFD) /* Falcon '040 Turbo Board */ + +#define MANUF_COMBITEC (0x6766) /* Combitec */ + +#define MANUF_SKI (0x8000) /* SKI Peripherals */ +#define PROD_MAST_FIREBALL (0x08) /* M.A.S.T. Fireball SCSI Controller */ +#define PROD_SKI_SCSI_SERIAL (0x80) /* SCSI / Dual Serial */ + +#define MANUF_CAMERON (0xAA01) /* Cameron */ +#define PROD_PERSONAL_A4 (0x10) /* Personal A4 */ + +#define MANUF_REIS_WARE (0xAA11) /* Reis-Ware */ +#define PROD_RW_HANDYSCANNER (0x11) /* Handyscanner */ + + +/* Illegal Manufacturer IDs. These do NOT appear in arch/m68k/amiga/zorro.c! */ + +#define MANUF_HACKER_INC (0x07DB) /* Hacker Inc. */ +#define PROD_HACKER_SCSI (0x01) /* Hacker Inc. SCSI Controller */ + +#define MANUF_RES_MNGT_FORCE (0x07DB) /* Resource Management Force */ +#define PROD_QUICKNET (0x02) /* QuickNet Ethernet */ + +#define MANUF_VECTOR2 (0x07DB) /* Vector */ +#define PROD_CONNECTION_2 (0xE0) /* Vector Connection */ +#define PROD_CONNECTION_3 (0xE1) /* Vector Connection */ +#define PROD_CONNECTION_4 (0xE2) /* Vector Connection */ +#define PROD_CONNECTION_5 (0xE3) /* Vector Connection */ + + +/* + * GVP's identifies most of their product through the 'extended + * product code' (epc). The epc has to be and'ed with the GVP_PRODMASK + * before the identification. + */ + +#define GVP_PRODMASK (0xf8) +#define GVP_SCSICLKMASK (0x01) + +enum GVP_ident { + GVP_GFORCE_040 = 0x20, + GVP_GFORCE_040_SCSI = 0x30, + GVP_A1291_SCSI = 0x40, + GVP_COMBO_R4 = 0x60, + GVP_COMBO_R4_SCSI = 0x70, + GVP_PHONEPAK = 0x78, + GVP_IOEXT = 0x98, + GVP_GFORCE_030 = 0xa0, + GVP_GFORCE_030_SCSI = 0xb0, + GVP_A530 = 0xc0, + GVP_A530_SCSI = 0xd0, + GVP_COMBO_R3 = 0xe0, + GVP_COMBO_R3_SCSI = 0xf0, + GVP_SERIESII = 0xf8, +}; + +enum GVP_flags { + GVP_IO = 0x01, + GVP_ACCEL = 0x02, + GVP_SCSI = 0x04, + GVP_24BITDMA = 0x08, + GVP_25BITDMA = 0x10, + GVP_NOBANK = 0x20, + GVP_14MHZ = 0x40, +}; + + +struct Node { + struct Node *ln_Succ; /* Pointer to next (successor) */ + struct Node *ln_Pred; /* Pointer to previous (predecessor) */ + u_char ln_Type; + char ln_Pri; /* Priority, for sorting */ + char *ln_Name; /* ID string, null terminated */ +}; + +struct ExpansionRom { + /* -First 16 bytes of the expansion ROM */ + u_char er_Type; /* Board type, size and flags */ + u_char er_Product; /* Product number, assigned by manufacturer */ + u_char er_Flags; /* Flags */ + u_char er_Reserved03; /* Must be zero ($ff inverted) */ + u_short er_Manufacturer; /* Unique ID,ASSIGNED BY COMMODORE-AMIGA! */ + u_long er_SerialNumber; /* Available for use by manufacturer */ + u_short er_InitDiagVec; /* Offset to optional "DiagArea" structure */ + u_char er_Reserved0c; + u_char er_Reserved0d; + u_char er_Reserved0e; + u_char er_Reserved0f; +}; + +/* er_Type board type bits */ +#define ERT_TYPEMASK 0xc0 +#define ERT_ZORROII 0xc0 +#define ERT_ZORROIII 0x80 + +/* other bits defined in er_Type */ +#define ERTB_MEMLIST 5 /* Link RAM into free memory list */ +#define ERTF_MEMLIST (1<<5) + +struct ConfigDev { + struct Node cd_Node; + u_char cd_Flags; /* (read/write) */ + u_char cd_Pad; /* reserved */ + struct ExpansionRom cd_Rom; /* copy of board's expansion ROM */ + void *cd_BoardAddr; /* where in memory the board was placed */ + u_long cd_BoardSize; /* size of board in bytes */ + u_short cd_SlotAddr; /* which slot number (PRIVATE) */ + u_short cd_SlotSize; /* number of slots (PRIVATE) */ + void *cd_Driver; /* pointer to node of driver */ + struct ConfigDev *cd_NextCD; /* linked list of drivers to config */ + u_long cd_Unused[4]; /* for whatever the driver wants */ +}; + +#else /* __ASSEMBLY__ */ + +LN_Succ = 0 +LN_Pred = LN_Succ+4 +LN_Type = LN_Pred+4 +LN_Pri = LN_Type+1 +LN_Name = LN_Pri+1 +LN_sizeof = LN_Name+4 + +ER_Type = 0 +ER_Product = ER_Type+1 +ER_Flags = ER_Product+1 +ER_Reserved03 = ER_Flags+1 +ER_Manufacturer = ER_Reserved03+1 +ER_SerialNumber = ER_Manufacturer+2 +ER_InitDiagVec = ER_SerialNumber+4 +ER_Reserved0c = ER_InitDiagVec+2 +ER_Reserved0d = ER_Reserved0c+1 +ER_Reserved0e = ER_Reserved0d+1 +ER_Reserved0f = ER_Reserved0e+1 +ER_sizeof = ER_Reserved0f+1 + +CD_Node = 0 +CD_Flags = CD_Node+LN_sizeof +CD_Pad = CD_Flags+1 +CD_Rom = CD_Pad+1 +CD_BoardAddr = CD_Rom+ER_sizeof +CD_BoardSize = CD_BoardAddr+4 +CD_SlotAddr = CD_BoardSize+4 +CD_SlotSize = CD_SlotAddr+2 +CD_Driver = CD_SlotSize+2 +CD_NextCD = CD_Driver+4 +CD_Unused = CD_NextCD+4 +CD_sizeof = CD_Unused+(4*4) + +#endif /* __ASSEMBLY__ */ + +#ifndef __ASSEMBLY__ + +#define ZORRO_NUM_AUTO 16 + +#ifdef __KERNEL__ + +extern int zorro_num_autocon; /* # of autoconfig devices found */ +extern struct ConfigDev zorro_autocon[ZORRO_NUM_AUTO]; + + +/* + * Zorro Functions + */ + +extern int zorro_find(int manuf, int prod, int part, int index); +extern struct ConfigDev *zorro_get_board(int key); +extern void zorro_config_board(int key, int part); +extern void zorro_unconfig_board(int key, int part); + + +/* + * Bitmask indicating portions of available Zorro II RAM that are unused + * by the system. Every bit represents a 64K chunk, for a maximum of 8MB + * (128 chunks, physical 0x00200000-0x009fffff). + * + * If you want to use (= allocate) portions of this RAM, you should clear + * the corresponding bits. + */ + +extern u_long zorro_unused_z2ram[4]; + +#define Z2RAM_START (0x00200000) +#define Z2RAM_END (0x00a00000) +#define Z2RAM_SIZE (0x00800000) +#define Z2RAM_CHUNKSIZE (0x00010000) +#define Z2RAM_CHUNKMASK (0x0000ffff) +#define Z2RAM_CHUNKSHIFT (16) + + +/* + * Verbose Board Identification + */ + +extern void zorro_identify(void); +extern int zorro_get_list(char *buffer); + +#endif /* !__ASSEMBLY__ */ +#endif /* __KERNEL__ */ + +#endif /* __ZORRO_H */ |