Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
6e38a55b
Commit
6e38a55b
authored
Nov 23, 2007
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Import 1.1.53
parent
5f50b72d
Changes
30
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
1317 additions
and
965 deletions
+1317
-965
Makefile
Makefile
+6
-2
drivers/char/console.c
drivers/char/console.c
+16
-4
drivers/net/3c501.c
drivers/net/3c501.c
+139
-114
drivers/net/3c503.c
drivers/net/3c503.c
+86
-49
drivers/net/3c507.c
drivers/net/3c507.c
+68
-48
drivers/net/3c509.c
drivers/net/3c509.c
+113
-97
drivers/net/8390.c
drivers/net/8390.c
+18
-15
drivers/net/8390.h
drivers/net/8390.h
+6
-6
drivers/net/at1700.c
drivers/net/at1700.c
+78
-53
drivers/net/auto_irq.c
drivers/net/auto_irq.c
+58
-47
drivers/net/hp-plus.c
drivers/net/hp-plus.c
+29
-17
drivers/net/hp.c
drivers/net/hp.c
+42
-26
drivers/net/lance.c
drivers/net/lance.c
+127
-91
drivers/net/loopback.c
drivers/net/loopback.c
+1
-1
drivers/net/ne.c
drivers/net/ne.c
+97
-62
drivers/net/net_init.c
drivers/net/net_init.c
+9
-9
drivers/net/skeleton.c
drivers/net/skeleton.c
+110
-58
drivers/net/smc-ultra.c
drivers/net/smc-ultra.c
+196
-179
drivers/net/wd.c
drivers/net/wd.c
+67
-53
drivers/net/znet.c
drivers/net/znet.c
+2
-2
drivers/scsi/scsi.c
drivers/scsi/scsi.c
+1
-1
fs/nfs/proc.c
fs/nfs/proc.c
+1
-1
fs/nfs/sock.c
fs/nfs/sock.c
+3
-1
fs/nfs/symlink.c
fs/nfs/symlink.c
+6
-0
include/linux/resource.h
include/linux/resource.h
+1
-1
include/linux/signal.h
include/linux/signal.h
+2
-15
kernel/sched.c
kernel/sched.c
+12
-4
kernel/signal.c
kernel/signal.c
+2
-2
kernel/vm86.c
kernel/vm86.c
+2
-2
net/inet/icmp.c
net/inet/icmp.c
+19
-5
No files found.
Makefile
View file @
6e38a55b
VERSION
=
1
VERSION
=
1
PATCHLEVEL
=
1
PATCHLEVEL
=
1
SUBLEVEL
=
5
2
SUBLEVEL
=
5
3
ARCH
=
i386
ARCH
=
i386
...
@@ -136,7 +136,11 @@ tools/version.h: $(CONFIGURE) Makefile
...
@@ -136,7 +136,11 @@ tools/version.h: $(CONFIGURE) Makefile
@
echo
\#
define LINUX_COMPILE_TIME
\"
`
date
+%T
`
\"
>>
tools/version.h
@
echo
\#
define LINUX_COMPILE_TIME
\"
`
date
+%T
`
\"
>>
tools/version.h
@
echo
\#
define LINUX_COMPILE_BY
\"
`
whoami
`
\"
>>
tools/version.h
@
echo
\#
define LINUX_COMPILE_BY
\"
`
whoami
`
\"
>>
tools/version.h
@
echo
\#
define LINUX_COMPILE_HOST
\"
`
hostname
`
\"
>>
tools/version.h
@
echo
\#
define LINUX_COMPILE_HOST
\"
`
hostname
`
\"
>>
tools/version.h
@
echo
\#
define LINUX_COMPILE_DOMAIN
\"
`
domainname
`
\"
>>
tools/version.h
@
if
[
-x
/bin/dnsdomainname
]
;
then
\
echo
\#
define LINUX_COMPILE_DOMAIN
\"
`
dnsdomainname
`
\"
;
\
else
\
echo
\#
define LINUX_COMPILE_DOMAIN
\"
`
domainname
`
\"
;
\
fi
>>
tools/version.h
@
echo
\#
define LINUX_COMPILER
\"
`
$(HOSTCC)
-v
2>&1 |
tail
-1
`
\"
>>
tools/version.h
@
echo
\#
define LINUX_COMPILER
\"
`
$(HOSTCC)
-v
2>&1 |
tail
-1
`
\"
>>
tools/version.h
tools/build
:
tools/build.c $(CONFIGURE)
tools/build
:
tools/build.c $(CONFIGURE)
...
...
drivers/char/console.c
View file @
6e38a55b
...
@@ -1081,20 +1081,32 @@ static void reset_terminal(int currcons, int do_clear)
...
@@ -1081,20 +1081,32 @@ static void reset_terminal(int currcons, int do_clear)
}
}
/*
/*
* Turn the Scroll-Lock LED on when the tty is stopped
(with a ^S)
* Turn the Scroll-Lock LED on when the tty is stopped
*/
*/
static
void
con_stop
(
struct
tty_struct
*
tty
)
static
void
con_stop
(
struct
tty_struct
*
tty
)
{
{
set_vc_kbd_led
(
kbd_table
+
fg_console
,
VC_SCROLLOCK
);
int
console_num
;
if
(
!
tty
)
return
;
console_num
=
MINOR
(
tty
->
device
)
-
(
tty
->
driver
.
minor_start
);
if
(
console_num
<
0
||
console_num
>=
NR_CONSOLES
)
return
;
set_vc_kbd_led
(
kbd_table
+
console_num
,
VC_SCROLLOCK
);
set_leds
();
set_leds
();
}
}
/*
/*
* Turn the Scroll-Lock LED off when the console is started
(with a ^Q)
* Turn the Scroll-Lock LED off when the console is started
*/
*/
static
void
con_start
(
struct
tty_struct
*
tty
)
static
void
con_start
(
struct
tty_struct
*
tty
)
{
{
clr_vc_kbd_led
(
kbd_table
+
fg_console
,
VC_SCROLLOCK
);
int
console_num
;
if
(
!
tty
)
return
;
console_num
=
MINOR
(
tty
->
device
)
-
(
tty
->
driver
.
minor_start
);
if
(
console_num
<
0
||
console_num
>=
NR_CONSOLES
)
return
;
clr_vc_kbd_led
(
kbd_table
+
console_num
,
VC_SCROLLOCK
);
set_leds
();
set_leds
();
}
}
...
...
drivers/net/3c501.c
View file @
6e38a55b
This diff is collapsed.
Click to expand it.
drivers/net/3c503.c
View file @
6e38a55b
/* 3c503.c: A shared-memory NS8390 ethernet driver for linux. */
/* 3c503.c: A shared-memory NS8390 ethernet driver for linux. */
/*
/*
Written 1992
,1993
by Donald Becker.
Written 1992
-94
by Donald Becker.
Copyright 1993 United States Government as represented by the
Copyright 1993 United States Government as represented by the
Director, National Security Agency. This software may be used and
Director, National Security Agency. This software may be used and
distributed according to the terms of the GNU Public License,
distributed according to the terms of the GNU Public License,
incorporated herein by reference.
incorporated herein by reference.
The author may be reached as becker@CESDIS.gsfc.nasa.gov, or C/O
Center of Excellence in Space Data and Information Sciences
Code 930.5, Goddard Space Flight Center, Greenbelt MD 20771
This driver should work with the 3c503 and 3c503/16. It should be used
This driver should work with the 3c503 and 3c503/16. It should be used
in shared memory mode for best performance, although it may also work
in shared memory mode for best performance, although it may also work
in programmed-I/O mode.
in programmed-I/O mode.
The Author may be reached as becker@super.org or
Sources:
C/O Supercomputing Research Ctr., 17100 Science Dr., Bowie MD 20715
EtherLink II Technical Reference Guide,
3Com Corporation, 5400 Bayfront Plaza, Santa Clara CA 95052-8145
The Crynwr 3c503 packet driver.
*/
*/
static
char
*
version
=
static
char
*
version
=
"3c503.c:v
0.99.15k 3/3/93 Donald Becker (becker@super.org
)
\n
"
;
"3c503.c:v
1.10 9/23/93 Donald Becker (becker@cesdis.gsfc.nasa.gov
)
\n
"
;
#include <linux/config.h>
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/kernel.h>
...
@@ -31,9 +38,27 @@ static char *version =
...
@@ -31,9 +38,27 @@ static char *version =
#include "8390.h"
#include "8390.h"
#include "3c503.h"
#include "3c503.h"
extern
struct
device
*
init_etherdev
(
struct
device
*
dev
,
int
sizeof_private
,
unsigned
long
*
mem_startp
);
int
el2_probe
(
struct
device
*
dev
);
int
el2_probe
(
struct
device
*
dev
);
int
el2_pio_autoprobe
(
struct
device
*
dev
);
int
el2_pio_probe
(
struct
device
*
dev
);
int
el2probe1
(
int
ioaddr
,
struct
device
*
dev
);
int
el2_probe1
(
struct
device
*
dev
,
int
ioaddr
);
/* A zero-terminated list of I/O addresses to be probed in PIO mode. */
static
unsigned
int
netcard_portlist
[]
=
{
0x300
,
0x310
,
0x330
,
0x350
,
0x250
,
0x280
,
0x2a0
,
0x2e0
,
0
};
#define EL2_IO_EXTENT 16
#ifdef HAVE_DEVLIST
/* The 3c503 uses two entries, one for the safe memory-mapped probe and
the other for the typical I/O probe. */
struct
netdev_entry
el2_drv
=
{
"3c503"
,
el2_probe
,
EL1_IO_EXTENT
,
0
};
struct
netdev_entry
el2pio_drv
=
{
"3c503pio"
,
el2_pioprobe1
,
EL1_IO_EXTENT
,
netcard_portlist
};
#endif
static
int
el2_open
(
struct
device
*
dev
);
static
int
el2_open
(
struct
device
*
dev
);
static
int
el2_close
(
struct
device
*
dev
);
static
int
el2_close
(
struct
device
*
dev
);
...
@@ -52,19 +77,16 @@ static int el2_block_input(struct device *dev, int count, char *buf,
...
@@ -52,19 +77,16 @@ static int el2_block_input(struct device *dev, int count, char *buf,
If the ethercard isn't found there is an optional probe for
If the ethercard isn't found there is an optional probe for
ethercard jumpered to programmed-I/O mode.
ethercard jumpered to programmed-I/O mode.
*/
*/
static
int
ports
[]
=
{
0x300
,
0x310
,
0x330
,
0x350
,
0x250
,
0x280
,
0x2a0
,
0x2e0
,
0
};
int
int
el2_probe
(
struct
device
*
dev
)
el2_probe
(
struct
device
*
dev
)
{
{
int
*
addr
,
addrs
[]
=
{
0xddffe
,
0xd9ffe
,
0xcdffe
,
0xc9ffe
,
0
};
int
*
addr
,
addrs
[]
=
{
0xddffe
,
0xd9ffe
,
0xcdffe
,
0xc9ffe
,
0
};
short
io
addr
=
dev
->
base_addr
;
int
base_
addr
=
dev
->
base_addr
;
if
(
ioaddr
<
0
)
if
(
base_addr
>
0x1ff
)
/* Check a single specified location. */
return
ENXIO
;
/* Don't probe at all. */
return
el2_probe1
(
dev
,
base_addr
);
if
(
ioaddr
>
0
)
else
if
(
base_addr
!=
0
)
/* Don't probe at all. */
return
!
el2probe1
(
ioaddr
,
dev
)
;
return
ENXIO
;
for
(
addr
=
addrs
;
*
addr
;
addr
++
)
{
for
(
addr
=
addrs
;
*
addr
;
addr
++
)
{
int
i
;
int
i
;
...
@@ -75,86 +97,99 @@ el2_probe(struct device *dev)
...
@@ -75,86 +97,99 @@ el2_probe(struct device *dev)
break
;
break
;
if
(
base_bits
!=
1
)
if
(
base_bits
!=
1
)
continue
;
continue
;
#ifdef HAVE_PORTRESERVE
if
(
check_region
(
netcard_portlist
[
i
],
EL2_IO_EXTENT
))
if
(
check_region
(
ports
[
i
],
16
))
continue
;
continue
;
#endif
if
(
el2_probe1
(
dev
,
netcard_portlist
[
i
])
==
0
)
if
(
el2probe1
(
ports
[
i
],
dev
))
return
0
;
return
0
;
}
}
#if
ndef no_probe_nonshared_memory
#if
! defined(no_probe_nonshared_memory) && ! defined (HAVE_DEVLIST)
return
el2_pio_
auto
probe
(
dev
);
return
el2_pio_probe
(
dev
);
#else
#else
return
ENODEV
;
return
ENODEV
;
#endif
#endif
}
}
#ifndef HAVE_DEVLIST
/* Try all of the locations that aren't obviously empty. This touches
/* Try all of the locations that aren't obviously empty. This touches
a lot of locations, and is much riskier than the code above. */
a lot of locations, and is much riskier than the code above. */
int
int
el2_pio_
auto
probe
(
struct
device
*
dev
)
el2_pio_probe
(
struct
device
*
dev
)
{
{
int
i
;
int
i
;
for
(
i
=
0
;
i
<
8
;
i
++
)
{
int
base_addr
=
dev
?
dev
->
base_addr
:
0
;
#ifdef HAVE_PORTRESERVE
if
(
check_region
(
ports
[
i
],
16
))
if
(
base_addr
>
0x1ff
)
/* Check a single specified location. */
continue
;
return
el2_probe1
(
dev
,
base_addr
);
#endif
else
if
(
base_addr
!=
0
)
/* Don't probe at all. */
/* Reset and/or avoid any lurking NE2000 */
return
ENXIO
;
if
(
inb_p
(
ports
[
i
]
+
0x408
)
==
0xff
)
for
(
i
=
0
;
netcard_portlist
[
i
];
i
++
)
{
int
ioaddr
=
netcard_portlist
[
i
];
if
(
check_region
(
ioaddr
,
EL2_IO_EXTENT
))
continue
;
continue
;
if
(
inb
(
ports
[
i
]
+
0x403
)
==
(
0x80
>>
i
)
/* Preliminary check */
if
(
el2_probe1
(
dev
,
ioaddr
)
==
0
)
&&
el2probe1
(
ports
[
i
],
dev
))
return
0
;
return
0
;
}
}
return
ENODEV
;
return
ENODEV
;
}
}
#endif
/* Probe for the Etherlink II card at I/O port base IOADDR,
/* Probe for the Etherlink II card at I/O port base IOADDR,
returning non-zero on success. If found, set the station
returning non-zero on success. If found, set the station
address and memory parameters in DEVICE. */
address and memory parameters in DEVICE. */
int
int
el2
probe1
(
int
ioaddr
,
struct
device
*
dev
)
el2
_probe1
(
struct
device
*
dev
,
int
ioaddr
)
{
{
int
i
,
iobase_reg
,
membase_reg
,
saved_406
;
int
i
,
iobase_reg
,
membase_reg
,
saved_406
;
unsigned
char
*
station_addr
=
dev
->
dev_addr
;
static
unsigned
version_printed
=
0
;
/* Reset and/or avoid any lurking NE2000 */
if
(
inb
(
ioaddr
+
0x408
)
==
0xff
)
return
ENODEV
;
/* We verify that it's a 3C503 board by checking the first three octets
/* We verify that it's a 3C503 board by checking the first three octets
of its ethernet address. */
of its ethernet address. */
printk
(
"3c503 probe at %#3x:"
,
ioaddr
);
iobase_reg
=
inb
(
ioaddr
+
0x403
);
iobase_reg
=
inb
(
ioaddr
+
0x403
);
membase_reg
=
inb
(
ioaddr
+
0x404
);
membase_reg
=
inb
(
ioaddr
+
0x404
);
/*
Verify ASIC register that should be 0 or have
a single bit set. */
/*
ASIC location registers should be 0 or have only
a single bit set. */
if
(
(
iobase_reg
&
(
iobase_reg
-
1
))
if
(
(
iobase_reg
&
(
iobase_reg
-
1
))
||
(
membase_reg
&
(
membase_reg
-
1
)))
{
||
(
membase_reg
&
(
membase_reg
-
1
)))
{
printk
(
" not found.
\n
"
);
return
ENODEV
;
return
0
;
}
}
saved_406
=
inb_p
(
ioaddr
+
0x406
);
saved_406
=
inb_p
(
ioaddr
+
0x406
);
outb_p
(
ECNTRL_RESET
|
ECNTRL_THIN
,
ioaddr
+
0x406
);
/* Reset it... */
outb_p
(
ECNTRL_RESET
|
ECNTRL_THIN
,
ioaddr
+
0x406
);
/* Reset it... */
outb_p
(
ECNTRL_THIN
,
ioaddr
+
0x406
);
outb_p
(
ECNTRL_THIN
,
ioaddr
+
0x406
);
/* Map the station addr PROM into the lower I/O ports. */
/* Map the station addr PROM into the lower I/O ports. */
outb
(
ECNTRL_SAPROM
|
ECNTRL_THIN
,
ioaddr
+
0x406
);
outb
(
ECNTRL_SAPROM
|
ECNTRL_THIN
,
ioaddr
+
0x406
);
for
(
i
=
0
;
i
<
ETHER_ADDR_LEN
;
i
++
)
{
if
(
inb
(
ioaddr
+
0
)
!=
0x02
printk
(
" %2.2X"
,
(
station_addr
[
i
]
=
inb
(
ioaddr
+
i
)));
||
inb
(
ioaddr
+
1
)
!=
0x60
}
||
inb
(
ioaddr
+
2
)
!=
0x8c
)
{
if
(
station_addr
[
0
]
!=
0x02
||
station_addr
[
1
]
!=
0x60
||
station_addr
[
2
]
!=
0x8c
)
{
printk
(
" 3C503 not found.
\n
"
);
/* Restore the register we frobbed. */
/* Restore the register we frobbed. */
outb
(
saved_406
,
ioaddr
+
0x406
);
outb
(
saved_406
,
ioaddr
+
0x406
);
return
0
;
return
ENODEV
;
}
}
#ifdef HAVE_PORTRESERVE
snarf_region
(
ioaddr
,
EL2_IO_EXTENT
);
snarf_region
(
ioaddr
,
16
);
#endif
if
(
dev
==
NULL
)
dev
=
init_etherdev
(
0
,
sizeof
(
struct
ei_device
),
0
);
if
(
ei_debug
&&
version_printed
++
==
0
)
printk
(
version
);
dev
->
base_addr
=
ioaddr
;
ethdev_init
(
dev
);
ethdev_init
(
dev
);
printk
(
"%s: 3c503 at %#3x,"
,
dev
->
name
,
ioaddr
);
/* Retrive and print the ethernet address. */
for
(
i
=
0
;
i
<
6
;
i
++
)
printk
(
" %2.2x"
,
dev
->
dev_addr
[
i
]
=
inb
(
ioaddr
+
i
));
/* Map the 8390 back into the window. */
/* Map the 8390 back into the window. */
outb
(
ECNTRL_THIN
,
ioaddr
+
0x406
);
outb
(
ECNTRL_THIN
,
ioaddr
+
0x406
);
dev
->
base_addr
=
ioaddr
;
/* Probe for, turn on and clear the board's shared memory. */
/* Probe for, turn on and clear the board's shared memory. */
if
(
ei_debug
>
2
)
printk
(
" memory jumpers %2.2x "
,
membase_reg
);
if
(
ei_debug
>
2
)
printk
(
" memory jumpers %2.2x "
,
membase_reg
);
outb
(
EGACFR_NORM
,
ioaddr
+
0x405
);
/* Enable RAM */
outb
(
EGACFR_NORM
,
ioaddr
+
0x405
);
/* Enable RAM */
...
@@ -231,10 +266,11 @@ el2probe1(int ioaddr, struct device *dev)
...
@@ -231,10 +266,11 @@ el2probe1(int ioaddr, struct device *dev)
else
else
printk
(
"
\n
%s: %s using programmed I/O (REJUMPER for SHARED MEMORY).
\n
"
,
printk
(
"
\n
%s: %s using programmed I/O (REJUMPER for SHARED MEMORY).
\n
"
,
dev
->
name
,
ei_status
.
name
);
dev
->
name
,
ei_status
.
name
);
if
(
ei_debug
>
1
)
if
(
ei_debug
>
1
)
printk
(
version
);
printk
(
version
);
return
ioaddr
;
return
0
;
}
}
static
int
static
int
...
@@ -425,5 +461,6 @@ el2_block_input(struct device *dev, int count, char *buf, int ring_offset)
...
@@ -425,5 +461,6 @@ el2_block_input(struct device *dev, int count, char *buf, int ring_offset)
* Local variables:
* Local variables:
* version-control: t
* version-control: t
* kept-new-versions: 5
* kept-new-versions: 5
* c-indent-level: 4
* End:
* End:
*/
*/
drivers/net/3c507.c
View file @
6e38a55b
/* 3c507.c: An EtherLink16 device driver for Linux. */
/* 3c507.c: An EtherLink16 device driver for Linux. */
/*
/*
Written 1993 by Donald Becker.
Written 1993,1994 by Donald Becker.
Copyright 1993 United States Government as represented by the Director,
National Security Agency. This software may only be used and distributed
according to the terms of the GNU Public License as modified by SRC,
incorporated herein by reference.
The author may be reached as becker@super.org or
Copyright 1993 United States Government as represented by the
C/O Supercomputing Research Ctr., 17100 Science Dr., Bowie MD 20715
Director, National Security Agency.
This software may be used and distributed according to the terms
of the GNU Public License, incorporated herein by reference.
The author may be reached as becker@CESDIS.gsfc.nasa.gov, or C/O
Center of Excellence in Space Data and Information Sciences
Code 930.5, Goddard Space Flight Center, Greenbelt MD 20771
Thanks go to jennings@Montrouge.SMR.slb.com ( Patrick Jennings)
Thanks go to jennings@Montrouge.SMR.slb.com ( Patrick Jennings)
and jrs@world.std.com (Rick Sladkey) for testing and bugfixes.
and jrs@world.std.com (Rick Sladkey) for testing and bugfixes.
...
@@ -21,7 +24,7 @@
...
@@ -21,7 +24,7 @@
*/
*/
static
char
*
version
=
static
char
*
version
=
"3c507.c:v
0.99-15f 2/17/94 Donald Becker (becker@super.org
)
\n
"
;
"3c507.c:v
1.10 9/23/94 Donald Becker (becker@cesdis.gsfc.nasa.gov
)
\n
"
;
#include <linux/config.h>
#include <linux/config.h>
...
@@ -32,8 +35,8 @@ static char *version =
...
@@ -32,8 +35,8 @@ static char *version =
that filled in the gaping holes of the Intel documentation. Three cheers
that filled in the gaping holes of the Intel documentation. Three cheers
for Russ Nelson.
for Russ Nelson.
Intel Microcommunications Databook, Vol. 1, 1990. It provides just enough
Intel Microcommunications Databook, Vol. 1, 1990.
It provides just enough
info that the casual reader might think that it documents the i82586.
info that the casual reader might think that it documents the i82586
:-<
.
*/
*/
#include <linux/kernel.h>
#include <linux/kernel.h>
...
@@ -56,12 +59,20 @@ static char *version =
...
@@ -56,12 +59,20 @@ static char *version =
#include <linux/skbuff.h>
#include <linux/skbuff.h>
#include <linux/malloc.h>
#include <linux/malloc.h>
extern
struct
device
*
init_etherdev
(
struct
device
*
dev
,
int
sizeof_private
,
unsigned
long
*
mem_startp
);
/* use 0 for production, 1 for verification, 2..7 for debug */
/* use 0 for production, 1 for verification, 2..7 for debug */
#ifndef NET_DEBUG
#ifndef NET_DEBUG
#define NET_DEBUG 1
#define NET_DEBUG 1
#endif
#endif
static
unsigned
int
net_debug
=
NET_DEBUG
;
static
unsigned
int
net_debug
=
NET_DEBUG
;
/* A zero-terminated list of common I/O addresses to be probed. */
static
unsigned
int
netcard_portlist
[]
=
{
0x300
,
0x320
,
0x340
,
0x280
,
0
};
/*
/*
Details of the i82586.
Details of the i82586.
...
@@ -130,6 +141,7 @@ struct net_local {
...
@@ -130,6 +141,7 @@ struct net_local {
#define ROM_CONFIG 13
#define ROM_CONFIG 13
#define MEM_CONFIG 14
#define MEM_CONFIG 14
#define IRQ_CONFIG 15
#define IRQ_CONFIG 15
#define EL16_IO_EXTENT 16
/* The ID port is used at boot-time to locate the ethercard. */
/* The ID port is used at boot-time to locate the ethercard. */
#define ID_PORT 0x100
#define ID_PORT 0x100
...
@@ -267,7 +279,7 @@ unsigned short init_words[] = {
...
@@ -267,7 +279,7 @@ unsigned short init_words[] = {
extern
int
el16_probe
(
struct
device
*
dev
);
/* Called from Space.c */
extern
int
el16_probe
(
struct
device
*
dev
);
/* Called from Space.c */
static
int
el16_probe1
(
struct
device
*
dev
,
shor
t
ioaddr
);
static
int
el16_probe1
(
struct
device
*
dev
,
in
t
ioaddr
);
static
int
el16_open
(
struct
device
*
dev
);
static
int
el16_open
(
struct
device
*
dev
);
static
int
el16_send_packet
(
struct
sk_buff
*
skb
,
struct
device
*
dev
);
static
int
el16_send_packet
(
struct
sk_buff
*
skb
,
struct
device
*
dev
);
static
void
el16_interrupt
(
int
reg_ptr
);
static
void
el16_interrupt
(
int
reg_ptr
);
...
@@ -279,6 +291,11 @@ static void hardware_send_packet(struct device *dev, void *buf, short length);
...
@@ -279,6 +291,11 @@ static void hardware_send_packet(struct device *dev, void *buf, short length);
void
init_82586_mem
(
struct
device
*
dev
);
void
init_82586_mem
(
struct
device
*
dev
);
#ifdef HAVE_DEVLIST
struct
netdev_entry
netcard_drv
=
{
"3c507"
,
el16_probe1
,
EL16_IO_EXTENT
,
netcard_portlist
};
#endif
/* Check for a network adaptor of this type, and return '0' iff one exists.
/* Check for a network adaptor of this type, and return '0' iff one exists.
If dev->base_addr == 0, probe all likely locations.
If dev->base_addr == 0, probe all likely locations.
If dev->base_addr == 1, always return failure.
If dev->base_addr == 1, always return failure.
...
@@ -288,55 +305,57 @@ void init_82586_mem(struct device *dev);
...
@@ -288,55 +305,57 @@ void init_82586_mem(struct device *dev);
int
int
el16_probe
(
struct
device
*
dev
)
el16_probe
(
struct
device
*
dev
)
{
{
/* Don't probe all settable addresses, 0x[23][0-F]0, just common ones. */
int
base_addr
=
dev
?
dev
->
base_addr
:
0
;
int
*
port
,
ports
[]
=
{
0x300
,
0x320
,
0x340
,
0x280
,
0
};
int
i
;
int
base_addr
=
dev
->
base_addr
;
ushort
lrs_state
=
0xff
,
i
;
if
(
base_addr
>
0x1ff
)
/* Check a single specified location. */
if
(
base_addr
>
0x1ff
)
/* Check a single specified location. */
return
el16_probe1
(
dev
,
base_addr
);
return
el16_probe1
(
dev
,
base_addr
);
else
if
(
base_addr
>
0
)
else
if
(
base_addr
!=
0
)
return
ENXIO
;
/* Don't probe at all. */
return
ENXIO
;
/* Don't probe at all. */
/* Send the ID sequence to the ID_PORT to enable the board. */
for
(
i
=
0
;
netcard_portlist
[
i
];
i
++
)
{
outb
(
0x00
,
ID_PORT
);
int
ioaddr
=
netcard_portlist
[
i
];
for
(
i
=
0
;
i
<
255
;
i
++
)
{
if
(
check_region
(
ioaddr
,
EL16_IO_EXTENT
))
outb
(
lrs_state
,
ID_PORT
);
continue
;
lrs_state
<<=
1
;
if
(
el16_probe1
(
dev
,
ioaddr
)
==
0
)
if
(
lrs_state
&
0x100
)
lrs_state
^=
0xe7
;
}
outb
(
0x00
,
ID_PORT
);
for
(
port
=
&
ports
[
0
];
*
port
;
port
++
)
{
short
ioaddr
=
*
port
;
#if 0
/* This is my original code. */
if (inb(ioaddr) == '*' && inb(ioaddr+1) == '3'
&& inb(ioaddr+2) == 'C' && inb(ioaddr+3) == 'O'
&& el16_probe1(dev, *port) == 0)
return
0
;
return
0
;
#else
/* This is code from jennings@Montrouge.SMR.slb.com, done so that
the string can be printed out. */
char
res
[
5
];
res
[
0
]
=
inb
(
ioaddr
);
res
[
1
]
=
inb
(
ioaddr
+
1
);
res
[
2
]
=
inb
(
ioaddr
+
2
);
res
[
3
]
=
inb
(
ioaddr
+
3
);
res
[
4
]
=
0
;
if
(
res
[
0
]
==
'*'
&&
res
[
1
]
==
'3'
&&
res
[
2
]
==
'C'
&&
res
[
3
]
==
'O'
&&
el16_probe1
(
dev
,
*
port
)
==
0
)
return
0
;
#endif
}
}
return
ENODEV
;
/* ENODEV would be more accurate. */
return
ENODEV
;
/* ENODEV would be more accurate. */
}
}
int
el16_probe1
(
struct
device
*
dev
,
shor
t
ioaddr
)
int
el16_probe1
(
struct
device
*
dev
,
in
t
ioaddr
)
{
{
static
unsigned
char
init_ID_done
=
0
,
version_printed
=
0
;
int
i
,
irq
,
irqval
;
int
i
,
irq
,
irqval
;
if
(
init_ID_done
==
0
)
{
ushort
lrs_state
=
0xff
;
/* Send the ID sequence to the ID_PORT to enable the board(s). */
outb
(
0x00
,
ID_PORT
);
for
(
i
=
0
;
i
<
255
;
i
++
)
{
outb
(
lrs_state
,
ID_PORT
);
lrs_state
<<=
1
;
if
(
lrs_state
&
0x100
)
lrs_state
^=
0xe7
;
}
outb
(
0x00
,
ID_PORT
);
init_ID_done
=
1
;
}
if
(
inb
(
ioaddr
)
==
'*'
&&
inb
(
ioaddr
+
1
)
==
'3'
&&
inb
(
ioaddr
+
2
)
==
'C'
&&
inb
(
ioaddr
+
3
)
==
'O'
)
;
else
return
ENODEV
;
/* Allocate a new 'dev' if needed. */
if
(
dev
==
NULL
)
dev
=
init_etherdev
(
0
,
sizeof
(
struct
net_local
),
0
);
if
(
net_debug
&&
version_printed
++
==
0
)
printk
(
version
);
printk
(
"%s: 3c507 at %#x,"
,
dev
->
name
,
ioaddr
);
printk
(
"%s: 3c507 at %#x,"
,
dev
->
name
,
ioaddr
);
/* We should make a few more checks here, like the first three octets of
/* We should make a few more checks here, like the first three octets of
...
@@ -351,7 +370,7 @@ int el16_probe1(struct device *dev, short ioaddr)
...
@@ -351,7 +370,7 @@ int el16_probe1(struct device *dev, short ioaddr)
}
}
/* We've committed to using the board, and can start filling in *dev. */
/* We've committed to using the board, and can start filling in *dev. */
snarf_region
(
ioaddr
,
16
);
snarf_region
(
ioaddr
,
EL16_IO_EXTENT
);
dev
->
base_addr
=
ioaddr
;
dev
->
base_addr
=
ioaddr
;
outb
(
0x01
,
ioaddr
+
MISC_CTRL
);
outb
(
0x01
,
ioaddr
+
MISC_CTRL
);
...
@@ -394,7 +413,8 @@ int el16_probe1(struct device *dev, short ioaddr)
...
@@ -394,7 +413,8 @@ int el16_probe1(struct device *dev, short ioaddr)
printk
(
version
);
printk
(
version
);
/* Initialize the device structure. */
/* Initialize the device structure. */
dev
->
priv
=
kmalloc
(
sizeof
(
struct
net_local
),
GFP_KERNEL
);
if
(
dev
->
priv
==
NULL
)
dev
->
priv
=
kmalloc
(
sizeof
(
struct
net_local
),
GFP_KERNEL
);
memset
(
dev
->
priv
,
0
,
sizeof
(
struct
net_local
));
memset
(
dev
->
priv
,
0
,
sizeof
(
struct
net_local
));
dev
->
open
=
el16_open
;
dev
->
open
=
el16_open
;
...
...
drivers/net/3c509.c
View file @
6e38a55b
This diff is collapsed.
Click to expand it.
drivers/net/8390.c
View file @
6e38a55b
/* 8390.c: A general NS8390 ethernet driver core for linux. */
/* 8390.c: A general NS8390 ethernet driver core for linux. */
/*
/*
Written 1992,1993
by Donald Becker.
Written 1992-94
by Donald Becker.
Copyright 1993 United States Government as represented by the
Copyright 1993 United States Government as represented by the
Director, National Security Agency. This software may be used and
Director, National Security Agency.
distributed according to the terms of the GNU Public License,
incorporated herein by reference.
This software may be used and distributed according to the terms
of the GNU Public License, incorporated herein by reference.
The author may be reached as becker@CESDIS.gsfc.nasa.gov, or C/O
Center of Excellence in Space Data and Information Sciences
Code 930.5, Goddard Space Flight Center, Greenbelt MD 20771
This is the chip-specific code for many 8390-based ethernet adaptors.
This is the chip-specific code for many 8390-based ethernet adaptors.
This is not a complete driver, it must be combined with board-specific
This is not a complete driver, it must be combined with board-specific
code such as ne.c, wd.c, 3c503.c, etc.
code such as ne.c, wd.c, 3c503.c, etc.
The Author may be reached as becker@super.org or
C/O Supercomputing Research Ctr., 17100 Science Dr., Bowie MD 20715
*/
*/
static
char
*
version
=
static
char
*
version
=
"8390.c:v
0.99-15e 2/16/94 Donald Becker (becker@super.org
)
\n
"
;
"8390.c:v
1.10 9/23/94 Donald Becker (becker@cesdis.gsfc.nasa.gov
)
\n
"
;
#include <linux/config.h>
#include <linux/config.h>
/*
/*
Braindamage remaining:
Braindamage remaining:
Much of this code should
be cleaned up post-1.00, but it has been
Much of this code should
have been cleaned up, but every attempt
extensively beta tested in the current form
.
has broken some clone part
.
Sources:
Sources:
The National Semiconductor LAN Databook, and the 3Com 3c503 databook.
The National Semiconductor LAN Databook, and the 3Com 3c503 databook.
The NE* programming info came from the Crynwr packet driver, and figuring
out that the those boards are similar to the NatSemi evaluation board
described in AN-729. Thanks NS, no thanks to Novell/Eagle.
*/
*/
#include <linux/config.h>
#include <linux/config.h>
...
@@ -302,7 +301,11 @@ void ei_interrupt(int reg_ptr)
...
@@ -302,7 +301,11 @@ void ei_interrupt(int reg_ptr)
}
}
if
(
interrupts
&&
ei_debug
)
{
if
(
interrupts
&&
ei_debug
)
{
printk
(
"%s: unknown interrupt %#2x
\n
"
,
dev
->
name
,
interrupts
);
if
(
boguscount
==
9
)
printk
(
"%s: Too much work at interrupt, status %#2.2x
\n
"
,
dev
->
name
,
interrupts
);
else
printk
(
"%s: unknown interrupt %#2x
\n
"
,
dev
->
name
,
interrupts
);
outb_p
(
E8390_NODMA
+
E8390_PAGE0
+
E8390_START
,
e8390_base
+
E8390_CMD
);
outb_p
(
E8390_NODMA
+
E8390_PAGE0
+
E8390_START
,
e8390_base
+
E8390_CMD
);
outb_p
(
0xff
,
e8390_base
+
EN0_ISR
);
/* Ack. all intrs. */
outb_p
(
0xff
,
e8390_base
+
EN0_ISR
);
/* Ack. all intrs. */
}
}
...
...
drivers/net/8390.h
View file @
6e38a55b
...
@@ -41,12 +41,12 @@ struct ei_device {
...
@@ -41,12 +41,12 @@ struct ei_device {
void
(
*
reset_8390
)(
struct
device
*
);
void
(
*
reset_8390
)(
struct
device
*
);
void
(
*
block_output
)(
struct
device
*
,
int
,
const
unsigned
char
*
,
int
);
void
(
*
block_output
)(
struct
device
*
,
int
,
const
unsigned
char
*
,
int
);
int
(
*
block_input
)(
struct
device
*
,
int
,
char
*
,
int
);
int
(
*
block_input
)(
struct
device
*
,
int
,
char
*
,
int
);
int
open
:
1
;
unsigned
open
:
1
;
int
word16
:
1
;
/* We have the 16-bit (vs 8-bit) version of the card. */
unsigned
word16
:
1
;
/* We have the 16-bit (vs 8-bit) version of the card. */
int
txing
:
1
;
/* Transmit Active */
unsigned
txing
:
1
;
/* Transmit Active */
int
dmaing
:
2
;
/* Remote DMA Active */
unsigned
dmaing
:
2
;
/* Remote DMA Active */
int
irqlock
:
1
;
/* 8390's intrs disabled when '1'. */
unsigned
irqlock
:
1
;
/* 8390's intrs disabled when '1'. */
int
pingpong
:
1
;
/* Using the ping-pong driver */
unsigned
pingpong
:
1
;
/* Using the ping-pong driver */
unsigned
char
tx_start_page
,
rx_start_page
,
stop_page
;
unsigned
char
tx_start_page
,
rx_start_page
,
stop_page
;
unsigned
char
current_page
;
/* Read pointer in buffer */
unsigned
char
current_page
;
/* Read pointer in buffer */
unsigned
char
interface_num
;
/* Net port (AUI, 10bT.) to use. */
unsigned
char
interface_num
;
/* Net port (AUI, 10bT.) to use. */
...
...
drivers/net/at1700.c
View file @
6e38a55b
/* at1700.c: A network device driver for the Allied Telesis AT1700.
/* at1700.c: A network device driver for the Allied Telesis AT1700.
Written 1993 by Donald Becker. This is a alpha test limited release.
Written 1993-94 by Donald Becker.
This version may only be used and distributed according to the terms of the
GNU Public License, incorporated herein by reference.
The author may be reached as becker@super.org or
Copyright 1993 United States Government as represented by the
C/O Supercomputing Research Ctr., 17100 Science Dr., Bowie MD 20715
Director, National Security Agency.
This is a device driver for the Allied Telesis AT1700, which is a
This software may be used and distributed according to the terms
straightforward Fujitsu MB86965 implementation.
of the GNU Public License, incorporated herein by reference.
*/
static
char
*
version
=
The author may be reached as becker@CESDIS.gsfc.nasa.gov, or C/O
"at1700.c:v0.06 3/3/94 Donald Becker (becker@super.org)
\n
"
;
Center of Excellence in Space Data and Information Sciences
Code 930.5, Goddard Space Flight Center, Greenbelt MD 20771
#include <linux/config.h>
This is a device driver for the Allied Telesis AT1700, which is a
straight-forward Fujitsu MB86965 implementation.
/*
Sources:
Sources:
The Fujitsu MB86695 datasheet.
The Fujitsu MB86695 datasheet.
After this driver was written, ATI provided their EEPROM configuration
After the initial version of this driver was written Gerry Sockins of
code header file. Thanks to Gerry Sockins of ATI.
ATI provided their EEPROM configurationcode header file.
Thanks to NIIBE Yutaka <gniibe@mri.co.jp> for bug fixes.
Bugs:
The MB86695 has a design flaw that makes all probes unreliable. Not
only is it difficult to detect, it also moves around in I/O space in
response to inb()s from other device probes!
*/
*/
static
char
*
version
=
"at1700.c:v1.10 9/24/94 Donald Becker (becker@cesdis.gsfc.nasa.gov)
\n
"
;
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/sched.h>
#include <linux/types.h>
#include <linux/types.h>
...
@@ -43,19 +52,16 @@ static char *version =
...
@@ -43,19 +52,16 @@ static char *version =
#include <linux/netdevice.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include <linux/skbuff.h>
extern
struct
device
*
init_etherdev
(
struct
device
*
dev
,
int
sizeof_private
,
unsigned
long
*
mem_startp
);
#ifndef HAVE_AUTOIRQ
/* This unusual address order is used to verify the CONFIG register. */
/* From auto_irq.c, in ioport.h for later versions. */
static
int
at1700_probe_list
[]
=
extern
void
autoirq_setup
(
int
waittime
);
{
0x260
,
0x280
,
0x2a0
,
0x240
,
0x340
,
0x320
,
0x380
,
0x300
,
0
};
extern
int
autoirq_report
(
int
waittime
);
/* The map from IRQ number (as passed to the interrupt handler) to
'struct device'. */
extern
struct
device
*
irq2dev_map
[
16
];
#endif
/* use 0 for production, 1 for verification, >2 for debug */
/* use 0 for production, 1 for verification, >2 for debug */
#ifndef NET_DEBUG
#ifndef NET_DEBUG
#define NET_DEBUG
2
#define NET_DEBUG
1
#endif
#endif
static
unsigned
int
net_debug
=
NET_DEBUG
;
static
unsigned
int
net_debug
=
NET_DEBUG
;
...
@@ -87,6 +93,9 @@ struct net_local {
...
@@ -87,6 +93,9 @@ struct net_local {
#define MODE13 13
#define MODE13 13
#define EEPROM_Ctrl 16
#define EEPROM_Ctrl 16
#define EEPROM_Data 17
#define EEPROM_Data 17
#define IOCONFIG 19
#define RESET 31
/* Write to reset some parts of the chip. */
#define AT1700_IO_EXTENT 32
/* EEPROM_Ctrl bits. */
/* EEPROM_Ctrl bits. */
#define EE_SHIFT_CLK 0x40
/* EEPROM shift clock, in reg. 16. */
#define EE_SHIFT_CLK 0x40
/* EEPROM shift clock, in reg. 16. */
...
@@ -124,20 +133,26 @@ static void set_multicast_list(struct device *dev, int num_addrs, void *addrs);
...
@@ -124,20 +133,26 @@ static void set_multicast_list(struct device *dev, int num_addrs, void *addrs);
If dev->base_addr == 2, allocate space for the device and return success
If dev->base_addr == 2, allocate space for the device and return success
(detachable devices only).
(detachable devices only).
*/
*/
#ifdef HAVE_DEVLIST
/* Support for a alternate probe manager, which will eliminate the
boilerplate below. */
struct
netdev_entry
at1700_drv
=
{
"at1700"
,
at1700_probe1
,
AT1700_IO_EXTENT
,
at1700_probe_list
};
#else
int
int
at1700_probe
(
struct
device
*
dev
)
at1700_probe
(
struct
device
*
dev
)
{
{
short
ports
[]
=
{
0x300
,
0x280
,
0x380
,
0x320
,
0x340
,
0x260
,
0x2a0
,
0x240
,
0
}
;
int
i
;
short
*
port
,
base_addr
=
dev
->
base_addr
;
int
base_addr
=
dev
?
dev
->
base_addr
:
0
;
if
(
base_addr
>
0x1ff
)
/* Check a single specified location. */
if
(
base_addr
>
0x1ff
)
/* Check a single specified location. */
return
at1700_probe1
(
dev
,
base_addr
);
return
at1700_probe1
(
dev
,
base_addr
);
else
if
(
base_addr
>
0
)
/* Don't probe at all. */
else
if
(
base_addr
!=
0
)
/* Don't probe at all. */
return
ENXIO
;
return
ENXIO
;
for
(
port
=
&
ports
[
0
];
*
port
;
port
++
)
{
for
(
i
=
0
;
at1700_probe_list
[
i
];
i
++
)
{
int
ioaddr
=
*
port
;
int
ioaddr
=
at1700_probe_list
[
i
]
;
if
(
check_region
(
ioaddr
,
32
))
if
(
check_region
(
ioaddr
,
AT1700_IO_EXTENT
))
continue
;
continue
;
if
(
at1700_probe1
(
dev
,
ioaddr
)
==
0
)
if
(
at1700_probe1
(
dev
,
ioaddr
)
==
0
)
return
0
;
return
0
;
...
@@ -145,6 +160,7 @@ at1700_probe(struct device *dev)
...
@@ -145,6 +160,7 @@ at1700_probe(struct device *dev)
return
ENODEV
;
return
ENODEV
;
}
}
#endif
/* The Fujitsu datasheet suggests that the NIC be probed for by checking its
/* The Fujitsu datasheet suggests that the NIC be probed for by checking its
"signature", the default bit pattern after a reset. This *doesn't* work --
"signature", the default bit pattern after a reset. This *doesn't* work --
...
@@ -156,29 +172,24 @@ at1700_probe(struct device *dev)
...
@@ -156,29 +172,24 @@ at1700_probe(struct device *dev)
int
at1700_probe1
(
struct
device
*
dev
,
short
ioaddr
)
int
at1700_probe1
(
struct
device
*
dev
,
short
ioaddr
)
{
{
unsigned
short
signature
[
4
]
=
{
0xffff
,
0xffff
,
0x7ff7
,
0xff5f
};
unsigned
short
signature_invalid
[
4
]
=
{
0xffff
,
0xffff
,
0x7ff7
,
0xdf0f
};
char
irqmap
[
8
]
=
{
3
,
4
,
5
,
9
,
10
,
11
,
14
,
15
};
char
irqmap
[
8
]
=
{
3
,
4
,
5
,
9
,
10
,
11
,
14
,
15
};
unsigned
short
*
station_address
=
(
unsigned
short
*
)
dev
->
dev_addr
;
unsigned
int
i
,
irq
;
unsigned
int
i
,
irq
;
/* Resetting the chip doesn't reset the ISA interface, so don't bother.
/* Resetting the chip doesn't reset the ISA interface, so don't bother.
That means we have to be careful with the register values we probe for.
That means we have to be careful with the register values we probe for.
*/
*/
for
(
i
=
0
;
i
<
4
;
i
++
)
#ifdef notdef
if
((
inw
(
ioaddr
+
2
*
i
)
|
signature_invalid
[
i
])
!=
signature
[
i
])
{
printk
(
"at1700 probe at %#x, eeprom is %4.4x %4.4x %4.4x ctrl %4.4x.
\n
"
,
if
(
net_debug
>
2
)
ioaddr
,
read_eeprom
(
ioaddr
,
4
),
read_eeprom
(
ioaddr
,
5
),
printk
(
"AT1700 signature match failed at %d (%04x vs. %04x)
\n
"
,
read_eeprom
(
ioaddr
,
6
),
inw
(
ioaddr
+
EEPROM_Ctrl
));
i
,
inw
(
ioaddr
+
2
*
i
),
signature
[
i
]);
#endif
return
-
ENODEV
;
if
(
at1700_probe_list
[
inb
(
ioaddr
+
IOCONFIG
)
&
0x07
]
!=
ioaddr
}
||
read_eeprom
(
ioaddr
,
4
)
!=
0x0000
if
(
read_eeprom
(
ioaddr
,
4
)
!=
0x0000
||
read_eeprom
(
ioaddr
,
5
)
&
0xff00
!=
0xF400
)
||
read_eeprom
(
ioaddr
,
5
)
&
0x00ff
!=
0x00F4
)
return
-
ENODEV
;
return
-
ENODEV
;
/* Grab the region so that we can find another board if the IRQ request
/* Reset the internal state machines. */
fails. */
outb
(
0
,
ioaddr
+
RESET
);
snarf_region
(
ioaddr
,
32
);
irq
=
irqmap
[(
read_eeprom
(
ioaddr
,
12
)
&
0x04
)
irq
=
irqmap
[(
read_eeprom
(
ioaddr
,
12
)
&
0x04
)
|
(
read_eeprom
(
ioaddr
,
0
)
>>
14
)];
|
(
read_eeprom
(
ioaddr
,
0
)
>>
14
)];
...
@@ -190,6 +201,14 @@ int at1700_probe1(struct device *dev, short ioaddr)
...
@@ -190,6 +201,14 @@ int at1700_probe1(struct device *dev, short ioaddr)
return
EAGAIN
;
return
EAGAIN
;
}
}
/* Allocate a new 'dev' if needed. */
if
(
dev
==
NULL
)
dev
=
init_etherdev
(
0
,
sizeof
(
struct
net_local
),
0
);
/* Grab the region so that we can find another board if the IRQ request
fails. */
snarf_region
(
ioaddr
,
AT1700_IO_EXTENT
);
printk
(
"%s: AT1700 found at %#3x, IRQ %d, address "
,
dev
->
name
,
printk
(
"%s: AT1700 found at %#3x, IRQ %d, address "
,
dev
->
name
,
ioaddr
,
irq
);
ioaddr
,
irq
);
...
@@ -200,7 +219,7 @@ int at1700_probe1(struct device *dev, short ioaddr)
...
@@ -200,7 +219,7 @@ int at1700_probe1(struct device *dev, short ioaddr)
for
(
i
=
0
;
i
<
3
;
i
++
)
{
for
(
i
=
0
;
i
<
3
;
i
++
)
{
unsigned
short
eeprom_val
=
read_eeprom
(
ioaddr
,
4
+
i
);
unsigned
short
eeprom_val
=
read_eeprom
(
ioaddr
,
4
+
i
);
printk
(
"%04x"
,
eeprom_val
);
printk
(
"%04x"
,
eeprom_val
);
station_address
[
i
]
=
ntohs
(
eeprom_val
);
((
unsigned
short
*
)
dev
->
dev_addr
)
[
i
]
=
ntohs
(
eeprom_val
);
}
}
/* The EEPROM word 12 bit 0x0400 means use regular 100 ohm 10baseT signals,
/* The EEPROM word 12 bit 0x0400 means use regular 100 ohm 10baseT signals,
...
@@ -214,8 +233,7 @@ int at1700_probe1(struct device *dev, short ioaddr)
...
@@ -214,8 +233,7 @@ int at1700_probe1(struct device *dev, short ioaddr)
ushort
setup_value
=
read_eeprom
(
ioaddr
,
12
);
ushort
setup_value
=
read_eeprom
(
ioaddr
,
12
);
dev
->
if_port
=
setup_value
>>
8
;
dev
->
if_port
=
setup_value
>>
8
;
printk
(
" %s interface (%04x).
\n
"
,
porttype
[(
dev
->
if_port
>>
3
)
&
3
],
printk
(
" %s interface.
\n
"
,
porttype
[(
dev
->
if_port
>>
3
)
&
3
]);
setup_value
);
}
}
/* Set the station address in bank zero. */
/* Set the station address in bank zero. */
...
@@ -243,7 +261,8 @@ int at1700_probe1(struct device *dev, short ioaddr)
...
@@ -243,7 +261,8 @@ int at1700_probe1(struct device *dev, short ioaddr)
printk
(
version
);
printk
(
version
);
/* Initialize the device structure. */
/* Initialize the device structure. */
dev
->
priv
=
kmalloc
(
sizeof
(
struct
net_local
),
GFP_KERNEL
);
if
(
dev
->
priv
==
NULL
)
dev
->
priv
=
kmalloc
(
sizeof
(
struct
net_local
),
GFP_KERNEL
);
memset
(
dev
->
priv
,
0
,
sizeof
(
struct
net_local
));
memset
(
dev
->
priv
,
0
,
sizeof
(
struct
net_local
));
dev
->
open
=
net_open
;
dev
->
open
=
net_open
;
...
@@ -252,7 +271,7 @@ int at1700_probe1(struct device *dev, short ioaddr)
...
@@ -252,7 +271,7 @@ int at1700_probe1(struct device *dev, short ioaddr)
dev
->
get_stats
=
net_get_stats
;
dev
->
get_stats
=
net_get_stats
;
dev
->
set_multicast_list
=
&
set_multicast_list
;
dev
->
set_multicast_list
=
&
set_multicast_list
;
/* Fill in the fields of
the device structure
with ethernet-generic values. */
/* Fill in the fields of
'dev'
with ethernet-generic values. */
ether_setup
(
dev
);
ether_setup
(
dev
);
return
0
;
return
0
;
...
@@ -400,7 +419,9 @@ net_send_packet(struct sk_buff *skb, struct device *dev)
...
@@ -400,7 +419,9 @@ net_send_packet(struct sk_buff *skb, struct device *dev)
lp
->
tx_queue_len
=
0
;
lp
->
tx_queue_len
=
0
;
dev
->
trans_start
=
jiffies
;
dev
->
trans_start
=
jiffies
;
lp
->
tx_started
=
1
;
lp
->
tx_started
=
1
;
}
else
if
(
lp
->
tx_queue_len
<
4096
-
1502
)
/* Room for one more packet? */
dev
->
tbusy
=
0
;
}
else
if
(
lp
->
tx_queue_len
<
4096
-
1502
)
/* Yes, there is room for one more packet. */
dev
->
tbusy
=
0
;
dev
->
tbusy
=
0
;
/* Turn on Tx interrupts back on. */
/* Turn on Tx interrupts back on. */
...
@@ -453,10 +474,12 @@ net_interrupt(int reg_ptr)
...
@@ -453,10 +474,12 @@ net_interrupt(int reg_ptr)
/* Turn on Tx interrupts off. */
/* Turn on Tx interrupts off. */
outb
(
0x00
,
ioaddr
+
TX_INTR
);
outb
(
0x00
,
ioaddr
+
TX_INTR
);
dev
->
tbusy
=
0
;
dev
->
tbusy
=
0
;
mark_bh
(
NET_BH
);
/* Inform upper layers. */
}
}
}
}
}
}
dev
->
interrupt
=
0
;
return
;
return
;
}
}
...
@@ -499,7 +522,7 @@ net_rx(struct device *dev)
...
@@ -499,7 +522,7 @@ net_rx(struct device *dev)
lp
->
stats
.
rx_errors
++
;
lp
->
stats
.
rx_errors
++
;
break
;
break
;
}
}
skb
=
alloc_skb
(
pkt_len
,
GFP_ATOMIC
);
skb
=
alloc_skb
(
pkt_len
+
1
,
GFP_ATOMIC
);
if
(
skb
==
NULL
)
{
if
(
skb
==
NULL
)
{
printk
(
"%s: Memory squeeze, dropping packet (len %d).
\n
"
,
printk
(
"%s: Memory squeeze, dropping packet (len %d).
\n
"
,
dev
->
name
,
pkt_len
);
dev
->
name
,
pkt_len
);
...
@@ -535,6 +558,7 @@ net_rx(struct device *dev)
...
@@ -535,6 +558,7 @@ net_rx(struct device *dev)
for
(
i
=
0
;
i
<
20
;
i
++
)
{
for
(
i
=
0
;
i
<
20
;
i
++
)
{
if
((
inb
(
ioaddr
+
RX_MODE
)
&
0x40
)
==
0x40
)
if
((
inb
(
ioaddr
+
RX_MODE
)
&
0x40
)
==
0x40
)
break
;
break
;
inw
(
ioaddr
+
DATAPORT
);
/* dummy status read */
outb
(
0x05
,
ioaddr
+
14
);
outb
(
0x05
,
ioaddr
+
14
);
}
}
...
@@ -592,9 +616,9 @@ set_multicast_list(struct device *dev, int num_addrs, void *addrs)
...
@@ -592,9 +616,9 @@ set_multicast_list(struct device *dev, int num_addrs, void *addrs)
{
{
short
ioaddr
=
dev
->
base_addr
;
short
ioaddr
=
dev
->
base_addr
;
if
(
num_addrs
)
{
if
(
num_addrs
)
{
out
w
(
3
,
ioaddr
+
RX_MODE
);
/* Enable promiscuous mode */
out
b
(
3
,
ioaddr
+
RX_MODE
);
/* Enable promiscuous mode */
}
else
}
else
out
w
(
2
,
ioaddr
+
RX_MODE
);
/* Disable promiscuous, use normal mode */
out
b
(
2
,
ioaddr
+
RX_MODE
);
/* Disable promiscuous, use normal mode */
}
}
/*
/*
...
@@ -603,5 +627,6 @@ set_multicast_list(struct device *dev, int num_addrs, void *addrs)
...
@@ -603,5 +627,6 @@ set_multicast_list(struct device *dev, int num_addrs, void *addrs)
* version-control: t
* version-control: t
* kept-new-versions: 5
* kept-new-versions: 5
* tab-width: 4
* tab-width: 4
* c-indent-level: 4
* End:
* End:
*/
*/
drivers/net/auto_irq.c
View file @
6e38a55b
/* auto_irq.c: Auto-configure IRQ lines for linux. */
/* auto_irq.c: Auto-configure IRQ lines for linux. */
/*
/*
Written 199
3
by Donald Becker.
Written 199
4
by Donald Becker.
The Author may be reached as becker@super.org or
The author may be reached as becker@CESDIS.gsfc.nasa.gov, or C/O
C/O Supercomputing Research Ctr., 17100 Science Dr., Bowie MD 20715
Center of Excellence in Space Data and Information Sciences
Code 930.5, Goddard Space Flight Center, Greenbelt MD 20771
This code is a general-purpose IRQ line detector for devices with
This code is a general-purpose IRQ line detector for devices with
jumpered IRQ lines. If you can make the device raise an IRQ (and
jumpered IRQ lines. If you can make the device raise an IRQ (and
...
@@ -12,7 +13,7 @@
...
@@ -12,7 +13,7 @@
device probes!
device probes!
To use this, first call autoirq_setup(timeout). TIMEOUT is how many
To use this, first call autoirq_setup(timeout). TIMEOUT is how many
'jiffies' (1/1
8
sec.) to detect other devices that have active IRQ lines,
'jiffies' (1/1
00
sec.) to detect other devices that have active IRQ lines,
and can usually be zero at boot. 'autoirq_setup()' returns the bit
and can usually be zero at boot. 'autoirq_setup()' returns the bit
vector of nominally-available IRQ lines (lines may be physically in-use,
vector of nominally-available IRQ lines (lines may be physically in-use,
but not yet registered to a device).
but not yet registered to a device).
...
@@ -27,23 +28,26 @@
...
@@ -27,23 +28,26 @@
#ifdef version
#ifdef version
static
char
*
version
=
"auto_irq.c:v0.02 1993 Donald Becker (becker@super.org)"
;
static
char
*
version
=
"auto_irq.c:v1.11 Donald Becker (becker@cesdis.gsfc.nasa.gov)"
;
#endif
#endif
/*#include <linux/config.h>*/
/*#include <linux/config.h>*/
/*#include <linux/kernel.h>*/
/*#include <linux/kernel.h>*/
#include <linux/sched.h>
#include <linux/sched.h>
#include <linux/delay.h>
#include <asm/bitops.h>
#include <asm/bitops.h>
#include <asm/io.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <linux/netdevice.h>
#include <linux/netdevice.h>
/*#include <asm/system.h>*/
/*#include <asm/system.h>*/
struct
device
*
irq2dev_map
[
16
]
=
{
0
,
0
,
/* ... zeroed */
};
struct
device
*
irq2dev_map
[
16
]
=
{
0
,
0
,
/* ... zeroed */
};
int
irqs_busy
=
0x
01
;
/* The set of fixed IRQs always enabled
*/
int
irqs_busy
=
0x
2147
;
/* The set of fixed IRQs (keyboard, timer, etc)
*/
int
irqs_used
=
0x01
;
/* The set of fixed IRQs sometimes enabled. */
int
irqs_used
=
0x0
00
1
;
/* The set of fixed IRQs sometimes enabled. */
int
irqs_reserved
=
0x00
;
/* An advisory "reserved" table. */
int
irqs_reserved
=
0x00
00
;
/* An advisory "reserved" table. */
int
irqs_shared
=
0x00
;
/* IRQ lines "shared" among conforming cards.*/
int
irqs_shared
=
0x00
00
;
/* IRQ lines "shared" among conforming cards.*/
static
volatile
int
irq_number
;
/* The latest irq number we actually found. */
static
volatile
int
irq_number
;
/* The latest irq number we actually found. */
static
volatile
int
irq_bitmap
;
/* The irqs we actually found. */
static
volatile
int
irq_bitmap
;
/* The irqs we actually found. */
...
@@ -53,56 +57,61 @@ static void autoirq_probe(int irq)
...
@@ -53,56 +57,61 @@ static void autoirq_probe(int irq)
{
{
irq_number
=
irq
;
irq_number
=
irq
;
set_bit
(
irq
,
(
void
*
)
&
irq_bitmap
);
/* irq_bitmap |= 1 << irq; */
set_bit
(
irq
,
(
void
*
)
&
irq_bitmap
);
/* irq_bitmap |= 1 << irq; */
disable_irq
(
irq
);
return
;
return
;
}
}
int
autoirq_setup
(
int
waittime
)
int
autoirq_setup
(
int
waittime
)
{
{
int
i
,
mask
;
int
i
,
mask
;
int
timeout
=
jiffies
+
waittime
;
int
timeout
=
jiffies
+
waittime
;
int
boguscount
=
(
waittime
*
loops_per_sec
)
/
100
;
irq_handled
=
0
;
for
(
i
=
0
;
i
<
16
;
i
++
)
{
irq_handled
=
0
;
if
(
!
request_irq
(
i
,
autoirq_probe
,
SA_INTERRUPT
,
"irq probe"
))
for
(
i
=
0
;
i
<
16
;
i
++
)
{
set_bit
(
i
,
(
void
*
)
&
irq_handled
);
/* irq_handled |= 1 << i;*/
if
(
test_bit
(
i
,
&
irqs_busy
)
==
0
}
&&
request_irq
(
i
,
autoirq_probe
,
SA_INTERRUPT
,
"irq probe"
)
==
0
)
/* Update our USED lists. */
set_bit
(
i
,
(
void
*
)
&
irq_handled
);
/* irq_handled |= 1 << i;*/
irqs_used
|=
~
irq_handled
;
}
irq_number
=
0
;
/* Update our USED lists. */
irq_bitmap
=
0
;
irqs_used
|=
~
irq_handled
;
irq_number
=
0
;
/* Hang out at least <waittime> jiffies waiting for bogus IRQ hits. */
irq_bitmap
=
0
;
while
(
timeout
>
jiffies
)
;
/* Hang out at least <waittime> jiffies waiting for bogus IRQ hits. */
while
(
timeout
>
jiffies
&&
--
boguscount
>
0
)
for
(
i
=
0
,
mask
=
0x01
;
i
<
16
;
i
++
,
mask
<<=
1
)
{
;
if
(
irq_bitmap
&
irq_handled
&
mask
)
{
irq_handled
&=
~
mask
;
for
(
i
=
0
,
mask
=
0x01
;
i
<
16
;
i
++
,
mask
<<=
1
)
{
if
(
irq_bitmap
&
irq_handled
&
mask
)
{
irq_handled
&=
~
mask
;
#ifdef notdef
#ifdef notdef
printk
(
" Spurious interrupt on IRQ %d
\n
"
,
i
);
printk
(
" Spurious interrupt on IRQ %d
\n
"
,
i
);
#endif
#endif
free_irq
(
i
);
free_irq
(
i
);
}
}
}
}
return
irq_handled
;
return
irq_handled
;
}
}
int
autoirq_report
(
int
waittime
)
int
autoirq_report
(
int
waittime
)
{
{
int
i
;
int
i
;
int
timeout
=
jiffies
+
waittime
;
int
timeout
=
jiffies
+
waittime
;
int
boguscount
=
(
waittime
*
loops_per_sec
)
/
100
;
/* Hang out at least <waittime> jiffies waiting for the IRQ. */
while
(
timeout
>
jiffies
)
/* Hang out at least <waittime> jiffies waiting for the IRQ. */
if
(
irq_number
)
break
;
while
(
timeout
>
jiffies
&&
--
boguscount
>
0
)
if
(
irq_number
)
/* Retract the irq handlers that we installed. */
break
;
for
(
i
=
0
;
i
<
16
;
i
++
)
{
if
(
test_bit
(
i
,
(
void
*
)
&
irq_handled
))
/* Retract the irq handlers that we installed. */
free_irq
(
i
);
for
(
i
=
0
;
i
<
16
;
i
++
)
{
}
if
(
test_bit
(
i
,
(
void
*
)
&
irq_handled
))
return
irq_number
;
free_irq
(
i
);
}
return
irq_number
;
}
}
/*
/*
...
@@ -110,5 +119,7 @@ int autoirq_report(int waittime)
...
@@ -110,5 +119,7 @@ int autoirq_report(int waittime)
* compile-command: "gcc -DKERNEL -Wall -O6 -fomit-frame-pointer -I/usr/src/linux/net/tcp -c auto_irq.c"
* compile-command: "gcc -DKERNEL -Wall -O6 -fomit-frame-pointer -I/usr/src/linux/net/tcp -c auto_irq.c"
* version-control: t
* version-control: t
* kept-new-versions: 5
* kept-new-versions: 5
* c-indent-level: 4
* tab-width: 4
* End:
* End:
*/
*/
drivers/net/hp-plus.c
View file @
6e38a55b
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
*/
*/
static
char
*
version
=
static
char
*
version
=
"hp-plus.c:v
0.04 6/16
/94 Donald Becker (becker@cesdis.gsfc.nasa.gov)
\n
"
;
"hp-plus.c:v
1.10 9/24
/94 Donald Becker (becker@cesdis.gsfc.nasa.gov)
\n
"
;
#include <linux/config.h>
#include <linux/config.h>
#include <linux/string.h>
/* Important -- this inlines word moves. */
#include <linux/string.h>
/* Important -- this inlines word moves. */
...
@@ -38,6 +38,12 @@ static char *version =
...
@@ -38,6 +38,12 @@ static char *version =
#endif
#endif
#include "8390.h"
#include "8390.h"
extern
struct
device
*
init_etherdev
(
struct
device
*
dev
,
int
sizeof_private
,
unsigned
long
*
mem_startp
);
/* A zero-terminated list of I/O addresses to be probed. */
static
unsigned
int
hpplus_portlist
[]
=
{
0x200
,
0x240
,
0x280
,
0x2C0
,
0x300
,
0x320
,
0x340
,
0
}
/*
/*
The HP EtherTwist chip implementation is a fairly routine DP8390
The HP EtherTwist chip implementation is a fairly routine DP8390
...
@@ -64,10 +70,6 @@ static char *version =
...
@@ -64,10 +70,6 @@ static char *version =
register.
register.
*/
*/
#define HPP_PROBE_LIST {0x200, 0x240, 0x280, 0x2C0, 0x300, 0x320, 0x340, 0}
#define HP_IO_EXTENT 32
#define HP_ID 0x00
/* ID register, always 0x4850. */
#define HP_ID 0x00
/* ID register, always 0x4850. */
#define HP_PAGING 0x02
/* Registers visible @ 8-f, see PageName. */
#define HP_PAGING 0x02
/* Registers visible @ 8-f, see PageName. */
#define HPP_OPTION 0x04
/* Bitmapped options, see HP_Option. */
#define HPP_OPTION 0x04
/* Bitmapped options, see HP_Option. */
...
@@ -75,6 +77,7 @@ static char *version =
...
@@ -75,6 +77,7 @@ static char *version =
#define HPP_IN_ADDR 0x0A
/* I/O input location in Perf_Page. */
#define HPP_IN_ADDR 0x0A
/* I/O input location in Perf_Page. */
#define HP_DATAPORT 0x0c
/* I/O data transfer in Perf_Page. */
#define HP_DATAPORT 0x0c
/* I/O data transfer in Perf_Page. */
#define NIC_OFFSET 0x10
/* Offset to the 8390 registers. */
#define NIC_OFFSET 0x10
/* Offset to the 8390 registers. */
#define HP_IO_EXTENT 32
#define HP_START_PG 0x00
/* First page of TX buffer */
#define HP_START_PG 0x00
/* First page of TX buffer */
#define HP_STOP_PG 0x80
/* Last page +1 of RX ring */
#define HP_STOP_PG 0x80
/* Last page +1 of RX ring */
...
@@ -111,26 +114,34 @@ static void hpp_io_block_output(struct device *dev, int count,
...
@@ -111,26 +114,34 @@ static void hpp_io_block_output(struct device *dev, int count,
/* Probe a list of addresses for an HP LAN+ adaptor.
/* Probe a list of addresses for an HP LAN+ adaptor.
This routine is almost boilerplate. */
This routine is almost boilerplate. */
#ifdef HAVE_DEVLIST
/* Support for a alternate probe manager, which will eliminate the
boilerplate below. */
struct
netdev_entry
hpplus_drv
=
{
"hpplus"
,
hpp_probe1
,
HP_IO_EXTENT
,
hpplus_portlist
};
#else
int
hp_plus_probe
(
struct
device
*
dev
)
int
hp_plus_probe
(
struct
device
*
dev
)
{
{
int
*
port
,
ports
[]
=
HPP_PROBE_LIST
;
int
i
;
short
ioaddr
=
dev
->
base_addr
;
int
base_addr
=
dev
?
dev
->
base_addr
:
0
;
if
(
ioaddr
>
0x1ff
)
/* Check a single specified location. */
if
(
base_addr
>
0x1ff
)
/* Check a single specified location. */
return
hpp_probe1
(
dev
,
io
addr
);
return
hpp_probe1
(
dev
,
base_
addr
);
else
if
(
ioaddr
>
0
)
/* Don't probe at all. */
else
if
(
base_addr
!=
0
)
/* Don't probe at all. */
return
ENXIO
;
return
ENXIO
;
for
(
port
=
&
ports
[
0
];
*
port
;
port
++
)
{
for
(
i
=
0
;
hpplus_portlist
[
i
];
i
++
)
{
if
(
check_region
(
*
port
,
HP_IO_EXTENT
))
int
ioaddr
=
hpplus_portlist
[
i
];
if
(
check_region
(
ioaddr
,
HP_IO_EXTENT
))
continue
;
continue
;
if
(
hpp_probe1
(
dev
,
*
port
)
==
0
)
{
if
(
hpp_probe1
(
dev
,
ioaddr
)
==
0
)
return
0
;
return
0
;
}
}
}
return
ENODEV
;
return
ENODEV
;
}
}
#endif
/* Do the interesting part of the probe at a single address. */
/* Do the interesting part of the probe at a single address. */
int
hpp_probe1
(
struct
device
*
dev
,
int
ioaddr
)
int
hpp_probe1
(
struct
device
*
dev
,
int
ioaddr
)
...
@@ -138,7 +149,6 @@ int hpp_probe1(struct device *dev, int ioaddr)
...
@@ -138,7 +149,6 @@ int hpp_probe1(struct device *dev, int ioaddr)
int
i
;
int
i
;
unsigned
char
checksum
=
0
;
unsigned
char
checksum
=
0
;
char
*
name
=
"HP-PC-LAN+"
;
char
*
name
=
"HP-PC-LAN+"
;
unsigned
char
*
station_addr
=
dev
->
dev_addr
;
int
mem_start
;
int
mem_start
;
/* Check for the HP+ signature, 50 48 0x 53. */
/* Check for the HP+ signature, 50 48 0x 53. */
...
@@ -146,7 +156,9 @@ int hpp_probe1(struct device *dev, int ioaddr)
...
@@ -146,7 +156,9 @@ int hpp_probe1(struct device *dev, int ioaddr)
||
(
inw
(
ioaddr
+
HP_PAGING
)
&
0xfff0
)
!=
0x5300
)
||
(
inw
(
ioaddr
+
HP_PAGING
)
&
0xfff0
)
!=
0x5300
)
return
ENODEV
;
return
ENODEV
;
/* OK, we think that we have it. Get and checksum the physical address. */
if
(
dev
==
NULL
)
dev
=
init_etherdev
(
0
,
sizeof
(
struct
ei_device
),
0
);
printk
(
"%s: %s at %#3x,"
,
dev
->
name
,
name
,
ioaddr
);
printk
(
"%s: %s at %#3x,"
,
dev
->
name
,
name
,
ioaddr
);
/* Retrieve and checksum the station address. */
/* Retrieve and checksum the station address. */
...
@@ -154,7 +166,7 @@ int hpp_probe1(struct device *dev, int ioaddr)
...
@@ -154,7 +166,7 @@ int hpp_probe1(struct device *dev, int ioaddr)
for
(
i
=
0
;
i
<
ETHER_ADDR_LEN
;
i
++
)
{
for
(
i
=
0
;
i
<
ETHER_ADDR_LEN
;
i
++
)
{
unsigned
char
inval
=
inb
(
ioaddr
+
8
+
i
);
unsigned
char
inval
=
inb
(
ioaddr
+
8
+
i
);
station
_addr
[
i
]
=
inval
;
dev
->
dev
_addr
[
i
]
=
inval
;
checksum
+=
inval
;
checksum
+=
inval
;
printk
(
" %2.2x"
,
inval
);
printk
(
" %2.2x"
,
inval
);
}
}
...
...
drivers/net/hp.c
View file @
6e38a55b
/* hp.c: A HP LAN ethernet driver for linux. */
/* hp.c: A HP LAN ethernet driver for linux. */
/*
/*
Written 1993 by Donald Becker.
Written 1993-94 by Donald Becker.
Copyright 1993 United States Government as represented by the
Copyright 1993 United States Government as represented by the
Director, National Security Agency. This software may be used and
Director, National Security Agency.
distributed according to the terms of the GNU Public License,
incorporated herein by reference.
This software may be used and distributed according to the terms
of the GNU Public License, incorporated herein by reference.
The author may be reached as becker@CESDIS.gsfc.nasa.gov, or C/O
Center of Excellence in Space Data and Information Sciences
Code 930.5, Goddard Space Flight Center, Greenbelt MD 20771
This is a driver for the HP LAN adaptors.
This is a driver for the HP
PC-
LAN adaptors.
The Author may be reached as becker@super.org or
Sources:
C/O Supercomputing Research Ctr., 17100 Science Dr., Bowie MD 20715
The Crynwr packet driver.
*/
*/
static
char
*
version
=
static
char
*
version
=
"hp.c:v
0.99.15k 3/3/94 Donald Becker (becker@super.org
)
\n
"
;
"hp.c:v
1.10 9/23/94 Donald Becker (becker@cesdis.gsfc.nasa.gov
)
\n
"
;
#include <linux/config.h>
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/kernel.h>
...
@@ -26,10 +32,12 @@ static char *version =
...
@@ -26,10 +32,12 @@ static char *version =
#include <linux/netdevice.h>
#include <linux/netdevice.h>
#include "8390.h"
#include "8390.h"
#ifndef HAVE_PORTRESERVE
extern
struct
device
*
init_etherdev
(
struct
device
*
dev
,
int
sizeof_private
,
#define check_region(ioaddr, size) 0
unsigned
long
*
mem_startp
);
#define snarf_region(ioaddr, size); do ; while (0)
#endif
/* A zero-terminated list of I/O addresses to be probed. */
static
unsigned
int
hppclan_portlist
[]
=
{
0x300
,
0x320
,
0x340
,
0x280
,
0x2C0
,
0x200
,
0x240
,
0
};
#define HP_IO_EXTENT 32
#define HP_IO_EXTENT 32
...
@@ -46,7 +54,7 @@ static char *version =
...
@@ -46,7 +54,7 @@ static char *version =
#define HP_16BSTOP_PG 0xFF
/* Same, for 16 bit cards. */
#define HP_16BSTOP_PG 0xFF
/* Same, for 16 bit cards. */
int
hp_probe
(
struct
device
*
dev
);
int
hp_probe
(
struct
device
*
dev
);
int
hpprobe1
(
struct
device
*
dev
,
int
ioaddr
);
int
hp
_
probe1
(
struct
device
*
dev
,
int
ioaddr
);
static
void
hp_reset_8390
(
struct
device
*
dev
);
static
void
hp_reset_8390
(
struct
device
*
dev
);
static
int
hp_block_input
(
struct
device
*
dev
,
int
count
,
static
int
hp_block_input
(
struct
device
*
dev
,
int
count
,
...
@@ -63,32 +71,37 @@ static char irqmap[16] = { 0, 0, 4, 6, 8,10, 0,14, 0, 4, 2,12,0,0,0,0};
...
@@ -63,32 +71,37 @@ static char irqmap[16] = { 0, 0, 4, 6, 8,10, 0,14, 0, 4, 2,12,0,0,0,0};
/* Probe for an HP LAN adaptor.
/* Probe for an HP LAN adaptor.
Also initialize the card and fill in STATION_ADDR with the station
Also initialize the card and fill in STATION_ADDR with the station
address. */
address. */
#ifdef HAVE_DEVLIST
struct
netdev_entry
netcard_drv
=
{
"hp"
,
hp_probe1
,
HP_IO_EXTENT
,
hppclan_portlist
};
#else
int
hp_probe
(
struct
device
*
dev
)
int
hp_probe
(
struct
device
*
dev
)
{
{
int
*
port
,
ports
[]
=
{
0x300
,
0x320
,
0x340
,
0x280
,
0x2C0
,
0x200
,
0x240
,
0
}
;
int
i
;
short
ioaddr
=
dev
->
base_addr
;
int
base_addr
=
dev
?
dev
->
base_addr
:
0
;
if
(
ioaddr
>
0x1ff
)
/* Check a single specified location. */
if
(
base_addr
>
0x1ff
)
/* Check a single specified location. */
return
hp
probe1
(
dev
,
io
addr
);
return
hp
_probe1
(
dev
,
base_
addr
);
else
if
(
ioaddr
>
0
)
/* Don't probe at all. */
else
if
(
base_addr
!=
0
)
/* Don't probe at all. */
return
ENXIO
;
return
ENXIO
;
for
(
port
=
&
ports
[
0
];
*
port
;
port
++
)
{
for
(
i
=
0
;
hppclan_portlist
[
i
];
i
++
)
{
if
(
check_region
(
*
port
,
HP_IO_EXTENT
))
int
ioaddr
=
hppclan_portlist
[
i
];
if
(
check_region
(
ioaddr
,
HP_IO_EXTENT
))
continue
;
continue
;
if
(
hp
probe1
(
dev
,
*
port
)
==
0
)
{
if
(
hp
_probe1
(
dev
,
ioaddr
)
==
0
)
return
0
;
return
0
;
}
}
}
return
ENODEV
;
return
ENODEV
;
}
}
#endif
int
hpprobe1
(
struct
device
*
dev
,
int
ioaddr
)
int
hp
_
probe1
(
struct
device
*
dev
,
int
ioaddr
)
{
{
int
i
,
board_id
,
wordmode
;
int
i
,
board_id
,
wordmode
;
char
*
name
;
char
*
name
;
unsigned
char
*
station_addr
=
dev
->
dev_addr
;
/* Check for the HP physical address, 08 00 09 xx xx xx. */
/* Check for the HP physical address, 08 00 09 xx xx xx. */
/* This really isn't good enough: we may pick up HP LANCE boards
/* This really isn't good enough: we may pick up HP LANCE boards
...
@@ -100,7 +113,7 @@ int hpprobe1(struct device *dev, int ioaddr)
...
@@ -100,7 +113,7 @@ int hpprobe1(struct device *dev, int ioaddr)
return
ENODEV
;
return
ENODEV
;
/* Set up the parameters based on the board ID.
/* Set up the parameters based on the board ID.
If you have additional mappings, please mail them to
becker@super.org
. */
If you have additional mappings, please mail them to
me -djb
. */
if
((
board_id
=
inb
(
ioaddr
+
HP_ID
))
&
0x80
)
{
if
((
board_id
=
inb
(
ioaddr
+
HP_ID
))
&
0x80
)
{
name
=
"HP27247"
;
name
=
"HP27247"
;
wordmode
=
1
;
wordmode
=
1
;
...
@@ -109,13 +122,16 @@ int hpprobe1(struct device *dev, int ioaddr)
...
@@ -109,13 +122,16 @@ int hpprobe1(struct device *dev, int ioaddr)
wordmode
=
0
;
wordmode
=
0
;
}
}
if
(
dev
==
NULL
)
dev
=
init_etherdev
(
0
,
sizeof
(
struct
ei_device
),
0
);
/* Grab the region so we can find another board if something fails. */
/* Grab the region so we can find another board if something fails. */
snarf_region
(
ioaddr
,
HP_IO_EXTENT
);
snarf_region
(
ioaddr
,
HP_IO_EXTENT
);
printk
(
"%s: %s (ID %02x) at %#3x,"
,
dev
->
name
,
name
,
board_id
,
ioaddr
);
printk
(
"%s: %s (ID %02x) at %#3x,"
,
dev
->
name
,
name
,
board_id
,
ioaddr
);
for
(
i
=
0
;
i
<
ETHER_ADDR_LEN
;
i
++
)
for
(
i
=
0
;
i
<
ETHER_ADDR_LEN
;
i
++
)
printk
(
" %2.2x"
,
station
_addr
[
i
]
=
inb
(
ioaddr
+
i
));
printk
(
" %2.2x"
,
dev
->
dev
_addr
[
i
]
=
inb
(
ioaddr
+
i
));
/* Snarf the interrupt now. Someday this could be moved to open(). */
/* Snarf the interrupt now. Someday this could be moved to open(). */
if
(
dev
->
irq
<
2
)
{
if
(
dev
->
irq
<
2
)
{
...
...
drivers/net/lance.c
View file @
6e38a55b
This diff is collapsed.
Click to expand it.
drivers/net/loopback.c
View file @
6e38a55b
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
*
*
* Authors: Ross Biro, <bir7@leland.Stanford.Edu>
* Authors: Ross Biro, <bir7@leland.Stanford.Edu>
* Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
* Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
* Donald Becker, <becker@
super.org
>
* Donald Becker, <becker@
cesdis.gsfc.nasa.gov
>
*
*
* Alan Cox : Fixed oddments for NET3.014
* Alan Cox : Fixed oddments for NET3.014
*
*
...
...
drivers/net/ne.c
View file @
6e38a55b
/* ne.c: A general non-shared-memory NS8390 ethernet driver for linux. */
/* ne.c: A general non-shared-memory NS8390 ethernet driver for linux. */
/*
/*
Written 1992
,1993
by Donald Becker.
Written 1992
-94
by Donald Becker.
Copyright 1993 United States Government as represented by the
Copyright 1993 United States Government as represented by the
Director, National Security Agency. This software may be used and
Director, National Security Agency.
distributed according to the terms of the GNU Public License,
incorporated herein by reference.
This
driver should work with many 8390-based ethernet boards. Currently
This
software may be used and distributed according to the terms
it support the NE1000, NE2000, clones, and some Cabletron products
.
of the GNU Public License, incorporated herein by reference
.
The Author may be reached as becker@super.org or
The author may be reached as becker@CESDIS.gsfc.nasa.gov, or C/O
C/O Supercomputing Research Ctr., 17100 Science Dr., Bowie MD 20715
Center of Excellence in Space Data and Information Sciences
Code 930.5, Goddard Space Flight Center, Greenbelt MD 20771
This driver should work with many programmed-I/O 8390-based ethernet
boards. Currently it support the NE1000, NE2000, many clones,
and some Cabletron products.
*/
*/
/* Routines for the NatSemi-based designs (NE[12]000). */
/* Routines for the NatSemi-based designs (NE[12]000). */
static
char
*
version
=
static
char
*
version
=
"ne.c:v
0.99-15k 3/3/94 Donald Becker (becker@super.org
)
\n
"
;
"ne.c:v
1.10 9/23/94 Donald Becker (becker@cesdis.gsfc.nasa.gov
)
\n
"
;
#include <linux/config.h>
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/kernel.h>
...
@@ -28,11 +31,28 @@ static char *version =
...
@@ -28,11 +31,28 @@ static char *version =
#include <linux/netdevice.h>
#include <linux/netdevice.h>
#include "8390.h"
#include "8390.h"
extern
struct
device
*
init_etherdev
(
struct
device
*
dev
,
int
sizeof_private
,
unsigned
long
*
mem_startp
);
/* A zero-terminated list of I/O addresses to be probed. */
static
unsigned
int
netcard_portlist
[]
=
{
0x300
,
0x280
,
0x320
,
0x340
,
0x360
,
0
};
/* A list of bad clones that we none-the-less recognize. */
static
struct
{
char
*
name8
,
*
name16
;
unsigned
char
SAprefix
[
4
];}
bad_clone_list
[]
=
{
{
"DE100"
,
"DE200"
,
{
0x00
,
0xDE
,
0x01
,}},
{
"DE120"
,
"DE220"
,
{
0x00
,
0x80
,
0xc8
,}},
{
"DFI1000"
,
"DFI2000"
,
{
'D'
,
'F'
,
'I'
,}},
/* Original, eh? */
{
0
,}
};
#define NE_BASE (dev->base_addr)
#define NE_BASE (dev->base_addr)
#define NE_CMD 0x00
#define NE_CMD 0x00
#define NE_DATAPORT 0x10
/* NatSemi-defined port window offset. */
#define NE_DATAPORT 0x10
/* NatSemi-defined port window offset. */
#define NE_RESET 0x1f
/* Issue a read to reset, a write to clear. */
#define NE_RESET 0x1f
/* Issue a read to reset, a write to clear. */
#define NE_IO_EXTENT 0x20
#define NE1SM_START_PG 0x20
/* First page of TX buffer */
#define NE1SM_START_PG 0x20
/* First page of TX buffer */
#define NE1SM_STOP_PG 0x40
/* Last page +1 of RX ring */
#define NE1SM_STOP_PG 0x40
/* Last page +1 of RX ring */
...
@@ -40,7 +60,7 @@ static char *version =
...
@@ -40,7 +60,7 @@ static char *version =
#define NESM_STOP_PG 0x80
/* Last page +1 of RX ring */
#define NESM_STOP_PG 0x80
/* Last page +1 of RX ring */
int
ne_probe
(
struct
device
*
dev
);
int
ne_probe
(
struct
device
*
dev
);
static
int
ne
probe1
(
int
ioaddr
,
struct
device
*
dev
,
int
verbose
);
static
int
ne
_probe1
(
struct
device
*
dev
,
int
ioaddr
);
static
void
ne_reset_8390
(
struct
device
*
dev
);
static
void
ne_reset_8390
(
struct
device
*
dev
);
static
int
ne_block_input
(
struct
device
*
dev
,
int
count
,
static
int
ne_block_input
(
struct
device
*
dev
,
int
count
,
...
@@ -70,44 +90,47 @@ static void ne_block_output(struct device *dev, const int count,
...
@@ -70,44 +90,47 @@ static void ne_block_output(struct device *dev, const int count,
E2010 starts at 0x100 and ends at 0x4000.
E2010 starts at 0x100 and ends at 0x4000.
E2010-x starts at 0x100 and ends at 0xffff. */
E2010-x starts at 0x100 and ends at 0xffff. */
#ifdef HAVE_DEVLIST
struct
netdev_entry
netcard_drv
=
{
"ne"
,
ne_probe1
,
NE_IO_EXTENT
,
netcard_portlist
};
#else
int
ne_probe
(
struct
device
*
dev
)
int
ne_probe
(
struct
device
*
dev
)
{
{
int
*
port
,
ports
[]
=
{
0x300
,
0x280
,
0x320
,
0x340
,
0x360
,
0
}
;
int
i
;
short
ioaddr
=
dev
->
base_addr
;
int
base_addr
=
dev
?
dev
->
base_addr
:
0
;
if
(
ioaddr
<
0
)
if
(
base_addr
>
0x1ff
)
/* Check a single specified location. */
return
ENXIO
;
/* Don't probe at all. */
return
ne_probe1
(
dev
,
base_addr
);
if
(
ioaddr
>
0x100
)
else
if
(
base_addr
!=
0
)
/* Don't probe at all. */
return
!
neprobe1
(
ioaddr
,
dev
,
1
)
;
return
ENXIO
;
for
(
port
=
&
ports
[
0
];
*
port
;
port
++
)
{
for
(
i
=
0
;
netcard_portlist
[
i
];
i
++
)
{
#ifdef HAVE_PORTRESERVE
int
ioaddr
=
netcard_portlist
[
i
];
if
(
check_region
(
*
port
,
32
))
if
(
check_region
(
ioaddr
,
NE_IO_EXTENT
))
continue
;
continue
;
#endif
if
(
ne_probe1
(
dev
,
ioaddr
)
==
0
)
if
(
inb_p
(
*
port
)
!=
0xff
&&
neprobe1
(
*
port
,
dev
,
0
))
{
dev
->
base_addr
=
*
port
;
return
0
;
return
0
;
}
}
}
dev
->
base_addr
=
ioaddr
;
return
ENODEV
;
return
ENODEV
;
}
}
#endif
static
int
ne
probe1
(
int
ioaddr
,
struct
device
*
dev
,
int
verbose
)
static
int
ne
_probe1
(
struct
device
*
dev
,
int
ioaddr
)
{
{
int
i
;
int
i
;
unsigned
char
SA_prom
[
32
];
unsigned
char
SA_prom
[
32
];
int
wordlength
=
2
;
int
wordlength
=
2
;
char
*
name
;
char
*
name
=
NULL
;
int
start_page
,
stop_page
;
int
start_page
,
stop_page
;
int
neX000
,
ctron
,
dlink
,
dfi
;
int
neX000
,
ctron
;
int
reg0
=
inb
(
ioaddr
);
int
reg0
=
inb
(
ioaddr
);
if
(
reg0
==
0xFF
)
if
(
reg0
==
0xFF
)
return
0
;
return
ENODEV
;
/* Do a
quick preliminary check
that we have a 8390. */
/* Do a
preliminary verification
that we have a 8390. */
{
int
regd
;
{
int
regd
;
outb_p
(
E8390_NODMA
+
E8390_PAGE1
+
E8390_STOP
,
ioaddr
+
E8390_CMD
);
outb_p
(
E8390_NODMA
+
E8390_PAGE1
+
E8390_STOP
,
ioaddr
+
E8390_CMD
);
regd
=
inb_p
(
ioaddr
+
0x0d
);
regd
=
inb_p
(
ioaddr
+
0x0d
);
...
@@ -117,14 +140,13 @@ static int neprobe1(int ioaddr, struct device *dev, int verbose)
...
@@ -117,14 +140,13 @@ static int neprobe1(int ioaddr, struct device *dev, int verbose)
if
(
inb_p
(
ioaddr
+
EN0_COUNTER0
)
!=
0
)
{
if
(
inb_p
(
ioaddr
+
EN0_COUNTER0
)
!=
0
)
{
outb_p
(
reg0
,
ioaddr
);
outb_p
(
reg0
,
ioaddr
);
outb
(
regd
,
ioaddr
+
0x0d
);
/* Restore the old values. */
outb
(
regd
,
ioaddr
+
0x0d
);
/* Restore the old values. */
return
0
;
return
ENODEV
;
}
}
}
}
printk
(
"NE*000 ethercard probe at %#3x:"
,
ioaddr
);
printk
(
"NE*000 ethercard probe at %#3x:"
,
ioaddr
);
/* Read the 16 bytes of station address prom, returning 1 for
/* Read the 16 bytes of station address PROM.
an eight-bit interface and 2 for a 16-bit interface.
We must first initialize registers, similar to NS8390_init(eifdev, 0).
We must first initialize registers, similar to NS8390_init(eifdev, 0).
We can't reliably read the SAPROM address without this.
We can't reliably read the SAPROM address without this.
(I learned the hard way!). */
(I learned the hard way!). */
...
@@ -162,44 +184,54 @@ static int neprobe1(int ioaddr, struct device *dev, int verbose)
...
@@ -162,44 +184,54 @@ static int neprobe1(int ioaddr, struct device *dev, int verbose)
/* Un-double the SA_prom values. */
/* Un-double the SA_prom values. */
for
(
i
=
0
;
i
<
16
;
i
++
)
for
(
i
=
0
;
i
<
16
;
i
++
)
SA_prom
[
i
]
=
SA_prom
[
i
+
i
];
SA_prom
[
i
]
=
SA_prom
[
i
+
i
];
start_page
=
NESM_START_PG
;
stop_page
=
NESM_STOP_PG
;
}
else
{
start_page
=
NE1SM_START_PG
;
stop_page
=
NE1SM_STOP_PG
;
}
}
#if defined(show_all_SAPROM)
/* If your ethercard isn't detected define this to see the SA_PROM. */
for
(
i
=
0
;
i
<
sizeof
(
SA_prom
);
i
++
)
printk
(
" %2.2x"
,
SA_prom
[
i
]);
#else
for
(
i
=
0
;
i
<
ETHER_ADDR_LEN
;
i
++
)
{
for
(
i
=
0
;
i
<
ETHER_ADDR_LEN
;
i
++
)
{
dev
->
dev_addr
[
i
]
=
SA_prom
[
i
];
dev
->
dev_addr
[
i
]
=
SA_prom
[
i
];
printk
(
" %2.2x"
,
SA_prom
[
i
]);
printk
(
" %2.2x"
,
SA_prom
[
i
]);
}
}
#endif
neX000
=
(
SA_prom
[
14
]
==
0x57
&&
SA_prom
[
15
]
==
0x57
);
neX000
=
(
SA_prom
[
14
]
==
0x57
&&
SA_prom
[
15
]
==
0x57
);
ctron
=
(
SA_prom
[
0
]
==
0x00
&&
SA_prom
[
1
]
==
0x00
&&
SA_prom
[
2
]
==
0x1d
);
ctron
=
(
SA_prom
[
0
]
==
0x00
&&
SA_prom
[
1
]
==
0x00
&&
SA_prom
[
2
]
==
0x1d
);
dlink
=
(
SA_prom
[
0
]
==
0x00
&&
SA_prom
[
1
]
==
0xDE
&&
SA_prom
[
2
]
==
0x01
);
dfi
=
(
SA_prom
[
0
]
==
'D'
&&
SA_prom
[
1
]
==
'F'
&&
SA_prom
[
2
]
==
'I'
);
/* Set up the rest of the parameters. */
/* Set up the rest of the parameters. */
if
(
neX000
||
dlink
||
dfi
)
{
if
(
neX000
)
{
if
(
wordlength
==
2
)
{
name
=
(
wordlength
==
2
)
?
"NE2000"
:
"NE1000"
;
name
=
dlink
?
"DE200"
:
"NE2000"
;
start_page
=
NESM_START_PG
;
stop_page
=
NESM_STOP_PG
;
}
else
{
name
=
dlink
?
"DE100"
:
"NE1000"
;
start_page
=
NE1SM_START_PG
;
stop_page
=
NE1SM_STOP_PG
;
}
}
else
if
(
ctron
)
{
}
else
if
(
ctron
)
{
name
=
"Cabletron"
;
name
=
"Cabletron"
;
start_page
=
0x01
;
start_page
=
0x01
;
stop_page
=
(
wordlength
==
2
)
?
0x40
:
0x20
;
stop_page
=
(
wordlength
==
2
)
?
0x40
:
0x20
;
}
else
{
}
else
{
printk
(
" not found.
\n
"
);
/* Ack! Well, there might be a *bad* NE*000 clone there.
return
0
;
Check for total bogus addresses. */
for
(
i
=
0
;
bad_clone_list
[
i
].
name8
;
i
++
)
{
if
(
SA_prom
[
0
]
==
bad_clone_list
[
i
].
SAprefix
[
0
]
&&
SA_prom
[
1
]
==
bad_clone_list
[
i
].
SAprefix
[
1
]
&&
SA_prom
[
2
]
==
bad_clone_list
[
i
].
SAprefix
[
2
])
{
if
(
wordlength
==
2
)
{
name
=
bad_clone_list
[
i
].
name16
;
}
else
{
name
=
bad_clone_list
[
i
].
name8
;
}
break
;
}
}
if
(
bad_clone_list
[
i
].
name8
==
NULL
)
{
printk
(
" not found (invalid signature %2.2x %2.2x).
\n
"
,
SA_prom
[
14
],
SA_prom
[
15
]);
return
ENXIO
;
}
}
}
if
(
dev
==
NULL
)
dev
=
init_etherdev
(
0
,
sizeof
(
struct
ei_device
),
0
);
if
(
dev
->
irq
<
2
)
{
if
(
dev
->
irq
<
2
)
{
autoirq_setup
(
0
);
autoirq_setup
(
0
);
outb_p
(
0x50
,
ioaddr
+
EN0_IMR
);
/* Enable one interrupt. */
outb_p
(
0x50
,
ioaddr
+
EN0_IMR
);
/* Enable one interrupt. */
...
@@ -221,15 +253,16 @@ static int neprobe1(int ioaddr, struct device *dev, int verbose)
...
@@ -221,15 +253,16 @@ static int neprobe1(int ioaddr, struct device *dev, int verbose)
int
irqval
=
request_irq
(
dev
->
irq
,
ei_interrupt
,
0
,
"ne"
);
int
irqval
=
request_irq
(
dev
->
irq
,
ei_interrupt
,
0
,
"ne"
);
if
(
irqval
)
{
if
(
irqval
)
{
printk
(
" unable to get IRQ %d (irqval=%d).
\n
"
,
dev
->
irq
,
irqval
);
printk
(
" unable to get IRQ %d (irqval=%d).
\n
"
,
dev
->
irq
,
irqval
);
return
0
;
return
EAGAIN
;
}
}
}
}
dev
->
base_addr
=
ioaddr
;
dev
->
base_addr
=
ioaddr
;
#ifdef HAVE_PORTRESERVE
snarf_region
(
ioaddr
,
NE_IO_EXTENT
);
snarf_region
(
ioaddr
,
32
);
#endif
for
(
i
=
0
;
i
<
ETHER_ADDR_LEN
;
i
++
)
dev
->
dev_addr
[
i
]
=
SA_prom
[
i
];
ethdev_init
(
dev
);
ethdev_init
(
dev
);
printk
(
"
\n
%s: %s found at %#x, using IRQ %d.
\n
"
,
printk
(
"
\n
%s: %s found at %#x, using IRQ %d.
\n
"
,
...
@@ -253,7 +286,7 @@ static int neprobe1(int ioaddr, struct device *dev, int verbose)
...
@@ -253,7 +286,7 @@ static int neprobe1(int ioaddr, struct device *dev, int verbose)
ei_status
.
block_input
=
&
ne_block_input
;
ei_status
.
block_input
=
&
ne_block_input
;
ei_status
.
block_output
=
&
ne_block_output
;
ei_status
.
block_output
=
&
ne_block_output
;
NS8390_init
(
dev
,
0
);
NS8390_init
(
dev
,
0
);
return
dev
->
base_addr
;
return
0
;
}
}
/* Hard reset the card. This used to pause for the same period that a
/* Hard reset the card. This used to pause for the same period that a
...
@@ -289,9 +322,10 @@ ne_block_input(struct device *dev, int count, char *buf, int ring_offset)
...
@@ -289,9 +322,10 @@ ne_block_input(struct device *dev, int count, char *buf, int ring_offset)
if
(
ei_status
.
dmaing
)
{
if
(
ei_status
.
dmaing
)
{
if
(
ei_debug
>
0
)
if
(
ei_debug
>
0
)
printk
(
"%s: DMAing conflict in ne_block_input."
printk
(
"%s: DMAing conflict in ne_block_input "
"[DMAstat:%1x][irqlock:%1x]
\n
"
,
"[DMAstat:%d][irqlock:%d][intr:%d].
\n
"
,
dev
->
name
,
ei_status
.
dmaing
,
ei_status
.
irqlock
);
dev
->
name
,
ei_status
.
dmaing
,
ei_status
.
irqlock
,
dev
->
interrupt
);
return
0
;
return
0
;
}
}
ei_status
.
dmaing
|=
0x01
;
ei_status
.
dmaing
|=
0x01
;
...
@@ -348,8 +382,9 @@ ne_block_output(struct device *dev, int count,
...
@@ -348,8 +382,9 @@ ne_block_output(struct device *dev, int count,
if
(
ei_status
.
dmaing
)
{
if
(
ei_status
.
dmaing
)
{
if
(
ei_debug
>
0
)
if
(
ei_debug
>
0
)
printk
(
"%s: DMAing conflict in ne_block_output."
printk
(
"%s: DMAing conflict in ne_block_output."
"[DMAstat:%1x][irqlock:%1x]
\n
"
,
"[DMAstat:%d][irqlock:%d][intr:%d]
\n
"
,
dev
->
name
,
ei_status
.
dmaing
,
ei_status
.
irqlock
);
dev
->
name
,
ei_status
.
dmaing
,
ei_status
.
irqlock
,
dev
->
interrupt
);
return
;
return
;
}
}
ei_status
.
dmaing
|=
0x02
;
ei_status
.
dmaing
|=
0x02
;
...
...
drivers/net/net_init.c
View file @
6e38a55b
/* netdrv_init.c: Initialization for network devices. */
/* netdrv_init.c: Initialization for network devices. */
/*
/*
Written 1993 by Donald Becker.
Written 1993,1994 by Donald Becker.
Copyright 1993 United States Government as represented by the Director,
National Security Agency. This software may only be used and distributed
according to the terms of the GNU Public License as modified by SRC,
incorporated herein by reference.
The author may be reached as becker@super.org or
The author may be reached as becker@cesdis.gsfc.nasa.gov or
C/O Supercomputing Research Ctr., 17100 Science Dr., Bowie MD 20715
C/O Center of Excellence in Space Data and Information Sciences
Code 930.5, Goddard Space Flight Center, Greenbelt MD 20771
This file contains the initialization for the "pl14+" style ethernet
This file contains the initialization for the "pl14+" style ethernet
drivers. It should eventually replace most of drivers/net/Space.c.
drivers. It should eventually replace most of drivers/net/Space.c.
...
@@ -94,8 +91,11 @@ init_etherdev(struct device *dev, int sizeof_private, unsigned long *mem_startp)
...
@@ -94,8 +91,11 @@ init_etherdev(struct device *dev, int sizeof_private, unsigned long *mem_startp)
int
i
;
int
i
;
if
(
dev
==
NULL
)
{
if
(
dev
==
NULL
)
{
int
alloc_size
=
sizeof
(
struct
device
)
+
sizeof
(
"eth%d "
)
int
alloc_size
=
sizeof
(
struct
device
)
+
sizeof
(
"eth%d "
)
+
sizeof_private
;
+
sizeof_private
+
3
;
alloc_size
&=
~
3
;
/* Round to dword boundary. */
if
(
mem_startp
&&
*
mem_startp
)
{
if
(
mem_startp
&&
*
mem_startp
)
{
dev
=
(
struct
device
*
)
*
mem_startp
;
dev
=
(
struct
device
*
)
*
mem_startp
;
*
mem_startp
+=
alloc_size
;
*
mem_startp
+=
alloc_size
;
...
...
drivers/net/skeleton.c
View file @
6e38a55b
/* skeleton.c: A
sample network driver cor
e for linux. */
/* skeleton.c: A
network driver outlin
e for linux. */
/*
/*
Written 1993 by Donald Becker.
Written 1993-94 by Donald Becker.
Copyright 1993 United States Government as represented by the Director,
National Security Agency. This software may only be used and distributed
according to the terms of the GNU Public License as modified by SRC,
incorporated herein by reference.
The author may be reached as becker@super.org or
Copyright 1993 United States Government as represented by the
C/O Supercomputing Research Ctr., 17100 Science Dr., Bowie MD 20715
Director, National Security Agency.
This software may be used and distributed according to the terms
of the GNU Public License, incorporated herein by reference.
The author may be reached as becker@CESDIS.gsfc.nasa.gov, or C/O
Center of Excellence in Space Data and Information Sciences
Code 930.5, Goddard Space Flight Center, Greenbelt MD 20771
This file is an outline for writing a network device driver for the
This file is an outline for writing a network device driver for the
the Linux operating system.
the Linux operating system.
...
@@ -19,7 +22,7 @@
...
@@ -19,7 +22,7 @@
*/
*/
static
char
*
version
=
static
char
*
version
=
"skeleton.c:v
0.05 11/16/93 Donald Becker (becker@super.org
)
\n
"
;
"skeleton.c:v
1.51 9/24/94 Donald Becker (becker@cesdis.gsfc.nasa.gov
)
\n
"
;
/* Always include 'config.h' first in case the user wants to turn on
/* Always include 'config.h' first in case the user wants to turn on
or override something. */
or override something. */
...
@@ -59,20 +62,13 @@ static char *version =
...
@@ -59,20 +62,13 @@ static char *version =
#include <linux/netdevice.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include <linux/skbuff.h>
extern
struct
device
*
init_etherdev
(
struct
device
*
dev
,
int
sizeof_private
,
unsigned
long
*
mem_startp
);
#ifndef HAVE_AUTOIRQ
/* First, a few definitions that the brave might change. */
/* From auto_irq.c, in ioport.h for later versions. */
/* A zero-terminated list of I/O addresses to be probed. */
extern
void
autoirq_setup
(
int
waittime
);
static
unsigned
int
netcard_portlist
[]
=
extern
int
autoirq_report
(
int
waittime
);
{
0x200
,
0x240
,
0x280
,
0x2C0
,
0x300
,
0x320
,
0x340
,
0
};
/* The map from IRQ number (as passed to the interrupt handler) to
'struct device'. */
extern
struct
device
*
irq2dev_map
[
16
];
#endif
#ifndef HAVE_PORTRESERVE
#define check_region(ioaddr, size) 0
#define snarf_region(ioaddr, size); do ; while (0)
#endif
/* use 0 for production, 1 for verification, >2 for debug */
/* use 0 for production, 1 for verification, >2 for debug */
#ifndef NET_DEBUG
#ifndef NET_DEBUG
...
@@ -80,15 +76,15 @@ extern struct device *irq2dev_map[16];
...
@@ -80,15 +76,15 @@ extern struct device *irq2dev_map[16];
#endif
#endif
static
unsigned
int
net_debug
=
NET_DEBUG
;
static
unsigned
int
net_debug
=
NET_DEBUG
;
/* The number of low I/O ports used by the ethercard. */
#define NETCARD_IO_EXTENT 32
/* Information that need to be kept for each board. */
/* Information that need to be kept for each board. */
struct
net_local
{
struct
net_local
{
struct
enet_statistics
stats
;
struct
enet_statistics
stats
;
long
open_time
;
/* Useless example local info. */
long
open_time
;
/* Useless example local info. */
};
};
/* The number of low I/O ports used by the ethercard. */
#define ETHERCARD_TOTAL_SIZE 16
/* The station (ethernet) address prefix, used for IDing the board. */
/* The station (ethernet) address prefix, used for IDing the board. */
#define SA_ADDR0 0x00
#define SA_ADDR0 0x00
#define SA_ADDR1 0x42
#define SA_ADDR1 0x42
...
@@ -98,7 +94,7 @@ struct net_local {
...
@@ -98,7 +94,7 @@ struct net_local {
extern
int
netcard_probe
(
struct
device
*
dev
);
extern
int
netcard_probe
(
struct
device
*
dev
);
static
int
netcard_probe1
(
struct
device
*
dev
,
shor
t
ioaddr
);
static
int
netcard_probe1
(
struct
device
*
dev
,
in
t
ioaddr
);
static
int
net_open
(
struct
device
*
dev
);
static
int
net_open
(
struct
device
*
dev
);
static
int
net_send_packet
(
struct
sk_buff
*
skb
,
struct
device
*
dev
);
static
int
net_send_packet
(
struct
sk_buff
*
skb
,
struct
device
*
dev
);
static
void
net_interrupt
(
int
reg_ptr
);
static
void
net_interrupt
(
int
reg_ptr
);
...
@@ -119,54 +115,75 @@ extern void chipset_init(struct device *dev, int startp);
...
@@ -119,54 +115,75 @@ extern void chipset_init(struct device *dev, int startp);
If dev->base_addr == 2, allocate space for the device and return success
If dev->base_addr == 2, allocate space for the device and return success
(detachable devices only).
(detachable devices only).
*/
*/
#ifdef HAVE_DEVLIST
/* Support for a alternate probe manager, which will eliminate the
boilerplate below. */
struct
netdev_entry
netcard_drv
=
{
"netcard"
,
netcard_probe1
,
NETCARD_IO_EXTENT
,
netcard_portlist
};
#else
int
int
netcard_probe
(
struct
device
*
dev
)
netcard_probe
(
struct
device
*
dev
)
{
{
int
*
port
,
ports
[]
=
{
0x300
,
0x280
,
0
}
;
int
i
;
int
base_addr
=
dev
->
base_addr
;
int
base_addr
=
dev
?
dev
->
base_addr
:
0
;
if
(
base_addr
>
0x1ff
)
/* Check a single specified location. */
if
(
base_addr
>
0x1ff
)
/* Check a single specified location. */
return
netcard_probe1
(
dev
,
base_addr
);
return
netcard_probe1
(
dev
,
base_addr
);
else
if
(
base_addr
>
0
)
/* Don't probe at all. */
else
if
(
base_addr
!=
0
)
/* Don't probe at all. */
return
ENXIO
;
return
ENXIO
;
for
(
port
=
&
ports
[
0
];
*
port
;
port
++
)
{
for
(
i
=
0
;
netcard_portlist
[
i
];
i
++
)
{
int
ioaddr
=
*
port
;
int
ioaddr
=
netcard_portlist
[
i
];
if
(
check_region
(
ioaddr
,
ETHERCARD_TOTAL_SIZE
))
if
(
check_region
(
ioaddr
,
NETCARD_IO_EXTENT
))
continue
;
if
(
inb
(
ioaddr
)
!=
0x57
)
continue
;
continue
;
dev
->
base_addr
=
ioaddr
;
if
(
netcard_probe1
(
dev
,
ioaddr
)
==
0
)
if
(
netcard_probe1
(
dev
,
ioaddr
)
==
0
)
return
0
;
return
0
;
}
}
dev
->
base_addr
=
base_addr
;
return
ENODEV
;
return
ENODEV
;
}
}
#endif
/* This is the real probe routine. Linux has a history of friendly device
probes on the ISA bus. A good device probes avoids doing writes, and
verifies that the correct device exists and functions. */
int
netcard_probe1
(
struct
device
*
dev
,
shor
t
ioaddr
)
static
int
netcard_probe1
(
struct
device
*
dev
,
in
t
ioaddr
)
{
{
unsigned
char
station_addr
[
6
]
;
static
unsigned
version_printed
=
0
;
int
i
;
int
i
;
/* Read the station address PROM. */
/* For ethernet adaptors the first three octets of the station address contains
for
(
i
=
0
;
i
<
6
;
i
++
)
{
the manufacturer's unique code. That might be a good probe method.
station_addr
[
i
]
=
inb
(
ioaddr
+
i
);
Ideally you would add additional checks. */
}
if
(
inb
(
ioaddr
+
0
)
!=
SA_ADDR0
/* Check the first three octets of the S.A. for the manufacturer's code. */
||
inb
(
ioaddr
+
1
)
!=
SA_ADDR1
if
(
station_addr
[
0
]
!=
SA_ADDR0
||
inb
(
ioaddr
+
2
)
!=
SA_ADDR2
)
{
||
station_addr
[
1
]
!=
SA_ADDR1
||
station_addr
[
2
]
!=
SA_ADDR2
)
{
return
ENODEV
;
return
ENODEV
;
}
}
printk
(
"%s: %s found at %#3x, IRQ %d.
\n
"
,
dev
->
name
,
/* Allocate a new 'dev' if needed. */
"network card"
,
dev
->
base_addr
,
dev
->
irq
);
if
(
dev
==
NULL
)
dev
=
init_etherdev
(
0
,
sizeof
(
struct
net_local
),
0
);
if
(
net_debug
&&
version_printed
++
==
0
)
printk
(
version
);
printk
(
"%s: %s found at %#3x, "
,
dev
->
name
,
"network card"
,
ioaddr
);
/* Fill in the 'dev' fields. */
dev
->
base_addr
=
ioaddr
;
/* Retrive and print the ethernet address. */
for
(
i
=
0
;
i
<
6
;
i
++
)
printk
(
" %2.2x"
,
dev
->
dev_addr
[
i
]
=
inb
(
ioaddr
+
i
));
#ifdef jumpered_interrupts
#ifdef jumpered_interrupts
/* If this board has jumpered interrupts, snarf the interrupt vector
/* If this board has jumpered interrupts, snarf the interrupt vector
now. There is no point in waiting since no other device can use
now. There is no point in waiting since no other device can use
the interrupt, and this marks the irq as busy. */
the interrupt, and this marks the irq as busy.
Jumpered interrupts are typically not reported by the boards, and
we must used autoIRQ to find them. */
if
(
dev
->
irq
==
-
1
)
if
(
dev
->
irq
==
-
1
)
;
/* Do nothing: a user-level program will set it. */
;
/* Do nothing: a user-level program will set it. */
...
@@ -190,15 +207,51 @@ int netcard_probe1(struct device *dev, short ioaddr)
...
@@ -190,15 +207,51 @@ int netcard_probe1(struct device *dev, short ioaddr)
}
}
}
}
#endif
/* jumpered interrupt */
#endif
/* jumpered interrupt */
#ifdef jumpered_dma
/* If we use a jumpered DMA channel, that should be probed for and
allocated here as well. See lance.c for an example. */
if
(
dev
->
dma
==
0
)
{
if
(
request_dma
(
dev
->
dma
,
"netcard"
))
{
printk
(
"DMA %d allocation failed.
\n
"
,
dev
->
dma
);
return
EAGAIN
;
}
else
printk
(
", assigned DMA %d.
\n
"
,
dev
->
dma
);
}
else
{
short
dma_status
,
new_dma_status
;
/* Read the DMA channel status registers. */
dma_status
=
((
inb
(
DMA1_STAT_REG
)
>>
4
)
&
0x0f
)
|
(
inb
(
DMA2_STAT_REG
)
&
0xf0
);
/* Trigger a DMA request, perhaps pause a bit. */
outw
(
0x1234
,
ioaddr
+
8
);
/* Re-read the DMA status registers. */
new_dma_status
=
((
inb
(
DMA1_STAT_REG
)
>>
4
)
&
0x0f
)
|
(
inb
(
DMA2_STAT_REG
)
&
0xf0
);
/* Eliminate the old and floating requests and DMA4, the cascade. */
new_dma_status
^=
dma_status
;
new_dma_status
&=
~
0x10
;
for
(
i
=
7
;
i
>
0
;
i
--
)
if
(
test_bit
(
new_dma
,
&
new_dma_status
))
{
dev
->
dma
=
i
;
break
;
}
if
(
i
<=
0
)
{
printk
(
"DMA probe failed.
\n
"
);
return
EAGAIN
;
}
if
(
request_dma
(
dev
->
dma
,
"netcard"
))
{
printk
(
"probed DMA %d allocation failed.
\n
"
,
dev
->
dma
);
return
EAGAIN
;
}
}
#endif
/* jumpered DMA */
/* Grab the region so we can find another board if autoIRQ fails. */
/* Grab the region so we can find another board if autoIRQ fails. */
snarf_region
(
ioaddr
,
ETHERCARD_TOTAL_SIZE
);
snarf_region
(
ioaddr
,
NETCARD_IO_EXTENT
);
if
(
net_debug
)
printk
(
version
);
/* Initialize the device structure. */
/* Initialize the device structure. */
dev
->
priv
=
kmalloc
(
sizeof
(
struct
net_local
),
GFP_KERNEL
);
if
(
dev
->
priv
==
NULL
)
dev
->
priv
=
kmalloc
(
sizeof
(
struct
net_local
),
GFP_KERNEL
);
memset
(
dev
->
priv
,
0
,
sizeof
(
struct
net_local
));
memset
(
dev
->
priv
,
0
,
sizeof
(
struct
net_local
));
dev
->
open
=
net_open
;
dev
->
open
=
net_open
;
...
@@ -207,8 +260,7 @@ int netcard_probe1(struct device *dev, short ioaddr)
...
@@ -207,8 +260,7 @@ int netcard_probe1(struct device *dev, short ioaddr)
dev
->
get_stats
=
net_get_stats
;
dev
->
get_stats
=
net_get_stats
;
dev
->
set_multicast_list
=
&
set_multicast_list
;
dev
->
set_multicast_list
=
&
set_multicast_list
;
/* Fill in the fields of the device structure with ethernet-generic values. */
/* Fill in the fields of the device structure with ethernet values. */
ether_setup
(
dev
);
ether_setup
(
dev
);
return
0
;
return
0
;
...
@@ -234,15 +286,14 @@ net_open(struct device *dev)
...
@@ -234,15 +286,14 @@ net_open(struct device *dev)
return
-
EAGAIN
;
return
-
EAGAIN
;
}
}
/* Always snarf the DMA channel after the IRQ, and clean up on failure. */
/* Always snarf a DMA channel after the IRQ. */
if
(
request_dma
(
dev
->
dma
,
"skeleton ethernet"
))
{
if
(
request_dma
(
dev
->
dma
,
"skeleton ethernet"
))
{
free_irq
(
dev
->
irq
);
free_irq
(
dev
->
irq
);
return
-
EAGAIN
;
return
-
EAGAIN
;
}
}
irq2dev_map
[
dev
->
irq
]
=
dev
;
irq2dev_map
[
dev
->
irq
]
=
dev
;
/* Reset the hardware here. */
/* Reset the hardware here.
Don't forget to set the station address.
*/
/*chipset_init(dev, 1);*/
/*chipset_init(dev, 1);*/
outb
(
0x00
,
ioaddr
);
outb
(
0x00
,
ioaddr
);
lp
->
open_time
=
jiffies
;
lp
->
open_time
=
jiffies
;
...
@@ -337,6 +388,7 @@ net_interrupt(int reg_ptr)
...
@@ -337,6 +388,7 @@ net_interrupt(int reg_ptr)
}
}
}
while
(
++
boguscount
<
20
)
;
}
while
(
++
boguscount
<
20
)
;
dev
->
interrupt
=
0
;
return
;
return
;
}
}
...
...
drivers/net/smc-ultra.c
View file @
6e38a55b
This diff is collapsed.
Click to expand it.
drivers/net/wd.c
View file @
6e38a55b
/* wd.c: A WD80x3 ethernet driver for linux. */
/* wd.c: A WD80x3 ethernet driver for linux. */
/*
/*
Written 1993 by Donald Becker.
Written 1993-94 by Donald Becker.
Copyright 1993 United States Government as represented by the
Copyright 1993 United States Government as represented by the
Director, National Security Agency. This software may be used and
Director, National Security Agency.
distributed according to the terms of the GNU Public License,
incorporated herein by reference.
This software may be used and distributed according to the terms
of the GNU Public License, incorporated herein by reference.
This is a driver for WD8003 and WD8013 "compatible" ethercards.
The author may be reached as becker@CESDIS.gsfc.nasa.gov, or C/O
Center of Excellence in Space Data and Information Sciences
Code 930.5, Goddard Space Flight Center, Greenbelt MD 20771
The Author may be reached as becker@super.org or
This is a driver for WD8003 and WD8013 "compatible" ethercards.
C/O Supercomputing Research Ctr., 17100 Science Dr., Bowie MD 20715
Thanks to Russ Nelson (nelson@crnwyr.com) for loaning me a WD8013.
Thanks to Russ Nelson (nelson@crnwyr.com) for loaning me a WD8013.
*/
*/
static
char
*
version
=
static
char
*
version
=
"wd.c:v
0.99-14 11/21/93 Donald Becker (becker@super.org
)
\n
"
;
"wd.c:v
1.10 9/23/94 Donald Becker (becker@cesdis.gsfc.nasa.gov
)
\n
"
;
#include <linux/config.h>
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/kernel.h>
...
@@ -27,15 +30,15 @@ static char *version =
...
@@ -27,15 +30,15 @@ static char *version =
#include <linux/netdevice.h>
#include <linux/netdevice.h>
#include "8390.h"
#include "8390.h"
extern
struct
device
*
init_etherdev
(
struct
device
*
dev
,
int
sizeof_private
,
unsigned
long
*
mem_startp
);
/* Compatibility definitions for earlier kernel versions. */
/* A zero-terminated list of I/O addresses to be probed. */
#ifndef HAVE_PORTRESERVE
static
unsigned
int
wd_portlist
[]
=
#define check_region(ioaddr, size) 0
{
0x300
,
0x280
,
0x380
,
0x240
,
0
};
#define snarf_region(ioaddr, size) do ; while (0)
#endif
int
wd_probe
(
struct
device
*
dev
);
int
wd_probe
(
struct
device
*
dev
);
int
wd
probe1
(
int
ioaddr
,
struct
device
*
dev
);
int
wd
_probe1
(
struct
device
*
dev
,
int
ioaddr
);
static
int
wd_open
(
struct
device
*
dev
);
static
int
wd_open
(
struct
device
*
dev
);
static
void
wd_reset_8390
(
struct
device
*
dev
);
static
void
wd_reset_8390
(
struct
device
*
dev
);
...
@@ -56,56 +59,67 @@ static int wd_close_card(struct device *dev);
...
@@ -56,56 +59,67 @@ static int wd_close_card(struct device *dev);
#define WD_CMDREG5 5
/* Offset to 16-bit-only ASIC register 5. */
#define WD_CMDREG5 5
/* Offset to 16-bit-only ASIC register 5. */
#define ISA16 0x80
/* Enable 16 bit access from the ISA bus. */
#define ISA16 0x80
/* Enable 16 bit access from the ISA bus. */
#define NIC16 0x40
/* Enable 16 bit access from the 8390. */
#define NIC16 0x40
/* Enable 16 bit access from the 8390. */
#define WD_NIC_OFFSET 16
/* Offset to the 8390 NIC from the base_addr. */
#define WD_NIC_OFFSET 16
/* Offset to the 8390 from the base_addr. */
#define WD_IO_EXTENT 32
/* Probe for the WD8003 and WD8013. These cards have the station
/* Probe for the WD8003 and WD8013. These cards have the station
address PROM at I/O ports <base>+8 to <base>+13, with a checksum
address PROM at I/O ports <base>+8 to <base>+13, with a checksum
following. A Soundblaster can have the same checksum as an WDethercard,
following. A Soundblaster can have the same checksum as an WDethercard,
so we have an extra exclusionary check for it.
so we have an extra exclusionary check for it.
The wdprobe1() routine initializes the card and fills the
The wd
_
probe1() routine initializes the card and fills the
station address field. */
station address field. */
#ifdef HAVE_DEVLIST
struct
netdev_entry
wd_drv
=
{
"wd"
,
wd_probe1
,
WD_IO_EXTENT
,
wd_portlist
};
#else
int
wd_probe
(
struct
device
*
dev
)
int
wd_probe
(
struct
device
*
dev
)
{
{
int
*
port
,
ports
[]
=
{
0x300
,
0x280
,
0x380
,
0x240
,
0
}
;
int
i
;
short
ioaddr
=
dev
->
base_addr
;
int
base_addr
=
dev
?
dev
->
base_addr
:
0
;
if
(
ioaddr
<
0
)
if
(
base_addr
>
0x1ff
)
/* Check a single specified location. */
return
ENXIO
;
/* Don't probe at all. */
return
wd_probe1
(
dev
,
base_addr
);
if
(
ioaddr
>
0x100
)
else
if
(
base_addr
!=
0
)
/* Don't probe at all. */
return
!
wdprobe1
(
ioaddr
,
dev
)
;
return
ENXIO
;
for
(
port
=
&
ports
[
0
];
*
port
;
port
++
)
{
for
(
i
=
0
;
wd_portlist
[
i
];
i
++
)
{
if
(
check_region
(
*
port
,
32
))
int
ioaddr
=
wd_portlist
[
i
];
if
(
check_region
(
ioaddr
,
WD_IO_EXTENT
))
continue
;
continue
;
if
(
inb
(
*
port
+
8
)
!=
0xff
if
(
wd_probe1
(
dev
,
ioaddr
)
==
0
)
&&
inb
(
*
port
+
9
)
!=
0xff
/* Extra check to avoid soundcard. */
&&
wdprobe1
(
*
port
,
dev
))
return
0
;
return
0
;
}
}
dev
->
base_addr
=
ioaddr
;
return
ENODEV
;
return
ENODEV
;
}
}
#endif
int
wd
probe1
(
int
ioaddr
,
struct
device
*
dev
)
int
wd
_probe1
(
struct
device
*
dev
,
int
ioaddr
)
{
{
int
i
;
int
i
;
unsigned
char
*
station_addr
=
dev
->
dev_addr
;
int
checksum
=
0
;
int
checksum
=
0
;
int
ancient
=
0
;
/* An old card without config registers. */
int
ancient
=
0
;
/* An old card without config registers. */
int
word16
=
0
;
/* 0 = 8 bit, 1 = 16 bit */
int
word16
=
0
;
/* 0 = 8 bit, 1 = 16 bit */
char
*
model_name
;
char
*
model_name
;
for
(
i
=
0
;
i
<
8
;
i
++
)
for
(
i
=
0
;
i
<
8
;
i
++
)
checksum
+=
inb
(
ioaddr
+
8
+
i
);
checksum
+=
inb
(
ioaddr
+
8
+
i
);
if
((
checksum
&
0xff
)
!=
0xFF
)
if
(
inb
(
ioaddr
+
8
)
==
0xff
/* Extra check to avoid soundcard. */
return
0
;
||
inb
(
ioaddr
+
9
)
==
0xff
||
(
checksum
&
0xff
)
!=
0xFF
)
return
ENODEV
;
if
(
dev
==
NULL
)
dev
=
init_etherdev
(
0
,
sizeof
(
struct
ei_device
),
0
);
printk
(
"%s: WD80x3 at %#3x, "
,
dev
->
name
,
ioaddr
);
printk
(
"%s: WD80x3 at %#3x, "
,
dev
->
name
,
ioaddr
);
for
(
i
=
0
;
i
<
6
;
i
++
)
for
(
i
=
0
;
i
<
6
;
i
++
)
printk
(
" %2.2X"
,
station
_addr
[
i
]
=
inb
(
ioaddr
+
8
+
i
));
printk
(
" %2.2X"
,
dev
->
dev
_addr
[
i
]
=
inb
(
ioaddr
+
8
+
i
));
/* The following PureData probe code was contributed by
/* The following PureData probe code was contributed by
Mike Jagdis <jaggy@purplet.demon.co.uk>. Puredata does software
Mike Jagdis <jaggy@purplet.demon.co.uk>. Puredata does software
configuration differently from others so we have to check for them.
configuration differently from others so we have to check for them.
...
@@ -113,7 +127,7 @@ int wdprobe1(int ioaddr, struct device *dev)
...
@@ -113,7 +127,7 @@ int wdprobe1(int ioaddr, struct device *dev)
*/
*/
if
(
inb
(
ioaddr
+
0
)
==
'P'
&&
inb
(
ioaddr
+
1
)
==
'D'
)
{
if
(
inb
(
ioaddr
+
0
)
==
'P'
&&
inb
(
ioaddr
+
1
)
==
'D'
)
{
unsigned
char
reg5
=
inb
(
ioaddr
+
5
);
unsigned
char
reg5
=
inb
(
ioaddr
+
5
);
switch
(
inb
(
ioaddr
+
2
))
{
switch
(
inb
(
ioaddr
+
2
))
{
case
0x03
:
word16
=
0
;
model_name
=
"PDI8023-8"
;
break
;
case
0x03
:
word16
=
0
;
model_name
=
"PDI8023-8"
;
break
;
case
0x05
:
word16
=
0
;
model_name
=
"PDUC8023"
;
break
;
case
0x05
:
word16
=
0
;
model_name
=
"PDUC8023"
;
break
;
...
@@ -160,7 +174,7 @@ int wdprobe1(int ioaddr, struct device *dev)
...
@@ -160,7 +174,7 @@ int wdprobe1(int ioaddr, struct device *dev)
word16
?
16
:
8
,
(
inb
(
ioaddr
+
1
)
&
0x01
)
?
16
:
8
);
word16
?
16
:
8
,
(
inb
(
ioaddr
+
1
)
&
0x01
)
?
16
:
8
);
#endif
#endif
}
}
#if defined(WD_SHMEM) && WD_SHMEM > 0x80000
#if defined(WD_SHMEM) && WD_SHMEM > 0x80000
/* Allow a compile-time override. */
/* Allow a compile-time override. */
dev
->
mem_start
=
WD_SHMEM
;
dev
->
mem_start
=
WD_SHMEM
;
...
@@ -181,17 +195,17 @@ int wdprobe1(int ioaddr, struct device *dev)
...
@@ -181,17 +195,17 @@ int wdprobe1(int ioaddr, struct device *dev)
}
}
}
}
#endif
#endif
/* The 8390 isn't at the base address -- the ASIC regs are there! */
/* The 8390 isn't at the base address -- the ASIC regs are there! */
dev
->
base_addr
=
ioaddr
+
WD_NIC_OFFSET
;
dev
->
base_addr
=
ioaddr
+
WD_NIC_OFFSET
;
if
(
dev
->
irq
<
2
)
{
if
(
dev
->
irq
<
2
)
{
int
irqmap
[]
=
{
9
,
3
,
5
,
7
,
10
,
11
,
15
,
4
};
int
irqmap
[]
=
{
9
,
3
,
5
,
7
,
10
,
11
,
15
,
4
};
int
reg1
=
inb
(
ioaddr
+
1
);
int
reg1
=
inb
(
ioaddr
+
1
);
int
reg4
=
inb
(
ioaddr
+
4
);
int
reg4
=
inb
(
ioaddr
+
4
);
if
(
ancient
||
reg1
==
0xff
)
{
/* Ack!! No way to read the IRQ! */
if
(
ancient
||
reg1
==
0xff
)
{
/* Ack!! No way to read the IRQ! */
short
nic_addr
=
ioaddr
+
WD_NIC_OFFSET
;
short
nic_addr
=
ioaddr
+
WD_NIC_OFFSET
;
/* We have an old-style ethercard that doesn't report its IRQ
/* We have an old-style ethercard that doesn't report its IRQ
line. Do autoirq to find the IRQ line. Note that this IS NOT
line. Do autoirq to find the IRQ line. Note that this IS NOT
a reliable way to trigger an interrupt. */
a reliable way to trigger an interrupt. */
...
@@ -204,7 +218,7 @@ int wdprobe1(int ioaddr, struct device *dev)
...
@@ -204,7 +218,7 @@ int wdprobe1(int ioaddr, struct device *dev)
outb
(
E8390_RREAD
+
E8390_START
,
nic_addr
);
/* Trigger it... */
outb
(
E8390_RREAD
+
E8390_START
,
nic_addr
);
/* Trigger it... */
dev
->
irq
=
autoirq_report
(
2
);
dev
->
irq
=
autoirq_report
(
2
);
outb_p
(
0x00
,
nic_addr
+
EN0_IMR
);
/* Mask all intrs. again. */
outb_p
(
0x00
,
nic_addr
+
EN0_IMR
);
/* Mask all intrs. again. */
if
(
ei_debug
>
2
)
if
(
ei_debug
>
2
)
printk
(
" autoirq is %d"
,
dev
->
irq
);
printk
(
" autoirq is %d"
,
dev
->
irq
);
if
(
dev
->
irq
<
2
)
if
(
dev
->
irq
<
2
)
...
@@ -213,42 +227,42 @@ int wdprobe1(int ioaddr, struct device *dev)
...
@@ -213,42 +227,42 @@ int wdprobe1(int ioaddr, struct device *dev)
dev
->
irq
=
irqmap
[((
reg4
>>
5
)
&
0x03
)
+
(
reg1
&
0x04
)];
dev
->
irq
=
irqmap
[((
reg4
>>
5
)
&
0x03
)
+
(
reg1
&
0x04
)];
}
else
if
(
dev
->
irq
==
2
)
/* Fixup bogosity: IRQ2 is really IRQ9 */
}
else
if
(
dev
->
irq
==
2
)
/* Fixup bogosity: IRQ2 is really IRQ9 */
dev
->
irq
=
9
;
dev
->
irq
=
9
;
/* Snarf the interrupt now. There's no point in waiting since we cannot
/* Snarf the interrupt now. There's no point in waiting since we cannot
share and the board will usually be enabled. */
share and the board will usually be enabled. */
if
(
request_irq
(
dev
->
irq
,
ei_interrupt
,
0
,
"wd"
))
{
if
(
request_irq
(
dev
->
irq
,
ei_interrupt
,
0
,
"wd"
))
{
printk
(
" unable to get IRQ %d.
\n
"
,
dev
->
irq
);
printk
(
" unable to get IRQ %d.
\n
"
,
dev
->
irq
);
return
0
;
return
EAGAIN
;
}
}
/* OK, were are certain this is going to work. Setup the device. */
/* OK, were are certain this is going to work. Setup the device. */
snarf_region
(
ioaddr
,
32
);
snarf_region
(
ioaddr
,
WD_IO_EXTENT
);
ethdev_init
(
dev
);
ethdev_init
(
dev
);
ei_status
.
name
=
model_name
;
ei_status
.
name
=
model_name
;
ei_status
.
word16
=
word16
;
ei_status
.
word16
=
word16
;
ei_status
.
tx_start_page
=
WD_START_PG
;
ei_status
.
tx_start_page
=
WD_START_PG
;
ei_status
.
rx_start_page
=
WD_START_PG
+
TX_PAGES
;
ei_status
.
rx_start_page
=
WD_START_PG
+
TX_PAGES
;
ei_status
.
stop_page
=
word16
?
WD13_STOP_PG
:
WD03_STOP_PG
;
ei_status
.
stop_page
=
word16
?
WD13_STOP_PG
:
WD03_STOP_PG
;
/* Don't map in the shared memory until the board is actually opened. */
/* Don't map in the shared memory until the board is actually opened. */
dev
->
rmem_start
=
dev
->
mem_start
+
TX_PAGES
*
256
;
dev
->
rmem_start
=
dev
->
mem_start
+
TX_PAGES
*
256
;
dev
->
mem_end
=
dev
->
rmem_end
dev
->
mem_end
=
dev
->
rmem_end
=
dev
->
mem_start
+
(
ei_status
.
stop_page
-
WD_START_PG
)
*
256
;
=
dev
->
mem_start
+
(
ei_status
.
stop_page
-
WD_START_PG
)
*
256
;
printk
(
" %s, IRQ %d, shared memory at %#lx-%#lx.
\n
"
,
printk
(
" %s, IRQ %d, shared memory at %#lx-%#lx.
\n
"
,
model_name
,
dev
->
irq
,
dev
->
mem_start
,
dev
->
mem_end
-
1
);
model_name
,
dev
->
irq
,
dev
->
mem_start
,
dev
->
mem_end
-
1
);
if
(
ei_debug
>
0
)
if
(
ei_debug
>
0
)
printk
(
version
);
printk
(
version
);
ei_status
.
reset_8390
=
&
wd_reset_8390
;
ei_status
.
reset_8390
=
&
wd_reset_8390
;
ei_status
.
block_input
=
&
wd_block_input
;
ei_status
.
block_input
=
&
wd_block_input
;
ei_status
.
block_output
=
&
wd_block_output
;
ei_status
.
block_output
=
&
wd_block_output
;
dev
->
open
=
&
wd_open
;
dev
->
open
=
&
wd_open
;
dev
->
stop
=
&
wd_close_card
;
dev
->
stop
=
&
wd_close_card
;
NS8390_init
(
dev
,
0
);
NS8390_init
(
dev
,
0
);
return
dev
->
base_addr
;
return
0
;
}
}
static
int
static
int
...
...
drivers/net/znet.c
View file @
6e38a55b
/* znet.c: An Zenith Z-Note ethernet driver for linux. */
/* znet.c: An Zenith Z-Note ethernet driver for linux. */
static
char
*
version
=
"znet.c:v1.0
1 7/1
/94 becker@cesdis.gsfc.nasa.gov
\n
"
;
static
char
*
version
=
"znet.c:v1.0
2 9/23
/94 becker@cesdis.gsfc.nasa.gov
\n
"
;
/*
/*
Written by Donald Becker.
Written by Donald Becker.
...
@@ -81,7 +81,7 @@ static char *version = "znet.c:v1.01 7/1/94 becker@cesdis.gsfc.nasa.gov\n";
...
@@ -81,7 +81,7 @@ static char *version = "znet.c:v1.01 7/1/94 becker@cesdis.gsfc.nasa.gov\n";
#include <linux/if_arp.h>
#include <linux/if_arp.h>
#ifndef ZNET_DEBUG
#ifndef ZNET_DEBUG
#define ZNET_DEBUG
3
#define ZNET_DEBUG
1
#endif
#endif
static
unsigned
int
znet_debug
=
ZNET_DEBUG
;
static
unsigned
int
znet_debug
=
ZNET_DEBUG
;
...
...
drivers/scsi/scsi.c
View file @
6e38a55b
...
@@ -1804,7 +1804,7 @@ unsigned long scsi_dev_init (unsigned long memory_start,unsigned long memory_end
...
@@ -1804,7 +1804,7 @@ unsigned long scsi_dev_init (unsigned long memory_start,unsigned long memory_end
host
->
hostt
->
cmd_per_lun
;
host
->
hostt
->
cmd_per_lun
;
if
(
host
->
unchecked_isa_dma
&&
if
(
host
->
unchecked_isa_dma
&&
memory_end
>
ISA_DMA_THRESHOLD
&&
memory_end
-
1
>
ISA_DMA_THRESHOLD
&&
SDpnt
->
type
!=
TYPE_TAPE
)
{
SDpnt
->
type
!=
TYPE_TAPE
)
{
dma_sectors
+=
(
PAGE_SIZE
>>
9
)
*
host
->
sg_tablesize
*
dma_sectors
+=
(
PAGE_SIZE
>>
9
)
*
host
->
sg_tablesize
*
host
->
hostt
->
cmd_per_lun
;
host
->
hostt
->
cmd_per_lun
;
...
...
fs/nfs/proc.c
View file @
6e38a55b
...
@@ -80,7 +80,7 @@ static inline int *nfs_rpc_alloc(int size)
...
@@ -80,7 +80,7 @@ static inline int *nfs_rpc_alloc(int size)
#if 1
#if 1
/* Allow for the NFS crap as well as buffer */
/* Allow for the NFS crap as well as buffer */
return
(
int
*
)
kmalloc
(
size
+
NFS_SLACK_SPACE
,
GFP_KERNEL
);
return
(
int
*
)
kmalloc
(
size
+
NFS_SLACK_SPACE
,
GFP_KERNEL
);
#else
#else
/* If kmalloc fails, then we will give an EIO to user level.
/* If kmalloc fails, then we will give an EIO to user level.
(Please correct me, I am wron here... ??) This is not
(Please correct me, I am wron here... ??) This is not
desirable, but it is also not desirable to execute the
desirable, but it is also not desirable to execute the
...
...
fs/nfs/sock.c
View file @
6e38a55b
...
@@ -209,7 +209,9 @@ static int do_nfs_rpc_call(struct nfs_server *server, int *start, int *end, int
...
@@ -209,7 +209,9 @@ static int do_nfs_rpc_call(struct nfs_server *server, int *start, int *end, int
size
+
1024
,
1
,
0
,
NULL
,
size
+
1024
,
1
,
0
,
NULL
,
/* Here is NFS_SLACK_SPACE..., hack */
/* Here is NFS_SLACK_SPACE..., hack */
&
addrlen
);
&
addrlen
);
if
(
result
<
addrlen
)
{
if
(
result
<
0
)
{
printk
(
"NFS: notice message: result=%d
\n
"
,
result
);
}
else
if
(
result
<
addrlen
)
{
printk
(
"NFS: just caught a too small read memory size..., email to NET channel
\n
"
);
printk
(
"NFS: just caught a too small read memory size..., email to NET channel
\n
"
);
printk
(
"NFS: result=%d,addrlen=%d
\n
"
,
result
,
addrlen
);
printk
(
"NFS: result=%d,addrlen=%d
\n
"
,
result
,
addrlen
);
result
=
-
EIO
;
result
=
-
EIO
;
...
...
fs/nfs/symlink.c
View file @
6e38a55b
...
@@ -71,10 +71,16 @@ static int nfs_follow_link(struct inode *dir, struct inode *inode,
...
@@ -71,10 +71,16 @@ static int nfs_follow_link(struct inode *dir, struct inode *inode,
}
}
error
=
nfs_proc_readlink
(
NFS_SERVER
(
inode
),
NFS_FH
(
inode
),
&
mem
,
error
=
nfs_proc_readlink
(
NFS_SERVER
(
inode
),
NFS_FH
(
inode
),
&
mem
,
&
res
,
&
len
,
NFS_MAXPATHLEN
);
&
res
,
&
len
,
NFS_MAXPATHLEN
);
#if 1
if
((
res2
=
(
char
*
)
kmalloc
(
NFS_MAXPATHLEN
+
1
,
GFP_KERNEL
))
==
NULL
)
{
if
((
res2
=
(
char
*
)
kmalloc
(
NFS_MAXPATHLEN
+
1
,
GFP_KERNEL
))
==
NULL
)
{
printk
(
"NFS: no memory in nfs_follow_link
\n
"
);
printk
(
"NFS: no memory in nfs_follow_link
\n
"
);
error
=
-
EIO
;
error
=
-
EIO
;
}
}
#else
while
((
res2
=
(
char
*
)
kmalloc
(
NFS_MAXPATHLEN
+
1
,
GFP_KERNEL
))
==
NULL
)
{
schedule
();
}
#endif
if
(
error
)
{
if
(
error
)
{
iput
(
inode
);
iput
(
inode
);
iput
(
dir
);
iput
(
dir
);
...
...
include/linux/resource.h
View file @
6e38a55b
...
@@ -54,7 +54,7 @@ struct rusage {
...
@@ -54,7 +54,7 @@ struct rusage {
#define RLIM_NLIMITS 6
#define RLIM_NLIMITS 6
#define RLIM_INFINITY
0x7FFFFFFF
#define RLIM_INFINITY
((long)(~0UL>>1))
struct
rlimit
{
struct
rlimit
{
int
rlim_cur
;
int
rlim_cur
;
...
...
include/linux/signal.h
View file @
6e38a55b
...
@@ -13,7 +13,7 @@ typedef unsigned int sigset_t; /* 32 bits */
...
@@ -13,7 +13,7 @@ typedef unsigned int sigset_t; /* 32 bits */
#define SIGTRAP 5
#define SIGTRAP 5
#define SIGABRT 6
#define SIGABRT 6
#define SIGIOT 6
#define SIGIOT 6
#define SIG
UNUSED
7
#define SIG
BUS
7
#define SIGFPE 8
#define SIGFPE 8
#define SIGKILL 9
#define SIGKILL 9
#define SIGUSR1 10
#define SIGUSR1 10
...
@@ -29,32 +29,19 @@ typedef unsigned int sigset_t; /* 32 bits */
...
@@ -29,32 +29,19 @@ typedef unsigned int sigset_t; /* 32 bits */
#define SIGTSTP 20
#define SIGTSTP 20
#define SIGTTIN 21
#define SIGTTIN 21
#define SIGTTOU 22
#define SIGTTOU 22
/*
* Most of these aren't used yet (and perhaps never will),
* so they are commented out.
*/
#define SIGIO 23
#define SIGIO 23
#define SIGPOLL SIGIO
#define SIGPOLL SIGIO
#define SIGURG SIGIO
#define SIGURG SIGIO
#define SIGXCPU 24
#define SIGXCPU 24
#define SIGXFSZ 25
#define SIGXFSZ 25
#define SIGVTALRM 26
#define SIGVTALRM 26
#define SIGPROF 27
#define SIGPROF 27
#define SIGWINCH 28
#define SIGWINCH 28
/*
/*
#define SIGLOST 29
#define SIGLOST 29
*/
*/
#define SIGPWR 30
#define SIGPWR 30
#define SIGUNUSED 31
/* Arggh. Bad user source code wants this.. */
#define SIGBUS SIGUNUSED
/*
/*
* sa_flags values: SA_STACK is not currently supported, but will allow the
* sa_flags values: SA_STACK is not currently supported, but will allow the
...
...
kernel/sched.c
View file @
6e38a55b
...
@@ -600,7 +600,7 @@ static void do_timer(struct pt_regs * regs)
...
@@ -600,7 +600,7 @@ static void do_timer(struct pt_regs * regs)
unsigned
long
mask
;
unsigned
long
mask
;
struct
timer_struct
*
tp
;
struct
timer_struct
*
tp
;
long
ltemp
;
long
ltemp
,
psecs
;
/* Advance the phase, once it gets to one microsecond, then
/* Advance the phase, once it gets to one microsecond, then
* advance the tick more.
* advance the tick more.
...
@@ -679,12 +679,20 @@ static void do_timer(struct pt_regs * regs)
...
@@ -679,12 +679,20 @@ static void do_timer(struct pt_regs * regs)
/*
/*
* check the cpu time limit on the process.
* check the cpu time limit on the process.
*/
*/
if
((
current
->
rlim
[
RLIMIT_CPU
].
rlim_cur
!=
RLIM_INFINITY
)
&&
(((
current
->
stime
+
current
->
utime
)
/
HZ
)
>=
current
->
rlim
[
RLIMIT_CPU
].
rlim_cur
))
send_sig
(
SIGXCPU
,
current
,
1
);
if
((
current
->
rlim
[
RLIMIT_CPU
].
rlim_max
!=
RLIM_INFINITY
)
&&
if
((
current
->
rlim
[
RLIMIT_CPU
].
rlim_max
!=
RLIM_INFINITY
)
&&
(((
current
->
stime
+
current
->
utime
)
/
HZ
)
>=
current
->
rlim
[
RLIMIT_CPU
].
rlim_max
))
(((
current
->
stime
+
current
->
utime
)
/
HZ
)
>=
current
->
rlim
[
RLIMIT_CPU
].
rlim_max
))
send_sig
(
SIGKILL
,
current
,
1
);
send_sig
(
SIGKILL
,
current
,
1
);
if
((
current
->
rlim
[
RLIMIT_CPU
].
rlim_cur
!=
RLIM_INFINITY
)
&&
(((
current
->
stime
+
current
->
utime
)
%
HZ
)
==
0
))
{
psecs
=
(
current
->
stime
+
current
->
utime
)
/
HZ
;
/* send when equal */
if
(
psecs
==
current
->
rlim
[
RLIMIT_CPU
].
rlim_cur
)
send_sig
(
SIGXCPU
,
current
,
1
);
/* and every five seconds thereafter. */
else
if
((
psecs
>
current
->
rlim
[
RLIMIT_CPU
].
rlim_cur
)
&&
((
psecs
-
current
->
rlim
[
RLIMIT_CPU
].
rlim_cur
)
%
5
)
==
0
)
send_sig
(
SIGXCPU
,
current
,
1
);
}
if
(
current
!=
task
[
0
]
&&
0
>
--
current
->
counter
)
{
if
(
current
!=
task
[
0
]
&&
0
>
--
current
->
counter
)
{
current
->
counter
=
0
;
current
->
counter
=
0
;
...
...
kernel/signal.c
View file @
6e38a55b
...
@@ -217,8 +217,8 @@ if (!(context.x & 0xfffc) || (context.x & 3) != 3) goto badframe; COPY(x);
...
@@ -217,8 +217,8 @@ if (!(context.x & 0xfffc) || (context.x & 3) != 3) goto badframe; COPY(x);
COPY
(
ebx
);
COPY
(
ebx
);
COPY
(
esp
);
COPY
(
ebp
);
COPY
(
esp
);
COPY
(
ebp
);
COPY
(
edi
);
COPY
(
esi
);
COPY
(
edi
);
COPY
(
esi
);
regs
->
eflags
&=
~
0x
C
D5
;
regs
->
eflags
&=
~
0x
40D
D5
;
regs
->
eflags
|=
context
.
eflags
&
0x
C
D5
;
regs
->
eflags
|=
context
.
eflags
&
0x
40D
D5
;
regs
->
orig_eax
=
-
1
;
/* disable syscall checks */
regs
->
orig_eax
=
-
1
;
/* disable syscall checks */
return
context
.
eax
;
return
context
.
eax
;
badframe:
badframe:
...
...
kernel/vm86.c
View file @
6e38a55b
...
@@ -45,8 +45,8 @@
...
@@ -45,8 +45,8 @@
#define set_flags(X,new,mask) \
#define set_flags(X,new,mask) \
((X) = ((X) & ~(mask)) | ((new) & (mask)))
((X) = ((X) & ~(mask)) | ((new) & (mask)))
#define SAFE_MASK (0xDD5)
#define SAFE_MASK (0x
40
DD5)
#define RETURN_MASK (0xDFF)
#define RETURN_MASK (0x
40
DFF)
asmlinkage
struct
pt_regs
*
save_v86_state
(
struct
vm86_regs
*
regs
)
asmlinkage
struct
pt_regs
*
save_v86_state
(
struct
vm86_regs
*
regs
)
{
{
...
...
net/inet/icmp.c
View file @
6e38a55b
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
* Alan Cox : Removed old debugging junk
* Alan Cox : Removed old debugging junk
* Alan Cox : Fixed the ICMP error status of net/host unreachable
* Alan Cox : Fixed the ICMP error status of net/host unreachable
* Gerhard Koerting : Fixed broadcast ping properly
* Gerhard Koerting : Fixed broadcast ping properly
* Ulrich Kunitz : Fixed ICMP timestamp reply
*
*
*
*
*
*
...
@@ -424,8 +425,21 @@ static void icmp_timestamp(struct icmphdr *icmph, struct sk_buff *skb, struct de
...
@@ -424,8 +425,21 @@ static void icmp_timestamp(struct icmphdr *icmph, struct sk_buff *skb, struct de
int
size
,
offset
;
int
size
,
offset
;
unsigned
long
*
timeptr
,
midtime
;
unsigned
long
*
timeptr
,
midtime
;
struct
device
*
ndev
=
NULL
;
struct
device
*
ndev
=
NULL
;
size
=
dev
->
hard_header_len
+
64
+
len
;
if
(
len
!=
20
)
{
printk
(
"ICMP: Size (%d) of ICMP_TIMESTAMP request should be 20!
\n
"
,
len
);
icmp_statistics
.
IcmpInErrors
++
;
#if 1
/* correct answers are possible for everything >= 12 */
if
(
len
<
12
)
#endif
return
;
}
size
=
dev
->
hard_header_len
+
84
;
if
(
!
(
skb2
=
alloc_skb
(
size
,
GFP_ATOMIC
)))
if
(
!
(
skb2
=
alloc_skb
(
size
,
GFP_ATOMIC
)))
{
{
...
@@ -454,14 +468,14 @@ static void icmp_timestamp(struct icmphdr *icmph, struct sk_buff *skb, struct de
...
@@ -454,14 +468,14 @@ static void icmp_timestamp(struct icmphdr *icmph, struct sk_buff *skb, struct de
/*
/*
* Re-adjust length according to actual IP header size.
* Re-adjust length according to actual IP header size.
*/
*/
skb2
->
len
=
offset
+
len
;
skb2
->
len
=
offset
+
20
;
/*
/*
* Build ICMP_TIMESTAMP Response message.
* Build ICMP_TIMESTAMP Response message.
*/
*/
icmphr
=
(
struct
icmphdr
*
)
((
char
*
)
(
skb2
+
1
)
+
offset
);
icmphr
=
(
struct
icmphdr
*
)
((
char
*
)
(
skb2
+
1
)
+
offset
);
memcpy
((
char
*
)
icmphr
,
(
char
*
)
icmph
,
len
);
memcpy
((
char
*
)
icmphr
,
(
char
*
)
icmph
,
12
);
icmphr
->
type
=
ICMP_TIMESTAMPREPLY
;
icmphr
->
type
=
ICMP_TIMESTAMPREPLY
;
icmphr
->
code
=
icmphr
->
checksum
=
0
;
icmphr
->
code
=
icmphr
->
checksum
=
0
;
...
@@ -473,7 +487,7 @@ static void icmp_timestamp(struct icmphdr *icmph, struct sk_buff *skb, struct de
...
@@ -473,7 +487,7 @@ static void icmp_timestamp(struct icmphdr *icmph, struct sk_buff *skb, struct de
*/
*/
timeptr
[
1
]
=
timeptr
[
2
]
=
htonl
(
midtime
);
timeptr
[
1
]
=
timeptr
[
2
]
=
htonl
(
midtime
);
icmphr
->
checksum
=
ip_compute_csum
((
unsigned
char
*
)
icmphr
,
len
);
icmphr
->
checksum
=
ip_compute_csum
((
unsigned
char
*
)
icmphr
,
20
);
/*
/*
* Ship it out - free it when done
* Ship it out - free it when done
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment