Commit 3544b328 authored by Linus Torvalds's avatar Linus Torvalds

v2.4.3 -> v2.4.3.1

  - Bob Tracy: Cyrix MTRR setup fix (don't make it twice as big as asked
  for)
  - Trond Myklebust: rpciod needs to be PF_MEMALLOC to avoid deadlocks on
  memory allocation when writing out NFS data under low memory conditions.
  Fix up BKL and RPC interactions.
  - Jeff Garzik: tulip network driver update
  - fix truncate to call down to the filesystem with the kernel lock.
  - David Mosberger: ia64 update
  - David Mosberger: simplify ELF program header generation.
  - Alan Cox: merge from -ac series
  - Jeff Garzik: make serial.c recognize modem devices properly
parent 27c07b25
......@@ -311,9 +311,6 @@ E: anton@samba.org
W: http://samba.org/~anton/
P: 1024/8462A731 4C 55 86 34 44 59 A7 99 2B 97 88 4A 88 9A 0D 97
D: sun4 port, Sparc hacker
S: 47 Robert Street
S: Marrickville NSW 2204
S: Australia
N: Hugh Blemings
E: hugh@misc.nu
......@@ -766,6 +763,11 @@ S: Grevgatan 11
S: S-114 53 Stockholm
S: Sweden
N: Michael Engel
E: engel@unix-ag.org
D: DECstation framebuffer drivers
S: Germany
N: Paal-Kristian Engstad
E: engstad@intermetrics.com
D: Kernel smbfs (to mount WfW, NT and OS/2 network drives.)
......@@ -1220,13 +1222,12 @@ S: Wantage, New Jersey 07461
S: USA
N: Harald Hoyer
E: HarryH@Royal.Net
W: http://hot.spotline.de/
W: http://home.pages.de/~saturn
E: harald.hoyer@parzelle.de
W: http://parzelle.de/
D: ip_masq_quake
D: md boot support
S: Alleenstrasse 27
S: D-71679 Asperg
S: Hohe Strasse 30
S: D-70176 Stuttgart
S: Germany
N: Jan Hubicka
......@@ -1725,12 +1726,8 @@ S: 198 00 Praha 9
S: Czech Republic
N: Paul Mackerras
E: paulus@linuxcare.com
E: paulus@samba.org
D: Linux port for PCI Power Macintosh
S: Linuxcare, Inc.
S: 24 Marcus Clarke Street
S: Canberra ACT 2601
S: Australia
N: Pat Mackinlay
E: pat@it.com.au
......@@ -1879,6 +1876,11 @@ S: R. Tocantins, 89 - Cristo Rei
S: 80050-430 - Curitiba - Paran
S: Brazil
N: Karsten Merker
E: merker@linuxtag.org
D: DECstation framebuffer drivers
S: Germany
N: Michael Meskes
E: meskes@debian.org
P: 1024/04B6E8F5 6C 77 33 CA CC D6 22 03 AB AB 15 A3 AE AD 39 7D
......@@ -2359,8 +2361,8 @@ S: 79080-740 - Campo Grande - Mato Grosso do Sul
S: Brazil
N: Stephen Rothwell
E: sfr@linuxcare.com.au
W: http://linuxcare.com.au/sfr
E: sfr@canb.auug.org.au
W: http://www.canb.auug.org.au/~sfr
P: 1024/BD8C7805 CD A4 9D 01 10 6E 7E 3B 91 88 FA D9 C8 40 AA 02
D: Boot/setup/build work for setup > 2K
D: Author, APM driver
......@@ -2403,12 +2405,12 @@ S: 91052 Erlangen
S: Germany
N: Paul `Rusty' Russell
E: rusty@linuxcare.com
E: rusty@rustcorp.com.au
W: http://www.samba.org/netfilter
D: Ruggedly handsome.
D: netfilter, ipchains with Michael Neuling.
S: 301/222 City Walk
S: Canberra ACT 2601
S: 52 Moore St
S: Turner ACT 2612
S: Australia
N: Bill Ryder
......@@ -2429,11 +2431,11 @@ S: FIN-33720 Tampere
S: Finland
N: Thomas Sailer
E: sailer@ife.ee.ethz.ch
E: t.sailer@alumni.ethz.ch
E: HB9JNX@HB9W.CHE.EU (packet radio)
D: hfmodem, Baycom and sound card radio modem driver
S: Weinbergstrasse 76
S: 8408 Winterthur
S: Markusstrasse 18
S: 8006 Zuerich
S: Switzerland
N: Robert Sanders
......@@ -2516,6 +2518,14 @@ D: wd33c93 SCSI driver (linux-m68k)
S: San Jose, California
S: USA
N: Robert Siemer
E: Robert.Siemer@gmx.de
P: 2048/C99A4289 2F DC 17 2E 56 62 01 C8 3D F2 AC 09 F2 E5 DD EE
D: miroSOUND PCM20 radio RDS driver, ACI rewrite
S: Klosterweg 28 / i309
S: 76131 Karlsruhe
S: Germany
N: Jaspreet Singh
E: jaspreet@sangoma.com
W: www.sangoma.com
......@@ -2696,7 +2706,7 @@ S: Canada K2L 1S2
N: Andrew Tridgell
E: tridge@samba.org
W: http://linuxcare.com.au/tridge/
W: http://samba.org/tridge/
D: dosemu, networking, samba
S: 3 Ballow Crescent
S: MacGregor A.C.T 2615
......
BOOKS := wanbook.sgml z8530book.sgml mcabook.sgml videobook.sgml \
kernel-api.sgml parportbook.sgml kernel-hacking.sgml \
kernel-locking.sgml via-audio.sgml mousedrivers.sgml sis900.sgml
kernel-locking.sgml via-audio.sgml mousedrivers.sgml sis900.sgml \
deviceiobook.sgml
PS := $(patsubst %.sgml, %.ps, $(BOOKS))
PDF := $(patsubst %.sgml, %.pdf, $(BOOKS))
......@@ -9,12 +10,12 @@ IMG-parportbook := parport-share.fig parport-multi.fig parport-structure.fig
EPS-parportbook := $(patsubst %.fig, %.eps, $(IMG-parportbook))
JPG-parportbook := $(patsubst %.fig, %.jpeg, $(IMG-parportbook))
books: $(BOOKS)
$(BOOKS): $(TOPDIR)/scripts/docproc
.PHONY: books ps pdf html clean mrproper
books: $(BOOKS)
ps: $(PS)
pdf: $(PDF)
......@@ -55,6 +56,9 @@ sis900.sgml: sis900.tmpl $(TOPDIR)/drivers/net/sis900.c
$(TOPDIR)/scripts/docgen $(TOPDIR)/drivers/net/sis900.c \
<sis900.tmpl >sis900.sgml
deviceiobook.sgml: deviceiobook.tmpl
$(TOPDIR)/scripts/docgen <deviceiobook.tmpl >deviceiobook.sgml
mcabook.sgml: mcabook.tmpl $(TOPDIR)/arch/i386/kernel/mca.c
$(TOPDIR)/scripts/docgen $(TOPDIR)/arch/i386/kernel/mca.c \
<mcabook.tmpl >mcabook.sgml
......@@ -64,6 +68,7 @@ videobook.sgml: videobook.tmpl $(TOPDIR)/drivers/media/video/videodev.c
<videobook.tmpl >videobook.sgml
APISOURCES := $(TOPDIR)/drivers/media/video/videodev.c \
$(TOPDIR)/arch/i386/kernel/irq.c \
$(TOPDIR)/arch/i386/kernel/mca.c \
$(TOPDIR)/arch/i386/kernel/mtrr.c \
$(TOPDIR)/drivers/char/misc.c \
......@@ -77,11 +82,24 @@ APISOURCES := $(TOPDIR)/drivers/media/video/videodev.c \
$(TOPDIR)/drivers/net/wan/syncppp.c \
$(TOPDIR)/drivers/net/wan/z85230.c \
$(TOPDIR)/drivers/usb/usb.c \
$(TOPDIR)/fs/locks.c \
$(TOPDIR)/drivers/video/fbmem.c \
$(TOPDIR)/drivers/video/fbcmap.c \
$(TOPDIR)/drivers/video/fbcon.c \
$(TOPDIR)/drivers/video/fbgen.c \
$(TOPDIR)/drivers/video/fonts.c \
$(TOPDIR)/drivers/video/macmodes.c \
$(TOPDIR)/drivers/video/modedb.c \
$(TOPDIR)/fs/devfs/base.c \
$(TOPDIR)/fs/locks.c \
$(TOPDIR)/include/asm-i386/bitops.h \
$(TOPDIR)/kernel/pm.c \
$(TOPDIR)/kernel/ksyms.c \
$(TOPDIR)/kernel/kmod.c \
$(TOPDIR)/kernel/printk.c \
$(TOPDIR)/kernel/sched.c \
$(TOPDIR)/kernel/sysctl.c \
$(TOPDIR)/lib/string.c \
$(TOPDIR)/lib/vsprintf.c \
$(TOPDIR)/net/netsyms.c
kernel-api.sgml: kernel-api.tmpl $(APISOURCES)
......
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V3.1//EN"[]>
<book id="DoingIO">
<bookinfo>
<title>Bus-Independent Device Accesses</title>
<authorgroup>
<author>
<firstname>Matthew</firstname>
<surname>Wilcox</surname>
<affiliation>
<address>
<email>matthew@wil.cx</email>
</address>
</affiliation>
</author>
</authorgroup>
<authorgroup>
<author>
<firstname>Alan</firstname>
<surname>Cox</surname>
<affiliation>
<address>
<email>alan@redhat.com</email>
</address>
</affiliation>
</author>
</authorgroup>
<copyright>
<year>2001</year>
<holder>Matthew Wilcox</holder>
</copyright>
<legalnotice>
<para>
This documentation is free software; you can redistribute
it and/or modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later
version.
</para>
<para>
This program is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
</para>
<para>
You should have received a copy of the GNU General Public
License along with this program; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
</para>
<para>
For more details see the file COPYING in the source
distribution of Linux.
</para>
</legalnotice>
</bookinfo>
<toc></toc>
<chapter id="intro">
<title>Introduction</title>
<para>
Linux provides an API which abstracts performing IO across all busses
and devices, allowing device drivers to be written independently of
bus type.
</para>
</chapter>
<chapter id="bugs">
<title>Known Bugs And Assumptions</title>
<para>
None.
</para>
</chapter>
<chapter id="mmio">
<title>Memory Mapped IO</title>
<sect1>
<title>Getting Access to the Device</title>
<para>
The most widely supported form of IO is memory mapped IO.
That is, a part of the CPU's address space is interpreted
not as accesses to memory, but as accesses to a device. Some
architectures define devices to be at a fixed address, but most
have some method of discovering devices. The PCI bus walk is a
good example of such a scheme. This document does not cover how
to receive such an address, but assumes you are starting with one.
Physical addresses are of type unsigned long.
</para>
<para>
This address should not be used directly. Instead, to get an
address suitable for passing to the accessor functions described
below, you should call <function>ioremap</function>.
An address suitable for accessing the device will be returned to you.
</para>
<para>
After you've finished using the device (say, in your module's
exit routine), call <function>iounmap</function> in order to return
the address space to the kernel. Most architectures allocate new
address space each time you call <function>ioremap</function>, and
they can run out unless you call <function>iounmap</function>.
</para>
</sect1>
<sect1>
<title>Accessing the device</title>
<para>
The part of the interface most used by drivers is reading and
writing memory-mapped registers on the device. Linux provides
interfaces to read and write 8-bit, 16-bit, 32-bit and 64-bit
quantities. Due to a historical accident, these are named byte,
word, long and quad accesses. Both read and write accesses are
supported; there is no prefetch support at this time.
</para>
<para>
The functions are named <function>readb</function>,
<function>readw</function>, <function>readl</function>,
<function>readq</function>, <function>writeb</function>,
<function>writew</function>, <function>writel</function> and
<function>writeq</function>.
</para>
<para>
Some devices (such as framebuffers) would like to use larger
transfers than 8 bytes at a time. For these devices, the
<function>memcpy_toio</function>, <function>memcpy_fromio</function>
and <function>memset_io</function> functions are provided.
Do not use memset or memcpy on IO addresses; they
are not guaranteed to copy data in order.
</para>
<para>
The read and write functions are defined to be ordered. That is the
compiler is not permitted to reorder the I/O sequence. When the
ordering can be compiler optimised, you can use <function>
__readb</function> and friends to indicate the relaxed ordering. Use
this with care. The <function>rmb</function> provides a read memory
barrier. The <function>wmb</function> provides a write memory barrier.
</para>
<para>
While the basic functions are defined to be synchronous with respect
to each other and ordered with respect to each other the busses the
devices sit on may themselves have asynchronocity. In paticular many
authors are burned by the fact that PCI bus writes are posted
asynchronously. A driver author must issue a read from the same
device to ensure that writes have occurred in the specific cases the
author cares. This kind of property cannot be hidden from driver
writers in the API.
</para>
</sect1>
<sect1>
<title>ISA legacy functions</title>
<para>
On older kernels (2.2 and earlier) the ISA bus could be read or
written with these functions and without ioremap being used. This is
no longer true in Linux 2.4. A set of equivalent functions exist for
easy legacy driver porting. The functions available are prefixed
with 'isa_' and are <function>isa_readb</function>,
<function>isa_writeb</function>, <function>isa_readw</function>,
<function>isa_writew</function>, <function>isa_readl</function>,
<function>isa_writel</function), <function>isa_memcpy_fromio</function>
and <function>isa_memcpy_toio</function>
</para>
<para>
These functions should not be used in new drivers, and will
eventually be going away.
</para>
</sect1>
</chapter>
<chapter>
<title>Port Space Accesses</title>
<sect1>
<title>Port Space Explained</title>
<para>
Another form of IO commonly supported is Port Space. This is a
range of addresses separate to the normal memory address space.
Access to these addresses is generally not as fast as accesses
to the memory mapped addresses, and it also has a potentially
smaller address space.
</para>
<para>
Unlike memory mapped IO, no preparation is required
to access port space.
</para>
</sect1>
<sect1>
<title>Accessing Port Space</title>
<para>
Accesses to this space are provided through a set of functions
which allow 8-bit, 16-bit and 32-bit accesses; also
known as byte, word and long. These functions are
<function>inb</function>, <function>inw</function>,
<function>inl</function>, <function>outb</function>,
<function>outw</function> and <function>outl</function>.
</para>
<para>
Some variants are provided for these functions. Some devices
require that accesses to their ports are slowed down. This
functionality is provided by appending a <function>_p</function>
to the end of the function. There are also equivalents to memcpy.
The <function>ins</function> and <function>outs</function>
functions copy bytes, words or longs to the given port.
</para>
</sect1>
</chapter>
<chapter id="pubfunctions">
<title>Public Functions Provided</title>
!Einclude/asm-i386/io.h
</chapter>
</book>
......@@ -36,7 +36,7 @@
<toc></toc>
<chapter id="Basics">
<title>Driver Basic</title>
<title>Driver Basics</title>
<sect1><title>Driver Entry and Exit points</title>
!Iinclude/linux/init.h
</sect1>
......@@ -44,6 +44,10 @@
<sect1><title>Atomics</title>
!Iinclude/asm-i386/atomic.h
</sect1>
<sect1><title>Delaying, scheduling, and timer routines</title>
!Ekernel/sched.c
</sect1>
</chapter>
<chapter id="adt">
......@@ -53,6 +57,29 @@
</sect1>
</chapter>
<chapter id="libc">
<title>Basic C Library Functions</title>
<para>
When writing drivers, you cannot in general use routines which are
from the C Library. Some of the functions have been found generally
useful and they are listed below. The behaviour of these functions
may vary slightly from those defined by ANSI, and these deviations
are noted in the text.
</para>
<sect1><title>String Conversions</title>
!Ilib/vsprintf.c
!Elib/vsprintf.c
</sect1>
<sect1><title>String Manipulation</title>
!Ilib/string.c
</sect1>
<sect1><title>Bit Operations</title>
!Iinclude/asm-i386/bitops.h
</sect1>
</chapter>
<chapter id="mm">
<title>Memory Management in Linux</title>
<sect1><title>The Slab Cache</title>
......@@ -60,6 +87,14 @@
</sect1>
</chapter>
<chapter id="proc">
<title>The proc filesystem</title>
<sect1><title>sysctl interface</title>
!Ekernel/sysctl.c
</sect1>
</chapter>
<chapter id="vfs">
<title>The Linux VFS</title>
<sect1><title>The Directory Cache</title>
......@@ -177,5 +212,68 @@
!Edrivers/net/wan/z85230.c
</chapter>
<chapter id="fbdev">
<title>Frame Buffer Library</title>
<para>
The frame buffer drivers depend heavily on four data structures.
These structures are declared in include/linux/fb.h. They are
fb_info, fb_var_screeninfo, fb_fix_screeninfo and fb_monospecs.
The last three can be made available to and from userland.
</para>
<para>
fb_info defines the current state of a particular video card.
Inside fb_info, there exists a fb_ops structure which is a
collection of needed functions to make fbdev and fbcon work.
fb_info is only visible to the kernel.
</para>
<para>
fb_var_screeninfo is used to describe the features of a video card
that are user defined. With fb_var_screeninfo, things such as
depth and the resolution may be defined.
</para>
<para>
The next structure is fb_fix_screeninfo. This defines the
properties of a card that are created when a mode is set and can't
be changed otherwise. A good example of this is the start of the
frame buffer memory. This "locks" the address of the frame buffer
memory, so that it cannot be changed or moved.
</para>
<para>
The last structure is fb_monospecs. In the old API, there was
little importance for fb_monospecs. This allowed for forbidden things
such as setting a mode of 800x600 on a fix frequency monitor. With
the new API, fb_monospecs prevents such things, and if used
correctly, can prevent a monitor from being cooked. fb_monospecs
will not be useful until kernels 2.5.x.
</para>
<sect1><title>Frame Buffer Memory</title>
!Edrivers/video/fbmem.c
</sect1>
<sect1><title>Frame Buffer Console</title>
!Edrivers/video/fbcon.c
</sect1>
<sect1><title>Frame Buffer Colormap</title>
!Edrivers/video/fbcmap.c
</sect1>
<sect1><title>Frame Buffer Generic Functions</title>
!Idrivers/video/fbgen.c
</sect1>
<sect1><title>Frame Buffer Video Mode Database</title>
!Idrivers/video/modedb.c
!Edrivers/video/modedb.c
</sect1>
<sect1><title>Frame Buffer Macintosh Video Mode Database</title>
!Idrivers/video/macmodes.c
</sect1>
<sect1><title>Frame Buffer Fonts</title>
!Idrivers/video/fonts.c
</sect1>
</chapter>
</book>
......@@ -11,7 +11,7 @@
<surname>Russell</surname>
<affiliation>
<address>
<email>rusty@linuxcare.com</email>
<email>rusty@rustcorp.com.au</email>
</address>
</affiliation>
</author>
......@@ -335,6 +335,11 @@ asmlinkage int sys_mycall(int arg)
likely to be accepted by Linus.
</para>
<para>
If all your routine does is read or write some parameter, consider
implementing a <function>sysctl</function> interface instead.
</para>
<para>
Inside the ioctl you're in user context to a process. When a
error occurs you return a negated errno (see
......@@ -407,7 +412,7 @@ if (current-&gt;need_resched)
<para>
Note that some functions may sleep implicitly: common ones are
the user space access functions (*_user) and memory allocation
functions without GFP_ATOMIC.
functions without <symbol>GFP_ATOMIC</symbol>.
</para>
<para>
......@@ -608,7 +613,8 @@ printk(KERN_INFO "my ip: %d.%d.%d.%d\n", NIPQUAD(ipaddress));
for some weird device, you have a problem: it is poorly supported
in Linux because after some time memory fragmentation in a running
kernel makes it hard. The best way is to allocate the block early
in the boot process.
in the boot process via the <function>alloc_bootmem()</function>
routine.
</para>
<para>
......@@ -631,6 +637,20 @@ printk(KERN_INFO "my ip: %d.%d.%d.%d\n", NIPQUAD(ipaddress));
</para>
</sect1>
<sect1 id="routines-udelay">
<title><function>udelay()</function>/<function>mdelay()</function>
<filename class=headerfile>include/asm/delay.h</filename>
<filename class=headerfile>include/linux/delay.h</filename>
</title>
<para>
The <function>udelay()</function> function can be used for small pauses.
Do not use large values with <function>udelay()</function> as you risk
overflow - the helper function <function>mdelay()</function> is useful
here, or even consider <function>schedule_timeout()</function>.
</para>
</sect1>
<sect1 id="routines-local-irqs">
<title><function>local_irq_save()</function>/<function>local_irq_restore()</function>
<filename class=headerfile>include/asm/system.h</filename>
......@@ -687,8 +707,14 @@ printk(KERN_INFO "my ip: %d.%d.%d.%d\n", NIPQUAD(ipaddress));
modules this directive is currently ignored). <type>__exit</type>
is used to declare a function which is only required on exit: the
function will be dropped if this file is not compiled as a module.
See the header file for use.
See the header file for use. Note that it makes no sense for a function
marked with <type>__init</type> to be exported to modules with
<function>EXPORT_SYMBOL()</function> - this will break.
</para>
<para>
Static data structures marked as <type>__initdata</type> must be initialised
(as opposed to ordinary static data which is zeroed BSS).
</para>
</sect1>
......@@ -775,6 +801,21 @@ foo_open (...)
return 0;
}
</programlisting>
<para>
You can often avoid having to deal with these problems by using the
<structfield>owner</structfield> field of the
<structname>file_operations</structname> structure. Set this field
as the macro <symbol>THIS_MODULE</symbol>.
</para>
<para>
For more complicated module unload locking requirements, you can set the
<structfield>can_unload</structfield> function pointer to your own routine,
which should return <returnvalue>0</returnvalue> if the module is
unloadable, or <returnvalue>-EBUSY</returnvalue> otherwise.
</para>
</sect1>
</chapter>
......@@ -822,6 +863,17 @@ foo_open (...)
<returnvalue>-ERESTARTSYS</returnvalue> if a signal is received.
The <function>wait_event()</function> version ignores signals.
</para>
<para>
Do not use the <function>sleep_on()</function> function family -
it is very easy to accidentally introduce races; almost certainly
one of the <function>wait_event()</function> family will do, or a
loop around <function>schedule_timeout()</function>. If you choose
to loop around <function>schedule_timeout()</function> remember
you must set the task state (with
<function>set_current_state()</function>) on each iteration to avoid
busy-looping.
</para>
</sect1>
<sect1 id="queue-waking">
......@@ -1214,6 +1266,13 @@ static struct block_device_operations opt_fops = {
implies a more-than-passing commitment to some part of the code.
</para>
</listitem>
<listitem>
<para>
Finally, don't forget to read <filename>Documentation/SubmittingPatches</filename>
and possibly <filename>Documentation/SubmittingDrivers</filename>.
</para>
</listitem>
</itemizedlist>
</chapter>
......
......@@ -11,7 +11,7 @@
<surname>Russell</surname>
<affiliation>
<address>
<email>rusty@linuxcare.com</email>
<email>rusty@rustcorp.com.au</email>
</address>
</affiliation>
</author>
......
......@@ -111,7 +111,7 @@ Linux kernel mailing list:
Kernel traffic:
Weekly summary of kernel list activity (much easier to read)
[http://kt.linuxcare.com/kernel-traffic]
[http://kt.zork.net/kernel-traffic]
Linux USB project:
http://sourceforge.net/projects/linux-usb/
......
Linux 2.4 on the CRIS architecture
==================================
$Id: README,v 1.5 2001/01/10 17:20:55 bjornw Exp $
$Id: README,v 1.6 2001/02/21 15:27:25 bjornw Exp $
This is a port of Linux 2.4 to Axis Communications ETRAX 100LX embedded network CPU. For
more information about CRIS and ETRAX please see further below.
This is a port of Linux 2.4 to Axis Communications ETRAX 100LX embedded
network CPU. For more information about CRIS and ETRAX please see further
below.
<... to come: instructions on how to grab the right gcc, compiling and booting ...>
<to come: instructions on how to grab the right gcc, compiling and booting>
What is CRIS ?
--------------
CRIS is an acronym for 'Code Reduced Instruction Set'. It is the CPU architecture in Axis
Communication AB's range of embedded network CPU's, called ETRAX. The latest CPU is called
ETRAX 100LX, where LX stands for 'Linux' because the chip was designed to be a good host for
the Linux operating system.
CRIS is an acronym for 'Code Reduced Instruction Set'. It is the CPU
architecture in Axis Communication AB's range of embedded network CPU's,
called ETRAX. The latest CPU is called ETRAX 100LX, where LX stands for
'Linux' because the chip was designed to be a good host for the Linux
operating system.
The ETRAX 100LX chip
--------------------
......@@ -23,8 +25,8 @@ For reference, plase see the press-release:
http://www.axis.com/news/us/001101_etrax.htm
The ETRAX 100LX is a 100 MIPS processor with 8kB cache, MMU, and a very broad range of
built-in interfaces, all with modern scatter/gather DMA.
The ETRAX 100LX is a 100 MIPS processor with 8kB cache, MMU, and a very broad
range of built-in interfaces, all with modern scatter/gather DMA.
Memory interfaces:
......@@ -44,40 +46,41 @@ I/O interfaces:
* two parallel-ports
* two generic 8-bit ports
(not all interfaces are available at the same time due to chip pin multiplexing)
(not all interfaces are available at the same time due to chip pin
multiplexing)
The previous version of the ETRAX, the ETRAX 100, sits in almost all of Axis shipping
thin-servers like the Axis 2100 web camera or the developer-board. It lacks an MMU so the
Linux we run on that is a version of uClinux (Linux 2.0 without MM-support) ported to the CRIS
architecture. The new Linux 2.4 port has full MM and needs a CPU with an MMU, so it will not
run on the ETRAX 100.
A version of the Axis developer-board with ETRAX 100LX will be available as soon as the chip
is ramped up (please see http://developer.axis.com for further information on that).
The previous version of the ETRAX, the ETRAX 100, sits in almost all of
Axis shipping thin-servers like the Axis 2100 web camera or the ETRAX 100
developer-board. It lacks an MMU so the Linux we run on that is a version
of uClinux (Linux 2.0 without MM-support) ported to the CRIS architecture.
The new Linux 2.4 port has full MM and needs a CPU with an MMU, so it will
not run on the ETRAX 100.
A version of the Axis developer-board with ETRAX 100LX (running Linux
2.4) is now available. For more information please see developer.axis.com.
Bootlog
-------
Just as an example, this is the debug-output from a boot of Linux 2.4 on an Axis
developer-board with ETRAX 100LX. The displayed BogoMIPS value is 5 times too small :)
Just as an example, this is the debug-output from a boot of Linux 2.4 on
a board with ETRAX 100LX. The displayed BogoMIPS value is 5 times too small :)
At the end you see some user-mode programs booting like telnet and ftp daemons.
Linux version 2.4.0-test11 (bjornw@godzilla.axis.se) (gcc version 2.96 20000427 (experimental)) #358 Wed Nov 22 19:29:15 CET 2000
ROM fs in RAM, size 368640 bytes
Linux version 2.4.1 (bjornw@godzilla.axis.se) (gcc version 2.96 20000427 (experimental)) #207 Wed Feb 21 15:48:15 CET 2001
ROM fs in RAM, size 1376256 bytes
Setting up paging and the MMU.
On node 0 totalpages: 1024
zone(0): 1024 pages.
On node 0 totalpages: 2048
zone(0): 2048 pages.
zone(1): 0 pages.
zone(2): 0 pages.
Linux/CRIS port (c) 2000 Axis Communications AB
Linux/CRIS port on ETRAX 100LX (c) 2001 Axis Communications AB
Kernel command line:
Calibrating delay loop... 19.92 BogoMIPS
Memory: 6864k/8192k available (531k kernel code, 1328k reserved, 85k data, 24k init)
Calibrating delay loop... 19.91 BogoMIPS
Memory: 13872k/16384k available (587k kernel code, 2512k reserved, 44k data, 24k init)
kmem_create: Forcing size word alignment - vm_area_struct
kmem_create: Forcing size word alignment - filp
Dentry-cache hash table entries: 1024 (order: 0, 8192 bytes)
Dentry-cache hash table entries: 2048 (order: 1, 16384 bytes)
Buffer-cache hash table entries: 2048 (order: 0, 8192 bytes)
Page-cache hash table entries: 2048 (order: 0, 8192 bytes)
kmem_create: Forcing size word alignment - kiobuf
......@@ -87,41 +90,52 @@ kmem_create: Forcing size word alignment - inode_cache
POSIX conformance testing by UNIFIX
Linux NET4.0 for Linux 2.4
Based upon Swansea University Computer Society NET3.039
kmem_create: Forcing size word alignment - skbuff_head_cache
Starting kswapd v1.8
kmem_create: Forcing size word alignment - file lock cache
kmem_create: Forcing size word alignment - blkdev_requests
block: queued sectors max/low 9109kB/3036kB, 64 slots per queue
ETRAX 100LX 10/100MBit ethernet v2.0 (c) 2000 Axis Communications AB
eth0 initialized
eth0: changed MAC to 00:40:8C:CD:00:00
ETRAX 100LX serial-driver $Revision: 1.5 $, (c) 2000 Axis Communications AB
ETRAX 100LX serial-driver $Revision: 1.6 $, (c) 2000 Axis Communications AB
ttyS0 at 0xb0000060 is a builtin UART with DMA
ttyS1 at 0xb0000068 is a builtin UART with DMA
ttyS2 at 0xb0000070 is a builtin UART with DMA
ttyS3 at 0xb0000078 is a builtin UART with DMA
Axis flash mapping: 200000 at 50000000
Axis flash: Found 1 x16 CFI device at 0x0 in 16 bit mode
Amd/Fujitsu Extended Query Table v1.0 at 0x0040
Axis flash: JEDEC Device ID is 0xC4. Assuming broken CFI table.
Axis flash: Swapping erase regions for broken CFI table.
number of CFI chips: 1
Using default partition table
I2C driver v2.2, (c) 1999-2001 Axis Communications AB
ETRAX 100LX GPIO driver v2.1, (c) 2001 Axis Communications AB
NET4: Linux TCP/IP 1.0 for NET4.0
IP Protocols: ICMP, UDP, TCP
kmem_create: Forcing size word alignment - ip_dst_cache
IP: routing cache hash table of 1024 buckets, 8Kbytes
TCP: Hash tables configured (established 1024 bind 1024)
TCP: Hash tables configured (established 2048 bind 2048)
NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.
VFS: Mounted root (cramfs filesystem) readonly.
Init starts up...
Mounted none on /proc ok.
Setting up eth0 with ip 10.13.9.116 and mac 00:40:8c:18:04:60
eth0: changed MAC to 00:40:8C:18:04:60
Setting up lo with ip 127.0.0.1
Default gateway is 10.13.9.1
Hostname is bbox1
Telnetd starting, using port 23.
using /bin/sh as shell.
sftpd[14]: sftpd $Revision: 1.5 $ starting up
using /bin/sash as shell.
sftpd[15]: sftpd $Revision: 1.6 $ starting up
And here is how some /proc entries look:
17# cd /proc
17# cat cpuinfo
cpu : ETRAX
cpu : CRIS
cpu revision : 10
cpu model : ETRAX 100LX
cache size : 8 kB
......@@ -133,6 +147,7 @@ scsi : yes
ata : yes
usb : yes
bogomips : 99.84
17# cat meminfo
total: used: free: shared: buffers: cached:
Mem: 7028736 925696 6103040 114688 0 229376
......
Linux Directory Notification
============================
Stephen Rothwell <sfr@linuxcare.com.au>
Stephen Rothwell <sfr@canb.auug.org.au>
The intention of directory notification is to allow user applications
to be notified when a directory, or any of the files in it, are changed.
......
......@@ -495,7 +495,7 @@ Changes for patch v52
- Replaced dummy .epoch inode with .devfsd character device
- Modified rc.devfs to take acount of above change
- Modified rc.devfs to take account of above change
- Removed spurious driver warning messages when CONFIG_DEVFS_FS=n
......
......@@ -49,7 +49,7 @@ This documentation is part of a soon (or so we hope) to be released book on
the SuSE Linux distribution. As there is no complete documentation for the
/proc file system and we've used many freely available sources to write these
chapters, it seems only fair to give the work back to the Linux community.
This work is based on the 2.2.* kernel version and the upcomming 2.4.*. I'm
This work is based on the 2.2.* kernel version and the upcoming 2.4.*. I'm
afraid it's still far from complete, but we hope it will be useful. As far as
we know, it is the first 'all-in-one' document about the /proc file system. It
is focused on the Intel x86 hardware, so if you are looking for PPC, ARM,
......@@ -281,7 +281,7 @@ LOC is the local interrupt counter of the internal APIC of every CPU.
ERR is incremented in the case of errors in the IO-APIC bus (the bus that
connects the CPUs in a SMP system. This means that an error has been detected,
the IO-APIC automatically retry the transmision, so it should not be a big
the IO-APIC automatically retry the transmission, so it should not be a big
problem, but you should read the SMP-FAQ.
In this context it could be interesting to note the new irq directory in 2.4.
......
......@@ -114,7 +114,7 @@ snippet, this ends up being shorter.
~~~~~~~~~~~~~~~~~
The time an event was generated is stored in ``js_event.time''. It's a time
in miliseconds since ... well, since sometime in the past. This eases the
in milliseconds since ... well, since sometime in the past. This eases the
task of detecting double clicks, figuring out if movement of axis and button
presses happened at the same time, and similar.
......
......@@ -608,7 +608,7 @@
produced during the week. Published every Thursday.
* Name: "Kernel Traffic"
URL: http://kt.linuxcare.com
URL: http://kt.zork.net
Keywords: linux-kernel mailing list, weekly kernel news.
Description: Weekly newsletter covering the most relevant
discussions of the linux-kernel mailing list.
......
......@@ -162,7 +162,7 @@ pppd (this pppd will work as async pppd to, the modifiactions merely relax
some restricions in order to be able to use non-async lines too.
If configured, this driver can use Van Jacobson TCP header compression (you'll
need the slhc.o module for this).
Additionaly to use this protocol, enable async ppp in your kernel config, and
Additionally to use this protocol, enable async ppp in your kernel config, and
create the comx device special files in /dev. They're character special files
with major 88, and their names must be the same as their network interface
counterparts (i.e /dev/comx0 with minor 0 corresponds interface comx0 and so
......
......@@ -174,7 +174,7 @@ spintime The number of microseconds to busy-loop while waiting
peripherals. This is a port-wide setting, i.e. it
applies to all devices on a particular port.
timeslice The number of miliseconds that a device driver is
timeslice The number of milliseconds that a device driver is
allowed to keep a port claimed for. This is advisory,
and driver can ignore it if it must.
......
......@@ -33,7 +33,7 @@ and be sure that they are started sometime in the system boot process.
Go ahead and start both. If ACPI or APM is not available on your
system the associated daemon will exit gracefully.
apmd: http://linuxcare.com.au/apm/
apmd: http://worldvisions.ca/~apenwarr/apmd/
acpid: http://phobos.fs.tum.de/acpi/
Driver Interface
......
......@@ -106,6 +106,13 @@ M: p_gortmaker@yahoo.com
L: linux-net@vger.kernel.org
S: Maintained
ACI MIXER DRIVER
P: Robert Siemer
M: Robert.Siemer@gmx.de
L: linux-sound@vger.kernel.org
W: http://www.uni-karlsruhe.de/~Robert.Siemer/Private/
S: Maintained
ACPI
P: Andy Grover
M: andrew.grover@intel.com
......@@ -141,9 +148,9 @@ S: Maintained
APM DRIVER
P: Stephen Rothwell
M: apm@linuxcare.com.au
M: sfr@canb.auug.org.au
L: linux-laptop@vger.kernel.org
W: http://linuxcare.com.au/apm/
W: http://www.canb.auug.org.au/~sfr/
S: Supported
APPLETALK NETWORK LAYER
......@@ -293,6 +300,13 @@ P: John A. Martin
M: jam@acm.org
S: Maintained
CRIS PORT
P: Bjorn Wesen
M: bjornw@axis.com
L: dev-etrax@axis.com
W: http://developer.axis.com
S: Maintained
CYBERPRO FB DRIVER
P: Russell King
M: linux@arm.linux.org.uk
......@@ -368,7 +382,7 @@ S: Maintained
DIRECTORY NOTIFICATION
P: Stephen Rothwell
M: sfr@linuxcare.com.au
M: sfr@canb.auug.org.au
L: linux-kernel@vger.kernel.org
S: Supported
......@@ -398,6 +412,12 @@ M: faith@valinux.com
L: dri-devel@lists.sourceforge.net
S: Supported
DSCC4 DRIVER
P: Franois Romieu
M: romieu@cogenit.fr
M: romieu@ensta.fr
S: Maintained
EATA-DMA SCSI DRIVER
P: Michael Neuffer
M: mike@i-Connect.Net
......@@ -490,6 +510,12 @@ L: linux-scsi@vger.kernel.org
W: http://www.icp-vortex.com/
S: Supported
GENERIC HDLC DRIVER, N2 AND C101 DRIVERS
P: Krzysztof Halasa
M: khc@pm.waw.pl
W: http://hq.pm.waw.pl/hdlc/
S: Maintained
HAYES ESP SERIAL DRIVER
P: Andrew J. Robinson
M: arobinso@nyx.net
......@@ -535,7 +561,7 @@ S: Maintained
HIPPI
P: Jes Sorensen
M: Jes.Sorensen@cern.ch
M: jes@linuxcare.com
L: linux-hippi@sunsite.auc.dk
S: Maintained
......@@ -600,7 +626,14 @@ L: linux-kernel@vger.kernel.org
W: http://www.kernel.dk
S: Maintained
IDE/ATAPI TAPE/FLOPPY DRIVERS
IDE/ATAPI FLOPPY DRIVERS
P: Paul Bristow
M: Paul Bristow <paul@paulbristow.net>
W: http://paulbristow.net/linux/idefloppy.html
L: linux-kernel@vger.kernel.org
S: Maintained
IDE/ATAPI TAPE DRIVERS
P: Gadi Oxman
M: Gadi Oxman <gadio@netvision.net.il>
L: linux-kernel@vger.kernel.org
......@@ -750,14 +783,14 @@ S: Maintained
LINUX FOR POWER MACINTOSH
P: Paul Mackerras
M: paulus@linuxcare.com
M: paulus@samba.org
W: http://www.linuxppc.org/
L: linuxppc-dev@lists.linuxppc.org
S: Maintained
M68K
P: Jes Sorensen
M: Jes.Sorensen@cern.ch
M: jes@linuxcare.com
W: http://www.clark.net/pub/lawrencc/linux/index.html
L: linux-m68k@lists.linux-m68k.org
S: Maintained
......@@ -775,7 +808,7 @@ M: philb@gnu.org
W: http://www.tazenda.demon.co.uk/phil/linux-hp
S: Maintained
MAESTRO PCI SOUND DRIVER
MAESTRO PCI SOUND DRIVERS
P: Zach Brown
M: zab@zabbo.net
S: Odd Fixes
......@@ -787,6 +820,12 @@ W: http://www.linux-mtd.infradead.org/
L: mtd@infradead.org
S: Maintained
MICROTEK X6 SCANNER
P: Oliver Neukum
M: drivers@neukum.org
W: http://fachschaft.cup.uni-muenchen.de/~neukum/scanner.html
S: Maintained
MIPS
P: Ralf Baechle
M: ralf@gnu.ai.mit.edu
......@@ -837,10 +876,14 @@ S: Maintained
NETFILTER
P: Rusty Russell
M: rusty@linuxcare.com
M: rusty@rustcorp.com.au
P: Marc Boucher
M: marc@mbsi.ca
W: http://www.samba.org/netfilter/
P: James Morris
M: jamesm@intercode.com.au
P: Harald Welte
M: laforge@gnumonks.org
W: http://netfilter.samba.org
W: http://netfilter.kernelnotes.org
W: http://netfilter.filewatcher.org
L: netfilter@lists.samba.org
......@@ -904,8 +947,9 @@ S: Maintained
NTFS FILESYSTEM
P: Anton Altaparmakov
M: aia21@cus.cam.ac.uk
L: linux-ntfs-dev@lists.sourceforge.net
L: linux-kernel@vger.kernel.org
S: Odd Fixes
S: Maintained
NVIDIA (RIVA) FRAMEBUFFER DRIVER
P: Ani Joshi
......@@ -997,7 +1041,7 @@ S: Maintained
PPP PROTOCOL DRIVERS AND COMPRESSORS
P: Paul Mackerras
M: paulus@linuxcare.com
M: paulus@samba.org
L: linux-ppp@vger.kernel.org
S: Maintained
......@@ -1037,6 +1081,13 @@ M: p_gortmaker@yahoo.com
L: linux-kernel@vger.kernel.org
S: Maintained
REISERFS FILE SYSTEM
P: Hans Reiser
M: reiserfs-dev@namesys.com
L: reiserfs-list@namesys.com
W: http://www.namesys.com
S: Supported
ROSE NETWORK LAYER
P: Jean-Paul Roubelat
M: jpr@f6fbb.org
......@@ -1056,6 +1107,14 @@ L: rtl@rtlinux.org
W: www.rtlinux.org
S: Maintained
S390
P: Martin Schwidefsky
M: schwidefsky@de.ibm.com
M: linux390@de.ibm.com
L: linux-390@vm.marist.edu
W: http://oss.software.ibm.com/developerworks/opensource/linux390
S: Supported
SA1100 SUPPORT
P: Nicolas Pitre
M: nico@cam.org
......@@ -1174,6 +1233,11 @@ M: support@stallion.oz.au
W: http://www.stallion.com
S: Supported
STARFIRE/DURALAN NETWORK DRIVER
P: Ion Badulescu
M: ionut@cs.columbia.edu
S: Maintained
STARMODE RADIO IP (STRIP) PROTOCOL DRIVER
W: http://mosquitonet.Stanford.EDU/strip.html
S: Unsupported ?
......@@ -1357,11 +1421,11 @@ S: Maintained
USB SERIAL KEYSPAN DRIVER
P: Hugh Blemings
M: hugh@linuxcare.com
M: hugh@misc.nu
L: linux-usb-users@lists.sourceforge.net
L: linux-usb-devel@lists.sourceforge.net
S: Maintained
W: http://www.linuxcare.com.au/hugh/keyspan.html
W: http://misc.nu/hugh/keyspan/
USB SERIAL DRIVER
P: Greg Kroah-Hartman
......@@ -1459,6 +1523,12 @@ P: Ingo Molnar
M: mingo@redhat.com
S: Maintained
YAM DRIVER FOR AX.25
P: Jean-Paul Roubelat
M: jpr@f6fbb.org
L: linux-hams@vger.kernel.org
S: Maintained
Z85230 SYNCHRONOUS DRIVER
P: Alan Cox
M: alan@redhat.com
......
VERSION = 2
PATCHLEVEL = 4
SUBLEVEL = 3
EXTRAVERSION =
SUBLEVEL = 4
EXTRAVERSION =-pre1
KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
......
......@@ -25,10 +25,9 @@ list. Having a standardized bug report form makes it easier for you not to
overlook things, and easier for the developers to find the pieces of
information they're really interested in. Don't feel you have to follow it.
First run the ver_linux script included as scripts/ver_linux or
at <URL:ftp://ftp.sai.msu.su/pub/Linux/ver_linux> It checks out
the version of some important subsystems. Run it with the command
"sh scripts/ver_linux"
First run the ver_linux script included as scripts/ver_linux, which
reports the version of some important subsystems. Run this script with
the command "sh scripts/ver_linux".
Use that information to fill in all fields of the bug report form, and
post it to the mailing list with a subject of "PROBLEM: <one line
......
# $Id: Makefile,v 1.11 2000/11/27 17:58:30 bjornw Exp $
# $Id: Makefile,v 1.15 2001/02/16 17:50:04 larsv Exp $
# cris/Makefile
#
# This file is included by the global makefile so that you can add your own
......@@ -25,7 +25,7 @@ LD_SCRIPT=$(TOPDIR)/arch/cris/cris.ld
# regenerating stuff (even for incremental linking of subsystems!) is
# even more nauseating.
LD = if [ ! -e $(LD_SCRIPT).tmp -o $(LD_SCRIPT) -nt $(LD_SCRIPT).tmp ]; then \
sed -e s/@ETRAX_DRAM_BASE@/0x$(ETRAX_DRAM_BASE)/ \
sed -e s/@ETRAX_DRAM_VIRTUAL_BASE@/0x$(ETRAX_DRAM_VIRTUAL_BASE)/ \
-e s/@ETRAX_DRAM_SIZE_M@/$(ETRAX_DRAM_SIZE)/ \
< $(LD_SCRIPT) > $(LD_SCRIPT).tmp; \
else true; \
......@@ -49,7 +49,7 @@ endif
HEAD := arch/cris/kernel/head.o
SUBDIRS += arch/cris/kernel arch/cris/mm arch/cris/lib arch/cris/drivers
SUBDIRS += arch/cris/kernel arch/cris/mm arch/cris/lib arch/cris/drivers arch/cris/boot/rescue
CORE_FILES += arch/cris/kernel/kernel.o arch/cris/mm/mm.o arch/cris/drivers/drivers.o
LIBGCC = $(shell $(CC) $(CFLAGS) -print-file-name=libgcc.a)
LIBS := $(TOPDIR)/arch/cris/lib/lib.a $(LIBS) $(TOPDIR)/arch/cris/lib/lib.a $(LIBGCC)
......@@ -76,10 +76,18 @@ simimage: timage
cramfs:
## cramfs - Creates a cramfs image
mkcramfs -p 8192 root cramfs.img
mkcramfs -b 8192 root cramfs.img
cat vmlinux.bin cramfs.img >timage
zImage: vmlinux
clinux: vmlinux.bin decompress.bin rescue.bin
decompress.bin: dummy
@make -C arch/cris/boot/compressed decompress.bin
rescue.bin: dummy
@make -C arch/cris/boot/rescue rescue.bin
zImage: vmlinux.bin
## zImage - Compressed kernel (gzip)
@$(MAKEBOOT) zImage
......
......@@ -16,11 +16,14 @@ SYSTEM = $(TOPDIR)/vmlinux.bin
all: vmlinuz
vmlinuz: piggy.img $(OBJECTS)
$(LD) -mcriself -T decompress.ld -o decompress.o $(OBJECTS)
decompress.bin: $(OBJECTS)
$(LD) -T decompress.ld -o decompress.o $(OBJECTS)
$(OBJCOPY) -O binary --remove-section=.bss decompress.o decompress.bin
# save it for mkprod in the topdir.
cp decompress.bin $(TOPDIR)
vmlinuz: piggy.img decompress.bin
cat decompress.bin piggy.img $(TOPDIR)/cramfs.img > vmlinuz
rm -f piggy.img
......
OUTPUT_FORMAT(elf32-us-cris)
MEMORY
{
dram : ORIGIN = 0x40700000,
......
......@@ -8,7 +8,6 @@
*
*/
#include <linux/config.h>
#define ASSEMBLER_MACROS_ONLY
#include <asm/sv_addr_ag.h>
......@@ -22,23 +21,24 @@
nop
di
#ifndef CONFIG_SVINTO_SIM
;; We need to setup the bus registers before we start using the DRAM
;; We need to initialze DRAM registers before we start using the DRAM
#include "../../lib/dram_init.S"
dram_init_finished:
;; Initiate the PA and PB ports
move.d DEF_R_WAITSTATES, r0
move.d r0, [R_WAITSTATES]
move.b DEF_R_PORT_PA_DATA, r0
move.b r0, [R_PORT_PA_DATA]
move.d DEF_R_BUS_CONFIG, r0
move.d r0, [R_BUS_CONFIG]
move.d DEF_R_DRAM_CONFIG, r0
move.d r0, [R_DRAM_CONFIG]
move.b DEF_R_PORT_PA_DIR, r0
move.b r0, [R_PORT_PA_DIR]
move.d DEF_R_DRAM_TIMING, r0
move.d r0, [R_DRAM_TIMING]
move.b DEF_R_PORT_PB_DATA, r0
move.b r0, [R_PORT_PB_DATA]
#endif
move.b DEF_R_PORT_PB_DIR, r0
move.b r0, [R_PORT_PB_DIR]
;; Setup the stack to a suitably high address.
;; We assume 8 MB is the minimum DRAM in an eLinux
......@@ -83,7 +83,7 @@ basse: move.d pc, r5
;; Do the decompression and save compressed size in _inptr
jsr _decompress_kernel
;; Put start address of cramfs in r9 so the kernel can use it
;; when mounting from flash
......@@ -91,7 +91,6 @@ basse: move.d pc, r5
add.d [_inptr], r9 ; size of compressed kernel
;; Enter the decompressed kernel
jump 0x40004000 ; kernel is linked to this address
.data
......
......@@ -13,7 +13,7 @@
*/
/* where the piggybacked kernel image expects itself to live.
* it is the same address we use when we network load an uncompressed
* it is the same adress we use when we network load an uncompressed
* image into DRAM, and it is the address the kernel is linked to live
* at by etrax100.ld.
*/
......
#
# Makefile for rescue code
#
ifndef TOPDIR
TOPDIR = ../../../..
endif
CC = gcc-cris -I $(TOPDIR)/include
CFLAGS = -O2
LD = ld-cris
OBJCOPY = objcopy-cris
all: rescue.bin testrescue.bin kimagerescue.bin
rescue: rescue.bin
# do nothing
rescue.bin: head.o
$(LD) -T rescue.ld -o rescue.o head.o
$(OBJCOPY) -O binary --remove-section=.bss rescue.o rescue.bin
cp rescue.bin $(TOPDIR)
testrescue.bin: testrescue.o
$(OBJCOPY) -O binary --remove-section=.bss testrescue.o tr.bin
# Pad it to 784 bytes
dd if=/dev/zero of=tmp2423 bs=1 count=784
cat tr.bin tmp2423 >testrescue_tmp.bin
dd if=testrescue_tmp.bin of=testrescue.bin bs=1 count=784
rm tr.bin tmp2423 testrescue_tmp.bin
kimagerescue.bin: kimagerescue.o
$(OBJCOPY) -O binary --remove-section=.bss kimagerescue.o ktr.bin
# Pad it to 784 bytes, that's what the rescue loader expects
dd if=/dev/zero of=tmp2423 bs=1 count=784
cat ktr.bin tmp2423 >kimagerescue_tmp.bin
dd if=kimagerescue_tmp.bin of=kimagerescue.bin bs=1 count=784
rm ktr.bin tmp2423 kimagerescue_tmp.bin
head.o: head.S
$(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o
testrescue.o: testrescue.S
$(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o
kimagerescue.o: kimagerescue.S
$(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o
clean:
rm -f *.o *.bin
fastdep:
;; $Id: head.S,v 1.3 2001/02/14 16:57:25 larsv Exp $
;;
;; Rescue code, made to reside at the beginning of the
;; flash-memory. when it starts, it checks a partition
;; table at the first sector after the rescue sector.
;; the partition table was generated by the product builder
;; script and contains offsets, lengths, types and checksums
;; for each partition that this code should check.
;;
;; If any of the checksums fail, we assume the flash is so
;; corrupt that we cant use it to boot into the ftp flash
;; loader, and instead we initialize the serial port to
;; receive a flash-loader and new flash image. we dont include
;; any flash code here, but just accept a certain amount of
;; bytes from the serial port and jump into it. the downloaded
;; code is put in the cache.
;;
;; The partitiontable is designed so that it is transparent to
;; code execution - it has a relative branch opcode in the
;; beginning that jumps over it. each entry contains extra
;; data so we can add stuff later.
;;
;; Partition table format:
;;
;; Code transparency:
;;
;; 2 bytes [opcode 'nop']
;; 2 bytes [opcode 'di']
;; 4 bytes [opcode 'ba <offset>', 8-bit or 16-bit version]
;; 2 bytes [opcode 'nop', delay slot]
;;
;; Table validation (at +10):
;;
;; 2 bytes [magic/version word for partitiontable - 0xef, 0xbe]
;; 2 bytes [length of all entries plus the end marker]
;; 4 bytes [checksum for the partitiontable itself]
;;
;; Entries, each with the following format, last has offset -1:
;;
;; 4 bytes [offset in bytes, from start of flash]
;; 4 bytes [length in bytes of partition]
;; 4 bytes [checksum, simple longword sum]
;; 2 bytes [partition type]
;; 2 bytes [flags, only bit 0 used, ro/rw = 1/0]
;; 16 bytes [reserved for future use]
;;
;; End marker
;;
;; 4 bytes [-1]
;;
;; 10 bytes [0, padding]
;;
;; Bit 0 in flags signifies RW or RO. The rescue code only bothers
;; to check the checksum for RO partitions, since the others will
;; change its data without updating the checksums. A 1 in bit 0
;; means RO, 0 means RW. That way, it is possible to set a partition
;; in RO mode initially, and later mark it as RW, since you can always
;; write 0's to the flash.
;;
;; During the wait for serial input, the status LED will flash so the
;; user knows something went wrong.
;;
;; Copyright (C) 1999 Axis Communications AB
#include <linux/config.h>
#define ASSEMBLER_MACROS_ONLY
#include <asm/sv_addr_ag.h>
;; The partitiontable is looked for at the first sector after the boot
;; sector. Sector size is 65536 bytes in all flashes we use.
#define PTABLE_START 0x10000
#define PTABLE_MAGIC 0xbeef
;; The normal Etrax100 on-chip boot ROM does serial boot at 0x380000f0.
;; That is not where we put our downloaded serial boot-code. The length is
;; enough for downloading code that loads the rest of itself (after
;; having setup the DRAM etc). It is the same length as the on-chip
;; ROM loads, so the same host loader can be used to load a rescued
;; product as well as one booted through the Etrax serial boot code.
#define CODE_START 0x40000000
#define CODE_LENGTH 784
#ifdef CONFIG_RESCUE_SER0
#define SERXOFF R_SERIAL0_XOFF
#define SERBAUD R_SERIAL0_BAUD
#define SERRECC R_SERIAL0_REC_CTRL
#define SERRDAT R_SERIAL0_REC_DATA
#define SERSTAT R_SERIAL0_STATUS
#endif
#ifdef CONFIG_RESCUE_SER1
#define SERXOFF R_SERIAL1_XOFF
#define SERBAUD R_SERIAL1_BAUD
#define SERRECC R_SERIAL1_REC_CTRL
#define SERRDAT R_SERIAL1_REC_DATA
#define SERSTAT R_SERIAL1_STATUS
#endif
#ifdef CONFIG_RESCUE_SER2
#define SERXOFF R_SERIAL2_XOFF
#define SERBAUD R_SERIAL2_BAUD
#define SERRECC R_SERIAL2_REC_CTRL
#define SERRDAT R_SERIAL2_REC_DATA
#define SERSTAT R_SERIAL2_STATUS
#endif
#ifdef CONFIG_RESCUE_SER3
#define SERXOFF R_SERIAL3_XOFF
#define SERBAUD R_SERIAL3_BAUD
#define SERRECC R_SERIAL3_REC_CTRL
#define SERRDAT R_SERIAL3_REC_DATA
#define SERSTAT R_SERIAL3_STATUS
#endif
#define NOP_DI 0xf025050f
.text
;; This is the entry point of the rescue code
;; 0x80000000 if loaded in flash (as it should be)
;; since etrax actually starts at address 2 when booting from flash, we
;; put a nop (2 bytes) here first so we dont accidentally skip the di
nop
di
jump in_cache ; enter cached area instead
in_cache:
;; first put a jump test to give a possibility of upgrading the rescue code
;; without erasing/reflashing the sector. we put a longword of -1 here and if
;; its not -1, we jump using the value as jump target. since we can always
;; change 1's to 0's without erasing the sector, it is possible to add new
;; code after this and altering the jumptarget in an upgrade.
jtcd: move.d [jumptarget], r0
cmp.d 0xffffffff, r0
beq no_newjump
nop
jump [r0]
jumptarget:
.dword 0xffffffff ; can be overwritten later to insert new code
no_newjump:
;; We need to setup the bus registers before we start using the DRAM
#include "../../lib/dram_init.S"
;; we now should go through the checksum-table and check the listed
;; partitions for errors.
move.d PTABLE_START, r3
move.d [r3], r0
cmp.d NOP_DI, r0 ; make sure the nop/di is there...
bne do_rescue
nop
;; skip the code transparency block (10 bytes).
addq 10, r3
;; check for correct magic
move.w [r3+], r0
cmp.w PTABLE_MAGIC, r0
bne do_rescue ; didn't recognize - trig rescue
nop
;; check for correct ptable checksum
movu.w [r3+], r2 ; ptable length
move.d r2, r8 ; save for later, length of total ptable
addq 28, r8 ; account for the rest
move.d [r3+], r4 ; ptable checksum
move.d r3, r1
jsr checksum ; r1 source, r2 length, returns in r0
cmp.d r0, r4
bne do_rescue ; didn't match - trig rescue
nop
;; ptable is ok. validate each entry.
moveq -1, r7
ploop: move.d [r3+], r1 ; partition offset (from ptable start)
bne notfirst ; check if its the partition containing ptable
nop ; yes..
move.d r8, r1 ; for its checksum check, skip the ptable
move.d [r3+], r2 ; partition length
sub.d r8, r2 ; minus the ptable length
ba bosse
nop
notfirst:
cmp.d -1, r1 ; the end of the ptable ?
beq flash_ok ; if so, the flash is validated
move.d [r3+], r2 ; partition length
bosse: move.d [r3+], r5 ; checksum
move.d [r3+], r4 ; type and flags
addq 16, r3 ; skip the reserved bytes
btstq 16, r4 ; check ro flag
bpl ploop ; rw partition, skip validation
nop
btstq 17, r4 ; check bootable flag
bpl 1f
nop
move.d r1, r7 ; remember boot partition offset
1:
add.d PTABLE_START, r1
jsr checksum ; checksum the partition
cmp.d r0, r5
beq ploop ; checksums matched, go to next entry
nop
;; otherwise fall through to the rescue code.
do_rescue:
;; setup port PA and PB default initial directions and data
;; (so we can flash LEDs, and so that DTR and others are set)
move.b DEF_R_PORT_PA_DIR, r0
move.b r0, [R_PORT_PA_DIR]
move.b DEF_R_PORT_PA_DATA, r0
move.b r0, [R_PORT_PA_DATA]
move.b DEF_R_PORT_PB_DIR, r0
move.b r0, [R_PORT_PB_DIR]
move.b DEF_R_PORT_PB_DATA, r0
move.b r0, [R_PORT_PB_DATA]
;; setup the serial port at 115200 baud
moveq 0, r0
move.d r0, [SERXOFF]
move.b 0x99, r0
move.b r0, [SERBAUD] ; 115.2kbaud for both transmit and receive
move.b 0x40, r0 ; rec enable
move.b r0, [SERRECC]
moveq 0, r1 ; "timer" to clock out a LED red flash
move.d CODE_START, r3 ; destination counter
movu.w CODE_LENGTH, r4 ; length
wait_ser:
addq 1, r1
#ifndef CONFIG_ETRAX_NO_LEDS
#ifdef CONFIG_ETRAX_PA_LEDS
move.b DEF_R_PORT_PA_DATA, r2
#endif
#ifdef CONFIG_ETRAX_PB_LEDS
move.b DEF_R_PORT_PB_DATA, r2
#endif
move.d (1 << CONFIG_ETRAX_LED1R) | (1 << CONFIG_ETRAX_LED2R), r0
btstq 16, r1
bpl 1f
nop
or.d r0, r2 ; set bit
ba 2f
nop
1: not r0 ; clear bit
and.d r0, r2
2:
#ifdef CONFIG_ETRAX_PA_LEDS
move.b r2, [R_PORT_PA_DATA]
#endif
#ifdef CONFIG_ETRAX_PB_LEDS
move.b r2, [R_PORT_PB_DATA]
#endif
#ifdef CONFIG_ETRAX_90000000_LEDS
move.b r2, [0x90000000]
#endif
#endif
;; check if we got something on the serial port
move.b [SERSTAT], r0
btstq 0, r0 ; data_avail
bpl wait_ser
nop
;; got something - copy the byte and loop
move.b [SERRDAT], r0
move.b r0, [r3+]
subq 1, r4 ; decrease length
bne wait_ser
nop
;; jump into downloaded code
jump CODE_START
flash_ok:
;; check r7, which contains either -1 or the partition to boot from
cmp.d -1, r7
bne 1f
nop
move.d PTABLE_START, r7; otherwise use the ptable start
1:
jump r7 ; boot!
;; Helper subroutines
;; Will checksum by simple addition
;; r1 - source
;; r2 - length in bytes
;; result will be in r0
checksum:
moveq 0, r0
1: addu.b [r1+], r0
subq 1, r2
bne 1b
nop
ret
nop
;; $Id: kimagerescue.S,v 1.2 2001/02/14 16:57:25 larsv Exp $
;;
;; Rescue code to be prepended on a kimage and copied to the
;; rescue serial port.
;; This is called from the rescue code, it will copy received data to
;; 4000500 and after a timeout jump to it.
#include <linux/config.h>
#define ASSEMBLER_MACROS_ONLY
#include <asm/sv_addr_ag.h>
#define CODE_START 0x40000500
#define CODE_LENGTH 784
#define TIMEOUT_VALUE 1000
#ifdef CONFIG_RESCUE_SER0
#define SERXOFF R_SERIAL0_XOFF
#define SERBAUD R_SERIAL0_BAUD
#define SERRECC R_SERIAL0_REC_CTRL
#define SERRDAT R_SERIAL0_REC_DATA
#define SERSTAT R_SERIAL0_STATUS
#endif
#ifdef CONFIG_RESCUE_SER1
#define SERXOFF R_SERIAL1_XOFF
#define SERBAUD R_SERIAL1_BAUD
#define SERRECC R_SERIAL1_REC_CTRL
#define SERRDAT R_SERIAL1_REC_DATA
#define SERSTAT R_SERIAL1_STATUS
#endif
#ifdef CONFIG_RESCUE_SER2
#define SERXOFF R_SERIAL2_XOFF
#define SERBAUD R_SERIAL2_BAUD
#define SERRECC R_SERIAL2_REC_CTRL
#define SERRDAT R_SERIAL2_REC_DATA
#define SERSTAT R_SERIAL2_STATUS
#endif
#ifdef CONFIG_RESCUE_SER3
#define SERXOFF R_SERIAL3_XOFF
#define SERBAUD R_SERIAL3_BAUD
#define SERRECC R_SERIAL3_REC_CTRL
#define SERRDAT R_SERIAL3_REC_DATA
#define SERSTAT R_SERIAL3_STATUS
#endif
.text
;; This is the entry point of the rescue code
;; 0x80000000 if loaded in flash (as it should be)
;; since etrax actually starts at address 2 when booting from flash, we
;; put a nop (2 bytes) here first so we dont accidentally skip the di
nop
di
#ifndef CONFIG_SVINTO_SIM
;; setup port PA and PB default initial directions and data
;; (so we can flash LEDs, and so that DTR and others are set)
move.b DEF_R_PORT_PA_DIR, r0
move.b r0, [R_PORT_PA_DIR]
move.b DEF_R_PORT_PA_DATA, r0
move.b r0, [R_PORT_PA_DATA]
move.b DEF_R_PORT_PB_DIR, r0
move.b r0, [R_PORT_PB_DIR]
move.b DEF_R_PORT_PB_DATA, r0
move.b r0, [R_PORT_PB_DATA]
;; We need to setup the bus registers before we start using the DRAM
#include "../../lib/dram_init.S"
#endif
;; Setup the stack to a suitably high address.
;; We assume 8 MB is the minimum DRAM in an eLinux
;; product and put the sp at the top for now.
move.d 0x40800000, sp
;; setup the serial port at 115200 baud
moveq 0, r0
move.d r0, [SERXOFF]
move.b 0x99, r0
move.b r0, [SERBAUD] ; 115.2kbaud for both transmit and receive
move.b 0x40, r0 ; rec enable
move.b r0, [SERRECC]
moveq 0, r1 ; "timer" to clock out a LED red flash
move.d CODE_START, r3 ; destination counter
move.d CODE_LENGTH, r4 ; length
move.d TIMEOUT_VALUE, r5 ; "timeout" until jump
wait_ser:
addq 1, r1
subq 1, r5 ; decrease timeout
beq jump_start ; timed out
nop
#ifndef CONFIG_ETRAX_NO_LEDS
#ifdef CONFIG_ETRAX_PA_LEDS
move.b DEF_R_PORT_PA_DATA, r2
#endif
#ifdef CONFIG_ETRAX_PB_LEDS
move.b DEF_R_PORT_PB_DATA, r2
#endif
move.d (1 << CONFIG_ETRAX_LED1R) | (1 << CONFIG_ETRAX_LED2R), r0
btstq 16, r1
bpl 1f
nop
or.d r0, r2 ; set bit
ba 2f
nop
1: not r0 ; clear bit
and.d r0, r2
2:
#ifdef CONFIG_ETRAX_PA_LEDS
move.b r2, [R_PORT_PA_DATA]
#endif
#ifdef CONFIG_ETRAX_PB_LEDS
move.b r2, [R_PORT_PB_DATA]
#endif
#endif
;; check if we got something on the serial port
move.b [SERSTAT], r0
btstq 0, r0 ; data_avail
bpl wait_ser
nop
;; got something - copy the byte and loop
move.b [SERRDAT], r0
move.b r0, [r3+]
move.d TIMEOUT_VALUE, r5 ; reset "timeout"
subq 1, r4 ; decrease length
bne wait_ser
nop
jump_start:
;; jump into downloaded code
jump CODE_START
MEMORY
{
flash : ORIGIN = 0x00000000,
LENGTH = 0x00100000
}
SECTIONS
{
.text :
{
_stext = . ;
*(.text)
_etext = . ;
} > flash
.data :
{
*(.data)
_edata = . ;
} > flash
}
;; $Id: testrescue.S,v 1.1 2001/01/31 15:32:09 johana Exp $
;;
;; Simple testcode to download by the rescue block.
;; Just lits some LEDs to show it was downloaded correctly.
;;
;; Copyright (C) 1999 Axis Communications AB
#define ASSEMBLER_MACROS_ONLY
#include <asm/sv_addr_ag.h>
.text
nop
nop
moveq -1, r2
move.b r2, [R_PORT_PA_DIR]
moveq 0, r2
move.b r2, [R_PORT_PA_DATA]
endless:
nop
ba endless
nop
/*
* linux/tools/build.c
*
* Copyright (C) 1991, 1992 Linus Torvalds
*/
/*
* This file builds a disk-image from three different files:
*
* - bootsect: exactly 512 bytes of 8086 machine code, loads the rest
* - setup: 8086 machine code, sets up system parm
* - system: 80386 code for actual system
*
* It does some checking that all files are of the correct type, and
* just writes the result to stdout, removing headers and padding to
* the right amount. It also writes some system data to stderr.
*/
/*
* Changes by tytso to allow root device specification
* High loaded stuff by Hans Lermen & Werner Almesberger, Feb. 1996
* Cross compiling fixes by Gertjan van Wingerde, July 1996
*/
#include <stdio.h> /* fprintf */
#include <string.h>
#include <stdlib.h> /* contains exit */
#include <sys/types.h> /* unistd.h needs this */
#include <sys/stat.h>
#include <sys/sysmacros.h>
#include <unistd.h> /* contains read/write */
#include <fcntl.h>
#include <linux/a.out.h>
#include <errno.h>
#define MINIX_HEADER 32
#define N_MAGIC_OFFSET 1024
#ifndef __BFD__
static int GCC_HEADER = sizeof(struct exec);
#endif
#ifdef __BIG_KERNEL__
#define SYS_SIZE 0xffff
#else
#define SYS_SIZE DEF_SYSSIZE
#endif
#define DEFAULT_MAJOR_ROOT 0
#define DEFAULT_MINOR_ROOT 0
/* max nr of sectors of setup: don't change unless you also change
* bootsect etc */
#define SETUP_SECTS 4
#define STRINGIFY(x) #x
typedef union {
int i;
long l;
short s[2];
char b[4];
} conv;
long intel_long(long l)
{
conv t;
t.b[0] = l & 0xff; l >>= 8;
t.b[1] = l & 0xff; l >>= 8;
t.b[2] = l & 0xff; l >>= 8;
t.b[3] = l & 0xff; l >>= 8;
return t.l;
}
int intel_int(int i)
{
conv t;
t.b[0] = i & 0xff; i >>= 8;
t.b[1] = i & 0xff; i >>= 8;
t.b[2] = i & 0xff; i >>= 8;
t.b[3] = i & 0xff; i >>= 8;
return t.i;
}
short intel_short(short l)
{
conv t;
t.b[0] = l & 0xff; l >>= 8;
t.b[1] = l & 0xff; l >>= 8;
return t.s[0];
}
void die(const char * str)
{
fprintf(stderr,"%s\n",str);
exit(1);
}
void usage(void)
{
die("Usage: build bootsect setup system [rootdev] [> image]");
}
int main(int argc, char ** argv)
{
int i,c,id,sz,tmp_int;
unsigned long sys_size, tmp_long;
char buf[1024];
#ifndef __BFD__
struct exec *ex = (struct exec *)buf;
#endif
char major_root, minor_root;
struct stat sb;
unsigned char setup_sectors;
if ((argc < 4) || (argc > 5))
usage();
if (argc > 4) {
if (!strcmp(argv[4], "CURRENT")) {
if (stat("/", &sb)) {
perror("/");
die("Couldn't stat /");
}
major_root = major(sb.st_dev);
minor_root = minor(sb.st_dev);
} else if (strcmp(argv[4], "FLOPPY")) {
if (stat(argv[4], &sb)) {
perror(argv[4]);
die("Couldn't stat root device.");
}
major_root = major(sb.st_rdev);
minor_root = minor(sb.st_rdev);
} else {
major_root = 0;
minor_root = 0;
}
} else {
major_root = DEFAULT_MAJOR_ROOT;
minor_root = DEFAULT_MINOR_ROOT;
}
fprintf(stderr, "Root device is (%d, %d)\n", major_root, minor_root);
for (i=0;i<sizeof buf; i++) buf[i]=0;
if ((id=open(argv[1],O_RDONLY,0))<0)
die("Unable to open 'boot'");
if (read(id,buf,MINIX_HEADER) != MINIX_HEADER)
die("Unable to read header of 'boot'");
if (((long *) buf)[0]!=intel_long(0x04100301))
die("Non-Minix header of 'boot'");
if (((long *) buf)[1]!=intel_long(MINIX_HEADER))
die("Non-Minix header of 'boot'");
if (((long *) buf)[3] != 0)
die("Illegal data segment in 'boot'");
if (((long *) buf)[4] != 0)
die("Illegal bss in 'boot'");
if (((long *) buf)[5] != 0)
die("Non-Minix header of 'boot'");
if (((long *) buf)[7] != 0)
die("Illegal symbol table in 'boot'");
i=read(id,buf,sizeof buf);
fprintf(stderr,"Boot sector %d bytes.\n",i);
if (i != 512)
die("Boot block must be exactly 512 bytes");
if ((*(unsigned short *)(buf+510)) != (unsigned short)intel_short(0xAA55))
die("Boot block hasn't got boot flag (0xAA55)");
buf[508] = (char) minor_root;
buf[509] = (char) major_root;
i=write(1,buf,512);
if (i!=512)
die("Write call failed");
close (id);
if ((id=open(argv[2],O_RDONLY,0))<0)
die("Unable to open 'setup'");
if (read(id,buf,MINIX_HEADER) != MINIX_HEADER)
die("Unable to read header of 'setup'");
if (((long *) buf)[0]!=intel_long(0x04100301))
die("Non-Minix header of 'setup'");
if (((long *) buf)[1]!=intel_long(MINIX_HEADER))
die("Non-Minix header of 'setup'");
if (((long *) buf)[3] != 0)
die("Illegal data segment in 'setup'");
if (((long *) buf)[4] != 0)
die("Illegal bss in 'setup'");
if (((long *) buf)[5] != 0)
die("Non-Minix header of 'setup'");
if (((long *) buf)[7] != 0)
die("Illegal symbol table in 'setup'");
for (i=0 ; (c=read(id,buf,sizeof buf))>0 ; i+=c )
#ifdef __BIG_KERNEL__
{
if (!i) {
/* Working with memcpy because of alignment constraints
on Sparc - Gertjan */
memcpy(&tmp_long, &buf[2], sizeof(long));
if (tmp_long != intel_long(0x53726448) )
die("Wrong magic in loader header of 'setup'");
memcpy(&tmp_int, &buf[6], sizeof(int));
if (tmp_int < intel_int(0x200))
die("Wrong version of loader header of 'setup'");
buf[0x11] = 1; /* LOADED_HIGH */
tmp_long = intel_long(0x100000);
memcpy(&buf[0x14], &tmp_long, sizeof(long)); /* code32_start */
}
#endif
if (write(1,buf,c)!=c)
die("Write call failed");
#ifdef __BIG_KERNEL__
}
#endif
if (c != 0)
die("read-error on 'setup'");
close (id);
setup_sectors = (unsigned char)((i + 511) / 512);
/* for compatibility with LILO */
if (setup_sectors < SETUP_SECTS)
setup_sectors = SETUP_SECTS;
fprintf(stderr,"Setup is %d bytes.\n",i);
for (c=0 ; c<sizeof(buf) ; c++)
buf[c] = '\0';
while (i < setup_sectors * 512) {
c = setup_sectors * 512 - i;
if (c > sizeof(buf))
c = sizeof(buf);
if (write(1,buf,c) != c)
die("Write call failed");
i += c;
}
if ((id=open(argv[3],O_RDONLY,0))<0)
die("Unable to open 'system'");
#ifndef __BFD__
if (read(id,buf,GCC_HEADER) != GCC_HEADER)
die("Unable to read header of 'system'");
if (N_MAGIC(*ex) == ZMAGIC) {
GCC_HEADER = N_MAGIC_OFFSET;
lseek(id, GCC_HEADER, SEEK_SET);
} else if (N_MAGIC(*ex) != QMAGIC)
die("Non-GCC header of 'system'");
fprintf(stderr,"System is %d kB (%d kB code, %d kB data and %d kB bss)\n",
(ex->a_text+ex->a_data+ex->a_bss)/1024,
ex->a_text /1024,
ex->a_data /1024,
ex->a_bss /1024);
sz = N_SYMOFF(*ex) - GCC_HEADER + 4;
#else
if (fstat (id, &sb)) {
perror ("fstat");
die ("Unable to stat 'system'");
}
sz = sb.st_size;
fprintf (stderr, "System is %d kB\n", sz/1024);
#endif
sys_size = (sz + 15) / 16;
if (sys_size > SYS_SIZE)
die("System is too big");
while (sz > 0) {
int l, n;
l = sz;
if (l > sizeof(buf))
l = sizeof(buf);
if ((n=read(id, buf, l)) != l) {
if (n == -1)
perror(argv[1]);
else
fprintf(stderr, "Unexpected EOF\n");
die("Can't read 'system'");
}
if (write(1, buf, l) != l)
die("Write failed");
sz -= l;
}
close(id);
if (lseek(1, 497, 0) == 497) {
if (write(1, &setup_sectors, 1) != 1)
die("Write of setup sectors failed");
}
if (lseek(1,500,0) == 500) {
buf[0] = (sys_size & 0xff);
buf[1] = ((sys_size >> 8) & 0xff);
if (write(1, buf, 2) != 2)
die("Write failed");
}
return(0);
}
......@@ -36,15 +36,19 @@ mainmenu_option next_comment
comment 'Hardware setup'
choice 'Processor type' \
"Etrax-100-LX CONFIG_ETRAX100LX \
Etrax-100-LX-for-xsim-simulator CONFIG_SVINTO_SIM" Etrax-100-LX
"Etrax-100-LX-v1 CONFIG_ETRAX100LX \
Etrax-100-LX-v2 CONFIG_ETRAX100LX_V2 \
Etrax-100-LX-for-xsim-simulator CONFIG_SVINTO_SIM" Etrax-100-LX-v1
# For both LX version 1 and the current simulator we enable the low VM mapping
# Later when LX version 2 and above exist, this should be done with an if
define_bool CONFIG_CRIS_LOW_MAP y
if [ "$CONFIG_ETRAX100LX" = "y" -o "$CONFIG_SVINTO_SIM" = "y" ]; then
define_bool CONFIG_CRIS_LOW_MAP y
define_hex ETRAX_DRAM_VIRTUAL_BASE 60000000
else
define_hex ETRAX_DRAM_VIRTUAL_BASE c0000000
fi
hex 'DRAM base (hex)' ETRAX_DRAM_BASE 40000000
int 'DRAM size (dec, in MB)' ETRAX_DRAM_SIZE 8
int 'Max possible flash size (dec, in MB)' CONFIG_ETRAX_FLASH_LENGTH 2
......@@ -69,12 +73,29 @@ choice 'Product debug-port' \
"Serial-0 CONFIG_DEBUG_PORT0 \
Serial-1 CONFIG_DEBUG_PORT1 \
Serial-2 CONFIG_DEBUG_PORT2 \
Serial-3 CONFIG_DEBUG_PORT3" Serial-0
Serial-3 CONFIG_DEBUG_PORT3 \
disabled CONFIG_DEBUG_PORT_NULL" Serial-0
choice 'Product rescue-port' \
"Serial-0 CONFIG_RESCUE_SER0 \
Serial-1 CONFIG_RESCUE_SER1 \
Serial-2 CONFIG_RESCUE_SER2 \
Serial-3 CONFIG_RESCUE_SER3" Serial-0
hex 'R_WAITSTATES' DEF_R_WAITSTATES 95a6
hex 'R_BUS_CONFIG' DEF_R_BUS_CONFIG 104
hex 'R_DRAM_CONFIG' DEF_R_DRAM_CONFIG 1a200040
hex 'R_DRAM_TIMING' DEF_R_DRAM_TIMING 5611
bool 'SDRAM support' CONFIG_SDRAM n
if [ "$CONFIG_SDRAM" = "n" ]; then
hex 'R_DRAM_CONFIG' DEF_R_DRAM_CONFIG 1a200040
hex 'R_DRAM_TIMING' DEF_R_DRAM_TIMING 5611
fi
if [ "$CONFIG_SDRAM" = "y" ]; then
hex 'R_SDRAM_CONFIG' DEF_R_SDRAM_CONFIG d2fa7878
hex 'R_SDRAM_TIMING' DEF_R_SDRAM_TIMING 80004801
fi
hex 'R_PORT_PA_DIR' DEF_R_PORT_PA_DIR 1c
hex 'R_PORT_PA_DATA' DEF_R_PORT_PA_DATA 00
hex 'R_PORT_PB_CONFIG' DEF_R_PORT_PB_CONFIG 00
......@@ -83,24 +104,6 @@ hex 'R_PORT_PB_DATA' DEF_R_PORT_PB_DATA ff
endmenu
# only configure IP numbers if the kernel ifconfig/route setup is enabled
if [ "$CONFIG_KERNEL_IFCONFIG" = "y" ]; then
mainmenu_option next_comment
comment 'IP address selection'
comment 'All addresses are in hexadecimal form without 0x prefix'
hex 'IP address' ELTEST_IPADR ab1005af
hex 'Network' ELTEST_NETWORK ab100000
hex 'Netmask' ELTEST_NETMASK ffff0000
hex 'Broadcast' ELTEST_BROADCAST ab10ffff
hex 'Gateway' ELTEST_GATEWAY ab100101
hwaddr 'Ethernet address' ELTEST_ETHADR 00408ccd0000
endmenu
fi
# bring in Etrax built-in drivers
source arch/cris/drivers/Config.in
......
/* ld script to make the Linux/CRIS kernel
* Authors: Bjorn Wesen (bjornw@axis.com)
*
* For now, on Etrax-100 LX, the DRAM starts virtually at 0x6. Normally
* it should be at 0xc.
*/
SECTIONS
{
. = 0x60000000; /* DRAM starts virtually at 0x60000000 */
. = @ETRAX_DRAM_VIRTUAL_BASE@;
_dram_start = .;
_ibr_start = .;
. = . + 0x4000; /* see head.S and pages reserved at the start */
......@@ -21,6 +18,7 @@ SECTIONS
*(.fixup)
*(.text.__*)
*(.rodata)
*(.rodata.__*)
}
. = ALIGN(4); /* Exception table */
......@@ -77,5 +75,5 @@ SECTIONS
*(.exitcall.exit)
}
_dram_end = 0x60000000 + @ETRAX_DRAM_SIZE_M@*1024*1024;
_dram_end = _dram_start + @ETRAX_DRAM_SIZE_M@*1024*1024;
}
......@@ -24,10 +24,13 @@ CONFIG_USE_SERIAL_CONSOLE=y
# Hardware setup
#
CONFIG_ETRAX100LX=y
# CONFIG_ETRAX100LX_V2 is not set
# CONFIG_SVINTO_SIM is not set
CONFIG_CRIS_LOW_MAP=y
ETRAX_DRAM_BASE=40000000
ETRAX_DRAM_VIRTUAL_BASE=60000000
ETRAX_DRAM_SIZE=8
CONFIG_ETRAX_FLASH_LENGTH=2
CONFIG_ETRAX_FLASH_BUSWIDTH=2
CONFIG_ETRAX_PA_LEDS=y
# CONFIG_ETRAX_PB_LEDS is not set
# CONFIG_ETRAX_90000000_LEDS is not set
......@@ -40,8 +43,13 @@ CONFIG_DEBUG_PORT0=y
# CONFIG_DEBUG_PORT1 is not set
# CONFIG_DEBUG_PORT2 is not set
# CONFIG_DEBUG_PORT3 is not set
CONFIG_RESCUE_SER0=y
# CONFIG_RESCUE_SER1 is not set
# CONFIG_RESCUE_SER2 is not set
# CONFIG_RESCUE_SER3 is not set
DEF_R_WAITSTATES=95a6
DEF_R_BUS_CONFIG=104
# CONFIG_SDRAM is not set
DEF_R_DRAM_CONFIG=1a200040
DEF_R_DRAM_TIMING=5611
DEF_R_PORT_PA_DIR=1d
......@@ -56,6 +64,87 @@ DEF_R_PORT_PB_DATA=f3
CONFIG_ETRAX_ETHERNET=y
CONFIG_NET_ETHERNET=y
CONFIG_ETRAX_SERIAL=y
# CONFIG_ETRAX_SER0_DTR_RI_DSR_CD_ON_PB is not set
CONFIG_ETRAX_SERIAL_PORT1=y
# CONFIG_ETRAX_SER1_DTR_RI_DSR_CD_ON_PB is not set
# CONFIG_ETRAX_SERIAL_PORT2 is not set
# CONFIG_ETRAX_SERIAL_PORT3 is not set
# CONFIG_RS485 is not set
# CONFIG_ETRAX_SYNCHRONOUS_SERIAL is not set
# CONFIG_ETRAX_IDE is not set
CONFIG_ETRAX_AXISFLASHMAP=y
CONFIG_MTD=y
CONFIG_MTD_CFI=y
# CONFIG_MTD_CFI_INTELEXT is not set
CONFIG_MTD_CFI_AMDSTD=y
CONFIG_MTD_AMDSTD=y
CONFIG_MTD_CHAR=y
CONFIG_MTD_BLOCK=y
CONFIG_ETRAX_I2C=y
CONFIG_ETRAX_I2C_USES_PB_NOT_PB_I2C=y
CONFIG_ETRAX_GPIO=y
CONFIG_ETRAX_PA_BUTTON_BITMASK=02
CONFIG_PA_CHANGEABLE_DIR=00
CONFIG_PA_CHANGEABLE_BITS=FF
CONFIG_PB_CHANGEABLE_DIR=00
CONFIG_PB_CHANGEABLE_BITS=FF
# CONFIG_JULIETTE is not set
# CONFIG_JULIETTE_VIDEO is not set
# CONFIG_JULIETTE_CCD is not set
# CONFIG_JULIETTE_SS1M is not set
# CONFIG_JULIETTE_MEGCCD is not set
# CONFIG_ETRAX_USB_HOST is not set
#
# Memory Technology Devices (MTD)
#
CONFIG_MTD=y
# CONFIG_MTD_DEBUG is not set
# CONFIG_MTD_DOC1000 is not set
# CONFIG_MTD_DOC2000 is not set
# CONFIG_MTD_DOC2001 is not set
# CONFIG_MTD_DOCPROBE is not set
# CONFIG_MTD_PMC551 is not set
# CONFIG_MTD_SLRAM is not set
# CONFIG_MTD_RAM is not set
# CONFIG_MTD_ROM is not set
# CONFIG_MTD_MTDRAM is not set
CONFIG_MTD_CFI=y
# CONFIG_MTD_CFI_GEOMETRY is not set
# CONFIG_MTD_CFI_INTELEXT is not set
CONFIG_MTD_CFI_AMDSTD=y
CONFIG_MTD_AMDSTD=y
# CONFIG_MTD_SHARP is not set
# CONFIG_MTD_PHYSMAP is not set
# CONFIG_MTD_NORA is not set
# CONFIG_MTD_PNC2000 is not set
# CONFIG_MTD_RPXLITE is not set
# CONFIG_MTD_SBC_MEDIAGX is not set
# CONFIG_MTD_ELAN_104NC is not set
# CONFIG_MTD_SA1100 is not set
# CONFIG_MTD_DC21285 is not set
# CONFIG_MTD_CSTM_CFI_JEDEC is not set
# CONFIG_MTD_JEDEC is not set
# CONFIG_MTD_MIXMEM is not set
# CONFIG_MTD_OCTAGON is not set
# CONFIG_MTD_VMAX is not set
# CONFIG_MTD_NAND is not set
# CONFIG_MTD_NAND_SPIA is not set
CONFIG_MTD_CHAR=y
CONFIG_MTD_BLOCK=y
# CONFIG_FTL is not set
# CONFIG_NFTL is not set
#
# Parallel port support
#
# CONFIG_PARPORT is not set
#
# Plug and Play configuration
#
# CONFIG_PNP is not set
# CONFIG_ISAPNP is not set
#
# Block devices
......@@ -90,10 +179,6 @@ CONFIG_INET=y
# CONFIG_IPV6 is not set
# CONFIG_KHTTPD is not set
# CONFIG_ATM is not set
#
#
#
# CONFIG_IPX is not set
# CONFIG_ATALK is not set
# CONFIG_DECNET is not set
......@@ -101,6 +186,7 @@ CONFIG_INET=y
# CONFIG_X25 is not set
# CONFIG_LAPB is not set
# CONFIG_LLC is not set
# CONFIG_NET_DIVERT is not set
# CONFIG_ECONET is not set
# CONFIG_WAN_ROUTER is not set
# CONFIG_NET_FASTROUTE is not set
......@@ -111,11 +197,61 @@ CONFIG_INET=y
#
# CONFIG_NET_SCHED is not set
#
# Telephony Support
#
# CONFIG_PHONE is not set
# CONFIG_PHONE_IXJ is not set
#
# ATA/IDE/MFM/RLL support
#
# CONFIG_IDE is not set
#
# IDE, ATA and ATAPI Block devices
#
# CONFIG_BLK_DEV_IDE is not set
# CONFIG_BLK_DEV_HD_IDE is not set
# CONFIG_BLK_DEV_HD is not set
# CONFIG_BLK_DEV_IDEDISK is not set
# CONFIG_IDEDISK_MULTI_MODE is not set
# CONFIG_BLK_DEV_IDEDISK_VENDOR is not set
# CONFIG_BLK_DEV_IDEDISK_FUJITSU is not set
# CONFIG_BLK_DEV_IDEDISK_IBM is not set
# CONFIG_BLK_DEV_IDEDISK_MAXTOR is not set
# CONFIG_BLK_DEV_IDEDISK_QUANTUM is not set
# CONFIG_BLK_DEV_IDEDISK_SEAGATE is not set
# CONFIG_BLK_DEV_IDEDISK_WD is not set
# CONFIG_BLK_DEV_COMMERIAL is not set
# CONFIG_BLK_DEV_TIVO is not set
# CONFIG_BLK_DEV_IDECS is not set
# CONFIG_BLK_DEV_IDECD is not set
# CONFIG_BLK_DEV_IDETAPE is not set
# CONFIG_BLK_DEV_IDEFLOPPY is not set
# CONFIG_BLK_DEV_IDESCSI is not set
# CONFIG_BLK_DEV_CMD640 is not set
# CONFIG_BLK_DEV_CMD640_ENHANCED is not set
# CONFIG_BLK_DEV_ISAPNP is not set
# CONFIG_IDE_CHIPSETS is not set
# CONFIG_IDEDMA_AUTO is not set
# CONFIG_DMA_NONPCI is not set
# CONFIG_BLK_DEV_IDE_MODES is not set
#
# SCSI support
#
# CONFIG_SCSI is not set
#
# I2O device support
#
# CONFIG_I2O is not set
# CONFIG_I2O_BLOCK is not set
# CONFIG_I2O_LAN is not set
# CONFIG_I2O_SCSI is not set
# CONFIG_I2O_PROC is not set
#
# Network device support
#
......@@ -176,6 +312,16 @@ CONFIG_NET_ETHERNET=y
#
# CONFIG_WAN is not set
#
# Amateur Radio support
#
# CONFIG_HAMRADIO is not set
#
# IrDA (infrared) support
#
# CONFIG_IRDA is not set
#
# ISDN subsystem
#
......@@ -186,6 +332,60 @@ CONFIG_NET_ETHERNET=y
#
# CONFIG_CD_NO_IDESCSI is not set
#
# Input core support
#
# CONFIG_INPUT is not set
#
# Character devices
#
# CONFIG_VT is not set
# CONFIG_SERIAL is not set
# CONFIG_SERIAL_EXTENDED is not set
# CONFIG_SERIAL_NONSTANDARD is not set
# CONFIG_UNIX98_PTYS is not set
#
# I2C support
#
# CONFIG_I2C is not set
#
# Mice
#
# CONFIG_BUSMOUSE is not set
# CONFIG_MOUSE is not set
#
# Joysticks
#
# CONFIG_JOYSTICK is not set
# CONFIG_QIC02_TAPE is not set
#
# Watchdog Cards
#
# CONFIG_WATCHDOG is not set
# CONFIG_INTEL_RNG is not set
# CONFIG_NVRAM is not set
# CONFIG_RTC is not set
# CONFIG_DTLK is not set
# CONFIG_R3964 is not set
# CONFIG_APPLICOM is not set
#
# Ftape, the floppy tape device driver
#
# CONFIG_FTAPE is not set
# CONFIG_AGP is not set
# CONFIG_DRM is not set
#
# Multimedia devices
#
# CONFIG_VIDEO_DEV is not set
#
# File systems
#
......@@ -259,59 +459,14 @@ CONFIG_MSDOS_PARTITION=y
# CONFIG_NLS is not set
#
# Character devices
#
# CONFIG_VT is not set
# CONFIG_SERIAL is not set
# CONFIG_SERIAL_EXTENDED is not set
# CONFIG_SERIAL_NONSTANDARD is not set
# CONFIG_UNIX98_PTYS is not set
# CONFIG_PRINTER is not set
# CONFIG_PPDEV is not set
#
# I2C support
#
# CONFIG_I2C is not set
#
# Mice
#
# CONFIG_BUSMOUSE is not set
# CONFIG_MOUSE is not set
#
# Joysticks
#
# CONFIG_JOYSTICK is not set
#
# Input core support is needed for joysticks
#
# CONFIG_QIC02_TAPE is not set
#
# Watchdog Cards
#
# CONFIG_WATCHDOG is not set
# CONFIG_INTEL_RNG is not set
# CONFIG_NVRAM is not set
# CONFIG_RTC is not set
# CONFIG_DTLK is not set
# CONFIG_R3964 is not set
# CONFIG_APPLICOM is not set
#
# Ftape, the floppy tape device driver
# Sound
#
# CONFIG_FTAPE is not set
# CONFIG_AGP is not set
# CONFIG_DRM is not set
# CONFIG_SOUND is not set
#
# Sound
# USB support
#
# CONFIG_SOUND is not set
# CONFIG_USB is not set
#
# Kernel hacking
......
mainmenu_option next_comment
comment 'Drivers for Etrax built-in interfaces'
bool 'Ethernet support' CONFIG_ETRAX_ETHERNET y
bool 'Ethernet support' CONFIG_ETRAX_ETHERNET
if [ "$CONFIG_ETRAX_ETHERNET" = "y" ]; then
# this is just so that the user does not have to go into the
# normal ethernet driver section just to enable ethernetworking
define_bool CONFIG_NET_ETHERNET y
else
define_bool CONFIG_NET_ETHERNET n
fi
bool 'Serial-port support' CONFIG_ETRAX_SERIAL y
bool 'Serial-port support' CONFIG_ETRAX_SERIAL
if [ "$CONFIG_ETRAX_SERIAL" = "y" ]; then
comment ' Port 0 is always enabled'
bool ' Ser0 DTR, RI, DSR, CD on PB' CONFIG_ETRAX_SER0_DTR_RI_DSR_CD_ON_PB
if [ "$CONFIG_ETRAX_SER0_DTR_RI_DSR_CD_ON_PB" = "y" ]; then
int ' Ser0 DTR on PB bit' CONFIG_ETRAX_SER0_DTR_ON_PB_BIT 4
int ' Ser0 RI on PB bit' CONFIG_ETRAX_SER0_RI_ON_PB_BIT 5
int ' Ser0 DSR on PB bit' CONFIG_ETRAX_SER0_DSR_ON_PB_BIT 6
int ' Ser0 CD on PB bit' CONFIG_ETRAX_SER0_CD_ON_PB_BIT 7
fi
bool ' Serial port 1 enabled' CONFIG_ETRAX_SERIAL_PORT1
if [ "$CONFIG_ETRAX_SERIAL_PORT1" = "y" ]; then
bool ' Ser1 DTR, RI, DSR, CD on PB' CONFIG_ETRAX_SER1_DTR_RI_DSR_CD_ON_PB
if [ "$CONFIG_ETRAX_SER1_DTR_RI_DSR_CD_ON_PB" = "y" ]; then
int ' Ser1 DTR on PB bit' CONFIG_ETRAX_SER1_DTR_ON_PB_BIT 4
int ' Ser1 RI on PB bit' CONFIG_ETRAX_SER1_RI_ON_PB_BIT 5
int ' Ser1 DSR on PB bit' CONFIG_ETRAX_SER1_DSR_ON_PB_BIT 6
int ' Ser1 CD on PB bit' CONFIG_ETRAX_SER1_CD_ON_PB_BIT 7
fi
fi
if [ "$CONFIG_ETRAX_SER0_DTR_RI_DSR_CD_ON_PB" = "y" -a \
"$CONFIG_ETRAX_SER1_DTR_RI_DSR_CD_ON_PB" = "y" ]; then
comment 'Make sure you dont have the same PB bits more than once!'
fi
bool ' Serial port 2 enabled' CONFIG_ETRAX_SERIAL_PORT2
if [ "$CONFIG_ETRAX_SERIAL_PORT2" = "y" ]; then
bool ' Ser2 DTR, RI, DSR, CD on PA' CONFIG_ETRAX_SER2_DTR_RI_DSR_CD_ON_PA
if [ "$CONFIG_ETRAX_SER2_DTR_RI_DSR_CD_ON_PA" = "y" ]; then
int ' Ser2 DTR on PA bit' CONFIG_ETRAX_SER2_DTR_ON_PA_BIT 4
int ' Ser2 RI on PA bit' CONFIG_ETRAX_SER2_RI_ON_PA_BIT 5
int ' Ser2 DSR on PA bit' CONFIG_ETRAX_SER2_DSR_ON_PA_BIT 6
int ' Ser2 CD on PA bit' CONFIG_ETRAX_SER2_CD_ON_PA_BIT 7
fi
fi
bool ' Serial port 3 enabled' CONFIG_ETRAX_SERIAL_PORT3
bool ' RS-485 support' CONFIG_RS485
if [ "$CONFIG_RS485" = "y" ]; then
bool ' RS-485 mode on PA' CONFIG_RS485_ON_PA
if [ "$CONFIG_RS485_ON_PA" = "y" ]; then
int ' RS-485 mode on PA bit' CONFIG_RS485_ON_PA_BIT 3
fi
bool ' Disable serial receiver' CONFIG_RS485_DISABLE_RECEIVER
fi
fi
bool 'Synchronous serial port support' CONFIG_ETRAX_SYNCHRONOUS_SERIAL
if [ "$CONFIG_ETRAX_SYNCHRONOUS_SERIAL" = "y" ]; then
bool ' Synchronous serial port 0 enabled' CONFIG_ETRAX_SYNCHRONOUS_SERIAL_PORT0
if [ "$CONFIG_ETRAX_SYNCHRONOUS_SERIAL_PORT0" = "y" ]; then
bool ' Synchronous serial port 0 uses DMA' CONFIG_ETRAX_SYNCHRONOUS_SERIAL0_DMA y
fi
bool ' Synchronous serial port 1 enabled' CONFIG_ETRAX_SYNCHRONOUS_SERIAL_PORT1
if [ "$CONFIG_ETRAX_SYNCHRONOUS_SERIAL_PORT1" = "y" ]; then
bool ' Synchronous serial port 1 uses DMA' CONFIG_ETRAX_SYNCHRONOUS_SERIAL1_DMA y
fi
fi
bool 'ATA/IDE support' CONFIG_ETRAX_IDE n
bool 'ATA/IDE support' CONFIG_ETRAX_IDE
if [ "$CONFIG_ETRAX_IDE" = "y" ]; then
# here we should add the CONFIG_'s necessary to enable the basic
......@@ -25,14 +83,18 @@ if [ "$CONFIG_ETRAX_IDE" = "y" ]; then
define_bool CONFIG_BLK_DEV_IDEDMA y
define_bool CONFIG_DMA_NONPCI y
int 'Delay for drives to regain consciousness' CONFIG_IDE_DELAY 15
choice 'IDE reset pin' \
"Port_PB_Bit_7 CONFIG_ETRAX_IDE_PB7_RESET\
Port_G_Bit_27 CONFIG_ETRAX_IDE_G27_RESET\
Port_CSE1_Bit_16 CONFIG_ETRAX_IDE_CSE1_16_RESET" Port_PB_Bit_7
else
define_bool CONFIG_IDE n
fi
bool 'Axis flash-map support' CONFIG_ETRAX_AXISFLASHMAP n
bool 'Axis flash-map support' CONFIG_ETRAX_AXISFLASHMAP
if [ "$CONFIG_ETRAX_AXISFLASHMAP" = "y" ]; then
# here we define the CONFIG_'s necessary to enable MTD support
......@@ -43,7 +105,39 @@ if [ "$CONFIG_ETRAX_AXISFLASHMAP" = "y" ]; then
define_bool CONFIG_MTD_CFI_INTELEXT n
define_bool CONFIG_MTD_CFI_AMDSTD y
define_bool CONFIG_MTD_AMDSTD y
define_bool CONFIG_MTD_CHAR y
define_bool CONFIG_MTD_BLOCK y
fi
bool 'I2C support' CONFIG_ETRAX_I2C
if [ "$CONFIG_ETRAX_I2C" = "y" ]; then
# this is true for most products since PB-I2C seems to be somewhat
# flawed..
bool 'I2C uses PB not PB-I2C' CONFIG_ETRAX_I2C_USES_PB_NOT_PB_I2C
fi
bool 'GPIO support' CONFIG_ETRAX_GPIO
if [ "$CONFIG_ETRAX_GPIO" = "y" ]; then
hex ' PA-buttons bitmask' CONFIG_ETRAX_PA_BUTTON_BITMASK 02
hex ' PA user changeable dir mask' CONFIG_PA_CHANGEABLE_DIR 00
hex ' PA user changeable bits mask' CONFIG_PA_CHANGEABLE_BITS FF
hex ' PB user changeable dir mask' CONFIG_PB_CHANGEABLE_DIR 00
hex ' PB user changeable bits mask' CONFIG_PB_CHANGEABLE_BITS FF
fi
bool 'Juliette support' CONFIG_JULIETTE n
if [ "$CONFIG_JULIETTE" = "y" ]; then
source arch/cris/drivers/juliette/Config.in
fi
bool 'USB host' CONFIG_ETRAX_USB_HOST
if [ "$CONFIG_ETRAX_USB_HOST" = "y" ]; then
define_bool CONFIG_USB y
bool ' USB port 1 enabled' CONFIG_ETRAX_USB_HOST_PORT1 n
bool ' USB port 2 enabled' CONFIG_ETRAX_USB_HOST_PORT2 n
fi
endmenu
......@@ -6,9 +6,16 @@ O_TARGET := drivers.o
obj-y :=
obj-$(CONFIG_ETRAX_ETHERNET) += ethernet.o
obj-$(CONFIG_ETRAX_SERIAL) += serial.o
obj-$(CONFIG_ETRAX_IDE) += ide.o
obj-$(CONFIG_ETRAX_AXISFLASHMAP) += axisflashmap.o
obj-$(CONFIG_ETRAX_ETHERNET) += ethernet.o
obj-$(CONFIG_ETRAX_SERIAL) += serial.o
obj-$(CONFIG_ETRAX_IDE) += ide.o
obj-$(CONFIG_ETRAX_AXISFLASHMAP) += axisflashmap.o
obj-$(CONFIG_ETRAX_I2C) += i2c.o
obj-$(CONFIG_ETRAX_GPIO) += gpio.o
obj-$(CONFIG_ETRAX_USB_HOST) += usb-host.o
obj-$(CONFIG_ETRAX_SYNCHRONOUS_SERIAL) += sync_serial.o
obj-$(CONFIG_JULIETTE) += juliette/juliette.o
subdir-$(CONFIG_JULIETTE) += juliette
include $(TOPDIR)/Rules.make
......@@ -11,6 +11,17 @@
* partition split defined below.
*
* $Log: axisflashmap.c,v $
* Revision 1.4 2001/02/23 12:47:15 bjornw
* Uncached flash in LOW_MAP moved from 0xe to 0x8
*
* Revision 1.3 2001/02/16 12:11:45 jonashg
* MTD driver amd_flash is now included in MTD CVS repository.
* (It's now in drivers/mtd).
*
* Revision 1.2 2001/02/09 11:12:22 jonashg
* Support for AMD compatible non-CFI flash chips.
* Only tested with Toshiba TC58FVT160 so far.
*
* Revision 1.1 2001/01/12 17:01:18 bjornw
* * Added axisflashmap.c, a physical mapping for MTD that reads and understands
* Axis partition-table format.
......@@ -31,7 +42,7 @@
#include <asm/mmu.h>
#ifdef CONFIG_CRIS_LOW_MAP
#define FLASH_UNCACHED_ADDR KSEG_E
#define FLASH_UNCACHED_ADDR KSEG_8
#define FLASH_CACHED_ADDR KSEG_5
#else
#define FLASH_UNCACHED_ADDR KSEG_E
......@@ -205,8 +216,14 @@ init_axis_flash(void)
mymtd = do_cfi_probe(&axis_map);
#ifdef CONFIG_MTD_AMDSTD
if (!mymtd) {
mymtd = do_amd_flash_probe(&axis_map);
}
#endif
if(!mymtd) {
printk("cfi_probe erred %d\n", mymtd);
printk("%s: No flash chip found!\n", axis_map.name);
return -ENXIO;
}
......@@ -218,7 +235,8 @@ init_axis_flash(void)
* now at least.
*/
ptable_head = FLASH_CACHED_ADDR + PTABLE_SECTOR + PARTITION_TABLE_OFFSET;
ptable_head = (struct partitiontable_head *)(FLASH_CACHED_ADDR +
PTABLE_SECTOR + PARTITION_TABLE_OFFSET);
pidx++; /* first partition is always set to the default */
if ((ptable_head->magic == PARTITION_TABLE_MAGIC)
......
/* $Id: ethernet.c,v 1.5 2000/11/29 17:22:22 bjornw Exp $
/* $Id: ethernet.c,v 1.8 2001/02/27 13:52:48 bjornw Exp $
*
* e100net.c: A network driver for the ETRAX 100LX network controller.
*
* Copyright (c) 1998-2000 Axis Communications AB.
* Copyright (c) 1998-2001 Axis Communications AB.
*
* The outline of this driver comes from skeleton.c.
*
* $Log: ethernet.c,v $
* Revision 1.8 2001/02/27 13:52:48 bjornw
* malloc.h -> slab.h
*
* Revision 1.7 2001/02/23 13:46:38 bjornw
* Spellling check
*
* Revision 1.6 2001/01/26 15:21:04 starvik
* Don't disable interrupts while reading MDIO registers (MDIO is slow)
* Corrected promiscuous mode
* Improved deallocation of IRQs ("ifconfig eth0 down" now works)
*
* Revision 1.5 2000/11/29 17:22:22 bjornw
* Get rid of the udword types legacy stuff
*
......@@ -39,7 +50,7 @@
#include <linux/ptrace.h>
#include <linux/ioport.h>
#include <linux/in.h>
#include <linux/malloc.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <asm/system.h>
#include <asm/bitops.h>
......@@ -53,7 +64,7 @@
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include <asm/svinto.h>
#include <asm/svinto.h> /* DMA and register descriptions */
//#define ETHDEBUG
......@@ -483,9 +494,6 @@ e100_get_mdio_reg(unsigned char reg_num)
unsigned short data; /* Data read from MDIO */
int bitCounter;
save_flags(flags);
cli();
/* Start of frame, OP Code, Physical Address, Register Address */
cmd = (MDIO_START << 14) | (MDIO_READ << 12) | (MDIO_PHYS_ADDR << 7) |
(reg_num << 2);
......@@ -498,8 +506,7 @@ e100_get_mdio_reg(unsigned char reg_num)
for(bitCounter=15; bitCounter>=0 ; bitCounter--) {
data |= (e100_receive_mdio_bit() << bitCounter);
}
restore_flags(flags);
return data;
}
......@@ -555,9 +562,6 @@ e100_reset_tranceiver(void)
unsigned short data;
int bitCounter;
save_flags(flags);
cli();
data = e100_get_mdio_reg(MDIO_BASE_CONTROL_REG);
cmd = (MDIO_START << 14) | (MDIO_WRITE << 12) | (MDIO_PHYS_ADDR << 7) | (MDIO_BASE_CONTROL_REG << 2);
......@@ -569,8 +573,6 @@ e100_reset_tranceiver(void)
for(bitCounter = 15; bitCounter >= 0 ; bitCounter--) {
e100_send_mdio_bit(GET_BIT(bitCounter, data));
}
restore_flags(flags);
}
/* Called by upper layers if they decide it took too long to complete
......@@ -858,9 +860,9 @@ e100_close(struct net_device *dev)
/* Flush the Tx and disable Rx here. */
free_irq(NETWORK_DMARX_IRQ, NULL);
free_irq(NETWORK_DMATX_IRQ, NULL);
free_irq(NETWORK_STATUS_IRQ, NULL);
free_irq(NETWORK_DMARX_IRQ, (void *)dev);
free_irq(NETWORK_DMATX_IRQ, (void *)dev);
free_irq(NETWORK_STATUS_IRQ, (void *)dev);
free_dma(0);
free_dma(1);
......@@ -926,10 +928,21 @@ set_multicast_list(struct net_device *dev)
/* promiscuous mode */
lo_bits = 0xfffffffful;
hi_bits = 0xfffffffful;
/* Enable individual receive */
*R_NETWORK_REC_CONFIG =
IO_STATE(R_NETWORK_REC_CONFIG, broadcast, receive) |
IO_STATE(R_NETWORK_REC_CONFIG, ma0, enable) |
IO_STATE(R_NETWORK_REC_CONFIG, individual, receive);
} else if (num_addr == 0) {
/* Normal, clear the mc list */
lo_bits = 0x00000000ul;
hi_bits = 0x00000000ul;
/* Disable individual receive */
*R_NETWORK_REC_CONFIG =
IO_STATE(R_NETWORK_REC_CONFIG, broadcast, receive) |
IO_STATE(R_NETWORK_REC_CONFIG, ma0, enable);
} else {
/* MC mode, receive normal and MC packets */
char hash_ix;
......@@ -971,6 +984,10 @@ set_multicast_list(struct net_device *dev)
}
dmi = dmi->next;
}
/* Disable individual receive */
*R_NETWORK_REC_CONFIG =
IO_STATE(R_NETWORK_REC_CONFIG, broadcast, receive) |
IO_STATE(R_NETWORK_REC_CONFIG, ma0, enable);
}
*R_NETWORK_GA_0 = lo_bits;
*R_NETWORK_GA_1 = hi_bits;
......
/*
* Example showing how to pin down a range of virtual pages from user-space
* to be able to do for example DMA directly into them.
*
* It is necessary because the pages the virtual pointers reference, might
* not exist in memory (could be mapped to the zero-page, filemapped etc)
* and DMA cannot trigger the MMU to force them in (and would have time
* contraints making it impossible to wait for it anyway).
*
* Author: Bjorn Wesen
*
* $Log: kiobuftest.c,v $
* Revision 1.2 2001/02/27 13:52:50 bjornw
* malloc.h -> slab.h
*
* Revision 1.1 2001/01/19 15:57:49 bjornw
* Example of how to do direct HW -> user-mode DMA
*
*
*/
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/string.h>
#include <linux/init.h>
#include <linux/mm.h>
#include <linux/iobuf.h>
#define KIOBUFTEST_MAJOR 124 /* in the local range, experimental */
static ssize_t
kiobuf_read(struct file *filp, char *buf, size_t len, loff_t *ppos)
{
struct kiobuf *iobuf;
int res, i;
/* Make a kiobuf that maps the entire length the reader has given
* us
*/
res = alloc_kiovec(1, &iobuf);
if (res)
return res;
if((res = map_user_kiobuf(READ, iobuf, (unsigned long)buf, len))) {
printk("map_user_kiobuf failed, return %d\n", res);
return res;
}
/* At this point, the virtual area buf[0] -> buf[len-1] will
* have corresponding pages mapped in physical memory and locked
* until we unmap the kiobuf. They cannot be swapped out or moved
* around.
*/
printk("nr_pages == %d\noffset == %d\nlength == %d\n",
iobuf->nr_pages, iobuf->offset, iobuf->length);
for(i = 0; i < iobuf->nr_pages; i++) {
printk("page_add(maplist[%d]) == 0x%x\n", i,
page_address(iobuf->maplist[i]));
}
/* This is the place to create the necessary scatter-gather vector
* for the DMA using the iobuf->maplist array and page_address
* (don't forget __pa if the DMA needs the actual physical DRAM address)
* and run it.
*/
/* Release the mapping and exit */
unmap_kiobuf(iobuf); /* The unlock_kiobuf is implicit here */
return len;
}
static struct file_operations kiobuf_fops = {
owner: THIS_MODULE,
read: kiobuf_read
};
static int __init
kiobuftest_init(void)
{
int res;
/* register char device */
res = register_chrdev(KIOBUFTEST_MAJOR, "kiobuftest", &kiobuf_fops);
if(res < 0) {
printk(KERN_ERR "kiobuftest: couldn't get a major number.\n");
return res;
}
printk("Initializing kiobuf-test device\n");
}
module_init(kiobuftest_init);
/* $Id: gpio.c,v 1.4 2001/02/27 13:52:48 bjornw Exp $
*
* Etrax general port I/O device
*
* Copyright (c) 1999, 2000, 2001 Axis Communications AB
*
* Authors: Bjorn Wesen (initial version)
* Ola Knutsson (LED handling)
* Johan Adolfsson (read/set directions)
*
* $Log: gpio.c,v $
* Revision 1.4 2001/02/27 13:52:48 bjornw
* malloc.h -> slab.h
*
* Revision 1.3 2001/01/24 15:06:48 bjornw
* gpio_wq correct type
*
* Revision 1.2 2001/01/18 16:07:30 bjornw
* 2.4 port
*
* Revision 1.1 2001/01/18 15:55:16 bjornw
* Verbatim copy of etraxgpio.c from elinux 2.0 added
*
*
*/
#include <linux/config.h>
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/ioport.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/string.h>
#include <linux/poll.h>
#include <linux/init.h>
#include <asm/etraxgpio.h>
#include <asm/svinto.h>
#include <asm/io.h>
#include <asm/system.h>
#define GPIO_MAJOR 120 /* experimental MAJOR number */
#define D(x)
static char gpio_name[] = "etrax gpio";
static wait_queue_head_t *gpio_wq;
static int gpio_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg);
static int gpio_open(struct inode *inode, struct file *filp);
static int gpio_release(struct inode *inode, struct file *filp);
static unsigned int gpio_poll(struct file *filp, struct poll_table_struct *wait);
/* private data per open() of this driver */
struct gpio_private {
struct gpio_private *next;
volatile unsigned char *port, *shadow;
volatile unsigned char *dir, *dir_shadow;
unsigned char changeable_dir;
unsigned char changeable_bits;
unsigned char highalarm, lowalarm;
wait_queue_head_t alarm_wq;
int minor;
};
/* linked list of alarms to check for */
static struct gpio_private *alarmlist = 0;
#define NUM_PORTS 2
static volatile unsigned char *ports[2] = { R_PORT_PA_DATA, R_PORT_PB_DATA };
static volatile unsigned char *shads[2] = {
&port_pa_data_shadow, &port_pb_data_shadow };
/* What direction bits that are user changeable 1=changeable*/
#ifndef CONFIG_PA_CHANGEABLE_DIR
#define CONFIG_PA_CHANGEABLE_DIR 0x00
#endif
#ifndef CONFIG_PB_CHANGEABLE_DIR
#define CONFIG_PB_CHANGEABLE_DIR 0x00
#endif
#ifndef CONFIG_PA_CHANGEABLE_BITS
#define CONFIG_PA_CHANGEABLE_BITS 0xFF
#endif
#ifndef CONFIG_PB_CHANGEABLE_BITS
#define CONFIG_PB_CHANGEABLE_BITS 0xFF
#endif
static unsigned char changeable_dir[2] = { CONFIG_PA_CHANGEABLE_DIR,
CONFIG_PB_CHANGEABLE_DIR };
static unsigned char changeable_bits[2] = { CONFIG_PA_CHANGEABLE_BITS,
CONFIG_PB_CHANGEABLE_BITS };
static volatile unsigned char *dir[2] = { R_PORT_PA_DIR, R_PORT_PB_DIR };
static volatile unsigned char *dir_shadow[2] = {
&port_pa_dir_shadow, &port_pb_dir_shadow };
#define LEDS 2
static unsigned int
gpio_poll(struct file *filp,
struct poll_table_struct *wait)
{
/* TODO poll on alarms! */
#if 0
if(!ANYTHING_WANTED) {
D(printk("gpio_select sleeping task\n"));
select_wait(&gpio_wq, table);
return 0;
}
D(printk("gpio_select ready\n"));
#endif
return 1;
}
static int
gpio_open(struct inode *inode, struct file *filp)
{
struct gpio_private *priv;
int p = MINOR(inode->i_rdev);
if(p >= NUM_PORTS && p != LEDS)
return -EINVAL;
priv = (struct gpio_private *)kmalloc(sizeof(struct gpio_private),
GFP_KERNEL);
if(!priv)
return -ENOMEM;
priv->minor = p;
/* initialize the io/alarm struct and link it into our alarmlist */
priv->next = alarmlist;
alarmlist = priv;
priv->port = ports[p];
priv->shadow = shads[p];
priv->changeable_dir = changeable_dir[p];
priv->changeable_bits = changeable_bits[p];
priv->dir = dir[p];
priv->dir_shadow = dir_shadow[p];
priv->highalarm = 0;
priv->lowalarm = 0;
init_waitqueue_head(&priv->alarm_wq);
filp->private_data = (void *)priv;
return 0;
}
static int
gpio_release(struct inode *inode, struct file *filp)
{
struct gpio_private *p = alarmlist;
struct gpio_private *todel = (struct gpio_private *)filp->private_data;
/* unlink from alarmlist and free the private structure */
if(p == todel) {
alarmlist = todel->next;
} else {
while(p->next != todel)
p = p->next;
p->next = todel->next;
}
kfree(todel);
return 0;
}
/* Main device API. ioctl's to read/set/clear bits, as well as to
* set alarms to wait for using a subsequent select().
*/
static int
gpio_leds_ioctl(unsigned int cmd, unsigned long arg);
static int
gpio_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
struct gpio_private *priv = (struct gpio_private *)file->private_data;
if(_IOC_TYPE(cmd) != ETRAXGPIO_IOCTYPE) {
return -EINVAL;
}
switch (_IOC_NR(cmd)) {
case IO_READBITS:
// read the port
return *priv->port;
case IO_SETBITS:
// set changeable bits with a 1 in arg
*priv->port = *priv->shadow |=
((unsigned char)arg & priv->changeable_bits);
break;
case IO_CLRBITS:
// clear changeable bits with a 1 in arg
*priv->port = *priv->shadow &=
~((unsigned char)arg & priv->changeable_bits);
break;
case IO_HIGHALARM:
// set alarm when bits with 1 in arg go high
priv->highalarm |= (unsigned char)arg;
break;
case IO_LOWALARM:
// set alarm when bits with 1 in arg go low
priv->lowalarm |= (unsigned char)arg;
break;
case IO_CLRALARM:
// clear alarm for bits with 1 in arg
priv->highalarm &= ~(unsigned char)arg;
priv->lowalarm &= ~(unsigned char)arg;
break;
case IO_READDIR:
/* Read direction 0=input 1=output */
return *priv->dir_shadow;
case IO_SETINPUT:
/* Set direction 0=unchanged 1=input */
*priv->dir = *priv->dir_shadow &=
~((unsigned char)arg & priv->changeable_dir);
return *priv->dir_shadow;
case IO_SETOUTPUT:
/* Set direction 0=unchanged 1=output */
*priv->dir = *priv->dir_shadow |=
((unsigned char)arg & priv->changeable_dir);
return *priv->dir_shadow;
default:
if(priv->minor == LEDS)
return gpio_leds_ioctl(cmd, arg);
else
return -EINVAL;
}
return 0;
}
static int
gpio_leds_ioctl(unsigned int cmd, unsigned long arg)
{
unsigned char green;
unsigned char red;
switch (_IOC_NR(cmd)) {
case IO_LEDACTIVE_SET:
green = ((unsigned char) arg) & 1;
red = (((unsigned char) arg) >> 1) & 1;
LED_ACTIVE_SET_G(green);
LED_ACTIVE_SET_R(red);
break;
default:
return -EINVAL;
}
}
struct file_operations gpio_fops = {
owner: THIS_MODULE,
poll: gpio_poll,
ioctl: gpio_ioctl,
open: gpio_open,
release: gpio_release,
};
/* main driver initialization routine, called from mem.c */
static __init int
gpio_init(void)
{
int res;
/* do the formalities */
res = register_chrdev(GPIO_MAJOR, gpio_name, &gpio_fops);
if(res < 0) {
printk(KERN_ERR "gpio: couldn't get a major number.\n");
return res;
}
printk("ETRAX 100LX GPIO driver v2.1, (c) 2001 Axis Communications AB\n");
return res;
}
/* this makes sure that gpio_init is called during kernel boot */
module_init(gpio_init);
This diff is collapsed.
/* $Id: i2c.h,v 1.2 2001/01/18 15:49:30 bjornw Exp $ */
/* High level I2C actions */
int i2c_writereg(unsigned char theSlave, unsigned char theReg, unsigned char theValue);
unsigned char i2c_readreg(unsigned char theSlave, unsigned char theReg);
/* Low level I2C */
static void i2c_start(void);
static void i2c_stop(void);
static void i2c_outbyte(unsigned char x);
static unsigned char i2c_inbyte(void);
static int i2c_getack(void);
static void i2c_sendack(void);
/* $Id: ide.c,v 1.4 2001/01/10 21:14:32 bjornw Exp $
/* $Id: ide.c,v 1.9 2001/03/01 13:11:18 bjornw Exp $
*
* Etrax specific IDE functions, like init and PIO-mode setting etc.
* Almost the entire ide.c is used for the rest of the Etrax ATA driver.
......@@ -8,6 +8,23 @@
* Mikael Starvik (pio setup stuff)
*
* $Log: ide.c,v $
* Revision 1.9 2001/03/01 13:11:18 bjornw
* 100 -> HZ
*
* Revision 1.8 2001/03/01 09:32:56 matsfg
* Moved IDE delay to a CONFIG-parameter instead
*
* Revision 1.7 2001/02/23 13:46:38 bjornw
* Spellling check
*
* Revision 1.6 2001/02/22 15:44:30 bjornw
* * Use ioremap when mapping the CSE1 memory-mapped reset-line for LX v2
* * sw_len for a 65536 descriptor is 0, not 65536
* * Express concern for G27 reset code
*
* Revision 1.5 2001/02/16 07:35:38 matsfg
* Now handles DMA request blocks between 64k and 128k by split into two descriptors.
*
* Revision 1.4 2001/01/10 21:14:32 bjornw
* Initialize hwif->ideproc, for the new way of handling ide_xxx_data
*
......@@ -63,8 +80,13 @@
/* number of Etrax DMA descriptors */
#define MAX_DMA_DESCRS 64
#ifdef CONFIG_ETRAX_IDE_CSE1_16_RESET
/* address where the memory-mapped IDE reset bit lives, if used */
static volatile unsigned long *reset_addr;
#endif
#define LOWDB(x)
#define D(x)
#define D(x)
void OUT_BYTE(unsigned char data, ide_ioreg_t reg) {
LOWDB(printk("ob: data 0x%x, reg 0x%x\n", data, reg));
......@@ -208,7 +230,8 @@ static int e100_dmaproc (ide_dma_action_t func, ide_drive_t *drive); /* defined
static void e100_ideproc (ide_ide_action_t func, ide_drive_t *drive,
void *buffer, unsigned int length); /* defined below */
void __init init_e100_ide (void)
void __init
init_e100_ide (void)
{
volatile unsigned int dummy;
int h;
......@@ -226,6 +249,8 @@ void __init init_e100_ide (void)
}
/* actually reset and configure the etrax100 ide/ata interface */
/* This is mystifying; why is not G27 SET anywhere ? It's just reset here twice. */
/* de-assert bus-reset */
#ifdef CONFIG_ETRAX_IDE_PB7_RESET
port_pb_dir_shadow = port_pb_dir_shadow |
......@@ -252,7 +277,16 @@ void __init init_e100_ide (void)
*R_GEN_CONFIG = genconfig_shadow;
#ifdef CONFIG_ETRAX_IDE_CSE1_16_RESET
*(volatile long *)(MEM_CSE1_START | MEM_NON_CACHEABLE) = 0;
#ifndef CONFIG_CRIS_LOW_MAP
/* remap the I/O-mapped reset-bit from CSE1 to something inside our kernel space */
reset_addr = (unsigned long *)ioremap((unsigned long)(MEM_CSE1_START |
MEM_NON_CACHEABLE), 16);
*reset_addr = 0;
#else
/* LOW_MAP, can't do the ioremap, but it's already mapped straight over */
reset_addr = (unsigned long *)(MEM_CSE1_START | MEM_NON_CACHEABLE);
*reset_addr = 0;
#endif
#endif
/* wait some */
......@@ -262,9 +296,11 @@ void __init init_e100_ide (void)
dummy = 3;
#ifdef CONFIG_ETRAX_IDE_CSE1_16_RESET
*(volatile long *)(MEM_CSE1_START | MEM_NON_CACHEABLE) = 1 << 16;
*R_PORT_G_DATA = 0; /* de-assert bus-reset */
*reset_addr = 1 << 16;
#endif
#ifdef CONFIG_ETRAX_IDE_G27_RESET
*R_PORT_G_DATA = 0; /* de-assert bus-reset */
#endif
/* make a dummy read to set the ata controller in a proper state */
dummy = *R_ATA_STATUS_DATA;
......@@ -286,9 +322,9 @@ void __init init_e100_ide (void)
IO_STATE( R_IRQ_MASK0_SET, ata_irq2, set ) |
IO_STATE( R_IRQ_MASK0_SET, ata_irq3, set ) );
printk("ide: waiting 10 seconds for drives to regain consciousness\n");
printk("ide: waiting %d seconds for drives to regain consciousness\n", CONFIG_IDE_DELAY);
h = jiffies + 1000;
h = jiffies + (CONFIG_IDE_DELAY * HZ);
while(jiffies < h) ;
/* reset the dma channels we will use */
......@@ -560,14 +596,6 @@ static int e100_ide_build_dmatable (ide_drive_t *drive)
return 1;
}
/* uh.. I'm lazy.. if size >= 65536, it should loop below and split it in
more than one descriptor */
if(size >= 65536) {
printk("too large ATA DMA request block, size = %d!\n", size);
return 1;
}
/* however, this case is more difficult - R_ATA_TRANSFER_CNT cannot be more
than 65536 words per transfer, so in that case we need to either
1) use a DMA interrupt to re-trigger R_ATA_TRANSFER_CNT and continue with
......@@ -581,8 +609,22 @@ static int e100_ide_build_dmatable (ide_drive_t *drive)
return 1;
}
/* If size > 65536 it has to be splitted into new descriptors. Since we don't handle
size > 131072 only one split is necessary */
if(size > 65536) {
/* ok we want to do IO at addr, size bytes. set up a new descriptor entry */
ata_descrs[count].sw_len = 0; /* 0 means 65536, this is a 16-bit field */
ata_descrs[count].ctrl = 0;
ata_descrs[count].buf = addr;
ata_descrs[count].next = virt_to_phys(&ata_descrs[count + 1]);
count++;
ata_tot_size += 65536;
/* size and addr should refere to not handled data */
size -= 65536;
addr += 65536;
}
/* ok we want to do IO at addr, size bytes. set up a new descriptor entry */
ata_descrs[count].sw_len = size;
ata_descrs[count].ctrl = 0;
ata_descrs[count].buf = addr;
......
/* $Id: serial.c,v 1.6 2000/11/22 16:36:09 bjornw Exp $
/* $Id: serial.c,v 1.10 2001/03/05 13:14:07 bjornw Exp $
*
* Serial port driver for the ETRAX 100LX chip
*
* Copyright (C) 1998, 1999, 2000 Axis Communications AB
* Copyright (C) 1998, 1999, 2000, 2001 Axis Communications AB
*
* Many, many authors. Based once upon a time on serial.c for 16x50.
*
* $Log: serial.c,v $
* Revision 1.10 2001/03/05 13:14:07 bjornw
* Another spelling fix
*
* Revision 1.9 2001/02/23 13:46:38 bjornw
* Spellling check
*
* Revision 1.8 2001/01/23 14:56:35 markusl
* Made use of ser1 optional
* Needed by USB
*
* Revision 1.7 2001/01/19 16:14:48 perf
* Added kernel options for serial ports 234.
* Changed option names from CONFIG_ETRAX100_XYZ to CONFIG_ETRAX_XYZ.
*
* Revision 1.6 2000/11/22 16:36:09 bjornw
* Please marketing by using the correct case when spelling Etrax.
*
......@@ -176,7 +190,7 @@
*
*/
static char *serial_version = "$Revision: 1.6 $";
static char *serial_version = "$Revision: 1.10 $";
#include <linux/config.h>
#include <linux/version.h>
......@@ -252,12 +266,12 @@ static int serial_refcount;
//#define SERIAL_HANDLE_EARLY_ERRORS
#ifndef CONFIG_ETRAX100_SERIAL_RX_TIMEOUT_TICKS
#ifndef CONFIG_ETRAX_SERIAL_RX_TIMEOUT_TICKS
/* Default number of timer ticks before flushing rx fifo
* When using "little data, low latency applications: use 0
* When using "much data applications (PPP)" use ~5
*/
#define CONFIG_ETRAX100_SERIAL_RX_TIMEOUT_TICKS 5
#define CONFIG_ETRAX_SERIAL_RX_TIMEOUT_TICKS 5
#endif
#define MAX_FLUSH_TIME 8
......@@ -367,36 +381,36 @@ static const struct control_pins e100_modem_pins[NR_PORTS] =
{
/* Ser 0 */
{
#if defined(CONFIG_ETRAX100_SER0_DTR_RI_DSR_CD_ON_PB)
#if defined(CONFIG_ETRAX_SER0_DTR_RI_DSR_CD_ON_PB)
R_PORT_PB_DATA, &port_pb_data_shadow, &port_pb_dir_shadow,
CONFIG_ETRAX100_SER0_DTR_ON_PB_BIT,
CONFIG_ETRAX100_SER0_RI_ON_PB_BIT,
CONFIG_ETRAX100_SER0_DSR_ON_PB_BIT,
CONFIG_ETRAX100_SER0_CD_ON_PB_BIT
CONFIG_ETRAX_SER0_DTR_ON_PB_BIT,
CONFIG_ETRAX_SER0_RI_ON_PB_BIT,
CONFIG_ETRAX_SER0_DSR_ON_PB_BIT,
CONFIG_ETRAX_SER0_CD_ON_PB_BIT
#else
&dummy_ser0, &dummy_ser0, &dummy_dir_ser0, 0, 1, 2, 3
#endif
},
/* Ser 1 */
{
#if defined(CONFIG_ETRAX100_SER1_DTR_RI_DSR_CD_ON_PB)
#if defined(CONFIG_ETRAX_SER1_DTR_RI_DSR_CD_ON_PB)
R_PORT_PB_DATA, &port_pb_data_shadow, &port_pb_dir_shadow,
CONFIG_ETRAX100_SER1_DTR_ON_PB_BIT,
CONFIG_ETRAX100_SER1_RI_ON_PB_BIT,
CONFIG_ETRAX100_SER1_DSR_ON_PB_BIT,
CONFIG_ETRAX100_SER1_CD_ON_PB_BIT
CONFIG_ETRAX_SER1_DTR_ON_PB_BIT,
CONFIG_ETRAX_SER1_RI_ON_PB_BIT,
CONFIG_ETRAX_SER1_DSR_ON_PB_BIT,
CONFIG_ETRAX_SER1_CD_ON_PB_BIT
#else
&dummy_ser1, &dummy_ser1, &dummy_dir_ser1, 0, 1, 2, 3
#endif
},
/* Ser 2 */
{
#if defined(CONFIG_ETRAX100_SER2_DTR_RI_DSR_CD_ON_PA)
#if defined(CONFIG_ETRAX_SER2_DTR_RI_DSR_CD_ON_PA)
R_PORT_PA_DATA, &port_pa_data_shadow, &port_pa_dir_shadow,
CONFIG_ETRAX100_SER2_DTR_ON_PA_BIT,
CONFIG_ETRAX100_SER2_RI_ON_PA_BIT,
CONFIG_ETRAX100_SER2_DSR_ON_PA_BIT,
CONFIG_ETRAX100_SER2_CD_ON_PA_BIT
CONFIG_ETRAX_SER2_DTR_ON_PA_BIT,
CONFIG_ETRAX_SER2_RI_ON_PA_BIT,
CONFIG_ETRAX_SER2_DSR_ON_PA_BIT,
CONFIG_ETRAX_SER2_CD_ON_PA_BIT
#else
&dummy_ser2, &dummy_ser2, &dummy_dir_ser2, 0, 1, 2, 3
#endif
......@@ -459,7 +473,7 @@ static DECLARE_MUTEX(tmp_buf_sem);
static struct semaphore tmp_buf_sem = MUTEX;
#endif
#ifdef CONFIG_ETRAX100_SERIAL_FLUSH_DMA_FAST
#ifdef CONFIG_ETRAX_SERIAL_FLUSH_DMA_FAST
#define TIMER1_IRQ_NBR 3
/* clock select 10 for timer 1 gives 230400 Hz */
......@@ -494,7 +508,7 @@ static void _INLINE_ start_flush_timer(void)
*R_IRQ_MASK0_SET = IO_STATE(R_IRQ_MASK0_SET, timer1, set);
fast_timer_started = 1;
}
#endif /* CONFIG_ETRAX100_SERIAL_FLUSH_DMA_FAST */
#endif /* CONFIG_ETRAX_SERIAL_FLUSH_DMA_FAST */
/*
* This function maps from the Bxxxx defines in asm/termbits.h into real
......@@ -1267,12 +1281,12 @@ rec_interrupt(int irq, void *dev_id, struct pt_regs * regs)
/* dma fifo/buffer timeout handler
forces an end-of-packet for the dma input channel if no chars
have been received for CONFIG_ETRAX100_RX_TIMEOUT_TICKS/100 s.
If CONFIG_ETRAX100_SERIAL_FLUSH_DMA_FAST is configured then this
have been received for CONFIG_ETRAX_RX_TIMEOUT_TICKS/100 s.
If CONFIG_ETRAX_SERIAL_FLUSH_DMA_FAST is configured then this
handler is instead run at 15360 Hz.
*/
#ifndef CONFIG_ETRAX100_SERIAL_FLUSH_DMA_FAST
#ifndef CONFIG_ETRAX_SERIAL_FLUSH_DMA_FAST
static int timeout_divider = 0;
#endif
......@@ -1467,7 +1481,7 @@ startup(struct e100_serial * info)
info->xmit.buf = (unsigned char *) page;
#ifdef SERIAL_DEBUG_OPEN
printk("starting up ttyS%d (xmit_buf 0x%x)...\n", info->line, info->xmit_buf);
printk("starting up ttyS%d (xmit_buf 0x%x)...\n", info->line, info->xmit.buf);
#endif
if(info->tty) {
......@@ -2688,12 +2702,15 @@ rs_open(struct tty_struct *tty, struct file * filp)
return -ENODEV;
/* dont allow opening ports that are not enabled in the HW config */
#ifndef CONFIG_ETRAX100_SERIAL_PORT2
#ifndef CONFIG_ETRAX_SERIAL_PORT1
if (line == 1)
return -ENODEV;
#endif
#ifndef CONFIG_ETRAX_SERIAL_PORT2
if (line == 2)
return -ENODEV;
#endif
#ifndef CONFIG_ETRAX100_SERIAL_PORT3
#ifndef CONFIG_ETRAX_SERIAL_PORT3
if (line == 3)
return -ENODEV;
#endif
......@@ -2955,7 +2972,7 @@ rs_init(void)
for (i = 0, info = rs_table; i < NR_PORTS; i++,info++) {
info->line = i;
info->tty = 0;
info->type = PORT_ETRAX100;
info->type = PORT_ETRAX;
info->tr_running = 0;
info->fifo_magic = 0;
info->fifo_didmagic = 0;
......@@ -2990,25 +3007,27 @@ rs_init(void)
if(request_irq(8, ser_interrupt, SA_INTERRUPT, "serial ", NULL))
panic("irq8");
#endif
#ifdef CONFIG_ETRAX_SERIAL_PORT1
if(request_irq(24, tr_interrupt, SA_INTERRUPT, "serial 1 dma tr", NULL))
panic("irq24");
if(request_irq(25, rec_interrupt, SA_INTERRUPT, "serial 1 dma rec", NULL))
panic("irq25");
#ifdef CONFIG_ETRAX100_SERIAL_PORT2
#endif
#ifdef CONFIG_ETRAX_SERIAL_PORT2
/* DMA Shared with par0 (and SCSI0 and ATA) */
if(request_irq(18, tr_interrupt, SA_SHIRQ, "serial 2 dma tr", NULL))
panic("irq18");
if(request_irq(19, rec_interrupt, SA_SHIRQ, "serial 2 dma rec", NULL))
panic("irq19");
#endif
#ifdef CONFIG_ETRAX100_SERIAL_PORT3
#ifdef CONFIG_ETRAX_SERIAL_PORT3
/* DMA Shared with par1 (and SCSI1 and Extern DMA 0) */
if(request_irq(20, tr_interrupt, SA_SHIRQ, "serial 3 dma tr", NULL))
panic("irq20");
if(request_irq(21, rec_interrupt, SA_SHIRQ, "serial 3 dma rec", NULL))
panic("irq21");
#endif
#ifdef CONFIG_ETRAX100_SERIAL_FLUSH_DMA_FAST
#ifdef CONFIG_ETRAX_SERIAL_FLUSH_DMA_FAST
/* TODO: a timeout_interrupt needs to be written that calls timeout_handler */
if(request_irq(TIMER1_IRQ_NBR, timeout_interrupt, SA_SHIRQ,
"fast serial dma timeout", NULL)) {
......
......@@ -4,8 +4,8 @@
* Copyright (C) 1998, 1999, 2000 Axis Communications AB
*/
#ifndef _ETRAX100_SERIAL_H
#define _ETRAX100_SERIAL_H
#ifndef _ETRAX_SERIAL_H
#define _ETRAX_SERIAL_H
#include <linux/config.h>
#include <linux/circ_buf.h>
......@@ -64,7 +64,7 @@ struct e100_serial {
unsigned long event;
unsigned long last_active;
int line;
int type; /* PORT_ETRAX100 */
int type; /* PORT_ETRAX */
int count; /* # of fd on device */
int blocked_open; /* # of blocked opens */
long session; /* Session of opening process */
......@@ -93,7 +93,7 @@ struct e100_serial {
* system.
*/
#define PORT_ETRAX100 1
#define PORT_ETRAX 1
/*
* Events are used to schedule things to happen at timer-interrupt
......@@ -103,4 +103,4 @@ struct e100_serial {
#endif /* __KERNEL__ */
#endif /* !(_ETRAX100_SERIAL_H) */
#endif /* !(_ETRAX_SERIAL_H) */
This diff is collapsed.
This diff is collapsed.
#ifndef __LINUX_ETRAX_USB_H
#define __LINUX_ETRAX_USB_H
#include <linux/types.h>
#include <linux/list.h>
typedef struct USB_IN_Desc {
__u16 sw_len;
__u16 command;
unsigned long next;
unsigned long buf;
__u16 hw_len;
__u16 status;
} USB_IN_Desc_t;
typedef struct USB_SB_Desc {
__u16 sw_len;
__u16 command;
unsigned long next;
unsigned long buf;
__u32 dummy;
} USB_SB_Desc_t;
typedef struct USB_EP_Desc {
__u16 hw_len;
__u16 command;
unsigned long sub;
unsigned long nep;
__u32 dummy;
} USB_EP_Desc_t;
struct virt_root_hub {
int devnum;
void *urb;
void *int_addr;
int send;
int interval;
int numports;
struct timer_list rh_int_timer;
__u16 wPortChange_1;
__u16 wPortChange_2;
__u16 prev_wPortStatus_1;
__u16 prev_wPortStatus_2;
};
struct etrax_usb_intr_traffic {
int sleeping;
int error;
struct wait_queue *wq;
};
typedef struct etrax_usb_hc {
struct usb_bus *bus;
struct virt_root_hub rh;
struct etrax_usb_intr_traffic intr;
} etrax_hc_t;
typedef enum {idle, eot, nodata} etrax_usb_rx_state_t;
typedef struct etrax_usb_urb_priv {
USB_SB_Desc_t *first_sb;
__u32 rx_offset;
etrax_usb_rx_state_t rx_state;
__u8 eot;
struct list_head ep_in_list;
} etrax_urb_priv_t;
struct usb_reg_context
{
etrax_hc_t *hc;
__u32 r_usb_epid_attn;
__u8 r_usb_status;
__u32 r_usb_rh_port_status_1;
__u32 r_usb_rh_port_status_2;
__u32 r_usb_irq_mask_read;
struct tq_struct usb_bh;
#if 0
__u32 r_usb_ept_data[32];
#endif
};
struct in_chunk
{
void *data;
int length;
char epid;
struct list_head list;
};
/* ---------------------------------------------------------------------------
Virtual Root HUB
------------------------------------------------------------------------- */
/* destination of request */
#define RH_INTERFACE 0x01
#define RH_ENDPOINT 0x02
#define RH_OTHER 0x03
#define RH_CLASS 0x20
#define RH_VENDOR 0x40
/* Requests: bRequest << 8 | bmRequestType */
#define RH_GET_STATUS 0x0080
#define RH_CLEAR_FEATURE 0x0100
#define RH_SET_FEATURE 0x0300
#define RH_SET_ADDRESS 0x0500
#define RH_GET_DESCRIPTOR 0x0680
#define RH_SET_DESCRIPTOR 0x0700
#define RH_GET_CONFIGURATION 0x0880
#define RH_SET_CONFIGURATION 0x0900
#define RH_GET_STATE 0x0280
#define RH_GET_INTERFACE 0x0A80
#define RH_SET_INTERFACE 0x0B00
#define RH_SYNC_FRAME 0x0C80
/* Our Vendor Specific Request */
#define RH_SET_EP 0x2000
/* Hub port features */
#define RH_PORT_CONNECTION 0x00
#define RH_PORT_ENABLE 0x01
#define RH_PORT_SUSPEND 0x02
#define RH_PORT_OVER_CURRENT 0x03
#define RH_PORT_RESET 0x04
#define RH_PORT_POWER 0x08
#define RH_PORT_LOW_SPEED 0x09
#define RH_C_PORT_CONNECTION 0x10
#define RH_C_PORT_ENABLE 0x11
#define RH_C_PORT_SUSPEND 0x12
#define RH_C_PORT_OVER_CURRENT 0x13
#define RH_C_PORT_RESET 0x14
/* Hub features */
#define RH_C_HUB_LOCAL_POWER 0x00
#define RH_C_HUB_OVER_CURRENT 0x01
#define RH_DEVICE_REMOTE_WAKEUP 0x00
#define RH_ENDPOINT_STALL 0x01
/* Our Vendor Specific feature */
#define RH_REMOVE_EP 0x00
#define RH_ACK 0x01
#define RH_REQ_ERR -1
#define RH_NACK 0x00
#define min(a,b) (((a)<(b))?(a):(b))
/* Field definitions for */
#define USB_IN_command__eol__BITNR 0 /* command macros */
#define USB_IN_command__eol__WIDTH 1
#define USB_IN_command__eol__no 0
#define USB_IN_command__eol__yes 1
#define USB_IN_command__intr__BITNR 3
#define USB_IN_command__intr__WIDTH 1
#define USB_IN_command__intr__no 0
#define USB_IN_command__intr__yes 1
#define USB_IN_status__eop__BITNR 1 /* status macros. */
#define USB_IN_status__eop__WIDTH 1
#define USB_IN_status__eop__no 0
#define USB_IN_status__eop__yes 1
#define USB_IN_status__eot__BITNR 5
#define USB_IN_status__eot__WIDTH 1
#define USB_IN_status__eot__no 0
#define USB_IN_status__eot__yes 1
#define USB_IN_status__error__BITNR 6
#define USB_IN_status__error__WIDTH 1
#define USB_IN_status__error__no 0
#define USB_IN_status__error__yes 1
#define USB_IN_status__nodata__BITNR 7
#define USB_IN_status__nodata__WIDTH 1
#define USB_IN_status__nodata__no 0
#define USB_IN_status__nodata__yes 1
#define USB_IN_status__epid__BITNR 8
#define USB_IN_status__epid__WIDTH 5
#define USB_EP_command__eol__BITNR 0
#define USB_EP_command__eol__WIDTH 1
#define USB_EP_command__eol__no 0
#define USB_EP_command__eol__yes 1
#define USB_EP_command__eof__BITNR 1
#define USB_EP_command__eof__WIDTH 1
#define USB_EP_command__eof__no 0
#define USB_EP_command__eof__yes 1
#define USB_EP_command__intr__BITNR 3
#define USB_EP_command__intr__WIDTH 1
#define USB_EP_command__intr__no 0
#define USB_EP_command__intr__yes 1
#define USB_EP_command__enable__BITNR 4
#define USB_EP_command__enable__WIDTH 1
#define USB_EP_command__enable__no 0
#define USB_EP_command__enable__yes 1
#define USB_EP_command__hw_valid__BITNR 5
#define USB_EP_command__hw_valid__WIDTH 1
#define USB_EP_command__hw_valid__no 0
#define USB_EP_command__hw_valid__yes 1
#define USB_EP_command__epid__BITNR 8
#define USB_EP_command__epid__WIDTH 5
#define USB_SB_command__eol__BITNR 0 /* command macros. */
#define USB_SB_command__eol__WIDTH 1
#define USB_SB_command__eol__no 0
#define USB_SB_command__eol__yes 1
#define USB_SB_command__eot__BITNR 1
#define USB_SB_command__eot__WIDTH 1
#define USB_SB_command__eot__no 0
#define USB_SB_command__eot__yes 1
#define USB_SB_command__intr__BITNR 3
#define USB_SB_command__intr__WIDTH 1
#define USB_SB_command__intr__no 0
#define USB_SB_command__intr__yes 1
#define USB_SB_command__tt__BITNR 4
#define USB_SB_command__tt__WIDTH 2
#define USB_SB_command__tt__zout 0
#define USB_SB_command__tt__in 1
#define USB_SB_command__tt__out 2
#define USB_SB_command__tt__setup 3
#define USB_SB_command__rem__BITNR 8
#define USB_SB_command__rem__WIDTH 6
#define USB_SB_command__full__BITNR 6
#define USB_SB_command__full__WIDTH 1
#define USB_SB_command__full__no 0
#define USB_SB_command__full__yes 1
#endif
/* $Id: entry.S,v 1.11 2001/01/10 21:13:29 bjornw Exp $
/* $Id: entry.S,v 1.15 2001/03/05 13:14:30 bjornw Exp $
*
* linux/arch/cris/entry.S
*
* Copyright (C) 2000 Axis Communications AB
* Copyright (C) 2000, 2001 Axis Communications AB
*
* Authors: Bjorn Wesen (bjornw@axis.com)
*
* $Log: entry.S,v $
* Revision 1.15 2001/03/05 13:14:30 bjornw
* Spelling fix
*
* Revision 1.14 2001/02/23 08:36:36 perf
* New ABI; syscallnr=r9, arg5=mof, arg6=srp.
* Corrected tracesys call check.
*
* Revision 1.13 2001/02/15 08:40:55 perf
* H-P by way of perf;
* - (_system_call): Don't read system call function address into r1.
* - (RBFExit): There is no such thing as a null pop. Adjust sp by addq.
* - (_system_call): Don't use r10 and don't save and restore it.
* - (THREAD_ESP0): New constant.
* - (_system_call): Inline set_esp0.
*
* Revision 1.12 2001/01/31 17:56:25 orjanf
* Added definition of LTASK_PID and made it global.
*
* Revision 1.11 2001/01/10 21:13:29 bjornw
* SYMBOL_NAME is defined incorrectly for the compiler options we currently use
*
......@@ -79,7 +97,8 @@
.globl _mmu_bus_fault
.globl _sys_call_table
.globl LTASK_PID
;; syscall error codes
LENOSYS = 38
......@@ -90,7 +109,17 @@ LENOSYS = 38
LTASK_SIGPENDING = 8
LTASK_NEEDRESCHED = 20
LTASK_PTRACE = 24
LTASK_PID = 105
;; process bits for ptrace
PT_TRACESYS_BIT = 1
;; Offset for esp0 into task_struct: current->thread.esp0.
;; FIXME: In need of padding somewhere, to get dword-alignment.
THREAD_ESP0 = 597
;; some pt_regs offsets (from ptrace.h)
LORIG_R10 = 4
......@@ -98,8 +127,8 @@ LR13 = 8
LR12 = 12
LR11 = 16
LR10 = 20
LR1 = 56
LR0 = 60
LR9 = 24
LMOF = 64
LDCCR = 68
LSRP = 72
LIRP = 76
......@@ -124,7 +153,7 @@ _ret_from_intr:
nop
ba ret_with_reschedule ; go back but check schedule and signals first
nop
reschedule:
;; keep r9 intact
push r9
......@@ -170,41 +199,38 @@ _system_call:
push r10 ; push orig_r10
clear.d [sp=sp-4] ; frametype == 0, normal stackframe
move.d r10,r2 ; save for later
movs.w -LENOSYS,r10
move.d r10,[sp+LR10] ; put the default return value in r10 in the frame
move.d sp,r10
jsr _set_esp0 ; save top of frame (clobbers r9...)
movs.w -LENOSYS,r0
move.d r0,[sp+LR10] ; put the default return value in r10 in the frame
;; Perform "current->thread.esp0 = sp".
;; This used to be a separate function; set_esp0(ssp).
movs.w -8192,r0 ; THREAD_SIZE == 8192
and.d sp,r0
move.d sp,[r0+THREAD_ESP0]
;; check if this process is syscall-traced
move.d sp, r10
and.d -8192, r10 ; THREAD_SIZE == 8192
move.d [r10+LTASK_PTRACE],r10
btstq 2, r10 ; PT_TRACESYS
move.d [r0+LTASK_PTRACE],r0
btstq PT_TRACESYS_BIT, r0
bmi tracesys
nop
;; check for sanity in the requested syscall number
cmpu.w NR_syscalls,r1
cmpu.w NR_syscalls,r9
bcc _ret_from_sys_call
lslq 2,r1 ; multiply by 4, in the delay slot
lslq 2,r9 ; multiply by 4, in the delay slot
;; read the system call vector into r1
move.d [r1+_sys_call_table],r1
;; the parameter carrying registers r10, r11, r12 and 13 are intact.
;; the fifth and sixth parameters (if any) was in mof and srp
;; respectively, and we need to put them on the stack.
;; the parameter carrying registers r11, r12 and 13 are intact - restore r10.
;; the fifth parameter (if any) was in r0, and we need to put it on the stack
push r0
move.d r2,r10
push srp
push mof
jsr r1 ; actually call the corresponding system call
addq 4,sp ; pop the r0 parameter
jsr [r9+_sys_call_table] ; actually do the system call
addq 2*4,sp ; pop the mof and srp parameters
move.d r10,[sp+LR10] ; save the return value
moveq 1,r9 ; "parameter" to ret_from_sys_call to show it was a sys call
......@@ -269,10 +295,8 @@ RBFexit:
;; just get the PC value to restart it with, and skip the rest of
;; the frame.
pop irp ; fixup location will be here
pop p8 ; null pop
pop p8 ; null pop
reti ; return to IRP, taking U-flag into account
pop p8 ; null pop in delayslot
addq 12,sp ; Skip rest of SBFS frame.
tracesys:
......@@ -289,30 +313,32 @@ tracesys:
;; check for sanity in the requested syscall number
move.d [sp+LR1], r1
move.d [sp+LR9], r9
movs.w -LENOSYS, r10
cmpu.w NR_syscalls,r1
cmpu.w NR_syscalls,r9
bcc 1f
lslq 2,r1 ; multiply by 4, in the delay slot
lslq 2,r9 ; multiply by 4, in the delay slot
;; read the system call vector entry into r1
;; read the system call vector entry into r9
move.d [r1+_sys_call_table],r1
move.d [r9+_sys_call_table],r9
;; restore r10, r11, r12, r13 and r0 into the needed registers
;; restore r10, r11, r12, r13, mof and srp into the needed registers
move.d [sp+LORIG_R10], r10 ; LR10 is already filled with -LENOSYS
move.d [sp+LR11], r11
move.d [sp+LR12], r12
move.d [sp+LR13], r13
move.d [sp+LR0], r0
move [sp+LMOF], mof
move [sp+LSRP], srp
;; the fifth parameter needs to be put on the stack for the system
;; call to find it
;; the fifth and sixth parameters needs to be put on the stack for
;; the system call to find them
push r0
jsr r1 ; actually call the system-call
addq 4,sp ; pop the r0 parameter
push srp
push mof
jsr r9 ; actually call the system-call
addq 2*4,sp ; pop the r0 parameter
1: move.d r10,[sp+LR10] ; save the return value
......
This diff is collapsed.
/* $Id: irq.c,v 1.5 2000/08/17 15:35:15 bjornw Exp $
/* $Id: irq.c,v 1.11 2001/02/27 13:52:52 bjornw Exp $
*
* linux/arch/cris/kernel/irq.c
*
* Copyright (c) 2000 Axis Communications AB
* Copyright (c) 2000,2001 Axis Communications AB
*
* Authors: Bjorn Wesen (bjornw@axis.com)
*
......@@ -30,7 +30,7 @@
#include <linux/ioport.h>
#include <linux/interrupt.h>
#include <linux/timex.h>
#include <linux/malloc.h>
#include <linux/slab.h>
#include <linux/random.h>
#include <asm/system.h>
......@@ -160,6 +160,8 @@ BUILD_IRQ(22, 0x400000)
BUILD_IRQ(23, 0x800000)
BUILD_IRQ(24, 0x1000000)
BUILD_IRQ(25, 0x2000000)
/* IRQ 26-30 are resereved */
BUILD_IRQ(31, 0x80000000)
/*
* Pointers to the low-level handlers
......@@ -172,7 +174,8 @@ static void (*interrupt[NR_IRQS])(void) = {
IRQ12_interrupt, IRQ13_interrupt, NULL, NULL,
IRQ16_interrupt, IRQ17_interrupt, IRQ18_interrupt, IRQ19_interrupt,
IRQ20_interrupt, IRQ21_interrupt, IRQ22_interrupt, IRQ23_interrupt,
IRQ24_interrupt, IRQ25_interrupt
IRQ24_interrupt, IRQ25_interrupt, NULL, NULL, NULL, NULL, NULL,
IRQ31_interrupt
};
static void (*sinterrupt[NR_IRQS])(void) = {
......@@ -182,7 +185,8 @@ static void (*sinterrupt[NR_IRQS])(void) = {
sIRQ12_interrupt, sIRQ13_interrupt, NULL, NULL,
sIRQ16_interrupt, sIRQ17_interrupt, sIRQ18_interrupt, sIRQ19_interrupt,
sIRQ20_interrupt, sIRQ21_interrupt, sIRQ22_interrupt, sIRQ23_interrupt,
sIRQ24_interrupt, sIRQ25_interrupt
sIRQ24_interrupt, sIRQ25_interrupt, NULL, NULL, NULL, NULL, NULL,
sIRQ31_interrupt
};
static void (*bad_interrupt[NR_IRQS])(void) = {
......@@ -198,7 +202,9 @@ static void (*bad_interrupt[NR_IRQS])(void) = {
bad_IRQ18_interrupt, bad_IRQ19_interrupt,
bad_IRQ20_interrupt, bad_IRQ21_interrupt,
bad_IRQ22_interrupt, bad_IRQ23_interrupt,
bad_IRQ24_interrupt, bad_IRQ25_interrupt
bad_IRQ24_interrupt, bad_IRQ25_interrupt,
NULL, NULL, NULL, NULL, NULL,
bad_IRQ31_interrupt
};
/*
......@@ -212,7 +218,8 @@ static struct irqaction *irq_action[NR_IRQS] = {
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL
};
int get_irq_list(char *buf)
......@@ -412,6 +419,8 @@ void weird_irq(void)
*/
void system_call(void); /* from entry.S */
void gdb_handle_breakpoint(void); /* from traps.c */
void do_sigtrap(void); /* also from traps.c */
void init_IRQ(void)
{
......@@ -431,14 +440,22 @@ void init_IRQ(void)
for(i = 0; i < NR_IRQS; i++)
irq_shortcuts[i] = NULL;
for (i = 0; i < 256; i++)
etrax_irv->v[i] = weird_irq;
for (i = 0; i < 256; i++)
etrax_irv->v[i] = weird_irq;
/* the entries in the break vector contain actual code to be
executed by the associated break handler, rather than just a jump
address. therefore we need to setup a default breakpoint handler
for all breakpoints */
for (i = 0; i < 16; i++)
set_break_vector(i, do_sigtrap);
/* set all etrax irq's to the bad handlers */
for (i = 2; i < NR_IRQS; i++)
set_int_vector(i, bad_interrupt[i], 0);
/* except IRQ 15 which is the multiple-IRQ handler on Etrax100 */
set_int_vector(15, multiple_interrupt, 0);
......@@ -456,12 +473,15 @@ void init_IRQ(void)
set_break_vector(13, system_call);
/* setup a breakpoint handler for debugging used for both user and
kernel mode debugging (which is why it is not inside an ifdef
CONFIG_KGDB) */
set_break_vector(8, gdb_handle_breakpoint);
#ifdef CONFIG_KGDB
/* setup kgdb if its enabled, and break into the debugger */
kgdb_init();
breakpoint();
#endif
}
}
......@@ -18,6 +18,12 @@
*! Jul 21 1999 Bjorn Wesen eLinux port
*!
*! $Log: kgdb.c,v $
*! Revision 1.4 2001/02/23 13:45:19 bjornw
*! config.h check
*!
*! Revision 1.3 2001/01/31 18:08:23 orjanf
*! Removed kgdb_handle_breakpoint from being the break 8 handler.
*!
*! Revision 1.2 2001/01/12 14:22:25 orjanf
*! Updated kernel debugging support to work with ETRAX 100LX.
*!
......@@ -43,7 +49,7 @@
*!
*!---------------------------------------------------------------------------
*!
*! $Id: kgdb.c,v 1.2 2001/01/12 14:22:25 orjanf Exp $
*! $Id: kgdb.c,v 1.4 2001/02/23 13:45:19 bjornw Exp $
*!
*! (C) Copyright 1999, Axis Communications AB, LUND, SWEDEN
*!
......@@ -1531,7 +1537,7 @@ kgdb_init(void)
{
/* could initialize debug port as well but it's done in head.S already... */
set_break_vector(8, kgdb_handle_breakpoint);
/* breakpoint handler is now set in irq.c */
set_int_vector(8, kgdb_handle_serial, 0);
enableDebugIRQ();
......
This diff is collapsed.
This diff is collapsed.
......@@ -38,9 +38,6 @@
#define RESTART_CRIS_SYS(regs) regs->r10 = regs->orig_r10; regs->irp -= 2;
int sys_wait4(pid_t pid, unsigned long *stat_addr,
int options, unsigned long *ru);
int do_signal(int canrestart, sigset_t *oldset, struct pt_regs *regs);
int copy_siginfo_to_user(siginfo_t *to, siginfo_t *from)
......@@ -391,9 +388,9 @@ static void setup_frame(int sig, struct k_sigaction *ka,
} else {
/* trampoline - the desired return ip is the retcode itself */
return_ip = (unsigned long)&frame->retcode;
/* This is movu.w __NR_sigreturn, r1; break 13; */
/* This is movu.w __NR_sigreturn, r9; break 13; */
/* TODO: check byteorder */
err |= __put_user(0x1c5f, (short *)(frame->retcode+0));
err |= __put_user(0x9c5f, (short *)(frame->retcode+0));
err |= __put_user(__NR_sigreturn, (short *)(frame->retcode+2));
err |= __put_user(0xe93d, (short *)(frame->retcode+4));
}
......@@ -453,9 +450,9 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
} else {
/* trampoline - the desired return ip is the retcode itself */
return_ip = (unsigned long)&frame->retcode;
/* This is movu.w __NR_sigreturn, r1; break 13; */
/* This is movu.w __NR_sigreturn, r9; break 13; */
/* TODO: check byteorder */
err |= __put_user(0x1c5f, (short *)(frame->retcode+0));
err |= __put_user(0x9c5f, (short *)(frame->retcode+0));
err |= __put_user(__NR_sigreturn, (short *)(frame->retcode+2));
err |= __put_user(0xe93d, (short *)(frame->retcode+4));
}
......
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.
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.
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