Commit 0e8625c7 authored by Linus Torvalds's avatar Linus Torvalds

Import 1.3.53

parent 6caf23d5
......@@ -372,6 +372,14 @@ S: 25360 Georgia Tech Station
S: Atlanta, Georgia 30332
S: USA
N: Kai Harrekilde-Petersen
E: khp@pip.dknet.dk
W: http://www.pip.dknet.dk/~pip93
D: ftape-HOWTO, i82078 fdc detection code, various ftape related stuff.
S: Studsgade 40, 2tv
S: DK-8000 Aarhus C
S: Denmark
N: Andrew Haylett
E: ajh@primag.co.uk
D: Selection mechanism
......
Linux kernel coding style
This is a short document describing the preferred coding style for the
linux kernel. Coding style is very personal, and I won't _force_ my
views on anybody, but this is what goes for anything that I have to be
able to maintain, and I'd prefer it for most other things too. Please
at least consider the points made here.
First off, I'd suggest printing out a copy of the GNU coding standards,
and NOT read it. Burn them, it's a great symbolic gesture.
Anyway, here goes:
Chapter 1: Indentation
Tabs are 8 characters, and thus indentations are also 8 characters.
There are heretic movements that try to make indentations 4 (or even 2!)
characters deep, and that is akin to trying to define the value of PI to
be 3.
Rationale: The whole idea behind indentation is to clearly define where
a block of control starts and ends. Especially when you've been looking
at your screen for 20 straight hours, you'll find it a lot easier to see
how the indentation works if you have large indentations.
Now, some people will claim that having 8-character indentations makes
the code move too far to the right, and makes it hard to read on a
80-character terminal screen. The answer to that is that if you need
more than 3 levels of indentation, you're screwed anyway, and should fix
your program.
In short, 8-char indents make things easier to read, and have the added
benefit of warning you when you're nesting your functions too deep.
Heed that warning.
Chapter 2: Placing Braces
The other issue that always comes up in C styling is the placement of
braces. Unlike the indent size, there are few technical reasons to
choose one placement strategy over the other, but the preferred way, as
shown to us by the prophets Kernighan and Ritchie, is to put the opening
brace last on the line, and put the closing brace first, thusly:
if (x is true) {
we do y
}
However, there is one special case, namely functions: they have the
opening brace at the beginning of the next line, thus:
int function(int x)
{
body of function
}
Heretic people all over the world have claimed that this inconsistency
is ... well ... inconsistent, but all right-thinking people know that
(a) K&R are _right_ and (b) K&R are right. Besides, functions are
special anyway (you can't nest them in C).
Note that the closing brace is empty on a line of its own, _except_ in
the cases where it is followed by a continuation of the same statement,
ie a "while" in a do-statement or an "else" in an if-statement, like
this:
do {
body of do-loop
} while (condition);
and
if (x == y) {
..
} else if (x > y) {
...
} else {
....
}
Rationale: K&R.
Also, note that this brace-placement also minimizes the number of empty
(or almost empty) lines, without any loss of readability. Thus, as the
supply of new-lines on your screen is not a renewable resource (think
25-line terminal screens here), you have more empty lines to put
comments on.
Chapter 3: Naming
C is a Spartan language, and so should your naming be. Unlike Modula-2
and Pascal programmers, C programmers do not use cute names like
ThisVariableIsATemporaryCounter. A C programmer would call that
variable "tmp", which is much easier to write, and not the least more
difficult to understand.
HOWEVER, while mixed-case names are frowned upon, descriptive names for
global variables are a must. To call a global function "foo" is a
shooting offense.
GLOBAL variables (to be used only if you _really_ need them) need to
have descriptive names, as do global functions. If you have a function
that counts the number of active users, you should call that
"count_active_users()" or similar, you should _not_ call it "cntusr()".
Encoding the type of a function into the name (so-called Hungarian
notation) is brain damaged - the compiler knows the types anyway and can
check those, and it only confuses the programmer. No wonder MicroSoft
makes buggy programs.
LOCAL variable names should be short, and to the point. If you have
some random integer loop counter, it should probably be called "i".
Calling it "loop_counter" is non-productive, if there is no chance of it
being mis-understood. Similarly, "tmp" can be just about any type of
variable that is used to hold a temporary value.
If you are afraid to mix up your local variable names, you have another
problem, which is called the function-growth-hormone-imbalance syndrome.
See next chapter.
Chapter 4: Functions
Functions should be short and sweet, and do just one thing. They should
fit on one or two screenfuls of text (the ISO/ANSI screen size is 80x24,
as we all know), and do one thing and do that well.
The maximum length of a function is inversely proportional to the
complexity and indentation level of that function. So, if you have a
conceptually simple function that is just one long (but simple)
case-statement, where you have to do lots of small things for a lot of
different cases, it's ok to have a longer function.
However, if you have a complex function, and you suspect that a
less-than-gifted first-year high-school student might not even
understand what the function is all about, you should adhere to the
maximum limits all the more closely. Use helper functions with
descriptive names (you can ask the compiler to in-line them if you think
it's performance-critical, and it will probably do a better job of it
that you would have done).
Another measure of the function is the number of local variables. They
shouldn't exceed 5-10, or you're doing something wrong. Re-think the
function, and split it into smaller pieces. A human brain can
generally easily keep track of about 7 different things, anything more
and it gets confused. You know you're brilliant, but maybe you'd like
to understand what you did 2 weeks from now.
Chapter 5: Commenting
Comments are good, but there is also a danger of over-commenting. NEVER
try to explain HOW your code works in a comment: it's much better to
write the code so that the _working_ is obvious, and it's a waste of
time to explain badly written code.
Generally, you want your comments to tell WHAT your code does, not HOW.
Also, try to avoid putting comments inside a function body: if the
function is so complex that you need to separately comment parts of it,
you should probably go back to chapter 4 for a while. You can make
small comments to note or warn about something particularly clever (or
ugly), but try to avoid excess. Instead, put the comments at the head
of the function, telling people what it does, and possibly WHY it does
it.
Chapter 6: You've made a mess of it
That's ok, we all do. You've probably been told by your long-time unix
user helper that "GNU emacs" automatically formats the C sources for
you, and you've noticed that yes, it does do that, but the defaults it
uses are less than desirable (in fact, they are worse than random
typing - a infinite number of monkeys typing into GNU emacs would never
make a good program).
So, you can either get rid of GNU emacs, or change it to use saner
values. I did the first, so don't ask me how to do the latter. But
even if you fail in getting emacs to do sane formatting, not everything
is lost: use "indent".
Now, again, GNU indent has the same brain dead settings that GNU emacs
has, which is why you need to give it a few command line options.
However, that's not too bad, because even the makers of GNU indent
recognize the authority of K&R (the GNU people aren't evil, they are
just severely misguided in this matter), so you just give indent the
options "-kr -i8" (stands for "K&R, 8 character indents").
"indent" has a lot of options, and especially when it comes to comment
re-formatting you may want to take a look at the manual page. But
remember: "indent" is not a fix for bad programming.
......@@ -317,6 +317,14 @@ CONFIG_M486
not sure, say N; This option will make the kernel use some
instructions that are only available on 486+ machines.
Use Pentium optimizations
CONFIG_M586
If you have a 586 or better, as opposed to a 486, or if you have a
486 and are very short on memory, say Y here.
Things will be slightly faster for a 586, and your kernel will be
smaller. A kernel with this option enabled will still run on a 486,
although slightly slower.
Enable loadable module support
CONFIG_MODULES
Kernel modules are small pieces of compiled code which can be
......@@ -568,11 +576,12 @@ CONFIG_SKB_LARGE
The IPX protocol
CONFIG_IPX
This is support for the Novell networking protocol, IPX. You need it
if you want to access Novell Netware servers from within the Linux
DOS emulator dosemu (read the DOSEMU-HOWTO, available via ftp (user:
anonymous) in sunsite.unc.edu:/pub/Linux/docs/HOWTO). To
turn your Linux box into a fully featured Netware file server and
IPX router, say Y here and fetch lwared from
if you want to access Novell Netware servers by using ncpfs or from
within the Linux DOS emulator dosemu (read the DOSEMU-HOWTO,
available via ftp (user: anonymous) in
sunsite.unc.edu:/pub/Linux/docs/HOWTO). To turn your Linux box into
a fully featured Netware file server and IPX router, say Y here and
fetch lwared from
sunsite.unc.edu:/pub/Linux/system/Networking/daemons/. General
information about how to connect Linux, Windows machines and Macs is
on the WWW at http://eats.com/linux_mac_win.html (to browse the WWW,
......@@ -2003,7 +2012,7 @@ CONFIG_SYSV_FS
Documentation/modules.txt. If you haven't heard about all of this
before, it's safe to say N.
SMB filesystem (to mount WfW shares etc..) support
SMB filesystem support (to mount WfW shares etc..)
CONFIG_SMB_FS
SMB (Server Message Buffer) is the protocol Windows for Workgroups
(WfW), Windows NT and Lan Manager use to talk to each other over an
......@@ -2023,6 +2032,18 @@ CONFIG_SMB_FS
running kernel whenever you want), say M here and read
Documentation/modules.txt. Most people say N, however.
NCP filesystem support (to mount NetWare volumes)
CONFIG_NCP_FS
NCP (NetWare Core Protocol) is a protocol that runs over IPX and is
used by NetWare clients to talk to file servers. Enabling this
allows you to mount NetWare file server volumes and access them just
like any other directory. To actually mount the filesystem, you need
a special mount program, available on sunsite.unc.edu via anonymous
ftp in /pub/Linux/system/Filesystem/ncpfs-xx.tgz. If you want to
compile this as a module ( = code which can be inserted in and
removed from the running kernel whenever you want), say M here and
read Documentation/modules.txt.
Cyclades async mux support
CONFIG_CYCLADES
This is a card which gives you many serial ports. You would need
......
VERSION = 1
PATCHLEVEL = 3
SUBLEVEL = 52
SUBLEVEL = 53
ARCH = i386
......@@ -266,6 +266,7 @@ modules_install:
if [ -f IPV4_MODULES ]; then inst_mod IPV4_MODULES ipv4; fi; \
if [ -f SCSI_MODULES ]; then inst_mod SCSI_MODULES scsi; fi; \
if [ -f FS_MODULES ]; then inst_mod FS_MODULES fs; fi; \
if [ -f CDROM_MODULES ]; then inst_mod CDROM_MODULES cdrom; fi; \
\
ls *.o > .allmods; \
echo $$MODULES | tr ' ' '\n' | sort | comm -23 .allmods - > .misc; \
......
......@@ -22,6 +22,7 @@ CONFIG_ALPHA_CABRIOLET=y
# CONFIG_ALPHA_SRM is not set
CONFIG_PCI=y
CONFIG_ALPHA_APECS=y
CONFIG_ALPHA_NEED_ROUNDING_EMULATION=y
# CONFIG_SERIAL_ECHO is not set
# CONFIG_TGA_CONSOLE is not set
CONFIG_PCI_OPTIMIZE=y
......@@ -33,6 +34,7 @@ CONFIG_SYSVIPC=y
# block devices
#
CONFIG_BLK_DEV_FD=y
# CONFIG_BLK_DEV_RAM is not set
CONFIG_ST506=y
#
......@@ -142,6 +144,7 @@ CONFIG_DE4X5=y
#
# Filesystems
#
# CONFIG_QUOTA is not set
# CONFIG_MINIX_FS is not set
# CONFIG_EXT_FS is not set
CONFIG_EXT2_FS=y
......@@ -168,6 +171,7 @@ CONFIG_PSMOUSE=y
# CONFIG_ATIXL_BUSMOUSE is not set
# CONFIG_QIC02_TAPE is not set
# CONFIG_APM is not set
# CONFIG_WATCHDOG is not set
#
# Sound
......
......@@ -46,14 +46,16 @@ LINKFLAGS =-qmagic -Ttext 0xfffe0
endif
CFLAGS := $(CFLAGS) -pipe
ifdef CONFIG_M386
CFLAGS := $(CFLAGS) -m386
endif
ifdef CONFIG_M486
CFLAGS := $(CFLAGS) -m486
else
ifdef CONFIG_M586
CFLAGS := $(CFLAGS) -mpentium
else
CFLAGS := $(CFLAGS) -m386
endif
ifdef CONFIG_M586
CFLAGS := $(CFLAGS) -m486 -malign-loops=2 -malign-jumps=2 -malign-functions=2
endif
ifdef SMP
......
......@@ -27,10 +27,10 @@ tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
if [ "$CONFIG_BINFMT_ELF" = "y" ]; then
bool 'Compile kernel as ELF - if your GCC is ELF-GCC' CONFIG_KERNEL_ELF
fi
#bool 'Use Pentium-specific optimizations (does NOT work on i386)' CONFIG_M586
#if [ "$CONFIG_M586" = "n" ]; then
bool 'Use 486-specific optimizations (does NOT work on i386)' CONFIG_M486
#fi
choice 'Processor type' \
"386 CONFIG_M386 \
486 CONFIG_M486 \
Pentium CONFIG_M586" Pentium
source drivers/block/Config.in
......
......@@ -19,7 +19,9 @@ CONFIG_PCI_OPTIMIZE=y
CONFIG_SYSVIPC=y
CONFIG_BINFMT_ELF=y
CONFIG_KERNEL_ELF=y
CONFIG_M486=y
# CONFIG_M386 is not set
# CONFIG_M486 is not set
CONFIG_M586=y
#
# block devices
......@@ -109,10 +111,10 @@ CONFIG_MSDOS_FS=y
CONFIG_PROC_FS=y
CONFIG_NFS_FS=y
# CONFIG_ROOT_NFS is not set
# CONFIG_SMB_FS is not set
CONFIG_ISO9660_FS=y
# CONFIG_HPFS_FS is not set
# CONFIG_SYSV_FS is not set
# CONFIG_SMB_FS is not set
#
# character devices
......
......@@ -12,16 +12,16 @@
#
# Copyright (C) 1994 by Linus Torvalds
# Changes for PPC by Gary Thomas
# Modified by Cort Dougan
#
# PowerPC (cross) tools
AS = as.ppc
ASFLAGS =
LD = ld.ppc
AS = /usr/local/bin/as.ppc
ASFLAGS =
LD = /u/cort/ppc-gcc/bin/ld.ppc
#LINKFLAGS = -T arch/ppc/ld.script -Ttext 0x90000000 -Map vmlinux.map
LINKFLAGS = -T arch/ppc/ld.script -Ttext 0x90000000
HOSTCC = gcc
CC = gcc.ppc
CC = /usr/local/bin/gcc.ppc
CFLAGS = -D__KERNEL__ -I$(TOPDIR)/include \
-Wstrict-prototypes \
-fomit-frame-pointer \
......@@ -30,10 +30,10 @@ CFLAGS = -D__KERNEL__ -I$(TOPDIR)/include \
-O2 -pipe
#-Wall
CPP = $(CC) -E $(CFLAGS)
AR = ar.ppc
RANLIB = ranlib.ppc
STRIP = strip.ppc
NM = nm.ppc
AR = /u/cort/ppc-gcc/bin/ar.ppc
RANLIB = /u/cort/ppc-gcc/bin/ranlib.ppc
STRIP = /u/cort/ppc-gcc/bin/strip.ppc
NM = /u/cort/ppc-gcc/bin/nm.ppc
#
# Set these to indicate how to link it..
......@@ -99,6 +99,8 @@ arch/ppc/mm: dummy
archclean:
# @$(MAKEBOOT) clean
/bin/rm -f arch/ppc/kernel/*.o arch/ppc/kernel/mk_defs arch/ppc/kernel/ppc_defs.h mm/*.o
/bin/rm -f arch/ppc/kernel/*~ arch/ppc/kernel/*~
archdep:
# @$(MAKEBOOT) dep
......
......@@ -24,8 +24,11 @@ OBJECTS = head.o main.o
all: linux.boot
linux.boot: $(TOPDIR)/vmlinux
mkboot $(TOPDIR)/vmlinux $@ 0
linux.boot: $(TOPDIR)/vmlinux mkboot
mkboot $(TOPDIR)/vmlinux /u/cort/bootpd/vmlinux
mkboot : cortstrip.c
$(HOSTCC) -o mkboot cortstrip.c
clean:
rm -f linux.boot
......
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
/* amount to skip */
#define PLACE 65536
/* size of read buffer */
#define SIZE 0x200000
/* crude program to strip the elf header to make a bootable
image via tftp
*/
int main(int argc, char **argv )
{
int fd, fdo;
unsigned char data[SIZE];
int i, n, skip;
if ( argc != 3 )
{
fprintf(stderr,"%s infile outfile\n", argv[0]);
exit(-1);
}
fd = open(argv[1], O_RDONLY);
if ( fd == -1 )
{
fprintf(stderr,"Couldn't open %s\n", argv[1]);
perror("open()");
exit(-1);
}
fdo = open(argv[2], O_WRONLY|O_CREAT);
if ( fdo == -1 )
{
fprintf(stderr,"Couldn't open %s\n", argv[2]);
perror("open()");
exit(-1);
}
#if 0
skip = atoi(argv[3]);
#else
skip = PLACE;
#endif
i = lseek(fd, skip, SEEK_SET);
printf("lseek'd %d bytes\n", i);
if ( i == -1 )
{
perror("lseek()");
}
while ( (n = read(fd, data, SIZE)) > 0 )
{
printf("Read %d bytes\n", n);
i = write(fdo, data, n);
printf("Wrote %d bytes\n", i);
}
close(fdo);
close(fd);
return(0);
}
......@@ -6,6 +6,10 @@
# unless it's something special (ie not a .c file).
#
# Note 2! The CFLAGS definitions are now in the main makefile...
#
#
# Modified by Cort Dougan
#
.c.s:
$(CC) $(CFLAGS) -S $<
......@@ -26,7 +30,7 @@ HOST_CC = gcc
OBJS = misc.o setup.o port_io.o irq.o pci.o traps.o stubs.o process.o \
signal.o raw_printf.o ramdisk.o
all: head.o kernel.o cortstrip mkboot
all: head.o kernel.o
head.o: head.s
head.s: head.S $(TOPDIR)/include/linux/tasks.h ppc_defs.h
......
......@@ -560,7 +560,8 @@ sys_call_table:
.long sys_uselib
.long sys_swapon
.long sys_reboot
.long sys_readdir
/* .long sys_readdir*/
.long old_readdir
.long sys_mmap /* 90 */
.long sys_munmap
.long sys_truncate
......@@ -623,4 +624,4 @@ sys_call_table:
.globl floppy_track_buffer
floppy_track_buffer:
.space 512*2*38 /* Space for one entire cylinder! */
#endif
#endif
\ No newline at end of file
......@@ -90,7 +90,7 @@ pcibios_read_config_word (unsigned char bus,
#endif
if ((bus != 0) || (dev < 11) || (dev > 16))
{
*val = 0xFFFFFFFF;
*val =(unsigned short) 0xFFFFFFFF;
return PCIBIOS_DEVICE_NOT_FOUND;
} else
{
......@@ -119,7 +119,7 @@ pcibios_read_config_byte (unsigned char bus,
#endif
if ((bus != 0) || (dev < 11) || (dev > 16))
{
*val = 0xFFFFFFFF;
*val = (unsigned char) 0xFFFFFFFF;
return PCIBIOS_DEVICE_NOT_FOUND;
} else
{
......@@ -207,7 +207,7 @@ pcibios_find_device (unsigned short vendor, unsigned short device_id,
unsigned short index, unsigned char *bus,
unsigned char *dev)
{
unsigned long w, desired = (device_id << 16) | vendor;
unsigned int w, desired = (device_id << 16) | vendor;
int devnr;
if (vendor == 0xffff) {
......
......@@ -165,4 +165,7 @@ n:
/* Missing instructions */
#define bdne bc 0,2,
#include "ppc_machine.h"
#include <asm/ppc_machine.h>
/* * Last edited: Nov 8 12:32 1995 (cort) */
/* * Last edited: Dec 14 17:32 1995 (cort) */
/*
* linux/arch/ppc/kernel/process.c
*
* Copyright (C) 1995 Linus Torvalds
* Adapted for PowerPC by Gary Thomas
* Modified by Cort Dougan
*/
/*
......@@ -27,7 +28,7 @@
#include <asm/system.h>
#include <asm/io.h>
#include <asm/processor.h>
#include <asm/ppc_machine.h>
int dump_fpu (struct user_i387_struct* fpu)
{
......@@ -122,10 +123,10 @@ void copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
childregs = ((struct pt_regs *) (p->kernel_stack_page + 2*PAGE_SIZE)) - 2;
*childregs = *regs; /* STRUCT COPY */
childregs->gpr[3] = 0; /* Result from fork() */
p->tss.ksp = childregs;
p->tss.ksp = (unsigned long)childregs;
if (usp >= (unsigned long)regs)
{ /* Stack is in kernel space - must adjust */
childregs->gpr[1] = childregs+1;
childregs->gpr[1] = (long)(childregs+1);
} else
{ /* Provided stack is in user space */
childregs->gpr[1] = usp;
......@@ -166,8 +167,18 @@ asmlinkage int sys_newselect(int p1, int p2, int p3, int p4, int p5, int p6, str
asmlinkage int sys_fork(int p1, int p2, int p3, int p4, int p5, int p6, struct pt_regs *regs)
{
printk("process.c: sys_fork() called\n");
return do_fork( CLONE_VM|SIGCHLD, regs->gpr[1], regs);
int i;
char *a;
#if 0
for ( i = 0 ; i <= 0x400 ; i++)
{
printk("going to do kmalloc(%d)\n",i);
a = kmalloc(i,GFP_KERNEL);
a = kmalloc(i,GFP_KERNEL);
printk("a = %x\n",a);
}
#endif
return do_fork( SIGCHLD, regs->gpr[1], regs);
}
asmlinkage int sys_execve(unsigned long a0, unsigned long a1, unsigned long a2,
......@@ -176,7 +187,6 @@ asmlinkage int sys_execve(unsigned long a0, unsigned long a1, unsigned long a2,
{
int error;
char * filename;
/* printk("process.c: sys_execve(a0 = %s, a1 = %x, a2 = %x)\n",a0,a1,a2);*/
#if 1
/* paranoia check. I really don't trust head.S -- Cort */
......@@ -189,12 +199,7 @@ asmlinkage int sys_execve(unsigned long a0, unsigned long a1, unsigned long a2,
if (error)
return error;
error = do_execve(filename, (char **) a1, (char **) a2, regs);
#if 0
if (error)
{
printk("EXECVE - file = '%s', error = %d\n", filename, error);
}
#endif
putname(filename);
return error;
}
......@@ -210,9 +215,9 @@ asmlinkage int sys_clone(unsigned long clone_flags, unsigned long usp, unsigned
usp = regs->gpr[1];
i = do_fork(CLONE_VM/*clone_flags*/, /*usp*/regs->gpr[1], regs);
/* printk("sys_clone going to return %d\n", i);*/
return i;
/* I hard coded in all the arguments to clone since clone() is inlined
and has trouble with its args with our gcc -- Cort*/
return do_fork(/*clone_flags*/CLONE_VM, /*usp*/ regs->gpr[1], regs);
}
......@@ -226,7 +231,7 @@ print_backtrace(void)
while (*sp)
{
printk("%08X ", sp[2]);
sp = *sp;
sp = (unsigned long *)*sp;
if (++cnt == 8)
{
printk("\n");
......
......@@ -3,9 +3,65 @@
#include <stdarg.h>
extern void cnputc(char c);
char cngetc(void);
int cntstc(void);
void _cnpause(void);
void cnpause(void);
void video_on(void);
int CRT_init(void);
int kbd(int noblock);
int scankbd(void);
static char *_sprintk_ptr;
void kbdreset(void);
int CRT_test(void);
int CRT_putc(int , unsigned char );
/*int CRT_putc(int port, u_char c)*/
int CRT_getc(void);
int _vprintk( int (*putc)(), const char *fmt0, va_list ap);
static _cvt(unsigned long val, char *buf, long radix, char *digits);
static void cursor(void);
static void initscreen(void );
/*
* COM1 NS16550 support
*/
struct NS16550
{
unsigned char rbr; /* 0 */
unsigned char ier; /* 1 */
unsigned char fcr; /* 2 */
unsigned char lcr; /* 3 */
unsigned char mcr; /* 4 */
unsigned char lsr; /* 5 */
unsigned char msr; /* 6 */
unsigned char scr; /* 7 */
};
#define thr rbr
#define iir fcr
#define dll rbr
#define dlm ier
#define LSR_DR 0x01 /* Data ready */
#define LSR_OE 0x02 /* Overrun */
#define LSR_PE 0x04 /* Parity error */
#define LSR_FE 0x08 /* Framing error */
#define LSR_BI 0x10 /* Break */
#define LSR_THRE 0x20 /* Xmit holding register empty */
#define LSR_TEMT 0x40 /* Xmitter empty */
#define LSR_ERR 0x80 /* Error */
#define COM1 0x800003F8
#define COM2 0x800002F8
typedef struct NS16550 *NS16550_t;
const NS16550_t COM_PORTS[] = { COM1,COM2};
volatile struct NS16550 *NS16550_init(int chan);
void NS16550_putc(volatile struct NS16550 *com_port, unsigned char c);
unsigned char NS16550_getc(volatile struct NS16550 *com_port);
static _sputc(char c)
{
*_sprintk_ptr++ = c;
......@@ -46,11 +102,7 @@ _printk(char const *fmt, ...)
#define is_digit(c) ((c >= '0') && (c <= '9'))
int
_vprintk(putc, fmt0, ap)
int (*putc)();
const char *fmt0;
va_list ap;
int _vprintk( int (*putc)(), const char *fmt0, va_list ap)
{
char c, sign, *cp;
int left_prec, right_prec, zero_fill, length, pad, pad_on_right;
......@@ -210,7 +262,6 @@ static _cvt(unsigned long val, char *buf, long radix, char *digits)
/*
* Console I/O interface
*/
typedef const (*proc)();
typedef int dev_t;
......@@ -225,24 +276,24 @@ static int port = 0;
static int line_num = 0;
#define MAX_LINES 24
char
cngetc()
char cngetc(void)
{
int s = _disable_interrupts();
char c = '\0';
if (port == CRT_PORT)
{
c = CRT_getc(port);
/* c = CRT_getc(port);*/
c = CRT_getc();
} else
if (port)
{
c = NS16550_getc(port);
c = NS16550_getc((struct NS16550 *)port);
}
_enable_interrupts(s);
return (c);
}
cntstc()
int cntstc(void)
{
return (0);
}
......@@ -268,7 +319,7 @@ cnputc(char c)
port = CRT_PORT;
} else
{
port = NS16550_init(0);
port =(int) NS16550_init(0);
}
init = TRUE;
}
......@@ -278,7 +329,7 @@ cnputc(char c)
} else
if (port)
{
NS16550_putc(port, c);
NS16550_putc((struct NS16550 *)port, c);
}
if (c == '\n')
{
......@@ -294,7 +345,7 @@ cnputc(char c)
}
}
_cnpause()
void _cnpause(void)
{
int c;
int s = _disable_interrupts();
......@@ -323,7 +374,7 @@ _cnpause()
_enable_interrupts(s);
}
cnpause()
void cnpause(void)
{
int c;
int s = _disable_interrupts();
......@@ -333,45 +384,7 @@ cnpause()
_enable_interrupts(s);
}
/*
* COM1 NS16550 support
*/
struct NS16550
{
unsigned char rbr; /* 0 */
unsigned char ier; /* 1 */
unsigned char fcr; /* 2 */
unsigned char lcr; /* 3 */
unsigned char mcr; /* 4 */
unsigned char lsr; /* 5 */
unsigned char msr; /* 6 */
unsigned char scr; /* 7 */
};
#define thr rbr
#define iir fcr
#define dll rbr
#define dlm ier
#define LSR_DR 0x01 /* Data ready */
#define LSR_OE 0x02 /* Overrun */
#define LSR_PE 0x04 /* Parity error */
#define LSR_FE 0x08 /* Framing error */
#define LSR_BI 0x10 /* Break */
#define LSR_THRE 0x20 /* Xmit holding register empty */
#define LSR_TEMT 0x40 /* Xmitter empty */
#define LSR_ERR 0x80 /* Error */
#define COM1 0x800003F8
#define COM2 0x800002F8
typedef struct NS16550 *NS16550_t;
const NS16550_t COM_PORTS[] = { COM1, COM2};
volatile struct NS16550 *
NS16550_init(int chan)
volatile struct NS16550 *NS16550_init(int chan)
{
volatile struct NS16550 *com_port;
volatile unsigned char xx;
......@@ -393,13 +406,14 @@ NS16550_init(int chan)
}
NS16550_putc(volatile struct NS16550 *com_port, unsigned char c)
void NS16550_putc(volatile struct NS16550 *com_port, unsigned char c)
{
volatile int i;
while ((com_port->lsr & LSR_THRE) == 0) ;
com_port->thr = c;
}
unsigned char NS16550_getc(volatile struct NS16550 *com_port)
{
while ((com_port->lsr & LSR_DR) == 0) ;
......@@ -481,8 +495,7 @@ unsigned short pccolor_so; /* color/attributes, standout mode */
/*
* cursor() sets an offset (0-1999) into the 80x25 text area
*/
static void
cursor()
static void cursor(void)
{
int pos = screen.cp - Crtat;
......@@ -495,8 +508,7 @@ cursor()
}
}
static void
initscreen()
static void initscreen(void )
{
struct screen *d = &screen;
......@@ -533,8 +545,7 @@ fillw(unsigned short val, unsigned short *buf, int num)
* "ca" is the color/attributes value (left-shifted by 8)
* or 0 if the current regular color for that screen is to be used.
*/
void
CRT_putc(int port, u_char c)
int CRT_putc(int port, unsigned char c)
{
struct screen *d = &screen;
u_short *base;
......@@ -779,13 +790,13 @@ CRT_putc(int port, u_char c)
cursor();
}
video_on()
void video_on(void)
{ /* Enable video */
outb(0x3C4, 0x01);
outb(0x3C5, inb(0x3C5)&~20);
}
CRT_init()
int CRT_init(void)
{
unsigned long *PCI_base = (unsigned long *)0x80808010; /* Magic */
struct screen *d = &screen;
......@@ -964,9 +975,7 @@ const unsigned char keycode[] = {
_x__, 0x4E, 0x51, 0x4A, _x__, 0x49, 0x46, 0x54, /* 0x78-0x7F */
};
int
kbd(noblock)
int noblock;
int kbd(int noblock)
{
unsigned char dt, brk, act;
int first = 1;
......@@ -1041,11 +1050,12 @@ kbd(noblock)
goto loop;
}
scankbd() {
int scankbd(void)
{
return (kbd(1) != -1);
}
kbdreset()
void kbdreset(void)
{
unsigned char c;
......@@ -1066,14 +1076,14 @@ kbdreset()
;
}
CRT_getc()
int CRT_getc(void)
{
int c;
while ((c = kbd(0)) == 0) ;
return(c);
}
CRT_test()
int CRT_test(void)
{
return ((inb(KBSTATP) & KBINRDY) != 0);
}
......
......@@ -134,9 +134,6 @@ int size_memory;
#define DEFAULT_ROOT_DEVICE 0x0200 /* fd0 */
#define COMMAND_LINE_SIZE 512 /* Should match head.S */
char saved_command_line[COMMAND_LINE_SIZE];
void setup_arch(char **cmdline_p,
unsigned long * memory_start_p, unsigned long * memory_end_p)
{
......@@ -146,7 +143,6 @@ void setup_arch(char **cmdline_p,
ROOT_DEV = DEFAULT_ROOT_DEVICE;
aux_device_present = 0xaa;
strcpy(saved_command_line, cmd_line);
*cmdline_p = cmd_line;
*memory_start_p = (unsigned long) &_end;
*memory_end_p = (unsigned long *)Hash;
......
#include <linux/in.h>
unsigned int csum_tcpudp_magic(void);
void halt(void);
void _do_bottom_half(void);
void sys_ptrace(void) { _panic("sys_ptrace"); }
void sys_iopl(void) { _panic("sys_iopl"); }
void sys_vm86(void) { _panic("sys_vm86"); }
......@@ -9,10 +13,11 @@ void sys_quotactl(void) { _panic("sys_quotactl"); }
void sys_pipe(void) {_panic("sys_pipe"); }
void sys_ipc(void) {_panic("sys_ipc"); }
void sys_mmap(void) {_panic("sys_mmap"); }
void sys_readdir(void) {_panic("sys_readdir"); }
/* unneeded
void sys_readdir(void) {panic("sys_readdir"); }
*/
halt()
void halt(void)
{
_printk("\n...Halt!\n");
abort();
......@@ -91,7 +96,8 @@ tcp_check(unsigned char *buf, int len, int saddr, int daddr)
return (_val);
}
#endif
_do_bottom_half()
void _do_bottom_half(void)
{
_enable_interrupts(1);
do_bottom_half();
......
......@@ -26,7 +26,7 @@
#include <asm/system.h>
#include <asm/io.h>
#include <asm/processor.h>
#include <asm/ppc_machine.h>
/*
* Trap & Exception support
......@@ -68,7 +68,8 @@ MachineCheckException(struct pt_regs *regs)
ProgramCheckException(struct pt_regs *regs)
{
printk("Program check at PC: %x[%x], SR: %x\n", regs->nip, va_to_phys(regs->nip), regs->msr);
_exception(SIGILL, regs);
while(1) ;
_exception(SIGILL, regs);
}
FloatingPointCheckException(struct pt_regs *regs)
......
......@@ -24,6 +24,9 @@ modules:
dep:
$(CPP) -M *.c > .depend
fastdep:
$(CPP) -M *.c > .depend
#
# include a dependency file if one exists
#
......
/* * Last edited: Nov 29 18:14 1995 (cort) */
/*
* ARCH/ppc/mm/fault.c
*
......@@ -5,6 +6,9 @@
* Ported to PPC by Gary Thomas
*/
/*#define NOISY_DATAFAULT*/
/*#define NOISY_INSTRFAULT*/
#include <linux/config.h>
#include <linux/signal.h>
#include <linux/sched.h>
......@@ -37,19 +41,24 @@ DataAccessException(struct pt_regs *regs)
if (user_mode(regs)) mode |= 0x04;
if (regs->dsisr & 0x02000000) mode |= 0x02; /* Load/store */
if (regs->dsisr & 0x08000000) mode |= 0x01; /* Protection violation */
#if 0
/*#ifdef SHOW_FAULTS*/
printk("Data Access Fault - Loc: %x, DSISR: %x, PC: %x", regs->dar, regs->dsisr, regs->nip);
printk(" PR: %d\n", regs->msr &&(1<<14));
#ifdef NOISY_DATAFAULT
printk("Data fault on %x\n",regs->dar);
#endif
if (mode & 0x01)
{
#if 0
printk("Write Protect Fault - Loc: %x, DSISR: %x, PC: %x\n", regs->dar, regs->dsisr, regs->nip);
#endif
#ifdef NOISY_DATAFAULT
printk("Write Protect fault\n ");
#endif
do_page_fault(regs, regs->dar, mode);
#ifdef NOISY_DATAFAULT
printk("Write Protect fault handled\n");
#endif
return;
}
/* printk("trying\n"); */
for (tries = 0; tries < 1; tries++)
{
dir = pgd_offset(current->mm, regs->dar & PAGE_MASK);
......@@ -72,7 +81,15 @@ DataAccessException(struct pt_regs *regs)
{
printk("No PGD\n");
}
#ifdef NOISY_DATAFAULT
printk("fall through page fault addr=%x; ip=%x\n",
regs->dar,regs->nip);
printk("beforefault: pgd[0] = %x[%x]\n",current->mm->pgd,*(current->mm->pgd));
#endif
do_page_fault(regs, regs->dar, mode);
#ifdef NOISY_DATAFAULT
printk("handled: pgd[0] = %x[%x]\n",current->mm->pgd,*(current->mm->pgd));
#endif
}
}
......@@ -83,43 +100,72 @@ InstructionAccessException(struct pt_regs *regs)
pmd_t *pmd;
pte_t *pte;
int tries, mode = 0;
#if 0
panic("Instruction Access Fault - Loc: %x, DSISR: %x, PC: %x\n", regs->dar, regs->dsisr, regs->nip);
#endif
#if NOISY_INSTRFAULT
printk("Instr fault on %x\n",regs->dar);
#endif
if (user_mode(regs)) mode |= 0x04;
if (regs->dsisr & 0x02000000) mode |= 0x02; /* Load/store */
if (regs->dsisr & 0x08000000) mode |= 0x01; /* Protection violation */
if (mode & 0x01)
{
do_page_fault(regs, regs->dar, mode);
do_page_fault(regs, regs->dar, mode);
return;
}
for (tries = 0; tries < 1; tries++)
{
/* dir = pgd_offset(current->mm, regs->nip & PAGE_MASK); */
dir = pgd_offset(current->mm, regs->dar & PAGE_MASK);
#ifdef NOISY_INSTRFAULT
/* printk("regs->dar=%x current=%x current->mm=%x current->mm->pgd=%x current->tss.pg_tables=%x\n",
regs->dar,current,current->mm,current->mm->pgd,current->tss.pg_tables);*/
#endif
if (dir)
{
pmd = pmd_offset(dir, regs->dar & PAGE_MASK);
pmd = pmd_offset(dir, regs->dar & PAGE_MASK);
if (pmd && pmd_present(*pmd))
{
pte = pte_offset(pmd, regs->dar & PAGE_MASK);
if (pte && pte_present(*pte))
{
pte = pte_offset(pmd, regs->dar & PAGE_MASK);
#ifdef NOISY_INSTRFAULT
/* printk("dir %x(%x) pmd %x(%x) pte %x\n",dir,*dir,pmd,*pmd,pte);*/
#if 0
printk("Page mapped - PTE: %x[%x]\n", pte, *(long *)pte);
printk("pgd_offset mm=%x mm->pgd=%x dirshouldbe=%x\n",
current->mm, current->mm->pgd,
current->mm->pgd+((regs->dar&PAGE_MASK) >> PGDIR_SHIFT));
printk("dir is %x\n", dir);
/* printk("got pte\n"); */
if (pte) {
printk("pgd=%x; dir=%x->%x; pmd=%x->%x; pte=%x; \n",
current->mm->pgd,dir,*dir,pmd,*pmd,pte);
if (pte_present(*pte)) {
printk("pte present\n");
} else {
printk("pte not present\n");
}
} else {
printk("pte false\n");
}
#endif
MMU_hash_page(&current->tss, regs->dar & PAGE_MASK, pte);
#endif
if (pte && pte_present(*pte))
{
/* MMU_hash_page(&current->tss, regs->nip & PAGE_MASK, pte); */
MMU_hash_page(&current->tss, regs->dar & PAGE_MASK, pte);
return;
}
}
} else
{
#if 1
panic("No PGD Instruction Access Fault - Loc: %x, DSISR: %x, PC: %x\n", regs->dar, regs->dsisr, regs->nip);
#endif
printk("No PGD\n");
#ifdef NOISY_INSTRFAULT
panic("No PGD Instruction Access Fault - Loc: %x, DSISR: %x, PC: %x current->mm\n",
regs->dar, regs->dsisr, regs->nip, current->mm);
#endif
}
do_page_fault(regs, regs->dar, mode);
/* do_page_fault(regs, regs->nip, mode); */
do_page_fault(regs, regs->dar, mode);
}
}
......@@ -138,24 +184,15 @@ void do_page_fault(struct pt_regs *regs, unsigned long address, unsigned long er
{
struct vm_area_struct * vma;
unsigned long page;
/* printk("\ndo_page_fault()\n");*/
/* printk("In do_page_fault()\n"); */
#if 1
for (vma = current->mm->mmap ; ; vma = vma->vm_next)
{
if (!vma)
{
#if 0 /* mfisk */
{ struct vm_area_struct * mmp;
for(mmp=current->mm->mmap; mmp; mmp=mmp->vm_next) {
printk("notinmap: current: %x; mm: %x; mmap: %x; vma: %x to %x flags: %x\n",
current, current->mm, mmp, mmp->vm_start, mmp->vm_end, mmp->vm_flags);
}
}
#endif
panic("do_page_fault() !vma \n");
panic("not in map: ip = %x; current=%x; mm=%x; mmap=%x; address = %x error_code = %x\n",
regs->nip, current, current->mm, current->mm->mmap, address, error_code);
panic("!vma: ip = %x; current=%x[%d]; mm=%x; mmap=%x; address = %x error_code = %x\n",
regs->nip, current,current->pid,current->mm,current->mm->mmap, address, error_code);
goto bad_area;
}
if (vma->vm_end > address)
......@@ -164,6 +201,8 @@ void do_page_fault(struct pt_regs *regs, unsigned long address, unsigned long er
#else
vma = find_vma(current, address);
if (!vma)
{
}
goto bad_area;
#endif
if (vma->vm_start <= address){
......@@ -171,13 +210,19 @@ void do_page_fault(struct pt_regs *regs, unsigned long address, unsigned long er
}
if (!(vma->vm_flags & VM_GROWSDOWN))
{
printk("stack: gpr[1]=%x ip = %x; current=%x[%d]; mm=%x; mmap=%x; address = %x error_code = %x\n",regs->gpr[1],regs->nip, current,current->pid,current->mm,current->mm->mmap, address, error_code);
panic("stack\n");
goto bad_area;
}
if (vma->vm_end - address > current->rlim[RLIMIT_STACK].rlim_cur)
{ panic("stack 2\n");
{
printk("stack2: vma->vm_end-addres %x rlim %x\n", vma->vm_end - address,
current->rlim[RLIMIT_STACK].rlim_cur);
printk("stack2: vm_end %x address = %x\n", vma->vm_end,address);
printk("stack2: gpr[1]=%x ip = %x; current=%x[%d]; mm=%x; mmap=%x; address = %x error_code = %x\n",regs->gpr[1],regs->nip, current,current->pid,current->mm,current->mm->mmap, address, error_code);
panic("stack2\n");
goto bad_area;
}
}
vma->vm_offset -= vma->vm_start - (address & PAGE_MASK);
vma->vm_start = (address & PAGE_MASK);
......@@ -192,8 +237,8 @@ void do_page_fault(struct pt_regs *regs, unsigned long address, unsigned long er
if (error_code & 2) {
if (!(vma->vm_flags & VM_WRITE))
{
panic("\ndo_page_fault() write\n");
panic("\ndo_page_fault() write! current: %x, address:%x, vm_flags: %x, mm: %x; vma(%x) %x to %x\n",
panic("do_page_fault() write\n");
panic("do_page_fault() write! current: %x, address:%x, vm_flags: %x, mm: %x; vma(%x) %x to %x\n",
current,address,vma->vm_flags,current->mm,vma,vma->vm_start,vma->vm_end);
goto bad_area;
}
......@@ -224,7 +269,10 @@ void do_page_fault(struct pt_regs *regs, unsigned long address, unsigned long er
goto bad_area;
}
}
/* printk("premm: pgd[0] = %x[%x]\n",current->mm->pgd,*(current->mm->pgd)); */
handle_mm_fault(vma, address, error_code & 2);
/* printk("handled fault for %x in %x to %x flags %x\n", */
/* address,vma->vm_start,vma->vm_end,vma->vm_flags); */
return;
/*
......@@ -233,16 +281,21 @@ void do_page_fault(struct pt_regs *regs, unsigned long address, unsigned long er
*/
bad_area:
if (user_mode(regs)) {
panic("Task: %x, PC: %x, bad area! - Addr: %x\n", current, regs->nip, address);
printk("Task: %x, PC: %x, bad area! - Addr: %x\n", current, regs->nip, address);
send_sig(SIGSEGV, current, 1);
return;
}
#if 0
panic("\nKERNEL! Task: %x, PC: %x, bad area! - Addr: %x, PGDIR: %x\n",
panic("KERNEL! Task: %x, PC: %x, bad area! - Addr: %x, PGDIR: %x\n",
current, regs->nip, address, current->tss.pg_tables);
#else
panic("\nKERNELmm! current: %x, address:%x, vm_flags: %x, mm: %x; vma(%x) %x to %x\n",
/* panic("KERNEL mm! current: %x, address:%x, vm_flags: %x, mm: %x; \nvma(%x) %x to %x swapper_pg_dir %x\n",
current,address,vma->vm_flags,current->mm,vma,vma->vm_start,vma->vm_end,
swapper_pg_dir);*/
printk("KERNEL mm! current: %x, address:%x, vm_flags: %x, mm: %x; vma(%x) %x to %x\n",
current,address,vma->vm_flags,current->mm,vma,vma->vm_start,vma->vm_end);
panic("Kernel access of bad area\n");
#endif
while (1) ;
......
......@@ -5,6 +5,7 @@
* Ported to PPC by Gary Thomas
*/
#include <linux/config.h>
#include <linux/signal.h>
#include <linux/sched.h>
......@@ -27,7 +28,7 @@
making it 8k for now. will change later.
-- Cort
*/
pgd_t swapper_pg_dir[1024*8];
pgd_t swapper_pg_dir[1024];
/*pgd_t *swapper_pg_dir;*/
pte *MMU_get_page(void);
......@@ -331,6 +332,7 @@ BAT BAT1 =
};
BAT BAT2 =
{
/* map kernel with bats 0 = yes */
#if 1
{
0x00000000>>17, /* bepi */
......@@ -468,9 +470,9 @@ void MMU_init(void)
{
int i, p;
SEGREG *segs;
_printk("MMU init - started\n");
/* _printk("MMU init - started\n");*/
find_end_of_memory();
_printk(" Start at 0x%08X, End at 0x%08X, Hash at 0x%08X\n", _start, _end, Hash);
/* _printk(" Start at 0x%08X, End at 0x%08X, Hash at 0x%08X\n", _start, _end, Hash);*/
_SDR1 = ((unsigned long)Hash & 0x00FFFFFF) | Hash_mask;
p = (int)mmu_pages;
p = (p + (MMU_PAGE_SIZE-1)) & ~(MMU_PAGE_SIZE-1);
......@@ -507,7 +509,7 @@ void MMU_init(void)
{
MMU_map_page(&init_task.tss, i, i & 0x00FFFFFF, PAGE_KERNEL);
}
_printk("MMU init - done!\n");
/* _printk("MMU init - done!\n");*/
}
pte *
......@@ -518,7 +520,7 @@ MMU_get_page(void)
{
bzero((char *)pg, MMU_PAGE_SIZE);
}
_printk("MMU Allocate Page at %08X\n", pg);
/* _printk("MMU Allocate Page at %08X\n", pg);*/
return(pg);
}
......
......@@ -5,7 +5,7 @@ mainmenu_option next_comment
comment 'block devices'
tristate 'Normal floppy disk support' CONFIG_BLK_DEV_FD
bool 'RAM disk support' CONFIG_BLK_DEV_RAM
tristate 'RAM disk support' CONFIG_BLK_DEV_RAM
bool 'Normal (MFM/RLL) disk and IDE disk/cdrom support' CONFIG_ST506
if [ "$CONFIG_ST506" = "y" ]; then
comment 'Please see drivers/block/README.ide for help/info on IDE drives'
......
......@@ -30,6 +30,10 @@ endif
ifeq ($(CONFIG_BLK_DEV_RAM),y)
L_OBJS += rd.o
else
ifeq ($(CONFIG_BLK_DEV_RAM),m)
M_OBJS += rd.o
endif
endif
ifeq ($(CONFIG_BLK_DEV_HD),y)
......
......@@ -23,6 +23,8 @@
* loader now also loads into a dynamic (buffer cache based) ramdisk,
* not the old static ramdisk. Support for the old static ramdisk has
* been completely removed.
*
* Loadable module support added by Tom Dyas.
*/
#include <linux/sched.h>
......@@ -35,6 +37,7 @@
#include <linux/mman.h>
#include <linux/malloc.h>
#include <linux/ioctl.h>
#include <linux/module.h>
#include <asm/system.h>
#include <asm/segment.h>
......@@ -52,8 +55,10 @@ extern void wait_for_keypress(void);
#define BUILD_CRAMDISK
#define NUM_RAMDISKS 8
#ifndef MODULE
void rd_load(void);
static int crd_load(struct file *fp, struct file *outfp);
#endif
/* Various static variables go here... mostly used within the ramdisk code only. */
......@@ -66,9 +71,11 @@ static int rd_blocksizes[NUM_RAMDISKS];
* architecture-specific setup routine (from the stored bootsector
* information).
*/
#ifndef MODULE
int rd_doload = 0; /* 1 = load ramdisk, 0 = don't load */
int rd_prompt = 1; /* 1 = prompt for ramdisk, 0 = don't prompt */
int rd_image_start = 0; /* starting block # of image */
#endif
/*
* Basically, my strategy here is to set up a buffer-head which can't be
......@@ -143,9 +150,18 @@ static int rd_open(struct inode * inode, struct file * filp)
if (DEVICE_NR(inode->i_rdev) >= NUM_RAMDISKS)
return -ENODEV;
MOD_INC_USE_COUNT;
return 0;
}
#ifdef MODULE
static void rd_release(struct inode * inode, struct file * filp)
{
MOD_DEC_USE_COUNT;
}
#endif
static struct file_operations fd_fops = {
NULL, /* lseek - default */
block_read, /* read - block dev write */
......@@ -155,7 +171,11 @@ static struct file_operations fd_fops = {
rd_ioctl, /* ioctl */
NULL, /* mmap */
rd_open, /* open */
#ifndef MODULE
NULL, /* no special release code... */
#else
rd_release, /* module needs to decrement use count */
#endif
block_fsync /* fsync */
};
......@@ -165,7 +185,7 @@ int rd_init(void)
int i;
if (register_blkdev(MAJOR_NR, "ramdisk", &fd_fops)) {
printk("RAMDISK2 : Could not get major %d", MAJOR_NR);
printk("RAMDISK: Could not get major %d", MAJOR_NR);
return -EIO;
}
......@@ -181,6 +201,7 @@ int rd_init(void)
return 0;
}
#ifndef MODULE
/*
* This routine tries to a ramdisk image to load, and returns the
* number of blocks to read for a non-compressed image, 0 if the image
......@@ -523,7 +544,27 @@ crd_load(struct file * fp, struct file *outfp)
return result;
}
#endif
#endif /* BUILD_CRAMDISK */
#endif /* MODULE */
/* loadable module support */
#ifdef MODULE
int init_module(void)
{
int error = rd_init();
if (!error)
printk(KERN_INFO "RAMDISK: Loaded as module.\n");
return error;
}
void cleanup_module(void)
{
unregister_blkdev( MAJOR_NR, "ramdisk" );
blk_dev[MAJOR_NR].request_fn = 0;
}
#endif /* MODULE */
......@@ -286,7 +286,8 @@ static inline void
enable_interrupts(void)
{
#ifdef USE_IRQ
/* this code snarfed from cdu31a.c; it will not
/*
* This code was taken from cdu31a.c; it will not
* directly work for the cdu535 as written...
*/
curr_control_reg |= ( SONY_ATTN_INT_EN_BIT
......@@ -300,7 +301,8 @@ static inline void
disable_interrupts(void)
{
#ifdef USE_IRQ
/* this code snarfed from cdu31a.c; it will not
/*
* This code was taken from cdu31a.c; it will not
* directly work for the cdu535 as written...
*/
curr_control_reg &= ~(SONY_ATTN_INT_EN_BIT
......
......@@ -158,7 +158,7 @@ static int ac_probe1(int ioaddr, struct device *dev)
inb(ioaddr + AC_ID_PORT + 2), inb(ioaddr + AC_ID_PORT + 3));
#endif
/* Assign and snarf the interrupt now. */
/* Assign and allocate the interrupt now. */
if (dev->irq == 0)
dev->irq = config2irq(inb(ioaddr + AC_CONFIG));
else if (dev->irq == 2)
......
This diff is collapsed.
This diff is collapsed.
......@@ -61,43 +61,43 @@
/*
** Control and Status Register bit definitions (EWRK3_CSR)
*/
#define RA 0x80 /* Runt Accept */
#define PME 0x40 /* Promiscuous Mode Enable */
#define MCE 0x20 /* Multicast Enable */
#define TNE 0x08 /* TX Done Queue Not Empty */
#define RNE 0x04 /* RX Queue Not Empty */
#define TXD 0x02 /* TX Disable */
#define RXD 0x01 /* RX Disable */
#define CSR_RA 0x80 /* Runt Accept */
#define CSR_PME 0x40 /* Promiscuous Mode Enable */
#define CSR_MCE 0x20 /* Multicast Enable */
#define CSR_TNE 0x08 /* TX Done Queue Not Empty */
#define CSR_RNE 0x04 /* RX Queue Not Empty */
#define CSR_TXD 0x02 /* TX Disable */
#define CSR_RXD 0x01 /* RX Disable */
/*
** Control Register bit definitions (EWRK3_CR)
*/
#define APD 0x80 /* Auto Port Disable */
#define PSEL 0x40 /* Port Select (0->TP port) */
#define LBCK 0x20 /* LoopBaCK enable */
#define FDUP 0x10 /* Full DUPlex enable */
#define FBUS 0x08 /* Fast BUS enable (ISA clk > 8.33MHz) */
#define EN_16 0x04 /* ENable 16 bit memory accesses */
#define LED 0x02 /* LED (1-> turn on) */
#define CR_APD 0x80 /* Auto Port Disable */
#define CR_PSEL 0x40 /* Port Select (0->TP port) */
#define CR_LBCK 0x20 /* LoopBaCK enable */
#define CR_FDUP 0x10 /* Full DUPlex enable */
#define CR_FBUS 0x08 /* Fast BUS enable (ISA clk > 8.33MHz) */
#define CR_EN_16 0x04 /* ENable 16 bit memory accesses */
#define CR_LED 0x02 /* LED (1-> turn on) */
/*
** Interrupt Control Register bit definitions (EWRK3_ICR)
*/
#define IE 0x80 /* Interrupt Enable */
#define IS 0x60 /* Interrupt Selected */
#define TNEM 0x08 /* TNE Mask (0->mask) */
#define RNEM 0x04 /* RNE Mask (0->mask) */
#define TXDM 0x02 /* TXD Mask (0->mask) */
#define RXDM 0x01 /* RXD Mask (0->mask) */
#define ICR_IE 0x80 /* Interrupt Enable */
#define ICR_IS 0x60 /* Interrupt Selected */
#define ICR_TNEM 0x08 /* TNE Mask (0->mask) */
#define ICR_RNEM 0x04 /* RNE Mask (0->mask) */
#define ICR_TXDM 0x02 /* TXD Mask (0->mask) */
#define ICR_RXDM 0x01 /* RXD Mask (0->mask) */
/*
** Transmit Status Register bit definitions (EWRK3_TSR)
*/
#define NCL 0x80 /* No Carrier Loopback */
#define ID 0x40 /* Initially Deferred */
#define LCL 0x20 /* Late CoLlision */
#define ECL 0x10 /* Excessive CoLlisions */
#define RCNTR 0x0f /* Retries CouNTeR */
#define TSR_NCL 0x80 /* No Carrier Loopback */
#define TSR_ID 0x40 /* Initially Deferred */
#define TSR_LCL 0x20 /* Late CoLlision */
#define TSR_ECL 0x10 /* Excessive CoLlisions */
#define TSR_RCNTR 0x0f /* Retries CouNTeR */
/*
** I/O Page Register bit definitions (EWRK3_IOPR)
......@@ -111,67 +111,68 @@
/*
** I/O Base Register bit definitions (EWRK3_IOBR)
*/
#define EISA 0x20 /* Enable EISA ID and Control Registers */
#define IOB 0x1f /* Compare bits for I/O Base Address */
#define EISA_REGS_EN 0x20 /* Enable EISA ID and Control Registers */
#define EISA_IOB 0x1f /* Compare bits for I/O Base Address */
/*
** I/O Configuration/Management Register bit definitions (EWRK3_CMR)
** I/O Congiguration/Management Register bit definitions (EWRK3_CMR)
*/
#define RA 0x80 /* Read Ahead */
#define WB 0x40 /* Write Behind */
#define LINK 0x20 /* 0->TP */
#define POLARITY 0x10 /* Informational */
#define NO_EEPROM 0x0c /* NO_EEPROM<1:0> pin status */
#define HS 0x08 /* Hard Strapped pin status (LeMAC2) */
#define PNP 0x04 /* Plug 'n Play */
#define DRAM 0x02 /* 0-> 1DRAM, 1-> 2 DRAM on board */
#define _0WS 0x01 /* Zero Wait State */
#define CMR_RA 0x80 /* Read Ahead */
#define CMR_WB 0x40 /* Write Behind */
#define CMR_LINK 0x20 /* 0->TP */
#define CMR_POLARITY 0x10 /* Informational */
#define CMR_NO_EEPROM 0x0c /* NO_EEPROM<1:0> pin status */
#define CMR_HS 0x08 /* Hard Strapped pin status (LeMAC2) */
#define CMR_PNP 0x04 /* Plug 'n Play */
#define CMR_DRAM 0x02 /* 0-> 1DRAM, 1-> 2 DRAM on board */
#define CMR_0WS 0x01 /* Zero Wait State */
/*
** MAC Receive Status Register bit definitions
*/
#define ROK 0x80 /* Receive OK summary */
#define IAM 0x10 /* Individual Address Match */
#define MCM 0x08 /* MultiCast Match */
#define DBE 0x04 /* Dribble Bit Error */
#define CRC 0x02 /* CRC error */
#define PLL 0x01 /* Phase Lock Lost */
#define R_ROK 0x80 /* Receive OK summary */
#define R_IAM 0x10 /* Individual Address Match */
#define R_MCM 0x08 /* MultiCast Match */
#define R_DBE 0x04 /* Dribble Bit Error */
#define R_CRC 0x02 /* CRC error */
#define R_PLL 0x01 /* Phase Lock Lost */
/*
** MAC Transmit Control Register bit definitions
*/
#define SQEE 0x40 /* SQE Enable - look for heartbeat */
#define SED 0x20 /* Stop when Error Detected */
#define QMODE 0x10 /* Q_MODE */
#define LAB 0x08 /* Less Aggressive Backoff */
#define PAD 0x04 /* PAD Runt Packets */
#define IFC 0x02 /* Insert Frame Check */
#define ISA 0x01 /* Insert Source Address */
#define TCR_SQEE 0x40 /* SQE Enable - look for heartbeat */
#define TCR_SED 0x20 /* Stop when Error Detected */
#define TCR_QMODE 0x10 /* Q_MODE */
#define TCR_LAB 0x08 /* Less Aggressive Backoff */
#define TCR_PAD 0x04 /* PAD Runt Packets */
#define TCR_IFC 0x02 /* Insert Frame Check */
#define TCR_ISA 0x01 /* Insert Source Address */
/*
** MAC Transmit Status Register bit definitions
*/
#define VSTS 0x80 /* Valid STatuS */
#define MAC_CTU 0x40 /* Cut Through Used */
#define MAC_SQE 0x20 /* Signal Quality Error */
#define MAC_NCL 0x10 /* No Carrier Loopback */
#define MAC_LCL 0x08 /* Late Collision */
#define MAC_ID 0x04 /* Initially Deferred */
#define MAC_COLL 0x03 /* COLLision status */
#define MAC_XCOLL 0x03 /* Excessive Collisions */
#define MAC_MCOLL 0x02 /* Multiple Collisions */
#define MAC_OCOLL 0x01 /* One Collision */
#define MAC_NOCOLL 0x00 /* No Collisions */
#define MAC_XUR 0x03 /* Excessive Underruns */
#define MAC_TXE 0x7f /* TX Errors */
#define T_VSTS 0x80 /* Valid STatuS */
#define T_CTU 0x40 /* Cut Through Used */
#define T_SQE 0x20 /* Signal Quality Error */
#define T_NCL 0x10 /* No Carrier Loopback */
#define T_LCL 0x08 /* Late Collision */
#define T_ID 0x04 /* Initially Deferred */
#define T_COLL 0x03 /* COLLision status */
#define T_XCOLL 0x03 /* Excessive Collisions */
#define T_MCOLL 0x02 /* Multiple Collisions */
#define T_OCOLL 0x01 /* One Collision */
#define T_NOCOLL 0x00 /* No Collisions */
#define T_XUR 0x03 /* Excessive Underruns */
#define T_TXE 0x7f /* TX Errors */
/*
** EISA Configuration Register bit definitions
*/
#define EISA_ID iobase + 0x0c80 /* EISA ID Registers */
#define EISA_ID0 iobase + 0x0c80 /* EISA ID Register 0 */
#define EISA_ID1 iobase + 0x0c81 /* EISA ID Register 1 */
#define EISA_ID2 iobase + 0x0c82 /* EISA ID Register 2 */
......@@ -283,6 +284,8 @@
#define MASK_INTERRUPTS 1
#define UNMASK_INTERRUPTS 0
#define EEPROM_OFFSET(a) ((u_short)((u_long)(a)))
/*
** Include the IOCTL stuff
*/
......
......@@ -569,7 +569,7 @@ lance_open(struct device *dev)
}
/* We used to allocate DMA here, but that was silly.
DMA lines can't be shared! We now permanently snarf them. */
DMA lines can't be shared! We now permanently allocate them. */
irq2dev_map[dev->irq] = dev;
......
......@@ -237,7 +237,6 @@ int ether_config(struct device *dev, struct ifmap *map)
return 0;
}
#ifdef CONFIG_MODULES
int register_netdev(struct device *dev)
{
struct device *d = dev_base;
......@@ -357,8 +356,6 @@ void unregister_netdev(struct device *dev)
restore_flags(flags);
}
#endif /* CONFIG_MODULES */
/*
......
......@@ -1407,7 +1407,7 @@ static int pi_probe(struct device *dev, int card_type)
}
/* Grab the region */
snarf_region(ioaddr & 0x3f0, PI_TOTAL_SIZE);
request_region(ioaddr & 0x3f0, PI_TOTAL_SIZE, "pi2" );
} /* Only for A port */
......
......@@ -877,7 +877,7 @@ static int pt_probe(struct device *dev)
}
/* Grab the region */
snarf_region(ioaddr & 0x3f0, PT_TOTAL_SIZE);
request_region(ioaddr & 0x3f0, PT_TOTAL_SIZE, "pt" );
} /* A port */
dev->open = pt_open;
dev->stop = pt_close;
......
This diff is collapsed.
......@@ -448,11 +448,11 @@ int aha1740_detect(Scsi_Host_Template * tpnt)
for ( slot=MINEISA; slot <= MAXEISA; slot++ )
{
base = SLOTBASE(slot);
/* The ioports for eisa boards are generally beyond that used in the
check,snarf_region code, but this may change at some point, so we
go through the motions. */
/*
* The ioports for eisa boards are generally beyond that used in the
* check/allocate region code, but this may change at some point,
* so we go through the motions.
*/
if(check_region(base, 0x5c)) continue; /* See if in use */
if ( aha1740_test_port()) break;
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment