Commit 6696fcb6 authored by Linus Torvalds's avatar Linus Torvalds

Import 2.1.53

parent ddb701b2
...@@ -4,9 +4,10 @@ the kernel to your system hardware and intended usage. The defaults ...@@ -4,9 +4,10 @@ the kernel to your system hardware and intended usage. The defaults
are usually a good choice for 99% of the people 99% of the time, but are usually a good choice for 99% of the people 99% of the time, but
you should be aware they do exist and can be changed. you should be aware they do exist and can be changed.
The current list of parameters can be found in the file: The current list of parameters can be found in the files:
./linux/net/TUNABLE linux/net/TUNABLE
linux/Documentation/networking/ip-sysctl.txt
Some of these are accessible via the sysctl interface, and many more are Some of these are accessible via the sysctl interface, and many more are
scheduled to be added in this way. For example, some parameters related scheduled to be added in this way. For example, some parameters related
......
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
Because so many people (myself included) seem to have obtained ARCnet cards Because so many people (myself included) seem to have obtained ARCnet cards
without manuals, this file contains a quick introduction to ARCnet hardware, without manuals, this file contains a quick introduction to ARCnet hardware,
some cabling tips, and a listing of all jumper settings I can find. Please some cabling tips, and a listing of all jumper settings I can find. Please
e-mail apenwarr@foxnet.net with any settings for your particular card, or e-mail apenwarr@bond.net with any settings for your particular card, or any
any other information you have! other information you have!
INTRODUCTION TO ARCNET INTRODUCTION TO ARCNET
...@@ -80,7 +80,7 @@ CABLING ARCNET NETWORKS ...@@ -80,7 +80,7 @@ CABLING ARCNET NETWORKS
This section was rewritten by This section was rewritten by
Vojtech Pavlik <Vojtech.Pavlik@st.mff.cuni.cz> Vojtech Pavlik <Vojtech.Pavlik@st.mff.cuni.cz>
using information from several people, including: using information from several people, including:
Avery Pennraun <apenwarr@foxnet.net> Avery Pennraun <apenwarr@bond.net>
Stephen A. Wood <saw@hallc1.cebaf.gov> Stephen A. Wood <saw@hallc1.cebaf.gov>
John Paul Morrison <jmorriso@bogomips.ee.ubc.ca> John Paul Morrison <jmorriso@bogomips.ee.ubc.ca>
Joachim Koenig <jojo@repas.de> Joachim Koenig <jojo@repas.de>
...@@ -3129,6 +3129,6 @@ Other Cards ...@@ -3129,6 +3129,6 @@ Other Cards
I have no information on other models of ARCnet cards at the moment. Please I have no information on other models of ARCnet cards at the moment. Please
send any and all info to: send any and all info to:
apenwarr@foxnet.net apenwarr@bond.net
Thanks. Thanks.
...@@ -37,7 +37,7 @@ If you think so, why not flame me in a quick little e-mail? Please also ...@@ -37,7 +37,7 @@ If you think so, why not flame me in a quick little e-mail? Please also
include the type of card(s) you're using, software, size of network, and include the type of card(s) you're using, software, size of network, and
whether it's working or not.) whether it's working or not.)
My e-mail address is: apenwarr@foxnet.net My e-mail address is: apenwarr@bond.net
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
...@@ -45,7 +45,15 @@ My e-mail address is: apenwarr@foxnet.net ...@@ -45,7 +45,15 @@ My e-mail address is: apenwarr@foxnet.net
These are the ARCnet drivers for Linux. These are the ARCnet drivers for Linux.
This new release has resulted from many months of on-and-off effort from me
This new release (2.91) has been put together by David Woodhouse
<dwmw2@cam.ac.uk>, in an attempt to tidy up the driver after adding support
for yet another chipset. Now the generic support has been separated from the
individual chipset drivers, and the source files aren't quite so packed with
#ifdefs! I've changed this file a bit, but kept it in the first person from
Avery, because I didn't want to completely rewrite it.
The previous release resulted from many months of on-and-off effort from me
(Avery Pennarun), many bug reports/fixes and suggestions from others, and in (Avery Pennarun), many bug reports/fixes and suggestions from others, and in
particular a lot of input and coding from Tomasz Motylewski. Starting with particular a lot of input and coding from Tomasz Motylewski. Starting with
ARCnet 2.10 ALPHA, Tomasz's all-new-and-improved RFC1051 support has been ARCnet 2.10 ALPHA, Tomasz's all-new-and-improved RFC1051 support has been
...@@ -71,7 +79,8 @@ may not work right in the first place. ...@@ -71,7 +79,8 @@ may not work right in the first place.
Other Drivers and Info Other Drivers and Info
---------------------- ----------------------
You can try my ARCNET page on the World Wide Web at: You can (could - foxnet.net is no more - DW.) try my ARCNET page on the
World Wide Web at:
http://www.foxnet.net/~apenwarr/arcnet/ http://www.foxnet.net/~apenwarr/arcnet/
Also, SMC (one of the companies that makes ARCnet cards) has a WWW site you Also, SMC (one of the companies that makes ARCnet cards) has a WWW site you
...@@ -97,18 +106,10 @@ access. ...@@ -97,18 +106,10 @@ access.
Installing the Driver Installing the Driver
--------------------- ---------------------
** Note: the latest version of the driver contains preliminary support for
ARCnet RIM I cards. These are very old cards that don't use I/O
ports at all, but rather map the status and command ports into
shared memory. To compile the driver in RIM I mode, you must (for
now) edit linux/drivers/net/arcnet.c, find the line that says:
#undef RIM_I_MODE
and change it to:
#define RIM_I_MODE
All you will need to do in order to install the driver is: All you will need to do in order to install the driver is:
make config make config
(be sure to choose ARCnet in the network devices) (be sure to choose ARCnet in the network devices
and at least one chipset driver.)
make dep make dep
make clean make clean
make zImage make zImage
...@@ -120,24 +121,72 @@ the linux/drivers/net directory. ...@@ -120,24 +121,72 @@ the linux/drivers/net directory.
You will know the driver is installed properly if you get some ARCnet You will know the driver is installed properly if you get some ARCnet
messages when you reboot into the new Linux kernel. messages when you reboot into the new Linux kernel.
If you use a RIM I card, you will need to give the kernel boot parameters There are four chipset options:
specifying your card's irq, node ID, and shared memory. For example,
LILO boot: linux ether=9,0x42,0xD0000,0,arc0 1. Standard ARCnet COM90xx chipset.
if your card is node number 42h, irq 9, with shared memory at 0xD0000.
This is the normal ARCnet card, which you've probably got. This is the only
chipset driver which will autoprobe if not told where the card is.
It following options on the command line:
com90xx=[<io>[,<irq>[,<shmem>]]][,<name>] | <name>
If you load the chipset support as a module, the options are:
io=<io> irq=<irq> shmem=<shmem> device=<name>
To disable the autoprobe, just specify "com90xx=" on the kernel command line.
To specify the name alone, but allow autoprobe, just put "com90xx=<name>"
2. ARCnet COM20020 chipset.
This is the new chipset from SMC with support for promiscuous mode (packet
sniffing), extra diagnostic information, etc. Unfortunately, there is no
sensible method of autoprobing for these cards. You must specify the I/O
address on the kernel command line.
The command line options are:
com20020=<io>[,<irq>[,<node_ID>[,backplane[,CKP[,timeout]]]]][,name]
If you load the chipset support as a module, the options are:
io=<io> irq=<irq> node=<node_ID> backplane=<backplane> clock=<CKP>
timeout=<timeout> device=<name>
NOTE that if you aren't using RIM I, the above command will still work but The COM20020 chipset allows you to set the node ID in software, overriding the
you will need to replace the node ID with an I/O port number, for example: default which is still set in DIP switches on the card. If you don't have the
LILO boot: linux ether=9,0x300,0xD0000,0,arc0 COM20020 data sheets, and you don't know what the other three options refer
to, then they won't interest you - forget them.
You can add the ether= parameter to /etc/lilo.conf to avoid typing this 3. ARCnet COM90xx chipset in IO-mapped mode.
every time.
This will also work with the normal ARCnet cards, but doesn't use the shared
memory. It performs less well than the above driver, but is provided in case
you have a card which doesn't support shared memory, or (strangely) in case
you have so many ARCnet cards in your machine that you run out of shmem slots.
If you don't give the IO address on the kernel command line, then the driver
will not find the card.
The command line options are:
com90io=<io>[,<irq>][,<name>]
If you load the chipset support as a module, the options are:
io=<io> irq=<irq> device=<name>
4. ARCnet RIM I cards.
These are COM90xx chips which are _completely_ memory mapped. The support for
these is not tested. If you have one, please mail the author with a success
report. All options must be specified, except the device name.
Command line options:
arcrimi=<shmem>,<irq>,<node_ID>[,<name>]
If you load the chipset support as a module, the options are:
shmem=<shmem> irq=<irq> node=<node_ID> device=<name>
Loadable Module Support Loadable Module Support
----------------------- -----------------------
Configure and rebuild Linux. When asked, answer 'm' to "arcnet support" if Configure and rebuild Linux. When asked, answer 'm' to "Generic ARCnet
you want to use the loadable module. support" and to support for your ARcnet chipset if you want to use the
loadable module. You can also say 'y' to "Generic ARCnet support" and 'm'
to the chipset support if you wish.
make config make config
make dep make dep
...@@ -152,20 +201,18 @@ and works as a module, so most of this is now unnecessary.) ...@@ -152,20 +201,18 @@ and works as a module, so most of this is now unnecessary.)
For example: For example:
cd /usr/src/linux/modules cd /usr/src/linux/modules
insmod arcnet.o io=0x300 irq=2 shmem=0xd0000 insmod arcnet.o
insmod com90xx.o
You can name the device using something like "device=arc1" (for a second insmod com20020.o io=0x2e0 device=eth1
card) or "device=eth0" (for weird compatibility reasons) if you like.
If you use RIM I, you don't need to specify io= but you must include node=
for your ARCnet card's station ID.
Using the Driver Using the Driver
---------------- ----------------
If you build your kernel with ARCnet support included, it should probe for If you build your kernel with ARCnet COM90xx support included, it should
your card automatically when you boot. probe for your card automatically when you boot. If you use a different
chipset driver complied into the kernel, you must give the necessary options
on the kernel command line, as detailed above.
Go read the NET-2-HOWTO and ETHERNET-HOWTO for Linux; they should be Go read the NET-2-HOWTO and ETHERNET-HOWTO for Linux; they should be
available where you picked up this driver. Think of your ARCnet as a available where you picked up this driver. Think of your ARCnet as a
...@@ -180,13 +227,19 @@ Multiple Cards in One Computer ...@@ -180,13 +227,19 @@ Multiple Cards in One Computer
------------------------------ ------------------------------
Linux has pretty good support for this now, but since I've been busy, the Linux has pretty good support for this now, but since I've been busy, the
ARCnet driver has somewhat suffered in this respect. For now, the easiest ARCnet driver has somewhat suffered in this respect. COM90xx support, if
way to use multiple ARCnet cards is to build it as a loadable module and compiled into the kernel, will (try to) autodetect all the installed cards.
then do something like this:
insmod -o arc0 arcnet If you have other cards, with support compiled into the kernel, then you can
insmod -o arc1 arcnet device=arc1 just repeat the options on the kernel command line, e.g.:
(Note that in the first line, the default is device=arc0, but it doesn't LILO: linux com20020=0x2e0 com20020=0x380 com90io=0x260
hurt if you want to add it for consistency.)
If you have the chipset support built as a loadable module, then you need to
do something like this:
insmod -o arc0 com90xx
insmod -o arc1 com20020 io=0x2e0
insmod -o arc2 com90xx
The ARCnet drivers will now sort out their names automatically.
How do I get it to work with...? How do I get it to work with...?
...@@ -441,7 +494,7 @@ It works: what now? ...@@ -441,7 +494,7 @@ It works: what now?
Send mail describing your setup, preferably including driver version, kernel Send mail describing your setup, preferably including driver version, kernel
version, ARCnet card model, CPU type, number of systems on your network, and version, ARCnet card model, CPU type, number of systems on your network, and
list of software in use to me at the following address: list of software in use to me at the following address:
apenwarr@foxnet.net apenwarr@bond.net
I do send (sometimes automated) replies to all messages I receive. My email I do send (sometimes automated) replies to all messages I receive. My email
can be weird (and also usually gets forwarded all over the place along the can be weird (and also usually gets forwarded all over the place along the
......
...@@ -80,6 +80,10 @@ ip_rfc1812_filter - INTEGER ...@@ -80,6 +80,10 @@ ip_rfc1812_filter - INTEGER
(sort of gated, routed etc. etc.) is confused by such packets, (sort of gated, routed etc. etc.) is confused by such packets,
even if they are valid. even if they are valid.
NOTE: this option is turned on per default only when ip_forwarding
is on. For non-forwarding hosts it doesn't make much sense and
makes some legal multihoming configurations impossible.
ip_fib_model - INTEGER ip_fib_model - INTEGER
0 - (DEFAULT) Standard model. All routes are in class MAIN. 0 - (DEFAULT) Standard model. All routes are in class MAIN.
1 - default routes go to class DEFAULT. This mode should 1 - default routes go to class DEFAULT. This mode should
...@@ -88,7 +92,61 @@ ip_fib_model - INTEGER ...@@ -88,7 +92,61 @@ ip_fib_model - INTEGER
Interface routes are in class MAIN. Interface routes are in class MAIN.
Gateway routes are in class DEFAULT. Gateway routes are in class DEFAULT.
IP Fragmentation:
ipfrag_high_thresh - INTEGER
Maximum memory used to reassemble IP fragments. When
ipfrag_high_thresh bytes of memory is allocated for this purpose,
the fragment handler will toss packets until ipfrag_low_thresh
is reached.
ipfrag_low_thresh - INTEGER
See ipfrag_high_thresh
ipfrag_time - INTEGER
Time in seconds to keep an IP fragment in memory.
TCP variables:
tcp_syn_retries - INTEGER
Number of times initial SYNs for an TCP connection attempt will
be retransmitted. Should not be higher that 255.
tcp_keepalive_time - INTEGER
How often TCP sends out keepalive messages when keepalive is enabled.
Default: 2hours.
tcp_keepalive_probes - INTEGER
How many keepalive probes TCP sends out, until it decides that the
connection is broken.
tcp_retries1 - INTEGER
tcp_retries2 - INTEGER
tcp_max_delay_acks - INTEGER
tcp_fin_timeout - INTEGER
tcp_max_ka_probes - INTEGER
Undocumented for now.
tcp_syncookies - BOOLEAN
Only valid when the kernel was compiled with CONFIG_SYNCOOKIES
Send out syncookies when the syn backlog queue of a socket
overflows. This is to prevent against the common 'syn flood attack'
Default: FALSE
tcp_stdurg - BOOLEAN
Use the Host requirements interpretation of the TCP urg pointer field.
Most hosts use the older BSD interpretation, so if you turn this on
Linux might not communicate correctly with them.
Default: FALSE
tcp_syn_taildrop - BOOLEAN
tcp_max_syn_backlog - INTEGER
Undocumented (work in progress)
Alexey Kuznetsov. Alexey Kuznetsov.
kuznet@ms2.inr.ac.ru kuznet@ms2.inr.ac.ru
Updated by:
Andi Kleen
ak@muc.de
$Id: ip-sysctl.txt,v 1.3 1997/08/22 19:22:00 freitag Exp $
...@@ -9,7 +9,9 @@ attempt to include full duplex support failed because the hardware did ...@@ -9,7 +9,9 @@ attempt to include full duplex support failed because the hardware did
not support it (it appeared that the card only provides one DMA channel, not support it (it appeared that the card only provides one DMA channel,
although the Codec chip would support two channels). The driver needs although the Codec chip would support two channels). The driver needs
some processing power! A 486DX/2 66MHz is a minimum requirement, otherwise some processing power! A 486DX/2 66MHz is a minimum requirement, otherwise
interactive performance of the computer may become sluggish. interactive performance of the computer may become sluggish. This driver
does *not* support telephone modem standards, it is intended for radio
use only.
The Interface of the driver The Interface of the driver
......
Index of files in Documentation/powerpc. If you think something about
Linux/PPC needs an entry here, needs correction of you've written one
please mail me.
Cort Dougan (cort@cs.nmt.edu)
00-INDEX
- this file
ppc_htab.txt
- info about the Linux/PPC /proc/ppc_htab entry
Information about /proc/ppc_htab
=====================================================================
This entry in the proc directory is readable by all users but only
writable by root.
1. Reading
Reading this file will give you information about the memory management
hash table that serves as an extended tlb for page translation on the
powerpc.
Explaination of the fields:
Size - hash table size in Kb.
Buckets - number of buckets in the table.
Addess - the virtual kernel address of the hash table base.
Entries - the number of ptes that can be stored in the hash table.
User/Kernel - how many pte's are in use by the kernel or user at that time.
Overflows - How many of the entries are in their secondary hash location.
Percent full - ratio of free pte entries to in use entries.
Note that calculation of the data displayed from /proc/ppc_htab takes
a long time and spends a great deal of time in the kernel. It would
be quite hard on performance to read this file constantly. In time
there may be a counter in the kernel that allows successive reads from
this file only after a given amount of time has passed to reduce the
possibility of a user slowing the system by reading this file.
2. Writing
Writing to ppc_htab is not yet allowed.
Write options to ppc_htab:
- To set the size of the hash table to 64Kb:
echo 'size 64' > /dev/ppc_htab
The size must be a multiple of 64 and must be greater than or equal to
64.
VERSION = 2 VERSION = 2
PATCHLEVEL = 1 PATCHLEVEL = 1
SUBLEVEL = 52 SUBLEVEL = 53
ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/) ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/)
......
#
# ppc/Makefile
#
# This file is included by the global makefile so that you can add your own # This file is included by the global makefile so that you can add your own
# architecture-specific flags and dependencies. Remember to do have actions # architecture-specific flags and dependencies. Remember to do have actions
# for "archclean" and "archdep" for cleaning up and making dependencies for # for "archclean" and "archdep" for cleaning up and making dependencies for
...@@ -12,7 +9,7 @@ ...@@ -12,7 +9,7 @@
# #
# Copyright (C) 1994 by Linus Torvalds # Copyright (C) 1994 by Linus Torvalds
# Changes for PPC by Gary Thomas # Changes for PPC by Gary Thomas
# Modified by Cort Dougan and Paul Mackerras # Rewritten by Cort Dougan and Paul Mackerras
# #
ifeq ($(CONFIG_PMAC),y) ifeq ($(CONFIG_PMAC),y)
...@@ -23,18 +20,16 @@ endif ...@@ -23,18 +20,16 @@ endif
# PowerPC (cross) tools # PowerPC (cross) tools
ifneq ($(shell uname -m),ppc) ifneq ($(shell uname -m),ppc)
CROSS_COMPILE =powerpc-eabi- CROSS_COMPILE = ppc-linux-elf-
else
CHECKS = checks
endif endif
ASFLAGS = ASFLAGS =
LINKFLAGS = -T arch/ppc/vmlinux.lds -Ttext $(KERNELBASE) -Bstatic LINKFLAGS = -T arch/ppc/vmlinux.lds -Ttext $(KERNELBASE) -Bstatic
CFLAGSINC = -D__KERNEL__ -I$(TOPDIR)/include -D__powerpc__ CFLAGSINC = -D__KERNEL__ -I$(TOPDIR)/include -D__powerpc__
CFLAGS = $(CFLAGSINC) \ CFLAGS := $(CFLAGS) -D__powerpc__ -fsigned-char -msoft-float -pipe \
-Wall -Wstrict-prototypes -Wno-uninitialized \ -fno-builtin -ffixed-r2 -Wno-uninitialized -mmultiple -mstring
-fno-builtin \
-fsigned-char \
-msoft-float \
-O2 -pipe
CPP = $(CC) -E $(CFLAGS) CPP = $(CC) -E $(CFLAGS)
ifdef CONFIG_601 ifdef CONFIG_601
...@@ -64,7 +59,7 @@ endif ...@@ -64,7 +59,7 @@ endif
ifdef CONFIG_PMAC ifdef CONFIG_PMAC
MAKEBOOT = $(MAKE) -C arch/$(ARCH)/coffboot MAKEBOOT = $(MAKE) -C arch/$(ARCH)/coffboot
else else
# PReP systems # PReP and CHRP systems
MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot
endif endif
...@@ -74,7 +69,7 @@ checks: ...@@ -74,7 +69,7 @@ checks:
BOOT_TARGETS = netboot znetboot zImage floppy install \ BOOT_TARGETS = netboot znetboot zImage floppy install \
vmlinux.coff znetboot.initrd zImage.initrd vmlinux.coff znetboot.initrd zImage.initrd
$(BOOT_TARGETS): checks vmlinux $(BOOT_TARGETS): $(CHECKS) vmlinux
@$(MAKEBOOT) $@ @$(MAKEBOOT) $@
tags: tags:
...@@ -83,9 +78,6 @@ tags: ...@@ -83,9 +78,6 @@ tags:
archclean: archclean:
rm -f arch/ppc/kernel/mk_defs arch/ppc/kernel/ppc_defs.h rm -f arch/ppc/kernel/mk_defs arch/ppc/kernel/ppc_defs.h
rm -f arch/ppc/kernel/checks rm -f arch/ppc/kernel/checks
find arch/ppc/ -name '*.o' -exec /bin/rm -f '{}' \;
find arch/ppc/ -name '*~' -exec /bin/rm -f '{}' \;
find arch/ppc/ -name '*.a' -exec /bin/rm -f '{}' \;
@$(MAKEBOOT) clean @$(MAKEBOOT) clean
archdep: archdep:
......
...@@ -26,9 +26,9 @@ ZLINKFLAGS = -T ../vmlinux.lds -Ttext 0x00800000 ...@@ -26,9 +26,9 @@ ZLINKFLAGS = -T ../vmlinux.lds -Ttext 0x00800000
GZIP_FLAGS = -v9 GZIP_FLAGS = -v9
SYSTEM = $(TOPDIR)/vmlinux SYSTEM = $(TOPDIR)/vmlinux
OBJECTS = head.o inflate.o unzip.o misc.o vreset.o #kbd.o OBJECTS := head.o inflate.o unzip.o misc.o vreset.o kbd.o
CFLAGS = -O2 -DSTDC_HEADERS -I$(TOPDIR)/include CFLAGS = -O2 -DSTDC_HEADERS -I$(TOPDIR)/include
OBJCOPY = objcopy OBJCOPY = $(CROSS_COMPILE)objcopy
OBJCOPY_ARGS = -O elf32-powerpc OBJCOPY_ARGS = -O elf32-powerpc
...@@ -37,6 +37,9 @@ all: $(TOPDIR)/zImage ...@@ -37,6 +37,9 @@ all: $(TOPDIR)/zImage
mkprep : mkprep.c mkprep : mkprep.c
$(HOSTCC) $(CFLAGSINC) -o mkprep mkprep.c $(HOSTCC) $(CFLAGSINC) -o mkprep mkprep.c
piggyback : piggyback.c
$(HOSTCC) $(CFLAGSINC) -o piggyback piggyback.c
find_name : find_name.c find_name : find_name.c
$(HOSTCC) $(CFLAGSINC) -o find_name find_name.c $(HOSTCC) $(CFLAGSINC) -o find_name find_name.c
...@@ -52,6 +55,25 @@ znetboot : zImage mkprep ...@@ -52,6 +55,25 @@ znetboot : zImage mkprep
znetboot.initrd : zImage.initrd mkprep znetboot.initrd : zImage.initrd mkprep
cp $(TOPDIR)/zImage.initrd /usr/local/tftpboot/vmlinux cp $(TOPDIR)/zImage.initrd /usr/local/tftpboot/vmlinux
#
# This really needs to go away. Perhaps a
# zImage.prep and zImage.chrp might be better.
# Once we're able to get a lilo-ish program
# on prep systems this won't be a problem.
# -- Cort
#
ifdef CONFIG_CHRP
zImage: zvmlinux
cp zvmlinux $(TOPDIR)/zImage
zImage.initrd: zvmlinux.initrd
cp zvmlinux.initrd $(TOPDIR)/zImage.initrd
zvmlinux: $(OBJECTS) $(SYSTEM) find_name vmlinux.gz piggyback
./piggyback < vmlinux.gz | $(AS) -o piggy.o
$(LD) $(ZLINKFLAGS) -o $@ $(OBJECTS) piggy.o
rm -f piggy.o
else
zImage: zvmlinux mkprep zImage: zvmlinux mkprep
mkprep -pbp zvmlinux $(TOPDIR)/zImage mkprep -pbp zvmlinux $(TOPDIR)/zImage
...@@ -63,6 +85,7 @@ zvmlinux: $(OBJECTS) $(SYSTEM) mkprep find_name vmlinux.gz ...@@ -63,6 +85,7 @@ zvmlinux: $(OBJECTS) $(SYSTEM) mkprep find_name vmlinux.gz
$(OBJCOPY) $(OBJCOPY_ARGS) --add-section=image=vmlinux.gz \ $(OBJCOPY) $(OBJCOPY_ARGS) --add-section=image=vmlinux.gz \
zvmlinux.tmp $@ zvmlinux.tmp $@
rm zvmlinux.tmp rm zvmlinux.tmp
endif
vmlinux.gz: $(TOPDIR)/vmlinux vmlinux.gz: $(TOPDIR)/vmlinux
dd bs=64k skip=1 if=$(TOPDIR)/vmlinux | gzip -vf9 - > vmlinux.gz dd bs=64k skip=1 if=$(TOPDIR)/vmlinux | gzip -vf9 - > vmlinux.gz
......
...@@ -94,8 +94,8 @@ start_ldr: ...@@ -94,8 +94,8 @@ start_ldr:
as ptr to residual -- Cort*/ as ptr to residual -- Cort*/
lis r6,cmd_line@h lis r6,cmd_line@h
ori r6,r6,cmd_line@l ori r6,r6,cmd_line@l
subi r7,r7,1 subi r7,r6,1
00: lbzu r2,1(r12) 00: lbzu r2,1(r7)
cmpi 0,r2,0 cmpi 0,r2,0
bne 00b bne 00b
......
/* Keyboard handler */
#include <../drivers/char/defkeymap.c> /* yeah I know it's bad */
#define L 0x0001 /* locking function */
#define SHF 0x0002 /* keyboard shift */
#define ALT 0x0004 /* alternate shift -- alternate chars */
#define NUM 0x0008 /* numeric shift cursors vs. numeric */
#define CTL 0x0010 /* control shift -- allows ctl function */
#define CPS 0x0020 /* caps shift -- swaps case of letter */
#define ASCII 0x0040 /* ascii code for this key */
#define STP 0x0080 /* stop output */
#define FUNC 0x0100 /* function key */
#define SCROLL 0x0200 /* scroll lock key */
unsigned char shfts, ctls, alts, caps, num, stp;
#define KBDATAP 0x60 /* kbd data port */
#define KBSTATUSPORT 0x61 /* kbd status */
#define KBSTATP 0x64 /* kbd status port */
#define KBINRDY 0x01
#define KBOUTRDY 0x02
#define _x__ 0x00 /* Unknown / unmapped */
const unsigned short action[] = {
0, ASCII, ASCII, ASCII, ASCII, ASCII, ASCII, ASCII, /* scan 0- 7 */
ASCII, ASCII, ASCII, ASCII, ASCII, ASCII, ASCII, ASCII, /* scan 8-15 */
ASCII, ASCII, ASCII, ASCII, ASCII, ASCII, ASCII, ASCII, /* scan 16-23 */
ASCII, ASCII, ASCII, ASCII, ASCII, CTL, ASCII, ASCII, /* scan 24-31 */
ASCII, ASCII, ASCII, ASCII, ASCII, ASCII, ASCII, ASCII, /* scan 32-39 */
ASCII, ASCII, SHF, ASCII, ASCII, ASCII, ASCII, ASCII, /* scan 40-47 */
ASCII, ASCII, ASCII, ASCII, ASCII, ASCII, SHF, ASCII, /* scan 48-55 */
ALT, ASCII, CPS, FUNC, FUNC, FUNC, FUNC, FUNC, /* scan 56-63 */
FUNC, FUNC, FUNC, FUNC, FUNC, NUM,SCROLL, ASCII, /* scan 64-71 */
ASCII, ASCII, ASCII, ASCII, ASCII, ASCII, ASCII, ASCII, /* scan 72-79 */
ASCII, ASCII, ASCII, ASCII, 0, 0, 0, 0, /* scan 80-87 */
0,0,0,0,0,0,0,0, /* scan 88-95 */
0,0,0,0,0,0,0,0, /* scan 96-103 */
0,0,0,0,0,0,0,0, /* scan 104-111 */
0,0,0,0,0,0,0,0, /* scan 112-119 */
0,0,0,0,0,0,0,0, /* scan 120-127 */
};
static int
kbd(noblock)
int noblock;
{
unsigned char dt, brk, act;
int first = 1;
loop:
if (noblock) {
if ((inb(KBSTATP) & KBINRDY) == 0)
return (-1);
} else while((inb(KBSTATP) & KBINRDY) == 0) ;
dt = inb(KBDATAP);
brk = dt & 0x80; /* brk == 1 on key release */
dt = dt & 0x7f; /* keycode */
act = action[dt];
if (/*act&SHF*/ dt == 54)
shfts = brk ? 0 : 1;
if (/*act&ALT*/ dt == 48)
alts = brk ? 0 : 1;
if (/*act&NUM*/ dt == 69)
if (act&L) {
/* NUM lock */
if(!brk)
num = !num;
} else
num = brk ? 0 : 1;
if (/*act&CTL*/ dt == 29)
ctls = brk ? 0 : 1;
if (/*act&CPS*/ dt == 58)
if (act&L) {
/* CAPS lock */
if(!brk)
caps = !caps;
} else
caps = brk ? 0 : 1;
if (0/*act&STP*/)
if (act&L) {
if(!brk)
stp = !stp;
} else
stp = brk ? 0 : 1;
if ((act&ASCII) && !brk) {
unsigned char chr;
if (shfts)
chr = shift_map[dt];
else if (ctls)
chr = ctrl_map[dt];
else
chr = plain_map[dt];
if (alts)
chr |= 0x80;
if (caps && (chr >= 'a' && chr <= 'z'))
chr -= 'a' - 'A' ;
if ( chr == 0x01 ) chr = '\n'; /* hack */
#define CTRL(s) (s & 0x1F)
if ((chr == '\r') || (chr == '\n') || (chr == CTRL('A')) || (chr == CTRL('S')))
{
/* Wait for key up */
while (1)
{
while((inb(KBSTATP) & KBINRDY) == 0) ;
dt = inb(KBDATAP);
if (dt & 0x80) /* key up */ break;
}
}
return (chr);
}
if (first && brk) return (0); /* Ignore initial 'key up' codes */
goto loop;
}
static
scankbd(void) {
return (kbd(1) != -1);
}
static
kbdreset(void)
{
unsigned char c;
int i;
/* Send self-test */
while (inb(KBSTATP) & KBOUTRDY) ;
outb(KBSTATP,0xAA);
while ((inb(KBSTATP) & KBINRDY) == 0) ; /* wait input ready */
if ((c = inb(KBDATAP)) != 0x55)
{
puts("Keyboard self test failed - result:");
puthex(c);
puts("\n");
}
/* Enable interrupts and keyboard controller */
while (inb(KBSTATP) & KBOUTRDY) ;
outb(KBSTATP,0x60);
while (inb(KBSTATP) & KBOUTRDY) ;
outb(KBDATAP,0x45);
for (i = 0; i < 10000; i++) udelay(1);
while (inb(KBSTATP) & KBOUTRDY) ;
outb(KBSTATP,0xAE);
}
static int kbd_reset = 0;
CRT_getc(void)
{
int c;
if (!kbd_reset) {kbdreset(); kbd_reset++; }
while ((c = kbd(0)) == 0) ;
return(c);
}
CRT_tstc(void)
{
if (!kbd_reset) {kbdreset(); kbd_reset++; }
return ((inb(KBSTATP) & KBINRDY) != 0);
}
...@@ -126,7 +126,7 @@ static void scroll() ...@@ -126,7 +126,7 @@ static void scroll()
for ( i = ( lines - 1 ) * cols * 2; i < lines * cols * 2; i += 2 ) for ( i = ( lines - 1 ) * cols * 2; i < lines * cols * 2; i += 2 )
vidmem[i] = ' '; vidmem[i] = ' ';
} }
#if 0
tstc(void) tstc(void)
{ {
return (CRT_tstc() ); return (CRT_tstc() );
...@@ -138,7 +138,7 @@ getc(void) ...@@ -138,7 +138,7 @@ getc(void)
if (CRT_tstc()) return (CRT_getc()); if (CRT_tstc()) return (CRT_getc());
} }
} }
#endif
void void
putc(const char c) putc(const char c)
{ {
...@@ -378,6 +378,7 @@ decompress_kernel(unsigned long load_addr, int num_words, unsigned long cksum, R ...@@ -378,6 +378,7 @@ decompress_kernel(unsigned long load_addr, int num_words, unsigned long cksum, R
Elf32_Shdr *sh, *strtab_shdr; Elf32_Shdr *sh, *strtab_shdr;
char *strtab; char *strtab;
unsigned long i; unsigned long i;
extern unsigned long start(void);
output_data = (char *)0x0; /* Points to 0 */ output_data = (char *)0x0; /* Points to 0 */
...@@ -405,16 +406,17 @@ decompress_kernel(unsigned long load_addr, int num_words, unsigned long cksum, R ...@@ -405,16 +406,17 @@ decompress_kernel(unsigned long load_addr, int num_words, unsigned long cksum, R
clear_bufs(); clear_bufs();
makecrc(); makecrc();
puts("Cksum: "); puthex(cksum); puts("\n");
puts("Loaded at: "); puthex(load_addr); puts(" "); puthex(num_words+load_addr); puts("Loaded at: "); puthex(load_addr); puts(" "); puthex(num_words+load_addr);
puts("\n"); puts("\n");
/*puts("Relocated to start: "); puthex(start); puts(" "); puts("Boot code relocated to: "); puthex((unsigned long)start); puts(" ");
puthex(num_words+start); puthex((unsigned long)(num_words+start));
puts("\n");*/ puts("\n");
puts("Cksum: "); puthex(cksum); puts("\n");
if (residual) { if (residual) {
_bcopy((char *)residual, (char *)&hold_residual, sizeof(hold_residual)); _bcopy((char *)residual, (char *)&hold_residual, sizeof(hold_residual));
puts("Residual data at: "); puthex((unsigned long)residual); puts(" "); puts("Residual data at: "); puthex((unsigned long)residual); puts(" ");
puthex((unsigned long)(residual->ResidualLength + residual)); puts("\n"); puthex((unsigned long)((unsigned long)(residual->ResidualLength) + residual)); puts("\n");
puts("Residual data relocated to: "); puthex((unsigned long)&hold_residual); puts("\n");
} }
/* /*
...@@ -487,7 +489,39 @@ decompress_kernel(unsigned long load_addr, int num_words, unsigned long cksum, R ...@@ -487,7 +489,39 @@ decompress_kernel(unsigned long load_addr, int num_words, unsigned long cksum, R
puts(" "); puthex(initrd_end); puts("\n"); puts(" "); puthex(initrd_end); puts("\n");
} }
/* make the moto firmware print something */
CRT_tstc(); /* Forces keyboard to be initialized */
puts("\nLinux/PPC load: ");
timer = 0;
cp = cmd_line;
while (timer++ < 5*1000) {
if (tstc()) {
while ((ch = getc()) != '\n' && ch != '\r') {
if (ch == '\b') {
if (cp != cmd_line) {
cp--;
puts("\b \b");
}
} else {
*cp++ = ch;
putc(ch);
}
}
break; /* Exit 'timer' loop */
}
udelay(1000); /* 1 msec */
}
*cp = 0;
puts("\n");
/* mappings on early boot can only handle 16M */
if ( (int)(&cmd_line[0]) > (16<<20))
puts("cmd_line > 16M\n");
if ( (int)&hold_residual > (16<<20))
puts("hold_residual > 16M\n");
if ( initrd_start > (16<<20))
puts("initrd_start > 16M\n");
puts("Uncompressing Linux..."); puts("Uncompressing Linux...");
method = get_method(0); method = get_method(0);
......
# $Id: config.in,v 1.16 1997/08/11 08:37:49 cort Exp $ # $Id: config.in,v 1.19 1997/09/04 01:54:26 davem Exp $
# For a description of the syntax of this configuration file, # For a description of the syntax of this configuration file,
# see the Configure script. # see the Configure script.
# #
...@@ -8,20 +8,21 @@ mainmenu_option next_comment ...@@ -8,20 +8,21 @@ mainmenu_option next_comment
comment 'Platform support' comment 'Platform support'
define_bool CONFIG_PPC y define_bool CONFIG_PPC y
if [ "`uname`" != "Linux" ]; then if [ "`uname`" != "Linux" -o "`uname -m`" != "ppc" ]; then
define_bool CONFIG_CROSSCOMPILE y define_bool CONFIG_CROSSCOMPILE y
else else
define_bool CONFIG_NATIVE y define_bool CONFIG_NATIVE y
fi fi
bool 'Build PowerMac Kernel (not PReP)?' CONFIG_PMAC bool 'Build PowerMac Kernel (not PReP or CHRP)?' CONFIG_PMAC
bool 'Build PReP Kernel (not PowerMac)?' CONFIG_PREP bool 'Build PReP Kernel (not PowerMac or CHRP)?' CONFIG_PREP
bool 'Build CHRP Kernel (not PReP or PowerMac)?' CONFIG_CHRP
choice 'Processor type' \ choice 'Processor type' \
"Common CONFIG_MCOMMON \ "Common CONFIG_COMMON \
601 CONFIG_M601 \ 601 CONFIG_601 \
603 CONFIG_M603 \ 603 CONFIG_603 \
604 CONFIG_M604" Common 604 CONFIG_604" Common
endmenu endmenu
mainmenu_option next_comment mainmenu_option next_comment
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
# #
# Platform support # Platform support
# #
CONFIG_PPC=y
CONFIG_NATIVE=y CONFIG_NATIVE=y
# CONFIG_PMAC is not set # CONFIG_PMAC is not set
CONFIG_PREP=y CONFIG_PREP=y
...@@ -26,6 +27,7 @@ CONFIG_BINFMT_ELF=y ...@@ -26,6 +27,7 @@ CONFIG_BINFMT_ELF=y
CONFIG_KERNEL_ELF=y CONFIG_KERNEL_ELF=y
# CONFIG_BINFMT_MISC is not set # CONFIG_BINFMT_MISC is not set
# CONFIG_BINFMT_JAVA is not set # CONFIG_BINFMT_JAVA is not set
CONFIG_VGA_CONSOLE=y
# #
# Plug and Play support # Plug and Play support
...@@ -86,10 +88,14 @@ CONFIG_SCSI_CONSTANTS=y ...@@ -86,10 +88,14 @@ CONFIG_SCSI_CONSTANTS=y
# CONFIG_SCSI_FUTURE_DOMAIN is not set # CONFIG_SCSI_FUTURE_DOMAIN is not set
# CONFIG_SCSI_GENERIC_NCR5380 is not set # CONFIG_SCSI_GENERIC_NCR5380 is not set
# CONFIG_SCSI_NCR53C406A is not set # CONFIG_SCSI_NCR53C406A is not set
CONFIG_SCSI_NCR53C7xx=y # CONFIG_SCSI_NCR53C7xx is not set
# CONFIG_SCSI_NCR53C7xx_sync is not set CONFIG_SCSI_NCR53C8XX=y
# CONFIG_SCSI_NCR53C7xx_FAST is not set # CONFIG_SCSI_NCR53C8XX_NVRAM_DETECT is not set
# CONFIG_SCSI_NCR53C7xx_DISCONNECT is not set CONFIG_SCSI_NCR53C8XX_TAGGED_QUEUE=y
CONFIG_SCSI_NCR53C8XX_IOMAPPED=y
CONFIG_SCSI_NCR53C8XX_MAX_TAGS=4
CONFIG_SCSI_NCR53C8XX_SYNC=5
# CONFIG_SCSI_NCR53C8XX_SYMBIOS_COMPAT is not set
# CONFIG_SCSI_PPA is not set # CONFIG_SCSI_PPA is not set
# CONFIG_SCSI_PAS16 is not set # CONFIG_SCSI_PAS16 is not set
# CONFIG_SCSI_QLOGIC_FAS is not set # CONFIG_SCSI_QLOGIC_FAS is not set
...@@ -118,6 +124,7 @@ CONFIG_INET=y ...@@ -118,6 +124,7 @@ CONFIG_INET=y
# CONFIG_IP_ROUTER is not set # CONFIG_IP_ROUTER is not set
# CONFIG_NET_IPIP is not set # CONFIG_NET_IPIP is not set
# CONFIG_SYN_COOKIES is not set # CONFIG_SYN_COOKIES is not set
# CONFIG_XTP is not set
# CONFIG_INET_PCTCP is not set # CONFIG_INET_PCTCP is not set
# CONFIG_INET_RARP is not set # CONFIG_INET_RARP is not set
CONFIG_PATH_MTU_DISCOVERY=y CONFIG_PATH_MTU_DISCOVERY=y
...@@ -146,6 +153,7 @@ CONFIG_EL3=y ...@@ -146,6 +153,7 @@ CONFIG_EL3=y
# CONFIG_VORTEX is not set # CONFIG_VORTEX is not set
CONFIG_LANCE=y CONFIG_LANCE=y
# CONFIG_NET_VENDOR_SMC is not set # CONFIG_NET_VENDOR_SMC is not set
# CONFIG_NET_VENDOR_RACAL is not set
# CONFIG_NET_ISA is not set # CONFIG_NET_ISA is not set
CONFIG_NET_EISA=y CONFIG_NET_EISA=y
CONFIG_PCNET32=y CONFIG_PCNET32=y
...@@ -185,8 +193,8 @@ CONFIG_PPP=y ...@@ -185,8 +193,8 @@ CONFIG_PPP=y
# CONFIG_QUOTA is not set # CONFIG_QUOTA is not set
# CONFIG_MINIX_FS is not set # CONFIG_MINIX_FS is not set
CONFIG_EXT2_FS=y CONFIG_EXT2_FS=y
# CONFIG_FAT_FS is not set CONFIG_FAT_FS=y
# CONFIG_MSDOS_FS is not set CONFIG_MSDOS_FS=y
# CONFIG_VFAT_FS is not set # CONFIG_VFAT_FS is not set
# CONFIG_UMSDOS_FS is not set # CONFIG_UMSDOS_FS is not set
CONFIG_PROC_FS=y CONFIG_PROC_FS=y
...@@ -210,8 +218,14 @@ CONFIG_MAC_PARTITION=y ...@@ -210,8 +218,14 @@ CONFIG_MAC_PARTITION=y
# #
CONFIG_VT=y CONFIG_VT=y
CONFIG_VT_CONSOLE=y CONFIG_VT_CONSOLE=y
# CONFIG_SOFTCURSOR is not set
CONFIG_SERIAL=y CONFIG_SERIAL=y
# CONFIG_SERIAL_EXTENDED is not set CONFIG_SERIAL_EXTENDED=y
# CONFIG_SERIAL_MANY_PORTS is not set
# CONFIG_SERIAL_SHARE_IRQ is not set
# CONFIG_SERIAL_MULTIPORT is not set
# CONFIG_HUB6 is not set
CONFIG_SERIAL_CONSOLE=y
# CONFIG_SERIAL_NONSTANDARD is not set # CONFIG_SERIAL_NONSTANDARD is not set
# CONFIG_PRINTER is not set # CONFIG_PRINTER is not set
CONFIG_MOUSE=y CONFIG_MOUSE=y
...@@ -233,26 +247,4 @@ CONFIG_PSMOUSE=y ...@@ -233,26 +247,4 @@ CONFIG_PSMOUSE=y
# #
# Sound # Sound
# #
#CONFIG_SOUND=y # CONFIG_SOUND is not set
# CONFIG_PAS is not set
# CONFIG_SB is not set
# CONFIG_ADLIB is not set
# CONFIG_GUS is not set
# CONFIG_MPU401 is not set
# CONFIG_PSS is not set
# CONFIG_GUS16 is not set
# CONFIG_GUSMAX is not set
# CONFIG_MSS is not set
# CONFIG_SSCAPE is not set
# CONFIG_TRIX is not set
# CONFIG_MAD16 is not set
CONFIG_CS4232=y
# CONFIG_MAUI is not set
# CONFIG_YM3812 is not set
CS4232_BASE=830
CS4232_IRQ=10
CS4232_DMA=6
CS4232_DMA2=7
CS4232_MPU_BASE=330
CS4232_MPU_IRQ=9
# CONFIG_LOWLEVEL_SOUND is not set
.config
compile.h
.version
.objects
.blurb
*.cort
*.paul
*.old
.defines
version.h
find_name
checks
#*
.objects
.object_files
System.map
asm
.menuconfig*
CVS
ppc_defs.h
mk_defs
mkprep
*.s
.depend
.hdepend
*~
*.o
znetboot
zvmlinux
vmlinux
zImage
hack-coff
coffboot
vmlinux.coff
.depend
.cvsignore
RCS
SCCS
CVS.adm
RCSLOG
cvslog.*
tags
TAGS
.make.state
.nse_depinfo
*~
#*
.#*
,*
_$*
*$
*.old
*.bak
*.BAK
*.orig
*.rej
*.a
*.olb
*.o
*.obj
*.so
*.exe
*.Z
*.elc
*.ln
...@@ -12,20 +12,17 @@ ...@@ -12,20 +12,17 @@
O_TARGET := kernel.o O_TARGET := kernel.o
O_OBJS := misc.o traps.o process.o signal.o syscalls.o \ O_OBJS := misc.o traps.o process.o signal.o syscalls.o \
align.o ptrace.o irq.o bitops.o ppc_htab.o idle.o prom.o \ align.o ptrace.o irq.o openpic.o bitops.o ppc_htab.o idle.o \
time.o prep_time.o pmac_time.o \ time.o prep_time.o pmac_time.o chrp_time.o \
setup.o pmac_setup.o pmac_support.o \ setup.o prep_setup.o pmac_setup.o pmac_support.o chrp_setup.o \
pci.o prep_pci.o pmac_pci.o pci.o prep_pci.o pmac_pci.o chrp_pci.o \
residual.o prom.o
OX_OBJS := ppc_ksyms.o OX_OBJS := ppc_ksyms.o
all: head.o kernel.o all: head.o kernel.o
head.o: head.S $(TOPDIR)/include/linux/tasks.h ppc_defs.h head.o: head.S $(TOPDIR)/include/linux/tasks.h ppc_defs.h
ifeq ($(CONFIG_PREP),y)
O_OBJS += prep_setup.o #prep_time.o
endif
ppc_defs.h: mk_defs.c ppc_defs.head \ ppc_defs.h: mk_defs.c ppc_defs.head \
$(TOPDIR)/include/asm/mmu.h \ $(TOPDIR)/include/asm/mmu.h \
$(TOPDIR)/include/asm/processor.h \ $(TOPDIR)/include/asm/processor.h \
...@@ -37,7 +34,7 @@ ppc_defs.h: mk_defs.c ppc_defs.head \ ...@@ -37,7 +34,7 @@ ppc_defs.h: mk_defs.c ppc_defs.head \
rm mk_defs.s rm mk_defs.s
checks: checks.c checks: checks.c
$(HOSTCC) ${CFLAGS} -o checks checks.c $(HOSTCC) -fno-builtin -I$(TOPDIR)/include -D__KERNEL__ -o checks checks.c
./checks ./checks
include $(TOPDIR)/Rules.make include $(TOPDIR)/Rules.make
/*
* CHRP pci routines.
*/
#include <linux/kernel.h>
#include <linux/pci.h>
#include <linux/bios32.h>
#include <linux/delay.h>
#include <linux/string.h>
#include <linux/init.h>
#include <linux/openpic.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/hydra.h>
/* LongTrail */
#define pci_config_addr(bus, dev, offset) \
(0xfec00000 | ((bus)<<16) | ((dev)<<8) | (offset))
int chrp_pcibios_read_config_byte(unsigned char bus, unsigned char dev_fn,
unsigned char offset, unsigned char *val)
{
if (bus > 7) {
*val = 0xff;
return PCIBIOS_DEVICE_NOT_FOUND;
}
*val = in_8((unsigned char *)pci_config_addr(bus, dev_fn, offset));
if (offset == PCI_INTERRUPT_LINE) {
/* PCI interrupts are controlled by the OpenPIC */
if (*val)
*val = openpic_to_irq(*val);
}
return PCIBIOS_SUCCESSFUL;
}
int chrp_pcibios_read_config_word(unsigned char bus, unsigned char dev_fn,
unsigned char offset, unsigned short *val)
{
if (bus > 7) {
*val = 0xffff;
return PCIBIOS_DEVICE_NOT_FOUND;
}
*val = in_le16((unsigned short *)pci_config_addr(bus, dev_fn, offset));
return PCIBIOS_SUCCESSFUL;
}
int chrp_pcibios_read_config_dword(unsigned char bus, unsigned char dev_fn,
unsigned char offset, unsigned int *val)
{
if (bus > 7) {
*val = 0xffffffff;
return PCIBIOS_DEVICE_NOT_FOUND;
}
*val = in_le32((unsigned int *)pci_config_addr(bus, dev_fn, offset));
return PCIBIOS_SUCCESSFUL;
}
int chrp_pcibios_write_config_byte(unsigned char bus, unsigned char dev_fn,
unsigned char offset, unsigned char val)
{
if (bus > 7)
return PCIBIOS_DEVICE_NOT_FOUND;
out_8((unsigned char *)pci_config_addr(bus, dev_fn, offset), val);
return PCIBIOS_SUCCESSFUL;
}
int chrp_pcibios_write_config_word(unsigned char bus, unsigned char dev_fn,
unsigned char offset, unsigned short val)
{
if (bus > 7)
return PCIBIOS_DEVICE_NOT_FOUND;
out_le16((unsigned short *)pci_config_addr(bus, dev_fn, offset), val);
return PCIBIOS_SUCCESSFUL;
}
int chrp_pcibios_write_config_dword(unsigned char bus, unsigned char dev_fn,
unsigned char offset, unsigned int val)
{
if (bus > 7)
return PCIBIOS_DEVICE_NOT_FOUND;
out_le32((unsigned int *)pci_config_addr(bus, dev_fn, offset), val);
return PCIBIOS_SUCCESSFUL;
}
int chrp_pcibios_find_device(unsigned short vendor, unsigned short dev_id,
unsigned short index, unsigned char *bus_ptr,
unsigned char *dev_fn_ptr)
{
int num, devfn;
unsigned int x, vendev;
if (vendor == 0xffff)
return PCIBIOS_BAD_VENDOR_ID;
vendev = (dev_id << 16) + vendor;
num = 0;
for (devfn = 0; devfn < 32; devfn++) {
chrp_pcibios_read_config_dword(0, devfn<<3, PCI_VENDOR_ID, &x);
if (x == vendev) {
if (index == num) {
*bus_ptr = 0;
*dev_fn_ptr = devfn<<3;
return PCIBIOS_SUCCESSFUL;
}
++num;
}
}
return PCIBIOS_DEVICE_NOT_FOUND;
}
int chrp_pcibios_find_class(unsigned int class_code, unsigned short index,
unsigned char *bus_ptr, unsigned char *dev_fn_ptr)
{
int devnr, x, num;
num = 0;
for (devnr = 0; devnr < 32; devnr++) {
chrp_pcibios_read_config_dword(0, devnr<<3, PCI_CLASS_REVISION, &x);
if ((x>>8) == class_code) {
if (index == num) {
*bus_ptr = 0;
*dev_fn_ptr = devnr<<3;
return PCIBIOS_SUCCESSFUL;
}
++num;
}
}
return PCIBIOS_DEVICE_NOT_FOUND;
}
__initfunc(volatile struct Hydra *find_hydra(void))
{
u_char bus, dev;
volatile struct Hydra *hydra = 0;
if (chrp_pcibios_find_device(PCI_VENDOR_ID_APPLE,
PCI_DEVICE_ID_APPLE_HYDRA, 0, &bus, &dev)
== PCIBIOS_SUCCESSFUL)
chrp_pcibios_read_config_dword(bus, dev, PCI_BASE_ADDRESS_0,
(unsigned int *)&hydra);
return hydra;
}
__initfunc(void hydra_post_openpic_init(void))
{
openpic_set_sense(HYDRA_INT_SCSI_DMA, 0);
openpic_set_sense(HYDRA_INT_SCCA_TX_DMA, 0);
openpic_set_sense(HYDRA_INT_SCCA_RX_DMA, 0);
openpic_set_sense(HYDRA_INT_SCCB_TX_DMA, 0);
openpic_set_sense(HYDRA_INT_SCCB_RX_DMA, 0);
openpic_set_sense(HYDRA_INT_SCSI, 1);
openpic_set_sense(HYDRA_INT_SCCA, 1);
openpic_set_sense(HYDRA_INT_SCCB, 1);
openpic_set_sense(HYDRA_INT_VIA, 1);
openpic_set_sense(HYDRA_INT_ADB, 1);
openpic_set_sense(HYDRA_INT_ADB_NMI, 0);
}
/*
* linux/arch/ppc/kernel/setup.c
*
* Copyright (C) 1995 Linus Torvalds
* Adapted from 'alpha' version by Gary Thomas
* Modified by Cort Dougan (cort@cs.nmt.edu)
*/
/*
* bootup setup stuff..
*/
#include <linux/config.h>
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/stddef.h>
#include <linux/unistd.h>
#include <linux/ptrace.h>
#include <linux/malloc.h>
#include <linux/user.h>
#include <linux/a.out.h>
#include <linux/tty.h>
#include <linux/major.h>
#include <linux/interrupt.h>
#include <linux/reboot.h>
#include <linux/init.h>
#include <linux/blk.h>
#include <linux/ioport.h>
#include <asm/mmu.h>
#include <asm/processor.h>
#include <asm/io.h>
#include <asm/pgtable.h>
/* for the mac fs */
kdev_t boot_dev;
extern PTE *Hash, *Hash_end;
extern unsigned long Hash_size, Hash_mask;
extern int probingmem;
extern unsigned long loops_per_sec;
unsigned long empty_zero_page[1024];
extern unsigned char aux_device_present;
#ifdef CONFIG_BLK_DEV_RAM
extern int rd_doload; /* 1 = load ramdisk, 0 = don't load */
extern int rd_prompt; /* 1 = prompt for ramdisk, 0 = don't prompt */
extern int rd_image_start; /* starting block # of image */
#endif
extern char saved_command_line[256];
long TotalMemory;
int
chrp_get_cpuinfo(char *buffer)
{
int pvr = _get_PVR();
int len;
char *model;
switch (pvr>>16)
{
case 1:
model = "601";
break;
case 3:
model = "603";
break;
case 4:
model = "604";
break;
case 6:
model = "603e";
break;
case 7:
model = "603ev";
break;
case 9:
model = "604e";
break;
default:
model = "unknown";
break;
}
len = sprintf(buffer, "PowerPC %s rev %d.%d\n", model,
(pvr & 0xff00) >> 8, pvr & 0xff);
len += sprintf(buffer+len, "bogomips\t: %lu.%02lu\n",
(loops_per_sec+2500)/500000,
((loops_per_sec+2500)/5000) % 100);
#if 0
/*
* Ooh's and aah's info about zero'd pages in idle task
*/
{
extern unsigned int zerocount, zerototal, zeropage_hits,zeropage_calls;
len += sprintf(buffer+len,"zero pages\t: total %u (%uKb) "
"current: %u (%uKb) hits: %u/%u (%lu%%)\n",
zerototal, (zerototal*PAGE_SIZE)>>10,
zerocount, (zerocount*PAGE_SIZE)>>10,
zeropage_hits,zeropage_calls,
/* : 1 below is so we don't div by zero */
(zeropage_hits*100) /
((zeropage_calls)?zeropage_calls:1));
}
#endif
return len;
}
__initfunc(void
chrp_setup_arch(char **cmdline_p, unsigned long * memory_start_p,
unsigned long * memory_end_p))
{
extern char cmd_line[];
extern char _etext[], _edata[], _end[];
extern int panic_timeout;
/* Save unparsed command line copy for /proc/cmdline */
strcpy( saved_command_line, cmd_line );
*cmdline_p = cmd_line;
*memory_start_p = (unsigned long) Hash+Hash_size;
(unsigned long *)*memory_end_p = (unsigned long *)(TotalMemory+KERNELBASE);
/* init to some ~sane value until calibrate_delay() runs */
loops_per_sec = 50000000;
/* reboot on panic */
panic_timeout = 180;
init_task.mm->start_code = PAGE_OFFSET;
init_task.mm->end_code = (unsigned long) _etext;
init_task.mm->end_data = (unsigned long) _edata;
init_task.mm->brk = (unsigned long) _end;
aux_device_present = 0xaa;
switch ( _machine )
{
case _MACH_chrp:
ROOT_DEV = to_kdev_t(0x0801); /* sda1 */
break;
}
#ifdef CONFIG_BLK_DEV_RAM
#if 0
ROOT_DEV = to_kdev_t(0x0200); /* floppy */
rd_prompt = 1;
rd_doload = 1;
rd_image_start = 0;
#endif
/* initrd_start and size are setup by boot/head.S and kernel/head.S */
if ( initrd_start )
{
if (initrd_end > *memory_end_p)
{
printk("initrd extends beyond end of memory "
"(0x%08lx > 0x%08lx)\ndisabling initrd\n",
initrd_end,*memory_end_p);
initrd_start = 0;
}
}
#endif
printk("Boot arguments: %s\n", cmd_line);
request_region(0x20,0x20,"pic1");
request_region(0xa0,0x20,"pic2");
request_region(0x00,0x20,"dma1");
request_region(0x40,0x20,"timer");
request_region(0x80,0x10,"dma page reg");
request_region(0xc0,0x20,"dma2");
}
/*
* linux/arch/i386/kernel/time.c
*
* Copyright (C) 1991, 1992, 1995 Linus Torvalds
*
* Adapted for PowerPC (PreP) by Gary Thomas
* Modified by Cort Dougan (cort@cs.nmt.edu)
* copied and modified from intel version
*
*/
#include <linux/config.h>
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/param.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/interrupt.h>
#include <linux/timex.h>
#include <linux/kernel_stat.h>
#include <linux/mc146818rtc.h>
#include <asm/segment.h>
#include <asm/io.h>
#include <asm/processor.h>
#include <asm/nvram.h>
#include "time.h"
int chrp_cmos_clock_read(int addr)
{
outb(addr>>8, NVRAM_AS1);
outb(addr, NVRAM_AS0);
return (inb(NVRAM_DATA));
}
void chrp_cmos_clock_write(unsigned long val, int addr)
{
outb(addr>>8, NVRAM_AS1);
outb(addr, NVRAM_AS0);
outb(val,NVRAM_DATA);
return;
}
/*
* Set the hardware clock. -- Cort
*/
int chrp_set_rtc_time(unsigned long nowtime)
{
unsigned char save_control, save_freq_select;
struct rtc_time tm;
to_tm(nowtime, &tm);
save_control = chrp_cmos_clock_read(RTC_CONTROL); /* tell the clock it's being set */
chrp_cmos_clock_write((save_control|RTC_SET), RTC_CONTROL);
save_freq_select = chrp_cmos_clock_read(RTC_FREQ_SELECT); /* stop and reset prescaler */
chrp_cmos_clock_write((save_freq_select|RTC_DIV_RESET2), RTC_FREQ_SELECT);
tm.tm_year -= 1900;
if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
BIN_TO_BCD(tm.tm_sec);
BIN_TO_BCD(tm.tm_min);
BIN_TO_BCD(tm.tm_hour);
BIN_TO_BCD(tm.tm_mon);
BIN_TO_BCD(tm.tm_mday);
BIN_TO_BCD(tm.tm_year);
}
chrp_cmos_clock_write(tm.tm_sec,RTC_SECONDS);
chrp_cmos_clock_write(tm.tm_min,RTC_MINUTES);
chrp_cmos_clock_write(tm.tm_hour,RTC_HOURS);
chrp_cmos_clock_write(tm.tm_mon,RTC_MONTH);
chrp_cmos_clock_write(tm.tm_mday,RTC_DAY_OF_MONTH);
chrp_cmos_clock_write(tm.tm_year,RTC_YEAR);
/* The following flags have to be released exactly in this order,
* otherwise the DS12887 (popular MC146818A clone with integrated
* battery and quartz) will not reset the oscillator and will not
* update precisely 500 ms later. You won't find this mentioned in
* the Dallas Semiconductor data sheets, but who believes data
* sheets anyway ... -- Markus Kuhn
*/
chrp_cmos_clock_write(save_control, RTC_CONTROL);
chrp_cmos_clock_write(save_freq_select, RTC_FREQ_SELECT);
if ( (time_state == TIME_ERROR) || (time_state == TIME_BAD) )
time_state = TIME_OK;
return 0;
}
unsigned long chrp_get_rtc_time(void)
{
unsigned int year, mon, day, hour, min, sec;
int i;
/* The Linux interpretation of the CMOS clock register contents:
* When the Update-In-Progress (UIP) flag goes from 1 to 0, the
* RTC registers show the second which has precisely just started.
* Let's hope other operating systems interpret the RTC the same way.
*/
/* read RTC exactly on falling edge of update flag */
for (i = 0 ; i < 1000000 ; i++) /* may take up to 1 second... */
if (chrp_cmos_clock_read(RTC_FREQ_SELECT) & RTC_UIP)
break;
for (i = 0 ; i < 1000000 ; i++) /* must try at least 2.228 ms */
if (!(chrp_cmos_clock_read(RTC_FREQ_SELECT) & RTC_UIP))
break;
do { /* Isn't this overkill ? UIP above should guarantee consistency */
sec = chrp_cmos_clock_read(RTC_SECONDS);
min = chrp_cmos_clock_read(RTC_MINUTES);
hour = chrp_cmos_clock_read(RTC_HOURS);
day = chrp_cmos_clock_read(RTC_DAY_OF_MONTH);
mon = chrp_cmos_clock_read(RTC_MONTH);
year = chrp_cmos_clock_read(RTC_YEAR);
} while (sec != chrp_cmos_clock_read(RTC_SECONDS));
if (!(chrp_cmos_clock_read(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD)
{
BCD_TO_BIN(sec);
BCD_TO_BIN(min);
BCD_TO_BIN(hour);
BCD_TO_BIN(day);
BCD_TO_BIN(mon);
BCD_TO_BIN(year);
}
if ((year += 1900) < 1970)
year += 100;
return mktime(year, mon, day, hour, min, sec);
}
...@@ -175,36 +175,27 @@ __start: ...@@ -175,36 +175,27 @@ __start:
* Use the first pair of BAT registers to map the 1st 16MB * Use the first pair of BAT registers to map the 1st 16MB
* of RAM to KERNELBASE. * of RAM to KERNELBASE.
*/ */
mfspr r9,PVR mfspr r9,PVR
rlwinm r9,r9,16,16,31 /* r9 = 1 for 601, 4 for 604 */ rlwinm r9,r9,16,16,31 /* r9 = 1 for 601, 4 for 604 */
cmpi 0,r9,1 cmpi 0,r9,1
lis r11,KERNELBASE@h lis r11,KERNELBASE@h
bne 4f bne 4f
ori r11,r11,4 /* set up BAT registers for 601 */ ori r11,r11,4 /* set up BAT registers for 601 */
li r8,0x7f li r8,0x7f
oris r9,r11,0x800000@h /* set up BAT reg for 2nd 8M */ ori r11,r11,4 /* set up BAT registers for 601 */
oris r10,r8,0x800000@h /* set up BAT reg for 2nd 8M */ li r8,0x7f
mtspr IBAT1U,r9 oris r9,r11,0x800000@h /* set up BAT reg for 2nd 8M */
mtspr IBAT1L,r10 oris r10,r8,0x800000@h /* set up BAT reg for 2nd 8M */
b 5f mtspr IBAT1U,r9
4: ori r11,r11,0x1ff /* set up BAT registers for 604 */ mtspr IBAT1L,r10
li r8,2 b 5f
mtspr DBAT0U,r11 4: ori r11,r11,0x1ff /* set up BAT registers for 604 */
mtspr DBAT0L,r8 li r8,2
5: mtspr IBAT0U,r11 mtspr DBAT0U,r11
mtspr IBAT0L,r8 mtspr DBAT0L,r8
isync 5: mtspr IBAT0U,r11
mtspr IBAT0L,r8
#if 0 isync
/*
* Now we have the 1st 8M of RAM mapped at KERNELBASE, so we can
* refer to addresses of data items, procedures, etc. normally.
*/
lis r10,start_here@ha /* jump up to our copy at KERNELBASE */
addi r10,r10,start_here@l
mtlr r10
blr
#endif
/* /*
* we now have the 1st 16M of ram mapped with the bats. * we now have the 1st 16M of ram mapped with the bats.
* prep needs the mmu to be turned on here, but pmac already has it on. * prep needs the mmu to be turned on here, but pmac already has it on.
...@@ -220,7 +211,6 @@ __start: ...@@ -220,7 +211,6 @@ __start:
SYNC SYNC
rfi /* enables MMU */ rfi /* enables MMU */
/* /*
* GCC sometimes accesses words at negative offsets from the stack * GCC sometimes accesses words at negative offsets from the stack
* pointer, although the SysV ABI says it shouldn't. To cope with * pointer, although the SysV ABI says it shouldn't. To cope with
...@@ -834,15 +824,13 @@ start_here: ...@@ -834,15 +824,13 @@ start_here:
bne 3f /* don't invalidate the D-cache */ bne 3f /* don't invalidate the D-cache */
ori r8,r8,HID0_DCI /* unless it wasn't enabled */ ori r8,r8,HID0_DCI /* unless it wasn't enabled */
3: 3:
/* I haven't tested this yet so it's off now - Cort */
/* turn on dpm for 603 */ /* turn on dpm for 603 */
cmpi 0,r9,3 cmpi 0,r9,3
bne 10f bne 10f
oris r11,r11,HID0_DPM@h oris r11,r11,HID0_DPM@h
10: 10:
sync sync
mtspr HID0,r8 /* enable and invalidate caches */ mtspr HID0,r8 /* enable and invalidate caches */
sync
mtspr HID0,r11 /* enable caches */ mtspr HID0,r11 /* enable caches */
sync sync
isync isync
...@@ -954,6 +942,30 @@ start_here: ...@@ -954,6 +942,30 @@ start_here:
mtspr SRR1,r4 mtspr SRR1,r4
rfi /* enable MMU and jump to start_kernel */ rfi /* enable MMU and jump to start_kernel */
.globl reset_SDR1
reset_SDR1:
lis r6,_SDR1@ha
lwz r6,_SDR1@l(r6)
mfmsr r3
li r4,MSR_IR|MSR_DR
andc r3,r3,r4
lis r4,2f@h
addis r4,r4,-KERNELBASE@h
ori r4,r4,2f@l
mtspr SRR0,r4
mtspr SRR1,r3
rfi
2: /* load new SDR1 */
tlbia
mtspr SDR1,r6
/* turn the mmu back on */
li r4,MSR_KERNEL
mflr r3
mtspr SRR0,r3
mtspr SRR1,r4
rfi
/* /*
* FP unavailable trap from kernel - print a message, but let * FP unavailable trap from kernel - print a message, but let
* the task use FP in the kernel until it returns to user mode. * the task use FP in the kernel until it returns to user mode.
......
/* /*
* $Id: idle.c,v 1.3 1997/08/10 04:49:08 davem Exp $ * $Id: idle.c,v 1.4 1997/08/23 22:46:01 cort Exp $
* *
* Idle daemon for PowerPC. Idle daemon will handle any action * Idle daemon for PowerPC. Idle daemon will handle any action
* that needs to be taken when the system becomes idle. * that needs to be taken when the system becomes idle.
...@@ -276,3 +276,4 @@ int power_saved(void *unused) ...@@ -276,3 +276,4 @@ int power_saved(void *unused)
schedule(); schedule();
} }
} }
...@@ -28,18 +28,30 @@ ...@@ -28,18 +28,30 @@
#include <linux/config.h> #include <linux/config.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/malloc.h> #include <linux/malloc.h>
#include <linux/openpic.h>
#include <linux/pci.h>
#include <linux/bios32.h>
#include <linux/openpic.h>
#include <asm/hydra.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/bitops.h> #include <asm/bitops.h>
#undef SHOW_IRQ #undef SHOW_IRQ
#define OPENPIC_DEBUG
unsigned lost_interrupts = 0; unsigned lost_interrupts = 0;
unsigned int local_irq_count[NR_CPUS]; unsigned int local_irq_count[NR_CPUS];
static struct irqaction irq_action[32]; static struct irqaction irq_action[NR_IRQS];
static int spurious_interrupts = 0;
int __ppc_bh_counter;
static unsigned int cached_irq_mask = 0xffffffff;
static void no_action(int cpl, void *dev_id, struct pt_regs *regs) { }
#define cached_21 (((char *)(&cached_irq_mask))[3])
#define cached_A1 (((char *)(&cached_irq_mask))[2])
/* /*
* These are set to the appropriate functions by init_IRQ() * These are set to the appropriate functions by init_IRQ()
...@@ -47,11 +59,6 @@ static struct irqaction irq_action[32]; ...@@ -47,11 +59,6 @@ static struct irqaction irq_action[32];
void (*mask_and_ack_irq)(int irq_nr); void (*mask_and_ack_irq)(int irq_nr);
void (*set_irq_mask)(int irq_nr); void (*set_irq_mask)(int irq_nr);
static unsigned int cached_irq_mask = 0xffffffff;
#define cached_21 (((char *)(&cached_irq_mask))[3])
#define cached_A1 (((char *)(&cached_irq_mask))[2])
static void no_action(int cpl, void *dev_id, struct pt_regs *regs) { }
int __ppc_bh_counter;
/* prep */ /* prep */
#define PREP_IRQ_MASK (((unsigned int)cached_A1)<<8) | (unsigned int)cached_21 #define PREP_IRQ_MASK (((unsigned int)cached_A1)<<8) | (unsigned int)cached_21
...@@ -65,7 +72,10 @@ extern unsigned long route_pci_interrupts(void); ...@@ -65,7 +72,10 @@ extern unsigned long route_pci_interrupts(void);
#define KEYBOARD_IRQ 20 /* irq number for command-power interrupt */ #define KEYBOARD_IRQ 20 /* irq number for command-power interrupt */
#define PMAC_IRQ_MASK (~ld_le32(IRQ_ENABLE)) #define PMAC_IRQ_MASK (~ld_le32(IRQ_ENABLE))
void prep_mask_and_ack_irq(int irq_nr) /* chrp */
volatile struct Hydra *Hydra = NULL;
void i8259_mask_and_ack_irq(int irq_nr)
{ {
spin_lock(&irq_controller_lock); spin_lock(&irq_controller_lock);
cached_irq_mask |= 1 << irq_nr; cached_irq_mask |= 1 << irq_nr;
...@@ -94,7 +104,16 @@ void pmac_mask_and_ack_irq(int irq_nr) ...@@ -94,7 +104,16 @@ void pmac_mask_and_ack_irq(int irq_nr)
spin_unlock(&irq_controller_lock); spin_unlock(&irq_controller_lock);
} }
void prep_set_irq_mask(int irq_nr) void chrp_mask_and_ack_irq(int irq_nr)
{
/* spinlocks are done by i8259_mask_and_ack() - Cort */
if (is_8259_irq(irq_nr))
i8259_mask_and_ack_irq(irq_nr);
openpic_eoi(0);
}
void i8259_set_irq_mask(int irq_nr)
{ {
if (irq_nr > 7) { if (irq_nr > 7) {
outb(cached_A1,0xA1); outb(cached_A1,0xA1);
...@@ -116,6 +135,21 @@ void pmac_set_irq_mask(int irq_nr) ...@@ -116,6 +135,21 @@ void pmac_set_irq_mask(int irq_nr)
lost_interrupts |= (1UL<<irq_nr); lost_interrupts |= (1UL<<irq_nr);
} }
void chrp_set_irq_mask(int irq_nr)
{
if (is_8259_irq(irq_nr)) {
i8259_set_irq_mask(irq_nr);
} else
{
/* disable? */
if ( cached_irq_mask & (1UL<<irq_nr) )
openpic_disable_irq(irq_to_openpic(irq_nr));
/* enable */
else
openpic_disable_irq(irq_to_openpic(irq_nr));
}
}
/* /*
* These have to be protected by the spinlock * These have to be protected by the spinlock
* before being called. * before being called.
...@@ -171,6 +205,8 @@ int get_irq_list(char *buf) ...@@ -171,6 +205,8 @@ int get_irq_list(char *buf)
len+=sprintf(buf+len, "IPI: %8lu received\n", len+=sprintf(buf+len, "IPI: %8lu received\n",
ipi_count); ipi_count);
#endif #endif
len += sprintf(buf+len, "99: %10u spurious or short\n",
spurious_interrupts);
return len; return len;
} }
...@@ -184,13 +220,56 @@ asmlinkage void do_IRQ(struct pt_regs *regs) ...@@ -184,13 +220,56 @@ asmlinkage void do_IRQ(struct pt_regs *regs)
hardirq_enter(cpu); hardirq_enter(cpu);
if ( _machine == _MACH_Pmac )
/*
* I'll put this ugly mess of code into a function
* such as get_pending_irq() or some such clear thing
* so we don't have a switch in the irq code and
* the chrp code is merged a bit with the prep.
* -- Cort
*/
switch ( _machine )
{ {
case _MACH_Pmac:
bits = ld_le32(IRQ_FLAG) | lost_interrupts; bits = ld_le32(IRQ_FLAG) | lost_interrupts;
lost_interrupts = 0; lost_interrupts = 0;
} for (irq = NR_IRQS - 1; irq >= 0; --irq)
else /* prep */ if (bits & (1U << irq))
{ break;
break;
case _MACH_chrp:
irq = openpic_irq(0);
if (irq == IRQ_8259_CASCADE)
{
/*
* This magic address generates a PCI IACK cycle.
*
* This should go in the above mask/ack code soon. -- Cort
*/
irq = (*(volatile unsigned char *)0xfec80000) & 0x0f;
}
else if (irq >= 64)
{
/*
* OpenPIC interrupts >64 will be used for other purposes
* like interprocessor interrupts and hardware errors
*/
#ifdef OPENPIC_DEBUG
printk("OpenPIC interrupt %d\n", irq);
#endif
if (irq==99)
spurious_interrupts++;
}
else {
/*
* Here we should process IPI timer
* for now the interrupt is dismissed.
*/
goto out;
}
break;
case _MACH_IBM:
case _MACH_Motorola:
#if 1 #if 1
outb(0x0C, 0x20); outb(0x0C, 0x20);
irq = inb(0x20) & 7; irq = inb(0x20) & 7;
...@@ -221,13 +300,10 @@ asmlinkage void do_IRQ(struct pt_regs *regs) ...@@ -221,13 +300,10 @@ asmlinkage void do_IRQ(struct pt_regs *regs)
} }
/* ignore masked irqs */ /* ignore masked irqs */
bits &= ~cached_irq_mask; bits &= ~cached_irq_mask;
#endif #endif
break;
} }
for (irq = NR_IRQS - 1; irq >= 0; --irq)
if (bits & (1U << irq))
break;
if (irq < 0) { if (irq < 0) {
printk("Bogus interrupt from PC = %lx\n", regs->nip); printk("Bogus interrupt from PC = %lx\n", regs->nip);
goto out; goto out;
...@@ -238,12 +314,12 @@ asmlinkage void do_IRQ(struct pt_regs *regs) ...@@ -238,12 +314,12 @@ asmlinkage void do_IRQ(struct pt_regs *regs)
status = 0; status = 0;
action = irq_action + irq; action = irq_action + irq;
kstat.interrupts[irq]++; kstat.interrupts[irq]++;
if ( action ) if ( action && action->handler)
{ {
if (!(action->flags & SA_INTERRUPT)) if (!(action->flags & SA_INTERRUPT))
__sti(); __sti();
status |= action->flags; status |= action->flags;
action->handler(irq, action->dev_id, regs); action->handler(irq, action->dev_id, regs);
/*if (status & SA_SAMPLE_RANDOM) /*if (status & SA_SAMPLE_RANDOM)
add_interrupt_randomness(irq);*/ add_interrupt_randomness(irq);*/
__cli(); /* in case the handler turned them on */ __cli(); /* in case the handler turned them on */
...@@ -251,11 +327,13 @@ asmlinkage void do_IRQ(struct pt_regs *regs) ...@@ -251,11 +327,13 @@ asmlinkage void do_IRQ(struct pt_regs *regs)
unmask_irq(irq); unmask_irq(irq);
spin_unlock(&irq_controller_lock); spin_unlock(&irq_controller_lock);
} else { } else {
if ( irq == 7 ) /* i8259 gives us irq 7 on 'short' intrs */
spurious_interrupts++;
disable_irq( irq ); disable_irq( irq );
} }
/* make sure we don't miss any cascade intrs due to eoi-ing irq 2 */ /* make sure we don't miss any cascade intrs due to eoi-ing irq 2 */
if ( (_machine != _MACH_Pmac)/*prep*/ && (irq > 7) ) if ( is_prep && (irq > 7) )
goto retry_cascade; goto retry_cascade;
/* do_bottom_half is called if necessary from int_return in head.S */ /* do_bottom_half is called if necessary from int_return in head.S */
out: out:
...@@ -329,12 +407,37 @@ int probe_irq_off (unsigned long irqs) ...@@ -329,12 +407,37 @@ int probe_irq_off (unsigned long irqs)
return 0; return 0;
} }
__initfunc(static void i8259_init(void))
{
/* init master interrupt controller */
outb(0x11, 0x20); /* Start init sequence */
outb(0x40, 0x21); /* Vector base */
/*outb(0x04, 0x21);*/ /* edge tiggered, Cascade (slave) on IRQ2 */
outb(0x0C, 0x21); /* level triggered, Cascade (slave) on IRQ2 */
outb(0x01, 0x21); /* Select 8086 mode */
outb(0xFF, 0x21); /* Mask all */
/* init slave interrupt controller */
outb(0x11, 0xA0); /* Start init sequence */
outb(0x48, 0xA1); /* Vector base */
/*outb(0x02, 0xA1);*/ /* edge triggered, Cascade (slave) on IRQ2 */
outb(0x0A, 0x21); /* level triggered, Cascade (slave) on IRQ2 */
outb(0x01, 0xA1); /* Select 8086 mode */
outb(0xFF, 0xA1); /* Mask all */
outb(cached_A1, 0xA1);
outb(cached_21, 0x21);
if (request_irq(2, no_action, SA_INTERRUPT, "cascade", NULL) != 0)
panic("Could not allocate cascade IRQ!");
enable_irq(2); /* Enable cascade interrupt */
}
__initfunc(void init_IRQ(void)) __initfunc(void init_IRQ(void))
{ {
extern void xmon_irq(int, void *, struct pt_regs *); extern void xmon_irq(int, void *, struct pt_regs *);
if ( _machine == _MACH_Pmac ) switch (_machine)
{ {
case _MACH_Pmac:
mask_and_ack_irq = pmac_mask_and_ack_irq; mask_and_ack_irq = pmac_mask_and_ack_irq;
set_irq_mask = pmac_set_irq_mask; set_irq_mask = pmac_set_irq_mask;
...@@ -342,28 +445,14 @@ __initfunc(void init_IRQ(void)) ...@@ -342,28 +445,14 @@ __initfunc(void init_IRQ(void))
#ifdef CONFIG_XMON #ifdef CONFIG_XMON
request_irq(KEYBOARD_IRQ, xmon_irq, 0, "NMI", 0); request_irq(KEYBOARD_IRQ, xmon_irq, 0, "NMI", 0);
#endif /* CONFIG_XMON */ #endif /* CONFIG_XMON */
} break;
else /* prep */ case _MACH_Motorola:
{ case _MACH_IBM:
mask_and_ack_irq = prep_mask_and_ack_irq; mask_and_ack_irq = i8259_mask_and_ack_irq;
set_irq_mask = prep_set_irq_mask; set_irq_mask = i8259_set_irq_mask;
/* init master interrupt controller */ i8259_init();
outb(0x11, 0x20); /* Start init sequence */ route_pci_interrupts();
outb(0x40, 0x21); /* Vector base */
/*outb(0x04, 0x21);*/ /* edge tiggered, Cascade (slave) on IRQ2 */
outb(0x0C, 0x21); /* level triggered, Cascade (slave) on IRQ2 */
outb(0x01, 0x21); /* Select 8086 mode */
outb(0xFF, 0x21); /* Mask all */
/* init slave interrupt controller */
outb(0x11, 0xA0); /* Start init sequence */
outb(0x48, 0xA1); /* Vector base */
/*outb(0x02, 0xA1);*/ /* edge triggered, Cascade (slave) on IRQ2 */
outb(0x0A, 0x21); /* level triggered, Cascade (slave) on IRQ2 */
outb(0x01, 0xA1); /* Select 8086 mode */
outb(0xFF, 0xA1); /* Mask all */
/* /*
* According to the Carolina spec from ibm irq's 0,1,2, and 8 * According to the Carolina spec from ibm irq's 0,1,2, and 8
* must be edge triggered. Also, the pci intrs must be level * must be edge triggered. Also, the pci intrs must be level
...@@ -389,17 +478,40 @@ __initfunc(void init_IRQ(void)) ...@@ -389,17 +478,40 @@ __initfunc(void init_IRQ(void))
* Sound on the Powerstack reportedly needs to be edge triggered * Sound on the Powerstack reportedly needs to be edge triggered
*/ */
if ( _machine == _MACH_Motorola ) if ( _machine == _MACH_Motorola )
{} {
/*irq_mode2 &= ~0x04L;
outb( irq_mode1 , 0x4d0 );
outb( irq_mode2 , 0x4d1 );*/
}
/*outb( irq_mode1 , 0x4d0 );
outb( irq_mode2 , 0x4d1 );*/
} }
outb(cached_A1, 0xA1); break;
outb(cached_21, 0x21); case _MACH_chrp:
if (request_irq(2, no_action, SA_INTERRUPT, "cascade", NULL) != 0) mask_and_ack_irq = chrp_mask_and_ack_irq;
panic("Could not allocate cascade IRQ!"); set_irq_mask = chrp_set_irq_mask;
enable_irq(2); /* Enable cascade interrupt */ if ((Hydra = find_hydra())) {
printk("Hydra Mac I/O at %p\n", Hydra);
route_pci_interrupts(); out_le32(&Hydra->Feature_Control, HYDRA_FC_SCC_CELL_EN |
HYDRA_FC_SCSI_CELL_EN |
HYDRA_FC_SCCA_ENABLE |
HYDRA_FC_SCCB_ENABLE |
HYDRA_FC_ARB_BYPASS |
HYDRA_FC_MPIC_ENABLE |
HYDRA_FC_SLOW_SCC_PCLK |
HYDRA_FC_MPIC_IS_MASTER);
OpenPIC = (volatile struct OpenPIC *)&Hydra->OpenPIC;
} else if (!OpenPIC /* && find_xxx */) {
printk("Unknown openpic implementation\n");
/* other OpenPIC implementations */
/* ... */
}
if (OpenPIC)
openpic_init();
else
panic("No OpenPIC found");
if (Hydra)
hydra_post_openpic_init();
i8259_init();
break;
} }
} }
This diff is collapsed.
/* /*
* $Id: pci.c,v 1.11 1997/08/13 03:06:14 cort Exp $ * $Id: pci.c,v 1.12 1997/08/27 05:05:28 cort Exp $
* Common pmac/prep pci routines. -- Cort * Common pmac/prep/chrp pci routines. -- Cort
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <asm/pci-bridge.h> #include <asm/pci-bridge.h>
unsigned long io_base; unsigned long io_base;
unsigned long pci_dram_offset;
/* /*
* It would be nice if we could create a include/asm/pci.h and have just * It would be nice if we could create a include/asm/pci.h and have just
...@@ -63,6 +64,24 @@ extern int pmac_pcibios_find_device(unsigned short vendor, unsigned short dev_id ...@@ -63,6 +64,24 @@ extern int pmac_pcibios_find_device(unsigned short vendor, unsigned short dev_id
extern int pmac_pcibios_find_class(unsigned int class_code, unsigned short index, extern int pmac_pcibios_find_class(unsigned int class_code, unsigned short index,
unsigned char *bus_ptr, unsigned char *dev_fn_ptr); unsigned char *bus_ptr, unsigned char *dev_fn_ptr);
extern int chrp_pcibios_read_config_byte(unsigned char bus, unsigned char dev_fn,
unsigned char offset, unsigned char *val);
extern int chrp_pcibios_read_config_word(unsigned char bus, unsigned char dev_fn,
unsigned char offset, unsigned short *val);
extern int chrp_pcibios_read_config_dword(unsigned char bus, unsigned char dev_fn,
unsigned char offset, unsigned int *val);
extern int chrp_pcibios_write_config_byte(unsigned char bus, unsigned char dev_fn,
unsigned char offset, unsigned char val);
extern int chrp_pcibios_write_config_word(unsigned char bus, unsigned char dev_fn,
unsigned char offset, unsigned short val);
extern int chrp_pcibios_write_config_dword(unsigned char bus, unsigned char dev_fn,
unsigned char offset, unsigned int val);
extern int chrp_pcibios_find_device(unsigned short vendor, unsigned short dev_id,
unsigned short index, unsigned char *bus_ptr,
unsigned char *dev_fn_ptr);
extern int chrp_pcibios_find_class(unsigned int class_code, unsigned short index,
unsigned char *bus_ptr, unsigned char *dev_fn_ptr);
extern int prep_pcibios_read_config_byte(unsigned char bus, unsigned char dev_fn, extern int prep_pcibios_read_config_byte(unsigned char bus, unsigned char dev_fn,
unsigned char offset, unsigned char *val); unsigned char offset, unsigned char *val);
extern int prep_pcibios_read_config_word(unsigned char bus, unsigned char dev_fn, extern int prep_pcibios_read_config_word(unsigned char bus, unsigned char dev_fn,
...@@ -132,19 +151,9 @@ int pcibios_present(void) ...@@ -132,19 +151,9 @@ int pcibios_present(void)
__initfunc(unsigned long __initfunc(unsigned long
pcibios_init(unsigned long mem_start,unsigned long mem_end)) pcibios_init(unsigned long mem_start,unsigned long mem_end))
{ {
if ( _machine == _MACH_Pmac ) switch (_machine) {
{ case _MACH_Motorola:
ptr_pcibios_read_config_byte = pmac_pcibios_read_config_byte; case _MACH_IBM:
ptr_pcibios_read_config_word = pmac_pcibios_read_config_word;
ptr_pcibios_read_config_dword = pmac_pcibios_read_config_dword;
ptr_pcibios_write_config_byte = pmac_pcibios_write_config_byte;
ptr_pcibios_write_config_word = pmac_pcibios_write_config_word;
ptr_pcibios_write_config_dword = pmac_pcibios_write_config_dword;
ptr_pcibios_find_device = pmac_pcibios_find_device;
ptr_pcibios_find_class = pmac_pcibios_find_class;
}
else /* prep */
{
ptr_pcibios_read_config_byte = prep_pcibios_read_config_byte; ptr_pcibios_read_config_byte = prep_pcibios_read_config_byte;
ptr_pcibios_read_config_word = prep_pcibios_read_config_word; ptr_pcibios_read_config_word = prep_pcibios_read_config_word;
ptr_pcibios_read_config_dword = prep_pcibios_read_config_dword; ptr_pcibios_read_config_dword = prep_pcibios_read_config_dword;
...@@ -153,6 +162,27 @@ pcibios_init(unsigned long mem_start,unsigned long mem_end)) ...@@ -153,6 +162,27 @@ pcibios_init(unsigned long mem_start,unsigned long mem_end))
ptr_pcibios_write_config_dword = prep_pcibios_write_config_dword; ptr_pcibios_write_config_dword = prep_pcibios_write_config_dword;
ptr_pcibios_find_device = prep_pcibios_find_device; ptr_pcibios_find_device = prep_pcibios_find_device;
ptr_pcibios_find_class = prep_pcibios_find_class; ptr_pcibios_find_class = prep_pcibios_find_class;
break;
case _MACH_Pmac:
ptr_pcibios_read_config_byte = pmac_pcibios_read_config_byte;
ptr_pcibios_read_config_word = pmac_pcibios_read_config_word;
ptr_pcibios_read_config_dword = pmac_pcibios_read_config_dword;
ptr_pcibios_write_config_byte = pmac_pcibios_write_config_byte;
ptr_pcibios_write_config_word = pmac_pcibios_write_config_word;
ptr_pcibios_write_config_dword = pmac_pcibios_write_config_dword;
ptr_pcibios_find_device = pmac_pcibios_find_device;
ptr_pcibios_find_class = pmac_pcibios_find_class;
break;
case _MACH_chrp:
ptr_pcibios_read_config_byte = chrp_pcibios_read_config_byte;
ptr_pcibios_read_config_word = chrp_pcibios_read_config_word;
ptr_pcibios_read_config_dword = chrp_pcibios_read_config_dword;
ptr_pcibios_write_config_byte = chrp_pcibios_write_config_byte;
ptr_pcibios_write_config_word = chrp_pcibios_write_config_word;
ptr_pcibios_write_config_dword = chrp_pcibios_write_config_dword;
ptr_pcibios_find_device = chrp_pcibios_find_device;
ptr_pcibios_find_class = chrp_pcibios_find_class;
break;
} }
return mem_start; return mem_start;
} }
......
This diff is collapsed.
...@@ -193,7 +193,7 @@ void note_bootable_part(kdev_t dev, int part) ...@@ -193,7 +193,7 @@ void note_bootable_part(kdev_t dev, int part)
} }
} }
void ide_init_hwif_ports(ide_ioreg_t *p, ide_ioreg_t base, int *irq) void pmac_ide_init_hwif_ports(ide_ioreg_t *p, ide_ioreg_t base, int *irq)
{ {
struct device_node *np; struct device_node *np;
int i; int i;
......
/* /*
* $Id: ppc_htab.c,v 1.4 1997/08/12 04:24:54 cort Exp $ * $Id: ppc_htab.c,v 1.7 1997/08/24 19:33:32 cort Exp $
*
* PowerPC hash table management proc entry. Will show information * PowerPC hash table management proc entry. Will show information
* about the current hash table and will allow changes to it. * about the current hash table and will allow changes to it.
* *
...@@ -33,6 +34,7 @@ static long long ppc_htab_lseek(struct inode * inode, struct file * file, ...@@ -33,6 +34,7 @@ static long long ppc_htab_lseek(struct inode * inode, struct file * file,
extern PTE *Hash, *Hash_end; extern PTE *Hash, *Hash_end;
extern unsigned long Hash_size, Hash_mask; extern unsigned long Hash_size, Hash_mask;
extern unsigned long _SDR1;
static struct file_operations ppc_htab_operations = { static struct file_operations ppc_htab_operations = {
ppc_htab_lseek, /* lseek */ ppc_htab_lseek, /* lseek */
...@@ -83,6 +85,7 @@ static long ppc_htab_read(struct inode * inode, struct file * file, ...@@ -83,6 +85,7 @@ static long ppc_htab_read(struct inode * inode, struct file * file,
unsigned int kptes = 0, overflow = 0, uptes = 0; unsigned int kptes = 0, overflow = 0, uptes = 0;
PTE *ptr; PTE *ptr;
struct task_struct *p; struct task_struct *p;
char buffer[128];
if (nbytes < 0) if (nbytes < 0)
return -EINVAL; return -EINVAL;
...@@ -94,7 +97,7 @@ static long ppc_htab_read(struct inode * inode, struct file * file, ...@@ -94,7 +97,7 @@ static long ppc_htab_read(struct inode * inode, struct file * file,
* due to the way tlb invalidation is handled on the ppc * due to the way tlb invalidation is handled on the ppc
* -- Cort * -- Cort
*/ */
for ( ptr = Hash ; ptr < (PTE *)(Hash+Hash_size) ; ptr+=sizeof(PTE)) for ( ptr = Hash ; ptr < Hash_end ; ptr += sizeof(PTE))
{ {
if (ptr->v) if (ptr->v)
{ {
...@@ -118,7 +121,8 @@ static long ppc_htab_read(struct inode * inode, struct file * file, ...@@ -118,7 +121,8 @@ static long ppc_htab_read(struct inode * inode, struct file * file,
overflow++; overflow++;
} }
} }
n += sprintf( buf,
n += sprintf( buffer,
"Size\t\t: %luKb\n" "Size\t\t: %luKb\n"
"Buckets\t\t: %lu\n" "Buckets\t\t: %lu\n"
"Address\t\t: %08lx\n" "Address\t\t: %08lx\n"
...@@ -136,9 +140,12 @@ static long ppc_htab_read(struct inode * inode, struct file * file, ...@@ -136,9 +140,12 @@ static long ppc_htab_read(struct inode * inode, struct file * file,
overflow, overflow,
((kptes+uptes)*100) / (Hash_size/sizeof(PTE)) ((kptes+uptes)*100) / (Hash_size/sizeof(PTE))
); );
/* if we're trying to read part of the file that isn't there */
if ( file->f_pos > n ) if (file->f_pos >= strlen(buffer))
return -ENOMEM; return 0;
if (n > strlen(buffer) - file->f_pos)
n = strlen(buffer) - file->f_pos;
copy_to_user(buf, buffer + file->f_pos, n);
file->f_pos += n; file->f_pos += n;
return n; return n;
} }
...@@ -150,11 +157,47 @@ static long ...@@ -150,11 +157,47 @@ static long
ppc_htab_write(struct inode * inode, struct file * file, ppc_htab_write(struct inode * inode, struct file * file,
const char * buffer, unsigned long count) const char * buffer, unsigned long count)
{ {
unsigned long size;
extern void reset_SDR1(void);
if ( current->uid != 0 ) if ( current->uid != 0 )
return -EACCES; return -EACCES;
else
return -ENOSYS; /* only know how to set size right now */
return 0; if ( strncmp( buffer, "size ", 5) )
return -EINVAL;
size = simple_strtoul( &buffer[5], NULL, 10 );
/* only allow to shrink */
if ( size >= Hash_size>>10 )
return -EINVAL;
/* minimum size of htab */
if ( size < 64 )
return -EINVAL;
/* make sure it's a multiple of 64k */
if ( size % 64 )
return -EINVAL;
printk("Hash table resize to %luk\n", size);
/*
* We need to rehash all kernel entries for the new htab size.
* Kernel only since we do a flush_tlb_all(). Since it's kernel
* we only need to bother with vsids 0-15. To avoid problems of
* clobbering un-rehashed values we put the htab at a new spot
* and put everything there.
* -- Cort
*/
Hash_size = size<<10;
Hash_mask = (Hash_size >> 6) - 1;
_SDR1 = __pa(Hash) | (Hash_mask >> 10);
flush_tlb_all();
reset_SDR1();
printk("done\n");
return count;
} }
...@@ -176,21 +219,3 @@ ppc_htab_lseek(struct inode * inode, struct file * file, ...@@ -176,21 +219,3 @@ ppc_htab_lseek(struct inode * inode, struct file * file,
} }
} }
#if 0
/*
for root.c
*/
static struct proc_dir_entry proc_root_ppc_htab = {
PROC_PPC_HTAB, 8, "ppc_htab",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_ppc_htab_inode_operations
};
#ifdef __powerpc__
proc_register(&proc_root, &proc_root_ppc_htab);
#endif
/* add to proc_fs.h
PROC_PPC_HTAB,*/
#endif
This diff is collapsed.
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <asm/residual.h> #include <asm/residual.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
#include <asm/ide.h>
/* for the mac fs */ /* for the mac fs */
kdev_t boot_dev; kdev_t boot_dev;
...@@ -55,34 +56,19 @@ extern int rd_image_start; /* starting block # of image */ ...@@ -55,34 +56,19 @@ extern int rd_image_start; /* starting block # of image */
extern char saved_command_line[256]; extern char saved_command_line[256];
struct screen_info screen_info = { void prep_ide_init_hwif_ports (ide_ioreg_t *p, ide_ioreg_t base, int *irq)
0, 25, /* orig-x, orig-y */
{ 0, 0 }, /* unused */
0, /* orig-video-page */
0, /* orig-video-mode */
80, /* orig-video-cols */
0,0,0, /* ega_ax, ega_bx, ega_cx */
25, /* orig-video-lines */
1, /* orig-video-isVGA */
16 /* orig-video-points */
};
/*
* these are here to get by until the pmac/prep merge is done
*/
int pmac_display_supported(char *name)
{
return 0;
}
int sd_find_target(void *a, int b)
{
return 0;
}
void pmac_find_display(void)
{ {
ide_ioreg_t port = base;
int i = 8;
while (i--)
*p++ = port++;
*p++ = base + 0x206;
if (irq != NULL)
*irq = 0;
} }
int int
prep_get_cpuinfo(char *buffer) prep_get_cpuinfo(char *buffer)
{ {
...@@ -237,6 +223,7 @@ prep_setup_arch(char **cmdline_p, unsigned long * memory_start_p, ...@@ -237,6 +223,7 @@ prep_setup_arch(char **cmdline_p, unsigned long * memory_start_p,
extern char cmd_line[]; extern char cmd_line[];
extern char _etext[], _edata[], _end[]; extern char _etext[], _edata[], _end[];
extern int panic_timeout; extern int panic_timeout;
unsigned char reg;
/* Save unparsed command line copy for /proc/cmdline */ /* Save unparsed command line copy for /proc/cmdline */
strcpy( saved_command_line, cmd_line ); strcpy( saved_command_line, cmd_line );
...@@ -257,6 +244,12 @@ prep_setup_arch(char **cmdline_p, unsigned long * memory_start_p, ...@@ -257,6 +244,12 @@ prep_setup_arch(char **cmdline_p, unsigned long * memory_start_p,
init_task.mm->brk = (unsigned long) _end; init_task.mm->brk = (unsigned long) _end;
aux_device_present = 0xaa; aux_device_present = 0xaa;
/* Set up floppy in PS/2 mode */
outb(0x09, SIO_CONFIG_RA);
reg = inb(SIO_CONFIG_RD);
reg = (reg & 0x3F) | 0x40;
outb(reg, SIO_CONFIG_RD);
outb(reg, SIO_CONFIG_RD); /* Have to write twice to change! */
switch ( _machine ) switch ( _machine )
{ {
...@@ -289,6 +282,8 @@ prep_setup_arch(char **cmdline_p, unsigned long * memory_start_p, ...@@ -289,6 +282,8 @@ prep_setup_arch(char **cmdline_p, unsigned long * memory_start_p,
#endif #endif
printk("Boot arguments: %s\n", cmd_line); printk("Boot arguments: %s\n", cmd_line);
print_residual_device_info();
request_region(0x20,0x20,"pic1"); request_region(0x20,0x20,"pic1");
request_region(0xa0,0x20,"pic2"); request_region(0xa0,0x20,"pic2");
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/timex.h> #include <linux/timex.h>
#include <linux/kernel_stat.h> #include <linux/kernel_stat.h>
#include <linux/mc146818rtc.h>
#include <asm/segment.h> #include <asm/segment.h>
#include <asm/io.h> #include <asm/io.h>
...@@ -27,9 +26,6 @@ ...@@ -27,9 +26,6 @@
#include "time.h" #include "time.h"
inline unsigned long mktime(unsigned int, unsigned int,unsigned int,
unsigned int, unsigned int, unsigned int);
/* /*
* The motorola uses the m48t18 rtc (includes DS1643) whose registers * The motorola uses the m48t18 rtc (includes DS1643) whose registers
* are at a higher end of nvram (1ff8-1fff) than the ibm mc146818 * are at a higher end of nvram (1ff8-1fff) than the ibm mc146818
...@@ -90,108 +86,6 @@ void prep_cmos_clock_write(unsigned long val, int addr) ...@@ -90,108 +86,6 @@ void prep_cmos_clock_write(unsigned long val, int addr)
printk("Unknown machine in prep_cmos_clock_write()!\n"); printk("Unknown machine in prep_cmos_clock_write()!\n");
} }
#define TICK_SIZE tick
#define FEBRUARY 2
#define STARTOFTIME 1970
#define SECDAY 86400L
#define SECYR (SECDAY * 365)
#define leapyear(year) ((year) % 4 == 0)
#define days_in_year(a) (leapyear(a) ? 366 : 365)
#define days_in_month(a) (month_days[(a) - 1])
static int month_days[12] = {
31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
};
#if 0
static unsigned long do_slow_gettimeoffset(void)
{
int count;
unsigned long offset = 0;
/* timer count may underflow right here */
outb_p(0x00, 0x43); /* latch the count ASAP */
count = inb_p(0x40); /* read the latched count */
count |= inb(0x40) << 8;
/* we know probability of underflow is always MUCH less than 1% */
if (count > (LATCH - LATCH/100)) {
/* check for pending timer interrupt */
outb_p(0x0a, 0x20);
if (inb(0x20) & 1)
offset = TICK_SIZE;
}
count = ((LATCH-1) - count) * TICK_SIZE;
count = (count + LATCH/2) / LATCH;
return offset + count;
}
static unsigned long (*do_gettimeoffset)(void) = do_slow_gettimeoffset;
/*
* This version of gettimeofday has near microsecond resolution.
*/
void do_gettimeofday(struct timeval *tv)
{
unsigned long flags;
save_flags(flags);
cli();
*tv = xtime;
tv->tv_usec += do_gettimeoffset();
if (tv->tv_usec >= 1000000) {
tv->tv_usec -= 1000000;
tv->tv_sec++;
}
restore_flags(flags);
}
void do_settimeofday(struct timeval *tv)
{
cli();
tv->tv_usec -= do_gettimeoffset();
if (tv->tv_usec < 0) {
tv->tv_usec += 1000000;
tv->tv_sec--;
}
xtime = *tv;
time_state = TIME_ERROR;
time_maxerror = 0x70000000;
time_esterror = 0x70000000;
sti();
}
#endif
void to_tm(int tim, struct rtc_time * tm)
{
register int i;
register long hms, day;
day = tim / SECDAY;
hms = tim % SECDAY;
/* Hours, minutes, seconds are easy */
tm->tm_hour = hms / 3600;
tm->tm_min = (hms % 3600) / 60;
tm->tm_sec = (hms % 3600) % 60;
/* Number of years in days */
for (i = STARTOFTIME; day >= days_in_year(i); i++)
day -= days_in_year(i);
tm->tm_year = i;
/* Number of months in days left */
if (leapyear(tm->tm_year))
days_in_month(FEBRUARY) = 29;
for (i = 1; day >= days_in_month(i); i++)
day -= days_in_month(i);
days_in_month(FEBRUARY) = 28;
tm->tm_mon = i;
/* Days are what is left over (+1) from all that. */
tm->tm_mday = day + 1;
}
/* /*
* Set the hardware clock. -- Cort * Set the hardware clock. -- Cort
*/ */
...@@ -280,38 +174,6 @@ unsigned long prep_get_rtc_time(void) ...@@ -280,38 +174,6 @@ unsigned long prep_get_rtc_time(void)
return mktime(year, mon, day, hour, min, sec); return mktime(year, mon, day, hour, min, sec);
} }
/* Converts Gregorian date to seconds since 1970-01-01 00:00:00.
* Assumes input in normal date format, i.e. 1980-12-31 23:59:59
* => year=1980, mon=12, day=31, hour=23, min=59, sec=59.
*
* [For the Julian calendar (which was used in Russia before 1917,
* Britain & colonies before 1752, anywhere else before 1582,
* and is still in use by some communities) leave out the
* -year/100+year/400 terms, and add 10.]
*
* This algorithm was first published by Gauss (I think).
*
* WARNING: this function will overflow on 2106-02-07 06:28:16 on
* machines were long is 32-bit! (However, as time_t is signed, we
* will already get problems at other places on 2038-01-19 03:14:08)
*/
inline unsigned long mktime(unsigned int year, unsigned int mon,
unsigned int day, unsigned int hour,
unsigned int min, unsigned int sec)
{
if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */
mon += 12; /* Puts Feb last since it has leap day */
year -= 1;
}
return (((
(unsigned long)(year/4 - year/100 + year/400 + 367*mon/12 + day) +
year*365 - 719499
)*24 + hour /* now have hours */
)*60 + min /* now have minutes */
)*60 + sec; /* finally seconds */
}
#if 0 #if 0
void time_init(void) void time_init(void)
{ {
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/blk.h> #include <linux/blk.h>
#include <asm/prom.h> #include <asm/prom.h>
#include <asm/page.h> #include <asm/page.h>
#include <asm/processor.h>
#define getpromprop(node, name, buf, len) \ #define getpromprop(node, name, buf, len) \
((int)call_prom("getprop", 4, 1, (node), (name), (buf), (len))) ((int)call_prom("getprop", 4, 1, (node), (name), (buf), (len)))
...@@ -128,7 +129,7 @@ void ...@@ -128,7 +129,7 @@ void
prom_init(char *params, int unused, void (*pp)(void *)) prom_init(char *params, int unused, void (*pp)(void *))
{ {
/* First get a handle for the stdout device */ /* First get a handle for the stdout device */
if ( _machine != _MACH_Pmac ) /* prep */ if ( ! have_of() )
return; return;
prom_entry = pp; prom_entry = pp;
prom_chosen = call_prom("finddevice", 1, 1, "/chosen"); prom_chosen = call_prom("finddevice", 1, 1, "/chosen");
......
/*
* $Id: residual.c,v 1.2 1997/08/25 06:54:56 cort Exp $
*
* Code to deal with the PReP residual data.
*
* Written by: Cort Dougan (cort@cs.nmt.edu)
*/
#include <linux/config.h>
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/stddef.h>
#include <linux/unistd.h>
#include <linux/ptrace.h>
#include <linux/malloc.h>
#include <linux/user.h>
#include <linux/a.out.h>
#include <linux/tty.h>
#include <linux/major.h>
#include <linux/interrupt.h>
#include <linux/reboot.h>
#include <linux/init.h>
#include <linux/blk.h>
#include <linux/ioport.h>
#include <linux/pci.h>
#include <asm/mmu.h>
#include <asm/processor.h>
#include <asm/residual.h>
#include <asm/io.h>
#include <asm/pgtable.h>
#include <asm/ide.h>
#include <asm/pnp.h>
/*
* Spit out some info about residual data
*/
void print_residual_device_info(void)
{
int i;
union _PnP_TAG_PACKET *pkt;
PPC_DEVICE *dev;
#define did dev->DeviceId
/* make sure we have residual data first */
if ( res.ResidualLength == 0 )
return;
printk("Residual: %ld devices\n", res.ActualNumDevices);
for ( i = 0;
i < res.ActualNumDevices ;
i++)
{
dev = &res.Devices[i];
/*
* pci devices
*/
if ( did.BusId & PCIDEVICE )
{
printk("PCI Device:");
/* unknown vendor */
if ( !strncmp( "Unknown", pci_strvendor(did.DevId>>16), 7) )
printk(" id %08lx types %d/%d", did.DevId,
did.BaseType, did.SubType);
/* known vendor */
else
printk(" %s %s",
pci_strvendor(did.DevId>>16),
pci_strdev(did.DevId>>16,
did.DevId&0xffff)
);
if ( did.BusId & PNPISADEVICE )
{
printk(" pnp:");
/* get pnp info on the device */
pkt = (union _PnP_TAG_PACKET *)
&res.DevicePnPHeap[dev->AllocatedOffset];
for (; pkt->S1_Pack.Tag != DF_END_TAG;
pkt++ )
{
if ( (pkt->S1_Pack.Tag == S4_Packet) ||
(pkt->S1_Pack.Tag == S4_Packet_flags) )
printk(" irq %02x%02x",
pkt->S4_Pack.IRQMask[0],
pkt->S4_Pack.IRQMask[1]);
}
}
printk("\n");
continue;
}
/*
* isa devices
*/
if ( did.BusId & ISADEVICE )
{
printk("ISA Device: basetype: %d subtype: %d",
did.BaseType, did.SubType);
printk("\n");
continue;
}
/*
* eisa devices
*/
if ( did.BusId & EISADEVICE )
{
printk("EISA Device: basetype: %d subtype: %d",
did.BaseType, did.SubType);
printk("\n");
continue;
}
/*
* proc bus devices
*/
if ( did.BusId & PROCESSORDEVICE )
{
printk("ProcBus Device: basetype: %d subtype: %d",
did.BaseType, did.SubType);
printk("\n");
continue;
}
/*
* pcmcia devices
*/
if ( did.BusId & PCMCIADEVICE )
{
printk("PCMCIA Device: basetype: %d subtype: %d",
did.BaseType, did.SubType);
printk("\n");
continue;
}
printk("Unknown bus access device: busid %lx\n",
did.BusId);
}
}
/* /*
* $Id: setup.c,v 1.12 1997/08/13 03:06:17 cort Exp $ * $Id: setup.c,v 1.16 1997/08/27 22:06:54 cort Exp $
* Common prep/pmac boot and setup code. * Common prep/pmac boot and setup code.
*/ */
...@@ -8,10 +8,12 @@ ...@@ -8,10 +8,12 @@
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/reboot.h> #include <linux/reboot.h>
#include <linux/openpic.h>
#include <asm/cuda.h> #include <asm/cuda.h>
#include <asm/residual.h> #include <asm/residual.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/ide.h>
char saved_command_line[256]; char saved_command_line[256];
unsigned char aux_device_present; unsigned char aux_device_present;
...@@ -20,6 +22,42 @@ unsigned char aux_device_present; ...@@ -20,6 +22,42 @@ unsigned char aux_device_present;
RESIDUAL res; RESIDUAL res;
int _machine; int _machine;
/*
* Perhaps we can put the pmac screen_info[] here
* on pmac as well so we don't need the ifdef's.
* Until we get multiple-console support in here
* that is. -- Cort
*/
#if defined(CONFIG_CHRP) || defined(CONFIG_PREP )
struct screen_info screen_info = {
0, 25, /* orig-x, orig-y */
{ 0, 0 }, /* unused */
0, /* orig-video-page */
0, /* orig-video-mode */
80, /* orig-video-cols */
0,0,0, /* ega_ax, ega_bx, ega_cx */
25, /* orig-video-lines */
1, /* orig-video-isVGA */
16 /* orig-video-points */
};
/*
* I really need to add multiple-console support... -- Cort
*/
int pmac_display_supported(char *name)
{
return 0;
}
int sd_find_target(void *a, int b)
{
return 0;
}
void pmac_find_display(void)
{
}
#endif
/* /*
* Find out what kind of machine we're on and save any data we need * Find out what kind of machine we're on and save any data we need
* from the early boot process (devtree is copied on pmac by prom_init() ) * from the early boot process (devtree is copied on pmac by prom_init() )
...@@ -33,28 +71,36 @@ unsigned long identify_machine(unsigned long r3, unsigned long r4, unsigned long ...@@ -33,28 +71,36 @@ unsigned long identify_machine(unsigned long r3, unsigned long r4, unsigned long
_machine = _MACH_Pmac; _machine = _MACH_Pmac;
#endif /* CONFIG_PMAC */ #endif /* CONFIG_PMAC */
#ifdef CONFIG_PREP #ifdef CONFIG_PREP
/* make a copy of residual data */
if ( r3 )
memcpy( (void *)&res,(void *)(r3+KERNELBASE), sizeof(RESIDUAL) );
if (!strncmp(res.VitalProductData.PrintableModel,"IBM",3)) if (!strncmp(res.VitalProductData.PrintableModel,"IBM",3))
_machine = _MACH_IBM; _machine = _MACH_IBM;
else else
_machine = _MACH_Motorola; _machine = _MACH_Motorola;
#endif /* CONFIG_PREP */ #endif /* CONFIG_PREP */
#ifdef CONFIG_CHRP
if ( _machine == _MACH_Pmac ) _machine = _MACH_chrp;
#endif /* CONFIG_CHRP */
switch (_machine)
{ {
case _MACH_Pmac:
io_base = 0; io_base = 0;
} pci_dram_offset = 0;
else if ( is_prep ) /* prep */ break;
{ case _MACH_IBM:
case _MACH_Motorola:
io_base = 0x80000000; io_base = 0x80000000;
/* make a copy of residual data */ pci_dram_offset = 0x80000000;
if ( r3 ) #ifdef CONFIG_BLK_DEV_RAM
memcpy( (void *)&res,(void *)(r3+KERNELBASE), sizeof(RESIDUAL) );
/* take care of initrd if we have one */ /* take care of initrd if we have one */
if ( r4 ) if ( r4 )
{ {
initrd_start = r4 + KERNELBASE; initrd_start = r4 + KERNELBASE;
initrd_end = r5 + KERNELBASE; initrd_end = r5 + KERNELBASE;
} }
#endif /* CONFIG_BLK_DEV_RAM */
/* take care of cmd line */ /* take care of cmd line */
if ( r6 ) if ( r6 )
{ {
...@@ -62,9 +108,23 @@ unsigned long identify_machine(unsigned long r3, unsigned long r4, unsigned long ...@@ -62,9 +108,23 @@ unsigned long identify_machine(unsigned long r3, unsigned long r4, unsigned long
*(char *)(r7+KERNELBASE) = 0; *(char *)(r7+KERNELBASE) = 0;
strcpy(cmd_line, (char *)(r6+KERNELBASE)); strcpy(cmd_line, (char *)(r6+KERNELBASE));
} }
} break;
else case _MACH_chrp:
{ /* LongTrail */
io_base = 0xf8000000;
pci_dram_offset = 0;
/* take care of initrd if we have one */
if ( r4 ) {
initrd_start = r4 + KERNELBASE;
initrd_end = r5 + KERNELBASE;
}
/* take care of cmd line */
if ( r6 ) {
*(char *)(r7+KERNELBASE) = 0;
strcpy(cmd_line, (char *)(r6+KERNELBASE));
}
break;
default:
printk("Unknown machine type in identify_machine!\n"); printk("Unknown machine type in identify_machine!\n");
} }
return 0; return 0;
...@@ -77,14 +137,15 @@ void machine_restart(char *cmd) ...@@ -77,14 +137,15 @@ void machine_restart(char *cmd)
unsigned long flags; unsigned long flags;
unsigned long i = 10000; unsigned long i = 10000;
if ( _machine == _MACH_Pmac ) switch(_machine)
{ {
case _MACH_Pmac:
cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_RESET_SYSTEM); cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_RESET_SYSTEM);
for (;;) for (;;)
cuda_poll(); cuda_poll();
} break;
else /* prep */ case _MACH_IBM:
{ case _MACH_Motorola:
_disable_interrupts(); _disable_interrupts();
/* set exception prefix high - to the prom */ /* set exception prefix high - to the prom */
...@@ -98,8 +159,12 @@ void machine_restart(char *cmd) ...@@ -98,8 +159,12 @@ void machine_restart(char *cmd)
while ( i != 0 ) i++; while ( i != 0 ) i++;
panic("restart failed\n"); panic("restart failed\n");
} break;
case _MACH_chrp:
openpic_init_processor(1<<0);
break;
}
} }
void machine_power_off(void) void machine_power_off(void)
...@@ -112,7 +177,7 @@ void machine_power_off(void) ...@@ -112,7 +177,7 @@ void machine_power_off(void)
for (;;) for (;;)
cuda_poll(); cuda_poll();
} }
else /* prep */ else /* prep or chrp */
{ {
machine_restart(NULL); machine_restart(NULL);
} }
...@@ -128,16 +193,18 @@ void machine_halt(void) ...@@ -128,16 +193,18 @@ void machine_halt(void)
machine_power_off(); /* for now */ machine_power_off(); /* for now */
#endif #endif
} }
else /* prep */ else /* prep or chrp */
machine_restart(NULL); machine_restart(NULL);
} }
void ide_init_hwif_ports (ide_ioreg_t *p, ide_ioreg_t base, int *irq)
__initfunc(unsigned long
bios32_init(unsigned long memory_start, unsigned long memory_end))
{ {
return memory_start; if ( _machine == _MACH_Pmac )
pmac_ide_init_hwif_ports(p,base,irq);
else /* prep */
prep_ide_init_hwif_ports(p,base,irq);
} }
/* /*
...@@ -145,29 +212,57 @@ bios32_init(unsigned long memory_start, unsigned long memory_end)) ...@@ -145,29 +212,57 @@ bios32_init(unsigned long memory_start, unsigned long memory_end))
*/ */
int get_cpuinfo(char *buffer) int get_cpuinfo(char *buffer)
{ {
extern int pmac_get_cpuinfo(char *); extern int pmac_get_cpuinfo(char *);
extern int chrp_get_cpuinfo(char *);
extern int prep_get_cpuinfo(char *); extern int prep_get_cpuinfo(char *);
if ( _machine == _MACH_Pmac )
switch (_machine)
{
case _MACH_Pmac:
return pmac_get_cpuinfo(buffer); return pmac_get_cpuinfo(buffer);
#ifdef CONFIG_PREP break;
else /* prep */ case _MACH_Motorola:
case _MACH_IBM:
return prep_get_cpuinfo(buffer); return prep_get_cpuinfo(buffer);
#endif /* CONFIG_PREP */ break;
case _MACH_chrp:
return chrp_get_cpuinfo(buffer);
break;
}
printk("Unknown machine %d in get_cpuinfo()\n",_machine);
return 0;
}
__initfunc(unsigned long
bios32_init(unsigned long memory_start, unsigned long memory_end))
{
return memory_start;
} }
__initfunc(void setup_arch(char **cmdline_p, __initfunc(void setup_arch(char **cmdline_p,
unsigned long * memory_start_p, unsigned long * memory_end_p)) unsigned long * memory_start_p, unsigned long * memory_end_p))
{ {
extern void pmac_setup_arch(char **, unsigned long *, unsigned long *); extern void pmac_setup_arch(char **, unsigned long *, unsigned long *);
extern void chrp_setup_arch(char **, unsigned long *, unsigned long *);
extern void prep_setup_arch(char **, unsigned long *, unsigned long *); extern void prep_setup_arch(char **, unsigned long *, unsigned long *);
if ( _machine == _MACH_Pmac ) switch (_machine)
{
case _MACH_Pmac:
pmac_setup_arch(cmdline_p,memory_start_p,memory_end_p); pmac_setup_arch(cmdline_p,memory_start_p,memory_end_p);
#ifdef CONFIG_PREP break;
else /* prep */ case _MACH_Motorola:
case _MACH_IBM:
prep_setup_arch(cmdline_p,memory_start_p,memory_end_p); prep_setup_arch(cmdline_p,memory_start_p,memory_end_p);
#endif /* CONFIG_PREP */ break;
case _MACH_chrp:
return chrp_setup_arch(cmdline_p,memory_start_p,memory_end_p);
break;
}
printk("Unknown machine %d in setup_arch()\n",_machine);
} }
/* /*
* $Id: time.c,v 1.8 1997/08/11 08:37:51 cort Exp $ * $Id: time.c,v 1.10 1997/08/27 22:06:56 cort Exp $
* Common time routines among all ppc machines. * Common time routines among all ppc machines.
* *
* Written by Cort Dougan (cort@cs.nmt.edu) to merge * Written by Cort Dougan (cort@cs.nmt.edu) to merge
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include "time.h" #include "time.h"
/* this is set to the appropriate pmac/prep func in init_IRQ() */ /* this is set to the appropriate pmac/prep/chrp func in init_IRQ() */
int (*set_rtc_time)(unsigned long); int (*set_rtc_time)(unsigned long);
/* keep track of when we need to update the rtc */ /* keep track of when we need to update the rtc */
...@@ -125,11 +125,14 @@ void do_settimeofday(struct timeval *tv) ...@@ -125,11 +125,14 @@ void do_settimeofday(struct timeval *tv)
void void
time_init(void) time_init(void)
{ {
#ifdef CONFIG_PREP
/* pmac hasn't yet called via_cuda_init() */ /* pmac hasn't yet called via_cuda_init() */
if ( _machine != _MACH_Pmac ) /* prep */ if ( _machine != _MACH_Pmac )
{ {
xtime.tv_sec = prep_get_rtc_time();
if ( _machine == _MACH_chrp )
xtime.tv_sec = chrp_get_rtc_time();
else /* assume prep */
xtime.tv_sec = prep_get_rtc_time();
xtime.tv_usec = 0; xtime.tv_usec = 0;
/* /*
* mark the rtc/on-chip timer as in sync * mark the rtc/on-chip timer as in sync
...@@ -137,35 +140,33 @@ time_init(void) ...@@ -137,35 +140,33 @@ time_init(void)
*/ */
last_rtc_update = xtime.tv_sec; last_rtc_update = xtime.tv_sec;
} }
#endif /* CONFIG_PREP */
if ((_get_PVR() >> 16) == 1) { if ((_get_PVR() >> 16) == 1) {
/* 601 processor: dec counts down by 128 every 128ns */ /* 601 processor: dec counts down by 128 every 128ns */
decrementer_count = DECREMENTER_COUNT_601; decrementer_count = DECREMENTER_COUNT_601;
count_period_num = COUNT_PERIOD_NUM_601; count_period_num = COUNT_PERIOD_NUM_601;
count_period_den = COUNT_PERIOD_DEN_601; count_period_den = COUNT_PERIOD_DEN_601;
} else {
/*
* These should setup decrementer_count
*/
if ( _machine == _MACH_Pmac )
pmac_calibrate_decr();
#ifdef CONFIG_PREP
else /* PReP */
prep_calibrate_decr();
#endif /* CONFIG_PREP */
} }
if ( _machine == _MACH_Pmac ) switch (_machine)
{
case _MACH_Pmac:
pmac_calibrate_decr();
set_rtc_time = pmac_set_rtc_time; set_rtc_time = pmac_set_rtc_time;
#ifdef CONFIG_PREP break;
else /* prep */ case _MACH_IBM:
case _MACH_Motorola:
prep_calibrate_decr();
set_rtc_time = prep_set_rtc_time; set_rtc_time = prep_set_rtc_time;
#endif /* CONFIG_PREP */ break;
case _MACH_chrp:
chrp_calibrate_decr();
set_rtc_time = chrp_set_rtc_time;
break;
}
set_dec(decrementer_count); set_dec(decrementer_count);
} }
#ifdef CONFIG_PREP
/* /*
* Uses the on-board timer to calibrate the on-chip decrementer register * Uses the on-board timer to calibrate the on-chip decrementer register
* for prep systems. On the pmac the OF tells us what the frequency is * for prep systems. On the pmac the OF tells us what the frequency is
...@@ -218,4 +219,50 @@ void prep_calibrate_decr_handler(int irq, void *dev, struct pt_regs * regs) ...@@ -218,4 +219,50 @@ void prep_calibrate_decr_handler(int irq, void *dev, struct pt_regs * regs)
*done_ptr = 1; *done_ptr = 1;
} }
} }
#endif /* CONFIG_PREP */
void chrp_calibrate_decr(void)
{
int freq, fp, divisor;
fp = 16666000; /* hardcoded for now */
freq = fp*60; /* try to make freq/1e6 an integer */
divisor = 60;
printk("time_init: decrementer frequency = %d/%d\n", freq, divisor);
decrementer_count = freq / HZ / divisor;
count_period_num = divisor;
count_period_den = freq / 1000000;
}
/* Converts Gregorian date to seconds since 1970-01-01 00:00:00.
* Assumes input in normal date format, i.e. 1980-12-31 23:59:59
* => year=1980, mon=12, day=31, hour=23, min=59, sec=59.
*
* [For the Julian calendar (which was used in Russia before 1917,
* Britain & colonies before 1752, anywhere else before 1582,
* and is still in use by some communities) leave out the
* -year/100+year/400 terms, and add 10.]
*
* This algorithm was first published by Gauss (I think).
*
* WARNING: this function will overflow on 2106-02-07 06:28:16 on
* machines were long is 32-bit! (However, as time_t is signed, we
* will already get problems at other places on 2038-01-19 03:14:08)
*/
inline unsigned long mktime(unsigned int year, unsigned int mon,
unsigned int day, unsigned int hour,
unsigned int min, unsigned int sec)
{
if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */
mon += 12; /* Puts Feb last since it has leap day */
year -= 1;
}
return (((
(unsigned long)(year/4 - year/100 + year/400 + 367*mon/12 + day) +
year*365 - 719499
)*24 + hour /* now have hours */
)*60 + min /* now have minutes */
)*60 + sec; /* finally seconds */
}
/* /*
* $Id: time.h,v 1.3 1997/08/12 08:22:14 cort Exp $ * $Id: time.h,v 1.5 1997/08/27 22:06:58 cort Exp $
* Common time prototypes and such for all ppc machines. * Common time prototypes and such for all ppc machines.
* *
* Written by Cort Dougan (cort@cs.nmt.edu) to merge * Written by Cort Dougan (cort@cs.nmt.edu) to merge
* Paul Mackerras' version and mine for PReP and Pmac. * Paul Mackerras' version and mine for PReP and Pmac.
*/ */
#include <linux/mc146818rtc.h>
/* time.c */ /* time.c */
__inline__ unsigned long get_dec(void); __inline__ unsigned long get_dec(void);
__inline__ void set_dec(int val); __inline__ void set_dec(int val);
void prep_calibrate_decr_handler(int, void *,struct pt_regs *); void prep_calibrate_decr_handler(int, void *,struct pt_regs *);
void prep_calibrate_decr(void); void prep_calibrate_decr(void);
void pmac_calibrate_decr(void); void pmac_calibrate_decr(void);
void chrp_calibrate_decr(void);
extern unsigned decrementer_count; extern unsigned decrementer_count;
extern unsigned count_period_num; extern unsigned count_period_num;
extern unsigned count_period_den; extern unsigned count_period_den;
extern unsigned long mktime(unsigned int, unsigned int,unsigned int,
unsigned int, unsigned int, unsigned int);
/* pmac/prep_time.c */ /* pmac/prep/chrp_time.c */
unsigned long prep_get_rtc_time(void); unsigned long prep_get_rtc_time(void);
unsigned long pmac_get_rtc_time(void); unsigned long pmac_get_rtc_time(void);
unsigned long chrp_get_rtc_time(void);
int prep_set_rtc_time(unsigned long nowtime); int prep_set_rtc_time(unsigned long nowtime);
int pmac_set_rtc_time(unsigned long nowtime); int pmac_set_rtc_time(unsigned long nowtime);
int chrp_set_rtc_time(unsigned long nowtime);
void pmac_read_rtc_time(void); void pmac_read_rtc_time(void);
#define TICK_SIZE tick
#define FEBRUARY 2
#define STARTOFTIME 1970
#define SECDAY 86400L
#define SECYR (SECDAY * 365)
#define leapyear(year) ((year) % 4 == 0)
#define days_in_year(a) (leapyear(a) ? 366 : 365)
#define days_in_month(a) (month_days[(a) - 1])
static int month_days[12] = {
31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
};
extern void inline to_tm(int tim, struct rtc_time * tm)
{
register int i;
register long hms, day;
day = tim / SECDAY;
hms = tim % SECDAY;
/* Hours, minutes, seconds are easy */
tm->tm_hour = hms / 3600;
tm->tm_min = (hms % 3600) / 60;
tm->tm_sec = (hms % 3600) % 60;
/* Number of years in days */
for (i = STARTOFTIME; day >= days_in_year(i); i++)
day -= days_in_year(i);
tm->tm_year = i;
/* Number of months in days left */
if (leapyear(tm->tm_year))
days_in_month(FEBRUARY) = 29;
for (i = 1; day >= days_in_month(i); i++)
day -= days_in_month(i);
days_in_month(FEBRUARY) = 28;
tm->tm_mon = i;
/* Days are what is left over (+1) from all that. */
tm->tm_mday = day + 1;
}
...@@ -16,10 +16,17 @@ search_one_table(const struct exception_table_entry *first, ...@@ -16,10 +16,17 @@ search_one_table(const struct exception_table_entry *first,
const struct exception_table_entry *last, const struct exception_table_entry *last,
unsigned long value) unsigned long value)
{ {
const struct exception_table_entry *mid;
for ( mid = first; mid < last; mid++)
{
if ( mid->insn == value )
return mid->fixup;
}
return 0;
#if 0
while (first <= last) { while (first <= last) {
const struct exception_table_entry *mid; const struct exception_table_entry *mid;
long diff; long diff;
mid = (last - first) / 2 + first; mid = (last - first) / 2 + first;
diff = mid->insn - value; diff = mid->insn - value;
if (diff == 0) if (diff == 0)
...@@ -29,6 +36,7 @@ search_one_table(const struct exception_table_entry *first, ...@@ -29,6 +36,7 @@ search_one_table(const struct exception_table_entry *first,
else else
last = mid-1; last = mid-1;
} }
#endif
return 0; return 0;
} }
......
...@@ -145,8 +145,8 @@ bad_page_fault(struct pt_regs *regs, unsigned long address) ...@@ -145,8 +145,8 @@ bad_page_fault(struct pt_regs *regs, unsigned long address)
if (xmon_kernel_faults) if (xmon_kernel_faults)
xmon(regs); xmon(regs);
#endif #endif
panic("kernel access of bad area\n pc %lx address %lX tsk %s/%d", panic("kernel access of bad area pc %lx lr %lx address %lX tsk %s/%d",
regs->nip,address,current->comm,current->pid); regs->nip,regs->link,address,current->comm,current->pid);
} }
unsigned long va_to_phys(unsigned long address) unsigned long va_to_phys(unsigned long address)
......
...@@ -54,6 +54,16 @@ extern char etext[], _stext[]; ...@@ -54,6 +54,16 @@ extern char etext[], _stext[];
extern char __init_begin, __init_end; extern char __init_begin, __init_end;
extern RESIDUAL res; extern RESIDUAL res;
/* Hardwired MMU segments */
#if defined(CONFIG_PREP) || defined(CONFIG_PMAC)
#define MMU_SEGMENT_1 0x80000000
#define MMU_SEGMENT_2 0xc0000000
#endif /* CONFIG_PREP || CONFIG_PMAC */
#ifdef CONFIG_CHRP
#define MMU_SEGMENT_1 0xf0000000 /* LongTrail */
#define MMU_SEGMENT_2 0xc0000000
#endif /* CONFIG_CHRP */
void *find_mem_piece(unsigned, unsigned); void *find_mem_piece(unsigned, unsigned);
static void mapin_ram(void); static void mapin_ram(void);
...@@ -264,7 +274,7 @@ find_mem_piece(unsigned size, unsigned align) ...@@ -264,7 +274,7 @@ find_mem_piece(unsigned size, unsigned align)
unsigned long *pmac_find_end_of_memory(void) unsigned long *pmac_find_end_of_memory(void)
{ {
unsigned long a, total; unsigned long a, total;
unsigned long h, kstart, ksize; unsigned long kstart, ksize;
extern char _stext[], _end[]; extern char _stext[], _end[];
int i; int i;
...@@ -314,20 +324,6 @@ unsigned long *pmac_find_end_of_memory(void) ...@@ -314,20 +324,6 @@ unsigned long *pmac_find_end_of_memory(void)
remove_mem_piece(&phys_avail, kstart, ksize, 0); remove_mem_piece(&phys_avail, kstart, ksize, 0);
remove_mem_piece(&prom_mem, kstart, ksize, 0); remove_mem_piece(&prom_mem, kstart, ksize, 0);
/*
* Allow 64k of hash table for every 16MB of memory,
* up to a maximum of 2MB.
*/
for (h = 64<<10; h < total / 256 && h < 2<<20; h *= 2)
;
Hash_size = h;
Hash_mask = (h >> 6) - 1;
/* Find some memory for the hash table. */
Hash = find_mem_piece(Hash_size, Hash_size);
printk("Total memory = %ldMB; using %ldkB for hash table (at %p)\n",
total >> 20, Hash_size >> 10, Hash);
return __va(total); return __va(total);
} }
...@@ -572,13 +568,13 @@ void si_meminfo(struct sysinfo *val) ...@@ -572,13 +568,13 @@ void si_meminfo(struct sysinfo *val)
BAT BAT0 = BAT BAT0 =
{ {
{ {
0x80000000>>17, /* bepi */ MMU_SEGMENT_1>>17, /* bepi */
BL_256M, /* bl */ BL_256M, /* bl */
1, /* vs -- supervisor mode valid */ 1, /* vs -- supervisor mode valid */
1, /* vp -- user mode valid */ 1, /* vp -- user mode valid */
}, },
{ {
0x80000000>>17, /* brpn */ MMU_SEGMENT_1>>17, /* brpn */
1, /* write-through */ 1, /* write-through */
1, /* cache-inhibited */ 1, /* cache-inhibited */
0, /* memory coherence */ 0, /* memory coherence */
...@@ -589,13 +585,13 @@ BAT BAT0 = ...@@ -589,13 +585,13 @@ BAT BAT0 =
BAT BAT1 = BAT BAT1 =
{ {
{ {
0xC0000000>>17, /* bepi */ MMU_SEGMENT_2>>17, /* bepi */
BL_256M, /* bl */ BL_256M, /* bl */
1, /* vs */ 1, /* vs */
1, /* vp */ 1, /* vp */
}, },
{ {
0xC0000000>>17, /* brpn */ MMU_SEGMENT_2>>17, /* brpn */
1, /* w */ 1, /* w */
1, /* i (cache disabled) */ 1, /* i (cache disabled) */
0, /* m */ 0, /* m */
...@@ -660,13 +656,13 @@ P601_BAT BAT0_601 = ...@@ -660,13 +656,13 @@ P601_BAT BAT0_601 =
P601_BAT BAT1_601 = P601_BAT BAT1_601 =
{ {
{ {
0xC0000000>>17, /* bepi */ MMU_SEGMENT_2>>17, /* bepi */
1,1,0, /* wim */ 1,1,0, /* wim */
1, 0, /* vs, vp */ 1, 0, /* vs, vp */
BPP_RW, /* pp */ BPP_RW, /* pp */
}, },
{ {
0xC0000000>>17, /* brpn */ MMU_SEGMENT_2>>17, /* brpn */
1, /* v */ 1, /* v */
BL_8M, /* bl */ BL_8M, /* bl */
} }
...@@ -711,8 +707,7 @@ P601_BAT BAT3_601 = ...@@ -711,8 +707,7 @@ P601_BAT BAT3_601 =
unsigned long *prep_find_end_of_memory(void) unsigned long *prep_find_end_of_memory(void)
{ {
int i; int i;
unsigned long h;
/* setup the hash table */
if (res.TotalMemory == 0 ) if (res.TotalMemory == 0 )
{ {
/* /*
...@@ -723,34 +718,10 @@ unsigned long *prep_find_end_of_memory(void) ...@@ -723,34 +718,10 @@ unsigned long *prep_find_end_of_memory(void)
res.TotalMemory = 0x03000000; res.TotalMemory = 0x03000000;
printk("Ramsize default to be %ldM\n", res.TotalMemory>>20); printk("Ramsize default to be %ldM\n", res.TotalMemory>>20);
} }
#if 0
/* linux has trouble with > 64M ram -- Cort */
if ( res.TotalMemory > 0x04000000 /* 64M */ )
{
printk("Only using first 64M of ram.\n");
res.TotalMemory = 0x04000000;
}
#endif
/* setup the bat2 mapping to cover physical ram */
BAT2.batu.bl = 0x1; /* 256k mapping */
for ( h = 256*1024 /* 256k */ ; (h <= res.TotalMemory) && (h <= 256*1024*1024);
h *= 2 )
BAT2.batu.bl = (BAT2.batu.bl << 1) | BAT2.batu.bl;
/*
* Allow 64k of hash table for every 16MB of memory,
* up to a maximum of 2MB.
*/
for (h = 64<<10; h < res.TotalMemory / 256 && h < 2<<20; h *= 2)
;
Hash_size = h;
Hash_mask = (h >> 6) - 1;
/* align htab on a Hash_size boundry above _end[] */
Hash = (PTE *)_ALIGN( (unsigned long)&_end, Hash_size);
memset(Hash, Hash_size, 0 );
/* NOTE: everything below here is moving to mapin_ram() */
/* /*
* if this is a 601, we can only map sizes of 8M with the BAT's * if this is a 601, we can only map sizes of 8M with the BAT's
* so we have to map what we can't map with the bats with the segregs * so we have to map what we can't map with the bats with the segregs
...@@ -790,9 +761,7 @@ unsigned long *prep_find_end_of_memory(void) ...@@ -790,9 +761,7 @@ unsigned long *prep_find_end_of_memory(void)
} }
#endif /* MAP_RAM_WITH_SEGREGS */ #endif /* MAP_RAM_WITH_SEGREGS */
printk("Total memory = %ldMB; using %ldkB for hash table (at %p)\n", return (__va(res.TotalMemory));
res.TotalMemory >> 20, Hash_size >> 10, Hash);
return ((unsigned long *)res.TotalMemory);
} }
...@@ -809,20 +778,39 @@ static void mapin_ram() ...@@ -809,20 +778,39 @@ static void mapin_ram()
int i; int i;
unsigned long v, p, s, f; unsigned long v, p, s, f;
v = KERNELBASE; if ( _machine == _MACH_Pmac )
for (i = 0; i < phys_mem.n_regions; ++i) { {
p = phys_mem.regions[i].address; v = KERNELBASE;
for (s = 0; s < phys_mem.regions[i].size; s += PAGE_SIZE) { for (i = 0; i < phys_mem.n_regions; ++i) {
f = _PAGE_PRESENT | _PAGE_ACCESSED; p = phys_mem.regions[i].address;
if ((char *) v < _stext || (char *) v >= etext) for (s = 0; s < phys_mem.regions[i].size; s += PAGE_SIZE) {
f |= _PAGE_RW | _PAGE_DIRTY | _PAGE_HWWRITE; f = _PAGE_PRESENT | _PAGE_ACCESSED;
else if ((char *) v < _stext || (char *) v >= etext)
/* On the powerpc, no user access forces R/W kernel access */ f |= _PAGE_RW | _PAGE_DIRTY | _PAGE_HWWRITE;
f |= _PAGE_USER; else
map_page(&init_task, v, p, f); /* On the powerpc, no user access forces R/W kernel access */
v += PAGE_SIZE; f |= _PAGE_USER;
p += PAGE_SIZE; map_page(&init_task, v, p, f);
} v += PAGE_SIZE;
p += PAGE_SIZE;
}
}
}
else /* prep */
{
/* setup the bat2 mapping to cover physical ram */
BAT2.batu.bl = 0x1; /* 256k mapping */
for ( f = 256*1024 /* 256k */ ;
(f <= res.TotalMemory) && (f <= 256*1024*1024);
f *= 2 )
BAT2.batu.bl = (BAT2.batu.bl << 1) | BAT2.batu.bl;
/*
* let ibm get to the device mem from user mode since
* the X for them needs it right now -- Cort
*/
if ( _machine == _MACH_IBM )
BAT0.batu.vp = BAT1.batu.vp = 1;
} }
} }
...@@ -878,10 +866,29 @@ static void inherit_prom_translations() ...@@ -878,10 +866,29 @@ static void inherit_prom_translations()
static void hash_init(void) static void hash_init(void)
{ {
int Hash_bits; int Hash_bits;
unsigned long h;
extern unsigned int hash_page_patch_A[], hash_page_patch_B[], extern unsigned int hash_page_patch_A[], hash_page_patch_B[],
hash_page_patch_C[]; hash_page_patch_C[];
/*
* Allow 64k of hash table for every 16MB of memory,
* up to a maximum of 2MB.
*/
for (h = 64<<10; h < (ulong)__pa(end_of_DRAM) / 256 && h < 2<<20; h *= 2)
;
Hash_size = h;
Hash_mask = (h >> 6) - 1;
/* Find some memory for the hash table. */
if ( is_prep )
/* align htab on a Hash_size boundry above _end[] */
Hash = (PTE *)_ALIGN( (unsigned long)&_end, Hash_size);
else /* pmac */
Hash = find_mem_piece(Hash_size, Hash_size);
printk("Total memory = %ldMB; using %ldkB for hash table (at %p)\n",
__pa(end_of_DRAM) >> 20, Hash_size >> 10, Hash);
memset(Hash, 0, Hash_size); memset(Hash, 0, Hash_size);
Hash_end = (PTE *) ((unsigned long)Hash + Hash_size); Hash_end = (PTE *) ((unsigned long)Hash + Hash_size);
...@@ -924,19 +931,17 @@ MMU_init(void) ...@@ -924,19 +931,17 @@ MMU_init(void)
{ {
if ( _machine == _MACH_Pmac ) if ( _machine == _MACH_Pmac )
end_of_DRAM = pmac_find_end_of_memory(); end_of_DRAM = pmac_find_end_of_memory();
else /* prep */ else /* prep and chrp */
end_of_DRAM = prep_find_end_of_memory(); end_of_DRAM = prep_find_end_of_memory();
hash_init(); hash_init();
_SDR1 = __pa(Hash) | (Hash_mask >> 10); _SDR1 = __pa(Hash) | (Hash_mask >> 10);
/* Map in all of RAM starting at KERNELBASE */
mapin_ram();
if ( _machine == _MACH_Pmac ) if ( _machine == _MACH_Pmac )
{
/* Map in all of RAM starting at KERNELBASE */
mapin_ram();
/* Copy mappings from the prom */ /* Copy mappings from the prom */
inherit_prom_translations(); inherit_prom_translations();
}
} }
static void * static void *
...@@ -949,7 +954,7 @@ MMU_get_page() ...@@ -949,7 +954,7 @@ MMU_get_page()
if (p == 0) if (p == 0)
panic("couldn't get a page in MMU_get_page"); panic("couldn't get a page in MMU_get_page");
} else { } else {
if ( is_prep ) if ( is_prep || (_machine == _MACH_chrp) )
{ {
mmu_pages_count++; mmu_pages_count++;
if ( mmu_pages_count > MAX_MMU_PAGES ) if ( mmu_pages_count > MAX_MMU_PAGES )
...@@ -971,11 +976,32 @@ ioremap(unsigned long addr, unsigned long size) ...@@ -971,11 +976,32 @@ ioremap(unsigned long addr, unsigned long size)
{ {
unsigned long p, end = addr + size; unsigned long p, end = addr + size;
/*
* BAT mappings on prep cover this already so don't waste
* space with it. -- Cort
*/
if ( is_prep )
if ( ((addr >= 0xc0000000) && (end < (0xc0000000+(256<<20)))) ||
((addr >= 0x80000000) && (end < (0x80000000+(256<<20)))) )
return (void *)addr;
for (p = addr & PAGE_MASK; p < end; p += PAGE_SIZE) for (p = addr & PAGE_MASK; p < end; p += PAGE_SIZE)
map_page(&init_task, p, p, pgprot_val(PAGE_KERNEL_CI) | _PAGE_GUARDED); map_page(&init_task, p, p, pgprot_val(PAGE_KERNEL_CI) | _PAGE_GUARDED);
return (void *) addr; return (void *) addr;
} }
extern void iounmap(unsigned long *addr)
{
/*
* BAT mappings on prep cover this already so don't waste
* space with it. -- Cort
*/
if ( is_prep )
if ( (((unsigned long)addr >= 0xc0000000) && ((unsigned long)addr < (0xc0000000+(256<<20)))) ||
(((unsigned long)addr >= 0x80000000) && ((unsigned long)addr < (0x80000000+(256<<20)))) )
return;
/* else unmap it */
}
void void
map_page(struct task_struct *tsk, unsigned long va, map_page(struct task_struct *tsk, unsigned long va,
unsigned long pa, int flags) unsigned long pa, int flags)
...@@ -1091,3 +1117,4 @@ mmu_context_overflow(void) ...@@ -1091,3 +1117,4 @@ mmu_context_overflow(void)
current->mm->context = MUNGE_CONTEXT(++next_mmu_context); current->mm->context = MUNGE_CONTEXT(++next_mmu_context);
set_context(current->mm->context); set_context(current->mm->context);
} }
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
# #
# Platform support # Platform support
# #
CONFIG_PPC=y
CONFIG_NATIVE=y CONFIG_NATIVE=y
# CONFIG_PMAC is not set # CONFIG_PMAC is not set
CONFIG_PREP=y CONFIG_PREP=y
...@@ -26,6 +27,7 @@ CONFIG_BINFMT_ELF=y ...@@ -26,6 +27,7 @@ CONFIG_BINFMT_ELF=y
CONFIG_KERNEL_ELF=y CONFIG_KERNEL_ELF=y
# CONFIG_BINFMT_MISC is not set # CONFIG_BINFMT_MISC is not set
# CONFIG_BINFMT_JAVA is not set # CONFIG_BINFMT_JAVA is not set
CONFIG_VGA_CONSOLE=y
# #
# Plug and Play support # Plug and Play support
...@@ -86,10 +88,14 @@ CONFIG_SCSI_CONSTANTS=y ...@@ -86,10 +88,14 @@ CONFIG_SCSI_CONSTANTS=y
# CONFIG_SCSI_FUTURE_DOMAIN is not set # CONFIG_SCSI_FUTURE_DOMAIN is not set
# CONFIG_SCSI_GENERIC_NCR5380 is not set # CONFIG_SCSI_GENERIC_NCR5380 is not set
# CONFIG_SCSI_NCR53C406A is not set # CONFIG_SCSI_NCR53C406A is not set
CONFIG_SCSI_NCR53C7xx=y # CONFIG_SCSI_NCR53C7xx is not set
# CONFIG_SCSI_NCR53C7xx_sync is not set CONFIG_SCSI_NCR53C8XX=y
# CONFIG_SCSI_NCR53C7xx_FAST is not set # CONFIG_SCSI_NCR53C8XX_NVRAM_DETECT is not set
# CONFIG_SCSI_NCR53C7xx_DISCONNECT is not set CONFIG_SCSI_NCR53C8XX_TAGGED_QUEUE=y
CONFIG_SCSI_NCR53C8XX_IOMAPPED=y
CONFIG_SCSI_NCR53C8XX_MAX_TAGS=4
CONFIG_SCSI_NCR53C8XX_SYNC=5
# CONFIG_SCSI_NCR53C8XX_SYMBIOS_COMPAT is not set
# CONFIG_SCSI_PPA is not set # CONFIG_SCSI_PPA is not set
# CONFIG_SCSI_PAS16 is not set # CONFIG_SCSI_PAS16 is not set
# CONFIG_SCSI_QLOGIC_FAS is not set # CONFIG_SCSI_QLOGIC_FAS is not set
...@@ -118,6 +124,7 @@ CONFIG_INET=y ...@@ -118,6 +124,7 @@ CONFIG_INET=y
# CONFIG_IP_ROUTER is not set # CONFIG_IP_ROUTER is not set
# CONFIG_NET_IPIP is not set # CONFIG_NET_IPIP is not set
# CONFIG_SYN_COOKIES is not set # CONFIG_SYN_COOKIES is not set
# CONFIG_XTP is not set
# CONFIG_INET_PCTCP is not set # CONFIG_INET_PCTCP is not set
# CONFIG_INET_RARP is not set # CONFIG_INET_RARP is not set
CONFIG_PATH_MTU_DISCOVERY=y CONFIG_PATH_MTU_DISCOVERY=y
...@@ -146,6 +153,7 @@ CONFIG_EL3=y ...@@ -146,6 +153,7 @@ CONFIG_EL3=y
# CONFIG_VORTEX is not set # CONFIG_VORTEX is not set
CONFIG_LANCE=y CONFIG_LANCE=y
# CONFIG_NET_VENDOR_SMC is not set # CONFIG_NET_VENDOR_SMC is not set
# CONFIG_NET_VENDOR_RACAL is not set
# CONFIG_NET_ISA is not set # CONFIG_NET_ISA is not set
CONFIG_NET_EISA=y CONFIG_NET_EISA=y
CONFIG_PCNET32=y CONFIG_PCNET32=y
...@@ -185,8 +193,8 @@ CONFIG_PPP=y ...@@ -185,8 +193,8 @@ CONFIG_PPP=y
# CONFIG_QUOTA is not set # CONFIG_QUOTA is not set
# CONFIG_MINIX_FS is not set # CONFIG_MINIX_FS is not set
CONFIG_EXT2_FS=y CONFIG_EXT2_FS=y
# CONFIG_FAT_FS is not set CONFIG_FAT_FS=y
# CONFIG_MSDOS_FS is not set CONFIG_MSDOS_FS=y
# CONFIG_VFAT_FS is not set # CONFIG_VFAT_FS is not set
# CONFIG_UMSDOS_FS is not set # CONFIG_UMSDOS_FS is not set
CONFIG_PROC_FS=y CONFIG_PROC_FS=y
...@@ -210,8 +218,14 @@ CONFIG_MAC_PARTITION=y ...@@ -210,8 +218,14 @@ CONFIG_MAC_PARTITION=y
# #
CONFIG_VT=y CONFIG_VT=y
CONFIG_VT_CONSOLE=y CONFIG_VT_CONSOLE=y
# CONFIG_SOFTCURSOR is not set
CONFIG_SERIAL=y CONFIG_SERIAL=y
# CONFIG_SERIAL_EXTENDED is not set CONFIG_SERIAL_EXTENDED=y
# CONFIG_SERIAL_MANY_PORTS is not set
# CONFIG_SERIAL_SHARE_IRQ is not set
# CONFIG_SERIAL_MULTIPORT is not set
# CONFIG_HUB6 is not set
CONFIG_SERIAL_CONSOLE=y
# CONFIG_SERIAL_NONSTANDARD is not set # CONFIG_SERIAL_NONSTANDARD is not set
# CONFIG_PRINTER is not set # CONFIG_PRINTER is not set
CONFIG_MOUSE=y CONFIG_MOUSE=y
...@@ -233,26 +247,4 @@ CONFIG_PSMOUSE=y ...@@ -233,26 +247,4 @@ CONFIG_PSMOUSE=y
# #
# Sound # Sound
# #
#CONFIG_SOUND=y # CONFIG_SOUND is not set
# CONFIG_PAS is not set
# CONFIG_SB is not set
# CONFIG_ADLIB is not set
# CONFIG_GUS is not set
# CONFIG_MPU401 is not set
# CONFIG_PSS is not set
# CONFIG_GUS16 is not set
# CONFIG_GUSMAX is not set
# CONFIG_MSS is not set
# CONFIG_SSCAPE is not set
# CONFIG_TRIX is not set
# CONFIG_MAD16 is not set
CONFIG_CS4232=y
# CONFIG_MAUI is not set
# CONFIG_YM3812 is not set
CS4232_BASE=830
CS4232_IRQ=10
CS4232_DMA=6
CS4232_DMA2=7
CS4232_MPU_BASE=330
CS4232_MPU_IRQ=9
# CONFIG_LOWLEVEL_SOUND is not set
...@@ -57,6 +57,12 @@ SECTIONS ...@@ -57,6 +57,12 @@ SECTIONS
CONSTRUCTORS CONSTRUCTORS
} }
_edata = .; _edata = .;
PROVIDE (edata = .);
.fixup : { *(.fixup) }
__start___ex_table = .;
__ex_table : { *(__ex_table) }
__stop___ex_table = .;
. = ALIGN(4096); . = ALIGN(4096);
__init_begin = .; __init_begin = .;
...@@ -65,7 +71,6 @@ SECTIONS ...@@ -65,7 +71,6 @@ SECTIONS
. = ALIGN(4096); . = ALIGN(4096);
__init_end = .; __init_end = .;
PROVIDE (edata = .);
__bss_start = .; __bss_start = .;
.bss : .bss :
{ {
......
# $Id: config.in,v 1.36 1997/06/17 03:54:47 davem Exp $ # $Id: config.in,v 1.38 1997/09/04 01:54:33 davem Exp $
# For a description of the syntax of this configuration file, # For a description of the syntax of this configuration file,
# see the Configure script. # see the Configure script.
# #
...@@ -145,6 +145,10 @@ fi ...@@ -145,6 +145,10 @@ fi
source fs/Config.in source fs/Config.in
mainmenu_option next_comment
comment 'Watchdog'
bool 'Software watchdog' CONFIG_SOFT_WATCHDOG
mainmenu_option next_comment mainmenu_option next_comment
comment 'Kernel hacking' comment 'Kernel hacking'
......
...@@ -52,9 +52,34 @@ device_scan(unsigned long mem_start)) ...@@ -52,9 +52,34 @@ device_scan(unsigned long mem_start))
cpu_ctr++; cpu_ctr++;
} }
}; };
if(cpu_ctr == 0) {
if (sparc_cpu_model == sun4d) {
scan = prom_getchild(prom_root_node);
for (scan = prom_searchsiblings(scan, "cpu-unit"); scan;
scan = prom_searchsiblings(prom_getsibling(scan), "cpu-unit")) {
int node = prom_getchild(scan);
prom_getstring(node, "device_type", node_str, sizeof(node_str));
if (strcmp(node_str, "cpu") == 0) {
prom_getproperty(node, "cpu-id", (char *) &thismid, sizeof(thismid));
if (cpu_ctr < NCPUS) {
cpu_nds[cpu_ctr] = node;
linux_cpus[cpu_ctr].prom_node = node;
linux_cpus[cpu_ctr].mid = thismid;
}
prom_printf("Found CPU %d <node=%08lx,mid=%d>\n",
cpu_ctr, (unsigned long) node,
thismid);
cpu_ctr++;
}
}
}
if (cpu_ctr > NCPUS)
cpu_ctr = NCPUS;
}
if(cpu_ctr == 0) { if(cpu_ctr == 0) {
printk("No CPU nodes found, cannot continue.\n"); printk("No CPU nodes found, cannot continue.\n");
/* Probably a sun4d or sun4e, Sun is trying to trick us ;-) */ /* Probably a sun4e, Sun is trying to trick us ;-) */
halt(); halt();
} }
printk("Found %d CPU prom device tree node(s).\n", cpu_ctr); printk("Found %d CPU prom device tree node(s).\n", cpu_ctr);
......
/* $Id: head.S,v 1.82 1997/05/01 01:40:38 davem Exp $ /* $Id: head.S,v 1.83 1997/08/28 11:10:39 jj Exp $
* head.S: The initial boot code for the Sparc port of Linux. * head.S: The initial boot code for the Sparc port of Linux.
* *
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
...@@ -827,22 +827,18 @@ got_prop: ...@@ -827,22 +827,18 @@ got_prop:
cmp %l1, 'c' ! We already know we are not cmp %l1, 'c' ! We already know we are not
be 1f ! on a plain sun4 because of be 1f ! on a plain sun4 because of
nop ! the check for 0x4000 in %o0 ! the check for 0x4000 in %o0
cmp %l1, 'm' ! at start
cmp %l1, 'm' ! at start
be 1f be 1f
nop cmp %l1, 'd'
be 1f
cmp %l1, 'e' cmp %l1, 'e'
be no_sun4e_here ! Could be a sun4e. be no_sun4e_here ! Could be a sun4e.
nop nop
b no_sun4u_here ! AIEEE, a V9 sun4u... Get our BIG BROTHER kernel :))
b no_sun4u_here ! AIEEE, a V9 sun4u...
nop nop
1: set C_LABEL(cputypval), %l1
1:
set C_LABEL(cputypval), %l1
ldub [%l1 + 0x4], %l1 ldub [%l1 + 0x4], %l1
cmp %l1, 'm' ! Test for sun4d, sun4e ? cmp %l1, 'm' ! Test for sun4d, sun4e ?
be sun4m_init be sun4m_init
......
/* $Id: process.c,v 1.99 1997/07/17 02:20:13 davem Exp $ /* $Id: process.c,v 1.100 1997/08/10 04:49:23 davem Exp $
* linux/arch/sparc/kernel/process.c * linux/arch/sparc/kernel/process.c
* *
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
......
/* $Id: sys_sunos.c,v 1.80 1997/07/17 02:20:22 davem Exp $ /* $Id: sys_sunos.c,v 1.81 1997/07/20 05:59:31 davem Exp $
* sys_sunos.c: SunOS specific syscall compatibility support. * sys_sunos.c: SunOS specific syscall compatibility support.
* *
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
......
/* $Id: srmmu.c,v 1.150 1997/07/25 23:06:17 davem Exp $ /* $Id: srmmu.c,v 1.151 1997/08/28 11:10:54 jj Exp $
* srmmu.c: SRMMU specific routines for memory management. * srmmu.c: SRMMU specific routines for memory management.
* *
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
...@@ -2103,14 +2103,18 @@ unsigned long srmmu_paging_init(unsigned long start_mem, unsigned long end_mem) ...@@ -2103,14 +2103,18 @@ unsigned long srmmu_paging_init(unsigned long start_mem, unsigned long end_mem)
sparc_iobase_vaddr = 0xfd000000; /* 16MB of IOSPACE on all sun4m's. */ sparc_iobase_vaddr = 0xfd000000; /* 16MB of IOSPACE on all sun4m's. */
physmem_mapped_contig = 0; /* for init.c:taint_real_pages() */ physmem_mapped_contig = 0; /* for init.c:taint_real_pages() */
/* Find the number of contexts on the srmmu. */ if (sparc_cpu_model == sun4d)
cpunode = prom_getchild(prom_root_node); num_contexts = 65536; /* We now it is Viking */
num_contexts = 0; else {
while((cpunode = prom_getsibling(cpunode)) != 0) { /* Find the number of contexts on the srmmu. */
prom_getstring(cpunode, "device_type", node_str, sizeof(node_str)); cpunode = prom_getchild(prom_root_node);
if(!strcmp(node_str, "cpu")) { num_contexts = 0;
num_contexts = prom_getintdefault(cpunode, "mmu-nctx", 0x8); while((cpunode = prom_getsibling(cpunode)) != 0) {
break; prom_getstring(cpunode, "device_type", node_str, sizeof(node_str));
if(!strcmp(node_str, "cpu")) {
num_contexts = prom_getintdefault(cpunode, "mmu-nctx", 0x8);
break;
}
} }
} }
......
# $Id: Makefile,v 1.20 1997/07/11 11:05:29 jj Exp $ # $Id: Makefile,v 1.22 1997/08/29 15:51:53 jj Exp $
# sparc64/Makefile # sparc64/Makefile
# #
# Makefile for the architecture dependent flags and dependencies on the # Makefile for the architecture dependent flags and dependencies on the
...@@ -17,7 +17,7 @@ LD = sparc64-linux-ld ...@@ -17,7 +17,7 @@ LD = sparc64-linux-ld
NM = sparc64-linux-nm NM = sparc64-linux-nm
AR = sparc64-linux-ar AR = sparc64-linux-ar
RANLIB = sparc64-linux-ranlib RANLIB = sparc64-linux-ranlib
ELF2AOUT64 = elf2aout64 ELFTOAOUT = elftoaout
# #
# Uncomment the first CFLAGS if you are doing kgdb source level # Uncomment the first CFLAGS if you are doing kgdb source level
...@@ -34,13 +34,21 @@ HEAD := arch/sparc64/kernel/head.o arch/sparc64/kernel/init_task.o ...@@ -34,13 +34,21 @@ HEAD := arch/sparc64/kernel/head.o arch/sparc64/kernel/init_task.o
SUBDIRS := $(SUBDIRS) arch/sparc64/kernel arch/sparc64/lib arch/sparc64/mm \ SUBDIRS := $(SUBDIRS) arch/sparc64/kernel arch/sparc64/lib arch/sparc64/mm \
arch/sparc64/prom arch/sparc64/prom
ifneq ($(CONFIG_SOLARIS_EMUL),n)
SUBDIRS += arch/sparc64/solaris
endif
CORE_FILES := arch/sparc64/kernel/kernel.o arch/sparc64/mm/mm.o $(CORE_FILES) CORE_FILES := arch/sparc64/kernel/kernel.o arch/sparc64/mm/mm.o $(CORE_FILES)
ifeq ($(CONFIG_SOLARIS_EMUL),y)
CORE_FILES += arch/sparc64/solaris/solaris.o
endif
LIBS := $(TOPDIR)/lib/lib.a $(LIBS) $(TOPDIR)/arch/sparc64/prom/promlib.a \ LIBS := $(TOPDIR)/lib/lib.a $(LIBS) $(TOPDIR)/arch/sparc64/prom/promlib.a \
$(TOPDIR)/arch/sparc64/lib/lib.a $(TOPDIR)/arch/sparc64/lib/lib.a
vmlinux.aout: vmlinux vmlinux.aout: vmlinux
$(ELF2AOUT64) -o $(TOPDIR)/vmlinux.aout $(TOPDIR)/vmlinux $(ELFTOAOUT) -o $(TOPDIR)/vmlinux.aout $(TOPDIR)/vmlinux
archclean: archclean:
rm -f $(TOPDIR)/vmlinux.aout rm -f $(TOPDIR)/vmlinux.aout
......
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.
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.
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.
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.
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