summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-06-18 09:45:47 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-06-18 09:45:47 +0000
commit41ae123ec2d77615cd0b0476ff62564bd7a4865f (patch)
treeba6a57d3a8d7d725a5e0ae64e8401ed3bea0efb9 /sys
parent7a0b7f798c45842a34a4c6413f45e1b3824154a5 (diff)
sync to 0616, retaining local diffs
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/alpha/README182
-rw-r--r--sys/arch/alpha/STATUS99
-rw-r--r--sys/arch/alpha/TODO.users46
-rw-r--r--sys/arch/alpha/alpha/autoconf.c568
-rw-r--r--sys/arch/alpha/alpha/clock.c116
-rw-r--r--sys/arch/alpha/alpha/clock_mc.c279
-rw-r--r--sys/arch/alpha/alpha/clockvar.h35
-rw-r--r--sys/arch/alpha/alpha/conf.c43
-rw-r--r--sys/arch/alpha/alpha/cpu.c28
-rw-r--r--sys/arch/alpha/alpha/dec_2100_a50.c151
-rw-r--r--sys/arch/alpha/alpha/dec_2100_a50.h8
-rw-r--r--sys/arch/alpha/alpha/dec_3000_300.c85
-rw-r--r--sys/arch/alpha/alpha/dec_3000_300.h8
-rw-r--r--sys/arch/alpha/alpha/dec_3000_500.c87
-rw-r--r--sys/arch/alpha/alpha/dec_3000_500.h8
-rw-r--r--sys/arch/alpha/alpha/dec_axppci_33.c137
-rw-r--r--sys/arch/alpha/alpha/dec_axppci_33.h8
-rw-r--r--sys/arch/alpha/alpha/dec_kn20aa.c137
-rw-r--r--sys/arch/alpha/alpha/dec_kn20aa.h8
-rw-r--r--sys/arch/alpha/alpha/disksubr.c8
-rw-r--r--sys/arch/alpha/alpha/genassym.c8
-rw-r--r--sys/arch/alpha/alpha/in_cksum.c198
-rw-r--r--sys/arch/alpha/alpha/interrupt.c4
-rw-r--r--sys/arch/alpha/alpha/locore.s28
-rw-r--r--sys/arch/alpha/alpha/machdep.c177
-rw-r--r--sys/arch/alpha/alpha/mainbus.c17
-rw-r--r--sys/arch/alpha/alpha/mcclock.c136
-rw-r--r--sys/arch/alpha/alpha/mcclockvar.h (renamed from sys/arch/alpha/include/pci_machdep.h)23
-rw-r--r--sys/arch/alpha/alpha/mem.c4
-rw-r--r--sys/arch/alpha/alpha/pmap.c54
-rw-r--r--sys/arch/alpha/alpha/prom.c12
-rw-r--r--sys/arch/alpha/alpha/prom_disp.s12
-rw-r--r--sys/arch/alpha/alpha/promcons.c7
-rw-r--r--sys/arch/alpha/alpha/swapgeneric.c167
-rw-r--r--sys/arch/alpha/alpha/vm_machdep.c19
-rw-r--r--sys/arch/alpha/compile/build_all38
-rw-r--r--sys/arch/alpha/compile/rebuild_all48
-rw-r--r--sys/arch/alpha/conf/ALPHA46
-rw-r--r--sys/arch/alpha/conf/BUNNY35
-rw-r--r--sys/arch/alpha/conf/DILLY96
-rw-r--r--sys/arch/alpha/conf/GENERIC46
-rw-r--r--sys/arch/alpha/conf/GENERIC_NFS123
-rw-r--r--sys/arch/alpha/conf/JURA10
-rw-r--r--sys/arch/alpha/conf/Makefile.alpha156
-rw-r--r--sys/arch/alpha/conf/NONAME89
-rw-r--r--sys/arch/alpha/conf/NOSY (renamed from sys/arch/alpha/conf/MACALLAN)37
-rw-r--r--sys/arch/alpha/conf/TOMMY91
-rw-r--r--sys/arch/alpha/conf/files.alpha155
-rw-r--r--sys/arch/alpha/eisa/eisa_machdep.h64
-rw-r--r--sys/arch/alpha/include/ansi.h3
-rw-r--r--sys/arch/alpha/include/asm.h6
-rw-r--r--sys/arch/alpha/include/autoconf.h19
-rw-r--r--sys/arch/alpha/include/bus.h218
-rw-r--r--sys/arch/alpha/include/cdefs.h4
-rw-r--r--sys/arch/alpha/include/cfbreg.h59
-rw-r--r--sys/arch/alpha/include/coff.h109
-rw-r--r--sys/arch/alpha/include/cpu.h6
-rw-r--r--sys/arch/alpha/include/ecoff.h72
-rw-r--r--sys/arch/alpha/include/eisa_machdep.h0
-rw-r--r--sys/arch/alpha/include/fbio.h173
-rw-r--r--sys/arch/alpha/include/intr.h40
-rw-r--r--sys/arch/alpha/include/intrcnt.h70
-rw-r--r--sys/arch/alpha/include/kbio.h117
-rw-r--r--sys/arch/alpha/include/limits.h61
-rw-r--r--sys/arch/alpha/include/param.h6
-rw-r--r--sys/arch/alpha/include/prom.h3
-rw-r--r--sys/arch/alpha/include/psl.h7
-rw-r--r--sys/arch/alpha/include/pte.h4
-rw-r--r--sys/arch/alpha/include/rpb.h5
-rw-r--r--sys/arch/alpha/include/sfbreg.h96
-rw-r--r--sys/arch/alpha/include/sysarch.h (renamed from sys/arch/alpha/include/isa_machdep.h)29
-rw-r--r--sys/arch/alpha/include/tgareg.h (renamed from sys/arch/alpha/pci/tgareg.h)12
-rw-r--r--sys/arch/alpha/include/vuid_event.h87
-rw-r--r--sys/arch/alpha/include/wsconsio.h61
-rw-r--r--sys/arch/alpha/isa/isa_machdep.h53
-rw-r--r--sys/arch/alpha/isa/isafcns_jensen.c28
-rw-r--r--sys/arch/alpha/isa/mcclock_isa.c120
-rw-r--r--sys/arch/alpha/isa/pckbd.c400
-rw-r--r--sys/arch/alpha/isa/pms.c329
-rw-r--r--sys/arch/alpha/isa/spkrreg.h11
-rw-r--r--sys/arch/alpha/isa/timerreg.h100
-rw-r--r--sys/arch/alpha/pci/apecs.c64
-rw-r--r--sys/arch/alpha/pci/apecs_isa.c346
-rw-r--r--sys/arch/alpha/pci/apecs_lca_bus_io.c59
-rw-r--r--sys/arch/alpha/pci/apecs_lca_bus_mem.c65
-rw-r--r--sys/arch/alpha/pci/apecs_pci.c194
-rw-r--r--sys/arch/alpha/pci/apecsvar.h37
-rw-r--r--sys/arch/alpha/pci/bt485reg.h11
-rw-r--r--sys/arch/alpha/pci/cia.c63
-rw-r--r--sys/arch/alpha/pci/cia_bus_io.c63
-rw-r--r--sys/arch/alpha/pci/cia_bus_mem.c79
-rw-r--r--sys/arch/alpha/pci/cia_isa.c346
-rw-r--r--sys/arch/alpha/pci/cia_pci.c198
-rw-r--r--sys/arch/alpha/pci/ciareg.h34
-rw-r--r--sys/arch/alpha/pci/ciavar.h31
-rw-r--r--sys/arch/alpha/pci/lca.c89
-rw-r--r--sys/arch/alpha/pci/lca_isa.c346
-rw-r--r--sys/arch/alpha/pci/lca_pci.c251
-rw-r--r--sys/arch/alpha/pci/lcareg.h4
-rw-r--r--sys/arch/alpha/pci/lcavar.h27
-rw-r--r--sys/arch/alpha/pci/pci_2100_a50.c159
-rw-r--r--sys/arch/alpha/pci/pci_2100_a50.h8
-rw-r--r--sys/arch/alpha/pci/pci_axppci_33.c168
-rw-r--r--sys/arch/alpha/pci/pci_axppci_33.h10
-rw-r--r--sys/arch/alpha/pci/pci_kn20aa.c118
-rw-r--r--sys/arch/alpha/pci/pci_kn20aa.h6
-rw-r--r--sys/arch/alpha/pci/pci_machdep.c54
-rw-r--r--sys/arch/alpha/pci/pci_machdep.h87
-rw-r--r--sys/arch/alpha/pci/pcivga.c354
-rw-r--r--sys/arch/alpha/pci/pcivgavar.h34
-rw-r--r--sys/arch/alpha/pci/pcs_bus_io_common.c488
-rw-r--r--sys/arch/alpha/pci/pcs_bus_mem_common.c378
-rw-r--r--sys/arch/alpha/pci/sio.c169
-rw-r--r--sys/arch/alpha/pci/sio_pic.c122
-rw-r--r--sys/arch/alpha/pci/sioreg.h129
-rw-r--r--sys/arch/alpha/pci/siovar.h12
-rw-r--r--sys/arch/alpha/pci/tga.c679
-rw-r--r--sys/arch/alpha/pci/tga_bt463.c (renamed from sys/arch/alpha/pci/wsconsvar.h)45
-rw-r--r--sys/arch/alpha/pci/tga_bt485.c586
-rw-r--r--sys/arch/alpha/pci/tga_conf.c183
-rw-r--r--sys/arch/alpha/pci/tgavar.h79
-rw-r--r--sys/arch/alpha/pci/wscons.c383
-rw-r--r--sys/arch/alpha/stand/OSFpal.c28
-rw-r--r--sys/arch/alpha/stand/bbinfo.h28
-rw-r--r--sys/arch/alpha/stand/boot/Makefile4
-rw-r--r--sys/arch/alpha/stand/boot/boot.c14
-rw-r--r--sys/arch/alpha/stand/boot/version7
-rw-r--r--sys/arch/alpha/stand/bootxx.c29
-rw-r--r--sys/arch/alpha/stand/headersize.c11
-rw-r--r--sys/arch/alpha/stand/prom_disp.S6
-rw-r--r--sys/arch/alpha/tc/cfb.c346
-rw-r--r--sys/arch/alpha/tc/cfbvar.h62
-rw-r--r--sys/arch/alpha/tc/esp.c21
-rw-r--r--sys/arch/alpha/tc/ioasic.c78
-rw-r--r--sys/arch/alpha/tc/mcclock_ioasic.c112
-rw-r--r--sys/arch/alpha/tc/scc.c52
-rw-r--r--sys/arch/alpha/tc/sfb.c411
-rw-r--r--sys/arch/alpha/tc/sfbvar.h62
-rw-r--r--sys/arch/alpha/tc/tc_3000_300.c82
-rw-r--r--sys/arch/alpha/tc/tc_3000_500.c43
-rw-r--r--sys/arch/alpha/tc/tc_bus_io.c318
-rw-r--r--sys/arch/alpha/tc/tc_bus_mem.c313
-rw-r--r--sys/arch/alpha/tc/tc_machdep.h (renamed from sys/arch/alpha/include/tc_machdep.h)0
-rw-r--r--sys/arch/alpha/tc/tcasic.c58
-rw-r--r--sys/arch/alpha/tc/tcds.c41
-rw-r--r--sys/arch/alpha/tc/tcdsvar.h18
-rw-r--r--sys/arch/alpha/wscons/ascii.h10
-rw-r--r--sys/arch/alpha/wscons/event.c172
-rw-r--r--sys/arch/alpha/wscons/event_var.h87
-rw-r--r--sys/arch/alpha/wscons/kbd.c334
-rw-r--r--sys/arch/alpha/wscons/ms.c285
-rw-r--r--sys/arch/alpha/wscons/wscons.c495
-rw-r--r--sys/arch/alpha/wscons/wscons_emul.c416
-rw-r--r--sys/arch/alpha/wscons/wscons_emul.h50
-rw-r--r--sys/arch/alpha/wscons/wscons_raster.h93
-rw-r--r--sys/arch/alpha/wscons/wscons_rfont.h1010
-rw-r--r--sys/arch/alpha/wscons/wscons_rinit.c134
-rw-r--r--sys/arch/alpha/wscons/wscons_rops.c217
-rw-r--r--sys/arch/alpha/wscons/wsconsvar.h111
-rw-r--r--sys/dev/wscons/ascii.h10
-rw-r--r--sys/dev/wscons/event.c172
-rw-r--r--sys/dev/wscons/event_var.h87
-rw-r--r--sys/dev/wscons/kbd.c334
-rw-r--r--sys/dev/wscons/ms.c285
-rw-r--r--sys/dev/wscons/wscons.c495
-rw-r--r--sys/dev/wscons/wscons_emul.c416
-rw-r--r--sys/dev/wscons/wscons_emul.h50
-rw-r--r--sys/dev/wscons/wscons_raster.h93
-rw-r--r--sys/dev/wscons/wscons_rfont.h1010
-rw-r--r--sys/dev/wscons/wscons_rinit.c134
-rw-r--r--sys/dev/wscons/wscons_rops.c217
-rw-r--r--sys/dev/wscons/wsconsvar.h111
172 files changed, 16585 insertions, 5194 deletions
diff --git a/sys/arch/alpha/README b/sys/arch/alpha/README
index 0ee83f2b924..52ed304ea99 100644
--- a/sys/arch/alpha/README
+++ b/sys/arch/alpha/README
@@ -1,79 +1,75 @@
-$NetBSD: README,v 1.7 1995/11/23 02:33:17 cgd Exp $
+$NetBSD: README,v 1.8.4.1 1996/06/13 20:49:01 cgd Exp $
Obtaining NetBSD/Alpha sources and binaries:
- NetBSD/Alpha sources and binaries are available from:
+ NetBSD/Alpha's sources, with the exceptions of the GNU
+ toolchain and X11 code, are integrated into NetBSD-current,
+ and are available from:
+ ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-current/
+
+ The latest NetBSD/Alpha binary snapshot, and source snapshots
+ for the toolchain and X11 code, can be found at:
ftp://ftp.netbsd.org/pub/NetBSD/arch/alpha
- See the README.files file there to figure out which of
- the following items corresponds to what file(s) in the FTP
- archive.
- There are two sets of system binaries available:
+ Binary snapshots include two different set of system binaries:
(1) an rz25 disk image, for first-time installation
- (see below), and
- (2) two tar files of the binaries, for updates.
+ (see below for instructions), and
+ (2) three tar files of the binaries, for updates.
(one of the tar files is the contents of /etc,
- one is everything else, except a kernel.
+ one contains X11 binaries, and the last is everything
+ else, except the kernel and the installed boot block.)
There are no instructions on how to use these.
Good luck! 8-)
- There are also two precompiled kernels available: one generic
- kernel which will prompt for a root device, and one which tries
- to boot diskless. The generic kernel is included in the rz25
- disk image.
-
- X11 client binaries are packaged seperately. (There is no
- server at this time.)
+ Binary snapshots include a kernel image which is the same
+ as the one on the rz25 disk image.
- There are several sets of sources available:
- (1) kernel source snapshot (complete kernel sources),
- (2) compiler toolchain source snapshot (complete
- toolchain sources),
- (3) diffs to the NetBSD-current sources as of the date
- of the release to make them match what's used on
- the alpha port. (You should be able to get the
- NetBSD-current sources, replace the kernel sources
- with the ones i'm distributing, add in these
- diffs and the toolchain sources, and compile up a
- complete system.)
- (4) diffs to the XFree86 3.1.2 sources to make them
- work with NetBSD/Alpha. (If you add these to
- the XFree86 3.1.2 sources, you should be able to
- compile up the X clients.)
+ The sources provided seperately from the normal NetBSD-current
+ distribution are:
+ (1) complete compiler toolchain sources
+ (2) diffs against the XFree86 3.1.2 distribution to
+ make X work with NetBSD/Alpha. (Note that
+ at this time, the diffs are against 3.1.2,
+ i.e. not against 3.1.2D, etc.)
- If you are interested in the NetBSD/Alpha port, I suggest that you
- subscribe to the NetBSD "port-alpha" mailing list by sending an
- email message to majordomo@netbsd.org with no subject and with a
- body of "subscribe port-alpha" (without the quotes). For help on
- using majordomo, send it mail with an empty subject and body.
+ If you are using or are interested in the NetBSD/Alpha port, I
+ suggest that you subscribe to the NetBSD "port-alpha" mailing list
+ by sending an email message to majordomo@netbsd.org with no
+ subject and with a body of "subscribe port-alpha" (without the
+ quotes). For help on using majordomo, send it mail with an empty
+ subject and body. In general, questions about NetBSD/Alpha
+ are best asked on that mailing list (rather than by sending me
+ mail directly).
Installing the NetBSD/Alpha distribution:
[ Note that these instructions are minimal; it's assumed that if
you're going to be installing this, you're knowledgeable about
- booting Alphas and doing other sysadmin-ish stuff, are willing
- to look in your Alpha documentation, or are brave. If they're
- really not good enough to get you running, get in touch with me
- and I'll try to help you. ]
+ booting Alphas and doing sysadmin-ish stuff, are willing to look
+ in your Alpha documentation, or are brave. If they're really not
+ good enough to get you running, get in touch with me and I'll try
+ to help you. ]
To install the NetBSD/Alpha distribution, you'll need a disk at
least the size of an RZ25 -- about 406Mb. Once you've gotten the
- binary distribution from me, gunzip it and dd it to the raw disk.
- The binary distribution includes a disklabel and boot block, so you
- don't need to do anything special to make it bootable. I created
- the binary distribution's file systems with an older version (4.3
- Reno) of the Berkeley Fast File System format, so that you can
- mount, read, and write them under OSF/1.
-
- Once you've dd'd the image to the disk, set your system to use a
- serial console. Boot the Alpha with the NetBSD disk, supplying the
- boot flag "-s". It should print something about "NetBSD/Alpha Boot
- program", load the kernel, print a copyright, and print various
- startup messages. Included among those startup messages will be
- SCSI bus/id to device name mappings for all of the SCSI devices
- that NetBSD recognizes. Eventually, it'll ask you for the name of
- the root device. It expects something like "sd0", "sd1", etc., and
- you should pick the name that corresponds to the NetBSD disk.
+ binary distribution, gunzip it and dd it to the raw disk. The binary
+ distribution includes a disklabel and boot block, so you don't need
+ to do anything special to make it bootable. The binary distribution's
+ file systems are created with an older version ("Level 1") of the
+ Berkeley Fast File System format, so that you can mount, read, and
+ write them under Digital UNIX.
+
+ If your are using one of the supported systems that includes a
+ PCI bus, and have either a PCI VGA frame buffer of any type or
+ a ZLXp-E1 frame buffer, you may use it as console. (If you
+ are using your frame buffer as the console, you should use the
+ terminal type 'sun'.) Otherwise (if you are using a TurboChannel
+ Alpha or have a different kind of frame buffer, you have to use
+ a serial console.)
+
+ Boot the Alpha with the NetBSD disk, supplying the boot flag "-s".
+ It should print something like "NetBSD/Alpha Boot program", load
+ the kernel, print a copyright, and print various startup messages.
After a short while, you should be asked for the name of a shell
to use; just hit return. You're advised to fsck the disk at this
@@ -81,54 +77,42 @@ Installing the NetBSD/Alpha distribution:
is partition 'd'), remount the root partition read-write (use mount
-u root-dev /), and create some necessary system information files:
/etc/hosts
- /etc/resolv.conf (if you want to use DNS)
- /etc/myname (the hostname of the machine)
- /etc/mygate (the LAN's gateway's IP address, if your network
- setup requires that it be named explicitly)
- /etc/hostname.le0 (on TurboChannel machines, to describe
- the enet addr, etc., for the Alpha's ethernet. The
- format can be discerned by looking in /etc/netstart.
- As an example, for my development machine, it's:
- inet macallan.dssc.cs.cmu.edu 0xffff0000 128.2.255.255
- ^^^^^^^^^^^^^^^hostname ^^^netmask ^^^broadcast)
- /etc/hostname.de0 (on PCI machines; same format as
- hostname.le0 would have.)
- /etc/fstab (a prototype is in /etc/fstab.sd)
+ /etc/resolv.conf
+ DNS resolver configuration information, if you
+ want to use DNS.
+ /etc/myname
+ The hostname of the machine.
+ /etc/mygate
+ The LAN's gateway's IP address, if your network
+ setup requires that a static route to the
+ gateway be created.
+ /etc/hostname.xxy
+ (where "xxy" is your machine's ethernet
+ interface name, e.g. "le0" for TurboChannel
+ machines or "de0" for PCI machines.)
+ The IP address, etc., for the named network
+ interface. (You can have multiple of these
+ files, for example, if the machine is
+ multi-homed.) The format can be discerned by
+ looking in /etc/netstart, and is typically
+ something like:
+ inet hostname.in.etc.hosts net.mask broadcast.addr
+ where the netmask is formatted as a hex number
+ (e.g. 0xffffff00), and the broadcast address
+ is formatted as an IP address (e.g. 128.2.255.255)
+ /etc/fstab
+ The file system information table for the system.
+ A prototype is in /etc/fstab.sd.
(You can also create the files mentioned above by mounting the
- disk's file systems under OSF/1 and filling in the appropriate
- information.)
+ disk's file systems under Digital UNIX.)
Once those files are created, you should be able to boot the system
multi-user. To do so, halt the system and boot again from the
- NetBSD disk, this time supplying the boot flags "-a".
-
- Once the system has booted, you should be able to log in over the
- network. (Log in as root, at first, then use vipw to create user
- account(s) and re-log in as the appropriate user.) If you used a
- disk other than an RZ25, you may also want to edit the disk's
- disklabel, and create one or more partitions to use the extra space.
-
-Using NetBSD/Alpha:
- You'll probably want to NFS mount the sources from another machine;
- that's what I do, and it works just fine. If you'd like tips on
- good ways to keep the NetBSD sources under source control, just ask.
-
- A fair number of binaries don't work properly. For example, GDB
- won't properly run programs or debug core files; someone needs
- to write support for NetBSD/Alpha.
-
- As noted above, the SCSI code on TurboChannel machines is reliable
- only when being used with one SCSI bus at a time; this is obviously
- a bug. Additionally, the SCSI driver seems unhappy about dealing
- with certain types of disk drives (e.g. the IBM Lightning).
-
- Because I've been working on getting the system up and running, then
- out the door, I've not had much time to do performance analysis on
- the kernel, nor tried to improve performance in any way. Some of
- the code is awfully rough. That being said, on a lot of operations
- I'm seeing performance comparable to that of OSF/1 on the same
- hardware, so I've not gone too far wrong anywhere.
+ NetBSD disk, this time supplying the boot flag "-a".
+ If you used a disk other than an RZ25, you may want to edit the
+ disk's disklabel, and create one or more partitions after the
+ existing partitions to use the extra space.
Chris Demetriou
diff --git a/sys/arch/alpha/STATUS b/sys/arch/alpha/STATUS
index 6f9d08c679b..587e159f5d8 100644
--- a/sys/arch/alpha/STATUS
+++ b/sys/arch/alpha/STATUS
@@ -1,7 +1,10 @@
-$NetBSD: STATUS,v 1.2 1995/11/23 02:33:26 cgd Exp $
+$NetBSD: STATUS,v 1.3.4.1 1996/06/13 20:49:04 cgd Exp $
NetBSD/Alpha's Status
+If you find an inaccuracy in this file, can clarify it in any place,
+etc., please send mail to me (cgd@cs.cmu.edu).
+
Supported hardware:
@@ -9,54 +12,66 @@ Supported hardware:
600, but the rest should "just work) using the following
peripherals:
- Built-in serial ports
- LANCE ethernet -- only the on-board interface. (see below.)
- SCSI system -- it recognizes and can use both on-board SCSI
- controller chips. However, it has trouble working with
- both at the same time.
+ Supported hardware:
+ Built-in serial ports
+ Built-in LANCE ethernet.
+ Built-in SCSI chips (53c[f]94), though both
+ may not work at the same time.
+
+ Things that may work but haven't been tested:
+ TurboChannel option slot LANCE (PMAD-A)
Things are aren't supported:
No frame buffers of any type.
- Devices in TurboChannel option slots (see the
+ Other TurboChannel option boards (see the
TODO.users file.)
The ISDN/Audio chip.
DEC 3000/300 family, with same hardware above.
- *** NOTE THAT I HAVE NOT TESTED NEW KERNELS THOROUGHLY ON
- DEC 3000/[3-900] SYSTEMS!
-
- AlphaStation {200,250,400} systems using the following
+ AlphaStation {200,250,255,400} systems using the following
peripherals:
- On-board NRC 53c810 SCSI.
- On-board ns16550-based serial ports.
- DC21040-based ethernet (on-board or in an option
- slot).
- DC21050-based PCI-PCI bridges (though other
- types of PCI-PCI bridges should work).
- PCI VGA video boards.
- DEC ZLXp-E1 (DC21030-based, "TGA") video boards.
- Keyboard.
+ Supported hardware:
+ NCR 53c810 SCSI (built-in or PCI board).
+ Built-in ns16550 serial ports.
+ DC21040-based ethernet (built-in or PCI board).
+ DC21140-based PCI ethernet boards.
+ DC21050-based PCI-PCI bridges (though other
+ types of PCI-PCI bridges should work).
+ PCI VGA video boards.
+ DEC ZLXp-E1 (DC21030-based, "TGA") video boards.
+ Keyboard.
+ PS/2-style mice.
+
+ Things that may work but haven't been tested:
+ Built-in parallel ports.
+ ISA ns16x50-family serial port boards.
+ ISA ns16x50 multi-port serial boards.
+ Other NCR 53c8xx SCSI boards.
Things that ARE NOT supported at this time:
- DEC ZLXp-E2 and ZLXp-E3 video boards.
- Mouse.
- Sound hardware (Windows Sound System).
+ ISA VGA boards.
+ Sound hardware (including Windows Sound System
+ built-in on some machines).
+ DEC ZLXp-E2 and ZLXp-E3 PCI video boards.
+ Other PCI boards.
AlphaStation 600 systems, with the same supported hardware
- list as the AlphaStation {200,250,400} systems. (NOTE THAT
- THAT MEANS THE AlphaStation 600's BUILT-IN SCSI CONTROLLERS
- DO NOT WORK. You'll need to get a 53c810 board, or
- something.)
+ list as the AlphaStation {200,250,255,400} systems. (NOTE
+ THAT THAT MEANS THE AlphaStation 600's BUILT-IN SCSI
+ CONTROLLERS DO NOT WORK. You'll need to get a 53c810 board,
+ or run diskless.) AlphaStation 500 systems may work, but
+ have not been tested.
- AXPpci systems, with the same supported hardware list as
- the AlphaStation {200,250,400} systems. (AXPpci support
- was written by Jeffrey Hsu. Thanks, Jeff!)
+ AXPpci systems (including Multia), with the same supported
+ hardware list as the AlphaStation {200,250,255,400} systems.
At this time none of the following systems are supported:
- DECpc AXP systems (EISA-bus PC-like systems)
- Alpha "server" systems
+ DECpc AXP 150 systems (EISA-bus PC-like systems)
+ Alpha "server" systems (other than perhaps the
+ AlphaServer 400, which might be an AlphaStation 400
+ in disguise).
Multiprocessor Alpha systems
I was hoping to get a DECpc AXP port working "for free" based on
@@ -66,28 +81,30 @@ NetBSD/Alpha run on the DECpc AXP system, get in touch and I'll do
what I can to help you get started.
-Console frame buffers & keyboard are supported only on the AlphaStation
-and AXPpci families of machines. On the TurboChannel-baesd machines,
-NetBSD/Alpha _must_ be used with a serial console. To configure various
-Alpha systems to use a serial console, do the following depending on
-the model:
+Console frame buffers & keyboard are supported only with the frame
+buffers and keyboards mentioned as supported above. On other systems
+(including all TurboChannel-based machines), NetBSD/Alpha _must_ be used
+with a serial console. To configure various Alpha systems to use a serial
+console, do the following depending on the model:
DEC 3000/[4-9]00's:
Flip the appropriate switch on the back of the machine.
- (See your owner's manual for more details.)
DEC 3000/300 family machines:
Boot the machine with the keyboard/mouse connector
unplugged.
- DECpc AXPs, AXPpcis, and AlphaStations:
+ DECpc AXPs, AlphaStations, and AXPpci systems:
Get to the console prompt. Set the variable
"console" to be "serial", and "init" or power cycle
the system.
+See your owner's manual for more details on how to set your machine
+to use a serial console.
+
See the file src/sys/arch/alpha/README to find out how to get the
-latest sources and/or binaries.
+latest sources and binaries.
Please see the file src/sys/arch/alpha/TODO.users for a list of things
that users can do to help NetBSD/Alpha improve. If you're interested
@@ -96,4 +113,4 @@ I'll do what I can to help.
Chris Demetriou
-cgd@netbsd.org
+cgd@cs.cmu.edu
diff --git a/sys/arch/alpha/TODO.users b/sys/arch/alpha/TODO.users
index 410c973a7f1..c3d5f39ccfb 100644
--- a/sys/arch/alpha/TODO.users
+++ b/sys/arch/alpha/TODO.users
@@ -1,14 +1,14 @@
-$NetBSD: TODO.users,v 1.2 1995/11/23 02:33:29 cgd Exp $
+$NetBSD: TODO.users,v 1.3.4.1 1996/06/13 20:49:07 cgd Exp $
The NetBSD/Alpha "User" To-Do List
-The following are things that I'd like to see "users" of NetBSD/Alpha do.
-It's unlikely that I'll get around to them in any reasonable time
-frame, and I think they _should_ get done.
+The following are things that I'd like to see "users" of NetBSD/Alpha
+do. It's unlikely that I'll get around to them in any reasonable time
+frame, and I think they should get done.
-If you think of something that should be added to this list (and don't
-want to do it yourself, right then 8-), send me mail and I'll add it.
+If you think of something that should be added to this list send me
+mail and I'll add it.
If you're planning to work on something on this list, send me mail and
tell me about it, so that I can keep people from duplicating work.
@@ -16,35 +16,23 @@ Once you've done something on this list, send me context diffs.
Chris Demetriou
-cgd@netbsd.org
+cgd@cs.cmu.edu
--
-Make GDB work.
- (1) function arguments and local variables don't seem to work.
-
Test programs; find and fix bugs. In particular:
(1) make sure accounting works
- (2) figure out why strip doesn't seem to work
- (3) last i checked, 'file' core dumped
- (4) /usr/games
-
-Make TurboChannel option slots work reasonably. This will require
- different sets of code to be written on the 3000/[4-9]00 and on the
- 3000/300 families. It shouldn't be too hard, but you will need some
- devices that live in option slots.
+ (2) last i checked, 'file' core dumped
+ (3) /usr/games
-Once TC option slots work, somebody with a TC ethernet board should
- make it work, for completeness.
+Test TurboChannel option slot support. Write TurboChannel option
+board drivers. Test PMAD-A (TC le) driver.
Get the GNU tools to generate a.out binaries for the alpha. Once that
- is done:
- (1) make gprof work, then profile the kernel and tell me how
- bad my assumptions lost.
- (2) make the rest of the NetBSD a.out-manipulation tools (e.g.
- nm) work.
+is done, make the rest of the NetBSD a.out-manipulation tools (e.g. nm)
+work.
Make DDB work. (For completeness, may require a.out kernel binaries
- and/or some ecoff symbol handling code to be written; the former
- is strongly preferred.)
+and/or some ecoff symbol handling code to be written; the former is
+strongly preferred.)
-Track down bugs caused by compiling the kernel with -O. (At least
- some of these are likely to be code generation bugs.)
+Track down any bugs caused by compiling the kernel with -O. (At least
+some of these may be code generation bugs.)
diff --git a/sys/arch/alpha/alpha/autoconf.c b/sys/arch/alpha/alpha/autoconf.c
index c7e77b828fe..e81471449f2 100644
--- a/sys/arch/alpha/alpha/autoconf.c
+++ b/sys/arch/alpha/alpha/autoconf.c
@@ -1,30 +1,47 @@
-/* $NetBSD: autoconf.c,v 1.1 1995/02/13 23:06:49 cgd Exp $ */
+/* $NetBSD: autoconf.c,v 1.3.4.3 1996/06/14 20:42:41 cgd Exp $ */
/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
- * All rights reserved.
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
*
- * Authors: Keith Bostic, Chris G. Demetriou
- *
- * Permission to use, copy, modify and distribute this software and
- * its documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
*
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
+ * All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Lawrence Berkeley Laboratory.
*
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)autoconf.c 8.4 (Berkeley) 10/1/93
*/
#include <sys/param.h>
@@ -36,6 +53,24 @@
#include <sys/device.h>
#include <machine/autoconf.h>
+#include <machine/prom.h>
+
+extern char root_device[17]; /* XXX */
+
+struct device *booted_device;
+int booted_partition;
+struct bootdev_data *bootdev_data;
+char boot_dev[128];
+
+void parse_prom_bootdev __P((void));
+int atoi __P((char *));
+
+struct device *parsedisk __P((char *str, int len, int defpart, dev_t *devp));
+static struct device *getdisk __P((char *str, int len, int defpart,
+ dev_t *devp));
+static int findblkmajor __P((struct device *dv));
+static char *findblkname __P((int));
+static int getstr __P((char *cp, int size));
/*
* configure:
@@ -46,18 +81,17 @@ configure()
{
extern int cold;
+ parse_prom_bootdev();
+
(void)splhigh();
- if (config_rootfound("mainbus", "mainbus") == 0)
+ if (config_rootfound("mainbus", "mainbus") == NULL)
panic("no mainbus found");
(void)spl0();
-#ifdef GENERIC
- if ((boothowto & RB_ASKNAME) == 0)
- setroot();
- setconf();
-#else
+ if (booted_device == NULL)
+ printf("WARNING: can't figure what device matches \"%s\"\n",
+ boot_dev);
setroot();
-#endif
swapconf();
cold = 0;
}
@@ -67,12 +101,11 @@ configure()
*/
swapconf()
{
- register struct swdevt *swp;
- register int nblks;
+ struct swdevt *swp;
+ int nblks, maj;
for (swp = swdevt; swp->sw_dev != NODEV; swp++) {
- int maj = major(swp->sw_dev);
-
+ maj = major(swp->sw_dev);
if (maj > nblkdev)
break;
if (bdevsw[maj].d_psize) {
@@ -83,62 +116,306 @@ swapconf()
swp->sw_nblks = ctod(dtoc(swp->sw_nblks));
}
}
+ dumpconf();
}
-#define DOSWAP /* change swdevt and dumpdev */
-dev_t bootdev = 0; /* should be dev_t, but not until 32 bits */
-
-static char devname[][2] = {
- 'x','x', /* 0 = XX */
- 'x','x', /* 1 = XX */
- 'x','x', /* 2 = XX */
- 'x','x', /* 3 = XX */
- 'x','x', /* 4 = XX */
- 'x','x', /* 5 = XX */
- 'x','x', /* 6 = XX */
- 'x','x', /* 7 = XX */
- 's','d', /* 8 = sd */
+struct nam2blk {
+ char *name;
+ int maj;
+} nam2blk[] = {
+ { "st", 2 },
+ { "cd", 3 },
+ { "sd", 8 },
+#if 0
+ { "fd", XXX },
+#endif
};
+static int
+findblkmajor(dv)
+ struct device *dv;
+{
+ char *name = dv->dv_xname;
+ register int i;
+
+ for (i = 0; i < sizeof(nam2blk)/sizeof(nam2blk[0]); ++i)
+ if (strncmp(name, nam2blk[i].name, strlen(nam2blk[0].name))
+ == 0)
+ return (nam2blk[i].maj);
+ return (-1);
+}
+
+static char *
+findblkname(maj)
+ int maj;
+{
+ register int i;
+
+ for (i = 0; i < sizeof(nam2blk)/sizeof(nam2blk[0]); ++i)
+ if (maj == nam2blk[i].maj)
+ return (nam2blk[i].name);
+ return (NULL);
+}
+
+static struct device *
+getdisk(str, len, defpart, devp)
+ char *str;
+ int len, defpart;
+ dev_t *devp;
+{
+ register struct device *dv;
+
+ if ((dv = parsedisk(str, len, defpart, devp)) == NULL) {
+ printf("use one of:");
+ for (dv = alldevs.tqh_first; dv != NULL;
+ dv = dv->dv_list.tqe_next) {
+ if (dv->dv_class == DV_DISK)
+ printf(" %s[a-h]", dv->dv_xname);
+#ifdef NFSCLIENT
+ if (dv->dv_class == DV_IFNET)
+ printf(" %s", dv->dv_xname);
+#endif
+ }
+ printf("\n");
+ }
+ return (dv);
+}
+
+struct device *
+parsedisk(str, len, defpart, devp)
+ char *str;
+ int len, defpart;
+ dev_t *devp;
+{
+ register struct device *dv;
+ register char *cp, c;
+ int majdev, part;
+
+ if (len == 0)
+ return (NULL);
+ cp = str + len - 1;
+ c = *cp;
+ if (c >= 'a' && c <= ('a' + MAXPARTITIONS - 1)) {
+ part = c - 'a';
+ *cp = '\0';
+ } else
+ part = defpart;
+
+ for (dv = alldevs.tqh_first; dv != NULL; dv = dv->dv_list.tqe_next) {
+ if (dv->dv_class == DV_DISK &&
+ strcmp(str, dv->dv_xname) == 0) {
+ majdev = findblkmajor(dv);
+ if (majdev < 0)
+ panic("parsedisk");
+ *devp = MAKEDISKDEV(majdev, dv->dv_unit, part);
+ break;
+ }
+#ifdef NFSCLIENT
+ if (dv->dv_class == DV_IFNET &&
+ strcmp(str, dv->dv_xname) == 0) {
+ *devp = NODEV;
+ break;
+ }
+#endif
+ }
+
+ *cp = c;
+ return (dv);
+}
+
/*
* Attempt to find the device from which we were booted.
* If we can do so, and not instructed not to do so,
* change rootdev to correspond to the load device.
+ *
+ * XXX Actually, swap and root must be on the same type of device,
+ * (ie. DV_DISK or DV_IFNET) because of how (*mountroot) is written.
+ * That should be fixed.
*/
setroot()
{
- int majdev, mindev, unit, part, adaptor;
- dev_t temp, orootdev;
struct swdevt *swp;
+ struct device *dv;
+ register int len;
+ dev_t nrootdev, nswapdev = NODEV;
+ char buf[128], *rootdevname;
+ extern int (*mountroot) __P((void *));
+ dev_t temp;
+ struct device *bootdv, *rootdv, *swapdv;
+ int bootpartition;
+#if defined(NFSCLIENT)
+ extern char *nfsbootdevname;
+ extern int nfs_mountroot __P((void *));
+#endif
+#if defined(FFS)
+ extern int ffs_mountroot __P((void *));
+#endif
+
+ bootdv = booted_device;
+ bootpartition = booted_partition;
-/*printf("howto %x bootdev %x ", boothowto, bootdev);*/
- if (boothowto & RB_DFLTROOT ||
- (bootdev & B_MAGICMASK) != (u_long)B_DEVMAGIC)
- return;
- majdev = (bootdev >> B_TYPESHIFT) & B_TYPEMASK;
- if (majdev > sizeof(devname) / sizeof(devname[0]))
- return;
- adaptor = (bootdev >> B_ADAPTORSHIFT) & B_ADAPTORMASK;
- part = (bootdev >> B_PARTITIONSHIFT) & B_PARTITIONMASK;
- unit = (bootdev >> B_UNITSHIFT) & B_UNITMASK;
- mindev = (unit * MAXPARTITIONS) + part;
- orootdev = rootdev;
- rootdev = makedev(majdev, mindev);
/*
- * If the original rootdev is the same as the one
- * just calculated, don't need to adjust the swap configuration.
+ * If 'swap generic' and we couldn't determine root device,
+ * ask the user.
*/
- if (rootdev == orootdev)
+ if (mountroot == NULL && bootdv == NULL)
+ boothowto |= RB_ASKNAME;
+
+ if (boothowto & RB_ASKNAME) {
+ for (;;) {
+ printf("root device");
+ if (bootdv != NULL)
+ printf(" (default %s%c)",
+ bootdv->dv_xname,
+ bootdv->dv_class == DV_DISK
+ ? bootpartition + 'a' : ' ');
+ printf(": ");
+ len = getstr(buf, sizeof(buf));
+ if (len == 0 && bootdv != NULL) {
+ strcpy(buf, bootdv->dv_xname);
+ len = strlen(buf);
+ }
+ if (len == 4 && !strcmp(buf, "halt"))
+ boot(RB_HALT);
+ if (len > 0 && buf[len - 1] == '*') {
+ buf[--len] = '\0';
+ dv = getdisk(buf, len, 1, &nrootdev);
+ if (dv != NULL) {
+ rootdv = dv;
+ nswapdev = nrootdev;
+ goto gotswap;
+ }
+ }
+ dv = getdisk(buf, len, bootpartition, &nrootdev);
+ if (dv != NULL) {
+ rootdv = dv;
+ break;
+ }
+ }
+
+ /*
+ * because swap must be on same device type as root, for
+ * network devices this is easy.
+ */
+ if (rootdv->dv_class == DV_IFNET) {
+ swapdv = NULL;
+ goto gotswap;
+ }
+ for (;;) {
+ printf("swap device");
+ printf(" (default %s%c)", rootdv->dv_xname,
+ rootdv->dv_class == DV_DISK?'b':' ');
+ printf(": ");
+ len = getstr(buf, sizeof(buf));
+ if (len == 0) {
+ switch (rootdv->dv_class) {
+ case DV_IFNET:
+ nswapdev = NODEV;
+ break;
+ case DV_DISK:
+ nswapdev = MAKEDISKDEV(major(nrootdev),
+ DISKUNIT(nrootdev), 1);
+ break;
+ case DV_TAPE:
+ case DV_TTY:
+ case DV_DULL:
+ case DV_CPU:
+ break;
+ }
+ swapdv = rootdv;
+ break;
+ }
+ if (len == 4 && !strcmp(buf, "halt"))
+ boot(RB_HALT);
+ dv = getdisk(buf, len, 1, &nswapdev);
+ if (dv) {
+ if (dv->dv_class == DV_IFNET)
+ nswapdev = NODEV;
+ swapdv = dv;
+ break;
+ }
+ }
+gotswap:
+ rootdev = nrootdev;
+ dumpdev = nswapdev;
+ swdevt[0].sw_dev = nswapdev;
+ swdevt[1].sw_dev = NODEV;
+ } else if (mountroot == NULL) {
+ int majdev;
+
+ /*
+ * "swap generic"
+ */
+ majdev = findblkmajor(bootdv);
+ if (majdev >= 0) {
+ /*
+ * Root and swap are on a disk.
+ */
+ rootdv = swapdv = bootdv;
+ rootdev = MAKEDISKDEV(majdev, bootdv->dv_unit,
+ bootpartition);
+ nswapdev = dumpdev =
+ MAKEDISKDEV(majdev, bootdv->dv_unit, 1);
+ } else {
+ /*
+ * Root and swap are on a net.
+ */
+ rootdv = swapdv = bootdv;
+ nswapdev = dumpdev = NODEV;
+ }
+ swdevt[0].sw_dev = nswapdev;
+ swdevt[1].sw_dev = NODEV;
+ } else {
+ /*
+ * `root DEV swap DEV': honour rootdev/swdevt.
+ * rootdev/swdevt/mountroot already properly set.
+ */
+
+ rootdevname = findblkname(major(rootdev));
+ if (rootdevname == NULL) {
+ /* Root on NFS or unknown device. */
+ strcpy(root_device, "??");
+ } else {
+ /* Root on known block device. */
+ sprintf(root_device, "%s%d%c", rootdevname,
+ DISKUNIT(rootdev), DISKPART(rootdev) + 'a');
+ }
+
return;
- printf("changing root device to %c%c%d%c\n",
- devname[majdev][0], devname[majdev][1],
- unit, part + 'a');
+ }
-#ifdef DOSWAP
+ switch (rootdv->dv_class) {
+#if defined(NFSCLIENT)
+ case DV_IFNET:
+ strcpy(root_device, "??");
+ mountroot = nfs_mountroot;
+ nfsbootdevname = rootdv->dv_xname;
+ return;
+#endif
+#if defined(FFS)
+ case DV_DISK:
+ mountroot = ffs_mountroot;
+ sprintf(root_device, "%s%c", rootdv->dv_xname,
+ DISKPART(rootdev) + 'a');
+ printf("root on %s", root_device);
+ if (nswapdev != NODEV)
+ printf(" swap on %s%c", swapdv->dv_xname,
+ DISKPART(nswapdev) + 'a');
+ printf("\n");
+ break;
+#endif
+ default:
+ printf("can't figure root, hope your kernel is right\n");
+ return;
+ }
+
+ /*
+ * Make the swap partition on the root drive the primary swap.
+ */
+ temp = NODEV;
for (swp = swdevt; swp->sw_dev != NODEV; swp++) {
- if (majdev == major(swp->sw_dev) &&
- (mindev / MAXPARTITIONS)
- == (minor(swp->sw_dev) / MAXPARTITIONS)) {
+ if (major(rootdev) == major(swp->sw_dev) &&
+ DISKUNIT(rootdev) == DISKUNIT(swp->sw_dev)) {
temp = swdevt[0].sw_dev;
swdevt[0].sw_dev = swp->sw_dev;
swp->sw_dev = temp;
@@ -154,5 +431,154 @@ setroot()
*/
if (temp == dumpdev)
dumpdev = swdevt[0].sw_dev;
+}
+
+static int
+getstr(cp, size)
+ register char *cp;
+ register int size;
+{
+ register char *lp;
+ register int c;
+ register int len;
+
+ lp = cp;
+ len = 0;
+ for (;;) {
+ c = cngetc();
+ switch (c) {
+ case '\n':
+ case '\r':
+ printf("\n");
+ *lp++ = '\0';
+ return (len);
+ case '\b':
+ case '\177':
+ case '#':
+ if (len) {
+ --len;
+ --lp;
+ printf("\b \b");
+ }
+ continue;
+ case '@':
+ case 'u'&037:
+ len = 0;
+ lp = cp;
+ printf("\n");
+ continue;
+ default:
+ if (len + 1 >= size || c < ' ') {
+ printf("\007");
+ continue;
+ }
+ printf("%c", c);
+ ++len;
+ *lp++ = c;
+ }
+ }
+}
+
+void
+parse_prom_bootdev()
+{
+ static char hacked_boot_dev[128];
+ static struct bootdev_data bd;
+ char *cp, *scp, *boot_fields[8];
+ int i, done;
+
+ booted_device = NULL;
+ booted_partition = 0;
+ bootdev_data = NULL;
+
+ prom_getenv(PROM_E_BOOTED_DEV, boot_dev, sizeof(boot_dev));
+ bcopy(boot_dev, hacked_boot_dev, sizeof hacked_boot_dev);
+#if 0
+ printf("parse_prom_bootdev: boot dev = \"%s\"\n", boot_dev);
#endif
+
+ i = 0;
+ scp = cp = hacked_boot_dev;
+ for (done = 0; !done; cp++) {
+ if (*cp != ' ' && *cp != '\0')
+ continue;
+ if (*cp == '\0')
+ done = 1;
+
+ *cp = '\0';
+ boot_fields[i++] = scp;
+ scp = cp + 1;
+ if (i == 8)
+ done = 1;
+ }
+ if (i != 8)
+ return; /* doesn't look like anything we know! */
+
+#if 0
+ printf("i = %d, done = %d\n", i, done);
+ for (i--; i >= 0; i--)
+ printf("%d = %s\n", i, boot_fields[i]);
+#endif
+
+ bd.protocol = boot_fields[0];
+ bd.bus = atoi(boot_fields[1]);
+ bd.slot = atoi(boot_fields[2]);
+ bd.channel = atoi(boot_fields[3]);
+ bd.remote_address = boot_fields[4];
+ bd.unit = atoi(boot_fields[5]);
+ bd.boot_dev_type = atoi(boot_fields[6]);
+ bd.ctrl_dev_type = boot_fields[7];
+
+#if 0
+ printf("parsed: proto = %s, bus = %d, slot = %d, channel = %d,\n",
+ bd.protocol, bd.bus, bd.slot, bd.channel);
+ printf("\tremote = %s, unit = %d, dev_type = %d, ctrl_type = %s\n",
+ bd.remote_address, bd.unit, bd.boot_dev_type, bd.ctrl_dev_type);
+#endif
+
+ bootdev_data = &bd;
+}
+
+int
+atoi(s)
+ char *s;
+{
+ int n, neg;
+ char c;
+
+ n = 0;
+ neg = 0;
+
+ while (*s == '-') {
+ s++;
+ neg = !neg;
+ }
+
+ while (*s != '\0') {
+ if (*s < '0' && *s > '9')
+ break;
+
+ n = (10 * n) + (*s - '0');
+ s++;
+ }
+
+ return (neg ? -n : n);
+}
+
+void
+device_register(dev, aux)
+ struct device *dev;
+ void *aux;
+{
+ extern void (*cpu_device_register) __P((struct device *dev, void *aux));
+
+ if (bootdev_data == NULL) {
+ /*
+ * There is no hope.
+ */
+
+ return;
+ }
+
+ (*cpu_device_register)(dev, aux);
}
diff --git a/sys/arch/alpha/alpha/clock.c b/sys/arch/alpha/alpha/clock.c
index ec01cf72089..9fb7678429a 100644
--- a/sys/arch/alpha/alpha/clock.c
+++ b/sys/arch/alpha/alpha/clock.c
@@ -1,4 +1,4 @@
-/* $NetBSD: clock.c,v 1.6 1995/12/20 00:38:53 cgd Exp $ */
+/* $NetBSD: clock.c,v 1.10 1996/04/23 15:26:06 cgd Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -51,32 +51,6 @@
#include <alpha/alpha/clockvar.h>
-#include "ioasic.h"
-#if NIOASIC
-#include <dev/tc/tcreg.h>
-#include <dev/tc/tcvar.h>
-#include <dev/tc/ioasicvar.h> /* XXX */
-#endif
-
-#include "isa.h"
-#if NISA
-#include <dev/isa/isavar.h> /* XXX */
-#endif
-
-/* Definition of the driver for autoconfig. */
-static int clockmatch __P((struct device *, void *, void *));
-static void clockattach __P((struct device *, struct device *, void *));
-struct cfdriver clockcd =
- { NULL, "clock", clockmatch, clockattach, DV_DULL,
- sizeof(struct clock_softc) };
-
-#if defined(DEC_3000_500) || defined(DEC_3000_300) || \
- defined(DEC_2000_300) || defined(DEC_2100_A50) || \
- defined(DEC_KN20AA)
-void mcclock_attach __P((struct device *parent,
- struct device *self, void *aux));
-#endif
-
#define SECMIN ((unsigned)60) /* seconds per minute */
#define SECHOUR ((unsigned)(60*SECMIN)) /* seconds per hour */
#define SECDAY ((unsigned)(24*SECHOUR)) /* seconds per day */
@@ -84,64 +58,29 @@ void mcclock_attach __P((struct device *parent,
#define LEAPYEAR(year) (((year) % 4) == 0)
-static int
-clockmatch(parent, cfdata, aux)
- struct device *parent;
- void *cfdata;
- void *aux;
-{
- struct cfdata *cf = cfdata;
- struct confargs *ca = aux;
-
-#if NIOASIC
- if (parent->dv_cfdata->cf_driver == &ioasiccd) {
- struct ioasicdev_attach_args *d = aux;
+struct device *clockdev;
+const struct clockfns *clockfns;
+int clockinitted;
- if (strncmp("TOY_RTC ", d->iada_modname, TC_ROM_LLEN))
- return (0);
- } else
-#endif
-#if NISA
- if ((parent->dv_cfdata->cf_driver == &isacd)) {
- struct isadev_attach_args *ida = aux;
-
- /* XXX XXX XXX */
- if (ida->ida_port[0] != 0x70 && ida->ida_port[0] != -1)
- return (0);
-
- ida->ida_port[0] = 0x70; /* XXX */
- ida->ida_nports[0] = 2; /* XXX */
- ida->ida_iosiz[0] = 0;
- } else
-#endif
- return (0);
-
- return (1);
-}
-
-static void
-clockattach(parent, self, aux)
- struct device *parent;
- struct device *self;
- void *aux;
+void
+clockattach(dev, fns)
+ struct device *dev;
+ const struct clockfns *fns;
{
/*
- * XXX deal with other clock type, if the system
- * XXX supports the other clock. get systype
- * from RPB.
- */
- mcclock_attach(parent, self, aux);
-
- /*
* establish the clock interrupt; it's a special case
*/
set_clockintr();
#ifdef EVCNT_COUNTERS
evcnt_attach(self, "intr", &clock_intr_evcnt);
#endif
-
printf("\n");
+
+ if (clockfns != NULL)
+ panic("clockattach: multiple clocks");
+ clockdev = dev;
+ clockfns = fns;
}
/*
@@ -161,14 +100,14 @@ clockattach(parent, self, aux)
* Start the real-time and statistics clocks. Leave stathz 0 since there
* are no other timers available.
*/
+void
cpu_initclocks()
{
extern int tickadj;
struct clock_softc *csc;
int fractick;
- if (clockcd.cd_devs == NULL ||
- (csc = (struct clock_softc *)clockcd.cd_devs[0]) == NULL)
+ if (clockfns == NULL)
panic("cpu_initclocks: no clock attached");
hz = 1024; /* 1024 Hz clock */
@@ -185,7 +124,7 @@ cpu_initclocks()
/*
* Get the clock started.
*/
- (*csc->sc_init)(csc);
+ (*clockfns->cf_init)(clockdev);
}
/*
@@ -218,7 +157,6 @@ void
inittodr(base)
time_t base;
{
- struct clock_softc *csc = (struct clock_softc *)clockcd.cd_devs[0];
register int days, yr;
struct clocktime ct;
long deltat;
@@ -232,9 +170,8 @@ inittodr(base)
} else
badbase = 0;
- (*csc->sc_get)(csc, base, &ct);
-
- csc->sc_initted = 1;
+ (*clockfns->cf_get)(clockdev, base, &ct);
+ clockinitted = 1;
/* simple sanity checks */
if (ct.year < 70 || ct.mon < 1 || ct.mon > 12 || ct.day < 1 ||
@@ -287,12 +224,11 @@ bad:
void
resettodr()
{
- struct clock_softc *csc = (struct clock_softc *)clockcd.cd_devs[0];
register int t, t2;
struct clocktime ct;
int s;
- if (!csc->sc_initted)
+ if (!clockinitted)
return;
/* compute the day of week. */
@@ -324,17 +260,5 @@ resettodr()
ct.min = t / SECMIN;
ct.sec = t % SECMIN;
- (*csc->sc_set)(csc, &ct);
-}
-
-/*
- * Wait "n" microseconds. This doesn't belong here. XXX.
- */
-delay(n)
- int n;
-{
- register long N = cycles_per_usec * (n);
-
- while (N > 0)
- N -= 3;
+ (*clockfns->cf_set)(clockdev, &ct);
}
diff --git a/sys/arch/alpha/alpha/clock_mc.c b/sys/arch/alpha/alpha/clock_mc.c
deleted file mode 100644
index 04f6792703d..00000000000
--- a/sys/arch/alpha/alpha/clock_mc.c
+++ /dev/null
@@ -1,279 +0,0 @@
-/* $NetBSD: clock_mc.c,v 1.4 1995/12/20 00:38:57 cgd Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department and Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah Hdr: clock.c 1.18 91/01/21
- *
- * @(#)clock.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-#include <sys/kernel.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-#include <machine/pte.h> /* XXX */
-
-#include <alpha/alpha/clockvar.h>
-#include <dev/ic/mc146818reg.h>
-
-#include "ioasic.h"
-#if NIOASIC
-#include <dev/tc/tcreg.h>
-#include <dev/tc/tcvar.h>
-#include <dev/tc/ioasicvar.h>
-#endif
-
-#include "isa.h"
-#if NISA
-#include <dev/isa/isareg.h>
-#include <dev/isa/isavar.h>
-#endif
-
-void mcclock_attach __P((struct device *parent,
- struct device *self, void *aux));
-static void mcclock_init __P((struct clock_softc *csc));
-static void mcclock_get __P((struct clock_softc *csc, time_t base,
- struct clocktime *ct));
-static void mcclock_set __P((struct clock_softc *csc,
- struct clocktime *ct));
-
-struct mcclockdata {
- void (*mc_write) __P((struct clock_softc *csc, u_int reg,
- u_int datum));
- u_int (*mc_read) __P((struct clock_softc *csc, u_int reg));
- __const void *mc_accessfns;
- void *mc_accessarg;
- void *mc_addr;
-};
-
-#define mc146818_write(sc, reg, datum) \
- (*((struct mcclockdata *)sc->sc_data)->mc_write)(sc, reg, datum)
-#define mc146818_read(sc, reg) \
- (*((struct mcclockdata *)sc->sc_data)->mc_read)(sc, reg)
-
-#if NIOASIC
-static void mc_write_tc __P((struct clock_softc *csc, u_int reg,
- u_int datum));
-static u_int mc_read_tc __P((struct clock_softc *csc, u_int reg));
-static struct mcclockdata mcclockdata_tc = { mc_write_tc, mc_read_tc };
-#endif
-
-#if NISA
-static void mc_write_isa __P((struct clock_softc *csc, u_int reg,
- u_int datum));
-static u_int mc_read_isa __P((struct clock_softc *csc, u_int reg));
-static struct mcclockdata mcclockdata_isa = { mc_write_isa, mc_read_isa };
-#endif
-
-void
-mcclock_attach(parent, self, aux)
- struct device *parent;
- struct device *self;
- void *aux;
-{
- struct clock_softc *csc = (struct clock_softc *)self;
- struct isadev_attach_args *ida = aux;
- register volatile struct chiptime *c;
-
- printf(": mc146818 or compatible");
-
- csc->sc_init = mcclock_init;
- csc->sc_get = mcclock_get;
- csc->sc_set = mcclock_set;
-
-#if NIOASIC
- if (parent->dv_cfdata->cf_driver == &ioasiccd) {
- struct ioasicdev_attach_args *ioasicdev = aux;
-
- /*
- * XXX should really allocate a new one and copy, or
- * something. unlikely we'll have more than one...
- */
- csc->sc_data = &mcclockdata_tc;
- mcclockdata_tc.mc_addr = (void *)ioasicdev->iada_addr;
- } else
-#endif
-#if NISA
- if (parent->dv_cfdata->cf_driver == &isacd) {
- /*
- * XXX should really allocate a new one and copy, or
- * something. unlikely we'll have more than one...
- */
- csc->sc_data = &mcclockdata_isa;
- mcclockdata_isa.mc_accessfns = ida->ida_piofns;
- mcclockdata_isa.mc_accessarg = ida->ida_pioarg;
- } else
-#endif
- {
- printf("\n");
- panic("clockattach: can't tell what bus we're on");
- }
-
- /* Turn interrupts off, just in case. */
- mc146818_write(csc, MC_REGB, MC_REGB_BINARY | MC_REGB_24HR);
-}
-
-static void
-mcclock_init(csc)
- struct clock_softc *csc;
-{
-
- mc146818_write(csc, MC_REGA, MC_BASE_32_KHz | MC_RATE_1024_Hz);
- mc146818_write(csc, MC_REGB,
- MC_REGB_PIE | MC_REGB_BINARY | MC_REGB_24HR);
-}
-
-/*
- * Get the time of day, based on the clock's value and/or the base value.
- */
-static void
-mcclock_get(csc, base, ct)
- struct clock_softc *csc;
- time_t base;
- struct clocktime *ct;
-{
- mc_todregs regs;
- int s;
-
- s = splclock();
- MC146818_GETTOD(csc, &regs)
- splx(s);
-
- ct->sec = regs[MC_SEC];
- ct->min = regs[MC_MIN];
- ct->hour = regs[MC_HOUR];
- ct->dow = regs[MC_DOW];
- ct->day = regs[MC_DOM];
- ct->mon = regs[MC_MONTH];
- ct->year = regs[MC_YEAR];
-}
-
-/*
- * Reset the TODR based on the time value.
- */
-static void
-mcclock_set(csc, ct)
- struct clock_softc *csc;
- struct clocktime *ct;
-{
- mc_todregs regs;
- int s;
-
- s = splclock();
- MC146818_GETTOD(csc, &regs);
- splx(s);
-
- regs[MC_SEC] = ct->sec;
- regs[MC_MIN] = ct->min;
- regs[MC_HOUR] = ct->hour;
- regs[MC_DOW] = ct->dow;
- regs[MC_DOM] = ct->day;
- regs[MC_MONTH] = ct->mon;
- regs[MC_YEAR] = ct->year;
-
- s = splclock();
- MC146818_PUTTOD(csc, &regs);
- splx(s);
-}
-
-
-#if NIOASIC
-struct tc_clockdatum {
- u_char datum;
- char pad[3];
-};
-
-static void
-mc_write_tc(csc, reg, datum)
- struct clock_softc *csc;
- u_int reg, datum;
-{
- struct mcclockdata *mccdp;
- struct tc_clockdatum *dp;
-
- mccdp = csc->sc_data;
- dp = (struct tc_clockdatum *)(mccdp->mc_addr);
-
- dp[reg].datum = datum;
-}
-
-static u_int
-mc_read_tc(csc, reg)
- struct clock_softc *csc;
- u_int reg;
-{
- struct mcclockdata *mccdp;
- struct tc_clockdatum *dp;
-
- mccdp = csc->sc_data;
- dp = (struct tc_clockdatum *)(mccdp->mc_addr);
-
- return (dp[reg].datum);
-}
-#endif /* NIOASIC */
-
-
-#if NISA
-static void
-mc_write_isa(csc, reg, datum)
- struct clock_softc *csc;
- u_int reg, datum;
-{
- struct mcclockdata *cdp = csc->sc_data;
- __const struct isa_pio_fns *ipf = cdp->mc_accessfns;
- void *ipfa = cdp->mc_accessarg;
-
- OUTB(ipf, ipfa, IO_RTC, reg);
- OUTB(ipf, ipfa, IO_RTC + 1, datum);
-}
-
-static u_int
-mc_read_isa(csc, reg)
- struct clock_softc *csc;
- u_int reg;
-{
- struct mcclockdata *cdp = csc->sc_data;
- __const struct isa_pio_fns *ipf = cdp->mc_accessfns;
- void *ipfa = cdp->mc_accessarg;
-
- OUTB(ipf, ipfa, IO_RTC, reg);
- return INB(ipf, ipfa, IO_RTC + 1);
-}
-#endif /* NISA */
diff --git a/sys/arch/alpha/alpha/clockvar.h b/sys/arch/alpha/alpha/clockvar.h
index 912bbe78d54..42d50358e9a 100644
--- a/sys/arch/alpha/alpha/clockvar.h
+++ b/sys/arch/alpha/alpha/clockvar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: clockvar.h,v 1.1 1995/06/28 02:44:59 cgd Exp $ */
+/* $NetBSD: clockvar.h,v 1.2 1996/04/17 22:01:21 cgd Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
@@ -48,30 +48,15 @@ struct clocktime {
};
/*
- * clockdesc structure:
+ * clockfns structure:
*
- * provides clock-specific functions to do necessary operations.
+ * function switch used by chip-independent clock code, to access
+ * chip-dependent routines.
*/
-struct clock_softc {
- struct device sc_dev;
-
- /*
- * The functions that all types of clock provide.
- */
- void (*sc_attach) __P((struct device *parent, struct device *self,
- void *aux));
- void (*sc_init) __P((struct clock_softc *csc));
- void (*sc_get) __P((struct clock_softc *csc, time_t base,
- struct clocktime *ct));
- void (*sc_set) __P((struct clock_softc *csc, struct clocktime *ct));
-
- /*
- * Private storage for particular clock types.
- */
- void *sc_data;
-
- /*
- * Has the time been initialized?
- */
- int sc_initted;
+struct clockfns {
+ void (*cf_init) __P((struct device *));
+ void (*cf_get) __P((struct device *, time_t, struct clocktime *));
+ void (*cf_set) __P((struct device *, struct clocktime *));
};
+
+void clockattach __P((struct device *, const struct clockfns *));
diff --git a/sys/arch/alpha/alpha/conf.c b/sys/arch/alpha/alpha/conf.c
index 144cb4b712a..d96d609a037 100644
--- a/sys/arch/alpha/alpha/conf.c
+++ b/sys/arch/alpha/alpha/conf.c
@@ -1,4 +1,4 @@
-/* $NetBSD: conf.c,v 1.9 1995/08/17 17:40:42 thorpej Exp $ */
+/* $NetBSD: conf.c,v 1.11 1996/04/12 02:07:23 cgd Exp $ */
/*-
* Copyright (c) 1991 The Regents of the University of California.
@@ -45,6 +45,12 @@
int ttselect __P((dev_t, int, struct proc *));
+#ifndef LKM
+#define lkmenodev enodev
+#else
+int lkmenodev();
+#endif
+
bdev_decl(sw);
#include "st.h"
bdev_decl(st);
@@ -78,6 +84,18 @@ struct bdevsw bdevsw[] =
};
int nblkdev = sizeof (bdevsw) / sizeof (bdevsw[0]);
+/* open, close, read, write, ioctl, tty, mmap */
+#define cdev_wscons_init(c,n) { \
+ dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
+ dev_init(c,n,write), dev_init(c,n,ioctl), dev_init(c,n,stop), \
+ dev_init(c,n,tty), ttselect, dev_init(c,n,mmap), D_TTY }
+
+/* open, close, write, ioctl */
+#define cdev_lpt_init(c,n) { \
+ dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
+ dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \
+ 0, seltrue, (dev_type_mmap((*))) enodev }
+
cdev_decl(cn);
cdev_decl(ctty);
#define mmread mmrw
@@ -97,7 +115,7 @@ cdev_decl(tun);
cdev_decl(sd);
cdev_decl(vnd);
cdev_decl(ccd);
-dev_type_open(fdopen);
+dev_type_open(filedescopen);
#include "bpfilter.h"
cdev_decl(bpf);
cdev_decl(st);
@@ -114,13 +132,18 @@ cdev_decl(scc);
cdev_decl(lkm);
#include "audio.h"
cdev_decl(audio);
-#include "wsc.h"
-cdev_decl(wsc);
+#include "wscons.h"
+cdev_decl(wscons);
#include "com.h"
cdev_decl(com);
+cdev_decl(kbd);
+cdev_decl(ms);
+#include "lpt.h"
+cdev_decl(lpt);
cdev_decl(prom); /* XXX XXX XXX */
+
struct cdevsw cdevsw[] =
{
cdev_cn_init(1,cn), /* 0: virtual console */
@@ -133,7 +156,7 @@ struct cdevsw cdevsw[] =
cdev_bpftun_init(NTUN,tun), /* 7: network tunnel */
cdev_disk_init(NSD,sd), /* 8: SCSI disk */
cdev_disk_init(NVND,vnd), /* 9: vnode disk driver */
- cdev_fd_init(1,fd), /* 10: file descriptor pseudo-dev */
+ cdev_fd_init(1,filedesc), /* 10: file descriptor pseudo-dev */
cdev_bpftun_init(NBPFILTER,bpf),/* 11: Berkeley packet filter */
cdev_tape_init(NST,st), /* 12: SCSI tape */
cdev_disk_init(NCD,cd), /* 13: SCSI CD-ROM */
@@ -148,9 +171,13 @@ struct cdevsw cdevsw[] =
cdev_lkm_dummy(), /* 22 */
cdev_tty_init(1,prom), /* 23: XXX prom console */
cdev_audio_init(NAUDIO,audio), /* 24: generic audio I/O */
- cdev_tty_init(NWSC,wsc), /* 25: workstation console */
+ cdev_wscons_init(NWSCONS,wscons), /* 25: workstation console */
cdev_tty_init(NCOM,com), /* 26: ns16550 UART */
cdev_disk_init(NCCD,ccd), /* 27: concatenated disk driver */
+ cdev_notdef(), /* 28 */
+ cdev_mouse_init(NWSCONS,kbd), /* 29: /dev/kbd XXX */
+ cdev_mouse_init(NWSCONS,ms), /* 30: /dev/mouse XXX */
+ cdev_lpt_init(NLPT,lpt), /* 31: parallel printer */
};
int nchrdev = sizeof (cdevsw) / sizeof (cdevsw[0]);
@@ -218,6 +245,10 @@ static int chrtoblktbl[] = {
/* 25 */ NODEV,
/* 26 */ NODEV,
/* 27 */ 7,
+ /* 28 */ NODEV,
+ /* 29 */ NODEV,
+ /* 30 */ NODEV,
+ /* 31 */ NODEV,
};
/*
diff --git a/sys/arch/alpha/alpha/cpu.c b/sys/arch/alpha/alpha/cpu.c
index dad5807610e..4f462e1de86 100644
--- a/sys/arch/alpha/alpha/cpu.c
+++ b/sys/arch/alpha/alpha/cpu.c
@@ -1,7 +1,7 @@
-/* $NetBSD: cpu.c,v 1.4 1995/11/23 02:33:48 cgd Exp $ */
+/* $NetBSD: cpu.c,v 1.9 1996/04/29 16:36:19 cgd Exp $ */
/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
+ * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -36,8 +36,14 @@
/* Definition of the driver for autoconfig. */
static int cpumatch(struct device *, void *, void *);
static void cpuattach(struct device *, struct device *, void *);
-struct cfdriver cpucd =
- { NULL, "cpu", cpumatch, cpuattach, DV_DULL, sizeof (struct device) };
+
+struct cfattach cpu_ca = {
+ sizeof(struct device), cpumatch, cpuattach
+};
+
+struct cfdriver cpu_cd = {
+ NULL, "cpu", DV_DULL
+};
static int cpuprint __P((void *, char *pnp));
@@ -51,7 +57,7 @@ cpumatch(parent, cfdata, aux)
struct confargs *ca = aux;
/* make sure that we're looking for a CPU. */
- if (strcmp(ca->ca_name, cpucd.cd_name) != 0)
+ if (strcmp(ca->ca_name, cpu_cd.cd_name) != 0)
return (0);
return (1);
@@ -67,11 +73,11 @@ cpuattach(parent, dev, aux)
char *cpu_major[] = {
"UNKNOWN MAJOR TYPE (0)",
"EV3", /* PCS_PROC_EV3 */
- "EV4 (21064)", /* PCS_PROC_EV4 */
+ "21064 (EV4)", /* PCS_PROC_EV4 */
"Simulator", /* PCS_PROC_SIMULATOR */
- "LCA4 (21066/21068)", /* PCS_PROC_LCA4 */
- "EV5 (21164)", /* PCS_PROC_EV5 */
- "EV45 (21064A)", /* PCS_PROC_EV45 */
+ "21066/21068 (LCA4)", /* PCS_PROC_LCA4 */
+ "21164 (EV5)", /* PCS_PROC_EV5 */
+ "21064A (EV45)", /* PCS_PROC_EV45 */
};
int ncpu_major = sizeof(cpu_major) / sizeof(cpu_major[0]);
char *dc21064_cpu_minor[] = {
@@ -136,8 +142,8 @@ cpuattach(parent, dev, aux)
printf("%sIEEE FP support", needcomma ? ", " : "");
needcomma = 1;
}
- if (p->pcs_proc_var & PCS_VAR_IOACCESS) {
- printf("%shas I/O access", needcomma ? ", " : "");
+ if (p->pcs_proc_var & PCS_VAR_PE) {
+ printf("%sPrimary Eligible", needcomma ? ", " : "");
needcomma = 1;
}
if (p->pcs_proc_var & PCS_VAR_RESERVED)
diff --git a/sys/arch/alpha/alpha/dec_2100_a50.c b/sys/arch/alpha/alpha/dec_2100_a50.c
index 3e7e4b67b2b..ec05c75687a 100644
--- a/sys/arch/alpha/alpha/dec_2100_a50.c
+++ b/sys/arch/alpha/alpha/dec_2100_a50.c
@@ -1,7 +1,7 @@
-/* $NetBSD: dec_2100_a50.c,v 1.3 1995/11/23 02:33:52 cgd Exp $ */
+/* $NetBSD: dec_2100_a50.c,v 1.6.4.2 1996/06/14 20:42:23 cgd Exp $ */
/*
- * Copyright (c) 1995 Carnegie-Mellon University.
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -29,11 +29,15 @@
#include <sys/param.h>
#include <sys/device.h>
+#include <sys/termios.h>
#include <dev/cons.h>
#include <machine/rpb.h>
+#include <machine/autoconf.h>
#include <dev/isa/isavar.h>
+#include <dev/isa/comreg.h>
+#include <dev/isa/comvar.h>
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
@@ -42,42 +46,43 @@
#include <alpha/alpha/dec_2100_a50.h>
+#include <scsi/scsi_all.h>
+#include <scsi/scsiconf.h>
+
char *
dec_2100_a50_modelname()
{
+ static char s[80];
switch (hwrpb->rpb_variation & SV_ST_MASK) {
case SV_ST_AVANTI:
case SV_ST_AVANTI_XXX: /* XXX apparently the same? */
return "AlphaStation 400 4/233 (\"Avanti\")";
- break;
case SV_ST_MUSTANG2_4_166:
return "AlphaStation 200 4/166 (\"Mustang II\")";
- break;
case SV_ST_MUSTANG2_4_233:
return "AlphaStation 200 4/233 (\"Mustang II\")";
- break;
case 0x2000:
return "AlphaStation 250 4/266";
- break;
case SV_ST_MUSTANG2_4_100:
return "AlphaStation 200 4/100 (\"Mustang II\")";
- break;
+
+ case 0xa800:
+ return "AlphaStation 255/233";
default:
- printf("unknown system variation %lx\n",
+ sprintf(s, "DEC 2100/A50 (\"Avanti\") family, variation %lx",
hwrpb->rpb_variation & SV_ST_MASK);
- return NULL;
+ return s;
}
}
void
-dec_2100_a50_consinit(constype)
- char *constype;
+dec_2100_a50_consinit()
{
struct ctb *ctb;
struct apecs_config *acp;
@@ -88,32 +93,32 @@ dec_2100_a50_consinit(constype)
ctb = (struct ctb *)(((caddr_t)hwrpb) + hwrpb->rpb_ctb_off);
- printf("constype = %s\n", constype);
- printf("ctb->ctb_term_type = 0x%lx\n", ctb->ctb_term_type);
- printf("ctb->ctb_turboslot = 0x%lx\n", ctb->ctb_turboslot);
-
switch (ctb->ctb_term_type) {
case 2:
/* serial console ... */
/* XXX */
{
- extern int comdefaultrate, comconsole;
- extern int comconsaddr, comconsinit;
+ extern bus_chipset_tag_t comconsbc; /* set */
+ extern bus_io_handle_t comcomsioh; /* set */
+ extern int comconsaddr, comconsinit; /* set */
+ extern int comdefaultrate;
extern int comcngetc __P((dev_t));
extern void comcnputc __P((dev_t, int));
extern void comcnpollc __P((dev_t, int));
- extern __const struct isa_pio_fns *comconsipf;
- extern __const void *comconsipfa;
static struct consdev comcons = { NULL, NULL,
comcngetc, comcnputc, comcnpollc, NODEV, 1 };
- cominit(acp->ac_piofns, acp->ac_pioarg, 0,
- comdefaultrate);
- comconsole = 0; /* XXX */
- comconsaddr = 0x3f8; /* XXX */
+ /* Delay to allow PROM putchars to complete */
+ DELAY(10000);
+
+ comconsaddr = 0x3f8;
comconsinit = 0;
- comconsipf = acp->ac_piofns;
- comconsipfa = acp->ac_pioarg;
+ comconsbc = &acp->ac_bc;
+ if (bus_io_map(comconsbc, comconsaddr, COM_NPORTS,
+ &comconsioh))
+ panic("can't map serial console I/O ports");
+ comconscflag = (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8;
+ cominit(comconsbc, comconsioh, comdefaultrate);
cn_tab = &comcons;
comcons.cn_dev = makedev(26, 0); /* XXX */
@@ -123,21 +128,103 @@ dec_2100_a50_consinit(constype)
case 3:
/* display console ... */
/* XXX */
- pci_display_console(acp->ac_conffns, acp->ac_confarg,
- acp->ac_memfns, acp->ac_memarg, acp->ac_piofns,
- acp->ac_pioarg, 0, ctb->ctb_turboslot & 0xffff, 0);
+ pci_display_console(&acp->ac_bc, &acp->ac_pc,
+ (ctb->ctb_turboslot >> 8) & 0xff,
+ ctb->ctb_turboslot & 0xff, 0);
break;
default:
+ printf("ctb->ctb_term_type = 0x%lx\n", ctb->ctb_term_type);
+ printf("ctb->ctb_turboslot = 0x%lx\n", ctb->ctb_turboslot);
+
panic("consinit: unknown console type %d\n",
ctb->ctb_term_type);
}
}
-dev_t
-dec_2100_a50_bootdev(booted_dev)
- char *booted_dev;
+void
+dec_2100_a50_device_register(dev, aux)
+ struct device *dev;
+ void *aux;
{
+ static int found;
+ static struct device *pcidev, *scsidev;
+ struct bootdev_data *b = bootdev_data;
+ struct device *parent = dev->dv_parent;
+ struct cfdata *cf = dev->dv_cfdata;
+ struct cfdriver *cd = cf->cf_driver;
+
+ if (found)
+ return;
+
+ if (pcidev == NULL) {
+ if (strcmp(cd->cd_name, "pci"))
+ return;
+ else {
+ struct pcibus_attach_args *pba = aux;
+
+ if (b->bus != pba->pba_bus)
+ return;
+
+ pcidev = dev;
+#if 0
+ printf("\npcidev = %s\n", pcidev->dv_xname);
+#endif
+ return;
+ }
+ }
- panic("gack.");
+ if (scsidev == NULL) {
+ if (parent != pcidev)
+ return;
+ else {
+ struct pci_attach_args *pa = aux;
+
+ if (b->slot != pa->pa_device)
+ return;
+
+ /* XXX function? */
+
+ scsidev = dev;
+#if 0
+ printf("\nscsidev = %s\n", scsidev->dv_xname);
+#endif
+ return;
+ }
+ }
+
+ if (!strcmp(cd->cd_name, "sd") ||
+ !strcmp(cd->cd_name, "st") ||
+ !strcmp(cd->cd_name, "cd")) {
+ struct scsibus_attach_args *sa = aux;
+
+ if (parent->dv_parent != scsidev)
+ return;
+
+ if (b->unit / 100 != sa->sa_sc_link->target)
+ return;
+
+ /* XXX LUN! */
+
+ switch (b->boot_dev_type) {
+ case 0:
+ if (strcmp(cd->cd_name, "sd") &&
+ strcmp(cd->cd_name, "cd"))
+ return;
+ break;
+ case 1:
+ if (strcmp(cd->cd_name, "st"))
+ return;
+ break;
+ default:
+ return;
+ }
+
+ /* we've found it! */
+ booted_device = dev;
+#if 0
+ printf("\nbooted_device = %s\n", booted_device->dv_xname);
+#endif
+ found = 1;
+ }
}
diff --git a/sys/arch/alpha/alpha/dec_2100_a50.h b/sys/arch/alpha/alpha/dec_2100_a50.h
index 084ebaa171a..895517aad27 100644
--- a/sys/arch/alpha/alpha/dec_2100_a50.h
+++ b/sys/arch/alpha/alpha/dec_2100_a50.h
@@ -1,7 +1,7 @@
-/* $NetBSD: dec_2100_a50.h,v 1.2 1995/08/03 01:12:20 cgd Exp $ */
+/* $NetBSD: dec_2100_a50.h,v 1.2.6.2 1996/06/13 18:35:10 cgd Exp $ */
/*
- * Copyright (c) 1995 Carnegie-Mellon University.
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -28,5 +28,5 @@
*/
char *dec_2100_a50_modelname __P((void));
-void dec_2100_a50_consinit __P((char *));
-dev_t dec_2100_a50_bootdev __P((char *));
+void dec_2100_a50_consinit __P((void));
+void dec_2100_a50_device_register __P((struct device *, void *));
diff --git a/sys/arch/alpha/alpha/dec_3000_300.c b/sys/arch/alpha/alpha/dec_3000_300.c
index fa9b365309b..43e4254efb1 100644
--- a/sys/arch/alpha/alpha/dec_3000_300.c
+++ b/sys/arch/alpha/alpha/dec_3000_300.c
@@ -1,7 +1,7 @@
-/* $NetBSD: dec_3000_300.c,v 1.2 1995/08/03 01:12:21 cgd Exp $ */
+/* $NetBSD: dec_3000_300.c,v 1.2.6.2 1996/06/13 18:35:12 cgd Exp $ */
/*
- * Copyright (c) 1995 Carnegie-Mellon University.
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -28,8 +28,19 @@
*/
#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
#include <machine/rpb.h>
+#include <machine/autoconf.h>
+
+#include <dev/tc/tcvar.h>
+
+#include <alpha/tc/tcdsvar.h>
+
+#include <scsi/scsi_all.h>
+#include <scsi/scsiconf.h>
+
char *
dec_3000_300_modelname()
{
@@ -55,16 +66,74 @@ dec_3000_300_modelname()
}
void
-dec_3000_300_consinit(constype)
- char *constype;
+dec_3000_300_consinit()
{
}
-dev_t
-dec_3000_300_bootdev(booted_dev)
- char *booted_dev;
+void
+dec_3000_300_device_register(dev, aux)
+ struct device *dev;
+ void *aux;
{
+ static int found;
+ static struct device *scsidev;
+ struct bootdev_data *b = bootdev_data;
+ struct device *parent = dev->dv_parent;
+ struct cfdata *cf = dev->dv_cfdata;
+ struct cfdriver *cd = cf->cf_driver;
+
+ if (found)
+ return;
+
+ if (strcmp(cd->cd_name, "esp") == 0) {
+ if (b->slot == 4 &&
+ strcmp(parent->dv_cfdata->cf_driver->cd_name, "tcds")
+ == 0) {
+ struct tcdsdev_attach_args *tcdsdev = aux;
- panic("gack.");
+ if (tcdsdev->tcdsda_slot == b->channel) {
+ scsidev = dev;
+#if 0
+ printf("\nscsidev = %s\n", dev->dv_xname);
+#endif
+ }
+ }
+ } else if (strcmp(cd->cd_name, "sd") == 0 ||
+ strcmp(cd->cd_name, "st") == 0 ||
+ strcmp(cd->cd_name, "cd") == 0) {
+ struct scsibus_attach_args *sa = aux;
+
+ if (scsidev == NULL)
+ return;
+
+ if (parent->dv_parent != scsidev)
+ return;
+
+ if (b->unit / 100 != sa->sa_sc_link->target)
+ return;
+
+ /* XXX LUN! */
+
+ switch (b->boot_dev_type) {
+ case 0:
+ if (strcmp(cd->cd_name, "sd") &&
+ strcmp(cd->cd_name, "cd"))
+ return;
+ break;
+ case 1:
+ if (strcmp(cd->cd_name, "st"))
+ return;
+ break;
+ default:
+ return;
+ }
+
+ /* we've found it! */
+ booted_device = dev;
+#if 0
+ printf("\nbooted_device = %s\n", booted_device->dv_xname);
+#endif
+ found = 1;
+ }
}
diff --git a/sys/arch/alpha/alpha/dec_3000_300.h b/sys/arch/alpha/alpha/dec_3000_300.h
index 56926a5ba73..bc350ff64ea 100644
--- a/sys/arch/alpha/alpha/dec_3000_300.h
+++ b/sys/arch/alpha/alpha/dec_3000_300.h
@@ -1,7 +1,7 @@
-/* $NetBSD: dec_3000_300.h,v 1.2 1995/08/03 01:12:23 cgd Exp $ */
+/* $NetBSD: dec_3000_300.h,v 1.2.6.2 1996/06/13 18:35:13 cgd Exp $ */
/*
- * Copyright (c) 1995 Carnegie-Mellon University.
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -28,5 +28,5 @@
*/
char *dec_3000_300_modelname __P((void));
-void dec_3000_300_consinit __P((char *));
-dev_t dec_3000_300_bootdev __P((char *));
+void dec_3000_300_consinit __P((void));
+void dec_3000_300_device_register __P((struct device *, void *));
diff --git a/sys/arch/alpha/alpha/dec_3000_500.c b/sys/arch/alpha/alpha/dec_3000_500.c
index 1cf1dac3d77..0581672da7c 100644
--- a/sys/arch/alpha/alpha/dec_3000_500.c
+++ b/sys/arch/alpha/alpha/dec_3000_500.c
@@ -1,7 +1,7 @@
-/* $NetBSD: dec_3000_500.c,v 1.1 1995/08/03 00:57:26 cgd Exp $ */
+/* $NetBSD: dec_3000_500.c,v 1.1.6.2 1996/06/13 18:35:15 cgd Exp $ */
/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
+ * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -28,8 +28,19 @@
*/
#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
#include <machine/rpb.h>
+#include <machine/autoconf.h>
+
+#include <dev/tc/tcvar.h>
+
+#include <alpha/tc/tcdsvar.h>
+
+#include <scsi/scsi_all.h>
+#include <scsi/scsiconf.h>
+
char *
dec_3000_500_modelname()
{
@@ -73,16 +84,74 @@ systype_flamingo:
}
void
-dec_3000_500_consinit(constype)
- char *constype;
+dec_3000_500_consinit()
{
}
-dev_t
-dec_3000_500_bootdev(booted_dev)
- char *booted_dev;
+void
+dec_3000_500_device_register(dev, aux)
+ struct device *dev;
+ void *aux;
{
-
- panic("gack.");
+ static int found;
+ static struct device *scsidev;
+ struct bootdev_data *b = bootdev_data;
+ struct device *parent = dev->dv_parent;
+ struct cfdata *cf = dev->dv_cfdata;
+ struct cfdriver *cd = cf->cf_driver;
+
+ if (found)
+ return;
+
+ if (strcmp(cd->cd_name, "esp") == 0) {
+ if (b->slot == 6 &&
+ strcmp(parent->dv_cfdata->cf_driver->cd_name, "tcds")
+ == 0) {
+ struct tcdsdev_attach_args *tcdsdev = aux;
+
+ if (tcdsdev->tcdsda_slot == b->channel) {
+ scsidev = dev;
+#if 0
+ printf("\nscsidev = %s\n", dev->dv_xname);
+#endif
+ }
+ }
+ } else if (strcmp(cd->cd_name, "sd") == 0 ||
+ strcmp(cd->cd_name, "st") == 0 ||
+ strcmp(cd->cd_name, "cd") == 0) {
+ struct scsibus_attach_args *sa = aux;
+
+ if (scsidev == NULL)
+ return;
+
+ if (parent->dv_parent != scsidev)
+ return;
+
+ if (b->unit / 100 != sa->sa_sc_link->target)
+ return;
+
+ /* XXX LUN! */
+
+ switch (b->boot_dev_type) {
+ case 0:
+ if (strcmp(cd->cd_name, "sd") &&
+ strcmp(cd->cd_name, "cd"))
+ return;
+ break;
+ case 1:
+ if (strcmp(cd->cd_name, "st"))
+ return;
+ break;
+ default:
+ return;
+ }
+
+ /* we've found it! */
+ booted_device = dev;
+#if 0
+ printf("\nbooted_device = %s\n", booted_device->dv_xname);
+#endif
+ found = 1;
+ }
}
diff --git a/sys/arch/alpha/alpha/dec_3000_500.h b/sys/arch/alpha/alpha/dec_3000_500.h
index e597154f4fd..c45a5ed429a 100644
--- a/sys/arch/alpha/alpha/dec_3000_500.h
+++ b/sys/arch/alpha/alpha/dec_3000_500.h
@@ -1,7 +1,7 @@
-/* $NetBSD: dec_3000_500.h,v 1.2 1995/08/03 01:12:25 cgd Exp $ */
+/* $NetBSD: dec_3000_500.h,v 1.2.6.2 1996/06/13 18:35:17 cgd Exp $ */
/*
- * Copyright (c) 1995 Carnegie-Mellon University.
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -28,5 +28,5 @@
*/
char *dec_3000_500_modelname __P((void));
-void dec_3000_500_consinit __P((char *));
-dev_t dec_3000_500_bootdev __P((char *));
+void dec_3000_500_consinit __P((void));
+void dec_3000_500_device_register __P((struct device *, void *));
diff --git a/sys/arch/alpha/alpha/dec_axppci_33.c b/sys/arch/alpha/alpha/dec_axppci_33.c
index e688836b8f8..dd28dac0299 100644
--- a/sys/arch/alpha/alpha/dec_axppci_33.c
+++ b/sys/arch/alpha/alpha/dec_axppci_33.c
@@ -1,7 +1,7 @@
-/* $NetBSD: dec_axppci_33.c,v 1.1 1995/11/23 02:33:55 cgd Exp $ */
+/* $NetBSD: dec_axppci_33.c,v 1.4.4.2 1996/06/14 20:42:24 cgd Exp $ */
/*
- * Copyright (c) 1995 Carnegie-Mellon University.
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -29,11 +29,15 @@
#include <sys/param.h>
#include <sys/device.h>
+#include <sys/termios.h>
#include <dev/cons.h>
#include <machine/rpb.h>
+#include <machine/autoconf.h>
#include <dev/isa/isavar.h>
+#include <dev/isa/comreg.h>
+#include <dev/isa/comvar.h>
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
@@ -42,6 +46,9 @@
#include <alpha/alpha/dec_axppci_33.h>
+#include <scsi/scsi_all.h>
+#include <scsi/scsiconf.h>
+
char *
dec_axppci_33_modelname()
{
@@ -58,8 +65,7 @@ dec_axppci_33_modelname()
}
void
-dec_axppci_33_consinit(constype)
- char *constype;
+dec_axppci_33_consinit()
{
struct ctb *ctb;
struct lca_config *lcp;
@@ -70,33 +76,32 @@ dec_axppci_33_consinit(constype)
ctb = (struct ctb *)(((caddr_t)hwrpb) + hwrpb->rpb_ctb_off);
- printf("constype = %s\n", constype);
- printf("ctb->ctb_term_type = 0x%lx\n", ctb->ctb_term_type);
- printf("ctb->ctb_turboslot = 0x%lx\n", ctb->ctb_turboslot);
-
switch (ctb->ctb_term_type) {
case 2:
/* serial console ... */
/* XXX */
{
- extern int comdefaultrate, comconsole;
- extern int comconsaddr, comconsinit;
+ extern bus_chipset_tag_t comconsbc; /* set */
+ extern bus_io_handle_t comcomsioh; /* set */
+ extern int comconsaddr, comconsinit; /* set */
+ extern int comdefaultrate;
extern int comcngetc __P((dev_t));
extern void comcnputc __P((dev_t, int));
extern void comcnpollc __P((dev_t, int));
- extern __const struct isa_pio_fns *comconsipf;
- extern __const void *comconsipfa;
static struct consdev comcons = { NULL, NULL,
comcngetc, comcnputc, comcnpollc, NODEV, 1 };
+ /* Delay to allow PROM putchars to complete */
+ DELAY(10000);
- cominit(lcp->lc_piofns, lcp->lc_pioarg, 0,
- comdefaultrate);
- comconsole = 0; /* XXX */
- comconsaddr = 0x3f8; /* XXX */
+ comconsaddr = 0x3f8;
comconsinit = 0;
- comconsipf = lcp->lc_piofns;
- comconsipfa = lcp->lc_pioarg;
+ comconsbc = &lcp->lc_bc;
+ if (bus_io_map(comconsbc, comconsaddr, COM_NPORTS,
+ &comconsioh))
+ panic("can't map serial console I/O ports");
+ comconscflag = (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8;
+ cominit(comconsbc, comconsioh, comdefaultrate);
cn_tab = &comcons;
comcons.cn_dev = makedev(26, 0); /* XXX */
@@ -106,21 +111,103 @@ dec_axppci_33_consinit(constype)
case 3:
/* display console ... */
/* XXX */
- pci_display_console(lcp->lc_conffns, lcp->lc_confarg,
- lcp->lc_memfns, lcp->lc_memarg, lcp->lc_piofns,
- lcp->lc_pioarg, 0, ctb->ctb_turboslot & 0xffff, 0);
+ pci_display_console(&lcp->lc_bc, &lcp->lc_pc,
+ (ctb->ctb_turboslot >> 8) & 0xff,
+ ctb->ctb_turboslot & 0xff, 0);
break;
default:
+ printf("ctb->ctb_term_type = 0x%lx\n", ctb->ctb_term_type);
+ printf("ctb->ctb_turboslot = 0x%lx\n", ctb->ctb_turboslot);
+
panic("consinit: unknown console type %d\n",
ctb->ctb_term_type);
}
}
-dev_t
-dec_axppci_33_bootdev(booted_dev)
- char *booted_dev;
+void
+dec_axppci_33_device_register(dev, aux)
+ struct device *dev;
+ void *aux;
{
+ static int found;
+ static struct device *pcidev, *scsidev;
+ struct bootdev_data *b = bootdev_data;
+ struct device *parent = dev->dv_parent;
+ struct cfdata *cf = dev->dv_cfdata;
+ struct cfdriver *cd = cf->cf_driver;
+
+ if (found)
+ return;
+
+ if (pcidev == NULL) {
+ if (strcmp(cd->cd_name, "pci"))
+ return;
+ else {
+ struct pcibus_attach_args *pba = aux;
+
+ if (b->bus != pba->pba_bus)
+ return;
+
+ pcidev = dev;
+#if 0
+ printf("\npcidev = %s\n", pcidev->dv_xname);
+#endif
+ return;
+ }
+ }
+
+ if (scsidev == NULL) {
+ if (parent != pcidev)
+ return;
+ else {
+ struct pci_attach_args *pa = aux;
+
+ if (b->slot != pa->pa_device)
+ return;
+
+ /* XXX function? */
+
+ scsidev = dev;
+#if 0
+ printf("\nscsidev = %s\n", scsidev->dv_xname);
+#endif
+ return;
+ }
+ }
- panic("gack.");
+ if (!strcmp(cd->cd_name, "sd") ||
+ !strcmp(cd->cd_name, "st") ||
+ !strcmp(cd->cd_name, "cd")) {
+ struct scsibus_attach_args *sa = aux;
+
+ if (parent->dv_parent != scsidev)
+ return;
+
+ if (b->unit / 100 != sa->sa_sc_link->target)
+ return;
+
+ /* XXX LUN! */
+
+ switch (b->boot_dev_type) {
+ case 0:
+ if (strcmp(cd->cd_name, "sd") &&
+ strcmp(cd->cd_name, "cd"))
+ return;
+ break;
+ case 1:
+ if (strcmp(cd->cd_name, "st"))
+ return;
+ break;
+ default:
+ return;
+ }
+
+ /* we've found it! */
+ booted_device = dev;
+#if 0
+ printf("\nbooted_device = %s\n", booted_device->dv_xname);
+#endif
+ found = 1;
+ }
}
diff --git a/sys/arch/alpha/alpha/dec_axppci_33.h b/sys/arch/alpha/alpha/dec_axppci_33.h
index 1eb82dbbd56..79fe7325151 100644
--- a/sys/arch/alpha/alpha/dec_axppci_33.h
+++ b/sys/arch/alpha/alpha/dec_axppci_33.h
@@ -1,7 +1,7 @@
-/* $NetBSD: dec_axppci_33.h,v 1.1 1995/11/23 02:33:57 cgd Exp $ */
+/* $NetBSD: dec_axppci_33.h,v 1.1.4.2 1996/06/13 18:35:18 cgd Exp $ */
/*
- * Copyright (c) 1995 Carnegie-Mellon University.
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -28,5 +28,5 @@
*/
char *dec_axppci_33_modelname __P((void));
-void dec_axppci_33_consinit __P((char *));
-dev_t dec_axppci_33_bootdev __P((char *));
+void dec_axppci_33_consinit __P((void));
+void dec_axppci_33_device_register __P((struct device *, void *));
diff --git a/sys/arch/alpha/alpha/dec_kn20aa.c b/sys/arch/alpha/alpha/dec_kn20aa.c
index 789fa2f20b1..152d892c983 100644
--- a/sys/arch/alpha/alpha/dec_kn20aa.c
+++ b/sys/arch/alpha/alpha/dec_kn20aa.c
@@ -1,7 +1,7 @@
-/* $NetBSD: dec_kn20aa.c,v 1.1 1995/11/23 02:34:00 cgd Exp $ */
+/* $NetBSD: dec_kn20aa.c,v 1.4.4.2 1996/06/14 20:42:25 cgd Exp $ */
/*
- * Copyright (c) 1995 Carnegie-Mellon University.
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -29,11 +29,15 @@
#include <sys/param.h>
#include <sys/device.h>
+#include <sys/termios.h>
#include <dev/cons.h>
#include <machine/rpb.h>
+#include <machine/autoconf.h>
#include <dev/isa/isavar.h>
+#include <dev/isa/comreg.h>
+#include <dev/isa/comvar.h>
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
@@ -42,6 +46,9 @@
#include <alpha/alpha/dec_kn20aa.h>
+#include <scsi/scsi_all.h>
+#include <scsi/scsiconf.h>
+
char *
dec_kn20aa_modelname()
{
@@ -58,8 +65,7 @@ dec_kn20aa_modelname()
}
void
-dec_kn20aa_consinit(constype)
- char *constype;
+dec_kn20aa_consinit()
{
struct ctb *ctb;
struct cia_config *ccp;
@@ -70,33 +76,32 @@ dec_kn20aa_consinit(constype)
ctb = (struct ctb *)(((caddr_t)hwrpb) + hwrpb->rpb_ctb_off);
- printf("constype = %s\n", constype);
- printf("ctb->ctb_term_type = 0x%lx\n", ctb->ctb_term_type);
- printf("ctb->ctb_turboslot = 0x%lx\n", ctb->ctb_turboslot);
-
switch (ctb->ctb_term_type) {
case 2:
/* serial console ... */
/* XXX */
{
- extern int comdefaultrate, comconsole;
- extern int comconsaddr, comconsinit;
+ extern bus_chipset_tag_t comconsbc; /* set */
+ extern bus_io_handle_t comcomsioh; /* set */
+ extern int comconsaddr, comconsinit; /* set */
+ extern int comdefaultrate;
extern int comcngetc __P((dev_t));
extern void comcnputc __P((dev_t, int));
extern void comcnpollc __P((dev_t, int));
- extern __const struct isa_pio_fns *comconsipf;
- extern __const void *comconsipfa;
static struct consdev comcons = { NULL, NULL,
comcngetc, comcnputc, comcnpollc, NODEV, 1 };
+ /* Delay to allow PROM putchars to complete */
+ DELAY(10000);
- cominit(ccp->cc_piofns, ccp->cc_pioarg, 0,
- comdefaultrate);
- comconsole = 0; /* XXX */
- comconsaddr = 0x3f8; /* XXX */
+ comconsaddr = 0x3f8;
comconsinit = 0;
- comconsipf = ccp->cc_piofns;
- comconsipfa = ccp->cc_pioarg;
+ comconsbc = &ccp->cc_bc;
+ if (bus_io_map(comconsbc, comconsaddr, COM_NPORTS,
+ &comconsioh))
+ panic("can't map serial console I/O ports");
+ comconscflag = (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8;
+ cominit(comconsbc, comconsioh, comdefaultrate);
cn_tab = &comcons;
comcons.cn_dev = makedev(26, 0); /* XXX */
@@ -106,21 +111,103 @@ dec_kn20aa_consinit(constype)
case 3:
/* display console ... */
/* XXX */
- pci_display_console(ccp->cc_conffns, ccp->cc_confarg,
- ccp->cc_memfns, ccp->cc_memarg, ccp->cc_piofns,
- ccp->cc_pioarg, 0, ctb->ctb_turboslot & 0xffff, 0);
+ pci_display_console(&ccp->cc_bc, &ccp->cc_pc,
+ (ctb->ctb_turboslot >> 8) & 0xff,
+ ctb->ctb_turboslot & 0xff, 0);
break;
default:
+ printf("ctb->ctb_term_type = 0x%lx\n", ctb->ctb_term_type);
+ printf("ctb->ctb_turboslot = 0x%lx\n", ctb->ctb_turboslot);
+
panic("consinit: unknown console type %d\n",
ctb->ctb_term_type);
}
}
-dev_t
-dec_kn20aa_bootdev(booted_dev)
- char *booted_dev;
+void
+dec_kn20aa_device_register(dev, aux)
+ struct device *dev;
+ void *aux;
{
+ static int found;
+ static struct device *pcidev, *scsidev;
+ struct bootdev_data *b = bootdev_data;
+ struct device *parent = dev->dv_parent;
+ struct cfdata *cf = dev->dv_cfdata;
+ struct cfdriver *cd = cf->cf_driver;
+
+ if (found)
+ return;
+
+ if (pcidev == NULL) {
+ if (strcmp(cd->cd_name, "pci"))
+ return;
+ else {
+ struct pcibus_attach_args *pba = aux;
+
+ if (b->bus != pba->pba_bus)
+ return;
+
+ pcidev = dev;
+#if 0
+ printf("\npcidev = %s\n", pcidev->dv_xname);
+#endif
+ return;
+ }
+ }
+
+ if (scsidev == NULL) {
+ if (parent != pcidev)
+ return;
+ else {
+ struct pci_attach_args *pa = aux;
+
+ if (b->slot != pa->pa_device)
+ return;
+
+ /* XXX function? */
+
+ scsidev = dev;
+#if 0
+ printf("\nscsidev = %s\n", scsidev->dv_xname);
+#endif
+ return;
+ }
+ }
- panic("gack.");
+ if (!strcmp(cd->cd_name, "sd") ||
+ !strcmp(cd->cd_name, "st") ||
+ !strcmp(cd->cd_name, "cd")) {
+ struct scsibus_attach_args *sa = aux;
+
+ if (parent->dv_parent != scsidev)
+ return;
+
+ if (b->unit / 100 != sa->sa_sc_link->target)
+ return;
+
+ /* XXX LUN! */
+
+ switch (b->boot_dev_type) {
+ case 0:
+ if (strcmp(cd->cd_name, "sd") &&
+ strcmp(cd->cd_name, "cd"))
+ return;
+ break;
+ case 1:
+ if (strcmp(cd->cd_name, "st"))
+ return;
+ break;
+ default:
+ return;
+ }
+
+ /* we've found it! */
+ booted_device = dev;
+#if 0
+ printf("\nbooted_device = %s\n", booted_device->dv_xname);
+#endif
+ found = 1;
+ }
}
diff --git a/sys/arch/alpha/alpha/dec_kn20aa.h b/sys/arch/alpha/alpha/dec_kn20aa.h
index d078cca8c03..ef05246cd45 100644
--- a/sys/arch/alpha/alpha/dec_kn20aa.h
+++ b/sys/arch/alpha/alpha/dec_kn20aa.h
@@ -1,7 +1,7 @@
-/* $NetBSD: dec_kn20aa.h,v 1.1 1995/11/23 02:34:03 cgd Exp $ */
+/* $NetBSD: dec_kn20aa.h,v 1.1.4.2 1996/06/13 18:35:19 cgd Exp $ */
/*
- * Copyright (c) 1995 Carnegie-Mellon University.
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -28,5 +28,5 @@
*/
char *dec_kn20aa_modelname __P((void));
-void dec_kn20aa_consinit __P((char *));
-dev_t dec_kn20aa_bootdev __P((char *));
+void dec_kn20aa_consinit __P((void));
+void dec_kn20aa_device_register __P((struct device *, void *));
diff --git a/sys/arch/alpha/alpha/disksubr.c b/sys/arch/alpha/alpha/disksubr.c
index cec12b153df..9e3d2252742 100644
--- a/sys/arch/alpha/alpha/disksubr.c
+++ b/sys/arch/alpha/alpha/disksubr.c
@@ -1,7 +1,7 @@
-/* $NetBSD: disksubr.c,v 1.4 1996/01/07 22:01:38 thorpej Exp $ */
+/* $NetBSD: disksubr.c,v 1.6 1996/04/29 16:34:50 cgd Exp $ */
/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
+ * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Authors: Keith Bostic, Chris G. Demetriou
@@ -43,7 +43,7 @@
extern struct device *bootdv;
/* was this the boot device ? */
-int
+void
dk_establish(dk, dev)
struct disk *dk;
struct device *dev;
@@ -57,14 +57,12 @@ dk_establish(dk, dev)
if (bp == NULL) {
printf("no boot path\n");
- return -1;
}
sprintf(name, "%s%d", bp->name, CRAZYMAP(bp->val[0]));
if (strcmp(name, dev->dv_xname) == 0) {
bootdv = dev;
}
#endif
- return 1;
}
/*
diff --git a/sys/arch/alpha/alpha/genassym.c b/sys/arch/alpha/alpha/genassym.c
index 3eb7fcad1bb..6c4824dfb87 100644
--- a/sys/arch/alpha/alpha/genassym.c
+++ b/sys/arch/alpha/alpha/genassym.c
@@ -1,4 +1,4 @@
-/* $NetBSD: genassym.c,v 1.3 1995/11/23 02:34:06 cgd Exp $ */
+/* $NetBSD: genassym.c,v 1.4 1996/05/17 18:29:41 cgd Exp $ */
/*
* Copyright (c) 1982, 1990, 1993
@@ -56,6 +56,7 @@
#include <err.h>
void def __P((char *, long));
+int main __P((int argc, char **argv));
#define off(what, s, m) def(what, (int)offsetof(s, m))
@@ -69,7 +70,10 @@ def(what, val)
err(1, "printf");
}
-main()
+int
+main(argc, argv)
+ int argc;
+ char **argv;
{
/* general constants */
diff --git a/sys/arch/alpha/alpha/in_cksum.c b/sys/arch/alpha/alpha/in_cksum.c
new file mode 100644
index 00000000000..7382354afd0
--- /dev/null
+++ b/sys/arch/alpha/alpha/in_cksum.c
@@ -0,0 +1,198 @@
+/* $NetBSD: in_cksum.c,v 1.2.4.1 1996/05/30 23:12:50 cgd Exp $ */
+
+/*
+ * Copyright (c) 1988, 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ * Copyright (c) 1996
+ * Matt Thomas <matt@3am-software.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)in_cksum.c 8.1 (Berkeley) 6/10/93
+ */
+
+#include <sys/param.h>
+#include <sys/mbuf.h>
+#include <sys/systm.h>
+#include <netinet/in.h>
+
+/*
+ * Checksum routine for Internet Protocol family headers
+ * (Portable Alpha version).
+ *
+ * This routine is very heavily used in the network
+ * code and should be modified for each CPU to be as fast as possible.
+ */
+
+#define ADDCARRY(x) (x > 65535 ? x -= 65535 : x)
+#define REDUCE32 \
+ { \
+ q_util.q = sum; \
+ sum = q_util.s[0] + q_util.s[1] + q_util.s[2] + q_util.s[3]; \
+ }
+#define REDUCE16 \
+ { \
+ q_util.q = sum; \
+ l_util.l = q_util.s[0] + q_util.s[1] + q_util.s[2] + q_util.s[3]; \
+ sum = l_util.s[0] + l_util.s[1]; \
+ ADDCARRY(sum); \
+ }
+
+static const u_int32_t in_masks[] = {
+ /*0 bytes*/ /*1 byte*/ /*2 bytes*/ /*3 bytes*/
+ 0x00000000, 0x000000FF, 0x0000FFFF, 0x00FFFFFF, /* offset 0 */
+ 0x00000000, 0x0000FF00, 0x00FFFF00, 0xFFFFFF00, /* offset 1 */
+ 0x00000000, 0x00FF0000, 0xFFFF0000, 0xFFFF0000, /* offset 2 */
+ 0x00000000, 0xFF000000, 0xFF000000, 0xFF000000, /* offset 3 */
+};
+
+union l_util {
+ u_int16_t s[2];
+ u_int32_t l;
+};
+union q_util {
+ u_int16_t s[4];
+ u_int32_t l[2];
+ u_int64_t q;
+};
+
+u_int64_t
+in_cksumdata(buf, len)
+ register caddr_t buf;
+ register int len;
+{
+ const u_int32_t *lw = (u_int32_t *) buf;
+ u_int64_t sum = 0;
+ u_int64_t prefilled;
+ int offset;
+ union q_util q_util;
+ union l_util l_util;
+
+ if ((3 & (long) lw) == 0 && len == 20) {
+ sum = (u_int64_t) lw[0] + lw[1] + lw[2] + lw[3] + lw[4];
+ REDUCE32;
+ return sum;
+ }
+
+ if ((offset = 3 & (long) lw) != 0) {
+ const u_int32_t *masks = in_masks + (offset << 2);
+ lw = (u_int32_t *) (((long) lw) - offset);
+ sum = *lw++ & masks[len >= 3 ? 3 : len];
+ len -= 4 - offset;
+ if (len <= 0) {
+ REDUCE32;
+ return sum;
+ }
+ }
+#if 0
+ /*
+ * Force to cache line boundary.
+ */
+ offset = 32 - (0x1f & (long) lw);
+ if (offset < 32 && len > offset) {
+ len -= offset;
+ if (4 & offset) {
+ sum += (u_int64_t) lw[0];
+ lw += 1;
+ }
+ if (8 & offset) {
+ sum += (u_int64_t) lw[0] + lw[1];
+ lw += 2;
+ }
+ if (16 & offset) {
+ sum += (u_int64_t) lw[0] + lw[1] + lw[2] + lw[3];
+ lw += 4;
+ }
+ }
+#endif
+ /*
+ * access prefilling to start load of next cache line.
+ * then add current cache line
+ * save result of prefilling for loop iteration.
+ */
+ prefilled = lw[0];
+ while ((len -= 32) >= 4) {
+ u_int64_t prefilling = lw[8];
+ sum += prefilled + lw[1] + lw[2] + lw[3]
+ + lw[4] + lw[5] + lw[6] + lw[7];
+ lw += 8;
+ prefilled = prefilling;
+ }
+ if (len >= 0) {
+ sum += prefilled + lw[1] + lw[2] + lw[3]
+ + lw[4] + lw[5] + lw[6] + lw[7];
+ lw += 8;
+ } else {
+ len += 32;
+ }
+ while ((len -= 16) >= 0) {
+ sum += (u_int64_t) lw[0] + lw[1] + lw[2] + lw[3];
+ lw += 4;
+ }
+ len += 16;
+ while ((len -= 4) >= 0) {
+ sum += (u_int64_t) *lw++;
+ }
+ len += 4;
+ if (len > 0)
+ sum += (u_int64_t) (in_masks[len] & *lw);
+ REDUCE32;
+ return sum;
+}
+
+int
+in_cksum(m, len)
+ register struct mbuf *m;
+ register int len;
+{
+ register u_int64_t sum = 0;
+ register int mlen = 0;
+ register int clen = 0;
+ register caddr_t addr;
+ union q_util q_util;
+ union l_util l_util;
+
+ for (; m && len; m = m->m_next) {
+ if (m->m_len == 0)
+ continue;
+ mlen = m->m_len;
+ if (len < mlen)
+ mlen = len;
+ addr = mtod(m, caddr_t);
+ if ((clen ^ (long) addr) & 1)
+ sum += in_cksumdata(addr, mlen) << 8;
+ else
+ sum += in_cksumdata(addr, mlen);
+
+ clen += mlen;
+ len -= mlen;
+ }
+ REDUCE16;
+ return (~sum & 0xffff);
+}
diff --git a/sys/arch/alpha/alpha/interrupt.c b/sys/arch/alpha/alpha/interrupt.c
index 3b1b1eaadae..96dc58f7a10 100644
--- a/sys/arch/alpha/alpha/interrupt.c
+++ b/sys/arch/alpha/alpha/interrupt.c
@@ -1,4 +1,4 @@
-/* $NetBSD: interrupt.c,v 1.4 1995/11/23 02:34:08 cgd Exp $ */
+/* $NetBSD: interrupt.c,v 1.5 1996/04/23 13:54:32 cgd Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
@@ -128,7 +128,7 @@ machine_check(framep, logoutp, vec)
{
if (!mc_expected)
- panic("machine check: vec %lx, pc = 0x%lx, ra = 0x%lx",
+ panic("machine check: vec 0x%lx, pc = 0x%lx, ra = 0x%lx",
vec, framep->tf_pc, framep->tf_regs[FRAME_RA]);
mc_expected = 0;
diff --git a/sys/arch/alpha/alpha/locore.s b/sys/arch/alpha/alpha/locore.s
index 50439438fde..0df2856b540 100644
--- a/sys/arch/alpha/alpha/locore.s
+++ b/sys/arch/alpha/alpha/locore.s
@@ -1,7 +1,7 @@
-/* $NetBSD: locore.s,v 1.7 1995/11/23 02:34:11 cgd Exp $ */
+/* $NetBSD: locore.s,v 1.13.4.1 1996/06/13 18:06:59 cgd Exp $ */
/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
+ * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -27,16 +27,22 @@
* rights to redistribute these changes.
*/
-#define LOCORE
-
#include <machine/asm.h>
#ifndef EVCNT_COUNTERS
#include <machine/intrcnt.h>
#endif
-#include "assym.s"
+#include "assym.h"
/* don't reorder instructions; paranoia. */
.set noreorder
+ .text
+
+/*
+ * This is for kvm_mkdb, and should be the address of the beginning
+ * of the kernel text segment (not necessarily the same as kernbase).
+ */
+ EXPORT(kernel_text)
+kernel_text:
/*
* bootstack: a temporary stack, for booting.
@@ -51,13 +57,9 @@ bootstack:
* Arguments:
* a0 is the first free page frame number (PFN)
* a1 is the page table base register (PTBR)
- * a2 argc
- * a3 argv
- * a4 envp
*
* All arguments are passed to alpha_init().
*/
- .text
NESTED_NOPROFILE(__start,1,0,ra,0,0)
br pv,1f
1: SETGP(pv)
@@ -1621,3 +1623,11 @@ EXPORT(eintrcnt)
.text
/**************************************************************************/
+
+ .text
+LEAF(rpcc,1)
+ rpcc v0
+ RET
+ END(pal_mtpr_mces)
+
+/**************************************************************************/
diff --git a/sys/arch/alpha/alpha/machdep.c b/sys/arch/alpha/alpha/machdep.c
index a5bcdea8398..bdc0d410c25 100644
--- a/sys/arch/alpha/alpha/machdep.c
+++ b/sys/arch/alpha/alpha/machdep.c
@@ -1,7 +1,7 @@
-/* $NetBSD: machdep.c,v 1.14 1996/01/04 22:21:33 jtc Exp $ */
+/* $NetBSD: machdep.c,v 1.19.4.5 1996/06/15 03:56:33 cgd Exp $ */
/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
+ * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -35,6 +35,7 @@
#include <sys/proc.h>
#include <sys/buf.h>
#include <sys/reboot.h>
+#include <sys/device.h>
#include <sys/conf.h>
#include <sys/file.h>
#ifdef REAL_CLISTS
@@ -94,7 +95,7 @@
#include <net/netisr.h>
#include "ether.h"
-#include "le.h" /* XXX for le_iomem creation */
+#include "le_ioasic.h" /* for le_iomem creation */
vm_map_t buffer_map;
@@ -135,7 +136,7 @@ u_int32_t no_optimize;
/* the following is used externally (sysctl_hw) */
char machine[] = "alpha";
-char *cpu_model;
+char cpu_model[128];
char *model_names[] = {
"UNKNOWN (0)",
"Alpha Demonstration Unit",
@@ -174,18 +175,19 @@ int ncpus;
/* various CPU-specific functions. */
char *(*cpu_modelname) __P((void));
-void (*cpu_consinit) __P((char *));
-dev_t (*cpu_bootdev) __P((char *));
+void (*cpu_consinit) __P((void));
+void (*cpu_device_register) __P((struct device *dev, void *aux));
char *cpu_iobus;
-char *boot_file, *boot_flags, *boot_console, *boot_dev;
+char boot_flags[64];
+
+/* for cpu_sysctl() */
+char root_device[17];
int
-alpha_init(pfn, ptb, argc, argv, envp)
+alpha_init(pfn, ptb)
u_long pfn; /* first free PFN number */
u_long ptb; /* PFN of current level 1 page table */
- u_long argc;
- char *argv[], *envp[];
{
extern char _end[];
caddr_t start, v;
@@ -362,7 +364,7 @@ alpha_init(pfn, ptb, argc, argv, envp)
case ST_DEC_3000_500:
cpu_modelname = dec_3000_500_modelname;
cpu_consinit = dec_3000_500_consinit;
- cpu_bootdev = dec_3000_500_bootdev;
+ cpu_device_register = dec_3000_500_device_register;
cpu_iobus = "tcasic";
break;
#endif
@@ -371,7 +373,7 @@ alpha_init(pfn, ptb, argc, argv, envp)
case ST_DEC_3000_300:
cpu_modelname = dec_3000_300_modelname;
cpu_consinit = dec_3000_300_consinit;
- cpu_bootdev = dec_3000_300_bootdev;
+ cpu_device_register = dec_3000_300_device_register;
cpu_iobus = "tcasic";
break;
#endif
@@ -380,7 +382,7 @@ alpha_init(pfn, ptb, argc, argv, envp)
case ST_DEC_2100_A50:
cpu_modelname = dec_2100_a50_modelname;
cpu_consinit = dec_2100_a50_consinit;
- cpu_bootdev = dec_2100_a50_bootdev;
+ cpu_device_register = dec_2100_a50_device_register;
cpu_iobus = "apecs";
break;
#endif
@@ -389,7 +391,7 @@ alpha_init(pfn, ptb, argc, argv, envp)
case ST_DEC_KN20AA:
cpu_modelname = dec_kn20aa_modelname;
cpu_consinit = dec_kn20aa_consinit;
- cpu_bootdev = dec_kn20aa_bootdev;
+ cpu_device_register = dec_kn20aa_device_register;
cpu_iobus = "cia";
break;
#endif
@@ -398,7 +400,7 @@ alpha_init(pfn, ptb, argc, argv, envp)
case ST_DEC_AXPPCI_33:
cpu_modelname = dec_axppci_33_modelname;
cpu_consinit = dec_axppci_33_consinit;
- cpu_bootdev = dec_axppci_33_bootdev;
+ cpu_device_register = dec_axppci_33_device_register;
cpu_iobus = "lca";
break;
#endif
@@ -407,7 +409,7 @@ alpha_init(pfn, ptb, argc, argv, envp)
case ST_DEC_2000_300:
cpu_modelname = dec_2000_300_modelname;
cpu_consinit = dec_2000_300_consinit;
- cpu_bootdev = dec_2000_300_bootdev;
+ cpu_device_register = dec_2000_300_device_register;
cpu_iobus = "ibus";
XXX DEC 2000/300 NOT SUPPORTED
break;
@@ -417,8 +419,9 @@ alpha_init(pfn, ptb, argc, argv, envp)
case ST_DEC_21000:
cpu_modelname = dec_21000_modelname;
cpu_consinit = dec_21000_consinit;
- cpu_bootdev = dec_21000_bootdev;
+ cpu_device_register = dec_21000_device_register;
cpu_iobus = "tlsb";
+ XXX DEC 21000 NOT SUPPORTED
break;
#endif
@@ -430,22 +433,30 @@ alpha_init(pfn, ptb, argc, argv, envp)
model_names[cputype]);
}
- cpu_model = (*cpu_modelname)();
- if (cpu_model == NULL)
- cpu_model = model_names[cputype];
+ if ((*cpu_modelname)() != NULL)
+ strncpy(cpu_model, (*cpu_modelname)(), sizeof cpu_model - 1);
+ else
+ strncpy(cpu_model, model_names[cputype], sizeof cpu_model - 1);
+ cpu_model[sizeof cpu_model - 1] = '\0';
-#if NLE > 0
+#if NLE_IOASIC > 0
/*
* Grab 128K at the top of physical memory for the lance chip
* on machines where it does dma through the I/O ASIC.
* It must be physically contiguous and aligned on a 128K boundary.
+ *
+ * Note that since this is conditional on the presence of
+ * IOASIC-attached 'le' units in the kernel config, the
+ * message buffer may move on these systems. This shouldn't
+ * be a problem, because once people have a kernel config that
+ * they use, they're going to stick with it.
*/
if (cputype == ST_DEC_3000_500 ||
cputype == ST_DEC_3000_300) { /* XXX possibly others? */
lastusablepage -= btoc(128 * 1024);
le_iomem = (caddr_t)phystok0seg(ctob(lastusablepage + 1));
}
-#endif /* NLE */
+#endif /* NLE_IOASIC */
/*
* Initialize error message buffer (at end of core).
@@ -490,14 +501,12 @@ alpha_init(pfn, ptb, argc, argv, envp)
/*
* Determine how many buffers to allocate.
- * We allocate the BSD standard of 10% of memory for the first
- * 2 Meg, and 5% of remaining memory for buffer space. Insure a
+ * We allocate 10% of memory for buffer space. Insure a
* minimum of 16 buffers. We allocate 1/2 as many swap buffer
* headers as file i/o buffers.
*/
if (bufpages == 0)
- bufpages = (btoc(2 * 1024 * 1024) + physmem) /
- (20 * CLSIZE);
+ bufpages = (physmem * 10) / (CLSIZE * 100);
if (nbuf == 0) {
nbuf = bufpages;
if (nbuf < 16)
@@ -538,70 +547,40 @@ alpha_init(pfn, ptb, argc, argv, envp)
proc0.p_md.md_tf = (struct trapframe *)proc0paddr->u_pcb.pcb_ksp;
/*
- * figure out what arguments we have
- */
- switch (argc) {
- default:
- printf("weird number of arguments from boot: %d\n", argc);
- if (argc < 1)
- break;
- /* FALLTHRU */
- case 4:
- boot_dev = argv[3];
- /* FALLTHRU */
- case 3:
- boot_console = argv[2];
- /* FALLTHRU */
- case 2:
- boot_flags = argv[1];
- /* FALLTHRU */
- case 1:
- boot_file = argv[0];
- /* FALLTHRU */
- }
-
- /*
- * Look at arguments and compute bootdev.
- * XXX NOT HERE.
+ * Look at arguments passed to us and compute boothowto.
*/
+ prom_getenv(PROM_E_BOOTED_OSFLAGS, boot_flags, sizeof(boot_flags));
#if 0
- { /* XXX */
- extern dev_t bootdev; /* XXX */
- bootdev = (*cpu_bootdev)(boot_dev);
- } /* XXX */
+ printf("boot flags = \"%s\"\n", boot_flags);
#endif
- /*
- * Look at arguments passed to us and compute boothowto.
- */
boothowto = RB_SINGLE;
-#ifdef GENERIC
- boothowto |= RB_ASKNAME;
-#endif
#ifdef KADB
boothowto |= RB_KDB;
#endif
for (p = boot_flags; p && *p != '\0'; p++) {
+ /*
+ * Note that we'd really like to differentiate case here,
+ * but the Alpha AXP Architecture Reference Manual
+ * says that we shouldn't.
+ */
switch (*p) {
case 'a': /* autoboot */
- case 'A': /* DEC's notion of autoboot */
+ case 'A':
boothowto &= ~RB_SINGLE;
break;
- case 'd': /* use compiled in default root */
- boothowto |= RB_DFLTROOT;
+ case 'n': /* askname */
+ case 'N':
+ boothowto |= RB_ASKNAME;
break;
+#if 0
case 'm': /* mini root present in memory */
+ case 'M':
boothowto |= RB_MINIROOT;
break;
-
- case 'n': /* ask for names */
- boothowto |= RB_ASKNAME;
- break;
-
- case 'N': /* don't ask for names */
- boothowto &= ~RB_ASKNAME;
+#endif
}
}
@@ -621,13 +600,15 @@ alpha_init(pfn, ptb, argc, argv, envp)
return (0);
}
+void
consinit()
{
- (*cpu_consinit)(boot_console);
+ (*cpu_consinit)();
pmap_unmap_prom();
}
+void
cpu_startup()
{
register unsigned i;
@@ -757,6 +738,7 @@ identifycpu()
int waittime = -1;
struct pcb dumppcb;
+void
boot(howto)
int howto;
{
@@ -770,12 +752,6 @@ boot(howto)
boothowto = howto;
if ((howto & RB_NOSYNC) == 0 && waittime < 0) {
- extern struct proc proc0;
-
- /* protect against curproc->p_stats.foo refs in sync XXX */
- if (curproc == NULL)
- curproc = &proc0;
-
waittime = 0;
vfs_shutdown();
/*
@@ -1236,6 +1212,10 @@ cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
consdev = NODEV;
return (sysctl_rdstruct(oldp, oldlenp, newp, &consdev,
sizeof consdev));
+
+ case CPU_ROOT_DEVICE:
+ return (sysctl_rdstring(oldp, oldlenp, newp, root_device));
+
default:
return (EOPNOTSUPP);
}
@@ -1319,7 +1299,7 @@ netintr()
#endif
#ifdef PPP
if (netisr & (1 << NETISR_PPP)) {
- netisr &= ~(1 << NETISR_CCITT);
+ netisr &= ~(1 << NETISR_PPP);
pppintr();
}
#endif
@@ -1440,21 +1420,31 @@ microtime(tvp)
splx(s);
}
+/*
+ * Wait "n" microseconds.
+ */
+int
+delay(n)
+ int n;
+{
+ long N = cycles_per_usec * (n);
+
+ while (N > 0) /* XXX */
+ N -= 3; /* XXX */
+}
+
#if defined(COMPAT_OSF1) || 1 /* XXX */
void
-cpu_exec_ecoff_setregs(p, pack, stack, retval)
+cpu_exec_ecoff_setregs(p, epp, stack, retval)
struct proc *p;
- struct exec_package *pack;
+ struct exec_package *epp;
u_long stack;
register_t *retval;
{
- struct ecoff_aouthdr *eap;
-
- setregs(p, pack, stack, retval);
+ struct ecoff_exechdr *execp = (struct ecoff_exechdr *)epp->ep_hdr;
- eap = (struct ecoff_aouthdr *)
- ((caddr_t)pack->ep_hdr + sizeof(struct ecoff_filehdr));
- p->p_md.md_tf->tf_gp = eap->ea_gp_value;
+ setregs(p, epp, stack, retval);
+ p->p_md.md_tf->tf_gp = execp->a.gp_value;
}
/*
@@ -1465,26 +1455,25 @@ cpu_exec_ecoff_setregs(p, pack, stack, retval)
*
*/
int
-cpu_exec_ecoff_hook(p, epp, eap)
+cpu_exec_ecoff_hook(p, epp)
struct proc *p;
struct exec_package *epp;
- struct ecoff_aouthdr *eap;
{
- struct ecoff_filehdr *efp = epp->ep_hdr;
- extern struct emul emul_native;
+ struct ecoff_exechdr *execp = (struct ecoff_exechdr *)epp->ep_hdr;
+ extern struct emul emul_netbsd;
#ifdef COMPAT_OSF1
extern struct emul emul_osf1;
#endif
- switch (efp->ef_magic) {
+ switch (execp->f.f_magic) {
#ifdef COMPAT_OSF1
case ECOFF_MAGIC_ALPHA:
epp->ep_emul = &emul_osf1;
break;
#endif
- case ECOFF_MAGIC_NATIVE_ALPHA:
- epp->ep_emul = &emul_native;
+ case ECOFF_MAGIC_NETBSD_ALPHA:
+ epp->ep_emul = &emul_netbsd;
break;
default:
diff --git a/sys/arch/alpha/alpha/mainbus.c b/sys/arch/alpha/alpha/mainbus.c
index 6ed51a575be..50c0feac4f8 100644
--- a/sys/arch/alpha/alpha/mainbus.c
+++ b/sys/arch/alpha/alpha/mainbus.c
@@ -1,7 +1,7 @@
-/* $NetBSD: mainbus.c,v 1.6 1995/12/20 00:18:50 cgd Exp $ */
+/* $NetBSD: mainbus.c,v 1.9 1996/04/12 06:07:35 cgd Exp $ */
/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
+ * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -44,9 +44,14 @@ struct mainbus_softc {
static int mbmatch __P((struct device *, void *, void *));
static void mbattach __P((struct device *, struct device *, void *));
static int mbprint __P((void *, char *));
-struct cfdriver mainbuscd =
- { NULL, "mainbus", mbmatch, mbattach, DV_DULL,
- sizeof (struct mainbus_softc) };
+
+struct cfattach mainbus_ca = {
+ sizeof(struct mainbus_softc), mbmatch, mbattach
+};
+
+struct cfdriver mainbus_cd = {
+ NULL, "mainbus", DV_DULL
+};
void mb_intr_establish __P((struct confargs *, int (*)(void *), void *));
void mb_intr_disestablish __P((struct confargs *));
@@ -111,7 +116,7 @@ mbattach(parent, self, aux)
nca.ca_slot = 0;
nca.ca_offset = 0;
nca.ca_bus = &sc->sc_bus;
- if (config_found(self, &nca, mbprint))
+ if (config_found(self, &nca, mbprint) != NULL)
cpuattachcnt++;
}
if (ncpus != cpuattachcnt)
diff --git a/sys/arch/alpha/alpha/mcclock.c b/sys/arch/alpha/alpha/mcclock.c
new file mode 100644
index 00000000000..1a4c48b10eb
--- /dev/null
+++ b/sys/arch/alpha/alpha/mcclock.c
@@ -0,0 +1,136 @@
+/* $NetBSD: mcclock.c,v 1.2 1996/04/17 22:22:32 cgd Exp $ */
+
+/*
+ * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#include <sys/param.h>
+#include <sys/kernel.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+
+#include <alpha/alpha/clockvar.h>
+#include <alpha/alpha/mcclockvar.h>
+#include <dev/ic/mc146818reg.h>
+
+struct cfdriver mcclock_cd = {
+ NULL, "mcclock", DV_DULL,
+};
+
+void mcclock_init __P((struct device *));
+void mcclock_get __P((struct device *, time_t, struct clocktime *));
+void mcclock_set __P((struct device *, struct clocktime *));
+
+const struct clockfns mcclock_clockfns = {
+ mcclock_init, mcclock_get, mcclock_set,
+};
+
+#define mc146818_write(dev, reg, datum) \
+ (*(dev)->sc_busfns->mc_bf_write)(dev, reg, datum)
+#define mc146818_read(dev, reg) \
+ (*(dev)->sc_busfns->mc_bf_read)(dev, reg)
+
+void
+mcclock_attach(sc, busfns)
+ struct mcclock_softc *sc;
+ const struct mcclock_busfns *busfns;
+{
+
+ printf(": mc146818 or compatible");
+
+ sc->sc_busfns = busfns;
+
+ /* Turn interrupts off, just in case. */
+ mc146818_write(sc, MC_REGB, MC_REGB_BINARY | MC_REGB_24HR);
+
+ clockattach(&sc->sc_dev, &mcclock_clockfns);
+}
+
+void
+mcclock_init(dev)
+ struct device *dev;
+{
+ struct mcclock_softc *sc = (struct mcclock_softc *)dev;
+
+ mc146818_write(sc, MC_REGA, MC_BASE_32_KHz | MC_RATE_1024_Hz);
+ mc146818_write(sc, MC_REGB,
+ MC_REGB_PIE | MC_REGB_BINARY | MC_REGB_24HR);
+}
+
+/*
+ * Get the time of day, based on the clock's value and/or the base value.
+ */
+void
+mcclock_get(dev, base, ct)
+ struct device *dev;
+ time_t base;
+ struct clocktime *ct;
+{
+ struct mcclock_softc *sc = (struct mcclock_softc *)dev;
+ mc_todregs regs;
+ int s;
+
+ s = splclock();
+ MC146818_GETTOD(sc, &regs)
+ splx(s);
+
+ ct->sec = regs[MC_SEC];
+ ct->min = regs[MC_MIN];
+ ct->hour = regs[MC_HOUR];
+ ct->dow = regs[MC_DOW];
+ ct->day = regs[MC_DOM];
+ ct->mon = regs[MC_MONTH];
+ ct->year = regs[MC_YEAR];
+}
+
+/*
+ * Reset the TODR based on the time value.
+ */
+void
+mcclock_set(dev, ct)
+ struct device *dev;
+ struct clocktime *ct;
+{
+ struct mcclock_softc *sc = (struct mcclock_softc *)dev;
+ mc_todregs regs;
+ int s;
+
+ s = splclock();
+ MC146818_GETTOD(sc, &regs);
+ splx(s);
+
+ regs[MC_SEC] = ct->sec;
+ regs[MC_MIN] = ct->min;
+ regs[MC_HOUR] = ct->hour;
+ regs[MC_DOW] = ct->dow;
+ regs[MC_DOM] = ct->day;
+ regs[MC_MONTH] = ct->mon;
+ regs[MC_YEAR] = ct->year;
+
+ s = splclock();
+ MC146818_PUTTOD(sc, &regs);
+ splx(s);
+}
diff --git a/sys/arch/alpha/include/pci_machdep.h b/sys/arch/alpha/alpha/mcclockvar.h
index 5e474e396d2..049d3912eec 100644
--- a/sys/arch/alpha/include/pci_machdep.h
+++ b/sys/arch/alpha/alpha/mcclockvar.h
@@ -1,7 +1,7 @@
-/* $NetBSD: pci_machdep.h,v 1.1 1995/11/23 02:36:19 cgd Exp $ */
+/* $NetBSD: mcclockvar.h,v 1.2 1996/04/17 22:22:38 cgd Exp $ */
/*
- * Copyright (c) 1995 Carnegie-Mellon University.
+ * Copyright (c) 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -26,11 +26,16 @@
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
-/*
- * Machine-specific definitions for PCI autoconfiguration.
- */
-/*
- * Configuration tag.
- */
-typedef u_long pci_tag_t;
+struct mcclock_softc {
+ struct device sc_dev;
+ const struct mcclock_busfns *sc_busfns;
+};
+
+struct mcclock_busfns {
+ void (*mc_bf_write) __P((struct mcclock_softc *, u_int, u_int));
+ u_int (*mc_bf_read) __P((struct mcclock_softc *, u_int));
+};
+
+void mcclock_attach __P((struct mcclock_softc *,
+ const struct mcclock_busfns *));
diff --git a/sys/arch/alpha/alpha/mem.c b/sys/arch/alpha/alpha/mem.c
index 5f310eed697..3709b3104b8 100644
--- a/sys/arch/alpha/alpha/mem.c
+++ b/sys/arch/alpha/alpha/mem.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mem.c,v 1.5 1995/11/23 02:34:21 cgd Exp $ */
+/* $NetBSD: mem.c,v 1.6 1996/04/12 02:06:21 cgd Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -112,7 +112,7 @@ kmemphys:
#endif
o = uio->uio_offset & PGOFSET;
c = min(uio->uio_resid, (int)(NBPG - o));
- error = uiomove(phystok0seg(v), c, uio);
+ error = uiomove((caddr_t)phystok0seg(v), c, uio);
continue;
/* minor device 1 is kernel memory */
diff --git a/sys/arch/alpha/alpha/pmap.c b/sys/arch/alpha/alpha/pmap.c
index 59804c9d9be..2ea0b3f140e 100644
--- a/sys/arch/alpha/alpha/pmap.c
+++ b/sys/arch/alpha/alpha/pmap.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.7 1995/11/23 02:34:26 cgd Exp $ */
+/* $NetBSD: pmap.c,v 1.8 1996/04/12 02:09:24 cgd Exp $ */
/*
* Copyright (c) 1991, 1993
@@ -267,6 +267,8 @@ void pmap_pvdump __P((vm_offset_t));
void pmap_check_wiring __P((char *, vm_offset_t));
#endif
+#define PAGE_IS_MANAGED(pa) ((pa) >= vm_first_phys && (pa) < vm_last_phys)
+
/* pmap_remove_mapping flags */
#define PRM_TFLUSH 1
#define PRM_CFLUSH 2
@@ -406,8 +408,19 @@ pmap_bootstrap(firstaddr, ptaddr)
/* Nothing to do; it's already zero'd */
avail_start = k0segtophys(firstaddr);
- avail_end = alpha_ptob(1 + lastusablepage);
+#if 1
+ avail_end = alpha_ptob(lastusablepage + 1);
mem_size = avail_end - avail_start;
+#else
+ /* XXX why not lastusablepage + 1, & not include NBPG in mem_size? */
+ avail_end = alpha_ptob(lastusablepage);
+ mem_size = NBPG + avail_end - avail_start;
+#endif
+#if 0
+ printf("avail_start = 0x%lx\n", avail_start);
+ printf("avail_end = 0x%lx\n", avail_end);
+ printf("mem_size = 0x%lx\n", mem_size);
+#endif
virtual_avail = VM_MIN_KERNEL_ADDRESS;
virtual_end = VM_MIN_KERNEL_ADDRESS + Sysmapsize * NBPG;
@@ -522,6 +535,10 @@ pmap_init(phys_start, phys_end)
*/
vm_first_phys = phys_start;
vm_last_phys = phys_end;
+#if 0
+ printf("vm_first_phys = 0x%lx\n", vm_first_phys);
+ printf("vm_last_phys = 0x%lx\n", vm_last_phys);
+#endif
pmap_initialized = TRUE;
}
@@ -769,7 +786,7 @@ pmap_page_protect(pa, prot)
prot == VM_PROT_NONE && (pmapdebug & PDB_REMOVE))
printf("pmap_page_protect(%lx, %lx)\n", pa, prot);
#endif
- if (pa < vm_first_phys || pa >= vm_last_phys)
+ if (!PAGE_IS_MANAGED(pa))
return;
switch (prot) {
@@ -1015,7 +1032,7 @@ pmap_enter(pmap, va, pa, prot, wired)
* Note that we raise IPL while manipulating pv_table
* since pmap_enter can be called at interrupt time.
*/
- if (pa >= vm_first_phys && pa < vm_last_phys) {
+ if (PAGE_IS_MANAGED(pa)) {
register pv_entry_t pv, npv;
int s;
@@ -1092,10 +1109,12 @@ validate:
* Build the new PTE.
*/
npte = ((pa >> PGSHIFT) << PG_SHIFT) | pte_prot(pmap, prot) | PG_V;
- if ((pmap_attributes[pa_index(pa)] & PMAP_ATTR_REF) == 0)
- npte |= PG_FOR | PG_FOW | PG_FOE;
- else if ((pmap_attributes[pa_index(pa)] & PMAP_ATTR_MOD) == 0)
- npte |= PG_FOW;
+ if (PAGE_IS_MANAGED(pa)) {
+ if ((pmap_attributes[pa_index(pa)] & PMAP_ATTR_REF) == 0)
+ npte |= PG_FOR | PG_FOW | PG_FOE;
+ else if ((pmap_attributes[pa_index(pa)] & PMAP_ATTR_MOD) == 0)
+ npte |= PG_FOW;
+ }
if (wired)
npte |= PG_WIRED;
#ifdef DEBUG
@@ -1471,7 +1490,7 @@ pmap_pageable(pmap, sva, eva, pageable)
if (!pmap_ste_v(pmap, sva))
return;
pa = pmap_pte_pa(pmap_pte(pmap, sva));
- if (pa < vm_first_phys || pa >= vm_last_phys)
+ if (!PAGE_IS_MANAGED(pa))
return;
pv = pa_to_pvh(pa);
if (pv->pv_ptpte == NULL)
@@ -1514,6 +1533,8 @@ pmap_clear_modify(pa)
if (pmapdebug & PDB_FOLLOW)
printf("pmap_clear_modify(%lx)\n", pa);
#endif
+ if (!PAGE_IS_MANAGED(pa)) /* XXX why not panic? */
+ return;
if ((pmap_attributes[pa_index(pa)] & PMAP_ATTR_MOD) != 0) {
pmap_changebit(pa, PG_FOW, TRUE);
pmap_attributes[pa_index(pa)] &= ~PMAP_ATTR_MOD;
@@ -1533,6 +1554,8 @@ void pmap_clear_reference(pa)
if (pmapdebug & PDB_FOLLOW)
printf("pmap_clear_reference(%lx)\n", pa);
#endif
+ if (!PAGE_IS_MANAGED(pa)) /* XXX why not panic? */
+ return;
if ((pmap_attributes[pa_index(pa)] & PMAP_ATTR_REF) != 0) {
pmap_changebit(pa, PG_FOR | PG_FOW | PG_FOE, TRUE);
pmap_attributes[pa_index(pa)] &= ~PMAP_ATTR_REF;
@@ -1552,6 +1575,8 @@ pmap_is_referenced(pa)
{
boolean_t rv;
+ if (!PAGE_IS_MANAGED(pa)) /* XXX why not panic? */
+ return 0;
rv = (pmap_attributes[pa_index(pa)] & PMAP_ATTR_REF) != 0;
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW) {
@@ -1574,6 +1599,8 @@ pmap_is_modified(pa)
{
boolean_t rv;
+ if (!PAGE_IS_MANAGED(pa)) /* XXX why not panic? */
+ return 0;
rv = (pmap_attributes[pa_index(pa)] & PMAP_ATTR_MOD) != 0;
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW) {
@@ -1709,7 +1736,7 @@ pmap_remove_mapping(pmap, va, pte, flags)
/*
* If this isn't a managed page, we are all done.
*/
- if (pa < vm_first_phys || pa >= vm_last_phys)
+ if (!PAGE_IS_MANAGED(pa))
return;
/*
* Otherwise remove it from the PV table
@@ -1848,7 +1875,7 @@ pmap_changebit(pa, bit, setem)
printf("pmap_changebit(%lx, %lx, %s)\n",
pa, bit, setem ? "set" : "clear");
#endif
- if (pa < vm_first_phys || pa >= vm_last_phys)
+ if (!PAGE_IS_MANAGED(pa))
return;
#ifdef PMAPSTATS
@@ -2156,6 +2183,10 @@ pmap_emulate_reference(p, v, user, write)
if (pmapdebug & PDB_FOLLOW)
printf("\tpa = 0x%lx\n", pa);
#endif
+#ifdef DIAGNOSTIC
+ if (!PAGE_IS_MANAGED(pa))
+ printf("WARNING: pmap_emulate_reference(0x%lx, 0x%lx, %d, %d): pa 0x%lx not managed\n", p, v, user, write, pa);
+#endif
/*
* Twiddle the appropriate bits to reflect the reference
@@ -2177,6 +2208,7 @@ pmap_emulate_reference(p, v, user, write)
#if 0
/*
* This is apparently normal. Why? -- cgd
+ * XXX because was being called on unmanaged pages?
*/
printf("warning: pmap_changebit didn't.");
#endif
diff --git a/sys/arch/alpha/alpha/prom.c b/sys/arch/alpha/alpha/prom.c
index 473a9290981..735ae81c85c 100644
--- a/sys/arch/alpha/alpha/prom.c
+++ b/sys/arch/alpha/alpha/prom.c
@@ -1,7 +1,7 @@
-/* $NetBSD: prom.c,v 1.4 1995/08/03 00:58:33 cgd Exp $ */
+/* $NetBSD: prom.c,v 1.5.4.2 1996/06/13 18:35:21 cgd Exp $ */
/*
- * Copyright (c) 1992, 1994, 1995 Carnegie Mellon University
+ * Copyright (c) 1992, 1994, 1995, 1996 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
@@ -207,6 +207,11 @@ prom_getenv(id, buf, len)
TBIA(); /* XXX */
} /* XXX */
splx(s);
+
+ if (ret.u.status & 0x4)
+ ret.u.retval = 0;
+ buf[ret.u.retval] = '\0';
+
return (ret.bits);
}
@@ -226,7 +231,8 @@ prom_halt(halt)
* we want to happen when we halt.
*/
p = (struct pcs *)((char *)hwrpb + hwrpb->rpb_pcs_off);
- p->pcs_flags &= ~(PCS_RC | PCS_HALT_REQ);
+ /* XXX BIP should have been cleared long ago. */
+ p->pcs_flags &= ~(PCS_RC | PCS_HALT_REQ | PCS_BIP);
if (halt)
p->pcs_flags |= PCS_HALT_STAY_HALTED;
else
diff --git a/sys/arch/alpha/alpha/prom_disp.s b/sys/arch/alpha/alpha/prom_disp.s
index 6a4bb12685c..0a4f6a4c832 100644
--- a/sys/arch/alpha/alpha/prom_disp.s
+++ b/sys/arch/alpha/alpha/prom_disp.s
@@ -1,7 +1,7 @@
-/* $NetBSD: prom_disp.s,v 1.1 1995/02/13 23:07:10 cgd Exp $ */
+/* $NetBSD: prom_disp.s,v 1.4 1996/04/12 06:07:38 cgd Exp $ */
/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
+ * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -27,10 +27,10 @@
* rights to redistribute these changes.
*/
-#ifndef LOCORE
-#include "../include/asm.h"
-#include "../include/prom.h"
-#include "../include/rpb.h"
+#ifndef _LOCORE
+#include <machine/asm.h>
+#include <machine/prom.h>
+#include <machine/rpb.h>
#endif
.globl prom_dispatch_v
diff --git a/sys/arch/alpha/alpha/promcons.c b/sys/arch/alpha/alpha/promcons.c
index 7a0a2ecf3d3..d958cf0577f 100644
--- a/sys/arch/alpha/alpha/promcons.c
+++ b/sys/arch/alpha/alpha/promcons.c
@@ -1,4 +1,4 @@
-/* $NetBSD: promcons.c,v 1.2 1995/06/28 02:45:19 cgd Exp $ */
+/* $NetBSD: promcons.c,v 1.2.6.1 1996/06/03 18:54:31 cgd Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
@@ -64,9 +64,10 @@ promopen(dev, flag, mode, p)
s = spltty();
- if (!prom_tty[unit])
+ if (!prom_tty[unit]) {
tp = prom_tty[unit] = ttymalloc();
- else
+ tty_attach(tp);
+ } else
tp = prom_tty[unit];
tp->t_oproc = promstart;
diff --git a/sys/arch/alpha/alpha/swapgeneric.c b/sys/arch/alpha/alpha/swapgeneric.c
index acfad0b11c2..fb6aa241464 100644
--- a/sys/arch/alpha/alpha/swapgeneric.c
+++ b/sys/arch/alpha/alpha/swapgeneric.c
@@ -1,11 +1,8 @@
-/* $NetBSD: swapgeneric.c,v 1.3 1995/03/24 15:03:02 cgd Exp $ */
+/* $NetBSD: swapgeneric.c,v 1.4.4.1 1996/06/13 18:02:37 cgd Exp $ */
/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
+ * Copyright (c) 1994
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -17,8 +14,8 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
@@ -35,158 +32,22 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)swapgeneric.c 5.5 (Berkeley) 5/9/91
+ * @(#)swapgeneric.c 8.2 (Berkeley) 3/21/94
+ */
+
+/*
+ * fake swapgeneric.c -- should do this differently.
*/
#include <sys/param.h>
#include <sys/conf.h>
-#include <sys/buf.h>
-#include <sys/systm.h>
-#include <sys/reboot.h>
-#include <sys/device.h>
-#include <sys/disklabel.h>
-
-#include <machine/pte.h>
-#include "sd.h"
-#include "cd.h"
+int (*mountroot) __P((void *)) = NULL; /* tells autoconf.c that we are "generic" */
-/*
- * Generic configuration; all in one
- */
dev_t rootdev = NODEV;
-dev_t argdev = NODEV;
dev_t dumpdev = NODEV;
-int nswap;
-struct swdevt swdevt[] = {
- { NODEV, 1, 0 },
- { NODEV, 0, 0 },
-};
-long dumplo;
-int dmmin, dmmax, dmtext;
-
-#if NSD > 0
-extern struct cfdriver sdcd;
-#endif
-#if NCD > 0
-extern struct cfdriver cdcd;
-#endif
-struct genericconf {
- struct cfdriver *gc_driver;
- char *gc_name;
- dev_t gc_major;
-} genericconf[] = {
-#if NSD > 0
- { &sdcd, "sd", 8 },
-#endif
-#if NCD > 0
- { &cdcd, "cd", 3 },
-#endif
- { 0 }
+struct swdevt swdevt[] = {
+ { NODEV, 0, 0 }, /* to be filled in */
+ { NODEV, 0, 0 }
};
-
-extern int ffs_mountroot();
-int (*mountroot)() = ffs_mountroot;
-
-setconf()
-{
- register struct genericconf *gc;
- int unit, swaponroot = 0;
-
- if (rootdev != NODEV)
- goto doswap;
-
- if (genericconf[0].gc_driver == 0)
- goto verybad;
-
- if (boothowto & RB_ASKNAME) {
- char name[128];
-retry:
- printf("root device? ");
- gets(name);
-
- if (strcmp(name, "halt") == 0)
- boot(RB_HALT);
-
- for (gc = genericconf; gc->gc_driver; gc++)
- if (gc->gc_name[0] == name[0] &&
- gc->gc_name[1] == name[1])
- goto gotit;
- goto bad;
-gotit:
- if (name[3] == '*') {
- name[3] = name[4];
- swaponroot++;
- }
- if (name[2] >= '0' && name[2] <= '7' && name[3] == 0) {
- unit = name[2] - '0';
- goto found;
- }
- printf("bad/missing unit number\n");
-bad:
- printf("use:\n");
- for (gc = genericconf; gc->gc_driver; gc++)
- printf("\t%s%%d\n", gc->gc_name);
- printf("\thalt\n");
- goto retry;
- }
- unit = 0;
- for (gc = genericconf; gc->gc_driver; gc++) {
- if (gc->gc_driver->cd_ndevs > unit &&
- gc->gc_driver->cd_devs[unit]) {
- printf("root on %s0\n", gc->gc_name);
- goto found;
- }
- }
-verybad:
- printf("no suitable root\n");
- boot(RB_HALT);
-
-found:
- rootdev = makedev(gc->gc_major, unit * MAXPARTITIONS);
-doswap:
- swdevt[0].sw_dev = argdev = dumpdev =
- makedev(major(rootdev), minor(rootdev) + 1);
- /* swap size and dumplo set during autoconfigure */
- if (swaponroot)
- rootdev = dumpdev;
-}
-
-gets(cp)
- char *cp;
-{
- register char *lp;
- register c;
-
- lp = cp;
- for (;;) {
- printf("%c", c = cngetc()&0177);
- switch (c) {
- case '\n':
- case '\r':
- printf("%c", '\n');
- *lp++ = '\0';
- return;
- case '\b':
- case '\177':
- if (lp > cp) {
- printf(" \b");
- lp--;
- }
- continue;
- case '#':
- lp--;
- if (lp < cp)
- lp = cp;
- continue;
- case '@':
- case 'u'&037:
- lp = cp;
- printf("%c", '\n');
- continue;
- default:
- *lp++ = c;
- }
- }
-}
diff --git a/sys/arch/alpha/alpha/vm_machdep.c b/sys/arch/alpha/alpha/vm_machdep.c
index 5b31b6d23c2..32939382780 100644
--- a/sys/arch/alpha/alpha/vm_machdep.c
+++ b/sys/arch/alpha/alpha/vm_machdep.c
@@ -1,7 +1,7 @@
-/* $NetBSD: vm_machdep.c,v 1.6 1995/12/09 04:37:23 mycroft Exp $ */
+/* $NetBSD: vm_machdep.c,v 1.9 1996/04/23 15:26:10 cgd Exp $ */
/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
+ * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -246,14 +246,14 @@ cpu_fork(p1, p2)
void
cpu_set_kpc(p, pc)
struct proc *p;
- u_int64_t pc;
+ void (*pc) __P((struct proc *));
{
struct pcb *pcbp;
extern void proc_trampoline();
extern void rei();
pcbp = &p->p_addr->u_pcb;
- pcbp->pcb_context[0] = pc; /* s0 - pc to invoke */
+ pcbp->pcb_context[0] = (u_int64_t)pc; /* s0 - pc to invoke */
pcbp->pcb_context[1] = (u_int64_t)rei; /* s1 - return address */
pcbp->pcb_context[7] =
(u_int64_t)proc_trampoline; /* ra - assembly magic */
@@ -318,22 +318,25 @@ cpu_swapout(p)
* Both addresses are assumed to reside in the Sysmap,
* and size must be a multiple of CLSIZE.
*/
+void
pagemove(from, to, size)
register caddr_t from, to;
- int size;
+ size_t size;
{
register pt_entry_t *fpte, *tpte;
+ ssize_t todo;
if (size % CLBYTES)
panic("pagemove");
fpte = kvtopte(from);
tpte = kvtopte(to);
- while (size > 0) {
+ todo = size; /* if testing > 0, need sign... */
+ while (todo > 0) {
TBIS(from);
*tpte++ = *fpte;
*fpte = 0;
fpte++;
- size -= NBPG;
+ todo -= NBPG;
from += NBPG;
to += NBPG;
}
@@ -359,6 +362,7 @@ extern vm_map_t phys_map;
* All requests are (re)mapped into kernel VA space via the useriomap
* (a name with only slightly more meaning than "kernelmap")
*/
+void
vmapbuf(bp, len)
struct buf *bp;
vm_size_t len;
@@ -390,6 +394,7 @@ vmapbuf(bp, len)
* Free the io map PTEs associated with this IO operation.
* We also invalidate the TLB entries and restore the original b_addr.
*/
+void
vunmapbuf(bp, len)
struct buf *bp;
vm_size_t len;
diff --git a/sys/arch/alpha/compile/build_all b/sys/arch/alpha/compile/build_all
index a0a470cd77d..abd8fe68ac8 100644
--- a/sys/arch/alpha/compile/build_all
+++ b/sys/arch/alpha/compile/build_all
@@ -1,15 +1,33 @@
#!/bin/sh -
+#
+# $NetBSD: build_all,v 1.4.4.1 1996/06/15 03:46:17 cgd Exp $
-dirlist=`find . -type d ! \( -name . -o -name CVS \) -prune | \
- sed -e s,./,, | sort`
+cflist=`cd ../conf ; find . -type f ! -name "*[a-z.]*" ! -name ".*" | \
+ sed -e 's,^\./,,'`
-for dir in $dirlist; do
- echo === $dir
- echo ""
- echo "***"
- echo ""
- (cd $dir ; time make -k)
- echo ""
- echo "***"
+docmd()
+{
+
+ echo " ===> $*"
+# echo " eval ($*)"
+ eval "($*)"
+ echo " <==="
+}
+
+docf()
+{
+ echo "===> $1"
+ (
+ docmd "cd ../conf ; config $cf"
+ cd $cf
+ docmd "time make -k clean"
+ docmd "time make -k depend"
+ docmd "time make -k"
+ )
+ echo "<==="
echo ""
+}
+
+for cf in $cflist; do
+ docf $cf
done
diff --git a/sys/arch/alpha/compile/rebuild_all b/sys/arch/alpha/compile/rebuild_all
index fd619a5bcd5..2a0fa61fbc5 100644
--- a/sys/arch/alpha/compile/rebuild_all
+++ b/sys/arch/alpha/compile/rebuild_all
@@ -1,23 +1,33 @@
#!/bin/sh -
+#
+# $NetBSD: rebuild_all,v 1.4.4.1 1996/06/15 03:46:19 cgd Exp $
-dirlist=`find . -type d ! \( -name . -o -name CVS \) -prune | \
- sed -e s,./,, | sort`
+cflist=`cd ../conf ; find . -type f ! -name "*[a-z.]*" ! -name ".*" | \
+ sed -e 's,^\./,,'`
-for dir in $dirlist; do
- echo === $dir
- echo ""
- echo "***"
- echo ""
- (cd $dir ; time make -k clean)
- echo ""
- echo "***"
- echo ""
- (cd $dir ; time make -k depend)
- echo ""
- echo "***"
- echo ""
- (cd $dir ; time make -k)
- echo ""
- echo "***"
- echo ""
+docmd()
+{
+
+ echo " ===> $*"
+# echo " eval ($*)"
+ eval "($*)"
+ echo " <==="
+}
+
+docf()
+{
+ echo "===> $1"
+ (
+ # docmd "cd ../conf ; config $cf"
+ cd $cf
+ # docmd "time make -k clean"
+ # docmd "time make -k depend"
+ docmd "time make -k"
+ )
+ echo "<==="
+ echo ""
+}
+
+for cf in $cflist; do
+ docf $cf
done
diff --git a/sys/arch/alpha/conf/ALPHA b/sys/arch/alpha/conf/ALPHA
index 73989072623..7bbfb44cfae 100644
--- a/sys/arch/alpha/conf/ALPHA
+++ b/sys/arch/alpha/conf/ALPHA
@@ -1,4 +1,4 @@
-# $NetBSD: ALPHA,v 1.8 1995/12/20 00:14:10 cgd Exp $
+# $NetBSD: ALPHA,v 1.14.4.4 1996/06/13 19:21:59 cgd Exp $
#
# Alpha kernel with all the options you'd want, and more.
@@ -6,9 +6,6 @@ include "std.alpha"
maxusers 8
-# does not really do anything anymore, but this replaces "ident GENERIC"
-options GENERIC
-
# CPU Support
options DEC_3000_500 # Flamingo etc: 3000/[4-9]00*
options DEC_3000_300 # Pelican etc: 3000/300*
@@ -41,8 +38,9 @@ options NULLFS # Null file system layer
options KERNFS # Kernel variable file system (/kern)
options FDESC # File descriptor file system (/dev/fd)
options PORTAL # Portal file system
-options UMAP # User-mapping file system layer
+options UMAPFS # User-mapping file system layer
options PROCFS # Process file system (/proc)
+options UNION # union file system
# Networking options
options INET # Internet protocol suite
@@ -60,6 +58,7 @@ options COMPAT_43
# Binary compatibility with previous versions of NetBSD.
#options COMPAT_09
options COMPAT_10
+options COMPAT_11
# OSF/1 binary compatibility -- CURRENTLY DOES NOT WORK
#options COMPAT_OSF1
@@ -98,14 +97,17 @@ tc* at tcasic?
# TurboChannel devices
ioasic0 at tc? slot ? offset ?
-clock0 at ioasic? offset ?
-le0 at ioasic? offset ?
+mcclock0 at ioasic? offset ?
+le* at ioasic? offset ?
scc0 at ioasic? offset ?
scc1 at ioasic? offset ?
tcds0 at tc? slot ? offset ?
esp0 at tcds? slot ?
esp1 at tcds? slot ?
-#sfb* at tc? slot ? offset ?
+cfb* at tc? slot ? offset ?
+sfb* at tc? slot ? offset ?
+le* at tc? slot ? offset ?
+fta* at tc? slot ? offset ? # DEC DEFTA FDDI cards
# PCI host bus adapter support
apecs* at mainbus?
@@ -120,12 +122,14 @@ pci* at ppb?
# PCI devices
de* at pci?
+le* at pci?
ncr* at pci?
pceb* at pci?
pcivga* at pci?
ppb* at pci?
sio* at pci?
tga* at pci?
+fpa* at pci? dev ? function ? # DEC DEFPA FDDI cards
# ISA/EISA bus support
isa* at pceb?
@@ -133,14 +137,17 @@ eisa* at pceb?
isa* at sio?
# ISA devices
-clock0 at isa? port 0x70
+mcclock0 at isa? port 0x70
pckbd0 at isa? port 0x60 irq 1 # PC-ish ISA keyboard
-#pms0 at isa? port 0x60 irq 12 # PS/2 auxiliary
+pms0 at isa? port 0x60 irq 12 # PS/2 auxiliary
com0 at isa? port 0x3f8 irq 4 # standard serial ports
com1 at isa? port 0x2f8 irq 3
lpt0 at isa? port 0x3bc irq 7 # standard parallel port
#wss0 at isa? port 0x530 irq 9 drq 0 # Windows Sound System
+# EISA devices
+fea* at eisa? slot ? # DEC DEFEA FDDI cards
+
# SCSI bus support
scsibus* at esp?
scsibus* at ncr?
@@ -150,10 +157,17 @@ sd* at scsibus? target ? lun ?
st* at scsibus? target ? lun ?
cd* at scsibus? target ? lun ?
-pseudo-device bpfilter
+# Workstation Console attachments
+wscons* at cfb?
+wscons* at pcivga?
+wscons* at sfb?
+wscons* at tga?
+
+pseudo-device bpfilter 16
pseudo-device loop
-pseudo-device ppp
-pseudo-device pty
-pseudo-device sl
-pseudo-device tun
-pseudo-device vnd
+pseudo-device ppp 4
+pseudo-device pty 64
+pseudo-device sl 4
+pseudo-device strip 4
+pseudo-device tun 4
+pseudo-device vnd 4
diff --git a/sys/arch/alpha/conf/BUNNY b/sys/arch/alpha/conf/BUNNY
index aed65576e7e..61a913773a8 100644
--- a/sys/arch/alpha/conf/BUNNY
+++ b/sys/arch/alpha/conf/BUNNY
@@ -1,13 +1,9 @@
-# $NetBSD: BUNNY,v 1.3 1995/11/23 02:34:55 cgd Exp $
+# $NetBSD: BUNNY,v 1.5.4.1 1996/06/13 19:22:03 cgd Exp $
#
# Kernel for bunnahabhain.pdl.cs.cmu.edu.
#
-# This kernel contains support for NO frame buffer devices; bunny
-# is rack-mounted, and has no video boards. THIS KERNEL CANNOT BE
-# USED ON MACHINES WITH FRAME BUFFERS.
-#
-# It also has no support for devices which aren't actually used
-# (sound, parallel port, keyboard, mouse, SCSI tape or CD-ROM, etc.).
+# Trimmed down kernel for AlphaStation [24]xx systems, with lots
+# of buffer cache.
include "std.alpha"
@@ -42,7 +38,9 @@ options INET # Internet protocol suite
options COMPAT_43
# Binary compatibility with previous versions of NetBSD.
+#options COMPAT_09
options COMPAT_10
+options COMPAT_11
# Loadable Kernel Modules
options LKM
@@ -53,7 +51,7 @@ options LKM
# Misc. options
options PCIVERBOSE # recognize "unknown" PCI devices
-config netbsd root on sd0 swap on sd0
+config netbsd swap generic
mainbus0 at root
cpu* at mainbus0
@@ -66,23 +64,36 @@ pci* at apecs?
# PCI devices
de* at pci?
-ncr0 at pci?
+ncr* at pci?
+pcivga* at pci?
sio* at pci?
+tga* at pci?
# ISA/EISA bus support
isa* at sio?
# ISA devices
-clock0 at isa? port 0x70
+mcclock0 at isa? port 0x70
+pckbd0 at isa? port 0x60 irq 1 # PC-ish ISA keyboard
+pms0 at isa? port 0x60 irq 12 # PS/2 auxiliary
com0 at isa? port 0x3f8 irq 4 # standard serial ports
com1 at isa? port 0x2f8 irq 3
+lpt0 at isa? port 0x3bc irq 7 # standard parallel port
+#wss0 at isa? port 0x530 irq 9 drq 0 # Windows Sound System
# SCSI bus support
scsibus* at ncr?
# SCSI devices
sd* at scsibus? target ? lun ?
+st* at scsibus? target ? lun ?
+cd* at scsibus? target ? lun ?
+
+# Workstation Console attachments
+wscons* at pcivga?
+wscons* at tga?
-pseudo-device bpfilter
+pseudo-device bpfilter 16
pseudo-device loop
-pseudo-device pty
+pseudo-device pty 64
+pseudo-device vnd 4
diff --git a/sys/arch/alpha/conf/DILLY b/sys/arch/alpha/conf/DILLY
deleted file mode 100644
index b8236ee54ba..00000000000
--- a/sys/arch/alpha/conf/DILLY
+++ /dev/null
@@ -1,96 +0,0 @@
-# $NetBSD: DILLY,v 1.1 1995/11/23 02:34:58 cgd Exp $
-#
-# Kernel for dilrod.nas.nasa.gov, and AlphaStation 600.
-
-include "std.alpha"
-
-maxusers 16
-
-# bump up the number of buffers, for quicker compiles
-options BUFPAGES=2048 # 16M of buffer cache
-
-# CPU Support
-options DEC_KN20AA # KN20AA: AlphaStation 600
-
-# needs to be set per system
-options TIMEZONE="5*60" # Minutes west of GMT (for param.c)
-options DST=1 # Daylight savings rules (for param.c)
-
-# Standard system options
-options SWAPPAGER, VNODEPAGER, DEVPAGER # Paging (mandatory)
-options DEBUG, DIAGNOSTIC # Extra kernel debugging
-options KTRACE # System call tracing support
-
-# File system options
-options FIFO # POSIX fifo support (in all file systems)
-options FFS # Fast file system
-options MFS # Memory-based file system
-options NFSCLIENT # Sun NFS-compatible file system client
-
-# Networking options
-options INET # Internet protocol suite
-
-# 4.3BSD compatibility. Should be optional, but necessary for now.
-options COMPAT_43
-
-# Binary compatibility with previous versions of NetBSD.
-options COMPAT_10
-
-# Loadable Kernel Modules
-options LKM
-
-# Disable kernel security.
-#options INSECURE
-
-# Misc. options
-options PCIVERBOSE # recognize "unknown" PCI devices
-
-config netbsd root on sd0 swap on sd0
-
-mainbus0 at root
-cpu* at mainbus0
-
-# PCI host bus adapter support
-cia* at mainbus?
-
-# PCI bus support
-pci0 at cia?
-pci* at ppb?
-
-# PCI devices
-de* at pci?
-ncr0 at pci0 dev 9
-ncr* at pci?
-pceb* at pci?
-pcivga* at pci?
-ppb* at pci?
-tga* at pci?
-
-# ISA and EISA bus support
-isa* at pceb?
-eisa* at pceb?
-
-# ISA devices
-clock0 at isa? port 0x70
-pckbd0 at isa? port 0x60 irq 1 # PC-ish ISA keyboard
-#pms0 at isa? port 0x60 irq 12 # PS/2 auxiliary
-com0 at isa? port 0x3f8 irq 4 # standard serial ports
-com1 at isa? port 0x2f8 irq 3
-lpt0 at isa? port 0x3bc irq 7 # standard parallel port
-#wss0 at isa? port 0x530 irq 9 drq 0 # Windows Sound System
-
-# SCSI bus support
-scsibus0 at ncr0
-scsibus* at ncr?
-
-# SCSI devices
-sd0 at scsibus0 target 1 lun 0
-sd* at scsibus? target ? lun ?
-st* at scsibus? target ? lun ?
-cd* at scsibus? target ? lun ?
-
-pseudo-device bpfilter
-pseudo-device loop
-pseudo-device pty
-pseudo-device sl
-pseudo-device vnd
diff --git a/sys/arch/alpha/conf/GENERIC b/sys/arch/alpha/conf/GENERIC
index cd7717859b8..efd66410efd 100644
--- a/sys/arch/alpha/conf/GENERIC
+++ b/sys/arch/alpha/conf/GENERIC
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.10 1995/12/20 00:14:14 cgd Exp $
+# $NetBSD: GENERIC,v 1.15.4.3 1996/06/13 19:22:07 cgd Exp $
#
# Generic Alpha kernel. Enough to get booted, etc., but not much more.
@@ -6,9 +6,6 @@ include "std.alpha"
maxusers 8
-# does not really do anything anymore, but this replaces "ident GENERIC"
-options GENERIC
-
# CPU Support
options DEC_3000_500 # Flamingo etc: 3000/[4-9]00*
options DEC_3000_300 # Pelican etc: 3000/300*
@@ -40,7 +37,9 @@ options INET # Internet protocol suite
options COMPAT_43
# Binary compatibility with previous versions of NetBSD.
+#options COMPAT_09
options COMPAT_10
+options COMPAT_11
# OSF/1 binary compatibility -- CURRENTLY DOES NOT WORK
#options COMPAT_OSF1
@@ -54,7 +53,9 @@ options LKM
# Misc. options
options PCIVERBOSE # recognize "unknown" PCI devices
-config netbsd swap generic
+config netbsd swap generic
+#config netbsd root on sd0 swap on sd0
+#config netbsd root nfs swap nfs
mainbus0 at root
cpu* at mainbus0
@@ -67,14 +68,17 @@ tc* at tcasic?
# TurboChannel devices
ioasic0 at tc? slot ? offset ?
-clock0 at ioasic? offset ?
-le0 at ioasic? offset ?
+mcclock0 at ioasic? offset ?
+le* at ioasic? offset ?
scc0 at ioasic? offset ?
scc1 at ioasic? offset ?
tcds0 at tc? slot ? offset ?
esp0 at tcds? slot ?
esp1 at tcds? slot ?
-#sfb* at tc? slot ? offset ?
+cfb* at tc? slot ? offset ?
+sfb* at tc? slot ? offset ?
+le* at tc? slot ? offset ?
+fta* at tc? slot ? offset ? # DEC DEFTA FDDI cards
# PCI host bus adapter support
apecs* at mainbus?
@@ -89,12 +93,14 @@ pci* at ppb?
# PCI devices
de* at pci?
+le* at pci?
ncr* at pci?
pceb* at pci?
pcivga* at pci?
ppb* at pci?
sio* at pci?
tga* at pci?
+fpa* at pci? dev ? function ? # DEC DEFPA FDDI cards
# ISA/EISA bus support
isa* at pceb?
@@ -102,14 +108,17 @@ eisa* at pceb?
isa* at sio?
# ISA devices
-clock0 at isa? port 0x70
+mcclock0 at isa? port 0x70
pckbd0 at isa? port 0x60 irq 1 # PC-ish ISA keyboard
-#pms0 at isa? port 0x60 irq 12 # PS/2 auxiliary
+pms0 at isa? port 0x60 irq 12 # PS/2 auxiliary
com0 at isa? port 0x3f8 irq 4 # standard serial ports
com1 at isa? port 0x2f8 irq 3
lpt0 at isa? port 0x3bc irq 7 # standard parallel port
#wss0 at isa? port 0x530 irq 9 drq 0 # Windows Sound System
+# EISA devices
+fea* at eisa? slot ? # DEC DEFEA FDDI cards
+
# SCSI bus support
scsibus* at esp?
scsibus* at ncr?
@@ -118,12 +127,15 @@ scsibus* at ncr?
sd* at scsibus? target ? lun ?
st* at scsibus? target ? lun ?
cd* at scsibus? target ? lun ?
-ch* at scsibus? target ? lun ?
-ss* at scsibus? target ? lun ?
-uk* at scsibus? target ? lun ?
-pseudo-device bpfilter
+# Workstation Console attachments
+wscons* at cfb?
+wscons* at pcivga?
+wscons* at sfb?
+wscons* at tga?
+
+pseudo-device bpfilter 16
pseudo-device loop
-pseudo-device pty
-pseudo-device sl
-pseudo-device vnd
+pseudo-device pty 64
+pseudo-device sl 4
+pseudo-device vnd 4
diff --git a/sys/arch/alpha/conf/GENERIC_NFS b/sys/arch/alpha/conf/GENERIC_NFS
deleted file mode 100644
index cb7f540af64..00000000000
--- a/sys/arch/alpha/conf/GENERIC_NFS
+++ /dev/null
@@ -1,123 +0,0 @@
-# $NetBSD: GENERIC_NFS,v 1.4 1995/12/20 00:14:16 cgd Exp $
-#
-# Generic Alpha kernel. Enough to get booted, etc., but not much more.
-
-include "std.alpha"
-
-maxusers 8
-
-# CPU Support
-options DEC_3000_500 # Flamingo etc: 3000/[4-9]00*
-options DEC_3000_300 # Pelican etc: 3000/300*
-options DEC_2100_A50 # Avanti etc: AlphaStation 400, 200, etc.
-options DEC_KN20AA # KN20AA: AlphaStation 600
-options DEC_AXPPCI_33 # NoName: AXPpci33, etc.
-#options DEC_2000_300 # "Jensen": 2000/300 (DECpc AXP 150)
-
-# needs to be set per system
-options TIMEZONE="5*60" # Minutes west of GMT (for param.c)
-options DST=1 # Daylight savings rules (for param.c)
-
-# Standard system options
-options SWAPPAGER, VNODEPAGER, DEVPAGER # Paging (mandatory)
-options DEBUG, DIAGNOSTIC # Extra kernel debugging
-options KTRACE # System call tracing support
-
-# File system options
-options FIFO # POSIX fifo support (in all file systems)
-options FFS # Fast file system
-options MFS # Memory-based file system
-options NFSSERVER # Sun NFS-compatible file system server
-options NFSCLIENT # Sun NFS-compatible file system client
-
-# Networking options
-options INET # Internet protocol suite
-
-# 4.3BSD compatibility. Should be optional, but necessary for now.
-options COMPAT_43
-
-# Binary compatibility with previous versions of NetBSD.
-options COMPAT_10
-
-# OSF/1 binary compatibility -- CURRENTLY DOES NOT WORK
-#options COMPAT_OSF1
-
-# Loadable Kernel Modules
-options LKM
-
-# Disable kernel security.
-#options INSECURE
-
-# Misc. options
-options PCIVERBOSE # recognize "unknown" PCI devices
-
-config netbsd_nfs root on nfs swap on nfs
-
-mainbus0 at root
-cpu* at mainbus0
-
-# TurboChannel host bus adapter support
-tcasic* at mainbus0
-
-# TurboChannel bus support
-tc* at tcasic?
-
-# TurboChannel devices
-ioasic0 at tc? slot ? offset ?
-clock0 at ioasic? offset ?
-le0 at ioasic? offset ?
-scc0 at ioasic? offset ?
-scc1 at ioasic? offset ?
-tcds0 at tc? slot ? offset ?
-esp0 at tcds? slot ?
-esp1 at tcds? slot ?
-#sfb* at tc? slot ? offset ?
-
-# PCI host bus adapter support
-apecs* at mainbus?
-cia* at mainbus?
-lca* at mainbus?
-
-# PCI bus support
-pci* at apecs?
-pci* at cia?
-pci* at lca?
-pci* at ppb?
-
-# PCI devices
-de* at pci?
-ncr* at pci?
-pceb* at pci?
-pcivga* at pci?
-ppb* at pci?
-sio* at pci?
-tga* at pci?
-
-# ISA/EISA bus support
-isa* at pceb?
-eisa* at pceb?
-isa* at sio?
-
-# ISA devices
-clock0 at isa? port 0x70
-pckbd0 at isa? port 0x60 irq 1 # PC-ish ISA keyboard
-#pms0 at isa? port 0x60 irq 12 # PS/2 auxiliary
-com0 at isa? port 0x3f8 irq 4 # standard serial ports
-com1 at isa? port 0x2f8 irq 3
-lpt0 at isa? port 0x3bc irq 7 # standard parallel port
-#wss0 at isa? port 0x530 irq 9 drq 0 # Windows Sound System
-
-# SCSI bus support
-scsibus* at esp?
-scsibus* at ncr?
-
-# SCSI devices
-sd* at scsibus? target ? lun ?
-st* at scsibus? target ? lun ?
-cd* at scsibus? target ? lun ?
-
-pseudo-device bpfilter
-pseudo-device loop
-pseudo-device pty
-pseudo-device sl
-pseudo-device vnd
diff --git a/sys/arch/alpha/conf/JURA b/sys/arch/alpha/conf/JURA
index 9de2fa3bf2d..b1b6db317b3 100644
--- a/sys/arch/alpha/conf/JURA
+++ b/sys/arch/alpha/conf/JURA
@@ -1,6 +1,8 @@
-# $NetBSD: JURA,v 1.4 1995/11/23 02:35:09 cgd Exp $
+# $NetBSD: JURA,v 1.6.4.1 1996/06/13 19:22:10 cgd Exp $
#
# Kernel for jura.pdl.cs.cmu.edu.
+#
+# THIS KERNEL DOES NOT CURRENTLY WORK, OR EVEN CONFIGURE!
include "std.alpha"
@@ -33,7 +35,9 @@ options INET # Internet protocol suite
options COMPAT_43
# Binary compatibility with previous versions of NetBSD.
+#options COMPAT_09
options COMPAT_10
+options COMPAT_11
# Loadable Kernel Modules
options LKM
@@ -47,9 +51,9 @@ ibus* at mainbus0 # "internal bus"
jcombo* at ibus? # the VLSI combo chip
isa* at jcombo?
-clock0 at isa? port 0x70
+mcclock0 at isa? port 0x70
pckbd0 at isa? port 0x60 irq 1 # PC-ish ISA keyboard
-#pms0 at isa? port 0x60 irq 12 # PS/2 auxiliary
+pms0 at isa? port 0x60 irq 12 # PS/2 auxiliary
com0 at isa? port 0x3f8 irq 4 # standard serial ports
com1 at isa? port 0x2f8 irq 3
lpt0 at isa? port 0x3bc irq 7 # standard parallel port
diff --git a/sys/arch/alpha/conf/Makefile.alpha b/sys/arch/alpha/conf/Makefile.alpha
index b09846200a3..51acb060228 100644
--- a/sys/arch/alpha/conf/Makefile.alpha
+++ b/sys/arch/alpha/conf/Makefile.alpha
@@ -1,15 +1,15 @@
-# $NetBSD: Makefile.alpha,v 1.8 1995/11/23 02:35:16 cgd Exp $
-#
+# $NetBSD: Makefile.alpha,v 1.16 1996/05/19 21:16:51 cgd Exp $
+
# Makefile for NetBSD
#
# This makefile is constructed from a machine description:
# config machineid
# Most changes should be made in the machine description
-# /sys/conf/``machineid''
+# /sys/arch/alpha/conf/``machineid''
# after which you should do
-# config machineid
+# config machineid
# Machine generic makefile changes should be made in
-# /sys/conf/Makefile.``machinetype''
+# /sys/arch/alpha/conf/Makefile.alpha
# after which config should be rerun for all machines of that type.
#
# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
@@ -22,21 +22,21 @@
# PROF is set to -pg if profiling.
AS?= as
-AWK?= awk
CC?= cc
CPP?= cpp
LD?= ld
+STRIP?= strip -g -X -x
TOUCH?= touch -f -c
# source tree is located via $S relative to the compilation directory
S= ../../../..
ALPHA= ../..
-INCLUDES= -I. -I$S/arch -I$S -I$S/sys
-COPTS= ${INCLUDES} ${IDENT} -D_KERNEL
-CFLAGS= -Werror -fno-builtin -mno-fp-regs ${DEBUG} ${COPTS} -Dalpha
-#CFLAGS+=-Wmissing-prototypes -Wmissing-declarations
-AFLAGS= ${COPTS}
+INCLUDES= -I. -I$S/arch -I$S
+CPPFLAGS= ${INCLUDES} ${IDENT} -D_KERNEL -Dalpha
+CFLAGS= ${DEBUG} -O2 -Werror -mno-fp-regs
+AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE
+LINKFLAGS= -N -Ttext fffffc0000230000 -e __start -G 4
### find out what to use for libkern
.include "$S/lib/libkern/Makefile.inc"
@@ -59,103 +59,115 @@ LIBCOMPAT= ${COMPATLIB_PROF}
# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
# is marked as config-dependent.
-NORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $<
-NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
-NORMAL_S= rm -f $*.c; ln -s $< $*.c; \
- ${CC} ${AFLAGS} -I${ALPHA}/alpha -E $*.c > $*.i; \
- ${AS} -o $@ $*.i; rm -f $*.c $*.i
-NORMAL_S_C= rm -f $*.c; ln -s $< $*.c; \
- ${CC} ${AFLAGS} ${PARAM} -I${ALPHA}/alpha -E $*.c > $*.i; \
- ${AS} -o $@ $*.i; rm -f $*.c $*.i
+NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
+NORMAL_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
+
+DRIVER_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
+DRIVER_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
+
+NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $<
+NORMAL_S_C= ${CC} ${AFLAGS} ${CPPFLAGS} ${PARAM} -c $<
%OBJS
%CFILES
+%SFILES
+
# load lines for config "xxx" will be emitted as:
# xxx: ${SYSTEM_DEP} swapxxx.o
# ${SYSTEM_LD_HEAD}
# ${SYSTEM_LD} swapxxx.o
# ${SYSTEM_LD_TAIL}
-DEBUG?=
-.if ${DEBUG} == "-g"
-LDX=-X
-.else
-LDX=-x
-.endif
-LDFLAGS= ${LDX} -G 4 -N -e __start -Ttext fffffc0000230000
-SYSTEM_OBJ= locore.o ${OBJS} param.o ioconf.o ${LIBKERN} \
- ${LIBCOMPAT}
+SYSTEM_OBJ= locore.o \
+ param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
SYSTEM_DEP= Makefile ${SYSTEM_OBJ}
-SYSTEM_LD_HEAD= @echo loading $@; rm -f $@
-SYSTEM_LD= -@echo ${LD} ${LDFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o ${XXX}; \
- ${LD} ${LDFLAGS} -o $@ ${SYSTEM_OBJ} vers.o ${XXX}
+SYSTEM_LD_HEAD= @rm -f $@
+SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
+ ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
SYSTEM_LD_TAIL= @size $@; chmod 755 $@
+
+DEBUG?=
.if ${DEBUG} == "-g"
-.if 0
-SYSTEM_LD_TAIL+=; echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
- echo strip -d $@; strip -d $@
+LINKFLAGS+= -X
+SYSTEM_LD_TAIL+=; \
+ echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
+ echo ${STRIP} $@; ${STRIP} $@
.else
-SYSTEM_LD_TAIL+=; echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
- echo strip -g -X -x $@; strip -g -X -x $@
-.endif
+LINKFLAGS+= -x
.endif
%LOAD
-newvers:
- sh $S/conf/newvers.sh
- ${CC} ${CFLAGS} -c vers.c
+assym.h: genassym
+ ./genassym >assym.h
-clean::
- rm -f eddep *netbsd netbsd.gdb tags tags1 *.[io] \
- [a-z]*.s Errs errs linterrs makelinks genassym
+genassym: genassym.o
+ ${CC} -o $@ genassym.o
+
+genassym.o: ${ALPHA}/alpha/genassym.c
+ ${NORMAL_C_C}
+
+param.c: $S/conf/param.c
+ rm -f param.c
+ cp $S/conf/param.c .
+param.o: param.c Makefile
+ ${NORMAL_C_C}
-locore.o: ${ALPHA}/alpha/locore.s ${ALPHA}/alpha/pal.s \
- ${ALPHA}/alpha/prom_disp.s ${ALPHA}/include/intrcnt.h assym.s
- ${NORMAL_S_C}
+ioconf.o: ioconf.c
+ ${NORMAL_C}
-# depend on maxusers
-assym.s: Makefile
+newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
+ sh $S/conf/newvers.sh
+ ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
-./assym.s: assym.s
-assym.s: genassym
- ./genassym >assym.s
-genassym: genassym.o
- ${CC} -o $@ genassym.o
+clean::
+ rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
+ [Ee]rrs linterrs makelinks genassym genassym.o assym.h
-genassym.o: ${ALPHA}/alpha/genassym.c
- ${CC} -c ${CFLAGS} ${PARAM} $<
+lint:
+ @lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} ${PARAM} -UKGDB \
+ ${ALPHA}/alpha/Locore.c ${CFILES} ${ALPHA}/alpha/swapgeneric.c \
+ ioconf.c param.c | \
+ grep -v 'static function .* unused'
-SRCS= ${CFILES} ${ALPHA}/alpha/genassym.c ioconf.c param.c
-depend: .depend
-.depend: ${SRCS} assym.s
- mkdep ${COPTS} ${SRCS}
- mkdep -a -p ${COPTS} ${ALPHA}/alpha/genassym.c
+tags:
+ @echo "see $S/kern/Makefile for tags"
links:
egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
sort -u | comm -23 - dontlink | \
- sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
+ sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
sh makelinks && rm -f dontlink
-tags: depend
- sh $S/conf/systags.sh
- rm -f tags1
- sed -e 's, ../, ,' tags > tags1
+SRCS= ${ALPHA}/alpha/locore.s \
+ param.c ioconf.c ${CFILES} ${SFILES}
+depend:: .depend
+.depend: ${SRCS} assym.h param.c
+ mkdep ${AFLAGS} ${CPPFLAGS} ${ALPHA}/alpha/locore.s
+ mkdep -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
+ mkdep -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
+ mkdep -a ${CFLAGS} ${CPPFLAGS} ${PARAM} ${ALPHA}/alpha/genassym.c
-ioconf.o: ioconf.c
- ${CC} -c ${CFLAGS} ioconf.c
-param.c: $S/conf/param.c
- rm -f param.c
- cp $S/conf/param.c .
+# depend on root or device configuration
+autoconf.o conf.o: Makefile
+
+# depend on network or filesystem configuration
+uipc_proto.o vfs_conf.o: Makefile
-param.o: param.c Makefile
- ${CC} -c ${CFLAGS} ${PARAM} param.c
+# depend on maxusers
+genassym.o machdep.o: Makefile
+
+# depend on CPU configuration
+clock.o machdep.o apecs.o cia.o lca.o ioasic.o scc.o icasic.o: Makefile
+
+
+locore.o: ${ALPHA}/alpha/locore.s assym.h
+ ${NORMAL_S}
%RULES
diff --git a/sys/arch/alpha/conf/NONAME b/sys/arch/alpha/conf/NONAME
deleted file mode 100644
index 9bbe12ec924..00000000000
--- a/sys/arch/alpha/conf/NONAME
+++ /dev/null
@@ -1,89 +0,0 @@
-# $NetBSD: NONAME,v 1.1 1995/11/23 02:35:20 cgd Exp $
-#
-# Should work on AXPpci33's (and maybe other AXPpci machines).
-
-include "std.alpha"
-
-maxusers 8
-
-# CPU Support
-options DEC_AXPPCI_33 # NoName: AXPpci33, etc.
-
-# needs to be set per system
-options TIMEZONE="5*60" # Minutes west of GMT (for param.c)
-options DST=1 # Daylight savings rules (for param.c)
-
-# Standard system options
-options SWAPPAGER, VNODEPAGER, DEVPAGER # Paging (mandatory)
-options DEBUG, DIAGNOSTIC # Extra kernel debugging
-options KTRACE # System call tracing support
-
-# File system options
-options FIFO # POSIX fifo support (in all file systems)
-options FFS # Fast file system
-options MFS # Memory-based file system
-options NFSCLIENT # Sun NFS-compatible file system client
-
-# Networking options
-options INET # Internet protocol suite
-
-# 4.3BSD compatibility. Should be optional, but necessary for now.
-options COMPAT_43
-
-# Binary compatibility with previous versions of NetBSD.
-options COMPAT_10
-
-# Loadable Kernel Modules
-options LKM
-
-# Disable kernel security.
-#options INSECURE
-
-# Misc. options
-options PCIVERBOSE # recognize "unknown" PCI devices
-
-config netbsd root on sd0 swap on sd0
-
-mainbus0 at root
-cpu* at mainbus0
-
-# PCI host bus adapter support
-lca* at mainbus?
-
-# PCI bus support
-pci* at lca?
-pci* at ppb?
-
-# PCI devices
-de* at pci?
-ncr* at pci?
-pcivga* at pci?
-ppb* at pci?
-sio* at pci?
-tga* at pci?
-
-# ISA/EISA bus support
-isa* at sio?
-
-# ISA devices
-clock0 at isa? port 0x70
-pckbd0 at isa? port 0x60 irq 1 # PC-ish ISA keyboard
-#pms0 at isa? port 0x60 irq 12 # PS/2 auxiliary
-com0 at isa? port 0x3f8 irq 4 # standard serial ports
-com1 at isa? port 0x2f8 irq 3
-lpt0 at isa? port 0x3bc irq 7 # standard parallel port
-#wss0 at isa? port 0x530 irq 9 drq 0 # Windows Sound System
-
-# SCSI bus support
-scsibus* at ncr?
-
-# SCSI devices
-sd* at scsibus? target ? lun ?
-st* at scsibus? target ? lun ?
-cd* at scsibus? target ? lun ?
-
-pseudo-device bpfilter
-pseudo-device loop
-pseudo-device pty
-pseudo-device sl
-pseudo-device vnd
diff --git a/sys/arch/alpha/conf/MACALLAN b/sys/arch/alpha/conf/NOSY
index 2dfff09b113..bfd0d654f4c 100644
--- a/sys/arch/alpha/conf/MACALLAN
+++ b/sys/arch/alpha/conf/NOSY
@@ -1,6 +1,7 @@
-# $NetBSD: MACALLAN,v 1.7 1995/12/20 00:14:17 cgd Exp $
+# $NetBSD: NOSY,v 1.5.4.2 1996/06/13 19:22:15 cgd Exp $
+#
+# Jason's DEC 3000/400 in the lab...
#
-# Kernel for macallan.dssc.cs.cmu.edu.
include "std.alpha"
@@ -10,7 +11,7 @@ maxusers 8
options DEC_3000_500 # Flamingo etc: 3000/[4-9]00*
# needs to be set per system
-options TIMEZONE="5*60" # Minutes west of GMT (for param.c)
+options TIMEZONE="8*60" # Minutes west of GMT (for param.c)
options DST=1 # Daylight savings rules (for param.c)
# Standard system options
@@ -22,7 +23,9 @@ options KTRACE # System call tracing support
options FIFO # POSIX fifo support (in all file systems)
options FFS # Fast file system
options MFS # Memory-based file system
+options NFSSERVER # Sun NFS-compatible file system server
options NFSCLIENT # Sun NFS-compatible file system client
+options UNION # Union filesystem
# Networking options
options INET # Internet protocol suite
@@ -31,12 +34,20 @@ options INET # Internet protocol suite
options COMPAT_43
# Binary compatibility with previous versions of NetBSD.
+#options COMPAT_09
options COMPAT_10
+options COMPAT_11
+
+# OSF/1 binary compatibility -- CURRENTLY DOES NOT WORK
+#options COMPAT_OSF1
# Loadable Kernel Modules
options LKM
-config netbsd root on sd0 swap on sd0 and sd1
+# Disable kernel security.
+options INSECURE
+
+config netbsd swap generic
mainbus0 at root
cpu* at mainbus0
@@ -49,27 +60,27 @@ tc* at tcasic?
# TurboChannel devices
ioasic0 at tc? slot ? offset ?
-clock0 at ioasic? offset ?
-le0 at ioasic? offset ?
+mcclock0 at ioasic? offset ?
+le* at ioasic? offset ?
scc0 at ioasic? offset ?
scc1 at ioasic? offset ?
tcds0 at tc? slot ? offset ?
esp0 at tcds? slot ?
esp1 at tcds? slot ?
-#sfb* at tc? slot ? offset ?
+sfb* at tc? slot ? offset ?
+fta* at tc? slot ? offset ? # DEC DEFTA FDDI cards
# SCSI bus support
-scsibus0 at esp0
scsibus* at esp?
# SCSI devices
-sd0 at scsibus0 target 0 lun 0
sd* at scsibus? target ? lun ?
st* at scsibus? target ? lun ?
cd* at scsibus? target ? lun ?
-pseudo-device bpfilter
+# Workstation Console attachments
+wscons* at sfb?
+
+pseudo-device bpfilter 16
pseudo-device loop
-pseudo-device pty
-pseudo-device sl
-pseudo-device vnd
+pseudo-device pty 64
diff --git a/sys/arch/alpha/conf/TOMMY b/sys/arch/alpha/conf/TOMMY
deleted file mode 100644
index e97ca816a92..00000000000
--- a/sys/arch/alpha/conf/TOMMY
+++ /dev/null
@@ -1,91 +0,0 @@
-# $NetBSD: TOMMY,v 1.3 1995/11/25 01:32:34 cgd Exp $
-#
-# Kernel for tomintoul.pdl.cs.cmu.edu.
-# Should work on AlphaStation 400s and AlphaStation 200s
-
-include "std.alpha"
-
-maxusers 8
-
-# CPU Support
-options DEC_2100_A50 # Avanti etc: AlphaStation 400, 200, etc.
-
-# needs to be set per system
-options TIMEZONE="5*60" # Minutes west of GMT (for param.c)
-options DST=1 # Daylight savings rules (for param.c)
-
-# Standard system options
-options SWAPPAGER, VNODEPAGER, DEVPAGER # Paging (mandatory)
-options DEBUG, DIAGNOSTIC # Extra kernel debugging
-options KTRACE # System call tracing support
-
-# File system options
-options FIFO # POSIX fifo support (in all file systems)
-options FFS # Fast file system
-options MFS # Memory-based file system
-options NFSSERVER # Sun NFS-compatible file system server
-options NFSCLIENT # Sun NFS-compatible file system client
-
-# Networking options
-options INET # Internet protocol suite
-
-# 4.3BSD compatibility. Should be optional, but necessary for now.
-options COMPAT_43
-
-# Binary compatibility with previous versions of NetBSD.
-options COMPAT_10
-
-# Loadable Kernel Modules
-options LKM
-
-# Disable kernel security.
-#options INSECURE
-
-# Misc. options
-options PCIVERBOSE # recognize "unknown" PCI devices
-
-config netbsd root on sd0 swap on sd0
-
-mainbus0 at root
-cpu* at mainbus0
-
-# PCI host bus adapter support
-apecs* at mainbus?
-
-# PCI bus support
-pci* at apecs?
-pci* at ppb?
-
-# PCI devices
-de* at pci?
-ncr0 at pci?
-pcivga* at pci?
-ppb* at pci?
-sio* at pci?
-tga* at pci?
-
-# ISA/EISA bus support
-isa* at sio?
-
-# ISA devices
-clock0 at isa? port 0x70
-pckbd0 at isa? port 0x60 irq 1 # PC-ish ISA keyboard
-#pms0 at isa? port 0x60 irq 12 # PS/2 auxiliary
-com0 at isa? port 0x3f8 irq 4 # standard serial ports
-com1 at isa? port 0x2f8 irq 3
-lpt0 at isa? port 0x3bc irq 7 # standard parallel port
-#wss0 at isa? port 0x530 irq 9 drq 0 # Windows Sound System
-
-# SCSI bus support
-scsibus* at ncr?
-
-# SCSI devices
-sd* at scsibus? target ? lun ?
-st* at scsibus? target ? lun ?
-cd* at scsibus? target ? lun ?
-
-pseudo-device bpfilter
-pseudo-device loop
-pseudo-device pty
-pseudo-device sl
-pseudo-device vnd
diff --git a/sys/arch/alpha/conf/files.alpha b/sys/arch/alpha/conf/files.alpha
index ef97fad1a46..b3c8bf12b56 100644
--- a/sys/arch/alpha/conf/files.alpha
+++ b/sys/arch/alpha/conf/files.alpha
@@ -1,4 +1,4 @@
-# $NetBSD: files.alpha,v 1.9 1995/12/20 00:14:19 cgd Exp $
+# $NetBSD: files.alpha,v 1.19.4.2 1996/05/30 23:20:37 cgd Exp $
#
# alpha-specific configuration info
@@ -12,9 +12,11 @@ maxusers 2 8 64
# Bus-independent devices
#
-device mainbus at root { } # no locators (yet?)
+device mainbus { } # no locators (yet?)
+attach mainbus at root
-device cpu at mainbus { } # not really optional; can be a 'bus'
+device cpu { } # not really optional; can be a 'bus'
+attach cpu at mainbus
file arch/alpha/alpha/cpu.c cpu
@@ -29,30 +31,27 @@ major { sd = 8 }
#
-# ansi/sun console emulator
-#
-
-define ansicons
-file dev/pseudo/ansicons.c ansicons
-
-
-#
# raster console routines
#
+define raster
include "../../../dev/rcons/files.rcons"
-
-define rcons
-file dev/pseudo/rcons_init.c rcons
-file dev/pseudo/rcons_subr.c rcons
+file arch/alpha/wscons/wscons_rinit.c raster
+file arch/alpha/wscons/wscons_rops.c raster
#
# "Workstation Console" glue; attaches frame buffer to emulator & kbd.
-# XXX should be pseudo-device, with an ansicons attribute.
#
-define wsc # XXX should be pseudo-dev
-file arch/alpha/pci/wscons.c wsc needs-flag
+define wsconsdev {[console = -1]}
+device wscons
+attach wscons at wsconsdev
+file arch/alpha/wscons/wscons.c wscons needs-flag
+file arch/alpha/wscons/wscons_emul.c wscons
+
+file arch/alpha/wscons/event.c wscons
+file arch/alpha/wscons/kbd.c wscons
+file arch/alpha/wscons/ms.c wscons
#
@@ -61,44 +60,57 @@ file arch/alpha/pci/wscons.c wsc needs-flag
include "../../../dev/tc/files.tc"
-device tcasic at mainbus: tcbus
+device tcasic: tcbus
+attach tcasic at mainbus
file arch/alpha/tc/tcasic.c tcasic
-file arch/alpha/tc/tc_3000_500.c dec_3000_500
-file arch/alpha/tc/tc_3000_300.c dec_3000_300
+file arch/alpha/tc/tc_bus_io.c tcasic
+file arch/alpha/tc/tc_bus_mem.c tcasic
+file arch/alpha/tc/tc_3000_500.c tcasic & dec_3000_500
+file arch/alpha/tc/tc_3000_300.c tcasic & dec_3000_300
# the TurboChannel IOCTL ASIC
-device ioasic at tc { offset = -1 }
-file arch/alpha/tc/ioasic.c ioasic needs-flag
-
-# the TurboChannel clock (XXX)
-# device clock at ioasic # not really optional
-#file arch/alpha/alpha/clock.c clock
-
-# Smart Frame buffer (XXX NOT YET SUPPORTED)
-device sfb at tc
+device ioasic { offset = -1 }
+attach ioasic at tc
+file arch/alpha/tc/ioasic.c ioasic
+
+# Color Frame buffer
+device cfb: raster, wsconsdev
+attach cfb at tc
+file arch/alpha/tc/cfb.c cfb
+
+# Smart Frame buffer
+device sfb: raster, wsconsdev
+attach sfb at tc
file arch/alpha/tc/sfb.c sfb
# 8530 UARTs
-device scc at ioasic
+device scc
+attach scc at ioasic
file arch/alpha/tc/scc.c scc needs-count
# the TCDS ASIC
-device tcds at tc { slot = -1 }
+device tcds { slot = -1 }
+attach tcds at tc
file arch/alpha/tc/tcds.c tcds needs-count
# 53C[F]90 SCSI
-device esp at tcds: scsi
+device esp: scsi
+attach esp at tcds
file arch/alpha/tc/esp.c esp needs-count
file arch/alpha/tc/tcds_dma.c esp
# Baseboard Lance ethernet.
-device le at ioasic, tc: ether, ifnet
-file dev/tc/if_le.c le needs-flag # for le_iomem
+attach le at ioasic with le_ioasic
+attach le at tc with le_tc
+file dev/tc/if_le_dec.c (le_ioasic | le_tc)
+file dev/tc/if_le_ioasic.c le_ioasic needs-flag #for le_iomem
+file dev/tc/if_le_tc.c le_tc
#
# ISA Bus support
#
+include "../../../dev/pci/files.pci" # XXX some ISA devs are 'at pci' too.
include "../../../dev/isa/files.isa"
#file arch/alpha/isa/isafcns_jensen.c dec_2000_300
@@ -108,13 +120,15 @@ include "../../../dev/isa/files.isa"
# ISA Bus devices
#
-device ibus at mainbus { }
-device jcombo at ibus: isabus
-device jeisa at ibus: eisabus
+#device ibus at mainbus { }
+#device jcombo at ibus: isabus
+#device jeisa at ibus: eisabus
-device pckbd at isa
+device pckbd
+attach pckbd at isa
file arch/alpha/isa/pckbd.c pckbd needs-flag
-device pms at isa
+device pms
+attach pms at isa
file arch/alpha/isa/pms.c pms needs-flag
@@ -129,23 +143,28 @@ include "../../../dev/eisa/files.eisa"
# PCI Bus support
#
-include "../../../dev/pci/files.pci"
+# include "../../../dev/pci/files.pci" XXX SEE ABOVE
-device apecs at mainbus: pcibus
+device apecs: pcibus
+attach apecs at mainbus
file arch/alpha/pci/apecs.c apecs
-file arch/alpha/pci/apecs_isa.c apecs
file arch/alpha/pci/apecs_pci.c apecs
-device cia at mainbus: pcibus
-file arch/alpha/pci/cia.c cia
-file arch/alpha/pci/cia_isa.c cia
-file arch/alpha/pci/cia_pci.c cia
-
-device lca at mainbus: pcibus
+device lca: pcibus
+attach lca at mainbus
file arch/alpha/pci/lca.c lca
-file arch/alpha/pci/lca_isa.c lca
file arch/alpha/pci/lca_pci.c lca
+file arch/alpha/pci/apecs_lca_bus_io.c apecs | lca
+file arch/alpha/pci/apecs_lca_bus_mem.c apecs | lca
+
+device cia: pcibus
+attach cia at mainbus
+file arch/alpha/pci/cia.c cia
+file arch/alpha/pci/cia_bus_io.c cia
+file arch/alpha/pci/cia_bus_mem.c cia
+file arch/alpha/pci/cia_pci.c cia
+
file arch/alpha/pci/pci_2100_a50.c dec_2100_a50
file arch/alpha/pci/pci_kn20aa.c dec_kn20aa
file arch/alpha/pci/pci_axppci_33.c dec_axppci_33
@@ -157,15 +176,23 @@ file arch/alpha/pci/pci_axppci_33.c dec_axppci_33
file arch/alpha/pci/pci_machdep.c pci
-device sio at pci: isabus
-device pceb at pci: eisabus
-file arch/alpha/pci/sio.c sio pceb needs-flag
-file arch/alpha/pci/sio_pic.c sio pceb
+device sio: isabus
+attach sio at pci
+device pceb: isabus, eisabus
+attach pceb at pci
+file arch/alpha/pci/sio.c sio | pceb needs-flag
+file arch/alpha/pci/sio_pic.c sio | pceb
-device tga at pci: rcons, wsc, ansicons
+device tga: raster, wsconsdev
+attach tga at pci
file arch/alpha/pci/tga.c tga needs-flag
+file arch/alpha/pci/tga_conf.c tga
+file arch/alpha/pci/tga_bt463.c tga
+file arch/alpha/pci/tga_bt485.c tga
+
-device pcivga at pci: wsc, ansicons
+device pcivga: wsconsdev
+attach pcivga at pci
file arch/alpha/pci/pcivga.c pcivga needs-flag
@@ -173,17 +200,19 @@ file arch/alpha/pci/pcivga.c pcivga needs-flag
# Devices that can live on multiple busses
#
-device clock at isa, ioasic # not really optional
-file arch/alpha/alpha/clock.c clock
-file arch/alpha/alpha/clock_mc.c dec_3000_500 dec_2000_300 dec_3000_300
- dec_2100_a50 dec_kn20aa dec_axppci_33
- dec_21000
+device mcclock
+attach mcclock at ioasic with mcclock_ioasic
+attach mcclock at isa with mcclock_isa
+file arch/alpha/alpha/mcclock.c mcclock
+file arch/alpha/tc/mcclock_ioasic.c mcclock_ioasic
+file arch/alpha/isa/mcclock_isa.c mcclock_isa
#
# Standard files
#
file arch/alpha/alpha/autoconf.c
+file arch/alpha/alpha/clock.c
file arch/alpha/alpha/conf.c
file arch/alpha/alpha/interrupt.c
file arch/alpha/alpha/machdep.c
@@ -198,14 +227,14 @@ file arch/alpha/alpha/trap.c
file arch/alpha/alpha/vm_machdep.c
file arch/alpha/alpha/disksubr.c
file dev/cons.c
-file netinet/in_cksum.c
#
# Optional/miscellaneous files
#
-file netns/ns_cksum.c ns
+file arch/alpha/alpha/in_cksum.c inet
+file netns/ns_cksum.c ns
# XXX
file arch/alpha/alpha/promcons.c
diff --git a/sys/arch/alpha/eisa/eisa_machdep.h b/sys/arch/alpha/eisa/eisa_machdep.h
new file mode 100644
index 00000000000..0968ee61c9d
--- /dev/null
+++ b/sys/arch/alpha/eisa/eisa_machdep.h
@@ -0,0 +1,64 @@
+/* $NetBSD: eisa_machdep.h,v 1.1 1996/04/12 05:39:51 cgd Exp $ */
+
+/*
+ * Copyright (c) 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+/*
+ * Types provided to machine-independent EISA code.
+ */
+typedef struct alpha_eisa_chipset *eisa_chipset_tag_t;
+typedef int eisa_intr_handle_t;
+
+struct alpha_eisa_chipset {
+ void *ec_v;
+
+ void (*ec_attach_hook) __P((struct device *, struct device *,
+ struct eisabus_attach_args *));
+ int (*ec_maxslots) __P((void *));
+ int (*ec_intr_map) __P((void *, u_int,
+ eisa_intr_handle_t *));
+ const char *(*ec_intr_string) __P((void *, eisa_intr_handle_t));
+ void *(*ec_intr_establish) __P((void *, eisa_intr_handle_t,
+ int, int, int (*)(void *), void *));
+ void (*ec_intr_disestablish) __P((void *, void *));
+};
+
+/*
+ * Functions provided to machine-independent EISA code.
+ */
+#define eisa_attach_hook(p, s, a) \
+ (*(a)->eba_ec->ec_attach_hook)((p), (s), (a))
+#define eisa_maxslots(c) \
+ (*(c)->ec_maxslots)((c)->ec_v)
+#define eisa_intr_map(c, i, hp) \
+ (*(c)->ec_intr_map)((c)->ec_v, (i), (hp))
+#define eisa_intr_string(c, h) \
+ (*(c)->ec_intr_string)((c)->ec_v, (h))
+#define eisa_intr_establish(c, h, t, l, f, a) \
+ (*(c)->ec_intr_establish)((c)->ec_v, (h), (t), (l), (f), (a))
+#define eisa_intr_disestablish(c, h) \
+ (*(c)->ec_intr_disestablish)((c)->ec_v, (h))
diff --git a/sys/arch/alpha/include/ansi.h b/sys/arch/alpha/include/ansi.h
index 7502ca628f9..77ee9bbf2bb 100644
--- a/sys/arch/alpha/include/ansi.h
+++ b/sys/arch/alpha/include/ansi.h
@@ -1,4 +1,4 @@
-/* $NetBSD: ansi.h,v 1.3 1995/11/23 02:35:41 cgd Exp $ */
+/* $NetBSD: ansi.h,v 1.4 1996/03/16 01:31:45 jtc Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -73,6 +73,7 @@ typedef struct {
* defined for ctype.h.
*/
#define _BSD_WCHAR_T_ int /* wchar_t */
+#define _BSD_WINT_T_ int /* wint_t */
#define _BSD_RUNE_T_ int /* rune_t */
#endif /* _ANSI_H_ */
diff --git a/sys/arch/alpha/include/asm.h b/sys/arch/alpha/include/asm.h
index e76b4c586a1..8b54d605f69 100644
--- a/sys/arch/alpha/include/asm.h
+++ b/sys/arch/alpha/include/asm.h
@@ -1,7 +1,7 @@
-/* $NetBSD: asm.h,v 1.2 1995/11/23 02:35:45 cgd Exp $ */
+/* $NetBSD: asm.h,v 1.4 1996/04/12 01:36:51 cgd Exp $ */
/*
- * Copyright (c) 1991,1990,1989,1994,1995 Carnegie Mellon University
+ * Copyright (c) 1991,1990,1989,1994,1995,1996 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
@@ -600,6 +600,6 @@ _name_:; \
#define MF_FPCR(x) mf_fpcr x
#define MT_FPCR(x) mt_fpcr x
-#define JMP(loc) br zero,loc
+#define JMP(loc) jmp zero,loc
#define CONST(c,reg) ldiq reg, c
diff --git a/sys/arch/alpha/include/autoconf.h b/sys/arch/alpha/include/autoconf.h
index d4a10dd402f..78e62bc8a22 100644
--- a/sys/arch/alpha/include/autoconf.h
+++ b/sys/arch/alpha/include/autoconf.h
@@ -1,7 +1,7 @@
-/* $NetBSD: autoconf.h,v 1.2 1995/11/23 02:35:50 cgd Exp $ */
+/* $NetBSD: autoconf.h,v 1.2.4.2 1996/06/13 18:35:23 cgd Exp $ */
/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
+ * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -69,6 +69,17 @@ struct confargs {
struct abus *ca_bus; /* bus device resides on. */
};
+struct bootdev_data {
+ char *protocol;
+ int bus;
+ int slot;
+ int channel;
+ char *remote_address;
+ int unit;
+ int boot_dev_type;
+ char *ctrl_dev_type;
+};
+
void set_clockintr __P((void));
void set_iointr __P((void (*)(void *, int)));
int badaddr __P((void *, u_int64_t));
@@ -76,3 +87,7 @@ int badaddr __P((void *, u_int64_t));
#ifdef EVCNT_COUNTERS
extern struct evcnt clock_intr_evcnt;
#endif
+
+extern struct device *booted_device;
+extern int booted_partition;
+extern struct bootdev_data *bootdev_data;
diff --git a/sys/arch/alpha/include/bus.h b/sys/arch/alpha/include/bus.h
new file mode 100644
index 00000000000..5f3e8334261
--- /dev/null
+++ b/sys/arch/alpha/include/bus.h
@@ -0,0 +1,218 @@
+/* $NetBSD: bus.h,v 1.2.4.2 1996/06/13 17:44:45 cgd Exp $ */
+
+/*
+ * Copyright (c) 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#ifndef _ALPHA_BUS_H_
+#define _ALPHA_BUS_H_
+
+/*
+ * I/O addresses (in bus space)
+ */
+typedef u_long bus_io_addr_t;
+typedef u_long bus_io_size_t;
+
+/*
+ * Memory addresses (in bus space)
+ */
+typedef u_long bus_mem_addr_t;
+typedef u_long bus_mem_size_t;
+
+/*
+ * Access methods for bus resources, I/O space, and memory space.
+ */
+typedef struct alpha_bus_chipset *bus_chipset_tag_t;
+typedef u_long bus_io_handle_t;
+typedef u_long bus_mem_handle_t;
+
+struct alpha_bus_chipset {
+ /* I/O-space cookie */
+ void *bc_i_v;
+
+ /* I/O-space control functions */
+ int (*bc_i_map) __P((void *v, bus_io_addr_t port,
+ bus_io_size_t size, bus_io_handle_t *iohp));
+ void (*bc_i_unmap) __P((void *v, bus_io_handle_t ioh,
+ bus_io_size_t size));
+ int (*bc_i_subregion) __P((void *v, bus_io_handle_t ioh,
+ bus_io_size_t offset, bus_io_size_t size,
+ bus_io_handle_t *nioh));
+
+ /* I/O-space read functions */
+ u_int8_t (*bc_ir1) __P((void *v, bus_io_handle_t ioh,
+ bus_io_size_t off));
+ u_int16_t (*bc_ir2) __P((void *v, bus_io_handle_t ioh,
+ bus_io_size_t off));
+ u_int32_t (*bc_ir4) __P((void *v, bus_io_handle_t ioh,
+ bus_io_size_t off));
+ u_int64_t (*bc_ir8) __P((void *v, bus_io_handle_t ioh,
+ bus_io_size_t off));
+
+ /* I/O-space read-multiple functions */
+ void (*bc_irm1) __P((void *v, bus_io_handle_t ioh,
+ bus_io_size_t off, u_int8_t *addr,
+ bus_io_size_t count));
+ void (*bc_irm2) __P((void *v, bus_io_handle_t ioh,
+ bus_io_size_t off, u_int16_t *addr,
+ bus_io_size_t count));
+ void (*bc_irm4) __P((void *v, bus_io_handle_t ioh,
+ bus_io_size_t off, u_int32_t *addr,
+ bus_io_size_t count));
+ void (*bc_irm8) __P((void *v, bus_io_handle_t ioh,
+ bus_io_size_t off, u_int64_t *addr,
+ bus_io_size_t count));
+
+ /* I/O-space write functions */
+ void (*bc_iw1) __P((void *v, bus_io_handle_t ioh,
+ bus_io_size_t off, u_int8_t val));
+ void (*bc_iw2) __P((void *v, bus_io_handle_t ioh,
+ bus_io_size_t off, u_int16_t val));
+ void (*bc_iw4) __P((void *v, bus_io_handle_t ioh,
+ bus_io_size_t off, u_int32_t val));
+ void (*bc_iw8) __P((void *v, bus_io_handle_t ioh,
+ bus_io_size_t off, u_int64_t val));
+
+ /* I/O-space write-multiple functions */
+ void (*bc_iwm1) __P((void *v, bus_io_handle_t ioh,
+ bus_io_size_t off, const u_int8_t *addr,
+ bus_io_size_t count));
+ void (*bc_iwm2) __P((void *v, bus_io_handle_t ioh,
+ bus_io_size_t off, const u_int16_t *addr,
+ bus_io_size_t count));
+ void (*bc_iwm4) __P((void *v, bus_io_handle_t ioh,
+ bus_io_size_t off, const u_int32_t *addr,
+ bus_io_size_t count));
+ void (*bc_iwm8) __P((void *v, bus_io_handle_t ioh,
+ bus_io_size_t off, const u_int64_t *addr,
+ bus_io_size_t count));
+
+ /* Mem-space cookie */
+ void *bc_m_v;
+
+ /* Mem-space control functions */
+ int (*bc_m_map) __P((void *v, bus_mem_addr_t buspa,
+ bus_mem_size_t size, int cacheable,
+ bus_mem_handle_t *mhp));
+ void (*bc_m_unmap) __P((void *v, bus_mem_handle_t mh,
+ bus_mem_size_t size));
+ int (*bc_m_subregion) __P((void *v, bus_mem_handle_t memh,
+ bus_mem_size_t offset, bus_mem_size_t size,
+ bus_mem_handle_t *nmemh));
+
+ /* Mem-space read functions */
+ u_int8_t (*bc_mr1) __P((void *v, bus_mem_handle_t memh,
+ bus_mem_size_t off));
+ u_int16_t (*bc_mr2) __P((void *v, bus_mem_handle_t memh,
+ bus_mem_size_t off));
+ u_int32_t (*bc_mr4) __P((void *v, bus_mem_handle_t memh,
+ bus_mem_size_t off));
+ u_int64_t (*bc_mr8) __P((void *v, bus_mem_handle_t memh,
+ bus_mem_size_t off));
+
+ /* Mem-space write functions */
+ void (*bc_mw1) __P((void *v, bus_mem_handle_t memh,
+ bus_mem_size_t off, u_int8_t val));
+ void (*bc_mw2) __P((void *v, bus_mem_handle_t memh,
+ bus_mem_size_t off, u_int16_t val));
+ void (*bc_mw4) __P((void *v, bus_mem_handle_t memh,
+ bus_mem_size_t off, u_int32_t val));
+ void (*bc_mw8) __P((void *v, bus_mem_handle_t memh,
+ bus_mem_size_t off, u_int64_t val));
+
+ /* XXX THIS DOES NOT YET BELONG HERE */
+ vm_offset_t (*bc_XXX_dmamap) __P((void *addr));
+};
+
+#define __bc_CONCAT(A,B) __CONCAT(A,B)
+#define __bc_ABC(A,B,C) __bc_CONCAT(A,__bc_CONCAT(B,C))
+#define __bc_ABCD(A,B,C,D) __bc_CONCAT(__bc_ABC(A,B,C),D)
+
+#define __bc_rd(t, h, o, sz, sp) \
+ (*(t)->__bc_ABCD(bc_,sp,r,sz))((t)->__bc_ABC(bc_,sp,_v), h, o)
+
+#define __bc_wr(t, h, o, v, sz, sp) \
+ (*(t)->__bc_ABCD(bc_,sp,w,sz))((t)->__bc_ABC(bc_,sp,_v), h, o, v)
+
+#define bus_io_map(t, port, size, iohp) \
+ (*(t)->bc_i_map)((t)->bc_i_v, (port), (size), (iohp))
+#define bus_io_unmap(t, ioh, size) \
+ (*(t)->bc_i_unmap)((t)->bc_i_v, (ioh), (size))
+#define bus_io_subregion(t, ioh, offset, size, nioh) \
+ (*(t)->bc_i_unmap)((t)->bc_i_v, (ioh), (offset), (size), (nioh))
+
+#define __bc_io_multi(t, h, o, a, s, dir, sz) \
+ (*(t)->__bc_ABCD(bc_i,dir,m,sz))((t)->bc_i_v, h, o, a, s)
+
+#define bus_io_read_1(t, h, o) __bc_rd((t),(h),(o),1,i)
+#define bus_io_read_2(t, h, o) __bc_rd((t),(h),(o),2,i)
+#define bus_io_read_4(t, h, o) __bc_rd((t),(h),(o),4,i)
+#define bus_io_read_8(t, h, o) __bc_rd((t),(h),(o),8,i)
+
+#define bus_io_read_multi_1(t, h, o, a, s) \
+ __bc_io_multi((t),(h),(o),(a),(s),r,1)
+#define bus_io_read_multi_2(t, h, o, a, s) \
+ __bc_io_multi((t),(h),(o),(a),(s),r,2)
+#define bus_io_read_multi_4(t, h, o, a, s) \
+ __bc_io_multi((t),(h),(o),(a),(s),r,4)
+#define bus_io_read_multi_8(t, h, o, a, s) \
+ __bc_io_multi((t),(h),(o),(a),(s),r,8)
+
+#define bus_io_write_1(t, h, o, v) __bc_wr((t),(h),(o),(v),1,i)
+#define bus_io_write_2(t, h, o, v) __bc_wr((t),(h),(o),(v),2,i)
+#define bus_io_write_4(t, h, o, v) __bc_wr((t),(h),(o),(v),4,i)
+#define bus_io_write_8(t, h, o, v) __bc_wr((t),(h),(o),(v),8,i)
+
+#define bus_io_write_multi_1(t, h, o, a, s) \
+ __bc_io_multi((t),(h),(o),(a),(s),w,1)
+#define bus_io_write_multi_2(t, h, o, a, s) \
+ __bc_io_multi((t),(h),(o),(a),(s),w,2)
+#define bus_io_write_multi_4(t, h, o, a, s) \
+ __bc_io_multi((t),(h),(o),(a),(s),w,4)
+#define bus_io_write_multi_8(t, h, o, a, s) \
+ __bc_io_multi((t),(h),(o),(a),(s),w,8)
+
+#define bus_mem_map(t, bpa, size, cacheable, mhp) \
+ (*(t)->bc_m_map)((t)->bc_m_v, (bpa), (size), (cacheable), (mhp))
+#define bus_mem_unmap(t, memh, size) \
+ (*(t)->bc_m_unmap)((t)->bc_m_v, (memh), (size))
+#define bus_mem_subregion(t, memh, offset, size, nmemh) \
+ (*(t)->bc_m_unmap)((t)->bc_i_v, (memh), (offset), (size), (nmemh))
+
+#define bus_mem_read_1(t, h, o) __bc_rd((t),(h),(o),1,m)
+#define bus_mem_read_2(t, h, o) __bc_rd((t),(h),(o),2,m)
+#define bus_mem_read_4(t, h, o) __bc_rd((t),(h),(o),4,m)
+#define bus_mem_read_8(t, h, o) __bc_rd((t),(h),(o),8,m)
+
+#define bus_mem_write_1(t, h, o, v) __bc_wr((t),(h),(o),(v),1,m)
+#define bus_mem_write_2(t, h, o, v) __bc_wr((t),(h),(o),(v),2,m)
+#define bus_mem_write_4(t, h, o, v) __bc_wr((t),(h),(o),(v),4,m)
+#define bus_mem_write_8(t, h, o, v) __bc_wr((t),(h),(o),(v),8,m)
+
+/* XXX THIS DOES NOT BELONG HERE YET. */
+#define __alpha_bus_XXX_dmamap(t, va) (*(t)->bc_XXX_dmamap)((va))
+
+#endif /* _ALPHA_BUS_H_ */
diff --git a/sys/arch/alpha/include/cdefs.h b/sys/arch/alpha/include/cdefs.h
index d848e59f663..cd705e0db7d 100644
--- a/sys/arch/alpha/include/cdefs.h
+++ b/sys/arch/alpha/include/cdefs.h
@@ -32,9 +32,7 @@
#define _C_LABEL(x) _STRING(x)
-#ifndef lint
-#define __indr_reference(sym,msg) /* nothing */
-#endif
+#define __indr_references(sym,msg) /* nothing */
#define __warn_references(sym,msg) /* nothing */
#endif /* !_MACHINE_CDEFS_H_ */
diff --git a/sys/arch/alpha/include/cfbreg.h b/sys/arch/alpha/include/cfbreg.h
new file mode 100644
index 00000000000..3d5c21fb98d
--- /dev/null
+++ b/sys/arch/alpha/include/cfbreg.h
@@ -0,0 +1,59 @@
+/* $NetBSD: cfbreg.h,v 1.1 1996/05/01 23:25:00 cgd Exp $ */
+
+/*
+ * Copyright (c) 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+/*
+ * Color Frame Buffer definitions, from:
+ * ``PMAG-BA TURBOchannel Color Frame Buffer Functional Specification
+ * (Revision 1.2)'', availalable via anonymous FTP from gatekeeper.dec.com.
+ *
+ * All definitions are in "dense" TurboChannel space.
+ */
+
+/*
+ * Size of the CFB address space.
+ */
+#define CFB_SIZE 0x400000
+
+/*
+ * Offsets into slot space of each functional unit.
+ */
+#define CFB_FB_OFFSET 0x000000 /* Frame buffer */
+#define CFB_FB_SIZE 0x100000
+#define CFB_RAMDAC_OFFSET 0x200000 /* Bt495 RAMDAC Registers */
+#define CFB_RAMDAC_SIZE 0x100000
+#define CFB_IREQCTRL_OFFSET 0x300000 /* IReq Control region */
+#define CFB_IREQCTRL_SIZE 0x080000
+
+/*
+ * Bt459 RAMDAC registers (offsets from CFB_RAMDAC_OFFSET)
+ */
+#define CFB_RAMDAC_ADDRLOW 0x0000 /* Address register low byte */
+#define CFB_RAMDAC_ADDRHIGH 0x0004 /* Address register high byte */
+#define CFB_RAMDAC_REGDATA 0x0008 /* Register addressed by addr reg */
+#define CFB_RAMDAC_CMAPDATA 0x000c /* Colormap loc addressed by addr reg */
diff --git a/sys/arch/alpha/include/coff.h b/sys/arch/alpha/include/coff.h
deleted file mode 100644
index 7516cb7e72a..00000000000
--- a/sys/arch/alpha/include/coff.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Mach Operating System
- * Copyright (c) 1992,1993,1994,1995 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- */
-/*
- * HISTORY
- * Revision 1.1 1994/06/30 16:29:52 bostic
- * coff.h
- *
- * Revision 2.3 93/01/19 08:59:12 danner
- * Fix TXTOFF to cope with assembler/linker incoherence viz
- * rounding in OMAGIC files.
- * [93/01/15 af]
- *
- * Revision 2.2 93/01/14 17:12:13 danner
- * Adapted for Alpha.
- * [92/05/31 af]
- *
- */
-/*
- * File: coff.h
- * Author: Alessandro Forin, Carnegie Mellon University
- * Date: 10/89
- *
- * Structure definitions for COFF headers
- */
-
-struct filehdr {
- unsigned short f_magic; /* magic number */
- unsigned short f_nscns; /* number of sections */
- int f_timdat; /* time & date stamp */
- vm_offset_t f_symptr; /* file pointer to symtab */
- int f_nsyms; /* number of symtab entries */
- unsigned short f_opthdr; /* sizeof(optional hdr) */
- unsigned short f_flags; /* flags */
-};
-
-#define F_EXEC 0000002
-
-#define ALPHAMAGIC 0603
-
-struct scnhdr {
- char s_name[8]; /* section name */
- vm_offset_t s_paddr; /* physical address */
- vm_offset_t s_vaddr; /* virtual address */
- vm_offset_t s_size; /* section size */
- vm_offset_t s_scnptr; /* file ptr to raw data for section */
- vm_offset_t s_relptr; /* file ptr to relocation */
- vm_offset_t s_lnnoptr; /* file ptr to line numbers */
- unsigned short s_nreloc; /* number of relocation entries */
- unsigned short s_nlnno; /* number of line number entries */
- int s_flags; /* flags */
-};
-
-struct aouthdr {
- short magic; /* see magic.h */
- short vstamp; /* version stamp */
- int pad; /* help for cross compilers */
- vm_offset_t tsize; /* text size in bytes, padded to FW */
- vm_offset_t dsize; /* initialized data size */
- vm_offset_t bsize; /* uninitialized data size */
- vm_offset_t entry; /* entry point, value of "start" */
- vm_offset_t text_start; /* base of text used for this file */
- vm_offset_t data_start; /* base of data used for this file */
- vm_offset_t bss_start; /* base of bss used for this file */
- int gprmask; /* general purpose register mask*/
- int fprmask; /* FPA register mask */
- vm_offset_t gp_value; /* the gp value used for this object*/
-};
-
-struct exechdr {
- struct filehdr f;
- struct aouthdr a;
-};
-
-/* Linker and assembler screwed: .o are not aligned, images are */
-#define SCNROUND ((long)16)
-
-#define N_COFFBADMAG(a) \
- ((a).magic != OMAGIC && (a).magic != NMAGIC && (a).magic != ZMAGIC)
-
-#define N_COFFTXTOFF(f, a) \
- (((a).magic == ZMAGIC) ? 0 : \
- (((f).f_flags & F_EXEC) ? \
- (((sizeof(struct filehdr) + sizeof(struct aouthdr) + \
- (f).f_nscns * sizeof(struct scnhdr)) + SCNROUND-1) & ~(SCNROUND-1)) \
- : (sizeof(struct filehdr) + sizeof(struct aouthdr) + \
- (f).f_nscns * sizeof(struct scnhdr))))
diff --git a/sys/arch/alpha/include/cpu.h b/sys/arch/alpha/include/cpu.h
index 27ad8c4606c..9c7281cb7f2 100644
--- a/sys/arch/alpha/include/cpu.h
+++ b/sys/arch/alpha/include/cpu.h
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.7 1995/12/21 05:01:32 mycroft Exp $ */
+/* $NetBSD: cpu.h,v 1.7.4.1 1996/06/14 20:42:44 cgd Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -115,11 +115,13 @@ extern u_int64_t ssir;
* CTL_MACHDEP definitions.
*/
#define CPU_CONSDEV 1 /* dev_t: console terminal device */
-#define CPU_MAXID 2 /* number of valid machdep ids */
+#define CPU_ROOT_DEVICE 2 /* string: root device name */
+#define CPU_MAXID 3 /* number of valid machdep ids */
#define CTL_MACHDEP_NAMES { \
{ 0, 0 }, \
{ "console_device", CTLTYPE_STRUCT }, \
+ { "root_device", CTLTYPE_STRING }, \
}
#endif /* _ALPHA_CPU_H_ */
diff --git a/sys/arch/alpha/include/ecoff.h b/sys/arch/alpha/include/ecoff.h
index 08427556592..b40c2242f2f 100644
--- a/sys/arch/alpha/include/ecoff.h
+++ b/sys/arch/alpha/include/ecoff.h
@@ -1,4 +1,4 @@
-/* $NetBSD: ecoff.h,v 1.2 1995/11/23 02:35:57 cgd Exp $ */
+/* $NetBSD: ecoff.h,v 1.3 1996/05/09 23:47:25 cgd Exp $ */
/*
* Copyright (c) 1994 Adam Glass
@@ -34,47 +34,49 @@
#define ECOFF_LDPGSZ 4096
#define ECOFF_PAD \
- u_short ea_bldrev; /* XXX */
+ u_short bldrev; /* XXX */
#define ECOFF_MACHDEP \
- u_int ea_gprmask; \
- u_int ea_fprmask; \
- u_long ea_gp_value
+ u_int gprmask; \
+ u_int fprmask; \
+ u_long gp_value
#define ECOFF_MAGIC_ALPHA 0603
-#define ECOFF_MAGIC_NATIVE_ALPHA 0605
-#define ECOFF_BADMAG(ex) \
- (ex->ef_magic != ECOFF_MAGIC_ALPHA && \
- ex->ef_magic != ECOFF_MAGIC_NATIVE_ALPHA)
+#define ECOFF_MAGIC_NETBSD_ALPHA 0605
+#define ECOFF_BADMAG(ep) \
+ ((ep)->f.f_magic != ECOFF_MAGIC_ALPHA && \
+ (ep)->f.f_magic != ECOFF_MAGIC_NETBSD_ALPHA)
-#define ECOFF_SEGMENT_ALIGNMENT(eap) (eap->ea_vstamp < 23 ? 8 : 16)
+#define ECOFF_FLAG_EXEC 0002
+#define ECOFF_SEGMENT_ALIGNMENT(ep) \
+ (((ep)->f.f_flags & ECOFF_FLAG_EXEC) == 0 ? 8 : 16)
struct ecoff_symhdr {
- int16_t sh_magic;
- int16_t sh_vstamp;
- int32_t sh_linemax;
- int32_t sh_densenummax;
- int32_t sh_procmax;
- int32_t sh_lsymmax;
- int32_t sh_optsymmax;
- int32_t sh_auxxymmax;
- int32_t sh_lstrmax;
- int32_t sh_estrmax;
- int32_t sh_fdmax;
- int32_t sh_rfdmax;
- int32_t sh_esymmax;
- long sh_linesize;
- long sh_lineoff;
- long sh_densenumoff;
- long sh_procoff;
- long sh_lsymoff;
- long sh_optsymoff;
- long sh_auxsymoff;
- long sh_lstroff;
- long sh_estroff;
- long sh_fdoff;
- long sh_rfdoff;
- long sh_esymoff;
+ int16_t magic;
+ int16_t vstamp;
+ int32_t lineMax;
+ int32_t densenumMax;
+ int32_t procMax;
+ int32_t lsymMax;
+ int32_t optsymMax;
+ int32_t auxsymMax;
+ int32_t lstrMax;
+ int32_t estrMax;
+ int32_t fdMax;
+ int32_t rfdMax;
+ int32_t esymMax;
+ long linesize;
+ long cbLineOffset;
+ long cbDnOffset;
+ long cbPdOffset;
+ long cbSymOffset;
+ long cbOptOffset;
+ long cbAuxOffset;
+ long cbSsOffset;
+ long cbSsExtOffset;
+ long cbFdOffset;
+ long cbRfdOffset;
+ long cbExtOffset;
};
struct ecoff_extsym {
diff --git a/sys/arch/alpha/include/eisa_machdep.h b/sys/arch/alpha/include/eisa_machdep.h
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/sys/arch/alpha/include/eisa_machdep.h
+++ /dev/null
diff --git a/sys/arch/alpha/include/fbio.h b/sys/arch/alpha/include/fbio.h
new file mode 100644
index 00000000000..dd03eac5793
--- /dev/null
+++ b/sys/arch/alpha/include/fbio.h
@@ -0,0 +1,173 @@
+/* $NetBSD: fbio.h,v 1.2 1996/05/01 19:44:21 cgd Exp $ */
+
+/*
+ * Copyright (c) 1992 Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software developed by the Computer Systems
+ * Engineering group at Lawrence Berkeley Laboratory under DARPA
+ * contract BG 91-66 and contributed to Berkeley.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)fbio.h 7.2 (Berkeley) 4/1/92
+ */
+
+/*
+ * Frame buffer ioctls (from Sprite, trimmed to essentials for X11).
+ */
+
+/*
+ * Frame buffer type codes.
+ */
+#define FBTYPE_PM_MONO 0 /* never on the alpha */
+#define FBTYPE_PM_COLOR 1 /* never on the alpha */
+#define FBTYPE_CFB 2 /* CFB (TurboChannel) */
+#define FBTYPE_XCFB 3 /* ??? (TurboChannel) */
+#define FBTYPE_MFB 4 /* MFB (TurboChannel) */
+#define FBTYPE_SFB 5 /* SFB (TurboChannel) */
+#define FBTYPE_VGA 6 /* ISA or EISA VGA */
+#define FBTYPE_PCIVGA 7 /* PCI VGA */
+#define FBTYPE_TGA 8 /* TGA (PCI) */
+#define FBTYPE_SFBP 9 /* SFB+ (TurboChannel) */
+
+#define FBTYPE_LASTPLUSONE 10
+
+/*
+ * Frame buffer descriptor as returned by FBIOGTYPE.
+ */
+struct fbtype {
+ int fb_type; /* as defined above */
+ int fb_height; /* in pixels */
+ int fb_width; /* in pixels */
+ int fb_depth; /* bits per pixel */
+ int fb_cmsize; /* size of color map (entries) */
+ int fb_size; /* total size in bytes */
+};
+#define FBIOGTYPE _IOR('F', 0, struct fbtype)
+
+#ifdef notdef
+/*
+ * General purpose structure for passing info in and out of frame buffers
+ * (used for gp1) -- unsupported.
+ */
+struct fbinfo {
+ int fb_physaddr; /* physical frame buffer address */
+ int fb_hwwidth; /* fb board width */
+ int fb_hwheight; /* fb board height */
+ int fb_addrdelta; /* phys addr diff between boards */
+ u_char *fb_ropaddr; /* fb virtual addr */
+ int fb_unit; /* minor devnum of fb */
+};
+#define FBIOGINFO _IOR('F', 2, struct fbinfo)
+#endif
+
+/*
+ * Color map I/O.
+ */
+struct fbcmap {
+ int index; /* first element (0 origin) */
+ int count; /* number of elements */
+ u_char *red; /* red color map elements */
+ u_char *green; /* green color map elements */
+ u_char *blue; /* blue color map elements */
+};
+#define FBIOPUTCMAP _IOW('F', 3, struct fbcmap)
+#define FBIOGETCMAP _IOW('F', 4, struct fbcmap)
+
+/*
+ * Set/get attributes.
+ */
+#define FB_ATTR_NDEVSPECIFIC 8 /* no. of device specific values */
+#define FB_ATTR_NEMUTYPES 4 /* no. of emulation types */
+
+struct fbsattr {
+ int flags; /* flags; see below */
+ int emu_type; /* emulation type (-1 if unused) */
+ int dev_specific[FB_ATTR_NDEVSPECIFIC]; /* catchall */
+};
+#define FB_ATTR_AUTOINIT 1 /* emulation auto init flag */
+#define FB_ATTR_DEVSPECIFIC 2 /* dev. specific stuff valid flag */
+
+struct fbgattr {
+ int real_type; /* real device type */
+ int owner; /* PID of owner, 0 if myself */
+ struct fbtype fbtype; /* fbtype info for real device */
+ struct fbsattr sattr; /* see above */
+ int emu_types[FB_ATTR_NEMUTYPES]; /* possible emulations */
+ /* (-1 if unused) */
+};
+/* FBIOSATTR _IOW('F', 5, struct fbsattr) -- unsupported */
+#define FBIOGATTR _IOR('F', 6, struct fbgattr)
+
+/*
+ * Video control.
+ */
+#define FBVIDEO_OFF 0
+#define FBVIDEO_ON 1
+
+#define FBIOSVIDEO _IOW('F', 7, int)
+#define FBIOGVIDEO _IOR('F', 8, int)
+
+/*
+ * hardware cursor control
+ */
+struct fbcurpos {
+ short x;
+ short y;
+};
+
+#define FB_CUR_SETCUR 0x01
+#define FB_CUR_SETPOS 0x02
+#define FB_CUR_SETHOT 0x04
+#define FB_CUR_SETCMAP 0x08
+#define FB_CUR_SETSHAPE 0x10
+#define FB_CUR_SETALL 0x1F
+
+struct fbcursor {
+ short set; /* what to set */
+ short enable; /* enable/disable cursor */
+ struct fbcurpos pos; /* cursor's position */
+ struct fbcurpos hot; /* cursor's hot spot */
+ struct fbcmap cmap; /* color map info */
+ struct fbcurpos size; /* cursor's bit map size */
+ char *image; /* cursor's image bits */
+ char *mask; /* cursor's mask bits */
+};
+
+/* set/get cursor attributes/shape */
+#define FBIOSCURSOR _IOW('F', 24, struct fbcursor)
+#define FBIOGCURSOR _IOWR('F', 25, struct fbcursor)
+
+/* set/get cursor position */
+#define FBIOSCURPOS _IOW('F', 26, struct fbcurpos)
+#define FBIOGCURPOS _IOW('F', 27, struct fbcurpos)
+
+/* get max cursor size */
+#define FBIOGCURMAX _IOR('F', 28, struct fbcurpos)
diff --git a/sys/arch/alpha/include/intr.h b/sys/arch/alpha/include/intr.h
new file mode 100644
index 00000000000..8baab0eb85a
--- /dev/null
+++ b/sys/arch/alpha/include/intr.h
@@ -0,0 +1,40 @@
+/* $NetBSD: intr.h,v 1.1 1996/04/12 01:42:17 cgd Exp $ */
+
+/*
+ * Copyright (c) 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#define IPL_NONE 0 /* disable only this interrupt */
+#define IPL_BIO 1 /* disable block I/O interrupts */
+#define IPL_NET 2 /* disable network interrupts */
+#define IPL_TTY 3 /* disable terminal interrupts */
+#define IPL_CLOCK 4 /* disable clock interrupts */
+#define IPL_HIGH 5 /* disable all interrupts */
+
+#define IST_NONE 0 /* none (dummy) */
+#define IST_PULSE 1 /* pulsed */
+#define IST_EDGE 2 /* edge-triggered */
+#define IST_LEVEL 3 /* level-triggered */
diff --git a/sys/arch/alpha/include/intrcnt.h b/sys/arch/alpha/include/intrcnt.h
index abf39d0fc9c..046db247e30 100644
--- a/sys/arch/alpha/include/intrcnt.h
+++ b/sys/arch/alpha/include/intrcnt.h
@@ -1,4 +1,31 @@
+/* $NetBSD: intrcnt.h,v 1.4.4.2 1996/06/05 03:42:24 cgd Exp $ */
+/*
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
#define INTRNAMES_DEFINITION \
/* 0x00 */ ASCIZ "clock"; \
@@ -49,20 +76,49 @@
ASCIZ "kn20aa irq 28"; \
ASCIZ "kn20aa irq 29"; \
ASCIZ "kn20aa irq 30"; \
-/* 0x30 */ ASCIZ "kn20aa irq 31";
+/* 0x30 */ ASCIZ "kn20aa irq 31"; \
+ ASCIZ "kn15 tc slot 0"; \
+ ASCIZ "kn15 tc slot 1"; \
+ ASCIZ "kn15 tc slot 2"; \
+ ASCIZ "kn15 tc slot 3"; \
+ ASCIZ "kn15 tc slot 4"; \
+ ASCIZ "kn15 tc slot 5"; \
+ ASCIZ "kn15 tcds"; \
+ ASCIZ "kn15 ioasic"; \
+ ASCIZ "kn15 sfb"; \
+ ASCIZ "kn16 tc slot 0"; \
+ ASCIZ "kn16 tc slot 1"; \
+ ASCIZ "kn16 tcds"; \
+ ASCIZ "kn16 ioasic"; \
+ ASCIZ "kn16 sfb"; \
+ ASCIZ "tcds esp 0"; \
+/* 0x40 */ ASCIZ "tcds esp 1"; \
+ ASCIZ "ioasic le"; \
+ ASCIZ "ioasic scc 0"; \
+ ASCIZ "ioasic scc 1"; \
+ ASCIZ "ioasic am79c30";
#define INTRCNT_DEFINITION \
/* 0x00 */ .quad 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; \
/* 0x10 */ .quad 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; \
/* 0x20 */ .quad 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; \
-/* 0x30 */ .quad 0;
+/* 0x30 */ .quad 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; \
+/* 0x40 */ .quad 0, 0, 0, 0, 0;
#define INTRCNT_CLOCK 0
-#define INTRCNT_ISA_IRQ (INTRCNT_CLOCK + 1)
+#define INTRCNT_ISA_IRQ (INTRCNT_CLOCK + 1)
#define INTRCNT_ISA_IRQ_LEN 16
-#define INTRCNT_KN20AA_IRQ (INTRCNT_ISA_IRQ + INTRCNT_ISA_IRQ_LEN)
-#define INTRCNT_KN20AA_IRQ_LEN 32
+#define INTRCNT_KN20AA_IRQ (INTRCNT_ISA_IRQ + INTRCNT_ISA_IRQ_LEN)
+#define INTRCNT_KN20AA_IRQ_LEN 32
+#define INTRCNT_KN15 (INTRCNT_KN20AA_IRQ + INTRCNT_KN20AA_IRQ_LEN)
+#define INTRCNT_KN15_LEN 9
+#define INTRCNT_KN16 (INTRCNT_KN15 + INTRCNT_KN15_LEN)
+#define INTRCNT_KN16_LEN 5
+#define INTRCNT_TCDS (INTRCNT_KN16 + INTRCNT_KN16_LEN)
+#define INTRCNT_TCDS_LEN 2
+#define INTRCNT_IOASIC (INTRCNT_TCDS + INTRCNT_TCDS_LEN)
+#define INTRCNT_IOASIC_LEN 4
-#ifndef LOCORE
-extern long intrcnt[];
+#ifndef _LOCORE
+extern volatile long intrcnt[];
#endif
diff --git a/sys/arch/alpha/include/kbio.h b/sys/arch/alpha/include/kbio.h
new file mode 100644
index 00000000000..f785fdce2e3
--- /dev/null
+++ b/sys/arch/alpha/include/kbio.h
@@ -0,0 +1,117 @@
+/* $NetBSD: kbio.h,v 1.1 1996/04/12 01:45:45 cgd Exp $ */
+
+/*
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Lawrence Berkeley Laboratory.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)kbio.h 8.1 (Berkeley) 6/11/93
+ */
+
+#if 0 /* XXX */
+/*
+ * The following is a minimal emulation of Sun's `kio' structures
+ * and related operations necessary to make X11 happy (i.e., make it
+ * compile, and make old X11 binaries run).
+ */
+
+/*
+ * The kiockey structure apparently gets and/or sets keyboard mappings.
+ * It seems to be kind of useless, but X11 uses it (according to the
+ * comments) to figure out when a Sun 386i has a type-4 keyboard but
+ * claims to have a type-3 keyboard. We need just enough to cause the
+ * appropriate ioctl to return the appropriate magic value.
+ *
+ * KIOCGETKEY fills in kio_entry from kio_station. Not sure what tablemask
+ * is for; X sets it before the call, so it is not an output, but we do not
+ * care anyway. KIOCSDIRECT is supposed to tell the kernel whether to send
+ * keys to the console or to X; we just send them to X whenever the keyboard
+ * is open at all. (XXX may need to change this later)
+ *
+ * Keyboard commands and types are defined in kbd.h as they are actually
+ * real hardware commands and type numbers.
+ */
+struct okiockey { /* Out-dated key translation structure */
+ int kio_tablemask; /* whatever */
+ u_char kio_station; /* key number */
+ u_char kio_entry; /* HOLE if not present */
+ char kio_text[10]; /* the silly escape sequences (unsupported) */
+};
+
+struct kiockey {
+ int kio_tablemask; /* whatever */
+ u_char kio_station; /* key number */
+ u_short kio_entry; /* HOLE if not present */
+ char kio_text[10]; /* the silly escape sequences (unsupported) */
+};
+
+/*
+ * Values for kio_tablemask. These determine which table to read/modify
+ * in KIOC[SG]KEY ioctls. Currently, we only have "non-shift" and "shift"
+ * tables.
+ */
+#define KIOC_NOMASK 0x0
+#define KIOC_CAPSMASK 0x1
+#define KIOC_SHIFTMASK 0xe
+#define KIOC_CTRLMASK 0x30
+#define KIOC_ALTGMASK 0x200
+#define KIOC_NUMLMASK 0x800
+
+#define HOLE 0x302 /* value for kio_entry to say `really type 3' */
+
+#define KIOCTRANS _IOW('k', 0, int) /* set translation mode */
+ /* (we only accept TR_UNTRANS_EVENT) */
+#define KIOCGETKEY _IOWR('k', 2, struct okiockey) /* fill in kio_entry */
+#define KIOCGTRANS _IOR('k', 5, int) /* get translation mode */
+#define KIOCCMD _IOW('k', 8, int) /* X uses this to ring bell */
+#define KIOCTYPE _IOR('k', 9, int) /* get keyboard type */
+#endif /* 0 XXX */
+#define KIOCSDIRECT _IOW('k', 10, int) /* keys to console? */
+#if 0 /* XXX */
+#define KIOCSKEY _IOW('k', 12, struct kiockey) /* set xlat mode */
+#define KIOCGKEY _IOWR('k', 13, struct kiockey) /* get xlat mode */
+#define KIOCLAYOUT _IOR('k', 20, int) /* get keyboard layout */
+#define KIOCSLED _IOW('k', 14, char) /* set LED state */
+#define KIOCGLED _IOR('k', 15, char) /* get LED state */
+
+#define TR_NONE 0 /* X compat, unsupported */
+#define TR_ASCII 1 /* X compat, unsupported */
+#define TR_EVENT 2 /* X compat, unsupported */
+#define TR_UNTRANS_EVENT 3
+#endif /* 0 XXX */
diff --git a/sys/arch/alpha/include/limits.h b/sys/arch/alpha/include/limits.h
index 7fb490baef2..16cd93da86b 100644
--- a/sys/arch/alpha/include/limits.h
+++ b/sys/arch/alpha/include/limits.h
@@ -1,4 +1,4 @@
-/* $NetBSD: limits.h,v 1.1 1995/02/13 23:07:41 cgd Exp $ */
+/* $NetBSD: limits.h,v 1.2 1996/04/12 01:38:25 cgd Exp $ */
/*
* Copyright (c) 1988, 1993
@@ -48,37 +48,48 @@
* These numbers work for pcc as well. The UINT_MAX and ULONG_MAX values
* are written as hex so that GCC will be quiet about large integer constants.
*/
-#define SCHAR_MAX 127 /* min value for a signed char */
-#define SCHAR_MIN (-128) /* max value for a signed char */
+#define SCHAR_MAX 0x7f /* max value for a signed char */
+#define SCHAR_MIN (-0x7f-1) /* min value for a signed char */
-#define UCHAR_MAX 255 /* max value for an unsigned char */
-#define CHAR_MAX 127 /* max value for a char */
-#define CHAR_MIN (-128) /* min value for a char */
+#define UCHAR_MAX 0xffU /* max value for an unsigned char */
+#define CHAR_MAX 0x7f /* max value for a char */
+#define CHAR_MIN (-0x7f-1) /* min value for a char */
-#define USHRT_MAX 65535 /* max value for an unsigned short */
-#define SHRT_MAX 32767 /* max value for a short */
-#define SHRT_MIN (-32768) /* min value for a short */
+#define USHRT_MAX 0xffffU /* max value for an unsigned short */
+#define SHRT_MAX 0x7fff /* max value for a short */
+#define SHRT_MIN (-0x7fff-1) /* min value for a short */
-#define UINT_MAX 0xffffffff /* max value for an unsigned int */
-#define INT_MAX 2147483647 /* max value for an int */
-#define INT_MIN (-2147483647-1) /* min value for an int */
+#define UINT_MAX 0xffffffffU /* max value for an unsigned int */
+#define INT_MAX 0x7fffffff /* max value for an int */
+#define INT_MIN (-0x7fffffff-1) /* min value for an int */
-#define ULONG_MAX 0xffffffffffffffff /* max value for an unsigned long */
- /* max value for a long */
-#define LONG_MAX 0x7fffffffffffffff
-#define LONG_MIN (-LONG_MAX-1) /* min value for a long */
+#define ULONG_MAX 0xffffffffffffffffUL /* max for an unsigned long */
+#define LONG_MAX 0x7fffffffffffffffL /* max for a long */
+#define LONG_MIN (-0x7fffffffffffffffL-1) /* min for a long */
#if !defined(_ANSI_SOURCE)
-#define SSIZE_MAX INT_MAX /* max value for a ssize_t */
+#define SSIZE_MAX LONG_MAX /* max value for a ssize_t */
-#if !defined(_POSIX_SOURCE)
-#define SIZE_T_MAX UINT_MAX /* max value for a size_t */
+#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
+#define SIZE_T_MAX ULONG_MAX /* max value for a size_t */
-/* GCC requires that quad constants be written as expressions. */
-#define UQUAD_MAX ((u_quad_t)0-1) /* max value for a uquad_t */
- /* max value for a quad_t */
-#define QUAD_MAX ((quad_t)(UQUAD_MAX >> 1))
-#define QUAD_MIN (-QUAD_MAX-1) /* min value for a quad_t */
+/* Quads and longs are the same on the alpha */
+#define UQUAD_MAX (ULONG_MAX) /* max value for a uquad_t */
+#define QUAD_MAX (LONG_MAX) /* max value for a quad_t */
+#define QUAD_MIN (LONG_MIN) /* min value for a quad_t */
-#endif /* !_POSIX_SOURCE */
+#endif /* !_POSIX_SOURCE && !_XOPEN_SOURCE */
#endif /* !_ANSI_SOURCE */
+
+#if (!defined(_ANSI_SOURCE)&&!defined(_POSIX_SOURCE)) || defined(_XOPEN_SOURCE)
+#define LONG_BIT 64
+#define WORD_BIT 32
+
+#define DBL_DIG 15
+#define DBL_MAX 1.7976931348623157E+308
+#define DBL_MIN 2.2250738585072014E-308
+
+#define FLT_DIG 6
+#define FLT_MAX 3.40282347E+38F
+#define FLT_MIN 1.17549435E-38F
+#endif
diff --git a/sys/arch/alpha/include/param.h b/sys/arch/alpha/include/param.h
index ed6528e6cd3..73c09a51f81 100644
--- a/sys/arch/alpha/include/param.h
+++ b/sys/arch/alpha/include/param.h
@@ -1,4 +1,4 @@
-/* $NetBSD: param.h,v 1.10 1995/12/20 00:08:43 cgd Exp $ */
+/* $NetBSD: param.h,v 1.12 1996/03/04 05:04:10 cgd Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -45,7 +45,9 @@
/*
* Machine dependent constants for the Alpha.
*/
+#define _MACHINE alpha
#define MACHINE "alpha"
+#define _MACHINE_ARCH alpha
#define MACHINE_ARCH "alpha"
#define MID_MACHINE MID_ALPHA
@@ -157,7 +159,7 @@
#define splhigh() pal_swpipl(PSL_IPL_HIGH)
#ifdef _KERNEL
-#ifndef LOCORE
+#ifndef _LOCORE
/* This was calibrated empirically */
extern u_int64_t cycles_per_usec;
diff --git a/sys/arch/alpha/include/prom.h b/sys/arch/alpha/include/prom.h
index 66cda050fc4..26a70c0d82d 100644
--- a/sys/arch/alpha/include/prom.h
+++ b/sys/arch/alpha/include/prom.h
@@ -1,4 +1,4 @@
-/* $NetBSD: prom.h,v 1.1 1995/02/13 23:07:48 cgd Exp $ */
+/* $NetBSD: prom.h,v 1.2 1996/04/23 15:23:18 cgd Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
@@ -52,6 +52,7 @@ int prom_open __P((char *, int));
void putchar __P((int));
#endif
+void prom_halt __P((int)) __attribute__((__noreturn__));
int prom_getenv __P((int, char *, int));
#endif
diff --git a/sys/arch/alpha/include/psl.h b/sys/arch/alpha/include/psl.h
index e14260c2bf6..f430f51ec2e 100644
--- a/sys/arch/alpha/include/psl.h
+++ b/sys/arch/alpha/include/psl.h
@@ -1,4 +1,4 @@
-/* $NetBSD: psl.h,v 1.4 1995/11/23 02:36:33 cgd Exp $ */
+/* $NetBSD: psl.h,v 1.5 1996/04/23 15:24:09 cgd Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
@@ -75,8 +75,8 @@
*/
/* Flush all write buffers */
-static __inline int wbflush() { __asm __volatile("mb"); } /* XXX? wmb */
-
+static __inline int wbflush() \
+ { __asm __volatile("mb" : : : "memory"); } /* XXX? wmb */
#define IMB() pal_imb() /* Sync instruction cache w/data */
void alpha_mb __P((void)); /* Flush all write buffers */
@@ -84,6 +84,7 @@ void pal_imb __P((void)); /* Sync instruction cache */
u_int64_t pal_swpipl __P((u_int64_t)); /* write new IPL, return old */
u_int64_t profile_swpipl __P((u_int64_t)); /* pal_swpipl w/o profiling */
void pal_tbi __P((u_int64_t, void *)); /* Invalidate TLB entries */
+void pal_halt __P((void)) __attribute__((__noreturn__)); /* halt/reboot */
#endif /* _KERNEL */
#endif /* !__ALPHA_PSL_H__ */
diff --git a/sys/arch/alpha/include/pte.h b/sys/arch/alpha/include/pte.h
index 95b3a84c06c..bdec6d7e8a2 100644
--- a/sys/arch/alpha/include/pte.h
+++ b/sys/arch/alpha/include/pte.h
@@ -1,4 +1,4 @@
-/* $NetBSD: pte.h,v 1.3 1995/11/23 02:36:37 cgd Exp $ */
+/* $NetBSD: pte.h,v 1.4 1996/02/01 22:28:56 mycroft Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
@@ -66,7 +66,7 @@ typedef u_int64_t pt_entry_t;
#define K0SEG_END 0xfffffe0000000000
#define PHYS_UNCACHED 0x0000000040000000
-#if !defined(LOCORE)
+#ifndef _LOCORE
#define k0segtophys(x) ((vm_offset_t)(x) & 0x00000003ffffffff)
#define phystok0seg(x) ((vm_offset_t)(x) | K0SEG_BEGIN)
diff --git a/sys/arch/alpha/include/rpb.h b/sys/arch/alpha/include/rpb.h
index c738b061ac7..c652f3bfc7b 100644
--- a/sys/arch/alpha/include/rpb.h
+++ b/sys/arch/alpha/include/rpb.h
@@ -1,4 +1,4 @@
-/* $NetBSD: rpb.h,v 1.6 1995/11/23 02:36:41 cgd Exp $ */
+/* $NetBSD: rpb.h,v 1.7 1996/04/29 16:23:11 cgd Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
@@ -169,7 +169,6 @@ struct pcs {
#define PCS_PV 0x000040 /* PALcode valid */
#define PCS_PMV 0x000080 /* PALcode memory valid */
#define PCS_PL 0x000100 /* PALcode loaded */
-#define PCS_PE 0x000200 /* primary eligible (SMP) */
#define PCS_HALT_REQ 0xff0000 /* halt request mask */
#define PCS_HALT_DEFAULT 0x000000
@@ -227,7 +226,7 @@ struct pcs {
#define PCS_VAR_VAXFP 0x0000000000000001 /* VAX FP support */
#define PCS_VAR_IEEEFP 0x0000000000000002 /* IEEE FP support */
-#define PCS_VAR_IOACCESS 0x0000000000000004 /* Has I/O access */
+#define PCS_VAR_PE 0x0000000000000004 /* Primary Eligible */
#define PCS_VAR_RESERVED 0xfffffffffffffff8 /* Reserved */
char pcs_proc_revision[8]; /* C0: only first 4 valid */
diff --git a/sys/arch/alpha/include/sfbreg.h b/sys/arch/alpha/include/sfbreg.h
new file mode 100644
index 00000000000..dcef105d717
--- /dev/null
+++ b/sys/arch/alpha/include/sfbreg.h
@@ -0,0 +1,96 @@
+/* $NetBSD: sfbreg.h,v 1.1 1996/05/01 21:15:46 cgd Exp $ */
+
+/*
+ * Copyright (c) 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+/*
+ * Smart ("CXTurbo") Frame Buffer definitions, from:
+ * ``DEC 3000 300/400/500/600/700/800/900 AXP Models System Prgrammer's Manual''
+ * (DEC order number EK-D3SYS-PM), section 6.
+ *
+ * All definitions are in "dense" TurboChannel space.
+ */
+
+/*
+ * Size of the SFB address space.
+ */
+#define SFB_SIZE 0x1000000
+
+/*
+ * Offsets into slot space of each functional unit.
+ */
+#define SFB_ASIC_OFFSET 0x0100000 /* SFB ASIC Control Registers */
+#define SFB_ASIC_SIZE 0x0020000
+#define SFB_RAMDAC_OFFSET 0x01c0000 /* Bt495 RAMDAC Registers */
+#define SFB_RAMDAC_SIZE 0x0040000
+#define SFB_FB_OFFSET 0x0200000 /* Frame buffer */
+#define SFB_FB_SIZE 0x0200000
+#define SFB_OSBM_OFFSET 0x0600000 /* Off-screen buffer memory */
+#define SFB_OSBM_SIZE 0x0200000
+
+/*
+ * SFB ASIC registers (offsets from SFB_ASIC_OFFSET).
+ */
+#define SFB_ASIC_COPYBUF_0 0x0000 /* Copy buffer register 0 (R/W) */
+#define SFB_ASIC_COPYBUF_1 0x0004 /* Copy buffer register 1 (R/W) */
+#define SFB_ASIC_COPYBUF_2 0x0008 /* Copy buffer register 2 (R/W) */
+#define SFB_ASIC_COPYBUF_3 0x000c /* Copy buffer register 3 (R/W) */
+#define SFB_ASIC_COPYBUF_4 0x0010 /* Copy buffer register 4 (R/W) */
+#define SFB_ASIC_COPYBUF_5 0x0014 /* Copy buffer register 5 (R/W) */
+#define SFB_ASIC_COPYBUF_6 0x0018 /* Copy buffer register 6 (R/W) */
+#define SFB_ASIC_COPYBUF_7 0x001c /* Copy buffer register 7 (R/W) */
+#define SFB_ASIC_FG 0x0020 /* Foreground (R/W) */
+#define SFB_ASIC_BG 0x0024 /* Background (R/W) */
+#define SFB_ASIC_PLANEMASK 0x0028 /* PlaneMask (R/W) */
+#define SFB_ASIC_PIXELMASK 0x002c /* PixelMask (R/W) */
+#define SFB_ASIC_MODE 0x0030 /* Mode (R/W) */
+#define SFB_ASIC_ROP 0x0034 /* RasterOp (R/W) */
+#define SFB_ASIC_PIXELSHIFT 0x0038 /* PixelShift (R/W) */
+#define SFB_ASIC_ADDRESS 0x003c /* Address (R/W) */
+#define SFB_ASIC_BRES1 0x0040 /* Bresenham register 1 (R/W) */
+#define SFB_ASIC_BRES2 0x0044 /* Bresenham register 2 (R/W) */
+#define SFB_ASIC_BRES3 0x0048 /* Bresenham register 3 (R) (?) */
+#define SFB_ASIC_BCONT 0x004c /* Bcont (W) */
+#define SFB_ASIC_DEEP 0x0050 /* Deep (R/W) */
+#define SFB_ASIC_START 0x0054 /* Start (W) */
+#define SFB_ASIC_CLEAR_INTR 0x0058 /* Clear Interrupt (W) */
+#define SFB_ASIC_VIDEO_REFRESH 0x0060 /* Video refresh counter (R/W) */
+#define SFB_ASIC_VIDEO_HSETUP 0x0064 /* Video horizontal setup (R/W) */
+#define SFB_ASIC_VIDEO_VSETUP 0x0068 /* Video vertical setup (R/W) */
+#define SFB_ASIC_VIDEO_BASE 0x006c /* Video base address (R/W) */
+#define SFB_ASIC_VIDEO_VALID 0x0070 /* Video valid (W) */
+#define SFB_ASIC_ENABLE_INTR 0x0074 /* Enable/Disable Interrupts (W) */
+#define SFB_ASIC_TCCLK 0x0078 /* TCCLK count (R/W) */
+#define SFB_ASIC_VIDCLK 0x007c /* VIDCLK count (R/W) */
+
+/*
+ * Bt459 RAMDAC registers (offsets from SFB_RAMDAC_OFFSET)
+ */
+#define SFB_RAMDAC_ADDRLOW 0x0000 /* Address register low byte */
+#define SFB_RAMDAC_ADDRHIGH 0x0004 /* Address register high byte */
+#define SFB_RAMDAC_REGDATA 0x0008 /* Register addressed by addr reg */
+#define SFB_RAMDAC_CMAPDATA 0x000c /* Colormap loc addressed by addr reg */
diff --git a/sys/arch/alpha/include/isa_machdep.h b/sys/arch/alpha/include/sysarch.h
index a5636e42f51..a8a5493ab90 100644
--- a/sys/arch/alpha/include/isa_machdep.h
+++ b/sys/arch/alpha/include/sysarch.h
@@ -1,21 +1,21 @@
-/* $NetBSD: isa_machdep.h,v 1.1 1995/11/23 02:36:11 cgd Exp $ */
+/* $NetBSD: sysarch.h,v 1.1 1996/04/12 01:42:45 cgd Exp $ */
/*
- * Copyright (c) 1995 Carnegie-Mellon University.
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
- *
+ *
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
+ *
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
@@ -27,5 +27,16 @@
* rights to redistribute these changes.
*/
-/* not __ISA_MACHDEP_PIO_DEFINITIONS__ */
-/* not __ISA_MACHDEP_MEM_DEFINITIONS__ */
+#ifndef _ALPHA_SYSARCH_H_
+#define _ALPHA_SYSARCH_H_
+
+static inline u_int64_t
+alpha_rpcc()
+{
+ u_int64_t rv;
+
+ __asm ("rpcc %0" : "=r" (rv));
+ return (rv);
+}
+
+#endif /* _ALPHA_SYSARCH_H_ */
diff --git a/sys/arch/alpha/pci/tgareg.h b/sys/arch/alpha/include/tgareg.h
index 6c335cf9a28..fab595cc556 100644
--- a/sys/arch/alpha/pci/tgareg.h
+++ b/sys/arch/alpha/include/tgareg.h
@@ -1,7 +1,7 @@
-/* $NetBSD: tgareg.h,v 1.3 1995/11/23 02:38:28 cgd Exp $ */
+/* $NetBSD: tgareg.h,v 1.1 1996/04/12 01:44:23 cgd Exp $ */
/*
- * Copyright (c) 1995 Carnegie-Mellon University.
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -27,8 +27,8 @@
* rights to redistribute these changes.
*/
-#ifndef _ALPHA_PCI_TGAREG_H_
-#define _ALPHA_PCI_TGAREG_H_
+#ifndef _ALPHA_INCLUDE_TGAREG_H_
+#define _ALPHA_INCLUDE_TGAREG_H_
/*
* Device-specific PCI register offsets and contents.
@@ -50,7 +50,7 @@
* TGA Core Space register numbers and contents.
*/
-typedef int32_t tga_reg_t;
+typedef u_int32_t tga_reg_t;
#define TGA_REG_GCBR0 0x000 /* Copy buffer 0 */
#define TGA_REG_GCBR1 0x001 /* Copy buffer 1 */
@@ -156,4 +156,4 @@ typedef int32_t tga_reg_t;
/* reserved 0x07f */
-#endif /* _ALPHA_PCI_TGAREG_H_ */
+#endif /* _ALPHA_INCLUDE_TGAREG_H_ */
diff --git a/sys/arch/alpha/include/vuid_event.h b/sys/arch/alpha/include/vuid_event.h
new file mode 100644
index 00000000000..26c0e72590f
--- /dev/null
+++ b/sys/arch/alpha/include/vuid_event.h
@@ -0,0 +1,87 @@
+/* $NetBSD: vuid_event.h,v 1.1 1996/04/12 01:45:47 cgd Exp $ */
+
+/*
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Lawrence Berkeley Laboratory.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)vuid_event.h 8.1 (Berkeley) 6/11/93
+ */
+
+/*
+ * The following is a minimal emulation of Sun's `Firm_event' structures
+ * and related operations necessary to make X11 happy (i.e., make it
+ * compile, and make old X11 binaries run).
+ */
+typedef struct firm_event {
+ u_short id; /* key or MS_* or LOC_[XY]_DELTA */
+ u_short pad; /* unused, at least by X11 */
+ int value; /* VKEY_{UP,DOWN} or locator delta */
+ struct timeval time;
+} Firm_event;
+
+/*
+ * Special `id' fields. These weird numbers simply match the old binaries.
+ * Others are in 0..0x7f and are keyboard key numbers (keyboard dependent!).
+ */
+#define MS_LEFT 0x7f20 /* left mouse button */
+#define MS_MIDDLE 0x7f21 /* middle mouse button */
+#define MS_RIGHT 0x7f22 /* right mouse button */
+#define LOC_X_DELTA 0x7f80 /* mouse delta-X */
+#define LOC_Y_DELTA 0x7f81 /* mouse delta-Y */
+#define LOC_X_ABSOLUTE 0x7f82 /* X compat, unsupported */
+#define LOC_Y_ABSOLUTE 0x7f83 /* X compat, unsupported */
+
+/*
+ * Special `value' fields. These apply to keys and mouse buttons. The
+ * value of a mouse delta is the delta. Note that positive deltas are
+ * left and up (not left and down as you might expect).
+ */
+#define VKEY_UP 0 /* key or button went up */
+#define VKEY_DOWN 1 /* key or button went down */
+
+/*
+ * The following ioctls are clearly intended to take things in and out
+ * of `firm event' mode. Since we always run in this mode (as far as
+ * /dev/kbd and /dev/mouse are concerned, anyway), we always claim to
+ * be in this mode and reject anything else.
+ */
+#define VUIDSFORMAT _IOW('v', 1, int)
+#define VUIDGFORMAT _IOR('v', 2, int)
+#define VUID_FIRM_EVENT 1 /* the only format we support */
diff --git a/sys/arch/alpha/include/wsconsio.h b/sys/arch/alpha/include/wsconsio.h
new file mode 100644
index 00000000000..58848e420f5
--- /dev/null
+++ b/sys/arch/alpha/include/wsconsio.h
@@ -0,0 +1,61 @@
+/* $NetBSD: wsconsio.h,v 1.1 1996/04/12 01:43:06 cgd Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+/*
+ * Get keyboard type. Keyboard type definitions are below.
+ */
+#define WSCONSIO_KBD_GTYPE _IOR('W',100,int)
+#define KBD_TYPE_LK201 0 /* lk-201 */
+#define KBD_TYPE_LK401 1 /* lk-401 */
+#define KBD_TYPE_PC 2 /* pc-like */
+
+/*
+ * If arg is one, don't process scancodes into characters
+ */
+#define WSCONSIO_KBD_SCANCODES _IO('W',101,int)
+
+/*
+ * Bell ioctls.
+ */
+
+struct wsconsio_bell_data {
+ int wbd_flags;
+ int wbd_pitch; /* pitch, in Hz. */
+ int wbd_period; /* period, in milliseconds. */
+ int wbd_volume; /* percentage of maximum volume. */
+};
+
+#define WSCONSIO_BELLDATA_PITCH 0x01 /* pitch data present */
+#define WSCONSIO_BELLDATA_PERIOD 0x02 /* period data present */
+#define WSCONSIO_BELLDATA_VOLUME 0x04 /* volume data present */
+
+#define WSCONSIO_BELL _IO('W',102)
+#define WSCONSIO_COMPLEXBELL _IOW('W',103,struct wsconsio_bell_data)
+#define WSCONSIO_SETBELL _IOW('W',104,struct wsconsio_bell_data)
+#define WSCONSIO_GETBELL _IOR('W',105,struct wsconsio_bell_data)
diff --git a/sys/arch/alpha/isa/isa_machdep.h b/sys/arch/alpha/isa/isa_machdep.h
new file mode 100644
index 00000000000..051811ecafe
--- /dev/null
+++ b/sys/arch/alpha/isa/isa_machdep.h
@@ -0,0 +1,53 @@
+/* $NetBSD: isa_machdep.h,v 1.2 1996/04/12 05:39:02 cgd Exp $ */
+
+/*
+ * Copyright (c) 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+/*
+ * Types provided to machine-independent ISA code.
+ */
+typedef struct alpha_isa_chipset *isa_chipset_tag_t;
+
+struct alpha_isa_chipset {
+ void *ic_v;
+
+ void (*ic_attach_hook) __P((struct device *, struct device *,
+ struct isabus_attach_args *));
+ void *(*ic_intr_establish) __P((void *, int, int, int,
+ int (*)(void *), void *));
+ void (*ic_intr_disestablish) __P((void *, void *));
+};
+
+/*
+ * Functions provided to machine-independent ISA code.
+ */
+#define isa_attach_hook(p, s, a) \
+ (*(a)->iba_ic->ic_attach_hook)((p), (s), (a))
+#define isa_intr_establish(c, i, t, l, f, a) \
+ (*(c)->ic_intr_establish)((c)->ic_v, (i), (t), (l), (f), (a))
+#define isa_intr_disestablish(c, h) \
+ (*(c)->ic_intr_disestablish)((c)->ic_v, (h))
diff --git a/sys/arch/alpha/isa/isafcns_jensen.c b/sys/arch/alpha/isa/isafcns_jensen.c
index 3e5624357b8..5ac135aea69 100644
--- a/sys/arch/alpha/isa/isafcns_jensen.c
+++ b/sys/arch/alpha/isa/isafcns_jensen.c
@@ -1,3 +1,31 @@
+/* $NetBSD: isafcns_jensen.c,v 1.2 1996/04/12 01:54:04 cgd Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
#include <sys/types.h>
#include <machine/pio.h>
diff --git a/sys/arch/alpha/isa/mcclock_isa.c b/sys/arch/alpha/isa/mcclock_isa.c
new file mode 100644
index 00000000000..fb9ac1f778b
--- /dev/null
+++ b/sys/arch/alpha/isa/mcclock_isa.c
@@ -0,0 +1,120 @@
+/* $NetBSD: mcclock_isa.c,v 1.2 1996/04/17 22:22:46 cgd Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#include <sys/param.h>
+#include <sys/kernel.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+
+#include <machine/bus.h>
+
+#include <alpha/alpha/clockvar.h>
+#include <alpha/alpha/mcclockvar.h>
+#include <dev/ic/mc146818reg.h>
+#include <dev/isa/isavar.h>
+
+struct mcclock_isa_softc {
+ struct mcclock_softc sc_mcclock;
+
+ bus_chipset_tag_t sc_bc;
+ bus_io_handle_t sc_ioh;
+};
+
+int mcclock_isa_match __P((struct device *, void *, void *));
+void mcclock_isa_attach __P((struct device *, struct device *, void *));
+
+struct cfattach mcclock_isa_ca = {
+ sizeof (struct mcclock_isa_softc), mcclock_isa_match,
+ mcclock_isa_attach,
+};
+
+void mcclock_isa_write __P((struct mcclock_softc *, u_int, u_int));
+u_int mcclock_isa_read __P((struct mcclock_softc *, u_int));
+
+const struct mcclock_busfns mcclock_isa_busfns = {
+ mcclock_isa_write, mcclock_isa_read,
+};
+
+int
+mcclock_isa_match(parent, match, aux)
+ struct device *parent;
+ void *match, *aux;
+{
+ struct isa_attach_args *ia = aux;
+
+ if (ia->ia_iobase != 0x70 && ia->ia_iobase != -1)
+ return (0);
+
+ ia->ia_iobase = 0x70; /* XXX */
+ ia->ia_iosize = 2; /* XXX */
+ ia->ia_msize = 0;
+
+ return (1);
+}
+
+void
+mcclock_isa_attach(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ struct isa_attach_args *ia = aux;
+ struct mcclock_isa_softc *sc = (struct mcclock_isa_softc *)self;
+
+ sc->sc_bc = ia->ia_bc;
+ if (bus_io_map(sc->sc_bc, ia->ia_iobase, ia->ia_iosize, &sc->sc_ioh))
+ panic("mcclock_isa_attach: couldn't map clock I/O space");
+
+ mcclock_attach(&sc->sc_mcclock, &mcclock_isa_busfns);
+}
+
+void
+mcclock_isa_write(mcsc, reg, datum)
+ struct mcclock_softc *mcsc;
+ u_int reg, datum;
+{
+ struct mcclock_isa_softc *sc = (struct mcclock_isa_softc *)mcsc;
+ bus_chipset_tag_t bc = sc->sc_bc;
+ bus_io_handle_t ioh = sc->sc_ioh;
+
+ bus_io_write_1(bc, ioh, 0, reg);
+ bus_io_write_1(bc, ioh, 1, datum);
+}
+
+u_int
+mcclock_isa_read(mcsc, reg)
+ struct mcclock_softc *mcsc;
+ u_int reg;
+{
+ struct mcclock_isa_softc *sc = (struct mcclock_isa_softc *)mcsc;
+ bus_chipset_tag_t bc = sc->sc_bc;
+ bus_io_handle_t ioh = sc->sc_ioh;
+
+ bus_io_write_1(bc, ioh, 0, reg);
+ return bus_io_read_1(bc, ioh, 1);
+}
diff --git a/sys/arch/alpha/isa/pckbd.c b/sys/arch/alpha/isa/pckbd.c
index ab269620ef7..0a212449aeb 100644
--- a/sys/arch/alpha/isa/pckbd.c
+++ b/sys/arch/alpha/isa/pckbd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pckbd.c,v 1.3 1995/12/24 02:29:35 mycroft Exp $ */
+/* $NetBSD: pckbd.c,v 1.7 1996/05/05 01:41:53 thorpej Exp $ */
/*-
* Copyright (c) 1993, 1994, 1995 Charles Hannum. All rights reserved.
@@ -52,16 +52,18 @@
#include <sys/kernel.h>
#include <sys/device.h>
-#include <machine/cpu.h>
+#include <machine/intr.h>
+#include <machine/bus.h>
#include <dev/isa/isareg.h>
#include <dev/isa/isavar.h>
#include <alpha/isa/pckbdreg.h>
+#include <alpha/isa/spkrreg.h>
+#include <alpha/isa/timerreg.h>
+#include <machine/wsconsio.h>
-#include "wsc.h"
-#if NWSC
-#include <alpha/pci/wsconsvar.h>
-#endif
+#include <alpha/wscons/wsconsvar.h>
+#include "wscons.h"
static volatile u_char ack, nak; /* Don't ask. */
static u_char async, kernel, polling; /* Really, you don't want to know. */
@@ -70,28 +72,58 @@ static u_char lock_state = 0x00, /* all off */
typematic_rate = 0xff, /* don't update until set by user */
old_typematic_rate = 0xff;
-__const struct isa_intr_fns *pckbd_intr_fns; /* XXX */
-void *pckbd_intr_arg; /* XXX */
-__const struct isa_pio_fns *pckbd_pio_fns; /* XXX */
-void *pckbd_pio_arg; /* XXX */
+bus_chipset_tag_t pckbd_bc;
+isa_chipset_tag_t pckbd_ic;
+
+bus_io_handle_t pckbd_data_ioh;
+#define pckbd_out_ioh pckbd_data_ioh
+bus_io_handle_t pckbd_status_ioh;
+#define pckbd_cmd_ioh pckbd_status_ioh
+bus_io_handle_t pckbd_timer_ioh;
+bus_io_handle_t pckbd_pitaux_ioh;
+bus_io_handle_t pckbd_delay_ioh;
struct pckbd_softc {
struct device sc_dev;
void *sc_ih;
+
+ int sc_bellactive; /* is the bell active? */
+ int sc_bellpitch; /* last pitch programmed */
};
int pckbdprobe __P((struct device *, void *, void *));
void pckbdattach __P((struct device *, struct device *, void *));
int pckbdintr __P((void *));
-struct cfdriver pckbdcd = {
- NULL, "pckbd", pckbdprobe, pckbdattach, DV_DULL,
- sizeof(struct pckbd_softc)
+struct cfattach pckbd_ca = {
+ sizeof(struct pckbd_softc), pckbdprobe, pckbdattach,
};
-char *sget __P((void));
-int pccngetc __P((void *));
-void pccnpollc __P((void *, int));
+struct cfdriver pckbd_cd = {
+ NULL, "pckbd", DV_DULL,
+};
+
+int pckbd_cngetc __P((struct device *));
+void pckbd_cnpollc __P((struct device *, int));
+void pckbd_bell __P((struct device *, struct wsconsio_bell_data *));
+int pckbd_ioctl __P((struct device *, u_long, caddr_t, int,
+ struct proc *));
+
+char *pckbd_translate __P((struct device *dev, int c));
+
+#if NWSCONS
+struct wscons_idev_spec pckbd_wscons_idev = {
+ pckbd_cngetc,
+ pckbd_cnpollc,
+ pckbd_bell,
+ pckbd_ioctl,
+ pckbd_translate,
+ 0x7f, /* key data mask */
+ 0x80, /* key-up mask */
+};
+#endif
+
+void pckbd_bell_stop __P((void *));
/*
* DANGER WIL ROBINSON -- the values of SCROLL, NUM, CAPS, and ALT are
@@ -109,10 +141,10 @@ void pccnpollc __P((void *, int));
#define NONE 0x0400 /* no function */
#define KBD_DELAY \
- { u_char x = INB(pckbd_pio_fns, pckbd_pio_arg, 0x84); } \
- { u_char x = INB(pckbd_pio_fns, pckbd_pio_arg, 0x84); } \
- { u_char x = INB(pckbd_pio_fns, pckbd_pio_arg, 0x84); } \
- { u_char x = INB(pckbd_pio_fns, pckbd_pio_arg, 0x84); }
+ { u_char x = bus_io_read_1(pckbd_bc, pckbd_delay_ioh, 0); } \
+ { u_char x = bus_io_read_1(pckbd_bc, pckbd_delay_ioh, 0); } \
+ { u_char x = bus_io_read_1(pckbd_bc, pckbd_delay_ioh, 0); } \
+ { u_char x = bus_io_read_1(pckbd_bc, pckbd_delay_ioh, 0); }
static inline int
kbd_wait_output()
@@ -120,7 +152,7 @@ kbd_wait_output()
u_int i;
for (i = 100000; i; i--)
- if ((INB(pckbd_pio_fns, pckbd_pio_arg, KBSTATP) & KBS_IBF)
+ if ((bus_io_read_1(pckbd_bc, pckbd_status_ioh, 0) & KBS_IBF)
== 0) {
KBD_DELAY;
return 1;
@@ -134,7 +166,7 @@ kbd_wait_input()
u_int i;
for (i = 100000; i; i--)
- if ((INB(pckbd_pio_fns, pckbd_pio_arg, KBSTATP) & KBS_DIB)
+ if ((bus_io_read_1(pckbd_bc, pckbd_status_ioh, 0) & KBS_DIB)
!= 0) {
KBD_DELAY;
return 1;
@@ -148,11 +180,11 @@ kbd_flush_input()
u_int i;
for (i = 10; i; i--) {
- if ((INB(pckbd_pio_fns, pckbd_pio_arg, KBSTATP) & KBS_DIB)
+ if ((bus_io_read_1(pckbd_bc, pckbd_status_ioh, 0) & KBS_DIB)
== 0)
return;
KBD_DELAY;
- (void) INB(pckbd_pio_fns, pckbd_pio_arg, KBDATAP);
+ (void) bus_io_read_1(pckbd_bc, pckbd_data_ioh, 0);
}
}
@@ -166,10 +198,10 @@ kbc_get8042cmd()
if (!kbd_wait_output())
return -1;
- OUTB(pckbd_pio_fns, pckbd_pio_arg, KBCMDP, K_RDCMDBYTE);
+ bus_io_write_1(pckbd_bc, pckbd_cmd_ioh, 0, K_RDCMDBYTE);
if (!kbd_wait_input())
return -1;
- return INB(pckbd_pio_fns, pckbd_pio_arg, KBDATAP);
+ return bus_io_read_1(pckbd_bc, pckbd_data_ioh, 0);
}
#endif
@@ -183,10 +215,10 @@ kbc_put8042cmd(val)
if (!kbd_wait_output())
return 0;
- OUTB(pckbd_pio_fns, pckbd_pio_arg, KBCMDP, K_LDCMDBYTE);
+ bus_io_write_1(pckbd_bc, pckbd_cmd_ioh, 0, K_LDCMDBYTE);
if (!kbd_wait_output())
return 0;
- OUTB(pckbd_pio_fns, pckbd_pio_arg, KBOUTP, val);
+ bus_io_write_1(pckbd_bc, pckbd_out_ioh, 0, val);
return 1;
}
@@ -205,16 +237,16 @@ kbd_cmd(val, polling)
if (!kbd_wait_output())
return 0;
ack = nak = 0;
- OUTB(pckbd_pio_fns, pckbd_pio_arg, KBOUTP, val);
+ bus_io_write_1(pckbd_bc, pckbd_out_ioh, 0, val);
if (polling)
for (i = 100000; i; i--) {
- if (INB(pckbd_pio_fns, pckbd_pio_arg,
- KBSTATP) & KBS_DIB) {
+ if (bus_io_read_1(pckbd_bc,
+ pckbd_status_ioh, 0) & KBS_DIB) {
register u_char c;
KBD_DELAY;
- c = INB(pckbd_pio_fns, pckbd_pio_arg,
- KBDATAP);
+ c = bus_io_read_1(pckbd_bc,
+ pckbd_data_ioh, 0);
if (c == KBR_ACK || c == KBR_ECHO) {
ack = 1;
return 1;
@@ -231,8 +263,8 @@ kbd_cmd(val, polling)
}
else
for (i = 100000; i; i--) {
- (void) INB(pckbd_pio_fns, pckbd_pio_arg,
- KBSTATP);
+ (void) bus_io_read_1(pckbd_bc,
+ pckbd_status_ioh, 0);
if (ack)
return 1;
if (nak)
@@ -252,11 +284,19 @@ pckbdprobe(parent, match, aux)
struct device *parent;
void *match, *aux;
{
- struct isadev_attach_args *ida = aux;
+ struct isa_attach_args *ia = aux;
u_int i;
- pckbd_pio_fns = ida->ida_piofns; /* XXX */
- pckbd_pio_arg = ida->ida_pioarg; /* XXX */
+ pckbd_bc = ia->ia_bc;
+ pckbd_ic = ia->ia_ic;
+
+ if (bus_io_map(pckbd_bc, KBDATAP, 1, &pckbd_data_ioh) ||
+ bus_io_map(pckbd_bc, KBSTATP, 1, &pckbd_status_ioh) ||
+ bus_io_map(pckbd_bc, IO_TIMER1, 4, &pckbd_timer_ioh) ||
+ bus_io_map(pckbd_bc, PITAUX_PORT, 1, &pckbd_pitaux_ioh))
+ return 0;
+
+ pckbd_delay_ioh = ia->ia_delayioh;
/* Enable interrupts and keyboard, etc. */
if (!kbc_put8042cmd(CMDBYTE)) {
@@ -273,12 +313,12 @@ pckbdprobe(parent, match, aux)
goto lose;
}
for (i = 600000; i; i--)
- if ((INB(pckbd_pio_fns, pckbd_pio_arg, KBSTATP) & KBS_DIB)
+ if ((bus_io_read_1(pckbd_bc, pckbd_status_ioh, 0) & KBS_DIB)
!= 0) {
KBD_DELAY;
break;
}
- if (i == 0 || INB(pckbd_pio_fns, pckbd_pio_arg, KBDATAP)
+ if (i == 0 || bus_io_read_1(pckbd_bc, pckbd_data_ioh, 0)
!= KBR_RSTDONE) {
printf("pcprobe: reset error %d\n", 2);
goto lose;
@@ -329,8 +369,8 @@ lose:
*/
#endif
- ida->ida_nports[0] = 16;
- ida->ida_iosiz[0] = 0;
+ ia->ia_iobase = 16;
+ ia->ia_iosize = 0;
return 1;
}
@@ -340,20 +380,29 @@ pckbdattach(parent, self, aux)
void *aux;
{
struct pckbd_softc *sc = (void *)self;
- struct isadev_attach_args *ida = aux;
-
- pckbd_intr_fns = ida->ida_intrfns; /* XXX */
- pckbd_intr_arg = ida->ida_intrarg; /* XXX */
- pckbd_pio_fns = ida->ida_piofns; /* XXX */
- pckbd_pio_arg = ida->ida_pioarg; /* XXX */
-
- sc->sc_ih = ISA_INTR_ESTABLISH(pckbd_intr_fns, pckbd_intr_arg,
- ida->ida_irq[0], IST_EDGE, IPL_TTY, pckbdintr, sc);
-#if NWSC
+ struct isa_attach_args *ia = aux;
+
+ pckbd_bc = ia->ia_bc;
+ pckbd_ic = ia->ia_ic;
+
+ if (bus_io_map(pckbd_bc, KBDATAP, 1, &pckbd_data_ioh) ||
+ bus_io_map(pckbd_bc, KBSTATP, 1, &pckbd_status_ioh) ||
+ bus_io_map(pckbd_bc, IO_TIMER1, 4, &pckbd_timer_ioh) ||
+ bus_io_map(pckbd_bc, PITAUX_PORT, 1, &pckbd_pitaux_ioh))
+ panic("pckbdattach couldn't map");
+
+ pckbd_delay_ioh = ia->ia_delayioh;
+
+ sc->sc_ih = isa_intr_establish(pckbd_ic, ia->ia_irq, IST_EDGE,
+ IPL_TTY, pckbdintr, sc);
+
+ sc->sc_bellactive = sc->sc_bellpitch = 0;
+
+#if NWSCONS
printf("\n");
- wscattach_input(self, self, pccngetc, pccnpollc);
+ kbdattach(self, &pckbd_wscons_idev);
#else
- printf(": no wsc driver; no input possible\n");
+ printf(": no wscons driver present; no input possible\n");
#endif
}
@@ -367,19 +416,35 @@ pckbdintr(arg)
void *arg;
{
struct pckbd_softc *sc = arg;
- u_char *cp;
+ u_char data;
+ static u_char last;
- if ((INB(pckbd_pio_fns, pckbd_pio_arg, KBSTATP) & KBS_DIB) == 0)
+ if ((bus_io_read_1(pckbd_bc, pckbd_status_ioh, 0) & KBS_DIB) == 0)
return 0;
if (polling)
return 1;
do {
- cp = sget();
-#if NWSC
- if (cp)
- wscons_kbdinput(cp);
+ KBD_DELAY;
+ data = bus_io_read_1(pckbd_bc, pckbd_data_ioh, 0);
+
+ switch (data) {
+ case KBR_ACK:
+ ack = 1;
+ break;
+ case KBR_RESEND:
+ nak = 1;
+ break;
+ default:
+ /* Always ignore typematic keys */
+ if (data == last)
+ break;
+ last = data;
+#if NWSCONS
+ kbd_input(data);
#endif
- } while (INB(pckbd_pio_fns, pckbd_pio_arg, KBSTATP) & KBS_DIB);
+ break;
+ }
+ } while (bus_io_read_1(pckbd_bc, pckbd_status_ioh, 0) & KBS_DIB);
return 1;
}
@@ -426,6 +491,23 @@ async_update()
}
}
+int
+pckbd_ioctl(dev, cmd, data, flag, p)
+ struct device *dev;
+ u_long cmd;
+ caddr_t data;
+ int flag;
+ struct proc *p;
+{
+
+ switch (cmd) {
+ case WSCONSIO_KBD_GTYPE:
+ *(int *)data = KBD_TYPE_PC;
+ return 0;
+ }
+ return ENOTTY;
+}
+
#if 0
int
pcioctl(dev, cmd, data, flag, p)
@@ -633,96 +715,18 @@ static Scan_def scan_codes[] = {
* Get characters from the keyboard. If none are present, return NULL.
*/
char *
-sget()
+pckbd_translate(dev, c)
+ struct device *dev;
+ int c;
{
- u_char dt;
+ u_char dt = c;
static u_char extended = 0, shift_state = 0;
static u_char capchar[2];
-top:
- KBD_DELAY;
- dt = INB(pckbd_pio_fns, pckbd_pio_arg, KBDATAP);
-
- switch (dt) {
- case KBR_ACK:
- ack = 1;
- goto loop;
- case KBR_RESEND:
- nak = 1;
- goto loop;
- }
-
-#if 0
- if (pc_xmode > 0) {
-#if defined(DDB) && defined(XSERVER_DDB)
- /* F12 enters the debugger while in X mode */
- if (dt == 88)
- Debugger();
-#endif
- capchar[0] = dt;
- capchar[1] = 0;
- /*
- * Check for locking keys.
- *
- * XXX Setting the LEDs this way is a bit bogus. What if the
- * keyboard has been remapped in X?
- */
- switch (scan_codes[dt & 0x7f].type) {
- case NUM:
- if (dt & 0x80) {
- shift_state &= ~NUM;
- break;
- }
- if (shift_state & NUM)
- break;
- shift_state |= NUM;
- lock_state ^= NUM;
- async_update();
- break;
- case CAPS:
- if (dt & 0x80) {
- shift_state &= ~CAPS;
- break;
- }
- if (shift_state & CAPS)
- break;
- shift_state |= CAPS;
- lock_state ^= CAPS;
- async_update();
- break;
- case SCROLL:
- if (dt & 0x80) {
- shift_state &= ~SCROLL;
- break;
- }
- if (shift_state & SCROLL)
- break;
- shift_state |= SCROLL;
- lock_state ^= SCROLL;
- if ((lock_state & SCROLL) == 0)
- wakeup((caddr_t)&lock_state);
- async_update();
- break;
- }
- return capchar;
- }
-#endif /* 0 */
-
- switch (dt) {
- case KBR_EXTENDED:
+ if (dt == KBR_EXTENDED) {
extended = 1;
- goto loop;
- }
-
-#ifdef DDB
- /*
- * Check for cntl-alt-esc.
- */
- if ((dt == 1) && (shift_state & (CTL | ALT)) == (CTL | ALT)) {
- Debugger();
- dt |= 0x80; /* discard esc (ddb discarded ctl-alt) */
+ return NULL;
}
-#endif
/*
* Check for make/break.
@@ -837,31 +841,43 @@ top:
}
extended = 0;
-loop:
- if ((INB(pckbd_pio_fns, pckbd_pio_arg, KBSTATP) & KBS_DIB) == 0)
- return 0;
- goto top;
+ return (NULL);
}
/* ARGSUSED */
int
-pccngetc(cookie)
- void *cookie;
+pckbd_cngetc(dev)
+ struct device *dev;
{
register char *cp;
-
-#if 0
- if (pc_xmode > 0)
- return 0;
-#endif
+ u_char data;
+ static u_char last;
do {
- /* wait for byte */
- while ((INB(pckbd_pio_fns, pckbd_pio_arg, KBSTATP) & KBS_DIB)
- == 0);
- /* see if it's worthwhile */
- cp = sget();
+ /* wait for byte */
+ while ((bus_io_read_1(pckbd_bc, pckbd_status_ioh, 0) & KBS_DIB)
+ == 0)
+ KBD_DELAY;
+ KBD_DELAY;
+
+ data = bus_io_read_1(pckbd_bc, pckbd_data_ioh, 0);
+
+ if (data == KBR_ACK) {
+ ack = 1;
+ continue;
+ }
+ if (data == KBR_RESEND) {
+ nak = 1;
+ continue;
+ }
+
+ /* Ignore typematic keys */
+ if (data == last)
+ continue;
+ last = data;
+
+ cp = pckbd_translate(NULL, data);
} while (!cp);
if (*cp == '\r')
return '\n';
@@ -869,11 +885,11 @@ pccngetc(cookie)
}
void
-pccnpollc(cookie, on)
- void *cookie;
+pckbd_cnpollc(dev, on)
+ struct device *dev;
int on;
{
- struct pckbd_softc *sc = cookie;
+ struct pckbd_softc *sc = (struct pckbd_softc *)dev;
polling = on;
if (!on) {
@@ -892,3 +908,59 @@ pccnpollc(cookie, on)
}
}
}
+
+void
+pckbd_bell(dev, wbd)
+ struct device *dev;
+ struct wsconsio_bell_data *wbd;
+{
+ struct pckbd_softc *sc = (struct pckbd_softc *)dev;
+ int pitch, period;
+ int s;
+
+ pitch = wbd->wbd_pitch;
+ period = (wbd->wbd_period * hz) / 1000;
+ /* XXX volume ignored */
+
+ s = splhigh();
+ if (sc->sc_bellactive)
+ untimeout(pckbd_bell_stop, sc);
+ splx(s);
+ if (pitch == 0 || period == 0) {
+ pckbd_bell_stop(sc);
+ sc->sc_bellpitch = 0;
+ return;
+ }
+ if (!sc->sc_bellactive || sc->sc_bellpitch != pitch) {
+ s = splhigh();
+ bus_io_write_1(pckbd_bc, pckbd_timer_ioh, TIMER_MODE,
+ TIMER_SEL2 | TIMER_16BIT | TIMER_SQWAVE);
+ bus_io_write_1(pckbd_bc, pckbd_timer_ioh, TIMER_CNTR2,
+ TIMER_DIV(pitch) % 256);
+ bus_io_write_1(pckbd_bc, pckbd_timer_ioh, TIMER_CNTR2,
+ TIMER_DIV(pitch) / 256);
+ /* enable speaker */
+ bus_io_write_1(pckbd_bc, pckbd_pitaux_ioh, 0,
+ bus_io_read_1(pckbd_bc, pckbd_pitaux_ioh, 0) |
+ PIT_SPKR);
+ splx(s);
+ }
+ sc->sc_bellpitch = pitch;
+ sc->sc_bellactive = 1;
+ timeout(pckbd_bell_stop, sc, period);
+}
+
+void
+pckbd_bell_stop(arg)
+ void *arg;
+{
+ struct pckbd_softc *sc = arg;
+ int s;
+
+ /* disable bell */
+ s = splhigh();
+ bus_io_write_1(pckbd_bc, pckbd_pitaux_ioh, 0,
+ bus_io_read_1(pckbd_bc, pckbd_pitaux_ioh, 0) & ~PIT_SPKR);
+ sc->sc_bellactive = 0;
+ splx(s);
+}
diff --git a/sys/arch/alpha/isa/pms.c b/sys/arch/alpha/isa/pms.c
new file mode 100644
index 00000000000..5fc6e3ae649
--- /dev/null
+++ b/sys/arch/alpha/isa/pms.c
@@ -0,0 +1,329 @@
+/* $NetBSD: pms.c,v 1.1 1996/04/12 01:53:06 cgd Exp $ */
+
+/*-
+ * Copyright (c) 1994 Charles Hannum.
+ * Copyright (c) 1992, 1993 Erik Forsberg.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
+ * NO EVENT SHALL I BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * XXXX
+ * This is a hack. This driver should really be combined with the
+ * keyboard driver, since they go through the same buffer and use the
+ * same I/O ports. Frobbing the mouse and keyboard at the same time
+ * may result in dropped characters and/or corrupted mouse events.
+ */
+
+#include "pms.h"
+#if NPMS > 1
+#error Only one PS/2 style mouse may be configured into your system.
+#endif
+
+#include <sys/param.h>
+#include <sys/kernel.h>
+#include <sys/systm.h>
+#include <sys/buf.h>
+#include <sys/malloc.h>
+#include <sys/ioctl.h>
+#include <sys/tty.h>
+#include <sys/file.h>
+#include <sys/select.h>
+#include <sys/proc.h>
+#include <sys/vnode.h>
+#include <sys/device.h>
+
+#include <machine/intr.h>
+#include <dev/isa/isavar.h>
+#include <alpha/wscons/wsconsvar.h>
+
+#define PMS_DATA 0x60 /* offset for data port, read-write */
+#define PMS_CNTRL 0x64 /* offset for control port, write-only */
+#define PMS_STATUS 0x64 /* offset for status port, read-only */
+#define PMS_NPORTS 8
+
+/* status bits */
+#define PMS_OBUF_FULL 0x01
+#define PMS_IBUF_FULL 0x02
+
+/* controller commands */
+#define PMS_INT_ENABLE 0x47 /* enable controller interrupts */
+#define PMS_INT_DISABLE 0x65 /* disable controller interrupts */
+#define PMS_AUX_ENABLE 0xa8 /* enable auxiliary port */
+#define PMS_AUX_DISABLE 0xa7 /* disable auxiliary port */
+#define PMS_AUX_TEST 0xa9 /* test auxiliary port */
+
+#define PMS_8042_CMD 0x65
+
+/* mouse commands */
+#define PMS_SET_SCALE11 0xe6 /* set scaling 1:1 */
+#define PMS_SET_SCALE21 0xe7 /* set scaling 2:1 */
+#define PMS_SET_RES 0xe8 /* set resolution */
+#define PMS_GET_SCALE 0xe9 /* get scaling factor */
+#define PMS_SET_STREAM 0xea /* set streaming mode */
+#define PMS_SET_SAMPLE 0xf3 /* set sampling rate */
+#define PMS_DEV_ENABLE 0xf4 /* mouse on */
+#define PMS_DEV_DISABLE 0xf5 /* mouse off */
+#define PMS_RESET 0xff /* reset */
+
+#define PMS_CHUNK 128 /* chunk size for read */
+#define PMS_BSIZE 1020 /* buffer size */
+
+struct pms_softc { /* driver status information */
+ struct device sc_dev;
+
+ void *sc_ih;
+
+ u_char sc_state; /* mouse driver state */
+#define PMS_OPEN 0x01 /* device is open */
+#define PMS_ASLP 0x02 /* waiting for mouse data */
+ u_char sc_status; /* mouse button status */
+ int sc_x, sc_y; /* accumulated motion in the X,Y axis */
+};
+
+bus_chipset_tag_t pms_bc;
+isa_chipset_tag_t pms_ic;
+bus_io_handle_t pms_cntrl_ioh;
+#define pms_status_ioh pms_cntrl_ioh
+bus_io_handle_t pms_data_ioh;
+
+int pmsprobe __P((struct device *, void *, void *));
+void pmsattach __P((struct device *, struct device *, void *));
+int pmsintr __P((void *));
+
+struct cfattach pms_ca = {
+ sizeof(struct pms_softc), pmsprobe, pmsattach,
+};
+
+struct cfdriver pms_cd = {
+ NULL, "pms", DV_TTY,
+};
+
+#define PMSUNIT(dev) (minor(dev))
+
+int pms_enable __P((struct device *));
+int pms_disable __P((struct device *));
+
+struct wscons_mdev_spec pms_mdev_spec = {
+ pms_enable,
+ pms_disable,
+};
+
+static inline void
+pms_flush()
+{
+ u_char c;
+
+ while (c = bus_io_read_1(pms_bc, pms_status_ioh, 0) & 0x03)
+ if ((c & PMS_OBUF_FULL) == PMS_OBUF_FULL) {
+ /* XXX - delay is needed to prevent some keyboards from
+ wedging when the system boots */
+ delay(6);
+ (void) bus_io_read_1(pms_bc, pms_data_ioh, 0);
+ }
+}
+
+static inline void
+pms_dev_cmd(value)
+ u_char value;
+{
+
+ pms_flush();
+ bus_io_write_1(pms_bc, pms_cntrl_ioh, 0, 0xd4);
+ pms_flush();
+ bus_io_write_1(pms_bc, pms_data_ioh, 0, value);
+}
+
+static inline void
+pms_aux_cmd(value)
+ u_char value;
+{
+
+ pms_flush();
+ bus_io_write_1(pms_bc, pms_cntrl_ioh, 0, value);
+}
+
+static inline void
+pms_pit_cmd(value)
+ u_char value;
+{
+
+ pms_flush();
+ bus_io_write_1(pms_bc, pms_cntrl_ioh, 0, 0x60);
+ pms_flush();
+ bus_io_write_1(pms_bc, pms_data_ioh, 0, value);
+}
+
+int
+pmsprobe(parent, match, aux)
+ struct device *parent;
+ void *match, *aux;
+{
+ struct isa_attach_args *ia = aux;
+ u_char x;
+
+ pms_bc = ia->ia_bc;
+
+ if (ia->ia_iobase != 0x60)
+ return 0;
+
+ if (bus_io_map(pms_bc, PMS_DATA, 1, &pms_data_ioh) ||
+ bus_io_map(pms_bc, PMS_CNTRL, 1, &pms_cntrl_ioh))
+ return 0;
+
+ pms_dev_cmd(PMS_RESET);
+ pms_aux_cmd(PMS_AUX_TEST);
+ delay(1000);
+ x = bus_io_read_1(pms_bc, pms_data_ioh, 0);
+ pms_pit_cmd(PMS_INT_DISABLE);
+ if (x & 0x04)
+ return 0;
+
+ ia->ia_iosize = PMS_NPORTS;
+ ia->ia_msize = 0;
+ return 1;
+}
+
+void
+pmsattach(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ struct pms_softc *sc = (void *)self;
+ struct isa_attach_args *ia = aux;
+
+ pms_bc = ia->ia_bc;
+ pms_ic = ia->ia_ic;
+
+ if (bus_io_map(pms_bc, PMS_DATA, 1, &pms_data_ioh) ||
+ bus_io_map(pms_bc, PMS_CNTRL, 1, &pms_cntrl_ioh)) {
+ printf(": can't map I/O ports!\n");
+ return;
+ }
+
+ msattach(self, &pms_mdev_spec);
+
+ printf("\n");
+
+ /* Other initialization was done by pmsprobe. */
+ sc->sc_state = 0;
+
+ sc->sc_ih = isa_intr_establish(pms_ic, ia->ia_irq, IST_EDGE, IPL_TTY,
+ pmsintr, sc);
+}
+
+int
+pms_enable(dev)
+ struct device *dev;
+{
+ struct pms_softc *sc = (struct pms_softc *)dev;
+
+ if (sc->sc_state & PMS_OPEN)
+ return EBUSY;
+
+ sc->sc_state |= PMS_OPEN;
+ sc->sc_status = 0;
+ sc->sc_x = sc->sc_y = 0;
+
+ /* Enable interrupts. */
+ pms_dev_cmd(PMS_DEV_ENABLE);
+ pms_aux_cmd(PMS_AUX_ENABLE);
+#if 0
+ pms_dev_cmd(PMS_SET_RES);
+ pms_dev_cmd(3); /* 8 counts/mm */
+ pms_dev_cmd(PMS_SET_SCALE21);
+ pms_dev_cmd(PMS_SET_SAMPLE);
+ pms_dev_cmd(100); /* 100 samples/sec */
+ pms_dev_cmd(PMS_SET_STREAM);
+#endif
+ pms_pit_cmd(PMS_INT_ENABLE);
+
+ return 0;
+}
+
+int
+pms_disable(dev)
+ struct device *dev;
+{
+ struct pms_softc *sc = (struct pms_softc *)dev;
+
+ /* Disable interrupts. */
+ pms_dev_cmd(PMS_DEV_DISABLE);
+ pms_pit_cmd(PMS_INT_DISABLE);
+ pms_aux_cmd(PMS_AUX_DISABLE);
+
+ sc->sc_state &= ~PMS_OPEN;
+
+ return 0;
+}
+
+/* Masks for the first byte of a packet */
+#define PS2LBUTMASK 0x01
+#define PS2RBUTMASK 0x02
+#define PS2MBUTMASK 0x04
+
+int
+pmsintr(arg)
+ void *arg;
+{
+ struct pms_softc *sc = arg;
+ static int state = 0;
+ static u_char buttons;
+ u_char changed;
+ static char dx, dy;
+ u_char buffer[5];
+
+ if ((sc->sc_state & PMS_OPEN) == 0) {
+ /* Interrupts are not expected. Discard the byte. */
+ pms_flush();
+ return 0;
+ }
+
+ switch (state) {
+
+ case 0:
+ buttons = bus_io_read_1(pms_bc, pms_data_ioh, 0);
+ if ((buttons & 0xc0) == 0)
+ ++state;
+ break;
+
+ case 1:
+ dx = bus_io_read_1(pms_bc, pms_data_ioh, 0);
+ /* Bounding at -127 avoids a bug in XFree86. */
+ dx = (dx == -128) ? -127 : dx;
+ ++state;
+ break;
+
+ case 2:
+ dy = bus_io_read_1(pms_bc, pms_data_ioh, 0);
+ dy = (dy == -128) ? -127 : dy;
+ state = 0;
+
+ buttons = ((buttons & PS2LBUTMASK) << 2) |
+ ((buttons & (PS2RBUTMASK | PS2MBUTMASK)) >> 1);
+ changed = (buttons ^ sc->sc_status);
+ sc->sc_status = buttons;
+
+ if (dx || dy || changed)
+ ms_event(buttons, dx, dy);
+ break;
+ }
+
+ return -1;
+}
diff --git a/sys/arch/alpha/isa/spkrreg.h b/sys/arch/alpha/isa/spkrreg.h
new file mode 100644
index 00000000000..66bdf7f6651
--- /dev/null
+++ b/sys/arch/alpha/isa/spkrreg.h
@@ -0,0 +1,11 @@
+/* $NetBSD: spkrreg.h,v 1.1 1996/04/12 01:54:46 cgd Exp $ */
+
+/*
+ * PIT port addresses and speaker control values
+ */
+
+#define PITAUX_PORT 0x61 /* port of Programmable Peripheral Interface */
+#define PIT_ENABLETMR2 0x01 /* Enable timer/counter 2 */
+#define PIT_SPKRDATA 0x02 /* Direct to speaker */
+
+#define PIT_SPKR (PIT_ENABLETMR2|PIT_SPKRDATA)
diff --git a/sys/arch/alpha/isa/timerreg.h b/sys/arch/alpha/isa/timerreg.h
new file mode 100644
index 00000000000..04f2804f2b7
--- /dev/null
+++ b/sys/arch/alpha/isa/timerreg.h
@@ -0,0 +1,100 @@
+/* $NetBSD: timerreg.h,v 1.1 1996/04/12 01:54:56 cgd Exp $ */
+
+/*-
+ * Copyright (c) 1993 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Register definitions for the Intel 8253 Programmable Interval Timer.
+ *
+ * This chip has three independent 16-bit down counters that can be
+ * read on the fly. There are three mode registers and three countdown
+ * registers. The countdown registers are addressed directly, via the
+ * first three I/O ports. The three mode registers are accessed via
+ * the fourth I/O port, with two bits in the mode byte indicating the
+ * register. (Why are hardware interfaces always so braindead?).
+ *
+ * To write a value into the countdown register, the mode register
+ * is first programmed with a command indicating the which byte of
+ * the two byte register is to be modified. The three possibilities
+ * are load msb (TMR_MR_MSB), load lsb (TMR_MR_LSB), or load lsb then
+ * msb (TMR_MR_BOTH).
+ *
+ * To read the current value ("on the fly") from the countdown register,
+ * you write a "latch" command into the mode register, then read the stable
+ * value from the corresponding I/O port. For example, you write
+ * TMR_MR_LATCH into the corresponding mode register. Presumably,
+ * after doing this, a write operation to the I/O port would result
+ * in undefined behavior (but hopefully not fry the chip).
+ * Reading in this manner has no side effects.
+ *
+ * The outputs of the three timers are connected as follows:
+ *
+ * timer 0 -> irq 0
+ * timer 1 -> dma chan 0 (for dram refresh)
+ * timer 2 -> speaker (via keyboard controller)
+ *
+ * Timer 0 is used to call hardclock.
+ * Timer 2 is used to generate console beeps.
+ */
+
+/*
+ * Frequency of all three count-down timers; (TIMER_FREQ/freq) is the
+ * appropriate count to generate a frequency of freq hz.
+ */
+#ifndef TIMER_FREQ
+#define TIMER_FREQ 1193182
+#endif
+#define TIMER_DIV(x) ((TIMER_FREQ+(x)/2)/(x))
+
+/*
+ * Macros for specifying values to be written into a mode register.
+ */
+#define TIMER_CNTR0 0 /* timer 0 counter port */
+#define TIMER_CNTR1 1 /* timer 1 counter port */
+#define TIMER_CNTR2 2 /* timer 2 counter port */
+#define TIMER_MODE 3 /* timer mode port */
+#define TIMER_SEL0 0x00 /* select counter 0 */
+#define TIMER_SEL1 0x40 /* select counter 1 */
+#define TIMER_SEL2 0x80 /* select counter 2 */
+#define TIMER_INTTC 0x00 /* mode 0, intr on terminal cnt */
+#define TIMER_ONESHOT 0x02 /* mode 1, one shot */
+#define TIMER_RATEGEN 0x04 /* mode 2, rate generator */
+#define TIMER_SQWAVE 0x06 /* mode 3, square wave */
+#define TIMER_SWSTROBE 0x08 /* mode 4, s/w triggered strobe */
+#define TIMER_HWSTROBE 0x0a /* mode 5, h/w triggered strobe */
+#define TIMER_LATCH 0x00 /* latch counter for reading */
+#define TIMER_LSB 0x10 /* r/w counter LSB */
+#define TIMER_MSB 0x20 /* r/w counter MSB */
+#define TIMER_16BIT 0x30 /* r/w counter 16 bits, LSB first */
+#define TIMER_BCD 0x01 /* count in BCD */
+
diff --git a/sys/arch/alpha/pci/apecs.c b/sys/arch/alpha/pci/apecs.c
index 76fd9fec019..ec858ee1bab 100644
--- a/sys/arch/alpha/pci/apecs.c
+++ b/sys/arch/alpha/pci/apecs.c
@@ -1,7 +1,7 @@
-/* $NetBSD: apecs.c,v 1.4 1995/11/23 02:37:11 cgd Exp $ */
+/* $NetBSD: apecs.c,v 1.7 1996/04/12 06:08:01 cgd Exp $ */
/*
- * Copyright (c) 1995 Carnegie-Mellon University.
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -44,18 +44,20 @@
#include <dev/pci/pcivar.h>
#include <alpha/pci/apecsreg.h>
#include <alpha/pci/apecsvar.h>
+#include <alpha/pci/pci_2100_a50.h>
int apecsmatch __P((struct device *, void *, void *));
void apecsattach __P((struct device *, struct device *, void *));
-struct cfdriver apecscd = {
- NULL, "apecs", apecsmatch, apecsattach, DV_DULL,
- sizeof(struct apecs_softc)
+struct cfattach apecs_ca = {
+ sizeof(struct apecs_softc), apecsmatch, apecsattach,
};
-static int apecsprint __P((void *, char *pnp));
+struct cfdriver apecs_cd = {
+ NULL, "apecs", DV_DULL,
+};
-#define REGVAL(r) (*(int32_t *)phystok0seg(r))
+static int apecsprint __P((void *, char *pnp));
/* There can be only one. */
int apecsfound;
@@ -70,7 +72,7 @@ apecsmatch(parent, match, aux)
struct confargs *ca = aux;
/* Make sure that we're looking for an APECS. */
- if (strcmp(ca->ca_name, apecscd.cd_name) != 0)
+ if (strcmp(ca->ca_name, apecs_cd.cd_name) != 0)
return (0);
if (apecsfound)
@@ -98,15 +100,9 @@ apecs_init(acp)
* Can't set up SGMAP data here; can be called before malloc().
*/
- acp->ac_conffns = &apecs_conf_fns;
- acp->ac_confarg = acp;
- acp->ac_dmafns = &apecs_dma_fns;
- acp->ac_dmaarg = acp;
- /* Interrupt routines set up in 'attach' */
- acp->ac_memfns = &apecs_mem_fns;
- acp->ac_memarg = acp;
- acp->ac_piofns = &apecs_pio_fns;
- acp->ac_pioarg = acp;
+ apecs_lca_bus_io_init(&acp->ac_bc, acp);
+ apecs_lca_bus_mem_init(&acp->ac_bc, acp);
+ apecs_pci_init(&acp->ac_pc, acp);
/* Turn off DMA window enables in PCI Base Reg 1. */
REGVAL(EPIC_PCI_BASE_1) = 0;
@@ -120,10 +116,9 @@ apecsattach(parent, self, aux)
struct device *parent, *self;
void *aux;
{
- struct confargs *ca = aux;
struct apecs_softc *sc = (struct apecs_softc *)self;
struct apecs_config *acp;
- struct pci_attach_args pa;
+ struct pcibus_attach_args pba;
/* note that we've attached the chipset; can't have 2 APECSes. */
apecsfound = 1;
@@ -151,31 +146,18 @@ apecsattach(parent, self, aux)
switch (hwrpb->rpb_type) {
#if defined(DEC_2100_A50)
case ST_DEC_2100_A50:
- pci_2100_a50_pickintr(acp->ac_conffns, acp->ac_confarg,
- acp->ac_piofns, acp->ac_pioarg,
- &acp->ac_intrfns, &acp->ac_intrarg);
+ pci_2100_a50_pickintr(acp);
break;
#endif
default:
panic("apecsattach: shouldn't be here, really...");
}
- pa.pa_bus = 0;
- pa.pa_maxdev = 32;
- pa.pa_burstlog2 = 8;
-
- pa.pa_conffns = acp->ac_conffns;
- pa.pa_confarg = acp->ac_confarg;
- pa.pa_dmafns = acp->ac_dmafns;
- pa.pa_dmaarg = acp->ac_dmaarg;
- pa.pa_intrfns = acp->ac_intrfns;
- pa.pa_intrarg = acp->ac_intrarg;
- pa.pa_memfns = acp->ac_memfns;
- pa.pa_memarg = acp->ac_memarg;
- pa.pa_piofns = acp->ac_piofns;
- pa.pa_pioarg = acp->ac_pioarg;
-
- config_found(self, &pa, apecsprint);
+ pba.pba_busname = "pci";
+ pba.pba_bc = &acp->ac_bc;
+ pba.pba_pc = &acp->ac_pc;
+ pba.pba_bus = 0;
+ config_found(self, &pba, apecsprint);
}
static int
@@ -183,11 +165,11 @@ apecsprint(aux, pnp)
void *aux;
char *pnp;
{
- register struct pci_attach_args *pa = aux;
+ register struct pcibus_attach_args *pba = aux;
/* only PCIs can attach to APECSes; easy. */
if (pnp)
- printf("pci at %s", pnp);
- printf(" bus %d", pa->pa_bus);
+ printf("%s at %s", pba->pba_busname, pnp);
+ printf(" bus %d", pba->pba_bus);
return (UNCONF);
}
diff --git a/sys/arch/alpha/pci/apecs_isa.c b/sys/arch/alpha/pci/apecs_isa.c
deleted file mode 100644
index 1d2729475dc..00000000000
--- a/sys/arch/alpha/pci/apecs_isa.c
+++ /dev/null
@@ -1,346 +0,0 @@
-/* $NetBSD: apecs_isa.c,v 1.4 1995/11/23 02:37:13 cgd Exp $ */
-
-/*
- * Copyright (c) 1995 Carnegie-Mellon University.
- * All rights reserved.
- *
- * Author: Chris G. Demetriou
- *
- * Permission to use, copy, modify and distribute this software and
- * its documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-#include <sys/param.h>
-#include <sys/malloc.h>
-#include <sys/syslog.h>
-#include <sys/device.h>
-#include <vm/vm.h>
-
-#include <dev/isa/isavar.h>
-
-#include <alpha/pci/apecsreg.h>
-#include <alpha/pci/apecsvar.h>
-
-/*
- * Allocation/deallocation functions.
- */
-int apecs_pio_alloc __P((void *, isa_iooffset_t, isa_iosize_t));
-int apecs_pio_dealloc __P((void *, isa_iooffset_t, isa_iosize_t));
-
-/*
- * Byte functions.
- */
-isa_byte_t apecs_inb __P((void *, isa_iooffset_t));
-#define apecs_insb 0 /* XXX */
-void apecs_outb __P((void *, isa_iooffset_t, isa_byte_t));
-#define apecs_outsb 0 /* XXX */
-
-/*
- * Word functions.
- */
-isa_word_t apecs_inw __P((void *, isa_iooffset_t));
-#define apecs_insw 0 /* XXX */
-void apecs_outw __P((void *, isa_iooffset_t, isa_word_t));
-#define apecs_outsw 0 /* XXX */
-
-/*
- * Longword functions.
- */
-isa_long_t apecs_inl __P((void *, isa_iooffset_t));
-#define apecs_insl 0 /* XXX */
-void apecs_outl __P((void *, isa_iooffset_t, isa_long_t));
-#define apecs_outsl 0 /* XXX */
-
-__const struct pci_pio_fns apecs_pio_fns = {
- /* Allocation/deallocation functions. */
- apecs_pio_alloc, apecs_pio_dealloc,
-
- /* Byte functions. */
- apecs_inb, apecs_insb,
- apecs_outb, apecs_outsb,
-
- /* Word functions. */
- apecs_inw, apecs_insw,
- apecs_outw, apecs_outsw,
-
- /* Longword functions. */
- apecs_inl, apecs_insl,
- apecs_outl, apecs_outsl,
-};
-
-int
-apecs_pio_alloc(ipfarg, start, size)
- void *ipfarg;
- isa_iooffset_t start;
- isa_iosize_t size;
-{
-
- /* XXX should do something */
-}
-
-int
-apecs_pio_dealloc(ipfarg, start, size)
- void *ipfarg;
- isa_iooffset_t start;
- isa_iosize_t size;
-{
-
- /* XXX should do something */
-}
-
-isa_byte_t
-apecs_inb(ipfa, ioaddr)
- void *ipfa;
- isa_iooffset_t ioaddr;
-{
- u_int32_t *port, val;
- isa_byte_t rval;
- int offset;
-
- wbflush();
- offset = ioaddr & 3;
- port = (int32_t *)phystok0seg(APECS_PCI_SIO | 0 << 3 | ioaddr << 5);
- val = *port;
- rval = ((val) >> (8 * offset)) & 0xff;
-/* rval = val & 0xff; */
-
- return rval;
-}
-
-void
-apecs_outb(ipfa, ioaddr, val)
- void *ipfa;
- isa_iooffset_t ioaddr;
- isa_byte_t val;
-{
- u_int32_t *port, nval;
- int offset;
-
- offset = ioaddr & 3;
- nval = val /*<< (8 * offset)*/;
- nval = val << (8 * offset);
- port = (int32_t *)phystok0seg(APECS_PCI_SIO | 0 << 3 | ioaddr << 5);
-
- *port = nval;
- wbflush();
-}
-
-isa_word_t
-apecs_inw(ipfa, ioaddr)
- void *ipfa;
- isa_iooffset_t ioaddr;
-{
- u_int32_t *port, val;
- isa_word_t rval;
- int offset;
-
- wbflush();
- offset = ioaddr & 3;
- port = (int32_t *)phystok0seg(APECS_PCI_SIO | 1 << 3 | ioaddr << 5);
- val = *port;
- rval = ((val) >> (8 * offset)) & 0xffff;
- rval = val & 0xffff;
-
-panic("inw(0x%x) => 0x%x @ %p => 0x%x\n", ioaddr, val, port, rval);
-
- return rval;
-}
-
-void
-apecs_outw(ipfa, ioaddr, val)
- void *ipfa;
- isa_iooffset_t ioaddr;
- isa_word_t val;
-{
- u_int32_t *port, nval;
- int offset;
-
- offset = ioaddr & 3;
- nval = val /*<< (8 * offset)*/;
- port = (int32_t *)phystok0seg(APECS_PCI_SIO | 1 << 3 | ioaddr << 5);
-
- *port = nval;
- wbflush();
-}
-
-isa_long_t
-apecs_inl(ipfa, ioaddr)
- void *ipfa;
- isa_iooffset_t ioaddr;
-{
- u_int32_t *port, val;
- isa_long_t rval;
- int offset;
-
- wbflush();
- offset = ioaddr & 3;
- port = (int32_t *)phystok0seg(APECS_PCI_SIO | 3 << 3 | ioaddr << 5);
- val = *port;
- rval = ((val) >> (8 * offset)) & 0xffffffff;
- rval = val & 0xffffffff;
-
- return rval;
-}
-
-void
-apecs_outl(ipfa, ioaddr, val)
- void *ipfa;
- isa_iooffset_t ioaddr;
- isa_long_t val;
-{
- u_int32_t *port, nval;
- int offset;
-
- offset = ioaddr & 3;
- nval = val /*<< (8 * offset)*/;
- port = (int32_t *)phystok0seg(APECS_PCI_SIO | 3 << 3 | ioaddr << 5);
-
- *port = nval;
- wbflush();
-}
-
-/* XXX XXX XXX */
-
-#define pf(fn, args) fn args { panic(__STRING(fn)); }
-
-void pf(apecs_dma_cascade, (void *idfa, isa_drq_t chan))
-void pf(apecs_dma_copytobuf, ())
-void pf(apecs_dma_copyfrombuf, ())
-void pf(apecs_dma_start, (void *idfa, vm_offset_t addr,
- isa_msize_t size, isa_drq_t chan, int flags))
-void pf(apecs_dma_abort, (void *idfa, isa_drq_t chan))
-void pf(apecs_dma_done, (void *idfa, isa_drq_t chan))
-
-int apecs_dma_map __P((void *, vm_offset_t, isa_msize_t,
- isa_moffset_t *, int));
-void apecs_dma_unmap __P((void *, vm_offset_t, isa_msize_t, int,
- isa_moffset_t *));
-
-__const struct isa_dma_fns apecs_dma_fns = {
- apecs_dma_cascade,
- apecs_dma_map,
- apecs_dma_unmap,
- apecs_dma_copytobuf,
- apecs_dma_copyfrombuf,
- apecs_dma_start,
- apecs_dma_abort,
- apecs_dma_done,
-};
-
-int
-apecs_dma_map(idfa, va, isasize, mappingsp, flags)
- void *idfa;
- vm_offset_t va;
- isa_msize_t isasize;
- isa_moffset_t *mappingsp;
- int flags;
-{
- struct apecs_config *acp = idfa;
- long todo;
- int i;
-
- if (ISA_DMA_NEEDCONTIG(flags) && isasize > NBPG ||
- ISA_DMA_SIZEBOUND(flags) != ISA_DMA_SIZEBOUND_NONE ||
- ISA_DMA_ADDRBOUND(flags) != ISA_DMA_ADDRBOUND_NONE)
- panic("apecs_dma_map: punt");
-
- i = 0;
- todo = isasize;
-
- while (todo > 0) {
- mappingsp[i] = vtophys(va) | 0x40000000;
-#if 0
- printf("a_pd_m mapping %d: %lx -> %lx -> %lx\n", i, va,
- vtophys(va), mappingsp[i]);
-#endif
- i++;
- todo -= PAGE_SIZE - (va - trunc_page(va));
- va += PAGE_SIZE - (va - trunc_page(va));
- }
- return (i);
-}
-
-void
-apecs_dma_unmap(idfa, va, isasize, nmappings, mappingsp)
- void *idfa;
- vm_offset_t va;
- isa_msize_t isasize;
- int nmappings;
- isa_moffset_t *mappingsp;
-{
-
- printf("apecs_dma_unmap: called\n");
-}
-
-vm_offset_t apecs_mem_map __P((void *, isa_moffset_t, isa_msize_t, int));
-void apecs_mem_unmap __P((void *, vm_offset_t, isa_msize_t));
-
-#if 0
-void apecs_mem_copytoisa __P((void *, char *, vm_offset_t,
- isa_moffset_t, isa_msize_t));
-void apecs_mem_copyfromisa __P((void *, char *, vm_offset_t,
- isa_moffset_t, isa_msize_t));
-void apecs_mem_zero __P((void *, vm_offset_t, isa_moffset_t,
- isa_msize_t));
-#else
-void pf(apecs_mem_copytoisa, ())
-void pf(apecs_mem_copyfromisa, ())
-void pf(apecs_mem_zero, ())
-#endif
-
-__const struct isa_mem_fns apecs_mem_fns = {
- apecs_mem_map,
- apecs_mem_unmap,
- apecs_mem_copytoisa,
- apecs_mem_copyfromisa,
- apecs_mem_zero,
-};
-
-vm_offset_t
-apecs_mem_map(imfa, isapa, isasize, cacheable)
- void *imfa;
- isa_moffset_t isapa;
- isa_msize_t isasize;
- int cacheable;
-{
- vm_offset_t sbpa;
-
- /* XXX sanity checks on sizes, use of windows, etc. */
-
- /* XXX MAGIC NUMBERS */
- if (cacheable)
- sbpa = (isapa & 0xffffffff) | APECS_PCI_DENSE;
- else
- sbpa = ((isapa & 0x7ffffff) << 5) | APECS_PCI_SPARSE;
-
- return phystok0seg(sbpa);
-}
-
-void
-apecs_mem_unmap(imfa, va, isasize)
- void *imfa;
- vm_offset_t va;
- isa_msize_t isasize;
-{
-
- /* XXX sanity checks on va */
-
- /* Nothing to do; mapping was done in direct-mapped segment. */
-}
diff --git a/sys/arch/alpha/pci/apecs_lca_bus_io.c b/sys/arch/alpha/pci/apecs_lca_bus_io.c
new file mode 100644
index 00000000000..22e1aa3f050
--- /dev/null
+++ b/sys/arch/alpha/pci/apecs_lca_bus_io.c
@@ -0,0 +1,59 @@
+/* $NetBSD: apecs_lca_bus_io.c,v 1.2.4.1 1996/06/13 18:14:55 cgd Exp $ */
+
+/*
+ * Copyright (c) 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#include <sys/param.h>
+#include <sys/malloc.h>
+#include <sys/syslog.h>
+#include <sys/device.h>
+#include <vm/vm.h>
+
+#include <machine/bus.h>
+
+#include <alpha/pci/apecsreg.h>
+#include <alpha/pci/lcareg.h>
+
+#if (APECS_PCI_SIO != LCA_PCI_SIO)
+#error Sparse I/O addresses do not match up?
+#endif
+
+#define CHIP apecs_lca
+
+/* IO region 1 */
+#define CHIP_IO_W1_START(v) 0x00000000
+#define CHIP_IO_W1_END(v) 0x0003ffff
+#define CHIP_IO_W1_BASE(v) APECS_PCI_SIO
+#define CHIP_IO_W1_MASK(v) 0x00ffffff
+
+/* IO region 2 */
+#define CHIP_IO_W2_START(v) 0x00040000 /* XXX from HAXR2 */
+#define CHIP_IO_W2_END(v) 0xfffbffff /* XXX from HAXR2 */
+#define CHIP_IO_W2_BASE(v) APECS_PCI_SIO
+#define CHIP_IO_W2_MASK(v) 0x00ffffff
+
+#include "pcs_bus_io_common.c"
diff --git a/sys/arch/alpha/pci/apecs_lca_bus_mem.c b/sys/arch/alpha/pci/apecs_lca_bus_mem.c
new file mode 100644
index 00000000000..72a892c37fe
--- /dev/null
+++ b/sys/arch/alpha/pci/apecs_lca_bus_mem.c
@@ -0,0 +1,65 @@
+/* $NetBSD: apecs_lca_bus_mem.c,v 1.2.4.2 1996/06/13 18:14:58 cgd Exp $ */
+
+/*
+ * Copyright (c) 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#include <sys/param.h>
+#include <sys/malloc.h>
+#include <sys/syslog.h>
+#include <sys/device.h>
+#include <vm/vm.h>
+
+#include <machine/bus.h>
+
+#include <alpha/pci/apecsreg.h>
+#include <alpha/pci/lcareg.h>
+
+#if (APECS_PCI_SPARSE != LCA_PCI_SPARSE) || (APECS_PCI_DENSE != LCA_PCI_DENSE)
+#error Memory addresses do not match up?
+#endif
+
+#define CHIP apecs_lca
+
+/* Dense region 1 */
+#define CHIP_D_MEM_W1_START(v) 0x00000000
+#define CHIP_D_MEM_W1_END(v) 0xffffffff
+#define CHIP_D_MEM_W1_BASE(v) APECS_PCI_DENSE
+#define CHIP_D_MEM_W1_MASK(v) 0xffffffff
+
+/* Sparse region 1 */
+#define CHIP_S_MEM_W1_START(v) 0x00000000
+#define CHIP_S_MEM_W1_END(v) 0x00ffffff
+#define CHIP_S_MEM_W1_BASE(v) APECS_PCI_SPARSE
+#define CHIP_S_MEM_W1_MASK(v) 0x07ffffff
+
+/* Sparse region 2 */
+#define CHIP_S_MEM_W2_START(v) 0x01000000 /* XXX from HAXR1 */
+#define CHIP_S_MEM_W2_END(v) 0xfeffffff /* XXX from HAXR1 */
+#define CHIP_S_MEM_W2_BASE(v) APECS_PCI_SPARSE
+#define CHIP_S_MEM_W2_MASK(v) 0x07ffffff
+
+#include "pcs_bus_mem_common.c"
diff --git a/sys/arch/alpha/pci/apecs_pci.c b/sys/arch/alpha/pci/apecs_pci.c
index 42be1862efa..0c30c45ecba 100644
--- a/sys/arch/alpha/pci/apecs_pci.c
+++ b/sys/arch/alpha/pci/apecs_pci.c
@@ -1,7 +1,7 @@
-/* $NetBSD: apecs_pci.c,v 1.4 1995/11/23 02:37:16 cgd Exp $ */
+/* $NetBSD: apecs_pci.c,v 1.6 1996/04/12 06:08:09 cgd Exp $ */
/*
- * Copyright (c) 1995 Carnegie-Mellon University.
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -38,33 +38,83 @@
#include <alpha/pci/apecsreg.h>
#include <alpha/pci/apecsvar.h>
-pci_confreg_t apecs_conf_read __P((void *, pci_conftag_t, pci_confoffset_t));
-void apecs_conf_write __P((void *, pci_conftag_t,
- pci_confoffset_t, pci_confreg_t));
-int apecs_find_io __P((void *, pci_conftag_t,
- pci_confoffset_t, pci_iooffset_t *, pci_iosize_t *));
-int apecs_find_mem __P((void *, pci_conftag_t,
- pci_confoffset_t, pci_moffset_t *, pci_msize_t *, int *));
-
-__const struct pci_conf_fns apecs_conf_fns = {
- apecs_conf_read,
- apecs_conf_write,
- apecs_find_io,
- apecs_find_mem,
-};
-
-pci_confreg_t
+void apecs_attach_hook __P((struct device *, struct device *,
+ struct pcibus_attach_args *));
+int apecs_bus_maxdevs __P((void *, int));
+pcitag_t apecs_make_tag __P((void *, int, int, int));
+void apecs_decompose_tag __P((void *, pcitag_t, int *, int *,
+ int *));
+pcireg_t apecs_conf_read __P((void *, pcitag_t, int));
+void apecs_conf_write __P((void *, pcitag_t, int, pcireg_t));
+
+void
+apecs_pci_init(pc, v)
+ pci_chipset_tag_t pc;
+ void *v;
+{
+
+ pc->pc_conf_v = v;
+ pc->pc_attach_hook = apecs_attach_hook;
+ pc->pc_bus_maxdevs = apecs_bus_maxdevs;
+ pc->pc_make_tag = apecs_make_tag;
+ pc->pc_decompose_tag = apecs_decompose_tag;
+ pc->pc_conf_read = apecs_conf_read;
+ pc->pc_conf_write = apecs_conf_write;
+}
+
+void
+apecs_attach_hook(parent, self, pba)
+ struct device *parent, *self;
+ struct pcibus_attach_args *pba;
+{
+}
+
+int
+apecs_bus_maxdevs(cpv, busno)
+ void *cpv;
+ int busno;
+{
+
+ return 32;
+}
+
+pcitag_t
+apecs_make_tag(cpv, b, d, f)
+ void *cpv;
+ int b, d, f;
+{
+
+ return (b << 16) | (d << 11) | (f << 8);
+}
+
+void
+apecs_decompose_tag(cpv, tag, bp, dp, fp)
+ void *cpv;
+ pcitag_t tag;
+ int *bp, *dp, *fp;
+{
+
+ if (bp != NULL)
+ *bp = (tag >> 16) & 0xff;
+ if (dp != NULL)
+ *dp = (tag >> 11) & 0x1f;
+ if (fp != NULL)
+ *fp = (tag >> 8) & 0x7;
+}
+
+pcireg_t
apecs_conf_read(cpv, tag, offset)
void *cpv;
- pci_conftag_t tag;
- pci_confoffset_t offset;
+ pcitag_t tag;
+ int offset;
{
struct apecs_config *acp = cpv;
- pci_confreg_t *datap, data;
+ pcireg_t *datap, data;
int s, secondary, ba;
int32_t old_haxr2; /* XXX */
- secondary = PCI_TAG_BUS(tag) != 0;
+ /* secondary if bus # != 0 */
+ pci_decompose_tag(&acp->ac_pc, tag, &secondary, 0, 0);
if (secondary) {
s = splhigh();
old_haxr2 = REGVAL(EPIC_HAXR2);
@@ -73,12 +123,12 @@ apecs_conf_read(cpv, tag, offset)
wbflush();
}
- datap = (pci_confreg_t *)phystok0seg(APECS_PCI_CONF |
+ datap = (pcireg_t *)phystok0seg(APECS_PCI_CONF |
tag << 5UL | /* XXX */
(offset & ~0x03) << 5 | /* XXX */
0 << 5 | /* XXX */
0x3 << 3); /* XXX */
- data = (pci_confreg_t)-1;
+ data = (pcireg_t)-1;
if (!(ba = badaddr(datap, sizeof *datap)))
data = *datap;
@@ -100,16 +150,17 @@ apecs_conf_read(cpv, tag, offset)
void
apecs_conf_write(cpv, tag, offset, data)
void *cpv;
- pci_conftag_t tag;
- pci_confoffset_t offset;
- pci_confreg_t data;
+ pcitag_t tag;
+ int offset;
+ pcireg_t data;
{
struct apecs_config *acp = cpv;
- pci_confreg_t *datap;
+ pcireg_t *datap;
int s, secondary;
int32_t old_haxr2; /* XXX */
- secondary = PCI_TAG_BUS(tag) != 0;
+ /* secondary if bus # != 0 */
+ pci_decompose_tag(&acp->ac_pc, tag, &secondary, 0, 0);
if (secondary) {
s = splhigh();
old_haxr2 = REGVAL(EPIC_HAXR2);
@@ -118,7 +169,7 @@ apecs_conf_write(cpv, tag, offset, data)
wbflush();
}
- datap = (pci_confreg_t *)phystok0seg(APECS_PCI_CONF |
+ datap = (pcireg_t *)phystok0seg(APECS_PCI_CONF |
tag << 5UL | /* XXX */
(offset & ~0x03) << 5 | /* XXX */
0 << 5 | /* XXX */
@@ -137,86 +188,3 @@ apecs_conf_write(cpv, tag, offset, data)
reg, data, datap);
#endif
}
-
-int
-apecs_find_io(cpv, tag, reg, iobasep, sizep)
- void *cpv;
- pci_conftag_t tag;
- pci_confoffset_t reg;
- pci_iooffset_t *iobasep;
- pci_iosize_t *sizep;
-{
- struct apecs_config *acp = cpv;
- pci_confreg_t addrdata, sizedata;
- pci_iooffset_t pci_iobase;
-
- if (reg < PCI_MAPREG_START || reg >= PCI_MAPREG_END || (reg & 3))
- panic("apecs_map_io: bad request");
-
- addrdata = PCI_CONF_READ(acp->ac_conffns, acp->ac_confarg, tag, reg);
-
- PCI_CONF_WRITE(acp->ac_conffns, acp->ac_confarg, tag, reg, 0xffffffff);
- sizedata = PCI_CONF_READ(acp->ac_conffns, acp->ac_confarg, tag, reg);
- PCI_CONF_WRITE(acp->ac_conffns, acp->ac_confarg, tag, reg, addrdata);
-
- if (PCI_MAPREG_TYPE(addrdata) == PCI_MAPREG_TYPE_MEM)
- panic("apecs_map_io: attempt to I/O map an memory region");
-
- if (iobasep != NULL)
- *iobasep = PCI_MAPREG_IO_ADDRESS(addrdata);
- if (sizep != NULL)
- *sizep = ~PCI_MAPREG_IO_ADDRESS(sizedata) + 1;
-
- return (0);
-}
-
-int
-apecs_find_mem(cpv, tag, reg, paddrp, sizep, cacheablep)
- void *cpv;
- pci_conftag_t tag;
- pci_confoffset_t reg;
- pci_moffset_t *paddrp;
- pci_msize_t *sizep;
- int *cacheablep;
-{
- struct apecs_config *acp = cpv;
- pci_confreg_t addrdata, sizedata;
-
- if (reg < PCI_MAPREG_START || reg >= PCI_MAPREG_END || (reg & 3))
- panic("apecs_map_mem: bad request");
-
- /*
- * The PROM has mapped the device for us. We take the address
- * that's been assigned to the register, and figure out what
- * physical and virtual addresses go with it...
- */
- addrdata = PCI_CONF_READ(acp->ac_conffns, acp->ac_confarg, tag, reg);
-
- PCI_CONF_WRITE(acp->ac_conffns, acp->ac_confarg, tag, reg, 0xffffffff);
- sizedata = PCI_CONF_READ(acp->ac_conffns, acp->ac_confarg, tag, reg);
- PCI_CONF_WRITE(acp->ac_conffns, acp->ac_confarg, tag, reg, addrdata);
-
- if (PCI_MAPREG_TYPE(addrdata) == PCI_MAPREG_TYPE_IO)
- panic("apecs_map_mem: attempt to memory map an I/O region");
-
- switch (PCI_MAPREG_MEM_TYPE(addrdata)) {
- case PCI_MAPREG_MEM_TYPE_32BIT:
- case PCI_MAPREG_MEM_TYPE_32BIT_1M:
- break;
- case PCI_MAPREG_MEM_TYPE_64BIT:
-/* XXX */ printf("apecs_map_mem: attempt to map 64-bit region\n");
-/* XXX */ break;
- default:
- printf("apecs_map_mem: reserved mapping type\n");
- return EINVAL;
- }
-
- if (paddrp != NULL)
- *paddrp = PCI_MAPREG_MEM_ADDRESS(addrdata); /* PCI addr */
- if (sizep != NULL)
- *sizep = ~PCI_MAPREG_MEM_ADDRESS(sizedata) + 1;
- if (cacheablep != NULL)
- *cacheablep = PCI_MAPREG_MEM_CACHEABLE(addrdata);
-
- return 0;
-}
diff --git a/sys/arch/alpha/pci/apecsvar.h b/sys/arch/alpha/pci/apecsvar.h
index a63cc275922..fe4cfdeba47 100644
--- a/sys/arch/alpha/pci/apecsvar.h
+++ b/sys/arch/alpha/pci/apecsvar.h
@@ -1,21 +1,21 @@
-/* $NetBSD: apecsvar.h,v 1.1 1995/11/23 02:37:21 cgd Exp $ */
+/* $NetBSD: apecsvar.h,v 1.3 1996/04/12 06:08:14 cgd Exp $ */
/*
- * Copyright (c) 1995 Carnegie-Mellon University.
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
- *
+ *
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
+ *
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
@@ -41,20 +41,8 @@ struct apecs_config {
int ac_epic_pass2;
int ac_memwidth;
- __const struct pci_conf_fns *ac_conffns;
- void *ac_confarg;
-
- __const struct pci_dma_fns *ac_dmafns;
- void *ac_dmaarg;
-
- __const struct pci_intr_fns *ac_intrfns;
- void *ac_intrarg;
-
- __const struct pci_mem_fns *ac_memfns;
- void *ac_memarg;
-
- __const struct pci_pio_fns *ac_piofns;
- void *ac_pioarg;
+ struct alpha_bus_chipset ac_bc;
+ struct alpha_pci_chipset ac_pc;
};
struct apecs_softc {
@@ -63,10 +51,5 @@ struct apecs_softc {
struct apecs_config *sc_acp;
};
-extern __const struct pci_conf_fns apecs_conf_fns;
-extern __const struct pci_dma_fns apecs_dma_fns;
-/* pci interrupt functions handled elsewhere */
-extern __const struct pci_mem_fns apecs_mem_fns;
-extern __const struct pci_pio_fns apecs_pio_fns;
-
void apecs_init __P((struct apecs_config *));
+void apecs_pci_init __P((pci_chipset_tag_t, void *));
diff --git a/sys/arch/alpha/pci/bt485reg.h b/sys/arch/alpha/pci/bt485reg.h
index 60623050e8a..6cd8a9258ae 100644
--- a/sys/arch/alpha/pci/bt485reg.h
+++ b/sys/arch/alpha/pci/bt485reg.h
@@ -1,7 +1,7 @@
-/* $NetBSD: bt485reg.h,v 1.2 1995/08/03 01:17:07 cgd Exp $ */
+/* $NetBSD: bt485reg.h,v 1.4 1996/04/12 06:08:17 cgd Exp $ */
/*
- * Copyright (c) 1995 Carnegie-Mellon University.
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -55,3 +55,10 @@
#define BT485_REG_CURSOR_Y_HIGH 0x0f
#define BT485_REG_MAX 0x0f
+
+#define BT485_IREG_STATUS 0x00
+#define BT485_IREG_COMMAND_3 0x01
+#define BT485_IREG_COMMAND_4 0x02
+#define BT485_IREG_RSA 0x20
+#define BT485_IREG_GSA 0x21
+#define BT485_IREG_BSA 0x22
diff --git a/sys/arch/alpha/pci/cia.c b/sys/arch/alpha/pci/cia.c
index fa2f49fc6cc..942a5ed0cee 100644
--- a/sys/arch/alpha/pci/cia.c
+++ b/sys/arch/alpha/pci/cia.c
@@ -1,7 +1,7 @@
-/* $NetBSD: cia.c,v 1.1 1995/11/23 02:37:24 cgd Exp $ */
+/* $NetBSD: cia.c,v 1.5.4.1 1996/06/10 00:02:39 cgd Exp $ */
/*
- * Copyright (c) 1995 Carnegie-Mellon University.
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -51,9 +51,12 @@
int ciamatch __P((struct device *, void *, void *));
void ciaattach __P((struct device *, struct device *, void *));
-struct cfdriver ciacd = {
- NULL, "cia", ciamatch, ciaattach, DV_DULL,
- sizeof(struct cia_softc)
+struct cfattach cia_ca = {
+ sizeof(struct cia_softc), ciamatch, ciaattach,
+};
+
+struct cfdriver cia_cd = {
+ NULL, "cia", DV_DULL,
};
static int ciaprint __P((void *, char *pnp));
@@ -73,7 +76,7 @@ ciamatch(parent, match, aux)
struct confargs *ca = aux;
/* Make sure that we're looking for a CIA. */
- if (strcmp(ca->ca_name, ciacd.cd_name) != 0)
+ if (strcmp(ca->ca_name, cia_cd.cd_name) != 0)
return (0);
if (ciafound)
@@ -94,15 +97,12 @@ cia_init(ccp)
* Can't set up SGMAP data here; can be called before malloc().
*/
- ccp->cc_conffns = &cia_conf_fns;
- ccp->cc_confarg = ccp;
- ccp->cc_dmafns = &cia_dma_fns;
- ccp->cc_dmaarg = ccp;
- /* Interrupt routines set up in 'attach' */
- ccp->cc_memfns = &cia_mem_fns;
- ccp->cc_memarg = ccp;
- ccp->cc_piofns = &cia_pio_fns;
- ccp->cc_pioarg = ccp;
+ cia_bus_io_init(&ccp->cc_bc, ccp);
+ cia_bus_mem_init(&ccp->cc_bc, ccp);
+ cia_pci_init(&ccp->cc_pc, ccp);
+
+ ccp->cc_hae_mem = REGVAL(CIA_CSR_HAE_MEM);
+ ccp->cc_hae_io = REGVAL(CIA_CSR_HAE_IO);
}
void
@@ -113,7 +113,7 @@ ciaattach(parent, self, aux)
struct confargs *ca = aux;
struct cia_softc *sc = (struct cia_softc *)self;
struct cia_config *ccp;
- struct pci_attach_args pa;
+ struct pcibus_attach_args pba;
/* note that we've attached the chipset; can't have 2 CIAs. */
ciafound = 1;
@@ -131,9 +131,7 @@ ciaattach(parent, self, aux)
switch (hwrpb->rpb_type) {
#if defined(DEC_KN20AA)
case ST_DEC_KN20AA:
- pci_kn20aa_pickintr(ccp->cc_conffns, ccp->cc_confarg,
- ccp->cc_piofns, ccp->cc_pioarg,
- &ccp->cc_intrfns, &ccp->cc_intrarg);
+ pci_kn20aa_pickintr(ccp);
#ifdef EVCNT_COUNTERS
evcnt_attach(self, "intr", &kn20aa_intr_evcnt);
#endif
@@ -143,22 +141,11 @@ ciaattach(parent, self, aux)
panic("ciaattach: shouldn't be here, really...");
}
- pa.pa_bus = 0;
- pa.pa_maxdev = 32;
- pa.pa_burstlog2 = 8;
-
- pa.pa_conffns = ccp->cc_conffns;
- pa.pa_confarg = ccp->cc_confarg;
- pa.pa_dmafns = ccp->cc_dmafns;
- pa.pa_dmaarg = ccp->cc_dmaarg;
- pa.pa_intrfns = ccp->cc_intrfns;
- pa.pa_intrarg = ccp->cc_intrarg;
- pa.pa_memfns = ccp->cc_memfns;
- pa.pa_memarg = ccp->cc_memarg;
- pa.pa_piofns = ccp->cc_piofns;
- pa.pa_pioarg = ccp->cc_pioarg;
-
- config_found(self, &pa, ciaprint);
+ pba.pba_busname = "pci";
+ pba.pba_bc = &ccp->cc_bc;
+ pba.pba_pc = &ccp->cc_pc;
+ pba.pba_bus = 0;
+ config_found(self, &pba, ciaprint);
}
static int
@@ -166,11 +153,11 @@ ciaprint(aux, pnp)
void *aux;
char *pnp;
{
- register struct pci_attach_args *pa = aux;
+ register struct pcibus_attach_args *pba = aux;
/* only PCIs can attach to CIAs; easy. */
if (pnp)
- printf("pci at %s", pnp);
- printf(" bus %d", pa->pa_bus);
+ printf("%s at %s", pba->pba_busname, pnp);
+ printf(" bus %d", pba->pba_bus);
return (UNCONF);
}
diff --git a/sys/arch/alpha/pci/cia_bus_io.c b/sys/arch/alpha/pci/cia_bus_io.c
new file mode 100644
index 00000000000..12934b17687
--- /dev/null
+++ b/sys/arch/alpha/pci/cia_bus_io.c
@@ -0,0 +1,63 @@
+/* $NetBSD: cia_bus_io.c,v 1.2.4.2 1996/06/13 18:14:59 cgd Exp $ */
+
+/*
+ * Copyright (c) 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#include <sys/param.h>
+#include <sys/malloc.h>
+#include <sys/syslog.h>
+#include <sys/device.h>
+#include <vm/vm.h>
+
+#include <machine/bus.h>
+
+#include <alpha/pci/ciareg.h>
+#include <alpha/pci/ciavar.h>
+
+#define CHIP cia
+
+/* IO region 1 */
+#define CHIP_IO_W1_START(v) \
+ HAE_IO_REG1_START(((struct cia_config *)(v))->cc_hae_io)
+#define CHIP_IO_W1_END(v) \
+ (CHIP_IO_W1_START(v) + HAE_IO_REG1_MASK)
+#define CHIP_IO_W1_BASE(v) \
+ CIA_PCI_SIO1
+#define CHIP_IO_W1_MASK(v) \
+ HAE_IO_REG1_MASK
+
+/* IO region 2 */
+#define CHIP_IO_W2_START(v) \
+ HAE_IO_REG2_START(((struct cia_config *)(v))->cc_hae_io)
+#define CHIP_IO_W2_END(v) \
+ (CHIP_IO_W2_START(v) + HAE_IO_REG2_MASK)
+#define CHIP_IO_W2_BASE(v) \
+ CIA_PCI_SIO2
+#define CHIP_IO_W2_MASK(v) \
+ HAE_IO_REG2_MASK
+
+#include "pcs_bus_io_common.c"
diff --git a/sys/arch/alpha/pci/cia_bus_mem.c b/sys/arch/alpha/pci/cia_bus_mem.c
new file mode 100644
index 00000000000..47413db910a
--- /dev/null
+++ b/sys/arch/alpha/pci/cia_bus_mem.c
@@ -0,0 +1,79 @@
+/* $NetBSD: cia_bus_mem.c,v 1.2.4.2 1996/06/13 18:15:01 cgd Exp $ */
+
+/*
+ * Copyright (c) 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#include <sys/param.h>
+#include <sys/malloc.h>
+#include <sys/syslog.h>
+#include <sys/device.h>
+#include <vm/vm.h>
+
+#include <machine/bus.h>
+
+#include <alpha/pci/ciareg.h>
+#include <alpha/pci/ciavar.h>
+
+#define CHIP cia
+
+/* Dense region 1 */
+#define CHIP_D_MEM_W1_START(v) 0x00000000
+#define CHIP_D_MEM_W1_END(v) 0xffffffff
+#define CHIP_D_MEM_W1_BASE(v) CIA_PCI_DENSE
+#define CHIP_D_MEM_W1_MASK(v) 0xffffffff
+
+/* Sparse region 1 */
+#define CHIP_S_MEM_W1_START(v) \
+ HAE_MEM_REG1_START(((struct cia_config *)(v))->cc_hae_mem)
+#define CHIP_S_MEM_W1_END(v) \
+ (CHIP_S_MEM_W1_START(v) + HAE_MEM_REG1_MASK)
+#define CHIP_S_MEM_W1_BASE(v) \
+ CIA_PCI_SMEM1
+#define CHIP_S_MEM_W1_MASK(v) \
+ HAE_MEM_REG1_MASK
+
+/* Sparse region 2 */
+#define CHIP_S_MEM_W2_START(v) \
+ HAE_MEM_REG2_START(((struct cia_config *)(v))->cc_hae_mem)
+#define CHIP_S_MEM_W2_END(v) \
+ (CHIP_S_MEM_W2_START(v) + HAE_MEM_REG2_MASK)
+#define CHIP_S_MEM_W2_BASE(v) \
+ CIA_PCI_SMEM2
+#define CHIP_S_MEM_W2_MASK(v) \
+ HAE_MEM_REG2_MASK
+
+/* Sparse region 3 */
+#define CHIP_S_MEM_W3_START(v) \
+ HAE_MEM_REG3_START(((struct cia_config *)(v))->cc_hae_mem)
+#define CHIP_S_MEM_W3_END(v) \
+ (CHIP_S_MEM_W3_START(v) + HAE_MEM_REG3_MASK)
+#define CHIP_S_MEM_W3_BASE(v) \
+ CIA_PCI_SMEM3
+#define CHIP_S_MEM_W3_MASK(v) \
+ HAE_MEM_REG3_MASK
+
+#include "pcs_bus_mem_common.c"
diff --git a/sys/arch/alpha/pci/cia_isa.c b/sys/arch/alpha/pci/cia_isa.c
deleted file mode 100644
index 6ccb0ae4a3e..00000000000
--- a/sys/arch/alpha/pci/cia_isa.c
+++ /dev/null
@@ -1,346 +0,0 @@
-/* $NetBSD: cia_isa.c,v 1.1 1995/11/23 02:37:26 cgd Exp $ */
-
-/*
- * Copyright (c) 1995 Carnegie-Mellon University.
- * All rights reserved.
- *
- * Author: Chris G. Demetriou
- *
- * Permission to use, copy, modify and distribute this software and
- * its documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-#include <sys/param.h>
-#include <sys/malloc.h>
-#include <sys/syslog.h>
-#include <sys/device.h>
-#include <vm/vm.h>
-
-#include <dev/isa/isavar.h>
-
-#include <alpha/pci/ciareg.h>
-#include <alpha/pci/ciavar.h>
-
-/*
- * Allocation/deallocation functions.
- */
-int cia_pio_alloc __P((void *, isa_iooffset_t, isa_iosize_t));
-int cia_pio_dealloc __P((void *, isa_iooffset_t, isa_iosize_t));
-
-/*
- * Byte functions.
- */
-isa_byte_t cia_inb __P((void *, isa_iooffset_t));
-#define cia_insb 0 /* XXX */
-void cia_outb __P((void *, isa_iooffset_t, isa_byte_t));
-#define cia_outsb 0 /* XXX */
-
-/*
- * Word functions.
- */
-isa_word_t cia_inw __P((void *, isa_iooffset_t));
-#define cia_insw 0 /* XXX */
-void cia_outw __P((void *, isa_iooffset_t, isa_word_t));
-#define cia_outsw 0 /* XXX */
-
-/*
- * Longword functions.
- */
-isa_long_t cia_inl __P((void *, isa_iooffset_t));
-#define cia_insl 0 /* XXX */
-void cia_outl __P((void *, isa_iooffset_t, isa_long_t));
-#define cia_outsl 0 /* XXX */
-
-__const struct pci_pio_fns cia_pio_fns = {
- /* Allocation/deallocation functions. */
- cia_pio_alloc, cia_pio_dealloc,
-
- /* Byte functions. */
- cia_inb, cia_insb,
- cia_outb, cia_outsb,
-
- /* Word functions. */
- cia_inw, cia_insw,
- cia_outw, cia_outsw,
-
- /* Longword functions. */
- cia_inl, cia_insl,
- cia_outl, cia_outsl,
-};
-
-int
-cia_pio_alloc(ipfarg, start, size)
- void *ipfarg;
- isa_iooffset_t start;
- isa_iosize_t size;
-{
-
- /* XXX should do something */
-}
-
-int
-cia_pio_dealloc(ipfarg, start, size)
- void *ipfarg;
- isa_iooffset_t start;
- isa_iosize_t size;
-{
-
- /* XXX should do something */
-}
-
-isa_byte_t
-cia_inb(ipfa, ioaddr)
- void *ipfa;
- isa_iooffset_t ioaddr;
-{
- u_int32_t *port, val;
- isa_byte_t rval;
- int offset;
-
- wbflush();
- offset = ioaddr & 3;
- port = (int32_t *)phystok0seg(CIA_PCI_SIO0 | 0 << 3 | ioaddr << 5);
- val = *port;
- rval = ((val) >> (8 * offset)) & 0xff;
-/* rval = val & 0xff; */
-
- return rval;
-}
-
-void
-cia_outb(ipfa, ioaddr, val)
- void *ipfa;
- isa_iooffset_t ioaddr;
- isa_byte_t val;
-{
- u_int32_t *port, nval;
- int offset;
-
- offset = ioaddr & 3;
- nval = val /*<< (8 * offset)*/;
- nval = val << (8 * offset);
- port = (int32_t *)phystok0seg(CIA_PCI_SIO0 | 0 << 3 | ioaddr << 5);
-
- *port = nval;
- wbflush();
-}
-
-isa_word_t
-cia_inw(ipfa, ioaddr)
- void *ipfa;
- isa_iooffset_t ioaddr;
-{
- u_int32_t *port, val;
- isa_word_t rval;
- int offset;
-
- wbflush();
- offset = ioaddr & 3;
- port = (int32_t *)phystok0seg(CIA_PCI_SIO0 | 1 << 3 | ioaddr << 5);
- val = *port;
- rval = ((val) >> (8 * offset)) & 0xffff;
- rval = val & 0xffff;
-
-panic("inw(0x%x) => 0x%x @ %p => 0x%x\n", ioaddr, val, port, rval);
-
- return rval;
-}
-
-void
-cia_outw(ipfa, ioaddr, val)
- void *ipfa;
- isa_iooffset_t ioaddr;
- isa_word_t val;
-{
- u_int32_t *port, nval;
- int offset;
-
- offset = ioaddr & 3;
- nval = val /*<< (8 * offset)*/;
- port = (int32_t *)phystok0seg(CIA_PCI_SIO0 | 1 << 3 | ioaddr << 5);
-
- *port = nval;
- wbflush();
-}
-
-isa_long_t
-cia_inl(ipfa, ioaddr)
- void *ipfa;
- isa_iooffset_t ioaddr;
-{
- u_int32_t *port, val;
- isa_long_t rval;
- int offset;
-
- wbflush();
- offset = ioaddr & 3;
- port = (int32_t *)phystok0seg(CIA_PCI_SIO0 | 3 << 3 | ioaddr << 5);
- val = *port;
- rval = ((val) >> (8 * offset)) & 0xffffffff;
- rval = val & 0xffffffff;
-
- return rval;
-}
-
-void
-cia_outl(ipfa, ioaddr, val)
- void *ipfa;
- isa_iooffset_t ioaddr;
- isa_long_t val;
-{
- u_int32_t *port, nval;
- int offset;
-
- offset = ioaddr & 3;
- nval = val /*<< (8 * offset)*/;
- port = (int32_t *)phystok0seg(CIA_PCI_SIO0 | 3 << 3 | ioaddr << 5);
-
- *port = nval;
- wbflush();
-}
-
-/* XXX XXX XXX */
-
-#define pf(fn, args) fn args { panic(__STRING(fn)); }
-
-void pf(cia_dma_cascade, (void *idfa, isa_drq_t chan))
-void pf(cia_dma_copytobuf, ())
-void pf(cia_dma_copyfrombuf, ())
-void pf(cia_dma_start, (void *idfa, vm_offset_t addr,
- isa_msize_t size, isa_drq_t chan, int flags))
-void pf(cia_dma_abort, (void *idfa, isa_drq_t chan))
-void pf(cia_dma_done, (void *idfa, isa_drq_t chan))
-
-int cia_dma_map __P((void *, vm_offset_t, isa_msize_t,
- isa_moffset_t *, int));
-void cia_dma_unmap __P((void *, vm_offset_t, isa_msize_t, int,
- isa_moffset_t *));
-
-__const struct isa_dma_fns cia_dma_fns = {
- cia_dma_cascade,
- cia_dma_map,
- cia_dma_unmap,
- cia_dma_copytobuf,
- cia_dma_copyfrombuf,
- cia_dma_start,
- cia_dma_abort,
- cia_dma_done,
-};
-
-int
-cia_dma_map(idfa, va, isasize, mappingsp, flags)
- void *idfa;
- vm_offset_t va;
- isa_msize_t isasize;
- isa_moffset_t *mappingsp;
- int flags;
-{
- struct apecs_config *acp = idfa;
- long todo;
- int i;
-
- if (ISA_DMA_NEEDCONTIG(flags) && isasize > NBPG ||
- ISA_DMA_SIZEBOUND(flags) != ISA_DMA_SIZEBOUND_NONE ||
- ISA_DMA_ADDRBOUND(flags) != ISA_DMA_ADDRBOUND_NONE)
- panic("cia_dma_map: punt");
-
- i = 0;
- todo = isasize;
-
- while (todo > 0) {
- mappingsp[i] = vtophys(va) | 0x40000000;
-#if 0
- printf("a_pd_m mapping %d: %lx -> %lx -> %lx\n", i, va,
- vtophys(va), mappingsp[i]);
-#endif
- i++;
- todo -= PAGE_SIZE - (va - trunc_page(va));
- va += PAGE_SIZE - (va - trunc_page(va));
- }
- return (i);
-}
-
-void
-cia_dma_unmap(idfa, va, isasize, nmappings, mappingsp)
- void *idfa;
- vm_offset_t va;
- isa_msize_t isasize;
- int nmappings;
- isa_moffset_t *mappingsp;
-{
-
- printf("cia_dma_unmap: called\n");
-}
-
-vm_offset_t cia_mem_map __P((void *, isa_moffset_t, isa_msize_t, int));
-void cia_mem_unmap __P((void *, vm_offset_t, isa_msize_t));
-
-#if 0
-void cia_mem_copytoisa __P((void *, char *, vm_offset_t,
- isa_moffset_t, isa_msize_t));
-void cia_mem_copyfromisa __P((void *, char *, vm_offset_t,
- isa_moffset_t, isa_msize_t));
-void cia_mem_zero __P((void *, vm_offset_t, isa_moffset_t,
- isa_msize_t));
-#else
-void pf(cia_mem_copytoisa, ())
-void pf(cia_mem_copyfromisa, ())
-void pf(cia_mem_zero, ())
-#endif
-
-__const struct isa_mem_fns cia_mem_fns = {
- cia_mem_map,
- cia_mem_unmap,
- cia_mem_copytoisa,
- cia_mem_copyfromisa,
- cia_mem_zero,
-};
-
-vm_offset_t
-cia_mem_map(imfa, isapa, isasize, cacheable)
- void *imfa;
- isa_moffset_t isapa;
- isa_msize_t isasize;
- int cacheable;
-{
- vm_offset_t sbpa;
-
- /* XXX sanity checks on sizes, use of windows, etc. */
-
- /* XXX MAGIC NUMBERS */
- if (cacheable)
- sbpa = (isapa & 0xffffffff) | CIA_PCI_DENSE;
- else
- sbpa = ((isapa & 0x7ffffff) << 5) | CIA_PCI_SPARSE0;
-
- return phystok0seg(sbpa);
-}
-
-void
-cia_mem_unmap(imfa, va, isasize)
- void *imfa;
- vm_offset_t va;
- isa_msize_t isasize;
-{
-
- /* XXX sanity checks on va */
-
- /* Nothing to do; mapping was done in direct-mapped segment. */
-}
diff --git a/sys/arch/alpha/pci/cia_pci.c b/sys/arch/alpha/pci/cia_pci.c
index ef918cd84d6..4d9b592502b 100644
--- a/sys/arch/alpha/pci/cia_pci.c
+++ b/sys/arch/alpha/pci/cia_pci.c
@@ -1,7 +1,7 @@
-/* $NetBSD: cia_pci.c,v 1.1 1995/11/23 02:37:29 cgd Exp $ */
+/* $NetBSD: cia_pci.c,v 1.2 1996/04/12 23:37:10 cgd Exp $ */
/*
- * Copyright (c) 1995 Carnegie-Mellon University.
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -38,33 +38,83 @@
#include <alpha/pci/ciareg.h>
#include <alpha/pci/ciavar.h>
-pci_confreg_t cia_conf_read __P((void *, pci_conftag_t, pci_confoffset_t));
-void cia_conf_write __P((void *, pci_conftag_t,
- pci_confoffset_t, pci_confreg_t));
-int cia_find_io __P((void *, pci_conftag_t,
- pci_confoffset_t, pci_iooffset_t *, pci_iosize_t *));
-int cia_find_mem __P((void *, pci_conftag_t,
- pci_confoffset_t, pci_moffset_t *, pci_msize_t *, int *));
-
-__const struct pci_conf_fns cia_conf_fns = {
- cia_conf_read,
- cia_conf_write,
- cia_find_io,
- cia_find_mem,
-};
-
-pci_confreg_t
+void cia_attach_hook __P((struct device *, struct device *,
+ struct pcibus_attach_args *));
+int cia_bus_maxdevs __P((void *, int));
+pcitag_t cia_make_tag __P((void *, int, int, int));
+void cia_decompose_tag __P((void *, pcitag_t, int *, int *,
+ int *));
+pcireg_t cia_conf_read __P((void *, pcitag_t, int));
+void cia_conf_write __P((void *, pcitag_t, int, pcireg_t));
+
+void
+cia_pci_init(pc, v)
+ pci_chipset_tag_t pc;
+ void *v;
+{
+
+ pc->pc_conf_v = v;
+ pc->pc_attach_hook = cia_attach_hook;
+ pc->pc_bus_maxdevs = cia_bus_maxdevs;
+ pc->pc_make_tag = cia_make_tag;
+ pc->pc_decompose_tag = cia_decompose_tag;
+ pc->pc_conf_read = cia_conf_read;
+ pc->pc_conf_write = cia_conf_write;
+}
+
+void
+cia_attach_hook(parent, self, pba)
+ struct device *parent, *self;
+ struct pcibus_attach_args *pba;
+{
+}
+
+int
+cia_bus_maxdevs(cpv, busno)
+ void *cpv;
+ int busno;
+{
+
+ return 32;
+}
+
+pcitag_t
+cia_make_tag(cpv, b, d, f)
+ void *cpv;
+ int b, d, f;
+{
+
+ return (b << 16) | (d << 11) | (f << 8);
+}
+
+void
+cia_decompose_tag(cpv, tag, bp, dp, fp)
+ void *cpv;
+ pcitag_t tag;
+ int *bp, *dp, *fp;
+{
+
+ if (bp != NULL)
+ *bp = (tag >> 16) & 0xff;
+ if (dp != NULL)
+ *dp = (tag >> 11) & 0x1f;
+ if (fp != NULL)
+ *fp = (tag >> 8) & 0x7;
+}
+
+pcireg_t
cia_conf_read(cpv, tag, offset)
void *cpv;
- pci_conftag_t tag;
- pci_confoffset_t offset;
+ pcitag_t tag;
+ int offset;
{
- struct cia_config *acp = cpv;
- pci_confreg_t *datap, data;
+ struct cia_config *ccp = cpv;
+ pcireg_t *datap, data;
int s, secondary, ba;
int32_t old_haxr2; /* XXX */
- secondary = PCI_TAG_BUS(tag) != 0;
+ /* secondary if bus # != 0 */
+ pci_decompose_tag(&ccp->cc_pc, tag, &secondary, 0, 0);
if (secondary) {
s = splhigh();
old_haxr2 = REGVAL(CIA_CSRS + 0x480); /* XXX */
@@ -73,12 +123,12 @@ cia_conf_read(cpv, tag, offset)
wbflush();
}
- datap = (pci_confreg_t *)phystok0seg(CIA_PCI_CONF |
+ datap = (pcireg_t *)phystok0seg(CIA_PCI_CONF |
tag << 5UL | /* XXX */
(offset & ~0x03) << 5 | /* XXX */
0 << 5 | /* XXX */
0x3 << 3); /* XXX */
- data = (pci_confreg_t)-1;
+ data = (pcireg_t)-1;
if (!(ba = badaddr(datap, sizeof *datap)))
data = *datap;
@@ -100,16 +150,17 @@ cia_conf_read(cpv, tag, offset)
void
cia_conf_write(cpv, tag, offset, data)
void *cpv;
- pci_conftag_t tag;
- pci_confoffset_t offset;
- pci_confreg_t data;
+ pcitag_t tag;
+ int offset;
+ pcireg_t data;
{
- struct cia_config *acp = cpv;
- pci_confreg_t *datap;
+ struct cia_config *ccp = cpv;
+ pcireg_t *datap;
int s, secondary;
int32_t old_haxr2; /* XXX */
- secondary = PCI_TAG_BUS(tag) != 0;
+ /* secondary if bus # != 0 */
+ pci_decompose_tag(&ccp->cc_pc, tag, &secondary, 0, 0);
if (secondary) {
s = splhigh();
old_haxr2 = REGVAL(CIA_CSRS + 0x480); /* XXX */
@@ -118,7 +169,7 @@ cia_conf_write(cpv, tag, offset, data)
wbflush();
}
- datap = (pci_confreg_t *)phystok0seg(CIA_PCI_CONF |
+ datap = (pcireg_t *)phystok0seg(CIA_PCI_CONF |
tag << 5UL | /* XXX */
(offset & ~0x03) << 5 | /* XXX */
0 << 5 | /* XXX */
@@ -137,86 +188,3 @@ cia_conf_write(cpv, tag, offset, data)
reg, data, datap);
#endif
}
-
-int
-cia_find_io(cpv, tag, reg, iobasep, sizep)
- void *cpv;
- pci_conftag_t tag;
- pci_confoffset_t reg;
- pci_iooffset_t *iobasep;
- pci_iosize_t *sizep;
-{
- struct cia_config *acp = cpv;
- pci_confreg_t addrdata, sizedata;
- pci_iooffset_t pci_iobase;
-
- if (reg < PCI_MAPREG_START || reg >= PCI_MAPREG_END || (reg & 3))
- panic("cia_map_io: bad request");
-
- addrdata = PCI_CONF_READ(acp->cc_conffns, acp->cc_confarg, tag, reg);
-
- PCI_CONF_WRITE(acp->cc_conffns, acp->cc_confarg, tag, reg, 0xffffffff);
- sizedata = PCI_CONF_READ(acp->cc_conffns, acp->cc_confarg, tag, reg);
- PCI_CONF_WRITE(acp->cc_conffns, acp->cc_confarg, tag, reg, addrdata);
-
- if (PCI_MAPREG_TYPE(addrdata) == PCI_MAPREG_TYPE_MEM)
- panic("cia_map_io: attempt to I/O map an memory region");
-
- if (iobasep != NULL)
- *iobasep = PCI_MAPREG_IO_ADDRESS(addrdata);
- if (sizep != NULL)
- *sizep = ~PCI_MAPREG_IO_ADDRESS(sizedata) + 1;
-
- return (0);
-}
-
-int
-cia_find_mem(cpv, tag, reg, paddrp, sizep, cacheablep)
- void *cpv;
- pci_conftag_t tag;
- pci_confoffset_t reg;
- pci_moffset_t *paddrp;
- pci_msize_t *sizep;
- int *cacheablep;
-{
- struct cia_config *acp = cpv;
- pci_confreg_t addrdata, sizedata;
-
- if (reg < PCI_MAPREG_START || reg >= PCI_MAPREG_END || (reg & 3))
- panic("cia_map_mem: bad request");
-
- /*
- * The PROM has mapped the device for us. We take the address
- * that's been assigned to the register, and figure out what
- * physical and virtual addresses go with it...
- */
- addrdata = PCI_CONF_READ(acp->cc_conffns, acp->cc_confarg, tag, reg);
-
- PCI_CONF_WRITE(acp->cc_conffns, acp->cc_confarg, tag, reg, 0xffffffff);
- sizedata = PCI_CONF_READ(acp->cc_conffns, acp->cc_confarg, tag, reg);
- PCI_CONF_WRITE(acp->cc_conffns, acp->cc_confarg, tag, reg, addrdata);
-
- if (PCI_MAPREG_TYPE(addrdata) == PCI_MAPREG_TYPE_IO)
- panic("cia_map_mem: attempt to memory map an I/O region");
-
- switch (PCI_MAPREG_MEM_TYPE(addrdata)) {
- case PCI_MAPREG_MEM_TYPE_32BIT:
- case PCI_MAPREG_MEM_TYPE_32BIT_1M:
- break;
- case PCI_MAPREG_MEM_TYPE_64BIT:
-/* XXX */ printf("cia_map_mem: attempt to map 64-bit region\n");
-/* XXX */ break;
- default:
- printf("cia_map_mem: reserved mapping type\n");
- return EINVAL;
- }
-
- if (paddrp != NULL)
- *paddrp = PCI_MAPREG_MEM_ADDRESS(addrdata); /* PCI addr */
- if (sizep != NULL)
- *sizep = ~PCI_MAPREG_MEM_ADDRESS(sizedata) + 1;
- if (cacheablep != NULL)
- *cacheablep = PCI_MAPREG_MEM_CACHEABLE(addrdata);
-
- return 0;
-}
diff --git a/sys/arch/alpha/pci/ciareg.h b/sys/arch/alpha/pci/ciareg.h
index 5fc6ae9435a..403afa6e3de 100644
--- a/sys/arch/alpha/pci/ciareg.h
+++ b/sys/arch/alpha/pci/ciareg.h
@@ -1,7 +1,7 @@
-/* $NetBSD: ciareg.h,v 1.1 1995/11/23 02:37:31 cgd Exp $ */
+/* $NetBSD: ciareg.h,v 1.1.4.3 1996/06/13 18:35:27 cgd Exp $ */
/*
- * Copyright (c) 1995 Carnegie-Mellon University.
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -38,14 +38,34 @@
/*
* Base addresses
*/
-#define CIA_PCI_SPARSE0 0x8000000000L
-#define CIA_PCI_SPARSE1 0x8400000000L
-#define CIA_PCI_SPARSE2 0x8500000000L
-#define CIA_PCI_SIO0 0x8580000000L
-#define CIA_PCI_SIO1 0x85c0000000L
+#define CIA_PCI_SMEM1 0x8000000000L
+#define CIA_PCI_SMEM2 0x8400000000L
+#define CIA_PCI_SMEM3 0x8500000000L
+#define CIA_PCI_SIO1 0x8580000000L
+#define CIA_PCI_SIO2 0x85c0000000L
#define CIA_PCI_DENSE 0x8600000000L
#define CIA_PCI_CONF 0x8700000000L
#define CIA_PCI_IACK 0x8720000000L
#define CIA_CSRS 0x8740000000L
#define CIA_PCI_MC_CSRS 0x8750000000L
#define CIA_PCI_ATRANS 0x8760000000L
+
+/*
+ * General CSRs
+ */
+
+#define CIA_CSR_HAE_MEM (CIA_CSRS + 0x400)
+
+#define HAE_MEM_REG1_START(x) (((u_int32_t)(x) & 0xe0000000) << 0)
+#define HAE_MEM_REG1_MASK 0x1fffffff
+#define HAE_MEM_REG2_START(x) (((u_int32_t)(x) & 0x0000f800) << 16)
+#define HAE_MEM_REG2_MASK 0x07ffffff
+#define HAE_MEM_REG3_START(x) (((u_int32_t)(x) & 0x000000fc) << 16)
+#define HAE_MEM_REG3_MASK 0x03ffffff
+
+#define CIA_CSR_HAE_IO (CIA_CSRS + 0x440)
+
+#define HAE_IO_REG1_START(x) 0
+#define HAE_IO_REG1_MASK 0x01ffffff
+#define HAE_IO_REG2_START(x) (((u_int32_t)(x) & 0xfe000000) << 0)
+#define HAE_IO_REG2_MASK 0x01ffffff
diff --git a/sys/arch/alpha/pci/ciavar.h b/sys/arch/alpha/pci/ciavar.h
index d9241010d89..0a96fe7347b 100644
--- a/sys/arch/alpha/pci/ciavar.h
+++ b/sys/arch/alpha/pci/ciavar.h
@@ -1,7 +1,7 @@
-/* $NetBSD: ciavar.h,v 1.1 1995/11/23 02:37:35 cgd Exp $ */
+/* $NetBSD: ciavar.h,v 1.3.4.1 1996/06/10 00:04:12 cgd Exp $ */
/*
- * Copyright (c) 1995 Carnegie-Mellon University.
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -37,20 +37,11 @@
* do their dirty work (and more!).
*/
struct cia_config {
- __const struct pci_conf_fns *cc_conffns;
- void *cc_confarg;
+ struct alpha_bus_chipset cc_bc;
+ struct alpha_pci_chipset cc_pc;
- __const struct pci_dma_fns *cc_dmafns;
- void *cc_dmaarg;
-
- __const struct pci_intr_fns *cc_intrfns;
- void *cc_intrarg;
-
- __const struct pci_mem_fns *cc_memfns;
- void *cc_memarg;
-
- __const struct pci_pio_fns *cc_piofns;
- void *cc_pioarg;
+ u_int32_t cc_hae_mem;
+ u_int32_t cc_hae_io;
};
struct cia_softc {
@@ -60,10 +51,8 @@ struct cia_softc {
/* XXX SGMAP info */
};
-extern __const struct pci_conf_fns cia_conf_fns;
-extern __const struct pci_dma_fns cia_dma_fns;
-/* pci interrupt functions handled elsewhere */
-extern __const struct pci_mem_fns cia_mem_fns;
-extern __const struct pci_pio_fns cia_pio_fns;
-
void cia_init __P((struct cia_config *));
+void cia_pci_init __P((pci_chipset_tag_t, void *));
+
+void cia_bus_mem_init __P((bus_chipset_tag_t bc, void *memv));
+void cia_bus_io_init __P((bus_chipset_tag_t bc, void *iov));
diff --git a/sys/arch/alpha/pci/lca.c b/sys/arch/alpha/pci/lca.c
index ac6514fee99..164dd0714be 100644
--- a/sys/arch/alpha/pci/lca.c
+++ b/sys/arch/alpha/pci/lca.c
@@ -1,10 +1,10 @@
-/* $NetBSD: lca.c,v 1.1 1995/11/23 02:37:38 cgd Exp $ */
+/* $NetBSD: lca.c,v 1.5 1996/04/23 14:00:53 cgd Exp $ */
/*
- * Copyright (c) 1995 Carnegie-Mellon University.
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
- * Author: Jeffrey Hsu
+ * Authors: Jeffrey Hsu and Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
@@ -48,9 +48,12 @@
int lcamatch __P((struct device *, void *, void *));
void lcaattach __P((struct device *, struct device *, void *));
-struct cfdriver lcacd = {
- NULL, "lca", lcamatch, lcaattach, DV_DULL,
- sizeof(struct lca_softc)
+struct cfattach lca_ca = {
+ sizeof(struct lca_softc), lcamatch, lcaattach,
+};
+
+struct cfdriver lca_cd = {
+ NULL, "lca", DV_DULL,
};
static int lcaprint __P((void *, char *pnp));
@@ -68,7 +71,7 @@ lcamatch(parent, match, aux)
struct confargs *ca = aux;
/* Make sure that we're looking for a LCA. */
- if (strcmp(ca->ca_name, lcacd.cd_name) != 0)
+ if (strcmp(ca->ca_name, lca_cd.cd_name) != 0)
return (0);
if (lcafound)
@@ -89,20 +92,33 @@ lca_init(lcp)
* Can't set up SGMAP data here; can be called before malloc().
*/
- lcp->lc_conffns = &lca_conf_fns;
- lcp->lc_confarg = lcp;
- lcp->lc_dmafns = &lca_dma_fns;
- lcp->lc_dmaarg = lcp;
- /* Interrupt routines set up in 'attach' */
- lcp->lc_memfns = &lca_mem_fns;
- lcp->lc_memarg = lcp;
- lcp->lc_piofns = &lca_pio_fns;
- lcp->lc_pioarg = lcp;
+ apecs_lca_bus_io_init(&lcp->lc_bc, lcp);
+ apecs_lca_bus_mem_init(&lcp->lc_bc, lcp);
+ lca_pci_init(&lcp->lc_pc, lcp);
-/*
-printf("lca_init: before IOC_HAE=0x%x\n", REGVAL(LCA_IOC_HAE));
- REGVAL(LCA_IOC_HAE) = 0; */
+ /*
+ * Refer to ``DECchip 21066 and DECchip 21068 Alpha AXP Microprocessors
+ * Hardware Reference Manual''.
+ * ...
+ */
+ /*
+ * According to section 6.4.1, all bits of the IOC_HAE register are
+ * undefined after reset. Bits <31:27> are write-only. However, we
+ * cannot blindly set it to zero. The serial ROM code that initializes
+ * the PCI devices' address spaces, allocates sparse memory blocks in
+ * the range that must use the IOC_HAE register for address translation,
+ * and sets this register accordingly (see section 6.4.14).
+ *
+ * IOC_HAE left AS IS.
+ */
+
+ /* According to section 6.4.2, all bits of the IOC_CONF register are
+ * undefined after reset. Bits <1:0> are write-only. Set them to
+ * 0x00 for PCI Type 0 configuration access.
+ *
+ * IOC_CONF set to ZERO.
+ */
REGVAL(LCA_IOC_CONF) = 0;
/* Turn off DMA window enables in Window Base Registers */
@@ -142,10 +158,9 @@ lcaattach(parent, self, aux)
struct device *parent, *self;
void *aux;
{
- struct confargs *ca = aux;
struct lca_softc *sc = (struct lca_softc *)self;
struct lca_config *lcp;
- struct pci_attach_args pa;
+ struct pcibus_attach_args pba;
/* note that we've attached the chipset; can't have 2 LCAs. */
/* Um, not sure about this. XXX JH */
@@ -167,31 +182,18 @@ lcaattach(parent, self, aux)
switch (hwrpb->rpb_type) {
#if defined(DEC_AXPPCI_33)
case ST_DEC_AXPPCI_33:
- pci_axppci_33_pickintr(lcp->lc_conffns, lcp->lc_confarg,
- lcp->lc_piofns, lcp->lc_pioarg,
- &lcp->lc_intrfns, &lcp->lc_intrarg);
+ pci_axppci_33_pickintr(lcp);
break;
#endif
default:
panic("lcaattach: shouldn't be here, really...");
}
- pa.pa_bus = 0;
- pa.pa_maxdev = 13;
- pa.pa_burstlog2 = 8;
-
- pa.pa_conffns = lcp->lc_conffns;
- pa.pa_confarg = lcp->lc_confarg;
- pa.pa_dmafns = lcp->lc_dmafns;
- pa.pa_dmaarg = lcp->lc_dmaarg;
- pa.pa_intrfns = lcp->lc_intrfns;
- pa.pa_intrarg = lcp->lc_intrarg;
- pa.pa_memfns = lcp->lc_memfns;
- pa.pa_memarg = lcp->lc_memarg;
- pa.pa_piofns = lcp->lc_piofns;
- pa.pa_pioarg = lcp->lc_pioarg;
-
- config_found(self, &pa, lcaprint);
+ pba.pba_busname = "pci";
+ pba.pba_bc = &lcp->lc_bc;
+ pba.pba_pc = &lcp->lc_pc;
+ pba.pba_bus = 0;
+ config_found(self, &pba, lcaprint);
}
static int
@@ -199,12 +201,11 @@ lcaprint(aux, pnp)
void *aux;
char *pnp;
{
- register struct pci_attach_args *pa = aux;
+ register struct pcibus_attach_args *pba = aux;
- /* what does this do? XXX JH */
/* only PCIs can attach to LCAes; easy. */
if (pnp)
- printf("pci at %s", pnp);
- printf(" bus %d", pa->pa_bus);
+ printf("%s at %s", pba->pba_busname, pnp);
+ printf(" bus %d", pba->pba_bus);
return (UNCONF);
}
diff --git a/sys/arch/alpha/pci/lca_isa.c b/sys/arch/alpha/pci/lca_isa.c
deleted file mode 100644
index 205d8708663..00000000000
--- a/sys/arch/alpha/pci/lca_isa.c
+++ /dev/null
@@ -1,346 +0,0 @@
-/* $NetBSD: lca_isa.c,v 1.1 1995/11/23 02:37:40 cgd Exp $ */
-
-/*
- * Copyright (c) 1995 Carnegie-Mellon University.
- * All rights reserved.
- *
- * Author: Jeffrey Hsu
- *
- * Permission to use, copy, modify and distribute this software and
- * its documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-#include <sys/param.h>
-#include <sys/malloc.h>
-#include <sys/syslog.h>
-#include <sys/device.h>
-#include <vm/vm.h>
-
-#include <dev/isa/isavar.h>
-
-#include <alpha/pci/lcareg.h>
-#include <alpha/pci/lcavar.h>
-
-/*
- * Allocation/deallocation functions.
- */
-int lca_pio_alloc __P((void *, isa_iooffset_t, isa_iosize_t));
-int lca_pio_dealloc __P((void *, isa_iooffset_t, isa_iosize_t));
-
-/*
- * Byte functions.
- */
-isa_byte_t lca_inb __P((void *, isa_iooffset_t));
-#define lca_insb 0 /* XXX */
-void lca_outb __P((void *, isa_iooffset_t, isa_byte_t));
-#define lca_outsb 0 /* XXX */
-
-/*
- * Word functions.
- */
-isa_word_t lca_inw __P((void *, isa_iooffset_t));
-#define lca_insw 0 /* XXX */
-void lca_outw __P((void *, isa_iooffset_t, isa_word_t));
-#define lca_outsw 0 /* XXX */
-
-/*
- * Longword functions.
- */
-isa_long_t lca_inl __P((void *, isa_iooffset_t));
-#define lca_insl 0 /* XXX */
-void lca_outl __P((void *, isa_iooffset_t, isa_long_t));
-#define lca_outsl 0 /* XXX */
-
-__const struct pci_pio_fns lca_pio_fns = {
- /* Allocation/deallocation functions. */
- lca_pio_alloc, lca_pio_dealloc,
-
- /* Byte functions. */
- lca_inb, lca_insb,
- lca_outb, lca_outsb,
-
- /* Word functions. */
- lca_inw, lca_insw,
- lca_outw, lca_outsw,
-
- /* Longword functions. */
- lca_inl, lca_insl,
- lca_outl, lca_outsl,
-};
-
-int
-lca_pio_alloc(ipfarg, start, size)
- void *ipfarg;
- isa_iooffset_t start;
- isa_iosize_t size;
-{
-
- /* XXX should do something */
-}
-
-int
-lca_pio_dealloc(ipfarg, start, size)
- void *ipfarg;
- isa_iooffset_t start;
- isa_iosize_t size;
-{
-
- /* XXX should do something */
-}
-
-isa_byte_t
-lca_inb(ipfa, ioaddr)
- void *ipfa;
- isa_iooffset_t ioaddr;
-{
- u_int32_t *port, val;
- isa_byte_t rval;
- int offset;
-
- wbflush();
- offset = ioaddr & 3;
- port = (int32_t *)phystok0seg(LCA_PCI_SIO | 0 << 3 | ioaddr << 5);
- val = *port;
- rval = ((val) >> (8 * offset)) & 0xff;
-/* rval = val & 0xff; */
-
- return rval;
-}
-
-void
-lca_outb(ipfa, ioaddr, val)
- void *ipfa;
- isa_iooffset_t ioaddr;
- isa_byte_t val;
-{
- u_int32_t *port, nval;
- int offset;
-
- offset = ioaddr & 3;
- nval = val /*<< (8 * offset)*/;
- nval = val << (8 * offset);
- port = (int32_t *)phystok0seg(LCA_PCI_SIO | 0 << 3 | ioaddr << 5);
-
- *port = nval;
- wbflush();
-}
-
-isa_word_t
-lca_inw(ipfa, ioaddr)
- void *ipfa;
- isa_iooffset_t ioaddr;
-{
- u_int32_t *port, val;
- isa_word_t rval;
- int offset;
-
- wbflush();
- offset = ioaddr & 3;
- port = (int32_t *)phystok0seg(LCA_PCI_SIO | 1 << 3 | ioaddr << 5);
- val = *port;
- rval = ((val) >> (8 * offset)) & 0xffff;
- rval = val & 0xffff;
-
-panic("inw(0x%x) => 0x%x @ %p => 0x%x\n", ioaddr, val, port, rval);
-
- return rval;
-}
-
-void
-lca_outw(ipfa, ioaddr, val)
- void *ipfa;
- isa_iooffset_t ioaddr;
- isa_word_t val;
-{
- u_int32_t *port, nval;
- int offset;
-
- offset = ioaddr & 3;
- nval = val /*<< (8 * offset)*/;
- port = (int32_t *)phystok0seg(LCA_PCI_SIO | 1 << 3 | ioaddr << 5);
-
- *port = nval;
- wbflush();
-}
-
-isa_long_t
-lca_inl(ipfa, ioaddr)
- void *ipfa;
- isa_iooffset_t ioaddr;
-{
- u_int32_t *port, val;
- isa_long_t rval;
- int offset;
-
- wbflush();
- offset = ioaddr & 3;
- port = (int32_t *)phystok0seg(LCA_PCI_SIO | 3 << 3 | ioaddr << 5);
- val = *port;
- rval = ((val) >> (8 * offset)) & 0xffffffff;
- rval = val & 0xffffffff;
-
- return rval;
-}
-
-void
-lca_outl(ipfa, ioaddr, val)
- void *ipfa;
- isa_iooffset_t ioaddr;
- isa_long_t val;
-{
- u_int32_t *port, nval;
- int offset;
-
- offset = ioaddr & 3;
- nval = val /*<< (8 * offset)*/;
- port = (int32_t *)phystok0seg(LCA_PCI_SIO | 3 << 3 | ioaddr << 5);
-
- *port = nval;
- wbflush();
-}
-
-/* XXX XXX XXX */
-
-#define pf(fn, args) fn args { panic(__STRING(fn)); }
-
-void pf(lca_dma_cascade, (void *idfa, isa_drq_t chan))
-void pf(lca_dma_copytobuf, ())
-void pf(lca_dma_copyfrombuf, ())
-void pf(lca_dma_start, (void *idfa, vm_offset_t addr,
- isa_msize_t size, isa_drq_t chan, int flags))
-void pf(lca_dma_abort, (void *idfa, isa_drq_t chan))
-void pf(lca_dma_done, (void *idfa, isa_drq_t chan))
-
-int lca_dma_map __P((void *, vm_offset_t, isa_msize_t,
- isa_moffset_t *, int));
-void lca_dma_unmap __P((void *, vm_offset_t, isa_msize_t, int,
- isa_moffset_t *));
-
-__const struct isa_dma_fns lca_dma_fns = {
- lca_dma_cascade,
- lca_dma_map,
- lca_dma_unmap,
- lca_dma_copytobuf,
- lca_dma_copyfrombuf,
- lca_dma_start,
- lca_dma_abort,
- lca_dma_done,
-};
-
-int
-lca_dma_map(idfa, va, isasize, mappingsp, flags)
- void *idfa;
- vm_offset_t va;
- isa_msize_t isasize;
- isa_moffset_t *mappingsp;
- int flags;
-{
- struct lca_config *acp = idfa;
- long todo;
- int i;
-
- if (ISA_DMA_NEEDCONTIG(flags) && isasize > NBPG ||
- ISA_DMA_SIZEBOUND(flags) != ISA_DMA_SIZEBOUND_NONE ||
- ISA_DMA_ADDRBOUND(flags) != ISA_DMA_ADDRBOUND_NONE)
- panic("lca_dma_map: punt");
-
- i = 0;
- todo = isasize;
-
- while (todo > 0) {
- mappingsp[i] = vtophys(va) | 0x40000000;
-#if 0
- printf("a_pd_m mapping %d: %lx -> %lx -> %lx\n", i, va,
- vtophys(va), mappingsp[i]);
-#endif
- i++;
- todo -= PAGE_SIZE - (va - trunc_page(va));
- va += PAGE_SIZE - (va - trunc_page(va));
- }
- return (i);
-}
-
-void
-lca_dma_unmap(idfa, va, isasize, nmappings, mappingsp)
- void *idfa;
- vm_offset_t va;
- isa_msize_t isasize;
- int nmappings;
- isa_moffset_t *mappingsp;
-{
-
- printf("lca_dma_unmap: called\n");
-}
-
-vm_offset_t lca_mem_map __P((void *, isa_moffset_t, isa_msize_t, int));
-void lca_mem_unmap __P((void *, vm_offset_t, isa_msize_t));
-
-#if 0
-void lca_mem_copytoisa __P((void *, char *, vm_offset_t,
- isa_moffset_t, isa_msize_t));
-void lca_mem_copyfromisa __P((void *, char *, vm_offset_t,
- isa_moffset_t, isa_msize_t));
-void lca_mem_zero __P((void *, vm_offset_t, isa_moffset_t,
- isa_msize_t));
-#else
-void pf(lca_mem_copytoisa, ())
-void pf(lca_mem_copyfromisa, ())
-void pf(lca_mem_zero, ())
-#endif
-
-__const struct isa_mem_fns lca_mem_fns = {
- lca_mem_map,
- lca_mem_unmap,
- lca_mem_copytoisa,
- lca_mem_copyfromisa,
- lca_mem_zero,
-};
-
-vm_offset_t
-lca_mem_map(imfa, isapa, isasize, cacheable)
- void *imfa;
- isa_moffset_t isapa;
- isa_msize_t isasize;
- int cacheable;
-{
- vm_offset_t sbpa;
-
- /* XXX sanity checks on sizes, use of windows, etc. */
-
- /* XXX MAGIC NUMBERS */
- if (cacheable)
- sbpa = (isapa & 0xffffffff) | LCA_PCI_DENSE;
- else
- sbpa = ((isapa & 0x7ffffff) << 5) | LCA_PCI_SPARSE;
-
- return phystok0seg(sbpa);
-}
-
-void
-lca_mem_unmap(imfa, va, isasize)
- void *imfa;
- vm_offset_t va;
- isa_msize_t isasize;
-{
-
- /* XXX sanity checks on va */
-
- /* Nothing to do; mapping was done in direct-mapped segment. */
-}
diff --git a/sys/arch/alpha/pci/lca_pci.c b/sys/arch/alpha/pci/lca_pci.c
index 1b151dcefb9..8d11ddd5ff3 100644
--- a/sys/arch/alpha/pci/lca_pci.c
+++ b/sys/arch/alpha/pci/lca_pci.c
@@ -1,10 +1,10 @@
-/* $NetBSD: lca_pci.c,v 1.1 1995/11/23 02:37:42 cgd Exp $ */
+/* $NetBSD: lca_pci.c,v 1.3 1996/04/23 14:01:00 cgd Exp $ */
/*
- * Copyright (c) 1995 Carnegie-Mellon University.
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
- * Author: Jeffrey Hsu
+ * Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
@@ -38,62 +38,119 @@
#include <alpha/pci/lcareg.h>
#include <alpha/pci/lcavar.h>
-pci_confreg_t lca_conf_read __P((void *, pci_conftag_t, pci_confoffset_t));
-void lca_conf_write __P((void *, pci_conftag_t,
- pci_confoffset_t, pci_confreg_t));
-int lca_find_io __P((void *, pci_conftag_t,
- pci_confoffset_t, pci_iooffset_t *, pci_iosize_t *));
-int lca_find_mem __P((void *, pci_conftag_t,
- pci_confoffset_t, pci_moffset_t *, pci_msize_t *, int *));
-
-__const struct pci_conf_fns lca_conf_fns = {
- lca_conf_read,
- lca_conf_write,
- lca_find_io,
- lca_find_mem,
-};
-
-pci_confreg_t
-lca_conf_read(cpv, tag, offset)
+void lca_attach_hook __P((struct device *, struct device *,
+ struct pcibus_attach_args *));
+int lca_bus_maxdevs __P((void *, int));
+pcitag_t lca_make_tag __P((void *, int, int, int));
+void lca_decompose_tag __P((void *, pcitag_t, int *, int *,
+ int *));
+pcireg_t lca_conf_read __P((void *, pcitag_t, int));
+void lca_conf_write __P((void *, pcitag_t, int, pcireg_t));
+
+void
+lca_pci_init(pc, v)
+ pci_chipset_tag_t pc;
+ void *v;
+{
+
+ pc->pc_conf_v = v;
+ pc->pc_attach_hook = lca_attach_hook;
+ pc->pc_bus_maxdevs = lca_bus_maxdevs;
+ pc->pc_make_tag = lca_make_tag;
+ pc->pc_decompose_tag = lca_decompose_tag;
+ pc->pc_conf_read = lca_conf_read;
+ pc->pc_conf_write = lca_conf_write;
+}
+
+void
+lca_attach_hook(parent, self, pba)
+ struct device *parent, *self;
+ struct pcibus_attach_args *pba;
+{
+}
+
+int
+lca_bus_maxdevs(cpv, busno)
+ void *cpv;
+ int busno;
+{
+
+ if (busno == 0)
+ return 16;
+ else
+ return 32;
+}
+
+pcitag_t
+lca_make_tag(cpv, b, d, f)
void *cpv;
- pci_conftag_t tag;
- pci_confoffset_t offset;
+ int b, d, f;
{
- pci_confreg_t *datap, data;
- int s, secondary, ba;
- int32_t old_ioc_conf; /* XXX */
- u_int64_t dev_sel;
- dev_sel = 1 << PCI_TAG_DEVICE(tag) + 11;
+ return (b << 16) | (d << 11) | (f << 8);
+}
+
+void
+lca_decompose_tag(cpv, tag, bp, dp, fp)
+ void *cpv;
+ pcitag_t tag;
+ int *bp, *dp, *fp;
+{
+
+ if (bp != NULL)
+ *bp = (tag >> 16) & 0xff;
+ if (dp != NULL)
+ *dp = (tag >> 11) & 0x1f;
+ if (fp != NULL)
+ *fp = (tag >> 8) & 0x7;
+}
+
+pcireg_t
+lca_conf_read(cpv, tag, offset)
+ void *cpv;
+ pcitag_t tag;
+ int offset;
+{
+ struct lca_config *lcp = cpv;
+ pcireg_t *datap, data;
+ int s, secondary, device, ba;
- secondary = PCI_TAG_BUS(tag) != 0;
+ /* secondary if bus # != 0 */
+ pci_decompose_tag(&lcp->lc_pc, tag, &secondary, &device, 0);
if (secondary) {
s = splhigh();
- old_ioc_conf = REGVAL(LCA_IOC_CONF);
wbflush();
- REGVAL(LCA_IOC_CONF) = old_ioc_conf | 0x1;
+ REGVAL(LCA_IOC_CONF) = 0x01;
wbflush();
+ } else {
+ /*
+ * on the LCA, must frob the tag used for
+ * devices on the primary bus, in the same ways
+ * as is used by type 1 configuration cycles
+ * on PCs.
+ */
+ tag = (1 << (device + 11)) | (tag & 0x7ff);
}
- datap = (pci_confreg_t *)phystok0seg(LCA_PCI_CONF |
- dev_sel << 5UL | /* XXX */
+ datap = (pcireg_t *)phystok0seg(LCA_PCI_CONF |
+ tag << 5UL | /* XXX */
(offset & ~0x03) << 5 | /* XXX */
0 << 5 | /* XXX */
0x3 << 3); /* XXX */
- data = (pci_confreg_t)-1;
+ data = (pcireg_t)-1;
if (!(ba = badaddr(datap, sizeof *datap)))
data = *datap;
if (secondary) {
wbflush();
- REGVAL(LCA_IOC_CONF) = old_ioc_conf;
+ REGVAL(LCA_IOC_CONF) = 0x00;
wbflush();
splx(s);
}
#if 0
- printf("lca_conf_read: tag 0x%x, offset 0x%x -> %x @ %p%s\n", tag,
- offset, data, datap, ba ? " (badaddr)" : "");
+ printf("lca_conf_read: tag 0x%lx, reg 0x%lx -> %x @ %p%s\n", tag, reg,
+ data, datap, ba ? " (badaddr)" : "");
#endif
return data;
@@ -102,28 +159,33 @@ lca_conf_read(cpv, tag, offset)
void
lca_conf_write(cpv, tag, offset, data)
void *cpv;
- pci_conftag_t tag;
- pci_confoffset_t offset;
- pci_confreg_t data;
+ pcitag_t tag;
+ int offset;
+ pcireg_t data;
{
- pci_confreg_t *datap;
- int s, secondary;
- int32_t old_ioc_conf; /* XXX */
- int32_t dev_sel;
-
- dev_sel = 1 << PCI_TAG_DEVICE(tag) + 11;
+ struct lca_config *lcp = cpv;
+ pcireg_t *datap;
+ int s, secondary, device;
- secondary = PCI_TAG_BUS(tag) != 0;
+ /* secondary if bus # != 0 */
+ pci_decompose_tag(&lcp->lc_pc, tag, &secondary, &device, 0);
if (secondary) {
s = splhigh();
- old_ioc_conf = REGVAL(LCA_IOC_CONF);
wbflush();
- REGVAL(LCA_IOC_CONF) = old_ioc_conf | 0x1;
+ REGVAL(LCA_IOC_CONF) = 0x01;
wbflush();
+ } else {
+ /*
+ * on the LCA, must frob the tag used for
+ * devices on the primary bus, in the same ways
+ * as is used by type 1 configuration cycles
+ * on PCs.
+ */
+ tag = (1 << (device + 11)) | (tag & 0x7ff);
}
- datap = (pci_confreg_t *)phystok0seg(LCA_PCI_CONF |
- dev_sel << 5UL | /* XXX */
+ datap = (pcireg_t *)phystok0seg(LCA_PCI_CONF |
+ tag << 5UL | /* XXX */
(offset & ~0x03) << 5 | /* XXX */
0 << 5 | /* XXX */
0x3 << 3); /* XXX */
@@ -131,96 +193,13 @@ lca_conf_write(cpv, tag, offset, data)
if (secondary) {
wbflush();
- REGVAL(LCA_IOC_CONF) = old_ioc_conf;
+ REGVAL(LCA_IOC_CONF) = 0x00;
wbflush();
splx(s);
}
#if 0
- printf("lca_conf_write: tag 0x%x, offset 0x%x -> 0x%x @ %p\n", tag,
- offset, data, datap);
+ printf("lca_conf_write: tag 0x%lx, reg 0x%lx -> 0x%x @ %p\n", tag,
+ reg, data, datap);
#endif
}
-
-int
-lca_find_io(cpv, tag, reg, iobasep, sizep)
- void *cpv;
- pci_conftag_t tag;
- pci_confoffset_t reg;
- pci_iooffset_t *iobasep;
- pci_iosize_t *sizep;
-{
- struct lca_config *lcp = cpv;
- pci_confreg_t addrdata, sizedata;
- pci_iooffset_t pci_iobase;
-
- if (reg < PCI_MAPREG_START || reg >= PCI_MAPREG_END || (reg & 3))
- panic("lca_map_io: bad request");
-
- addrdata = PCI_CONF_READ(lcp->lc_conffns, lcp->lc_confarg, tag, reg);
-
- PCI_CONF_WRITE(lcp->lc_conffns, lcp->lc_confarg, tag, reg, 0xffffffff);
- sizedata = PCI_CONF_READ(lcp->lc_conffns, lcp->lc_confarg, tag, reg);
- PCI_CONF_WRITE(lcp->lc_conffns, lcp->lc_confarg, tag, reg, addrdata);
-
- if (PCI_MAPREG_TYPE(addrdata) == PCI_MAPREG_TYPE_MEM)
- panic("lca_map_io: attempt to I/O map an memory region");
-
- if (iobasep != NULL)
- *iobasep = PCI_MAPREG_IO_ADDRESS(addrdata);
- if (sizep != NULL)
- *sizep = ~PCI_MAPREG_IO_ADDRESS(sizedata) + 1;
-
- return (0);
-}
-
-int
-lca_find_mem(cpv, tag, reg, paddrp, sizep, cacheablep)
- void *cpv;
- pci_conftag_t tag;
- pci_confoffset_t reg;
- pci_moffset_t *paddrp;
- pci_msize_t *sizep;
- int *cacheablep;
-{
- struct lca_config *lcp = cpv;
- pci_confreg_t addrdata, sizedata;
-
- if (reg < PCI_MAPREG_START || reg >= PCI_MAPREG_END || (reg & 3))
- panic("lca_map_mem: bad request");
-
- /*
- * The PROM has mapped the device for us. We take the address
- * that's been assigned to the register, and figure out what
- * physical and virtual addresses go with it...
- */
- addrdata = PCI_CONF_READ(lcp->lc_conffns, lcp->lc_confarg, tag, reg);
-
- PCI_CONF_WRITE(lcp->lc_conffns, lcp->lc_confarg, tag, reg, 0xffffffff);
- sizedata = PCI_CONF_READ(lcp->lc_conffns, lcp->lc_confarg, tag, reg);
- PCI_CONF_WRITE(lcp->lc_conffns, lcp->lc_confarg, tag, reg, addrdata);
-
- if (PCI_MAPREG_TYPE(addrdata) == PCI_MAPREG_TYPE_IO)
- panic("lca_map_mem: attempt to memory map an I/O region");
-
- switch (PCI_MAPREG_MEM_TYPE(addrdata)) {
- case PCI_MAPREG_MEM_TYPE_32BIT:
- case PCI_MAPREG_MEM_TYPE_32BIT_1M:
- break;
- case PCI_MAPREG_MEM_TYPE_64BIT:
-/* XXX */ printf("lca_map_mem: attempt to map 64-bit region\n");
-/* XXX */ break;
- default:
- printf("lca_map_mem: reserved mapping type\n");
- return EINVAL;
- }
-
- if (paddrp != NULL)
- *paddrp = PCI_MAPREG_MEM_ADDRESS(addrdata); /* PCI addr */
- if (sizep != NULL)
- *sizep = ~PCI_MAPREG_MEM_ADDRESS(sizedata) + 1;
- if (cacheablep != NULL)
- *cacheablep = PCI_MAPREG_MEM_CACHEABLE(addrdata);
-
- return 0;
-}
diff --git a/sys/arch/alpha/pci/lcareg.h b/sys/arch/alpha/pci/lcareg.h
index ac876e3110d..2a36401be8d 100644
--- a/sys/arch/alpha/pci/lcareg.h
+++ b/sys/arch/alpha/pci/lcareg.h
@@ -1,4 +1,4 @@
-/* $NetBSD: lcareg.h,v 1.1 1995/11/23 02:37:44 cgd Exp $ */
+/* $NetBSD: lcareg.h,v 1.2 1996/04/23 14:03:46 cgd Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
@@ -45,6 +45,8 @@
#define LCA_IOC_HAE LCA_IOC_BASE /* Host Address Extension */
#define LCA_IOC_CONF (LCA_IOC_BASE + 0x020) /* Configuration Cycle Type */
+#define LCA_IOC_STAT0 (LCA_IOC_BASE + 0x040) /* Status 0 */
+#define LCA_IOC_STAT1 (LCA_IOC_BASE + 0x060) /* Status 1 */
#define LCA_IOC_W_BASE0 (LCA_IOC_BASE + 0x100) /* Window Base */
#define LCA_IOC_W_MASK0 (LCA_IOC_BASE + 0x140) /* Window Mask */
diff --git a/sys/arch/alpha/pci/lcavar.h b/sys/arch/alpha/pci/lcavar.h
index 80c70807172..1b2cf4bf816 100644
--- a/sys/arch/alpha/pci/lcavar.h
+++ b/sys/arch/alpha/pci/lcavar.h
@@ -1,7 +1,7 @@
-/* $NetBSD: lcavar.h,v 1.1 1995/11/23 02:37:47 cgd Exp $ */
+/* $NetBSD: lcavar.h,v 1.3 1996/04/12 06:08:35 cgd Exp $ */
/*
- * Copyright (c) 1995 Carnegie-Mellon University.
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Jeffrey Hsu
@@ -37,20 +37,8 @@
* do their dirty work (and more!).
*/
struct lca_config {
- __const struct pci_conf_fns *lc_conffns;
- void *lc_confarg;
-
- __const struct pci_dma_fns *lc_dmafns;
- void *lc_dmaarg;
-
- __const struct pci_intr_fns *lc_intrfns;
- void *lc_intrarg;
-
- __const struct pci_mem_fns *lc_memfns;
- void *lc_memarg;
-
- __const struct pci_pio_fns *lc_piofns;
- void *lc_pioarg;
+ struct alpha_bus_chipset lc_bc;
+ struct alpha_pci_chipset lc_pc;
};
struct lca_softc {
@@ -59,10 +47,5 @@ struct lca_softc {
struct lca_config *sc_lcp;
};
-extern __const struct pci_conf_fns lca_conf_fns;
-extern __const struct pci_dma_fns lca_dma_fns;
-/* pci interrupt functions handled elsewhere */
-extern __const struct pci_mem_fns lca_mem_fns;
-extern __const struct pci_pio_fns lca_pio_fns;
-
void lca_init __P((struct lca_config *));
+void lca_pci_init __P((pci_chipset_tag_t, void *));
diff --git a/sys/arch/alpha/pci/pci_2100_a50.c b/sys/arch/alpha/pci/pci_2100_a50.c
index 06fbc924b02..b9420c5ce01 100644
--- a/sys/arch/alpha/pci/pci_2100_a50.c
+++ b/sys/arch/alpha/pci/pci_2100_a50.c
@@ -1,7 +1,7 @@
-/* $NetBSD: pci_2100_a50.c,v 1.4 1995/12/24 02:29:42 mycroft Exp $ */
+/* $NetBSD: pci_2100_a50.c,v 1.7 1996/04/23 14:15:55 cgd Exp $ */
/*
- * Copyright (c) 1995 Carnegie-Mellon University.
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -35,6 +35,9 @@
#include <sys/device.h>
#include <vm/vm.h>
+#include <machine/bus.h>
+#include <machine/intr.h>
+
#include <dev/isa/isavar.h>
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
@@ -43,45 +46,72 @@
#include <alpha/pci/pci_2100_a50.h>
#include <alpha/pci/siovar.h>
+#include <alpha/pci/sioreg.h>
#include "sio.h"
-void *dec_2100_a50_pci_map_int __P((void *, pci_conftag_t,
- pci_intr_pin_t, pci_intr_line_t, int,
- int (*func)(void *), void *, char *));
-void dec_2100_a50_pci_unmap_int __P((void *, void *));
+int dec_2100_a50_intr_map __P((void *, pcitag_t, int, int,
+ pci_intr_handle_t *));
+const char *dec_2100_a50_intr_string __P((void *, pci_intr_handle_t));
+void *dec_2100_a50_intr_establish __P((void *, pci_intr_handle_t,
+ int, int (*func)(void *), void *));
+void dec_2100_a50_intr_disestablish __P((void *, void *));
-__const struct pci_intr_fns dec_2100_a50_pci_intr_fns = {
- dec_2100_a50_pci_map_int,
- dec_2100_a50_pci_unmap_int,
-};
+#define APECS_SIO_DEVICE 7 /* XXX */
-void *
-dec_2100_a50_pci_map_int(acv, tag, pin, line, level, func, arg, what)
+void
+pci_2100_a50_pickintr(acp)
+ struct apecs_config *acp;
+{
+ bus_chipset_tag_t bc = &acp->ac_bc;
+ pci_chipset_tag_t pc = &acp->ac_pc;
+ pcireg_t sioclass;
+ int sioII;
+
+ /* XXX MAGIC NUMBER */
+ sioclass = pci_conf_read(pc, pci_make_tag(pc, 0, 7, 0), PCI_CLASS_REG);
+ sioII = (sioclass & 0xff) >= 3;
+
+ if (!sioII)
+ printf("WARNING: SIO NOT SIO II... NO BETS...\n");
+
+ pc->pc_intr_v = acp;
+ pc->pc_intr_map = dec_2100_a50_intr_map;
+ pc->pc_intr_string = dec_2100_a50_intr_string;
+ pc->pc_intr_establish = dec_2100_a50_intr_establish;
+ pc->pc_intr_disestablish = dec_2100_a50_intr_disestablish;
+
+#if NSIO
+ sio_intr_setup(bc);
+ set_iointr(&sio_iointr);
+#else
+ panic("pci_2100_a50_pickintr: no I/O interrupt handler (no sio)");
+#endif
+}
+
+int
+dec_2100_a50_intr_map(acv, bustag, buspin, line, ihp)
void *acv;
- pci_conftag_t tag;
- pci_intr_pin_t pin;
- pci_intr_line_t line;
- int level;
- int (*func) __P((void *));
- void *arg;
- char *what;
+ pcitag_t bustag;
+ int buspin, line;
+ pci_intr_handle_t *ihp;
{
struct apecs_config *acp = acv;
- int bus, device, pirq;
- pci_confreg_t irreg, pirqreg;
+ pci_chipset_tag_t pc = &acp->ac_pc;
+ int device, pirq;
+ pcireg_t pirqreg;
u_int8_t pirqline;
- if (pin == 0) {
+ if (buspin == 0) {
/* No IRQ used. */
- return 0;
+ return 1;
}
- if (pin > 4) {
- printf("pci_map_int: bad interrupt pin %d\n", pin);
- return NULL;
+ if (buspin > 4) {
+ printf("pci_map_int: bad interrupt pin %d\n", buspin);
+ return 1;
}
- device = PCI_TAG_DEVICE(tag);
+ pci_decompose_tag(pc, bustag, NULL, &device, NULL);
switch (device) {
case 6: /* NCR SCSI */
@@ -89,7 +119,8 @@ dec_2100_a50_pci_map_int(acv, tag, pin, line, level, func, arg, what)
break;
case 11: /* slot 1 */
- switch (pin) {
+ case 14: /* slot 3 */
+ switch (buspin) {
case PCI_INTERRUPT_PIN_A:
case PCI_INTERRUPT_PIN_D:
pirq = 0;
@@ -104,7 +135,7 @@ dec_2100_a50_pci_map_int(acv, tag, pin, line, level, func, arg, what)
break;
case 12: /* slot 2 */
- switch (pin) {
+ switch (buspin) {
case PCI_INTERRUPT_PIN_A:
case PCI_INTERRUPT_PIN_D:
pirq = 1;
@@ -119,7 +150,7 @@ dec_2100_a50_pci_map_int(acv, tag, pin, line, level, func, arg, what)
break;
case 13: /* slot 3 */
- switch (pin) {
+ switch (buspin) {
case PCI_INTERRUPT_PIN_A:
case PCI_INTERRUPT_PIN_D:
pirq = 2;
@@ -134,64 +165,54 @@ dec_2100_a50_pci_map_int(acv, tag, pin, line, level, func, arg, what)
break;
}
- pirqreg = PCI_CONF_READ(acp->ac_conffns, acp->ac_confarg,
- PCI_MAKE_TAG(0, 7, 0), 0x60); /* XXX */
+ pirqreg = pci_conf_read(pc, pci_make_tag(pc, 0, APECS_SIO_DEVICE, 0),
+ SIO_PCIREG_PIRQ_RTCTRL);
#if 0
printf("pci_2100_a50_map_int: device %d pin %c: pirq %d, reg = %x\n",
- device, '@' + pin, pirq, pirqreg);
+ device, '@' + buspin, pirq, pirqreg);
#endif
pirqline = (pirqreg >> (pirq * 8)) & 0xff;
if ((pirqline & 0x80) != 0)
- return 0; /* not routed? */
+ return 1;
pirqline &= 0xf;
#if 0
printf("pci_2100_a50_map_int: device %d pin %c: mapped to line %d\n",
- device, '@' + pin, pirqline);
+ device, '@' + buspin, pirqline);
#endif
-#if NSIO
- return ISA_INTR_ESTABLISH(&sio_isa_intr_fns, NULL, /* XXX */
- pirqline, IST_LEVEL, level, func, arg);
-#else
- panic("dec_2100_a50_pci_map_int: no sio!");
-#endif
+ *ihp = pirqline;
+ return (0);
}
-void
-dec_2100_a50_pci_unmap_int(pifa, cookie)
- void *pifa;
- void *cookie;
+const char *
+dec_2100_a50_intr_string(acv, ih)
+ void *acv;
+ pci_intr_handle_t ih;
{
+ struct apecs_config *acp = acv;
- panic("dec_2100_a50_pci_unmap_int not implemented"); /* XXX */
+ return sio_intr_string(NULL /*XXX*/, ih);
}
-void
-pci_2100_a50_pickintr(pcf, pcfa, ppf, ppfa, pifp, pifap)
- __const struct pci_conf_fns *pcf;
- __const struct pci_pio_fns *ppf;
- void *pcfa, *ppfa;
- __const struct pci_intr_fns **pifp;
- void **pifap;
+void *
+dec_2100_a50_intr_establish(acv, ih, level, func, arg)
+ void *acv, *arg;
+ pci_intr_handle_t ih;
+ int level;
+ int (*func) __P((void *));
{
- pci_confreg_t sioclass;
- int sioII;
+ struct apecs_config *acp = acv;
- /* XXX MAGIC NUMBER */
- sioclass = PCI_CONF_READ(pcf, pcfa, PCI_MAKE_TAG(0, 7, 0),
- PCI_CLASS_REG);
- sioII = (sioclass & 0xff) >= 3;
+ return sio_intr_establish(NULL /*XXX*/, ih, IST_LEVEL, level, func,
+ arg);
+}
- if (!sioII)
- printf("WARNING: SIO NOT SIO II... NO BETS...\n");
+void
+dec_2100_a50_intr_disestablish(acv, cookie)
+ void *acv, *cookie;
+{
+ struct apecs_config *acp = acv;
- *pifp = &dec_2100_a50_pci_intr_fns;
- *pifap = pcfa; /* XXX assumes apecs_config ptr */
-#if NSIO
- sio_intr_setup(ppf, ppfa);
- set_iointr(&sio_iointr);
-#else
- panic("pci_2100_a50_pickintr: no I/O interrupt handler (no sio)");
-#endif
+ sio_intr_disestablish(NULL /*XXX*/, cookie);
}
diff --git a/sys/arch/alpha/pci/pci_2100_a50.h b/sys/arch/alpha/pci/pci_2100_a50.h
index 08c22aef089..ed450aa2f97 100644
--- a/sys/arch/alpha/pci/pci_2100_a50.h
+++ b/sys/arch/alpha/pci/pci_2100_a50.h
@@ -1,7 +1,7 @@
-/* $NetBSD: pci_2100_a50.h,v 1.1 1995/11/23 02:37:51 cgd Exp $ */
+/* $NetBSD: pci_2100_a50.h,v 1.3 1996/04/12 06:08:42 cgd Exp $ */
/*
- * Copyright (c) 1995 Carnegie-Mellon University.
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -27,6 +27,4 @@
* rights to redistribute these changes.
*/
-void pci_2100_a50_pickintr __P((__const struct pci_conf_fns *, void *,
- __const struct pci_pio_fns *, void *,
- __const struct pci_intr_fns **, void **));
+void pci_2100_a50_pickintr __P((struct apecs_config *));
diff --git a/sys/arch/alpha/pci/pci_axppci_33.c b/sys/arch/alpha/pci/pci_axppci_33.c
index 2cfb453226b..008f5111636 100644
--- a/sys/arch/alpha/pci/pci_axppci_33.c
+++ b/sys/arch/alpha/pci/pci_axppci_33.c
@@ -1,10 +1,10 @@
-/* $NetBSD: pci_axppci_33.c,v 1.2 1995/12/24 02:29:43 mycroft Exp $ */
+/* $NetBSD: pci_axppci_33.c,v 1.5 1996/04/23 14:15:28 cgd Exp $ */
/*
- * Copyright (c) 1995 Carnegie-Mellon University.
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
- * Author: Jeffrey Hsu
+ * Authors: Jeffrey Hsu and Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
@@ -35,6 +35,9 @@
#include <sys/device.h>
#include <vm/vm.h>
+#include <machine/bus.h>
+#include <machine/intr.h>
+
#include <dev/isa/isavar.h>
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
@@ -42,47 +45,74 @@
#include <alpha/pci/lcavar.h>
#include <alpha/pci/pci_axppci_33.h>
-
#include <alpha/pci/siovar.h>
+#include <alpha/pci/sioreg.h>
#include "sio.h"
-void *dec_axppci_33_pci_map_int __P((void *, pci_conftag_t,
- pci_intr_pin_t, pci_intr_line_t, int,
- int (*func)(void *), void *, char *));
-void dec_axppci_33_pci_unmap_int __P((void *, void *));
+int dec_axppci_33_intr_map __P((void *, pcitag_t, int, int,
+ pci_intr_handle_t *));
+const char *dec_axppci_33_intr_string __P((void *, pci_intr_handle_t));
+void *dec_axppci_33_intr_establish __P((void *, pci_intr_handle_t,
+ int, int (*func)(void *), void *));
+void dec_axppci_33_intr_disestablish __P((void *, void *));
-__const struct pci_intr_fns dec_axppci_33_pci_intr_fns = {
- dec_axppci_33_pci_map_int,
- dec_axppci_33_pci_unmap_int,
-};
+#define LCA_SIO_DEVICE 7 /* XXX */
-void *
-dec_axppci_33_pci_map_int(lcv, tag, pin, line, level, func, arg, what)
+void
+pci_axppci_33_pickintr(lcp)
+ struct lca_config *lcp;
+{
+ bus_chipset_tag_t bc = &lcp->lc_bc;
+ pci_chipset_tag_t pc = &lcp->lc_pc;
+ pcireg_t sioclass;
+ int sioII;
+
+ /* XXX MAGIC NUMBER */
+ sioclass = pci_conf_read(pc, pci_make_tag(pc, 0, LCA_SIO_DEVICE, 0),
+ PCI_CLASS_REG);
+ sioII = (sioclass & 0xff) >= 3;
+
+ if (!sioII)
+ printf("WARNING: SIO NOT SIO II... NO BETS...\n");
+
+ pc->pc_intr_v = lcp;
+ pc->pc_intr_map = dec_axppci_33_intr_map;
+ pc->pc_intr_string = dec_axppci_33_intr_string;
+ pc->pc_intr_establish = dec_axppci_33_intr_establish;
+ pc->pc_intr_disestablish = dec_axppci_33_intr_disestablish;
+
+#if NSIO
+ sio_intr_setup(bc);
+ set_iointr(&sio_iointr);
+#else
+ panic("pci_axppci_33_pickintr: no I/O interrupt handler (no sio)");
+#endif
+}
+
+int
+dec_axppci_33_intr_map(lcv, bustag, buspin, line, ihp)
void *lcv;
- pci_conftag_t tag;
- pci_intr_pin_t pin;
- pci_intr_line_t line;
- int level;
- int (*func) __P((void *));
- void *arg;
- char *what;
+ pcitag_t bustag;
+ int buspin, line;
+ pci_intr_handle_t *ihp;
{
struct lca_config *lcp = lcv;
- int bus, device, pirq;
- pci_confreg_t irreg, pirqreg;
+ pci_chipset_tag_t pc = &lcp->lc_pc;
+ int device, pirq;
+ pcireg_t pirqreg;
u_int8_t pirqline;
- if (pin == 0) {
+ if (buspin == 0) {
/* No IRQ used. */
- return 0;
+ return 1;
}
- if (pin > 4) {
- printf("dec_axppci_33_map_int: bad interrupt pin %d\n", pin);
- return NULL;
+ if (buspin > 4) {
+ printf("pci_map_int: bad interrupt pin %d\n", buspin);
+ return 1;
}
- device = PCI_TAG_DEVICE(tag);
+ pci_decompose_tag(pc, bustag, NULL, &device, NULL);
switch (device) {
case 6: /* NCR SCSI */
@@ -90,7 +120,7 @@ dec_axppci_33_pci_map_int(lcv, tag, pin, line, level, func, arg, what)
break;
case 11: /* slot 1 */
- switch (pin) {
+ switch (buspin) {
case PCI_INTERRUPT_PIN_A:
case PCI_INTERRUPT_PIN_D:
pirq = 0;
@@ -105,7 +135,7 @@ dec_axppci_33_pci_map_int(lcv, tag, pin, line, level, func, arg, what)
break;
case 12: /* slot 2 */
- switch (pin) {
+ switch (buspin) {
case PCI_INTERRUPT_PIN_A:
case PCI_INTERRUPT_PIN_D:
pirq = 1;
@@ -120,7 +150,7 @@ dec_axppci_33_pci_map_int(lcv, tag, pin, line, level, func, arg, what)
break;
case 8: /* slot 3 */
- switch (pin) {
+ switch (buspin) {
case PCI_INTERRUPT_PIN_A:
case PCI_INTERRUPT_PIN_D:
pirq = 2;
@@ -139,66 +169,54 @@ dec_axppci_33_pci_map_int(lcv, tag, pin, line, level, func, arg, what)
panic("dec_axppci_33_pci_map_int: bad device number");
}
-#define LCA_SIO_DEVICE 7 /* XXX */
-
- pirqreg = PCI_CONF_READ(lcp->lc_conffns, lcp->lc_confarg,
- PCI_MAKE_TAG(0, LCA_SIO_DEVICE, 0), 0x60); /* XXX */
+ pirqreg = pci_conf_read(pc, pci_make_tag(pc, 0, LCA_SIO_DEVICE, 0),
+ SIO_PCIREG_PIRQ_RTCTRL);
#if 0
- printf("dec_pci_axppci_33_map_int: device %d pin %c: pirq %d, reg = %x\n",
- device, '@' + pin, pirq, pirqreg);
+ printf("pci_axppci_33_map_int: device %d pin %c: pirq %d, reg = %x\n",
+ device, '@' + buspin, pirq, pirqreg);
#endif
pirqline = (pirqreg >> (pirq * 8)) & 0xff;
if ((pirqline & 0x80) != 0)
- return 0; /* not routed? */
+ return 1; /* not routed? */
pirqline &= 0xf;
#if 0
- printf("dec_pci_axppci_33_map_int: device %d pin %c: mapped to line %d\n",
- device, '@' + pin, pirqline);
+ printf("pci_axppci_33_map_int: device %d pin %c: mapped to line %d\n",
+ device, '@' + buspin, pirqline);
#endif
-#if NSIO
- return ISA_INTR_ESTABLISH(&sio_isa_intr_fns, NULL, /* XXX */
- pirqline, IST_LEVEL, level, func, arg);
-#else
- panic("dec_axppci_33_pci_map_int: no sio!");
-#endif
+ *ihp = pirqline;
+ return (0);
}
-void
-dec_axppci_33_pci_unmap_int(pifa, cookie)
- void *pifa;
- void *cookie;
+const char *
+dec_axppci_33_intr_string(lcv, ih)
+ void *lcv;
+ pci_intr_handle_t ih;
{
+ struct lca_config *lcp = lcv;
- panic("dec_axppci_33_pci_unmap_int not implemented"); /* XXX */
+ return sio_intr_string(NULL /*XXX*/, ih);
}
-void
-pci_axppci_33_pickintr(pcf, pcfa, ppf, ppfa, pifp, pifap)
- __const struct pci_conf_fns *pcf;
- __const struct pci_pio_fns *ppf;
- void *pcfa, *ppfa;
- __const struct pci_intr_fns **pifp;
- void **pifap;
+void *
+dec_axppci_33_intr_establish(lcv, ih, level, func, arg)
+ void *lcv, *arg;
+ pci_intr_handle_t ih;
+ int level;
+ int (*func) __P((void *));
{
- pci_confreg_t sioclass;
- int sioII;
+ struct lca_config *lcp = lcv;
- /* XXX MAGIC NUMBER */
- sioclass = PCI_CONF_READ(pcf, pcfa, PCI_MAKE_TAG(0, LCA_SIO_DEVICE, 0),
- PCI_CLASS_REG);
- sioII = (sioclass & 0xff) >= 3;
+ return sio_intr_establish(NULL /*XXX*/, ih, IST_LEVEL, level, func,
+ arg);
+}
- if (!sioII)
- printf("WARNING: SIO NOT SIO II... NO BETS...\n");
+void
+dec_axppci_33_intr_disestablish(lcv, cookie)
+ void *lcv, *cookie;
+{
+ struct lca_config *lcp = lcv;
- *pifp = &dec_axppci_33_pci_intr_fns;
- *pifap = pcfa; /* XXX assumes apecs_config ptr */
-#if NSIO
- sio_intr_setup(ppf, ppfa);
- set_iointr(&sio_iointr);
-#else
- panic("pci_axppci_33_pickintr: no I/O interrupt handler (no sio)");
-#endif
+ sio_intr_disestablish(NULL /*XXX*/, cookie);
}
diff --git a/sys/arch/alpha/pci/pci_axppci_33.h b/sys/arch/alpha/pci/pci_axppci_33.h
index 342eb0dfd71..27dfa1f4b04 100644
--- a/sys/arch/alpha/pci/pci_axppci_33.h
+++ b/sys/arch/alpha/pci/pci_axppci_33.h
@@ -1,10 +1,10 @@
-/* $NetBSD: pci_axppci_33.h,v 1.1 1995/11/23 02:37:56 cgd Exp $ */
+/* $NetBSD: pci_axppci_33.h,v 1.3 1996/04/12 06:08:47 cgd Exp $ */
/*
- * Copyright (c) 1995 Carnegie-Mellon University.
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
- * Author: Jeffrey Hsu
+ * Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
@@ -27,6 +27,4 @@
* rights to redistribute these changes.
*/
-void pci_axppci_33_pickintr __P((__const struct pci_conf_fns *, void *,
- __const struct pci_pio_fns *, void *,
- __const struct pci_intr_fns **, void **));
+void pci_axppci_33_pickintr __P((struct lca_config *));
diff --git a/sys/arch/alpha/pci/pci_kn20aa.c b/sys/arch/alpha/pci/pci_kn20aa.c
index f8cff214e01..6a5582c7cd3 100644
--- a/sys/arch/alpha/pci/pci_kn20aa.c
+++ b/sys/arch/alpha/pci/pci_kn20aa.c
@@ -1,7 +1,7 @@
-/* $NetBSD: pci_kn20aa.c,v 1.2 1995/12/24 02:29:45 mycroft Exp $ */
+/* $NetBSD: pci_kn20aa.c,v 1.3.4.2 1996/06/13 18:35:31 cgd Exp $ */
/*
- * Copyright (c) 1995 Carnegie-Mellon University.
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -55,14 +55,12 @@
#include <alpha/pci/siovar.h>
#endif
-void *kn20aa_pci_map_int __P((void *, pci_conftag_t, pci_intr_pin_t,
- pci_intr_line_t, int, int (*func)(void *), void *, char *));
-void kn20aa_pci_unmap_int __P((void *, void *));
-
-__const struct pci_intr_fns kn20aa_pci_intr_fns = {
- kn20aa_pci_map_int,
- kn20aa_pci_unmap_int,
-};
+int dec_kn20aa_intr_map __P((void *, pcitag_t, int, int,
+ pci_intr_handle_t *));
+const char *dec_kn20aa_intr_string __P((void *, pci_intr_handle_t));
+void *dec_kn20aa_intr_establish __P((void *, pci_intr_handle_t,
+ int, int (*func)(void *), void *));
+void dec_kn20aa_intr_disestablish __P((void *, void *));
#define KN20AA_PCEB_IRQ 31
#define KN20AA_MAX_IRQ 32
@@ -90,25 +88,25 @@ struct kn20aa_intrhand *kn20aa_attach_intr __P((struct kn20aa_intrchain *,
int, int (*) (void *), void *));
void
-pci_kn20aa_pickintr(pcf, pcfa, ppf, ppfa, pifp, pifap)
- __const struct pci_conf_fns *pcf;
- __const struct pci_pio_fns *ppf;
- void *pcfa, *ppfa;
- __const struct pci_intr_fns **pifp;
- void **pifap;
+pci_kn20aa_pickintr(ccp)
+ struct cia_config *ccp;
{
int i;
struct kn20aa_intrhand *nintrhand;
-
+ bus_chipset_tag_t bc = &ccp->cc_bc;
+ pci_chipset_tag_t pc = &ccp->cc_pc;
for (i = 0; i < KN20AA_MAX_IRQ; i++)
TAILQ_INIT(&kn20aa_pci_intrs[i]);
- *pifp = &kn20aa_pci_intr_fns;
- *pifap = NULL; /* XXX ? */
+ pc->pc_intr_v = ccp;
+ pc->pc_intr_map = dec_kn20aa_intr_map;
+ pc->pc_intr_string = dec_kn20aa_intr_string;
+ pc->pc_intr_establish = dec_kn20aa_intr_establish;
+ pc->pc_intr_disestablish = dec_kn20aa_intr_disestablish;
#if NSIO
- sio_intr_setup(ppf, ppfa);
+ sio_intr_setup(bc);
#endif
set_iointr(kn20aa_iointr);
@@ -121,27 +119,25 @@ pci_kn20aa_pickintr(pcf, pcfa, ppf, ppfa, pifp, pifap)
#endif
}
-void *
-kn20aa_pci_map_int(ccv, tag, pin, line, level, func, arg, what)
- void *ccv;
- pci_conftag_t tag;
- pci_intr_pin_t pin;
- pci_intr_line_t line;
- int level;
- int (*func) __P((void *));
- void *arg;
- char *what;
+int
+dec_kn20aa_intr_map(ccv, bustag, buspin, line, ihp)
+ void *ccv;
+ pcitag_t bustag;
+ int buspin, line;
+ pci_intr_handle_t *ihp;
{
+ struct cia_config *ccp = ccv;
+ pci_chipset_tag_t pc = &ccp->cc_pc;
int device;
int kn20aa_slot, kn20aa_irq;
void *ih;
- if (pin == 0) {
+ if (buspin == 0) {
/* No IRQ used. */
return 0;
}
- if (pin > 4) {
- printf("pci_map_int: bad interrupt pin %d\n", pin);
+ if (buspin > 4) {
+ printf("pci_map_int: bad interrupt pin %d\n", buspin);
return NULL;
}
@@ -152,7 +148,8 @@ kn20aa_pci_map_int(ccv, tag, pin, line, level, func, arg, what)
* The DEC engineers who did this hardware obviously engaged
* in random drug testing.
*/
- switch (device = PCI_TAG_DEVICE(tag)) {
+ pci_decompose_tag(pc, bustag, NULL, &device, NULL);
+ switch (device) {
case 11:
case 12:
kn20aa_slot = (device - 11) + 0;
@@ -175,29 +172,56 @@ kn20aa_pci_map_int(ccv, tag, pin, line, level, func, arg, what)
device);
}
- kn20aa_irq = (kn20aa_slot * 4) + pin - 1;
+ kn20aa_irq = (kn20aa_slot * 4) + buspin - 1;
if (kn20aa_irq > KN20AA_MAX_IRQ)
panic("pci_kn20aa_map_int: kn20aa_irq too large (%d)\n",
kn20aa_irq);
-#if 0
- printf("kn20aa_attach_intr: func 0x%lx, arg 0x%lx, level %d, irq %d\n",
- func, arg, level, kn20aa_irq);
-#endif
+ *ihp = kn20aa_irq;
+}
- ih = kn20aa_attach_intr(&kn20aa_pci_intrs[kn20aa_irq], level,
- func, arg);
- kn20aa_enable_intr(kn20aa_irq);
- return (ih);
+const char *
+dec_kn20aa_intr_string(ccv, ih)
+ void *ccv;
+ pci_intr_handle_t ih;
+{
+ struct cia_config *ccp = ccv;
+ static char irqstr[15]; /* 11 + 2 + NULL + sanity */
+
+ if (ih > KN20AA_MAX_IRQ)
+ panic("dec_kn20aa_a50_intr_string: bogus kn20aa IRQ 0x%x\n",
+ ih);
+
+ sprintf(irqstr, "kn20aa irq %d", ih);
+ return (irqstr);
}
-void
-kn20aa_pci_unmap_int(pifa, cookie)
- void *pifa;
+void *
+dec_kn20aa_intr_establish(ccv, ih, level, func, arg)
+ void *ccv, *arg;
+ pci_intr_handle_t ih;
+ int level;
+ int (*func) __P((void *));
+{
+ struct cia_config *ccp = ccv;
void *cookie;
+
+ if (ih > KN20AA_MAX_IRQ)
+ panic("dec_kn20aa_intr_establish: bogus kn20aa IRQ 0x%x\n",
+ ih);
+
+ cookie = kn20aa_attach_intr(&kn20aa_pci_intrs[ih], level, func, arg);
+ kn20aa_enable_intr(ih);
+ return (cookie);
+}
+
+void
+dec_kn20aa_intr_disestablish(ccv, cookie)
+ void *ccv, *cookie;
{
+ struct cia_config *ccp = ccv;
- panic("kn20aa_pci_unmap_int not implemented"); /* XXX */
+ panic("dec_kn20aa_intr_disestablish not implemented"); /* XXX */
}
/*
diff --git a/sys/arch/alpha/pci/pci_kn20aa.h b/sys/arch/alpha/pci/pci_kn20aa.h
index 4e499317ea0..dfbd89e3f05 100644
--- a/sys/arch/alpha/pci/pci_kn20aa.h
+++ b/sys/arch/alpha/pci/pci_kn20aa.h
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_kn20aa.h,v 1.1 1995/11/23 02:38:05 cgd Exp $ */
+/* $NetBSD: pci_kn20aa.h,v 1.2 1996/04/13 00:24:35 cgd Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
@@ -27,9 +27,7 @@
* rights to redistribute these changes.
*/
-void pci_kn20aa_pickintr __P((__const struct pci_conf_fns *, void *,
- __const struct pci_pio_fns *, void *,
- __const struct pci_intr_fns **, void **));
+void pci_kn20aa_pickintr __P((struct cia_config *));
#ifdef EVCNT_COUNTERS
extern struct evcnt kn20aa_intr_evcnt;
diff --git a/sys/arch/alpha/pci/pci_machdep.c b/sys/arch/alpha/pci/pci_machdep.c
index 02eb57caeaa..b0a8e04c6d3 100644
--- a/sys/arch/alpha/pci/pci_machdep.c
+++ b/sys/arch/alpha/pci/pci_machdep.c
@@ -1,7 +1,7 @@
-/* $NetBSD: pci_machdep.c,v 1.3 1995/11/23 02:38:07 cgd Exp $ */
+/* $NetBSD: pci_machdep.c,v 1.5 1996/04/12 06:08:49 cgd Exp $ */
/*
- * Copyright (c) 1995 Carnegie-Mellon University.
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -37,7 +37,6 @@
#include <sys/systm.h>
#include <sys/errno.h>
#include <sys/device.h>
-
#include <vm/vm.h>
#include <dev/isa/isavar.h>
@@ -56,41 +55,44 @@
#endif
void
-pci_display_console(pcf, pcfa, pmf, pmfa, ppf, ppfa, bus, device, function)
- __const struct pci_conf_fns *pcf;
- __const struct pci_mem_fns *pmf;
- __const struct pci_pio_fns *ppf;
- void *pcfa, *pmfa, *ppfa;
- pci_bus_t bus;
- pci_device_t device;
- pci_function_t function;
+pci_display_console(bc, pc, bus, device, function)
+ bus_chipset_tag_t bc;
+ pci_chipset_tag_t pc;
+ int bus, device, function;
{
- pci_conftag_t tag;
- pci_confreg_t id, class;
+ pcitag_t tag;
+ pcireg_t id, class;
+ int match, nmatch;
+ void (*fn) __P((bus_chipset_tag_t, pci_chipset_tag_t, int, int, int));
- tag = PCI_MAKE_TAG(bus, device, function);
- id = PCI_CONF_READ(pcf, pcfa, tag, PCI_ID_REG);
+ tag = pci_make_tag(pc, bus, device, function);
+ id = pci_conf_read(pc, tag, PCI_ID_REG);
if (id == 0 || id == 0xffffffff)
panic("pci_display_console: no device at %d/%d/%d",
bus, device, function);
- class = PCI_CONF_READ(pcf, pcfa, tag, PCI_CLASS_REG);
+ class = pci_conf_read(pc, tag, PCI_CLASS_REG);
+
+ match = 0;
+ fn = NULL;
#if NPCIVGA
- if (DEVICE_IS_PCIVGA(class, id)) {
- pcivga_console(pcf, pcfa, pmf, pmfa, ppf, ppfa, bus,
- device, function);
- return;
+ nmatch = DEVICE_IS_PCIVGA(class, id);
+ if (nmatch > match) {
+ match = nmatch;
+ fn = pcivga_console;
}
#endif
-
#if NTGA
- if (DEVICE_IS_TGA(class, id)) {
- tga_console(pcf, pcfa, pmf, pmfa, ppf, ppfa, bus,
- device, function);
- return;
+ nmatch = DEVICE_IS_TGA(class, id);
+ if (nmatch > match) {
+ match = nmatch;
+ fn = tga_console;
}
#endif
- panic("pci_display_console: unconfigured device at %d/%d/%d",
+ if (fn != NULL)
+ (*fn)(bc, pc, bus, device, function);
+ else
+ panic("pci_display_console: unconfigured device at %d/%d/%d",
bus, device, function);
}
diff --git a/sys/arch/alpha/pci/pci_machdep.h b/sys/arch/alpha/pci/pci_machdep.h
new file mode 100644
index 00000000000..1a4c5074fcb
--- /dev/null
+++ b/sys/arch/alpha/pci/pci_machdep.h
@@ -0,0 +1,87 @@
+/* $NetBSD: pci_machdep.h,v 1.4 1996/04/12 06:08:52 cgd Exp $ */
+
+/*
+ * Copyright (c) 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+/*
+ * Machine-specific definitions for PCI autoconfiguration.
+ */
+
+/*
+ * Types provided to machine-independent PCI code
+ */
+typedef struct alpha_pci_chipset *pci_chipset_tag_t;
+typedef u_long pcitag_t;
+typedef u_long pci_intr_handle_t;
+
+/*
+ * alpha-specific PCI structure and type definitions.
+ * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
+ */
+struct alpha_pci_chipset {
+ void *pc_conf_v;
+ void (*pc_attach_hook) __P((struct device *,
+ struct device *, struct pcibus_attach_args *));
+ int (*pc_bus_maxdevs) __P((void *, int));
+ pcitag_t (*pc_make_tag) __P((void *, int, int, int));
+ void (*pc_decompose_tag) __P((void *, pcitag_t, int *,
+ int *, int *));
+ pcireg_t (*pc_conf_read) __P((void *, pcitag_t, int));
+ void (*pc_conf_write) __P((void *, pcitag_t, int, pcireg_t));
+
+ void *pc_intr_v;
+ int (*pc_intr_map) __P((void *, pcitag_t, int, int,
+ pci_intr_handle_t *));
+ const char *(*pc_intr_string) __P((void *, pci_intr_handle_t));
+ void *(*pc_intr_establish) __P((void *, pci_intr_handle_t,
+ int, int (*)(void *), void *));
+ void (*pc_intr_disestablish) __P((void *, void *));
+};
+
+/*
+ * Functions provided to machine-independent PCI code.
+ */
+#define pci_attach_hook(p, s, pba) \
+ (*(pba)->pba_pc->pc_attach_hook)((p), (s), (pba))
+#define pci_bus_maxdevs(c, b) \
+ (*(c)->pc_bus_maxdevs)((c)->pc_conf_v, (b))
+#define pci_make_tag(c, b, d, f) \
+ (*(c)->pc_make_tag)((c)->pc_conf_v, (b), (d), (f))
+#define pci_decompose_tag(c, t, bp, dp, fp) \
+ (*(c)->pc_decompose_tag)((c)->pc_conf_v, (t), (bp), (dp), (fp))
+#define pci_conf_read(c, t, r) \
+ (*(c)->pc_conf_read)((c)->pc_conf_v, (t), (r))
+#define pci_conf_write(c, t, r, v) \
+ (*(c)->pc_conf_write)((c)->pc_conf_v, (t), (r), (v))
+#define pci_intr_map(c, it, ip, il, ihp) \
+ (*(c)->pc_intr_map)((c)->pc_intr_v, (it), (ip), (il), (ihp))
+#define pci_intr_string(c, ih) \
+ (*(c)->pc_intr_string)((c)->pc_intr_v, (ih))
+#define pci_intr_establish(c, ih, l, h, a) \
+ (*(c)->pc_intr_establish)((c)->pc_intr_v, (ih), (l), (h), (a))
+#define pci_intr_disestablish(c, iv) \
+ (*(c)->pc_intr_disestablish)((c)->pc_intr_v, (iv))
diff --git a/sys/arch/alpha/pci/pcivga.c b/sys/arch/alpha/pci/pcivga.c
index 5f62ab3fa73..96c3cfdadf9 100644
--- a/sys/arch/alpha/pci/pcivga.c
+++ b/sys/arch/alpha/pci/pcivga.c
@@ -1,7 +1,7 @@
-/* $NetBSD: pcivga.c,v 1.4 1995/12/24 02:29:47 mycroft Exp $ */
+/* $NetBSD: pcivga.c,v 1.8 1996/04/17 21:49:58 cgd Exp $ */
/*
- * Copyright (c) 1995 Carnegie-Mellon University.
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -36,39 +36,41 @@
#include <machine/autoconf.h>
#include <machine/pte.h>
-#include <dev/pseudo/ansicons.h>
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
#include <dev/pci/pcidevs.h>
#include <alpha/pci/pcivgavar.h>
-#include <alpha/pci/wsconsvar.h>
+#include <alpha/wscons/wsconsvar.h>
+
+#define PCIVGA_6845_ADDR 0x24
+#define PCIVGA_6845_DATA 0x25
int pcivgamatch __P((struct device *, void *, void *));
void pcivgaattach __P((struct device *, struct device *, void *));
+int pcivgaprint __P((void *, char *));
+
+struct cfattach pcivga_ca = {
+ sizeof(struct pcivga_softc), pcivgamatch, pcivgaattach,
+};
-struct cfdriver pcivgacd = {
- NULL, "pcivga", pcivgamatch, pcivgaattach, DV_DULL,
- sizeof(struct pcivga_softc)
+struct cfdriver pcivga_cd = {
+ NULL, "pcivga", DV_DULL,
};
-void pcivga_getdevconfig __P((__const struct pci_conf_fns *, void *,
- __const struct pci_mem_fns *, void *,
- __const struct pci_pio_fns *, void *,
- pci_conftag_t tag, struct pcivga_devconfig *dc));
+void pcivga_getdevconfig __P((bus_chipset_tag_t, pci_chipset_tag_t,
+ pcitag_t, struct pcivga_devconfig *dc));
struct pcivga_devconfig pcivga_console_dc;
-void pcivga_cursor __P((void *, int, int));
+void pcivga_cursor __P((void *, int, int, int));
void pcivga_putstr __P((void *, int, int, char *, int));
void pcivga_copycols __P((void *, int, int, int,int));
void pcivga_erasecols __P((void *, int, int, int));
void pcivga_copyrows __P((void *, int, int, int));
void pcivga_eraserows __P((void *, int, int));
-void pcivga_bell __P((void *)); /* XXX */
-struct ansicons_functions pcivga_acf = {
- pcivga_bell,
+struct wscons_emulfuncs pcivga_emulfuncs = {
pcivga_cursor,
pcivga_putstr,
pcivga_copycols,
@@ -77,7 +79,9 @@ struct ansicons_functions pcivga_acf = {
pcivga_eraserows,
};
-#define PCIVGAUNIT(dev) minor(dev)
+int pcivgaioctl __P((struct device *, u_long, caddr_t, int,
+ struct proc *));
+int pcivgammap __P((struct device *, off_t, int));
int
pcivgamatch(parent, match, aux)
@@ -85,55 +89,71 @@ pcivgamatch(parent, match, aux)
void *match, *aux;
{
struct cfdata *cf = match;
- struct pcidev_attach_args *pda = aux;
+ struct pci_attach_args *pa = aux;
/*
* If it's prehistoric/vga or display/vga, we match.
*/
- if (PCI_CLASS(pda->pda_class) == PCI_CLASS_PREHISTORIC &&
- PCI_SUBCLASS(pda->pda_class) == PCI_SUBCLASS_PREHISTORIC_VGA)
+ if (PCI_CLASS(pa->pa_class) == PCI_CLASS_PREHISTORIC &&
+ PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_PREHISTORIC_VGA)
return (1);
- if (PCI_CLASS(pda->pda_class) == PCI_CLASS_DISPLAY &&
- PCI_SUBCLASS(pda->pda_class) == PCI_SUBCLASS_DISPLAY_VGA)
+ if (PCI_CLASS(pa->pa_class) == PCI_CLASS_DISPLAY &&
+ PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_DISPLAY_VGA)
return (1);
return (0);
}
void
-pcivga_getdevconfig(pcf, pcfa, pmf, pmfa, ppf, ppfa, tag, dc)
- __const struct pci_conf_fns *pcf;
- __const struct pci_mem_fns *pmf;
- __const struct pci_pio_fns *ppf;
- void *pcfa, *pmfa, *ppfa;
- pci_conftag_t tag;
+pcivga_getdevconfig(bc, pc, tag, dc)
+ bus_chipset_tag_t bc;
+ pci_chipset_tag_t pc;
+ pcitag_t tag;
struct pcivga_devconfig *dc;
{
+ bus_io_handle_t ioh;
+ int cpos;
- dc->dc_pcf = pcf;
- dc->dc_pcfa = pcfa;
- dc->dc_pmf = pmf;
- dc->dc_pmfa = pmfa;
- dc->dc_ppf = ppf;
- dc->dc_ppfa = ppfa;
+ dc->dc_bc = bc;
+ dc->dc_pc = pc;
dc->dc_pcitag = tag;
/* XXX deal with mapping foo */
- /* XXX */
- dc->dc_crtat = (u_short *)PCI_MEM_MAP(pmf, pmfa, 0xb8000, 0x8000, 1);
- dc->dc_iobase = 0x3d4; /* XXX */
+ if (bus_mem_map(bc, 0xb8000, 0x8000, 0, &dc->dc_memh))
+ panic("pcivga_getdevconfig: couldn't map memory");
+ if (bus_io_map(bc, 0x3b0, 0x30, &ioh))
+ panic("pcivga_getdevconfig: couldn't map io");
+ dc->dc_ioh = ioh;
dc->dc_nrow = 25;
dc->dc_ncol = 80;
+
dc->dc_ccol = dc->dc_crow = 0;
+ bus_io_write_1(bc, ioh, PCIVGA_6845_ADDR, 14);
+ cpos = bus_io_read_1(bc, ioh, PCIVGA_6845_DATA) << 8;
+ bus_io_write_1(bc, ioh, PCIVGA_6845_ADDR, 15);
+ cpos |= bus_io_read_1(bc, ioh, PCIVGA_6845_DATA);
+
+ dc->dc_crow = cpos / dc->dc_ncol;
+ dc->dc_ccol = cpos % dc->dc_ncol;
+
dc->dc_so = 0;
+#if 0
dc->dc_at = 0x00 | 0xf; /* black bg | white fg */
dc->dc_so_at = 0x00 | 0xf | 0x80; /* black bg | white fg | blink */
/* clear screen, frob cursor, etc.? */
pcivga_eraserows(dc, 0, dc->dc_nrow);
+#endif
+ /*
+ * XXX DEC HAS SWITCHED THE CODES FOR BLUE AND RED!!!
+ * XXX Therefore, though the comments say "blue bg", the code uses
+ * XXX the value for a red background!
+ */
+ dc->dc_at = 0x40 | 0x0f; /* blue bg | white fg */
+ dc->dc_so_at = 0x40 | 0x0f | 0x80; /* blue bg | white fg | blink */
}
void
@@ -141,29 +161,26 @@ pcivgaattach(parent, self, aux)
struct device *parent, *self;
void *aux;
{
- struct pcidev_attach_args *pda = aux;
+ struct pci_attach_args *pa = aux;
struct pcivga_softc *sc = (struct pcivga_softc *)self;
+ struct wscons_attach_args waa;
+ struct wscons_odev_spec *wo;
char devinfo[256];
int console;
- console = (pda->pda_tag == pcivga_console_dc.dc_pcitag);
+ console = (pa->pa_tag == pcivga_console_dc.dc_pcitag);
if (console)
sc->sc_dc = &pcivga_console_dc;
else {
sc->sc_dc = (struct pcivga_devconfig *)
malloc(sizeof(struct pcivga_devconfig), M_DEVBUF, M_WAITOK);
- pcivga_getdevconfig(pda->pda_conffns, pda->pda_confarg,
- pda->pda_memfns, pda->pda_memarg, pda->pda_piofns,
- pda->pda_memarg, pda->pda_tag, sc->sc_dc);
- }
- if (sc->sc_dc->dc_crtat == NULL) {
- printf(": couldn't map memory space; punt!\n");
- return;
+ pcivga_getdevconfig(pa->pa_bc, pa->pa_pc, pa->pa_tag,
+ sc->sc_dc);
}
- pci_devinfo(pda->pda_id, pda->pda_class, 0, devinfo);
+ pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo);
printf(": %s (rev. 0x%02x)\n", devinfo,
- PCI_REVISION(pda->pda_class));
+ PCI_REVISION(pa->pa_class));
#if 0
if (sc->sc_dc->dc_tgaconf == NULL) {
@@ -180,94 +197,120 @@ pcivgaattach(parent, self, aux)
#if 0
pci_intrdata = pci_conf_read(sc->sc_pcitag, PCI_INTERRUPT_REG);
if (PCI_INTERRUPT_PIN(pci_intrdata) != PCI_INTERRUPT_PIN_NONE) {
- sc->sc_intr = pci_map_int(sc->sc_pcitag, IPL_TTY, tgaintr, sc,
- sc->sc_dev.dv_xname);
+ sc->sc_intr = pci_map_int(sc->sc_pcitag, IPL_TTY, tgaintr, sc);
if (sc->sc_intr == NULL)
printf("%s: WARNING: couldn't map interrupt\n",
sc->sc_dev.dv_xname);
}
#endif
- if (!wscattach_output(self, console, &sc->sc_dc->dc_ansicons,
- &pcivga_acf, sc->sc_dc, sc->sc_dc->dc_nrow, sc->sc_dc->dc_ncol,
- 0, 0)) {
- panic("pcivgaattach: wscattach failed");
- /* NOTREACHED */
- }
+ waa.waa_isconsole = console;
+ wo = &waa.waa_odev_spec;
+ wo->wo_ef = &pcivga_emulfuncs;
+ wo->wo_efa = sc->sc_dc;
+ wo->wo_nrows = sc->sc_dc->dc_nrow;
+ wo->wo_ncols = sc->sc_dc->dc_ncol;
+ wo->wo_crow = sc->sc_dc->dc_crow;
+ wo->wo_ccol = sc->sc_dc->dc_ccol;
+ wo->wo_ioctl = pcivgaioctl;
+ wo->wo_mmap = pcivgammap;
+
+ config_found(self, &waa, pcivgaprint);
}
-#if 0
int
-tgammap(dev, offset, nprot)
- dev_t dev;
- int offset;
- int nprot;
+pcivgaprint(aux, pnp)
+ void *aux;
+ char *pnp;
{
- struct pcivga_softc *sc = pcivgacd.cd_devs[TGAUNIT(dev)];
- if (offset > sc->sc_dc->dc_pcivgaconf->pcivgac_cspace_size)
- return -1;
- return alpha_btop(sc->sc_dc->dc_paddr + offset);
+ if (pnp)
+ printf("wscons at %s", pnp);
+ return (UNCONF);
}
+
+int
+pcivgaioctl(dev, cmd, data, flag, p)
+ struct device *dev;
+ u_long cmd;
+ caddr_t data;
+ int flag;
+ struct proc *p;
+{
+
+ return -1; /* XXX */
+}
+
+int
+pcivgammap(dev, offset, prot)
+ struct device *dev;
+ off_t offset;
+ int prot;
+{
+ struct pcivga_softc *sc = (struct pcivga_softc *)dev;
+ int rv;
+
+ rv = -1;
+#if 0 /* XXX */
+ if (offset >= 0 && offset < 0x100000) { /* 1MB */
+ /* Deal with mapping the VGA memory */
+ if (offset >= 0xb8000 && offset < 0xc0000) {
+ offset -= 0xb8000;
+ rv = alpha_btop(k0segtophys(sc->sc_dc->dc_crtat) +
+ offset);
+ }
+ } else {
+ /* XXX should do something with PCI memory */
+ rv = -1;
+ }
#endif
+ return rv;
+}
void
-pcivga_console(pcf, pcfa, pmf, pmfa, ppf, ppfa, bus, device, function)
- __const struct pci_conf_fns *pcf;
- __const struct pci_mem_fns *pmf;
- __const struct pci_pio_fns *ppf;
- void *pcfa, *pmfa, *ppfa;
- pci_bus_t bus;
- pci_device_t device;
- pci_function_t function;
+pcivga_console(bc, pc, bus, device, function)
+ bus_chipset_tag_t bc;
+ pci_chipset_tag_t pc;
+ int bus, device, function;
{
struct pcivga_devconfig *dcp = &pcivga_console_dc;
+ struct wscons_odev_spec wo;
- pcivga_getdevconfig(pcf, pcfa, pmf, pmfa, ppf, ppfa,
- PCI_MAKE_TAG(bus, device, function), dcp);
+ pcivga_getdevconfig(bc, pc,
+ pci_make_tag(pc, bus, device, function), dcp);
- /* sanity checks */
- if (dcp->dc_crtat == NULL)
- panic("pcivga_console(%d, %d): couldn't map memory space",
- device, function);
-#if 0
- if (dcp->dc_pcivgaconf == NULL)
- panic("pcivga_console(%d, %d): unknown board configuration",
- device, function);
-#endif
+ wo.wo_ef = &pcivga_emulfuncs;
+ wo.wo_efa = dcp;
+ wo.wo_nrows = dcp->dc_nrow;
+ wo.wo_ncols = dcp->dc_ncol;
+ wo.wo_crow = dcp->dc_crow;
+ wo.wo_ccol = dcp->dc_ccol;
+ /* ioctl and mmap are unused until real attachment. */
- wsc_console(&dcp->dc_ansicons, &pcivga_acf, dcp,
- dcp->dc_nrow, dcp->dc_ncol, 0, 0);
+ wscons_attach_console(&wo);
}
/*
* The following functions implement the MI ANSI terminal emulation on
* a VGA display.
*/
-void /* XXX */
-pcivga_bell(id) /* XXX */
- void *id; /* XXX */
-{ /* XXX */
- /* XXX */
- printf("pcivga_bell: unimplemented\n"); /* XXX */
-} /* XXX */
-
void
-pcivga_cursor(id, row, col)
+pcivga_cursor(id, on, row, col)
void *id;
- int row, col;
+ int on, row, col;
{
struct pcivga_devconfig *dc = id;
+ bus_chipset_tag_t bc = dc->dc_bc;
+ bus_io_handle_t ioh = dc->dc_ioh;
int pos;
#if 0
printf("pcivga_cursor: %d %d\n", row, col);
#endif
/* turn the cursor off */
- if (row == -1 || col == -1) {
- dc->dc_crow = dc->dc_ccol = PCIVGA_CURSOR_OFF;
-
- /* XXX disable cursor??? */
+ if (!on) {
+ /* XXX disable cursor how??? */
+ dc->dc_crow = dc->dc_ccol = -1;
} else {
dc->dc_crow = row;
dc->dc_ccol = col;
@@ -275,10 +318,10 @@ pcivga_cursor(id, row, col)
pos = row * dc->dc_ncol + col;
- OUTB(dc->dc_ppf, dc->dc_ppfa, dc->dc_iobase, 14);
- OUTB(dc->dc_ppf, dc->dc_ppfa, dc->dc_iobase+1, pos >> 8);
- OUTB(dc->dc_ppf, dc->dc_ppfa, dc->dc_iobase, 15);
- OUTB(dc->dc_ppf, dc->dc_ppfa, dc->dc_iobase+1, pos);
+ bus_io_write_1(bc, ioh, PCIVGA_6845_ADDR, 14);
+ bus_io_write_1(bc, ioh, PCIVGA_6845_DATA, pos >> 8);
+ bus_io_write_1(bc, ioh, PCIVGA_6845_ADDR, 15);
+ bus_io_write_1(bc, ioh, PCIVGA_6845_DATA, pos);
}
void
@@ -289,20 +332,16 @@ pcivga_putstr(id, row, col, cp, len)
int len;
{
struct pcivga_devconfig *dc = id;
+ bus_chipset_tag_t bc = dc->dc_bc;
+ bus_mem_handle_t memh = dc->dc_memh;
char *dcp;
- int i;
+ int i, off;
- for (i = 0; i < len; i++, cp++) {
- dcp = (char *)&dc->dc_crtat[row * dc->dc_ncol + col];
-#if 0
-printf("*cp = %c, attr = 0x%x\n", *cp, dc->dc_so ? dc->dc_so_at : dc->dc_at);
-printf("was: %c/", *dcp);
-#endif
- *dcp++ = *cp;
-#if 0
-printf("0x%x\n", *dcp);
-#endif
- *dcp++ = dc->dc_so ? dc->dc_so_at : dc->dc_at;
+ off = (row * dc->dc_ncol + col) * 2;
+ for (i = 0; i < len; i++, cp++, off += 2) {
+ bus_mem_write_1(bc, memh, off, *cp);
+ bus_mem_write_1(bc, memh, off + 1,
+ dc->dc_so ? dc->dc_so_at : dc->dc_at);
}
}
@@ -312,16 +351,20 @@ pcivga_copycols(id, row, srccol, dstcol, ncols)
int row, srccol, dstcol, ncols;
{
struct pcivga_devconfig *dc = id;
- u_short *ssp, *dsp;
- int nclr;
+ bus_chipset_tag_t bc = dc->dc_bc;
+ bus_mem_handle_t memh = dc->dc_memh;
+ bus_mem_size_t srcoff, srcend, dstoff;
-#if 0
- printf("pcivga_copycols: row %d: %d, %d -> %d\n", row, srccol, ncols,
- dstcol);
-#endif
- ssp = &dc->dc_crtat[row * dc->dc_ncol + srccol];
- dsp = &dc->dc_crtat[row * dc->dc_ncol + dstcol];
- bcopy(ssp, dsp, ncols * sizeof(u_short));
+ /*
+ * YUCK. Need bus copy functions.
+ */
+ srcoff = (row * dc->dc_ncol + srccol) * 2;
+ srcend = srcoff + ncols * 2;
+ dstoff = (row * dc->dc_ncol + dstcol) * 2;
+
+ for (; srcoff < srcend; srcoff += 2, dstoff += 2)
+ bus_mem_write_2(bc, memh, dstoff,
+ bus_mem_read_2(bc, memh, srcoff));
}
void
@@ -330,15 +373,20 @@ pcivga_erasecols(id, row, startcol, ncols)
int row, startcol, ncols;
{
struct pcivga_devconfig *dc = id;
- u_short *ssp;
- int i;
+ bus_chipset_tag_t bc = dc->dc_bc;
+ bus_mem_handle_t memh = dc->dc_memh;
+ bus_mem_size_t off, endoff;
+ u_int16_t val;
-#if 0
- printf("pcivga_erasecols: row %d: %d, %d\n", row, startcol, ncols);
-#endif
- ssp = &dc->dc_crtat[row * dc->dc_ncol + startcol];
- for (i = 0; i < ncols; i++)
- *ssp++ = (dc->dc_at << 8) | ' ';
+ /*
+ * YUCK. Need bus 'set' functions.
+ */
+ off = (row * dc->dc_ncol + startcol) * 2;
+ endoff = off + ncols * 2;
+ val = (dc->dc_at << 8) | ' ';
+
+ for (; off < endoff; off += 2)
+ bus_mem_write_2(bc, memh, off, val);
}
void
@@ -347,15 +395,20 @@ pcivga_copyrows(id, srcrow, dstrow, nrows)
int srcrow, dstrow, nrows;
{
struct pcivga_devconfig *dc = id;
- u_short *ssp, *dsp;
- int nclr;
+ bus_chipset_tag_t bc = dc->dc_bc;
+ bus_mem_handle_t memh = dc->dc_memh;
+ bus_mem_size_t srcoff, srcend, dstoff;
-#if 0
- printf("pcivga_copyrows: %d, %d -> %d\n", srcrow, nrows, dstrow);
-#endif
- ssp = &dc->dc_crtat[srcrow * dc->dc_ncol + 0];
- dsp = &dc->dc_crtat[dstrow * dc->dc_ncol + 0];
- bcopy(ssp, dsp, nrows * dc->dc_ncol * sizeof(u_short));
+ /*
+ * YUCK. Need bus copy functions.
+ */
+ srcoff = (srcrow * dc->dc_ncol + 0) * 2;
+ srcend = srcoff + (nrows * dc->dc_ncol * 2);
+ dstoff = (dstrow * dc->dc_ncol + 0) * 2;
+
+ for (; srcoff < srcend; srcoff += 2, dstoff += 2)
+ bus_mem_write_2(bc, memh, dstoff,
+ bus_mem_read_2(bc, memh, srcoff));
}
void
@@ -364,13 +417,18 @@ pcivga_eraserows(id, startrow, nrows)
int startrow, nrows;
{
struct pcivga_devconfig *dc = id;
- u_short *ssp;
- int i;
+ bus_chipset_tag_t bc = dc->dc_bc;
+ bus_mem_handle_t memh = dc->dc_memh;
+ bus_mem_size_t off, endoff;
+ u_int16_t val;
-#if 0
- printf("pcivga_eraserows: %d, %d\n", startrow, nrows);
-#endif
- ssp = &dc->dc_crtat[startrow * dc->dc_ncol + 0];
- for (i = 0; i < nrows * dc->dc_ncol; i++)
- *ssp++ = (dc->dc_at << 8) | ' ';
+ /*
+ * YUCK. Need bus 'set' functions.
+ */
+ off = (startrow * dc->dc_ncol + 0) * 2;
+ endoff = off + (nrows * dc->dc_ncol) * 2;
+ val = (dc->dc_at << 8) | ' ';
+
+ for (; off < endoff; off += 2)
+ bus_mem_write_2(bc, memh, off, val);
}
diff --git a/sys/arch/alpha/pci/pcivgavar.h b/sys/arch/alpha/pci/pcivgavar.h
index 579ad4ca0a4..da42958de3f 100644
--- a/sys/arch/alpha/pci/pcivgavar.h
+++ b/sys/arch/alpha/pci/pcivgavar.h
@@ -1,7 +1,7 @@
-/* $NetBSD: pcivgavar.h,v 1.3 1995/11/23 02:38:13 cgd Exp $ */
+/* $NetBSD: pcivgavar.h,v 1.5 1996/04/12 06:08:58 cgd Exp $ */
/*
- * Copyright (c) 1995 Carnegie-Mellon University.
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -27,20 +27,14 @@
* rights to redistribute these changes.
*/
-#include <dev/pseudo/ansicons.h>
-
struct pcivga_devconfig {
- __const struct pci_conf_fns *dc_pcf;
- void *dc_pcfa;
- __const struct pci_mem_fns *dc_pmf;
- void *dc_pmfa;
- __const struct pci_pio_fns *dc_ppf;
- void *dc_ppfa;
+ bus_chipset_tag_t dc_bc;
+ pci_chipset_tag_t dc_pc;
- pci_tag_t dc_pcitag; /* PCI tag */
+ pcitag_t dc_pcitag; /* PCI tag */
- u_int16_t *dc_crtat; /* VGA screen memory */
- int dc_iobase; /* VGA I/O address */
+ bus_io_handle_t dc_ioh;
+ bus_mem_handle_t dc_memh;
int dc_ncol, dc_nrow; /* screen width & height */
int dc_ccol, dc_crow; /* current cursor position */
@@ -48,8 +42,6 @@ struct pcivga_devconfig {
char dc_so; /* in standout mode? */
char dc_at; /* normal attributes */
char dc_so_at; /* standout attributes */
-
- struct ansicons dc_ansicons; /* ansi console emulator info XXX */
};
struct pcivga_softc {
@@ -59,15 +51,11 @@ struct pcivga_softc {
void *sc_intr; /* interrupt handler info */
};
-#define PCIVGA_CURSOR_OFF -1 /* pass to pcivga_cpos to disable */
-
#define DEVICE_IS_PCIVGA(class, id) \
- ((PCI_CLASS(class) == PCI_CLASS_DISPLAY && \
+ (((PCI_CLASS(class) == PCI_CLASS_DISPLAY && \
PCI_SUBCLASS(class) == PCI_SUBCLASS_DISPLAY_VGA) || \
(PCI_CLASS(class) == PCI_CLASS_PREHISTORIC && \
- PCI_SUBCLASS(class) == PCI_SUBCLASS_PREHISTORIC_VGA))
+ PCI_SUBCLASS(class) == PCI_SUBCLASS_PREHISTORIC_VGA)) ? 1 : 0)
-void pcivga_console __P((__const struct pci_conf_fns *, void *,
- __const struct pci_mem_fns *, void *,
- __const struct pci_pio_fns *, void *,
- pci_bus_t, pci_device_t, pci_function_t));
+void pcivga_console __P((bus_chipset_tag_t, pci_chipset_tag_t, int, int,
+ int));
diff --git a/sys/arch/alpha/pci/pcs_bus_io_common.c b/sys/arch/alpha/pci/pcs_bus_io_common.c
new file mode 100644
index 00000000000..3d1e904467b
--- /dev/null
+++ b/sys/arch/alpha/pci/pcs_bus_io_common.c
@@ -0,0 +1,488 @@
+/* $NetBSD: pcs_bus_io_common.c,v 1.2.4.2 1996/06/13 18:16:59 cgd Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+/*
+ * Common PCI Chipset "bus I/O" functions, for chipsets which have to
+ * deal with only a single PCI interface chip in a machine.
+ *
+ * uses:
+ * CHIP name of the 'chip' it's being compiled for.
+ * CHIP_IO_BASE Sparse I/O space base to use.
+ */
+
+#define __C(A,B) __CONCAT(A,B)
+#define __S(S) __STRING(S)
+
+int __C(CHIP,_io_map) __P((void *, bus_io_addr_t, bus_io_size_t,
+ bus_io_handle_t *));
+void __C(CHIP,_io_unmap) __P((void *, bus_io_handle_t,
+ bus_io_size_t));
+int __C(CHIP,_io_subregion) __P((void *, bus_io_handle_t,
+ bus_io_size_t, bus_io_size_t, bus_io_handle_t *));
+u_int8_t __C(CHIP,_io_read_1) __P((void *, bus_io_handle_t,
+ bus_io_size_t));
+u_int16_t __C(CHIP,_io_read_2) __P((void *, bus_io_handle_t,
+ bus_io_size_t));
+u_int32_t __C(CHIP,_io_read_4) __P((void *, bus_io_handle_t,
+ bus_io_size_t));
+u_int64_t __C(CHIP,_io_read_8) __P((void *, bus_io_handle_t,
+ bus_io_size_t));
+void __C(CHIP,_io_read_multi_1) __P((void *, bus_io_handle_t,
+ bus_io_size_t, u_int8_t *, bus_io_size_t));
+void __C(CHIP,_io_read_multi_2) __P((void *, bus_io_handle_t,
+ bus_io_size_t, u_int16_t *, bus_io_size_t));
+void __C(CHIP,_io_read_multi_4) __P((void *, bus_io_handle_t,
+ bus_io_size_t, u_int32_t *, bus_io_size_t));
+void __C(CHIP,_io_read_multi_8) __P((void *, bus_io_handle_t,
+ bus_io_size_t, u_int64_t *, bus_io_size_t));
+void __C(CHIP,_io_write_1) __P((void *, bus_io_handle_t,
+ bus_io_size_t, u_int8_t));
+void __C(CHIP,_io_write_2) __P((void *, bus_io_handle_t,
+ bus_io_size_t, u_int16_t));
+void __C(CHIP,_io_write_4) __P((void *, bus_io_handle_t,
+ bus_io_size_t, u_int32_t));
+void __C(CHIP,_io_write_8) __P((void *, bus_io_handle_t,
+ bus_io_size_t, u_int64_t));
+void __C(CHIP,_io_write_multi_1) __P((void *, bus_io_handle_t,
+ bus_io_size_t, const u_int8_t *, bus_io_size_t));
+void __C(CHIP,_io_write_multi_2) __P((void *, bus_io_handle_t,
+ bus_io_size_t, const u_int16_t *, bus_io_size_t));
+void __C(CHIP,_io_write_multi_4) __P((void *, bus_io_handle_t,
+ bus_io_size_t, const u_int32_t *, bus_io_size_t));
+void __C(CHIP,_io_write_multi_8) __P((void *, bus_io_handle_t,
+ bus_io_size_t, const u_int64_t *, bus_io_size_t));
+
+void
+__C(CHIP,_bus_io_init)(bc, iov)
+ bus_chipset_tag_t bc;
+ void *iov;
+{
+
+ bc->bc_i_v = iov;
+
+ bc->bc_i_map = __C(CHIP,_io_map);
+ bc->bc_i_unmap = __C(CHIP,_io_unmap);
+ bc->bc_i_subregion = __C(CHIP,_io_subregion);
+
+ bc->bc_ir1 = __C(CHIP,_io_read_1);
+ bc->bc_ir2 = __C(CHIP,_io_read_2);
+ bc->bc_ir4 = __C(CHIP,_io_read_4);
+ bc->bc_ir8 = __C(CHIP,_io_read_8);
+
+ bc->bc_irm1 = __C(CHIP,_io_read_multi_1);
+ bc->bc_irm2 = __C(CHIP,_io_read_multi_2);
+ bc->bc_irm4 = __C(CHIP,_io_read_multi_4);
+ bc->bc_irm8 = __C(CHIP,_io_read_multi_8);
+
+ bc->bc_iw1 = __C(CHIP,_io_write_1);
+ bc->bc_iw2 = __C(CHIP,_io_write_2);
+ bc->bc_iw4 = __C(CHIP,_io_write_4);
+ bc->bc_iw8 = __C(CHIP,_io_write_8);
+
+ bc->bc_iwm1 = __C(CHIP,_io_write_multi_1);
+ bc->bc_iwm2 = __C(CHIP,_io_write_multi_2);
+ bc->bc_iwm4 = __C(CHIP,_io_write_multi_4);
+ bc->bc_iwm8 = __C(CHIP,_io_write_multi_8);
+}
+
+int
+__C(CHIP,_io_map)(v, ioaddr, iosize, iohp)
+ void *v;
+ bus_io_addr_t ioaddr;
+ bus_io_size_t iosize;
+ bus_io_handle_t *iohp;
+{
+
+#ifdef CHIP_IO_W1_START
+ if (ioaddr >= CHIP_IO_W1_START(v) &&
+ ioaddr <= CHIP_IO_W1_END(v)) {
+ *iohp = (phystok0seg(CHIP_IO_W1_BASE(v)) >> 5) +
+ (ioaddr & CHIP_IO_W1_MASK(v));
+ } else
+#endif
+#ifdef CHIP_IO_W2_START
+ if (ioaddr >= CHIP_IO_W2_START(v) &&
+ ioaddr <= CHIP_IO_W2_END(v)) {
+ *iohp = (phystok0seg(CHIP_IO_W2_BASE(v)) >> 5) +
+ (ioaddr & CHIP_IO_W2_MASK(v));
+ } else
+#endif
+ {
+ printf("\n");
+#ifdef CHIP_IO_W1_START
+ printf("%s: window[1]=0x%lx-0x%lx\n",
+ __S(__C(CHIP,_io_map)), CHIP_IO_W1_START(v),
+ CHIP_IO_W1_END(v)-1);
+#endif
+#ifdef CHIP_IO_W2_START
+ printf("%s: window[2]=0x%lx-0x%lx\n",
+ __S(__C(CHIP,_io_map)), CHIP_IO_W2_START(v),
+ CHIP_IO_W2_END(v)-1);
+#endif
+ panic("%s: don't know how to map %lx non-cacheable\n",
+ __S(__C(CHIP,_io_map)), ioaddr);
+ }
+
+ return (0);
+}
+
+void
+__C(CHIP,_io_unmap)(v, ioh, iosize)
+ void *v;
+ bus_io_handle_t ioh;
+ bus_io_size_t iosize;
+{
+
+ /* XXX nothing to do. */
+}
+
+int
+__C(CHIP,_io_subregion)(v, ioh, offset, size, nioh)
+ void *v;
+ bus_io_handle_t ioh, *nioh;
+ bus_io_size_t offset, size;
+{
+
+ *nioh = ioh + offset;
+ return (0);
+}
+
+u_int8_t
+__C(CHIP,_io_read_1)(v, ioh, off)
+ void *v;
+ bus_io_handle_t ioh;
+ bus_io_size_t off;
+{
+ register bus_io_handle_t tmpioh;
+ register u_int32_t *port, val;
+ register u_int8_t rval;
+ register int offset;
+
+ wbflush();
+
+ tmpioh = ioh + off;
+ offset = tmpioh & 3;
+ port = (u_int32_t *)((tmpioh << 5) | (0 << 3));
+ val = *port;
+ rval = ((val) >> (8 * offset)) & 0xff;
+
+ return rval;
+}
+
+u_int16_t
+__C(CHIP,_io_read_2)(v, ioh, off)
+ void *v;
+ bus_io_handle_t ioh;
+ bus_io_size_t off;
+{
+ register bus_io_handle_t tmpioh;
+ register u_int32_t *port, val;
+ register u_int16_t rval;
+ register int offset;
+
+ wbflush();
+
+ tmpioh = ioh + off;
+ offset = tmpioh & 3;
+ port = (u_int32_t *)((tmpioh << 5) | (1 << 3));
+ val = *port;
+ rval = ((val) >> (8 * offset)) & 0xffff;
+
+ return rval;
+}
+
+u_int32_t
+__C(CHIP,_io_read_4)(v, ioh, off)
+ void *v;
+ bus_io_handle_t ioh;
+ bus_io_size_t off;
+{
+ register bus_io_handle_t tmpioh;
+ register u_int32_t *port, val;
+ register u_int32_t rval;
+ register int offset;
+
+ wbflush();
+
+ tmpioh = ioh + off;
+ offset = tmpioh & 3;
+ port = (u_int32_t *)((tmpioh << 5) | (3 << 3));
+ val = *port;
+#if 0
+ rval = ((val) >> (8 * offset)) & 0xffffffff;
+#else
+ rval = val;
+#endif
+
+ return rval;
+}
+
+u_int64_t
+__C(CHIP,_io_read_8)(v, ioh, off)
+ void *v;
+ bus_io_handle_t ioh;
+ bus_io_size_t off;
+{
+
+ /* XXX XXX XXX */
+ panic("%s not implemented\n", __S(__C(CHIP,_io_read_8)));
+}
+
+void
+__C(CHIP,_io_read_multi_1)(v, ioh, off, addr, count)
+ void *v;
+ bus_io_handle_t ioh;
+ bus_io_size_t off, count;
+ u_int8_t *addr;
+{
+ register bus_io_handle_t tmpioh;
+ register u_int32_t *port, val;
+ register int offset;
+
+ wbflush();
+
+ while (count--) {
+ tmpioh = ioh + off;
+ offset = tmpioh & 3;
+ port = (u_int32_t *)((tmpioh << 5) | (0 << 3));
+ val = *port;
+ *addr++ = ((val) >> (8 * offset)) & 0xff;
+ off++;
+ }
+}
+
+void
+__C(CHIP,_io_read_multi_2)(v, ioh, off, addr, count)
+ void *v;
+ bus_io_handle_t ioh;
+ bus_io_size_t off, count;
+ u_int16_t *addr;
+{
+ register bus_io_handle_t tmpioh;
+ register u_int32_t *port, val;
+ register int offset;
+
+ wbflush();
+
+ while (count--) {
+ tmpioh = ioh + off;
+ offset = tmpioh & 3;
+ port = (u_int32_t *)((tmpioh << 5) | (1 << 3));
+ val = *port;
+ *addr++ = ((val) >> (8 * offset)) & 0xffff;
+ off++;
+ }
+}
+
+void
+__C(CHIP,_io_read_multi_4)(v, ioh, off, addr, count)
+ void *v;
+ bus_io_handle_t ioh;
+ bus_io_size_t off, count;
+ u_int32_t *addr;
+{
+ register bus_io_handle_t tmpioh;
+ register u_int32_t *port, val;
+ register int offset;
+
+ wbflush();
+
+ while (count--) {
+ tmpioh = ioh + off;
+ offset = tmpioh & 3;
+ port = (u_int32_t *)((tmpioh << 5) | (3 << 3));
+ val = *port;
+#if 0
+ *addr++ = ((val) >> (8 * offset)) & 0xffffffff;
+#else
+ *addr++ = val;
+#endif
+ off++;
+ }
+}
+
+void
+__C(CHIP,_io_read_multi_8)(v, ioh, off, addr, count)
+ void *v;
+ bus_io_handle_t ioh;
+ bus_io_size_t off, count;
+ u_int64_t *addr;
+{
+
+ /* XXX XXX XXX */
+ panic("%s not implemented\n", __S(__C(CHIP,_io_read_multi_8)));
+}
+
+void
+__C(CHIP,_io_write_1)(v, ioh, off, val)
+ void *v;
+ bus_io_handle_t ioh;
+ bus_io_size_t off;
+ u_int8_t val;
+{
+ register bus_io_handle_t tmpioh;
+ register u_int32_t *port, nval;
+ register int offset;
+
+ tmpioh = ioh + off;
+ offset = tmpioh & 3;
+ nval = val << (8 * offset);
+ port = (u_int32_t *)((tmpioh << 5) | (0 << 3));
+ *port = nval;
+ wbflush();
+}
+
+void
+__C(CHIP,_io_write_2)(v, ioh, off, val)
+ void *v;
+ bus_io_handle_t ioh;
+ bus_io_size_t off;
+ u_int16_t val;
+{
+ register bus_io_handle_t tmpioh;
+ register u_int32_t *port, nval;
+ register int offset;
+
+ tmpioh = ioh + off;
+ offset = tmpioh & 3;
+ nval = val << (8 * offset);
+ port = (u_int32_t *)((tmpioh << 5) | (1 << 3));
+ *port = nval;
+ wbflush();
+}
+
+void
+__C(CHIP,_io_write_4)(v, ioh, off, val)
+ void *v;
+ bus_io_handle_t ioh;
+ bus_io_size_t off;
+ u_int32_t val;
+{
+ register bus_io_handle_t tmpioh;
+ register u_int32_t *port, nval;
+ register int offset;
+
+ tmpioh = ioh + off;
+ offset = tmpioh & 3;
+ nval = val /*<< (8 * offset)*/;
+ port = (u_int32_t *)((tmpioh << 5) | (3 << 3));
+ *port = nval;
+ wbflush();
+}
+
+void
+__C(CHIP,_io_write_8)(v, ioh, off, val)
+ void *v;
+ bus_io_handle_t ioh;
+ bus_io_size_t off;
+ u_int64_t val;
+{
+
+ /* XXX XXX XXX */
+ panic("%s not implemented\n", __S(__C(CHIP,_io_write_8)));
+ wbflush();
+}
+
+void
+__C(CHIP,_io_write_multi_1)(v, ioh, off, addr, count)
+ void *v;
+ bus_io_handle_t ioh;
+ bus_io_size_t off, count;
+ const u_int8_t *addr;
+{
+ register bus_io_handle_t tmpioh;
+ register u_int32_t *port, nval;
+ register int offset;
+
+ while (count--) {
+ tmpioh = ioh + off;
+ offset = tmpioh & 3;
+ nval = (*addr++) << (8 * offset);
+ port = (u_int32_t *)((tmpioh << 5) | (0 << 3));
+ *port = nval;
+ off++;
+ }
+ wbflush();
+}
+
+void
+__C(CHIP,_io_write_multi_2)(v, ioh, off, addr, count)
+ void *v;
+ bus_io_handle_t ioh;
+ bus_io_size_t off, count;
+ const u_int16_t *addr;
+{
+ register bus_io_handle_t tmpioh;
+ register u_int32_t *port, nval;
+ register int offset;
+
+ while (count--) {
+ tmpioh = ioh + off;
+ offset = tmpioh & 3;
+ nval = (*addr++) << (8 * offset);
+ port = (u_int32_t *)((tmpioh << 5) | (1 << 3));
+ *port = nval;
+ off++;
+ }
+ wbflush();
+}
+
+void
+__C(CHIP,_io_write_multi_4)(v, ioh, off, addr, count)
+ void *v;
+ bus_io_handle_t ioh;
+ bus_io_size_t off, count;
+ const u_int32_t *addr;
+{
+ register bus_io_handle_t tmpioh;
+ register u_int32_t *port, nval;
+ register int offset;
+
+ while (count--) {
+ tmpioh = ioh + off;
+ offset = tmpioh & 3;
+ nval = (*addr++) /*<< (8 * offset)*/;
+ port = (u_int32_t *)((tmpioh << 5) | (3 << 3));
+ *port = nval;
+ off++;
+ }
+ wbflush();
+}
+
+void
+__C(CHIP,_io_write_multi_8)(v, ioh, off, addr, count)
+ void *v;
+ bus_io_handle_t ioh;
+ bus_io_size_t off, count;
+ const u_int64_t *addr;
+{
+
+ /* XXX XXX XXX */
+ panic("%s not implemented\n", __S(__C(CHIP,_io_write_multi_8)));
+}
diff --git a/sys/arch/alpha/pci/pcs_bus_mem_common.c b/sys/arch/alpha/pci/pcs_bus_mem_common.c
new file mode 100644
index 00000000000..3697a497a15
--- /dev/null
+++ b/sys/arch/alpha/pci/pcs_bus_mem_common.c
@@ -0,0 +1,378 @@
+/* $NetBSD: pcs_bus_mem_common.c,v 1.1.4.4 1996/06/13 18:17:01 cgd Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+/*
+ * Common PCI Chipset "bus I/O" functions, for chipsets which have to
+ * deal with only a single PCI interface chip in a machine.
+ *
+ * uses:
+ * CHIP name of the 'chip' it's being compiled for.
+ * CHIP_D_MEM_BASE Dense Mem space base to use.
+ * CHIP_S_MEM_BASE Sparse Mem space base to use.
+ */
+
+#define __C(A,B) __CONCAT(A,B)
+#define __S(S) __STRING(S)
+
+int __C(CHIP,_mem_map) __P((void *, bus_mem_addr_t, bus_mem_size_t,
+ int, bus_mem_handle_t *));
+void __C(CHIP,_mem_unmap) __P((void *, bus_mem_handle_t,
+ bus_mem_size_t));
+int __C(CHIP,_mem_subregion) __P((void *, bus_mem_handle_t,
+ bus_mem_size_t, bus_mem_size_t, bus_mem_handle_t *));
+u_int8_t __C(CHIP,_mem_read_1) __P((void *, bus_mem_handle_t,
+ bus_mem_size_t));
+u_int16_t __C(CHIP,_mem_read_2) __P((void *, bus_mem_handle_t,
+ bus_mem_size_t));
+u_int32_t __C(CHIP,_mem_read_4) __P((void *, bus_mem_handle_t,
+ bus_mem_size_t));
+u_int64_t __C(CHIP,_mem_read_8) __P((void *, bus_mem_handle_t,
+ bus_mem_size_t));
+void __C(CHIP,_mem_write_1) __P((void *, bus_mem_handle_t,
+ bus_mem_size_t, u_int8_t));
+void __C(CHIP,_mem_write_2) __P((void *, bus_mem_handle_t,
+ bus_mem_size_t, u_int16_t));
+void __C(CHIP,_mem_write_4) __P((void *, bus_mem_handle_t,
+ bus_mem_size_t, u_int32_t));
+void __C(CHIP,_mem_write_8) __P((void *, bus_mem_handle_t,
+ bus_mem_size_t, u_int64_t));
+
+/* XXX DOES NOT BELONG */
+vm_offset_t __C(CHIP,_XXX_dmamap) __P((void *));
+
+void
+__C(CHIP,_bus_mem_init)(bc, memv)
+ bus_chipset_tag_t bc;
+ void *memv;
+{
+
+ bc->bc_m_v = memv;
+
+ bc->bc_m_map = __C(CHIP,_mem_map);
+ bc->bc_m_unmap = __C(CHIP,_mem_unmap);
+ bc->bc_m_subregion = __C(CHIP,_mem_subregion);
+
+ bc->bc_mr1 = __C(CHIP,_mem_read_1);
+ bc->bc_mr2 = __C(CHIP,_mem_read_2);
+ bc->bc_mr4 = __C(CHIP,_mem_read_4);
+ bc->bc_mr8 = __C(CHIP,_mem_read_8);
+
+ bc->bc_mw1 = __C(CHIP,_mem_write_1);
+ bc->bc_mw2 = __C(CHIP,_mem_write_2);
+ bc->bc_mw4 = __C(CHIP,_mem_write_4);
+ bc->bc_mw8 = __C(CHIP,_mem_write_8);
+
+ /* XXX DOES NOT BELONG */
+ bc->bc_XXX_dmamap = __C(CHIP,_XXX_dmamap);
+}
+
+int
+__C(CHIP,_mem_map)(v, memaddr, memsize, cacheable, memhp)
+ void *v;
+ bus_mem_addr_t memaddr;
+ bus_mem_size_t memsize;
+ int cacheable;
+ bus_mem_handle_t *memhp;
+{
+
+ if (cacheable) {
+#ifdef CHIP_D_MEM_W1_START
+ if (memaddr >= CHIP_D_MEM_W1_START(v) &&
+ memaddr <= CHIP_D_MEM_W1_END(v)) {
+ *memhp = phystok0seg(CHIP_D_MEM_W1_BASE(v)) +
+ (memaddr & CHIP_D_MEM_W1_MASK(v));
+ } else
+#endif
+ {
+ printf("\n");
+#ifdef CHIP_D_MEM_W1_START
+ printf("%s: window[1]=0x%lx-0x%lx\n",
+ __S(__C(CHIP,_mem_map)), CHIP_D_MEM_W1_START(v),
+ CHIP_D_MEM_W1_END(v)-1);
+#endif
+ panic("%s: don't know how to map %lx cacheable\n",
+ __S(__C(CHIP,_mem_map)), memaddr);
+ }
+ } else {
+#ifdef CHIP_S_MEM_W1_START
+ if (memaddr >= CHIP_S_MEM_W1_START(v) &&
+ memaddr <= CHIP_S_MEM_W1_END(v)) {
+ *memhp = (phystok0seg(CHIP_S_MEM_W1_BASE(v)) >> 5) +
+ (memaddr & CHIP_S_MEM_W1_MASK(v));
+ } else
+#endif
+#ifdef CHIP_S_MEM_W2_START
+ if (memaddr >= CHIP_S_MEM_W2_START(v) &&
+ memaddr <= CHIP_S_MEM_W2_END(v)) {
+ *memhp = (phystok0seg(CHIP_S_MEM_W2_BASE(v)) >> 5) +
+ (memaddr & CHIP_S_MEM_W2_MASK(v));
+ } else
+#endif
+#ifdef CHIP_S_MEM_W3_START
+ if (memaddr >= CHIP_S_MEM_W3_START(v) &&
+ memaddr <= CHIP_S_MEM_W3_END(v)) {
+ *memhp = (phystok0seg(CHIP_S_MEM_W3_BASE(v)) >> 5) +
+ (memaddr & CHIP_S_MEM_W3_MASK(v));
+ } else
+#endif
+ {
+ printf("\n");
+#ifdef CHIP_S_MEM_W1_START
+ printf("%s: window[1]=0x%lx-0x%lx\n",
+ __S(__C(CHIP,_mem_map)), CHIP_S_MEM_W1_START(v),
+ CHIP_S_MEM_W1_END(v)-1);
+#endif
+#ifdef CHIP_S_MEM_W2_START
+ printf("%s: window[2]=0x%lx-0x%lx\n",
+ __S(__C(CHIP,_mem_map)), CHIP_S_MEM_W2_START(v),
+ CHIP_S_MEM_W2_END(v)-1);
+#endif
+#ifdef CHIP_S_MEM_W3_START
+ printf("%s: window[3]=0x%lx-0x%lx\n",
+ __S(__C(CHIP,_mem_map)), CHIP_S_MEM_W3_START(v),
+ CHIP_S_MEM_W3_END(v)-1);
+#endif
+ panic("%s: don't know how to map %lx non-cacheable\n",
+ __S(__C(CHIP,_mem_map)), memaddr);
+ }
+ }
+
+ return (0);
+}
+
+void
+__C(CHIP,_mem_unmap)(v, memh, memsize)
+ void *v;
+ bus_mem_handle_t memh;
+ bus_mem_size_t memsize;
+{
+
+ /* XXX nothing to do. */
+}
+
+int
+__C(CHIP,_mem_subregion)(v, memh, offset, size, nmemh)
+ void *v;
+ bus_mem_handle_t memh, *nmemh;
+ bus_mem_size_t offset, size;
+{
+
+ *nmemh = memh + offset;
+ return (0);
+}
+
+u_int8_t
+__C(CHIP,_mem_read_1)(v, memh, off)
+ void *v;
+ bus_mem_handle_t memh;
+ bus_mem_size_t off;
+{
+ register bus_mem_handle_t tmpmemh;
+ register u_int32_t *port, val;
+ register u_int8_t rval;
+ register int offset;
+
+ wbflush();
+
+ if ((memh >> 63) != 0)
+ return (*(u_int8_t *)(memh + off));
+
+ tmpmemh = memh + off;
+ offset = tmpmemh & 3;
+ port = (u_int32_t *)((tmpmemh << 5) | (0 << 3));
+ val = *port;
+ rval = ((val) >> (8 * offset)) & 0xff;
+
+ return rval;
+}
+
+u_int16_t
+__C(CHIP,_mem_read_2)(v, memh, off)
+ void *v;
+ bus_mem_handle_t memh;
+ bus_mem_size_t off;
+{
+ register bus_mem_handle_t tmpmemh;
+ register u_int32_t *port, val;
+ register u_int16_t rval;
+ register int offset;
+
+ wbflush();
+
+ if ((memh >> 63) != 0)
+ return (*(u_int16_t *)(memh + off));
+
+ tmpmemh = memh + off;
+ offset = tmpmemh & 3;
+ port = (u_int32_t *)((tmpmemh << 5) | (1 << 3));
+ val = *port;
+ rval = ((val) >> (8 * offset)) & 0xffff;
+
+ return rval;
+}
+
+u_int32_t
+__C(CHIP,_mem_read_4)(v, memh, off)
+ void *v;
+ bus_mem_handle_t memh;
+ bus_mem_size_t off;
+{
+ register bus_mem_handle_t tmpmemh;
+ register u_int32_t *port, val;
+ register u_int32_t rval;
+ register int offset;
+
+ wbflush();
+
+ if ((memh >> 63) != 0)
+ return (*(u_int32_t *)(memh + off));
+
+ tmpmemh = memh + off;
+ offset = tmpmemh & 3;
+ port = (u_int32_t *)((tmpmemh << 5) | (3 << 3));
+ val = *port;
+#if 0
+ rval = ((val) >> (8 * offset)) & 0xffffffff;
+#else
+ rval = val;
+#endif
+
+ return rval;
+}
+
+u_int64_t
+__C(CHIP,_mem_read_8)(v, memh, off)
+ void *v;
+ bus_mem_handle_t memh;
+ bus_mem_size_t off;
+{
+
+ wbflush();
+
+ if ((memh >> 63) != 0)
+ return (*(u_int64_t *)(memh + off));
+
+ /* XXX XXX XXX */
+ panic("%s not implemented\n", __S(__C(CHIP,_mem_read_8)));
+}
+
+void
+__C(CHIP,_mem_write_1)(v, memh, off, val)
+ void *v;
+ bus_mem_handle_t memh;
+ bus_mem_size_t off;
+ u_int8_t val;
+{
+ register bus_mem_handle_t tmpmemh;
+ register u_int32_t *port, nval;
+ register int offset;
+
+ if ((memh >> 63) != 0)
+ (*(u_int8_t *)(memh + off)) = val;
+ else {
+ tmpmemh = memh + off;
+ offset = tmpmemh & 3;
+ nval = val << (8 * offset);
+ port = (u_int32_t *)((tmpmemh << 5) | (0 << 3));
+ *port = nval;
+ }
+ wbflush();
+}
+
+void
+__C(CHIP,_mem_write_2)(v, memh, off, val)
+ void *v;
+ bus_mem_handle_t memh;
+ bus_mem_size_t off;
+ u_int16_t val;
+{
+ register bus_mem_handle_t tmpmemh;
+ register u_int32_t *port, nval;
+ register int offset;
+
+ if ((memh >> 63) != 0)
+ (*(u_int16_t *)(memh + off)) = val;
+ else {
+ tmpmemh = memh + off;
+ offset = tmpmemh & 3;
+ nval = val << (8 * offset);
+ port = (u_int32_t *)((tmpmemh << 5) | (1 << 3));
+ *port = nval;
+ }
+ wbflush();
+}
+
+void
+__C(CHIP,_mem_write_4)(v, memh, off, val)
+ void *v;
+ bus_mem_handle_t memh;
+ bus_mem_size_t off;
+ u_int32_t val;
+{
+ register bus_mem_handle_t tmpmemh;
+ register u_int32_t *port, nval;
+ register int offset;
+
+ if ((memh >> 63) != 0)
+ (*(u_int32_t *)(memh + off)) = val;
+ else {
+ tmpmemh = memh + off;
+ offset = tmpmemh & 3;
+ nval = val /*<< (8 * offset)*/;
+ port = (u_int32_t *)((tmpmemh << 5) | (3 << 3));
+ *port = nval;
+ }
+ wbflush();
+}
+
+void
+__C(CHIP,_mem_write_8)(v, memh, off, val)
+ void *v;
+ bus_mem_handle_t memh;
+ bus_mem_size_t off;
+ u_int64_t val;
+{
+
+ if ((memh >> 63) != 0)
+ (*(u_int64_t *)(memh + off)) = val;
+ else {
+ /* XXX XXX XXX */
+ panic("%s not implemented\n",
+ __S(__C(CHIP,_mem_write_8)));
+ }
+ wbflush();
+}
+
+vm_offset_t
+__C(CHIP,_XXX_dmamap)(addr)
+ void *addr;
+{
+
+ return (vtophys(addr) | 0x40000000);
+}
diff --git a/sys/arch/alpha/pci/sio.c b/sys/arch/alpha/pci/sio.c
index a8b6b8a0a24..a43bcef227d 100644
--- a/sys/arch/alpha/pci/sio.c
+++ b/sys/arch/alpha/pci/sio.c
@@ -1,7 +1,7 @@
-/* $NetBSD: sio.c,v 1.3 1995/11/23 02:38:16 cgd Exp $ */
+/* $NetBSD: sio.c,v 1.8 1996/04/13 00:23:34 cgd Exp $ */
/*
- * Copyright (c) 1995 Carnegie-Mellon University.
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -32,6 +32,9 @@
#include <sys/kernel.h>
#include <sys/device.h>
+#include <machine/intr.h>
+#include <machine/bus.h>
+
#include <dev/isa/isavar.h>
#include <dev/eisa/eisavar.h>
@@ -44,17 +47,37 @@
int siomatch __P((struct device *, void *, void *));
void sioattach __P((struct device *, struct device *, void *));
-struct cfdriver siocd = {
- NULL, "sio", siomatch, sioattach, DV_DULL, sizeof(struct device)
+struct cfattach sio_ca = {
+ sizeof(struct device), siomatch, sioattach,
+};
+
+struct cfdriver sio_cd = {
+ NULL, "sio", DV_DULL,
};
int pcebmatch __P((struct device *, void *, void *));
-struct cfdriver pcebcd = {
- NULL, "pceb", pcebmatch, sioattach, DV_DULL, sizeof(struct device)
+struct cfattach pceb_ca = {
+ sizeof(struct device), pcebmatch, sioattach,
+};
+
+struct cfdriver pceb_cd = {
+ NULL, "pceb", DV_DULL,
};
-static int sioprint __P((void *, char *pnp));
+union sio_attach_args {
+ const char *sa_name; /* XXX should be common */
+ struct isabus_attach_args sa_iba;
+ struct eisabus_attach_args sa_eba;
+};
+
+int sioprint __P((void *, char *pnp));
+void sio_isa_attach_hook __P((struct device *, struct device *,
+ struct isabus_attach_args *));
+void sio_eisa_attach_hook __P((struct device *, struct device *,
+ struct eisabus_attach_args *));
+int sio_eisa_maxslots __P((void *));
+int sio_eisa_intr_map __P((void *, u_int, eisa_intr_handle_t *));
int
siomatch(parent, match, aux)
@@ -62,10 +85,10 @@ siomatch(parent, match, aux)
void *match, *aux;
{
struct cfdata *cf = match;
- struct pcidev_attach_args *pda = aux;
+ struct pci_attach_args *pa = aux;
- if (PCI_VENDOR(pda->pda_id) != PCI_VENDOR_INTEL ||
- PCI_PRODUCT(pda->pda_id) != PCI_PRODUCT_INTEL_SIO)
+ if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_INTEL ||
+ PCI_PRODUCT(pa->pa_id) != PCI_PRODUCT_INTEL_SIO)
return (0);
return (1);
@@ -77,10 +100,10 @@ pcebmatch(parent, match, aux)
void *match, *aux;
{
struct cfdata *cf = match;
- struct pcidev_attach_args *pda = aux;
+ struct pci_attach_args *pa = aux;
- if (PCI_VENDOR(pda->pda_id) != PCI_VENDOR_INTEL ||
- PCI_PRODUCT(pda->pda_id) != PCI_PRODUCT_INTEL_PCEB)
+ if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_INTEL ||
+ PCI_PRODUCT(pa->pa_id) != PCI_PRODUCT_INTEL_PCEB)
return (0);
return (1);
@@ -91,23 +114,24 @@ sioattach(parent, self, aux)
struct device *parent, *self;
void *aux;
{
- struct pcidev_attach_args *pda = aux;
- struct isa_attach_args ia;
- struct eisa_attach_args ea;
+ struct pci_attach_args *pa = aux;
+ struct alpha_isa_chipset ic;
+ struct alpha_eisa_chipset ec;
+ union sio_attach_args sa;
int sio, haseisa;
char devinfo[256];
- sio = (PCI_PRODUCT(pda->pda_id) == PCI_PRODUCT_INTEL_SIO);
- haseisa = (PCI_PRODUCT(pda->pda_id) == PCI_PRODUCT_INTEL_PCEB);
+ sio = (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_INTEL_SIO);
+ haseisa = (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_INTEL_PCEB);
- pci_devinfo(pda->pda_id, pda->pda_class, 0, devinfo);
+ pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo);
printf(": %s (rev. 0x%02x)\n", devinfo,
- PCI_REVISION(pda->pda_class));
+ PCI_REVISION(pa->pa_class));
if (sio) {
pci_revision_t rev;
- rev = PCI_REVISION(pda->pda_class);
+ rev = PCI_REVISION(pa->pa_class);
if (rev < 3)
printf("%s: WARNING: SIO I SUPPORT UNTESTED\n",
@@ -118,44 +142,89 @@ sioattach(parent, self, aux)
evcnt_attach(self, "intr", &sio_intr_evcnt);
#endif
- ia.ia_bus = BUS_ISA;
- ia.ia_dmafns = pda->pda_dmafns;
- ia.ia_dmaarg = pda->pda_dmaarg;
- ia.ia_intrfns = &sio_isa_intr_fns;
- ia.ia_intrarg = NULL; /* XXX needs nothing */
- ia.ia_memfns = pda->pda_memfns;
- ia.ia_memarg = pda->pda_memarg;
- ia.ia_piofns = pda->pda_piofns;
- ia.ia_pioarg = pda->pda_pioarg;
- config_found(self, &ia, sioprint);
-
if (haseisa) {
- ea.ea_bus = BUS_EISA;
- ea.ea_dmafns = pda->pda_dmafns;
- ea.ea_dmaarg = pda->pda_dmaarg;
- ea.ea_intrfns = &sio_isa_intr_fns;
- ea.ea_intrarg = NULL; /* XXX needs nothing */
- ea.ea_memfns = pda->pda_memfns;
- ea.ea_memarg = pda->pda_memarg;
- ea.ea_piofns = pda->pda_piofns;
- ea.ea_pioarg = pda->pda_pioarg;
- config_found(self, &ea, sioprint);
+ ec.ec_v = NULL;
+ ec.ec_attach_hook = sio_eisa_attach_hook;
+ ec.ec_maxslots = sio_eisa_maxslots;
+ ec.ec_intr_map = sio_eisa_intr_map;
+ ec.ec_intr_string = sio_intr_string;
+ ec.ec_intr_establish = sio_intr_establish;
+ ec.ec_intr_disestablish = sio_intr_disestablish;
+
+ sa.sa_eba.eba_busname = "eisa";
+ sa.sa_eba.eba_bc = pa->pa_bc;
+ sa.sa_eba.eba_ec = &ec;
+ config_found(self, &sa.sa_eba, sioprint);
}
+
+ ic.ic_v = NULL;
+ ic.ic_attach_hook = sio_isa_attach_hook;
+ ic.ic_intr_establish = sio_intr_establish;
+ ic.ic_intr_disestablish = sio_intr_disestablish;
+
+ sa.sa_iba.iba_busname = "isa";
+ sa.sa_iba.iba_bc = pa->pa_bc;
+ sa.sa_iba.iba_ic = &ic;
+ config_found(self, &sa.sa_iba, sioprint);
}
-static int
+int
sioprint(aux, pnp)
void *aux;
char *pnp;
{
- register struct isa_attach_args *ia = aux;
-
- /*
- * XXX Assumes that the first fields of 'struct isa_attach_args'
- * XXX and 'struct eisa_attach_args' are the same.
- */
+ register union sio_attach_args *sa = aux;
if (pnp)
- printf("%s at %s", isa_bustype_name(ia->ia_bus), pnp);
+ printf("%s at %s", sa->sa_name, pnp);
return (UNCONF);
}
+
+void
+sio_isa_attach_hook(parent, self, iba)
+ struct device *parent, *self;
+ struct isabus_attach_args *iba;
+{
+
+ /* Nothing to do. */
+}
+
+void
+sio_eisa_attach_hook(parent, self, eba)
+ struct device *parent, *self;
+ struct eisabus_attach_args *eba;
+{
+
+ /* Nothing to do. */
+}
+
+int
+sio_eisa_maxslots(v)
+ void *v;
+{
+
+ return 16; /* as good a number as any. only 8, maybe? */
+}
+
+int
+sio_eisa_intr_map(v, irq, ihp)
+ void *v;
+ u_int irq;
+ eisa_intr_handle_t *ihp;
+{
+
+#define ICU_LEN 16 /* number of ISA IRQs (XXX) */
+
+ if (irq >= ICU_LEN) {
+ printf("sio_eisa_intr_map: bad IRQ %d\n", irq);
+ *ihp = -1;
+ return 1;
+ }
+ if (irq == 2) {
+ printf("sio_eisa_intr_map: changed IRQ 2 to IRQ 9\n");
+ irq = 9;
+ }
+
+ *ihp = irq;
+ return 0;
+}
diff --git a/sys/arch/alpha/pci/sio_pic.c b/sys/arch/alpha/pci/sio_pic.c
index b7d7af43858..6ad39660d5f 100644
--- a/sys/arch/alpha/pci/sio_pic.c
+++ b/sys/arch/alpha/pci/sio_pic.c
@@ -1,7 +1,7 @@
-/* $NetBSD: sio_pic.c,v 1.3 1995/12/24 02:29:49 mycroft Exp $ */
+/* $NetBSD: sio_pic.c,v 1.7.4.3 1996/06/05 22:50:23 cgd Exp $ */
/*
- * Copyright (c) 1995 Carnegie-Mellon University.
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -33,6 +33,9 @@
#include <sys/malloc.h>
#include <sys/syslog.h>
+#include <machine/intr.h>
+#include <machine/bus.h>
+
#include <dev/isa/isareg.h>
#include <dev/isa/isavar.h>
#include <alpha/pci/siovar.h>
@@ -56,21 +59,10 @@
/*
* Private functions and variables.
*/
-static void *sio_intr_establish __P((void *, isa_irq_t,
- int, int, int (*)(void *), void *));
-static void sio_intr_disestablish __P((void *, void *));
-static void sio_strayintr __P((isa_irq_t));
-
-static __const struct isa_pio_fns *sio_ipf; /* XXX */
-static void *sio_ipfa; /* XXX */
-
-void sio_intr_setup __P((__const struct isa_pio_fns *, void *));
-void sio_iointr __P((void *framep, int vec));
+static void sio_strayintr __P((int));
-struct isa_intr_fns sio_isa_intr_fns = {
- sio_intr_establish,
- sio_intr_disestablish,
-};
+bus_chipset_tag_t sio_bc;
+bus_io_handle_t sio_ioh_icu1, sio_ioh_icu2, sio_ioh_elcr;
/*
* Interrupt handler chains. sio_intr_establish() inserts a handler into
@@ -131,7 +123,7 @@ sio_setirqstat(irq, enabled, type)
int icu, bit;
#if 0
- printf("sio_setirqstat: irq %d, %s, %s\n", irq,
+ printf("sio_setirqstat: irq %d: %s, %s\n", irq,
enabled ? "enabled" : "disabled", isa_intr_typename(type));
#endif
@@ -140,10 +132,10 @@ sio_setirqstat(irq, enabled, type)
icu = irq / 8;
bit = irq % 8;
- ocw1[0] = INB(sio_ipf, sio_ipfa, IO_ICU1 + 1);
- ocw1[1] = INB(sio_ipf, sio_ipfa, IO_ICU2 + 1);
- elcr[0] = INB(sio_ipf, sio_ipfa, 0x4d0); /* XXX */
- elcr[1] = INB(sio_ipf, sio_ipfa, 0x4d1); /* XXX */
+ ocw1[0] = bus_io_read_1(sio_bc, sio_ioh_icu1, 1);
+ ocw1[1] = bus_io_read_1(sio_bc, sio_ioh_icu2, 1);
+ elcr[0] = bus_io_read_1(sio_bc, sio_ioh_elcr, 0); /* XXX */
+ elcr[1] = bus_io_read_1(sio_bc, sio_ioh_elcr, 1); /* XXX */
/*
* interrupt enable: set bit to mask (disable) interrupt.
@@ -178,39 +170,42 @@ sio_setirqstat(irq, enabled, type)
(ocw1[1] & ~initial_ocw1[1]) != 0 ||
(elcr[0] & initial_elcr[0]) != initial_elcr[0] ||
(elcr[1] & initial_elcr[1]) != initial_elcr[1]) {
- printf("sio_sis: initial: ocw = (%2x,%2x), elcr = (%2x,%2X)\n",
+ printf("sio_sis: initial: ocw = (%2x,%2x), elcr = (%2x,%2x)\n",
initial_ocw1[0], initial_ocw1[1],
initial_elcr[0], initial_elcr[1]);
- printf(" current: ocw = (%2x,%2x), elcr = (%2x,%2X)\n",
+ printf(" current: ocw = (%2x,%2x), elcr = (%2x,%2x)\n",
ocw1[0], ocw1[1], elcr[0], elcr[1]);
panic("sio_setirqstat: hosed");
}
#endif
- OUTB(sio_ipf, sio_ipfa, IO_ICU1 + 1, ocw1[0]);
- OUTB(sio_ipf, sio_ipfa, IO_ICU2 + 1, ocw1[1]);
- OUTB(sio_ipf, sio_ipfa, 0x4d0, elcr[0]); /* XXX */
- OUTB(sio_ipf, sio_ipfa, 0x4d1, elcr[1]); /* XXX */
+ bus_io_write_1(sio_bc, sio_ioh_icu1, 1, ocw1[0]);
+ bus_io_write_1(sio_bc, sio_ioh_icu2, 1, ocw1[1]);
+ bus_io_write_1(sio_bc, sio_ioh_elcr, 0, elcr[0]); /* XXX */
+ bus_io_write_1(sio_bc, sio_ioh_elcr, 1, elcr[1]); /* XXX */
}
void
-sio_intr_setup(ipf, ipfa)
- __const struct isa_pio_fns *ipf;
- void *ipfa;
+sio_intr_setup(bc)
+ bus_chipset_tag_t bc;
{
int i;
- sio_ipf = ipf;
- sio_ipfa = ipfa;
+ sio_bc = bc;
+
+ if (bus_io_map(sio_bc, IO_ICU1, IO_ICUSIZE, &sio_ioh_icu1) ||
+ bus_io_map(sio_bc, IO_ICU2, IO_ICUSIZE, &sio_ioh_icu2) ||
+ bus_io_map(sio_bc, 0x4d0, 2, &sio_ioh_elcr))
+ panic("sio_intr_setup: can't map I/O ports");
#ifdef BROKEN_PROM_CONSOLE
/*
* Remember the initial values, because the prom is stupid.
*/
- initial_ocw1[0] = INB(sio_ipf, sio_ipfa, IO_ICU1 + 1);
- initial_ocw1[1] = INB(sio_ipf, sio_ipfa, IO_ICU2 + 1);
- initial_elcr[0] = INB(sio_ipf, sio_ipfa, 0x4d0); /* XXX */
- initial_elcr[1] = INB(sio_ipf, sio_ipfa, 0x4d1); /* XXX */
+ initial_ocw1[0] = bus_io_read_1(sio_bc, sio_ioh_icu1, 1);
+ initial_ocw1[1] = bus_io_read_1(sio_bc, sio_ioh_icu2, 1);
+ initial_elcr[0] = bus_io_read_1(sio_bc, sio_ioh_elcr, 0); /* XXX */
+ initial_elcr[1] = bus_io_read_1(sio_bc, sio_ioh_elcr, 1); /* XXX */
#if 0
printf("initial_ocw1[0] = 0x%x\n", initial_ocw1[0]);
printf("initial_ocw1[1] = 0x%x\n", initial_ocw1[1]);
@@ -262,14 +257,27 @@ sio_intr_setup(ipf, ipfa)
}
}
+const char *
+sio_intr_string(v, irq)
+ void *v;
+ int irq;
+{
+ static char irqstr[12]; /* 8 + 2 + NULL + sanity */
+
+ if (irq == 0 || irq >= ICU_LEN || irq == 2)
+ panic("sio_intr_string: bogus IRQ 0x%x\n", irq);
+
+ sprintf(irqstr, "isa irq %d", irq);
+ return (irqstr);
+}
+
void *
-sio_intr_establish(siifa, irq, type, level, ih_fun, ih_arg)
- void *siifa;
- isa_irq_t irq;
+sio_intr_establish(v, irq, type, level, ih_fun, ih_arg)
+ void *v, *ih_arg;
+ int irq;
int type;
int level;
int (*ih_fun)(void *);
- void *ih_arg;
{
struct intrhand **p, *c, *ih;
extern int cold;
@@ -288,10 +296,18 @@ sio_intr_establish(siifa, irq, type, level, ih_fun, ih_arg)
if (type == sio_intrsharetype[irq])
break;
case IST_PULSE:
- if (type != IST_NONE)
- panic("intr_establish: can't share %s with %s",
- isa_intrsharetype_name(sio_intrsharetype[irq]),
- isa_intrsharetype_name(type));
+ if (type != IST_NONE) {
+ if (sio_intrhand[irq] == NULL) {
+ printf("sio_intr_establish: irq %d: warning: using %s on %s\n",
+ irq, isa_intr_typename(type),
+ isa_intr_typename(sio_intrsharetype[irq]));
+ type = sio_intrsharetype[irq];
+ } else {
+ panic("sio_intr_establish: irq %d: can't share %s with %s",
+ irq, isa_intr_typename(type),
+ isa_intr_typename(sio_intrsharetype[irq]));
+ }
+ }
break;
}
@@ -320,12 +336,12 @@ sio_intr_establish(siifa, irq, type, level, ih_fun, ih_arg)
}
void
-sio_intr_disestablish(siifa, handler)
- void *siifa;
- void *handler;
+sio_intr_disestablish(v, cookie)
+ void *v;
+ void *cookie;
{
- printf("sio_intr_disestablish(%lx)\n", handler);
+ printf("sio_intr_disestablish(%lx)\n", cookie);
/* XXX */
/* XXX NEVER ALLOW AN INITIALLY-ENABLED INTERRUPT TO BE DISABLED */
@@ -337,7 +353,7 @@ sio_intr_disestablish(siifa, handler)
*/
void
sio_strayintr(irq)
- isa_irq_t irq;
+ int irq;
{
if (++sio_strayintrcnt[irq] <= STRAY_MAX)
@@ -401,8 +417,8 @@ sio_iointr(framep, vec)
* by the interrupt handler.
*/
if (irq > 7)
- OUTB(sio_ipf, sio_ipfa,
- IO_ICU2 + 0, 0x20 | (irq & 0x07)); /* XXX */
- OUTB(sio_ipf, sio_ipfa,
- IO_ICU1 + 0, 0x20 | (irq > 7 ? 2 : irq)); /* XXX */
+ bus_io_write_1(sio_bc,
+ sio_ioh_icu2, 0, 0x20 | (irq & 0x07)); /* XXX */
+ bus_io_write_1(sio_bc,
+ sio_ioh_icu1, 0, 0x20 | (irq > 7 ? 2 : irq)); /* XXX */
}
diff --git a/sys/arch/alpha/pci/sioreg.h b/sys/arch/alpha/pci/sioreg.h
new file mode 100644
index 00000000000..3be1f87288f
--- /dev/null
+++ b/sys/arch/alpha/pci/sioreg.h
@@ -0,0 +1,129 @@
+/* $NetBSD: sioreg.h,v 1.1 1996/04/23 14:10:53 cgd Exp $ */
+
+/*
+ * Copyright (c) 1996 BBN Corporation.
+ * BBN Systems and Technologies Division
+ * 10 Moulton Street
+ * Cambridge, Ma. 02138
+ * 617-873-3000
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this permission appear in all copies and in
+ * supporting documentation, and that the name of BBN Corporation not be used
+ * in advertising or publicity pertaining to distribution of the software
+ * without specific, written prior permission. BBN makes no representations
+ * about the suitability of this software for any purposes. It is provided
+ * "AS IS" without express or implied warranties.
+ */
+
+/*
+ * Intel 82378 System I/O (SIO) Chip
+ *
+ * Taken from the Intel "Peripheral Components" manual, 1995 Edition.
+ */
+
+
+/*
+ * Device-specific PCI Configuration Registers
+ */
+
+/*
+ * PCI Control Registers
+ */
+#define SIO_PCIREG_PCICON 0x40 /* PCI Control */
+#define SIO_PCIREG_PAC 0x41 /* PCI Arbiter Control */
+#define SIO_PCIREG_PAPC 0x42 /* PCI Arbiter Priority Control */
+#define SIO_PCIREG_ARBPRIX 0x43 /* PCI Arbiter Priority Control Ext. */
+
+/*
+ * Memory Chip Select Registers
+ */
+#define SIO_PCIREG_MEMCSCON 0x44 /* MEMCS# Control */
+#define SIO_PCIREG_MEMCSBOH 0x45 /* MEMCS# Bottom of Hole */
+#define SIO_PCIREG_MEMCSTOH 0x46 /* MEMCS# Top of Hole */
+#define SIO_PCIREG_MEMCSTOM 0x47 /* MEMCS# Top of Memory */
+
+#define SIO_PCIREG_MAR1 0x54 /* MEMCS# Attribute 1 */
+#define SIO_PCIREG_MAR2 0x55 /* MEMCS# Attribute 2 */
+#define SIO_PCIREG_MAR3 0x56 /* MEMCS# Attribute 3 */
+#define SIO_PCIREG_DMASGRB 0x57 /* DMA Scatter/Gather Rel. Base Addr. */
+
+/*
+ * ISA Address Decoder Registers
+ */
+#define SIO_PCIREG_IADCON 0x48 /* ISA Address Decoder Control */
+#define SIO_PCIREG_IADRBE 0x49 /* ISA Addr. Decoder ROM Block Enable */
+#define SIO_PCIREG_IADBOH 0x4A /* ISA Addr. Decoder Bottom of Hole */
+#define SIO_PCIREG_IADTOH 0x4B /* ISA Addr. Decoder Top of Hole */
+
+/*
+ * Clocks and Timers
+ */
+#define SIO_PCIREG_ICRT 0x4C /* ISA Controller Recovery Timer */
+#define SIO_PCIREG_ICD 0x4D /* ISA Clock Divisor */
+
+#define SIO_PCIREG_ 0x80 /* BIOS Timer Base Address */
+
+#define SIO_PCIREG_CTLTMRL 0xAC /* Clock Throttle STPCLK# Low Timer */
+#define SIO_PCIREG_CTLTMRH 0xAE /* Clock Throttle STPCLK# High Timer */
+
+/*
+ * Miscellaneous
+ */
+#define SIO_PCIREG_UBCSA 0x4E /* Utility Bus Chip Select A */
+#define SIO_PCIREG_UBCSB 0x4F /* Utility Bus Chip Select B */
+
+/*
+ * PIRQ# Route Control
+ */
+#define SIO_PCIREG_PIRQ0 0x60 /* PIRQ0 Route Control */
+#define SIO_PCIREG_PIRQ1 0x61 /* PIRQ1 Route Control */
+#define SIO_PCIREG_PIRQ2 0x62 /* PIRQ2 Route Control */
+#define SIO_PCIREG_PIRQ3 0x63 /* PIRQ3 Route Control */
+#define SIO_PCIREG_PIRQ_RTCTRL SIO_PCIREG_PIRQ0
+
+/*
+ * System Management Interrupt (SMI)
+ */
+#define SIO_PCIREG_SMICNTL 0xA0 /* SMI Control */
+#define SIO_PCIREG_SMIEN 0xA2 /* SMI Enable */
+#define SIO_PCIREG_SEE 0xA4 /* System Event Enable */
+#define SIO_PCIREG_FTMR 0xA8 /* Fast Off Timer */
+#define SIO_PCIREG_SMIREQ 0xAA /* SMI Request */
+
+
+/*
+ * Non-Configuration Registers
+ */
+
+/*
+ * Control
+ */
+#define SIO_REG_RSTUB 0x060 /* Reset UBus */
+#define SIO_REG_NMICTRL 0x061 /* NMI Status and Control */
+#define SIO_REG_CMOSRAM 0x070 /* CMOS RAM Address and NMI Mask */
+#define SIO_REG_NMIMASK 0x070 /* CMOS RAM Address and NMI Mask */
+#define SIO_REG_PORT92 0x092 /* Port 92 */
+#define SIO_REG_CPERR 0x0F0 /* Coprocessor Error */
+
+/*
+ * Interrupt
+ */
+#define SIO_REG_ICU1 0x020 /* Intr. Controller #1 Control */
+#define SIO_REG_ICU1MASK 0x021 /* Intr. Controller #1 Mask */
+#define SIO_REG_ICU2 0x0A0 /* Intr. Controller #2 Control */
+#define SIO_REG_ICU2MASK 0x0A1 /* Intr. Controller #2 Mask */
+#define SIO_REG_ICU1ELC 0x4D0 /* #1's Edge/Level Control */
+#define SIO_REG_ICU2ELC 0x4D1 /* #2's Edge/Level Control */
+#define SIO_ICUSIZE 16 /* I/O Port Sizes */
+
+/*
+ * Timer
+ */
+/* XXX need Timer definitions */
+
+/*
+ * DMA
+ */
+/* XXX need DMA definitions */
diff --git a/sys/arch/alpha/pci/siovar.h b/sys/arch/alpha/pci/siovar.h
index 746b9a89abb..84bcfabcedd 100644
--- a/sys/arch/alpha/pci/siovar.h
+++ b/sys/arch/alpha/pci/siovar.h
@@ -1,7 +1,7 @@
-/* $NetBSD: siovar.h,v 1.1 1995/11/23 02:38:22 cgd Exp $ */
+/* $NetBSD: siovar.h,v 1.3 1996/04/12 06:09:06 cgd Exp $ */
/*
- * Copyright (c) 1995 Carnegie-Mellon University.
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -27,10 +27,14 @@
* rights to redistribute these changes.
*/
-void sio_intr_setup __P((__const struct isa_pio_fns *, void *));
+void sio_intr_setup __P((bus_chipset_tag_t));
void sio_iointr __P((void *framep, int vec));
+const char *sio_intr_string __P((void *, int));
+void *sio_intr_establish __P((void *, int, int, int, int (*)(void *),
+ void *));
+void sio_intr_disestablish __P((void *, void *));
+
#ifdef EVCNT_COUNTERS
extern struct evcnt sio_intr_evcnt;
#endif
-extern __const struct isa_intr_fns sio_isa_intr_fns;
diff --git a/sys/arch/alpha/pci/tga.c b/sys/arch/alpha/pci/tga.c
index 739c0d812c1..efec7a02a81 100644
--- a/sys/arch/alpha/pci/tga.c
+++ b/sys/arch/alpha/pci/tga.c
@@ -1,7 +1,7 @@
-/* $NetBSD: tga.c,v 1.3 1995/11/23 02:38:25 cgd Exp $ */
+/* $NetBSD: tga.c,v 1.6 1996/04/12 06:09:08 cgd Exp $ */
/*
- * Copyright (c) 1995 Carnegie-Mellon University.
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -32,48 +32,49 @@
#include <sys/kernel.h>
#include <sys/device.h>
#include <sys/malloc.h>
+#include <sys/buf.h>
#include <sys/conf.h>
+#include <sys/ioctl.h>
-#include <dev/rcons/raster.h>
-#include <dev/pseudo/rcons.h>
-#include <dev/pseudo/ansicons.h>
+#include <machine/bus.h>
+#include <machine/intr.h>
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
#include <dev/pci/pcidevs.h>
-#include <alpha/pci/tgareg.h>
+#include <machine/tgareg.h>
#include <alpha/pci/tgavar.h>
#include <alpha/pci/bt485reg.h>
-#include <alpha/pci/wsconsvar.h>
+
+#include <dev/rcons/raster.h>
+#include <alpha/wscons/wscons_raster.h>
+#include <alpha/wscons/wsconsvar.h>
+#include <machine/fbio.h>
#include <machine/autoconf.h>
#include <machine/pte.h>
int tgamatch __P((struct device *, void *, void *));
void tgaattach __P((struct device *, struct device *, void *));
+int tgaprint __P((void *, char *));
-struct cfdriver tgacd = {
- NULL, "tga", tgamatch, tgaattach, DV_DULL, sizeof(struct tga_softc)
+struct cfattach tga_ca = {
+ sizeof(struct tga_softc), tgamatch, tgaattach,
};
-int tga_identify __P((tga_reg_t *));
-__const struct tga_conf *tga_getconf __P((int));
-void tga_getdevconfig __P((__const struct pci_conf_fns *, void *,
- __const struct pci_mem_fns *, void *,
- pci_conftag_t tag, struct tga_devconfig *dc));
+struct cfdriver tga_cd = {
+ NULL, "tga", DV_DULL,
+};
-void tga_bell __P((void *)); /* XXX */
+int tga_identify __P((tga_reg_t *));
+const struct tga_conf *tga_getconf __P((int));
+void tga_getdevconfig __P((bus_chipset_tag_t bc, pci_chipset_tag_t pc,
+ pcitag_t tag, struct tga_devconfig *dc));
struct tga_devconfig tga_console_dc;
-#if 0
-dev_decl(tga, mmap);
-dev_decl(tga, ioctl);
-#endif
-
-struct ansicons_functions tga_acf = {
- tga_bell,
- rcons_cursor, /* could use hardware cursor; who cares? */
+struct wscons_emulfuncs tga_emulfuncs = {
+ rcons_cursor, /* could use hardware cursor; punt */
rcons_putstr,
rcons_copycols,
rcons_erasecols,
@@ -81,110 +82,11 @@ struct ansicons_functions tga_acf = {
rcons_eraserows,
};
-#define TGAUNIT(dev) minor(dev)
+int tgaioctl __P((struct device *, u_long, caddr_t, int, struct proc *));
+int tgammap __P((struct device *, off_t, int));
-void tga_builtin_set_cpos __P((struct tga_devconfig *, int, int));
-void tga_builtin_get_cpos __P((struct tga_devconfig *, int *, int *));
-
-__const struct tga_ramdac_conf tga_ramdac_bt463 = {
- "Bt463",
- tga_builtin_set_cpos,
- tga_builtin_get_cpos,
- /* XXX */
-};
-
-void tga_bt485_wr_reg __P((volatile tga_reg_t *, u_int, u_int8_t));
-u_int8_t tga_bt485_rd_reg __P((volatile tga_reg_t *, u_int));
-
-void tga_bt485_set_cpos __P((struct tga_devconfig *, int, int));
-void tga_bt485_get_cpos __P((struct tga_devconfig *, int *, int *));
-
-__const struct tga_ramdac_conf tga_ramdac_bt485 = {
- "Bt485",
- tga_bt485_set_cpos,
- tga_bt485_get_cpos,
- /* XXX */
-};
-
-#undef KB
-#define KB * 1024
-#undef MB
-#define MB * 1024 * 1024
-
-__const struct tga_conf tga_configs[TGA_TYPE_UNKNOWN] = {
- /* TGA_TYPE_T8_01 */
- {
- "T8-01",
- &tga_ramdac_bt485,
- 8,
- 4 MB,
- 2 KB,
- 1, { 2 MB, 0 }, { 1 MB, 0 },
- 0, { 0, 0 }, { 0, 0 },
- },
- /* TGA_TYPE_T8_02 */
- {
- "T8-02",
- &tga_ramdac_bt485,
- 8,
- 4 MB,
- 4 KB,
- 1, { 2 MB, 0 }, { 2 MB, 0 },
- 0, { 0, 0 }, { 0, 0 },
- },
- /* TGA_TYPE_T8_22 */
- {
- "T8-22",
- &tga_ramdac_bt485,
- 8,
- 8 MB,
- 4 KB,
- 1, { 4 MB, 0 }, { 2 MB, 0 },
- 1, { 6 MB, 0 }, { 2 MB, 0 },
- },
- /* TGA_TYPE_T8_44 */
- {
- "T8-44",
- &tga_ramdac_bt485,
- 8,
- 16 MB,
- 4 KB,
- 2, { 8 MB, 12 MB }, { 2 MB, 2 MB },
- 2, { 10 MB, 14 MB }, { 2 MB, 2 MB },
- },
- /* TGA_TYPE_T32_04 */
- {
- "T32-04",
- &tga_ramdac_bt463,
- 32,
- 16 MB,
- 8 KB,
- 1, { 8 MB, 0 }, { 4 MB, 0 },
- 0, { 0, 0 }, { 0, 0 },
- },
- /* TGA_TYPE_T32_08 */
- {
- "T32-08",
- &tga_ramdac_bt463,
- 32,
- 16 MB,
- 16 KB,
- 1, { 8 MB, 0 }, { 8 MB, 0 },
- 0, { 0, 0 }, { 0, 0 },
- },
- /* TGA_TYPE_T32_88 */
- {
- "T32-88",
- &tga_ramdac_bt463,
- 32,
- 32 MB,
- 16 KB,
- 1, { 16 MB, 0 }, { 8 MB, 0 },
- 1, { 24 MB, 0 }, { 8 MB, 0 },
- },
-};
-#undef KB
-#undef MB
+void tga_blank __P((struct tga_devconfig *));
+void tga_unblank __P((struct tga_devconfig *));
int
tgamatch(parent, match, aux)
@@ -192,113 +94,43 @@ tgamatch(parent, match, aux)
void *match, *aux;
{
struct cfdata *cf = match;
- struct pcidev_attach_args *pda = aux;
+ struct pci_attach_args *pa = aux;
- if (PCI_VENDOR(pda->pda_id) != PCI_VENDOR_DEC ||
- PCI_PRODUCT(pda->pda_id) != PCI_PRODUCT_DEC_21030)
+ if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_DEC ||
+ PCI_PRODUCT(pa->pa_id) != PCI_PRODUCT_DEC_21030)
return (0);
- return (1);
-}
-
-int
-tga_identify(regs)
- tga_reg_t *regs;
-{
- int type;
- int deep, addrmask, wide;
-
- deep = (regs[TGA_REG_GDER] & 0x1) != 0; /* XXX */
- addrmask = ((regs[TGA_REG_GDER] >> 2) & 0x7); /* XXX */
- wide = (regs[TGA_REG_GDER] & 0x200) == 0; /* XXX */
-
- type = TGA_TYPE_UNKNOWN;
-
- if (!deep) {
- /* 8bpp frame buffer */
-
- if (addrmask == 0x0) {
- /* 4MB core map; T8-01 or T8-02 */
-
- if (!wide)
- type = TGA_TYPE_T8_01;
- else
- type = TGA_TYPE_T8_02;
- } else if (addrmask == 0x1) {
- /* 8MB core map; T8-22 */
-
- if (wide) /* sanity */
- type = TGA_TYPE_T8_22;
- } else if (addrmask == 0x3) {
- /* 16MB core map; T8-44 */
-
- if (wide) /* sanity */
- type = TGA_TYPE_T8_44;
- }
- } else {
- /* 32bpp frame buffer */
-
- if (addrmask == 0x3) {
- /* 16MB core map; T32-04 or T32-08 */
-
- if (!wide)
- type = TGA_TYPE_T32_04;
- else
- type = TGA_TYPE_T32_08;
- } else if (addrmask == 0x7) {
- /* 32MB core map; T32-88 */
-
- if (wide) /* sanity */
- type = TGA_TYPE_T32_88;
- }
- }
-
- return (type);
-}
-
-__const struct tga_conf *
-tga_getconf(type)
- int type;
-{
-
- if (type >= 0 && type < TGA_TYPE_UNKNOWN)
- return &tga_configs[type];
-
- return (NULL);
+ return (10);
}
void
-tga_getdevconfig(pcf, pcfa, pmf, pmfa, tag, dc)
- __const struct pci_conf_fns *pcf;
- __const struct pci_mem_fns *pmf;
- void *pcfa, *pmfa;
- pci_conftag_t tag;
+tga_getdevconfig(bc, pc, tag, dc)
+ bus_chipset_tag_t bc;
+ pci_chipset_tag_t pc;
+ pcitag_t tag;
struct tga_devconfig *dc;
{
- __const struct tga_conf *tgac;
- __const struct tga_ramdac_conf *tgar;
+ const struct tga_conf *tgac;
+ const struct tga_ramdac_conf *tgar;
struct raster *rap;
struct rcons *rcp;
- pci_msize_t pcisize;
+ bus_mem_size_t pcisize;
int i, cacheable;
- dc->dc_pcf = pcf;
- dc->dc_pcfa = pcfa;
- dc->dc_pmf = pmf;
- dc->dc_pmfa = pmfa;
+ dc->dc_bc = bc;
+ dc->dc_pc = pc;
dc->dc_pcitag = tag;
/* XXX MAGIC NUMBER */
- PCI_FIND_MEM(pcf, pcfa, tag, 0x10, &dc->dc_pcipaddr, &pcisize,
+ pci_mem_find(pc, tag, 0x10, &dc->dc_pcipaddr, &pcisize,
&cacheable);
if (!cacheable) /* sanity */
panic("tga_getdevconfig: memory not cacheable?");
- dc->dc_vaddr = PCI_MEM_MAP(pmf, pmfa, dc->dc_pcipaddr, pcisize, 1);
- if (dc->dc_vaddr == 0)
+ /* XXX XXX XXX */
+ if (bus_mem_map(bc, dc->dc_pcipaddr, pcisize, 1, &dc->dc_vaddr))
return;
-
dc->dc_paddr = k0segtophys(dc->dc_vaddr); /* XXX */
dc->dc_regs = (tga_reg_t *)(dc->dc_vaddr + TGA_MEM_CREGS);
@@ -332,15 +164,26 @@ tga_getdevconfig(pcf, pcfa, pmf, pmfa, tag, dc)
dc->dc_rowbytes = dc->dc_wid * (dc->dc_tgaconf->tgac_phys_depth / 8);
if ((dc->dc_regs[TGA_REG_VHCR] & 0x00000001) != 0 && /* XXX */
- (dc->dc_regs[TGA_REG_VHCR] & 0x80000000) != 0) /* XXX */
+ (dc->dc_regs[TGA_REG_VHCR] & 0x80000000) != 0) { /* XXX */
dc->dc_wid -= 4;
+ /*
+ * XXX XXX turning off 'odd' shouldn't be necesssary,
+ * XXX XXX but i can't make X work with the weird size.
+ */
+ dc->dc_regs[TGA_REG_VHCR] &= ~0x80000001;
+ dc->dc_rowbytes =
+ dc->dc_wid * (dc->dc_tgaconf->tgac_phys_depth / 8);
+ }
dc->dc_ht = (dc->dc_regs[TGA_REG_VVCR] & 0x7ff); /* XXX */
/* XXX this seems to be what DEC does */
+ dc->dc_regs[TGA_REG_CCBR] = 0;
dc->dc_regs[TGA_REG_VVBR] = 1;
dc->dc_videobase = dc->dc_vaddr + tgac->tgac_dbuf[0] +
1 * tgac->tgac_vvbr_units;
+ dc->dc_blanked = 1;
+ tga_unblank(dc);
/*
* Set all bits in the pixel mask, to enable writes to all pixels.
@@ -349,15 +192,6 @@ tga_getdevconfig(pcf, pcfa, pmf, pmfa, tag, dc)
*/
dc->dc_regs[TGA_REG_GPXR_P] = 0xffffffff;
- /* disable the cursor */
- (*tgar->tgar_set_cpos)(dc, TGA_CURSOR_OFF, 0);
-
- /* init black and white color map entries to 'sane' values. */
-#if 0
- (*tgar->tga_set_cmap)(dc, 0, 0, 0, 0);
- (*tgar->tga_set_cmap)(dc, 255, 0xff, 0xff, 0xff);
-#endif
-
/* clear the screen */
for (i = 0; i < dc->dc_ht * dc->dc_rowbytes; i += sizeof(u_int32_t))
*(u_int32_t *)(dc->dc_videobase + i) = 0;
@@ -384,27 +218,56 @@ tgaattach(parent, self, aux)
struct device *parent, *self;
void *aux;
{
- struct pcidev_attach_args *pda = aux;
+ struct pci_attach_args *pa = aux;
struct tga_softc *sc = (struct tga_softc *)self;
- pci_revision_t rev;
+ struct wscons_attach_args waa;
+ struct wscons_odev_spec *wo;
+ pci_intr_handle_t intrh;
+ const char *intrstr;
+ u_int8_t rev;
int console;
- console = (pda->pda_tag == tga_console_dc.dc_pcitag);
+ console = (pa->pa_tag == tga_console_dc.dc_pcitag);
if (console)
sc->sc_dc = &tga_console_dc;
else {
sc->sc_dc = (struct tga_devconfig *)
malloc(sizeof(struct tga_devconfig), M_DEVBUF, M_WAITOK);
- tga_getdevconfig(pda->pda_conffns, pda->pda_confarg,
- pda->pda_memfns, pda->pda_memarg, pda->pda_tag, sc->sc_dc);
+ tga_getdevconfig(pa->pa_bc, pa->pa_pc, pa->pa_tag, sc->sc_dc);
}
if (sc->sc_dc->dc_vaddr == NULL) {
printf(": couldn't map memory space; punt!\n");
return;
}
+ /* XXX say what's going on. */
+ if (sc->sc_dc->dc_tgaconf->tgac_ramdac->tgar_intr != NULL) {
+ if (pci_intr_map(pa->pa_pc, pa->pa_intrtag, pa->pa_intrpin,
+ pa->pa_intrline, &intrh)) {
+ printf(": couldn't map interrupt");
+ return;
+ }
+ intrstr = pci_intr_string(pa->pa_pc, intrh);
+ sc->sc_intr = pci_intr_establish(pa->pa_pc, intrh, IPL_TTY,
+ sc->sc_dc->dc_tgaconf->tgac_ramdac->tgar_intr, sc->sc_dc);
+ if (sc->sc_intr == NULL) {
+ printf(": couldn't establish interrupt");
+ if (intrstr != NULL)
+ printf("at %s", intrstr);
+ printf("\n");
+ return;
+ }
+ }
+
+ /*
+ * Initialize the RAMDAC and allocate any private storage it needs.
+ * Initialization includes disabling cursor, setting a sane
+ * colormap, etc.
+ */
+ (*sc->sc_dc->dc_tgaconf->tgac_ramdac->tgar_init)(sc->sc_dc, 1);
+
printf(": DC21030 ");
- rev = PCI_REVISION(pda->pda_class);
+ rev = PCI_REVISION(pa->pa_class);
switch (rev) {
case 1: case 2: case 3:
printf("step %c", 'A' + rev - 1);
@@ -426,216 +289,276 @@ tgaattach(parent, self, aux)
sc->sc_dc->dc_tgaconf->tgac_phys_depth,
sc->sc_dc->dc_tgaconf->tgac_ramdac->tgar_name);
-#if 0
- /* XXX intr foo? */
-#endif
+ if (intrstr != NULL)
+ printf("%s: interrupting at %s\n", sc->sc_dev.dv_xname,
+ intrstr);
+
+ waa.waa_isconsole = console;
+ wo = &waa.waa_odev_spec;
+ wo->wo_ef = &tga_emulfuncs;
+ wo->wo_efa = &sc->sc_dc->dc_rcons;
+ wo->wo_nrows = sc->sc_dc->dc_rcons.rc_maxrow;
+ wo->wo_ncols = sc->sc_dc->dc_rcons.rc_maxcol;
+ wo->wo_crow = 0;
+ wo->wo_ccol = 0;
+ wo->wo_ioctl = tgaioctl;
+ wo->wo_mmap = tgammap;
+
+ config_found(self, &waa, tgaprint);
+}
- if (!wscattach_output(self, console, &sc->sc_dc->dc_ansicons, &tga_acf,
- &sc->sc_dc->dc_rcons, sc->sc_dc->dc_rcons.rc_maxrow,
- sc->sc_dc->dc_rcons.rc_maxcol, 0, 0)) {
- panic("tgaattach: wscattach failed");
- /* NOTREACHED */
- }
+int
+tgaprint(aux, pnp)
+ void *aux;
+ char *pnp;
+{
+
+ if (pnp)
+ printf("wscons at %s", pnp);
+ return (UNCONF);
}
-#if 0
int
tgaioctl(dev, cmd, data, flag, p)
- dev_t dev;
+ struct device *dev;
u_long cmd;
caddr_t data;
int flag;
struct proc *p;
{
- struct tga_softc *sc = tgacd.cd_devs[TGAUNIT(dev)];
+ struct tga_softc *sc = (struct tga_softc *)dev;
+ struct tga_devconfig *dc = sc->sc_dc;
+ const struct tga_ramdac_conf *tgar = dc->dc_tgaconf->tgac_ramdac;
+
+ switch (cmd) {
+ case FBIOGTYPE:
+#define fbt ((struct fbtype *)data)
+ fbt->fb_type = FBTYPE_TGA;
+ fbt->fb_height = sc->sc_dc->dc_ht;
+ fbt->fb_width = sc->sc_dc->dc_wid;
+ fbt->fb_depth = sc->sc_dc->dc_tgaconf->tgac_phys_depth;
+ fbt->fb_cmsize = 256; /* XXX ??? */
+ fbt->fb_size = sc->sc_dc->dc_tgaconf->tgac_cspace_size;
+#undef fbt
+ return (0);
+
+ case FBIOPUTCMAP:
+ return (*tgar->tgar_set_cmap)(dc, (struct fbcmap *)data);
+
+ case FBIOGETCMAP:
+ return (*tgar->tgar_get_cmap)(dc, (struct fbcmap *)data);
+
+ case FBIOGATTR:
+ return (ENOTTY); /* XXX ? */
- return (ENOTTY);
+ case FBIOSVIDEO:
+ if (*(int *)data == FBVIDEO_OFF)
+ tga_blank(sc->sc_dc);
+ else
+ tga_unblank(sc->sc_dc);
+ return (0);
+
+ case FBIOGVIDEO:
+ *(int *)data = dc->dc_blanked ? FBVIDEO_OFF : FBVIDEO_ON;
+ return (0);
+
+ case FBIOSCURSOR:
+ return (*tgar->tgar_set_cursor)(dc, (struct fbcursor *)data);
+
+ case FBIOGCURSOR:
+ return (*tgar->tgar_get_cursor)(dc, (struct fbcursor *)data);
+
+ case FBIOSCURPOS:
+ return (*tgar->tgar_set_curpos)(dc, (struct fbcurpos *)data);
+
+ case FBIOGCURPOS:
+ return (*tgar->tgar_get_curpos)(dc, (struct fbcurpos *)data);
+
+ case FBIOGCURMAX:
+ return (*tgar->tgar_get_curmax)(dc, (struct fbcurpos *)data);
+ }
+ return (-1);
}
int
-tgammap(dev, offset, nprot)
- dev_t dev;
- int offset;
- int nprot;
+tgammap(dev, offset, prot)
+ struct device *dev;
+ off_t offset;
+ int prot;
{
- struct tga_softc *sc = tgacd.cd_devs[TGAUNIT(dev)];
+ struct tga_softc *sc = (struct tga_softc *)dev;
if (offset > sc->sc_dc->dc_tgaconf->tgac_cspace_size)
return -1;
return alpha_btop(sc->sc_dc->dc_paddr + offset);
}
-#endif
void
-tga_bell(id)
- void *id;
+tga_console(bc, pc, bus, device, function)
+ bus_chipset_tag_t bc;
+ pci_chipset_tag_t pc;
+ int bus, device, function;
{
+ struct tga_devconfig *dcp = &tga_console_dc;
+ struct wscons_odev_spec wo;
+
+ tga_getdevconfig(bc, pc, pci_make_tag(pc, bus, device, function), dcp);
- /* XXX */
- printf("tga_bell: not implemented\n");
+ /* sanity checks */
+ if (dcp->dc_vaddr == NULL)
+ panic("tga_console(%d, %d): couldn't map memory space",
+ device, function);
+ if (dcp->dc_tgaconf == NULL)
+ panic("tga_console(%d, %d): unknown board configuration",
+ device, function);
+
+ /*
+ * Initialize the RAMDAC but DO NOT allocate any private storage.
+ * Initialization includes disabling cursor, setting a sane
+ * colormap, etc. It will be reinitialized in tgaattach().
+ */
+ (*dcp->dc_tgaconf->tgac_ramdac->tgar_init)(dcp, 0);
+
+ wo.wo_ef = &tga_emulfuncs;
+ wo.wo_efa = &dcp->dc_rcons;
+ wo.wo_nrows = dcp->dc_rcons.rc_maxrow;
+ wo.wo_ncols = dcp->dc_rcons.rc_maxcol;
+ wo.wo_crow = 0;
+ wo.wo_ccol = 0;
+ /* ioctl and mmap are unused until real attachment. */
+
+ wscons_attach_console(&wo);
}
+/*
+ * Functions to blank and unblank the display.
+ */
void
-tga_builtin_set_cpos(dc, x, y)
+tga_blank(dc)
struct tga_devconfig *dc;
- int x, y;
{
- if (x == TGA_CURSOR_OFF || y == TGA_CURSOR_OFF) {
-
- dc->dc_regs[TGA_REG_VVVR] &= ~0x04; /* XXX */
- wbflush();
- return;
+ if (!dc->dc_blanked) {
+ dc->dc_blanked = 1;
+ dc->dc_regs[TGA_REG_VVVR] |= 0x02; /* XXX */
}
-
- /*
- * TGA builtin cursor is 0-based, and position is top-left corner.
- */
- dc->dc_regs[TGA_REG_CXYR] =
- (x & 0xfff) | ((y & 0xfff) << 12); /* XXX */
- wbflush();
}
void
-tga_builtin_get_cpos(dc, xp, yp)
+tga_unblank(dc)
struct tga_devconfig *dc;
- int *xp, *yp;
{
- tga_reg_t regval;
- if ((dc->dc_regs[TGA_REG_VVVR] & 0x04) == 0) { /* XXX */
- *xp = *yp = TGA_CURSOR_OFF;
- return;
+ if (dc->dc_blanked) {
+ dc->dc_blanked = 0;
+ dc->dc_regs[TGA_REG_VVVR] &= ~0x02; /* XXX */
}
-
- regval = dc->dc_regs[TGA_REG_CXYR];
- *xp = regval & 0xfff; /* XXX */
- *yp = (regval >> 12) & 0xfff; /* XXX */
}
/*
- * Bt485-specific functions.
+ * Functions to manipulate the built-in cursor handing hardware.
*/
-
-void
-tga_bt485_wr_reg(tgaregs, btreg, val)
- volatile tga_reg_t *tgaregs;
- u_int btreg;
- u_int8_t val;
+int
+tga_builtin_set_cursor(dc, fbc)
+ struct tga_devconfig *dc;
+ struct fbcursor *fbc;
{
+ int v, count;
- if (btreg > BT485_REG_MAX)
- panic("tga_bt485_wr_reg: reg %d out of range\n", btreg);
+ v = fbc->set;
+#if 0
+ if (v & FB_CUR_SETCMAP) /* XXX should be supported */
+ return EINVAL;
+ if (v & FB_CUR_SETSHAPE) {
+ if ((u_int)fbc->size.x != 64 || (u_int)fbc->size.y > 64)
+ return (EINVAL);
+ /* The cursor is 2 bits deep, and there is no mask */
+ count = (fbc->size.y * 64 * 2) / NBBY;
+ if (!useracc(fbc->image, count, B_READ))
+ return (EFAULT);
+ }
+ if (v & FB_CUR_SETHOT) /* not supported */
+ return EINVAL;
+#endif
- tgaregs[TGA_REG_EPDR] = (btreg << 9) | (0 << 8 ) | val; /* XXX */
- wbflush();
+ /* parameters are OK; do it */
+ if (v & FB_CUR_SETCUR) {
+ if (fbc->enable)
+ dc->dc_regs[TGA_REG_VVVR] |= 0x04; /* XXX */
+ else
+ dc->dc_regs[TGA_REG_VVVR] &= ~0x04; /* XXX */
+ }
+#if 0
+ if (v & FB_CUR_SETPOS) {
+ dc->dc_regs[TGA_REG_CXYR] =
+ ((fbc->pos.y & 0xfff) << 12) | (fbc->pos.x & 0xfff);
+ }
+ if (v & FB_CUR_SETCMAP) {
+ /* XXX */
+ }
+ if (v & FB_CUR_SETSHAPE) {
+ dc->dc_regs[TGA_REG_CCBR] =
+ (dc->dc_regs[TGA_REG_CCBR] & ~0xfc00) | (fbc->size.y << 10);
+ copyin(fbc->image, (char *)(dc->dc_vaddr +
+ (dc->dc_regs[TGA_REG_CCBR] & 0x3ff)),
+ count); /* can't fail. */
+ }
+#endif
+ return (0);
}
-u_int8_t
-tga_bt485_rd_reg(tgaregs, btreg)
- volatile tga_reg_t *tgaregs;
- u_int btreg;
+int
+tga_builtin_get_cursor(dc, fbc)
+ struct tga_devconfig *dc;
+ struct fbcursor *fbc;
{
- tga_reg_t rdval;
-
- if (btreg > BT485_REG_MAX)
- panic("tga_bt485_rd_reg: reg %d out of range\n", btreg);
-
- tgaregs[TGA_REG_EPSR] = (btreg << 1) | 0x1; /* XXX */
- wbflush();
-
- rdval = tgaregs[TGA_REG_EPDR];
- return (rdval >> 16) & 0xff; /* XXX */
+ int count, error;
+
+ fbc->set = FB_CUR_SETALL & ~(FB_CUR_SETHOT | FB_CUR_SETCMAP);
+ fbc->enable = (dc->dc_regs[TGA_REG_VVVR] & 0x04) != 0;
+ fbc->pos.x = dc->dc_regs[TGA_REG_CXYR] & 0xfff;
+ fbc->pos.y = (dc->dc_regs[TGA_REG_CXYR] >> 12) & 0xfff;
+ fbc->size.x = 64;
+ fbc->size.y = (dc->dc_regs[TGA_REG_CCBR] >> 10) & 0x3f;
+
+ if (fbc->image != NULL) {
+ count = (fbc->size.y * 64 * 2) / NBBY;
+ error = copyout((char *)(dc->dc_vaddr +
+ (dc->dc_regs[TGA_REG_CCBR] & 0x3ff)),
+ fbc->image, count);
+ if (error)
+ return (error);
+ /* No mask */
+ }
+ /* XXX No color map */
+ return (0);
}
-void
-tga_bt485_set_cpos(dc, x, y)
+int
+tga_builtin_set_curpos(dc, fbp)
struct tga_devconfig *dc;
- int x, y;
+ struct fbcurpos *fbp;
{
- if (x == TGA_CURSOR_OFF || y == TGA_CURSOR_OFF) {
- u_int8_t regval;
-
- regval = tga_bt485_rd_reg(dc->dc_regs, BT485_REG_COMMAND_2);
- regval &= ~0x03; /* XXX */
- regval |= 0x00; /* XXX */
- tga_bt485_wr_reg(dc->dc_regs, BT485_REG_COMMAND_2, regval);
- return;
- }
-
- /*
- * RAMDAC cursors are 1-based, and position is bottom-right
- * of displayed cursor!
- */
- x += 64;
- y += 64;
-
- /* XXX CONSTANTS */
- tga_bt485_rd_reg(dc->dc_regs, BT485_REG_CURSOR_X_LOW/*,
- x & 0xff*/);
- tga_bt485_rd_reg(dc->dc_regs, BT485_REG_CURSOR_X_HIGH/*,
- (x >> 8) & 0x0f*/);
- tga_bt485_rd_reg(dc->dc_regs, BT485_REG_CURSOR_Y_LOW/*,
- y & 0xff*/);
- tga_bt485_rd_reg(dc->dc_regs, BT485_REG_CURSOR_Y_HIGH/*,
- (y >> 8) & 0x0f*/);
+ dc->dc_regs[TGA_REG_CXYR] =
+ ((fbp->y & 0xfff) << 12) | (fbp->x & 0xfff);
}
-void
-tga_bt485_get_cpos(dc, xp, yp)
+int
+tga_builtin_get_curpos(dc, fbp)
struct tga_devconfig *dc;
- int *xp, *yp;
+ struct fbcurpos *fbp;
{
- u_int8_t regval;
- regval = tga_bt485_rd_reg(dc->dc_regs, BT485_REG_COMMAND_2);
- if ((regval & 0x03) == 0x00) { /* XXX */
- *xp = *yp = TGA_CURSOR_OFF;
- return;
- }
-
- regval = tga_bt485_rd_reg(dc->dc_regs, BT485_REG_CURSOR_X_LOW);
- *xp = regval;
- regval = tga_bt485_rd_reg(dc->dc_regs, BT485_REG_CURSOR_X_HIGH);
- *xp |= regval << 8; /* XXX */
-
- regval = tga_bt485_rd_reg(dc->dc_regs, BT485_REG_CURSOR_Y_LOW);
- *yp = regval;
- regval = tga_bt485_rd_reg(dc->dc_regs, BT485_REG_CURSOR_Y_HIGH);
- *yp |= regval << 8; /* XXX */
-
- /*
- * RAMDAC cursors are 1-based, and position is bottom-right
- * of displayed cursor!
- */
- (*xp) -= 64;
- (*yp) -= 64;
+ fbp->x = dc->dc_regs[TGA_REG_CXYR] & 0xfff;
+ fbp->y = (dc->dc_regs[TGA_REG_CXYR] >> 12) & 0xfff;
}
-void
-tga_console(pcf, pcfa, pmf, pmfa, ppf, ppfa, bus, device, function)
- __const struct pci_conf_fns *pcf;
- __const struct pci_mem_fns *pmf;
- __const struct pci_pio_fns *ppf;
- void *pcfa, *pmfa, *ppfa;
- pci_bus_t bus;
- pci_device_t device;
- pci_function_t function;
+int
+tga_builtin_get_curmax(dc, fbp)
+ struct tga_devconfig *dc;
+ struct fbcurpos *fbp;
{
- struct tga_devconfig *dcp = &tga_console_dc;
-
- tga_getdevconfig(pcf, pcfa, pmf, pmfa,
- PCI_MAKE_TAG(bus, device, function), dcp);
-
- /* sanity checks */
- if (dcp->dc_vaddr == NULL)
- panic("tga_console(%d, %d): couldn't map memory space",
- device, function);
- if (dcp->dc_tgaconf == NULL)
- panic("tga_console(%d, %d): unknown board configuration",
- device, function);
- wsc_console(&dcp->dc_ansicons, &tga_acf, &dcp->dc_rcons,
- dcp->dc_rcons.rc_maxrow, dcp->dc_rcons.rc_maxcol, 0, 0);
+ fbp->x = fbp->y = 64;
}
diff --git a/sys/arch/alpha/pci/wsconsvar.h b/sys/arch/alpha/pci/tga_bt463.c
index 77347e07faa..8d581be2ffa 100644
--- a/sys/arch/alpha/pci/wsconsvar.h
+++ b/sys/arch/alpha/pci/tga_bt463.c
@@ -1,21 +1,21 @@
-/* $NetBSD: wsconsvar.h,v 1.1 1995/11/23 02:38:39 cgd Exp $ */
+/* $NetBSD: tga_bt463.c,v 1.2 1996/04/12 06:09:13 cgd Exp $ */
/*
- * Copyright (c) 1995 Carnegie-Mellon University.
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
- *
+ *
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
+ *
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
@@ -27,14 +27,25 @@
* rights to redistribute these changes.
*/
-struct device;
-struct ansicons;
-struct ansicons_functions;
+#include <sys/param.h>
+#include <sys/device.h>
+
+#include <dev/pci/pcivar.h>
+#include <machine/tgareg.h>
+#include <alpha/pci/tgavar.h>
+#include <alpha/pci/bt485reg.h>
+
+#include <machine/fbio.h>
-int wscattach_output __P((struct device *, int, struct ansicons *,
- struct ansicons_functions *, void *, int, int, int, int));
-void wscattach_input __P((struct device *, void *, int (*)(void *),
- void (*)(void *, int)));
-void wscons_kbdinput __P((char *));
-void wsc_console __P((struct ansicons *, struct ansicons_functions *,
- void *, int, int, int, int));
+const struct tga_ramdac_conf tga_ramdac_bt463 = {
+ "Bt463",
+#if 0
+ NULL, /* XXX SET CMAP */
+ NULL, /* XXX GET CMAP */
+ tga_builtin_set_cursor,
+ tga_builtin_get_cursor,
+ tga_builtin_set_curpos,
+ tga_builtin_get_curpos,
+ tga_builtin_get_curmax,
+#endif
+};
diff --git a/sys/arch/alpha/pci/tga_bt485.c b/sys/arch/alpha/pci/tga_bt485.c
new file mode 100644
index 00000000000..45fb5f65b7e
--- /dev/null
+++ b/sys/arch/alpha/pci/tga_bt485.c
@@ -0,0 +1,586 @@
+/* $NetBSD: tga_bt485.c,v 1.2 1996/04/12 06:09:16 cgd Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#include <sys/param.h>
+#include <sys/device.h>
+#include <sys/buf.h>
+#include <sys/kernel.h>
+#include <sys/malloc.h>
+
+#include <dev/pci/pcivar.h>
+#include <machine/tgareg.h>
+#include <alpha/pci/tgavar.h>
+#include <alpha/pci/bt485reg.h>
+
+#include <machine/fbio.h>
+
+/*
+ * Functions exported via the RAMDAC configuration table.
+ */
+void tga_bt485_init __P((struct tga_devconfig *, int));
+int tga_bt485_intr __P((void *));
+int tga_bt485_set_cmap __P((struct tga_devconfig *, struct fbcmap *));
+int tga_bt485_get_cmap __P((struct tga_devconfig *, struct fbcmap *));
+int tga_bt485_set_cursor __P((struct tga_devconfig *, struct fbcursor *));
+int tga_bt485_get_cursor __P((struct tga_devconfig *, struct fbcursor *));
+int tga_bt485_set_curpos __P((struct tga_devconfig *, struct fbcurpos *));
+int tga_bt485_get_curpos __P((struct tga_devconfig *, struct fbcurpos *));
+int tga_bt485_get_curmax __P((struct tga_devconfig *, struct fbcurpos *));
+
+const struct tga_ramdac_conf tga_ramdac_bt485 = {
+ "Bt485",
+ tga_bt485_init,
+ tga_bt485_intr,
+ tga_bt485_set_cmap,
+ tga_bt485_get_cmap,
+ tga_bt485_set_cursor,
+ tga_bt485_get_cursor,
+ tga_bt485_set_curpos,
+ tga_bt485_get_curpos,
+ tga_bt485_get_curmax,
+};
+
+/*
+ * Private data.
+ */
+struct bt485data {
+ int changed; /* what changed; see below */
+ int curenb; /* cursor enabled */
+ struct fbcurpos curpos; /* current cursor position */
+ struct fbcurpos curhot; /* cursor hotspot */
+ char curcmap_r[2]; /* cursor colormap */
+ char curcmap_g[2];
+ char curcmap_b[2];
+ struct fbcurpos cursize; /* current cursor size */
+ char curimage[512]; /* cursor image data */
+ char curmask[512]; /* cursor mask data */
+ char cmap_r[256]; /* colormap */
+ char cmap_g[256];
+ char cmap_b[256];
+};
+
+#define DATA_ENB_CHANGED 0x01 /* cursor enable changed */
+#define DATA_CURCMAP_CHANGED 0x02 /* cursor colormap changed */
+#define DATA_CURSHAPE_CHANGED 0x04 /* cursor size, image, mask changed */
+#define DATA_CMAP_CHANGED 0x08 /* colormap changed */
+#define DATA_ALL_CHANGED 0x0f
+
+#define CURSOR_MAX_SIZE 64
+
+/*
+ * Internal functions.
+ */
+inline void tga_bt485_wr_d __P((volatile tga_reg_t *, u_int, u_int8_t));
+inline u_int8_t tga_bt485_rd_d __P((volatile tga_reg_t *, u_int));
+inline void tga_bt485_wr_i __P((volatile tga_reg_t *, u_int8_t, u_int8_t));
+inline u_int8_t tga_bt485_rd_i __P((volatile tga_reg_t *, u_int8_t));
+void tga_bt485_update __P((struct tga_devconfig *, struct bt485data *));
+void tga_bt485_update_curpos __P((struct tga_devconfig *, struct bt485data *));
+
+#define tga_bt485_sched_update(dc) \
+ ((dc)->dc_regs[TGA_REG_SISR] = 0x00010000) /* XXX */
+
+/*****************************************************************************/
+
+/*
+ * Functions exported via the RAMDAC configuration table.
+ */
+
+void
+tga_bt485_init(dc, alloc)
+ struct tga_devconfig *dc;
+ int alloc;
+{
+ u_int8_t regval;
+ struct bt485data tmp, *data;
+ int i;
+
+ /*
+ * Init the BT485 for normal operation.
+ */
+
+ /*
+ * Allow indirect register access. (Actually, this is
+ * already enabled. In fact, if it is _disabled_, for
+ * some reason the monitor appears to lose sync!!! (?!?!)
+ */
+ regval = tga_bt485_rd_d(dc->dc_regs, BT485_REG_COMMAND_0);
+ regval |= 0x80;
+ tga_bt485_wr_d(dc->dc_regs, BT485_REG_COMMAND_0, regval);
+
+ /* Set the RAMDAC to 8BPP (no interestion options). */
+ tga_bt485_wr_d(dc->dc_regs, BT485_REG_COMMAND_1, 0x40);
+
+ /* Disable the cursor (for now) */
+ regval = tga_bt485_rd_d(dc->dc_regs, BT485_REG_COMMAND_2);
+ regval &= ~0x03;
+ tga_bt485_wr_d(dc->dc_regs, BT485_REG_COMMAND_2, regval);
+
+ /* Use a 64x64x2 cursor */
+ regval = tga_bt485_rd_d(dc->dc_regs, BT485_IREG_COMMAND_3);
+ regval |= 0x04;
+ tga_bt485_wr_d(dc->dc_regs, BT485_IREG_COMMAND_3, regval);
+
+ /*
+ * If we should allocate a new private info struct, do so.
+ * Otherwise, use the one we have (if it's there), or
+ * use the temporary one on the stack.
+ */
+ if (alloc) {
+ if (dc->dc_ramdac_private != NULL)
+ panic("tga_bt485_init: already have private struct");
+ dc->dc_ramdac_private = malloc(sizeof *data, M_DEVBUF,
+ M_WAITOK);
+ }
+ if (dc->dc_ramdac_private != NULL)
+ data = dc->dc_ramdac_private;
+ else
+ data = &tmp;
+
+ /*
+ * Initalize the RAMDAC info struct to hold all of our
+ * data, and fill it in.
+ */
+ data->changed = DATA_ALL_CHANGED;
+
+ data->curenb = 0; /* cursor disabled */
+ data->curpos.x = data->curpos.y = 0; /* right now at 0,0 */
+ data->curhot.x = data->curhot.y = 0; /* hot spot at 0,0 */
+
+ /* initial cursor colormap: 0 is black, 1 is white */
+ data->curcmap_r[0] = data->curcmap_g[0] = data->curcmap_b[0] = 0;
+ data->curcmap_r[1] = data->curcmap_g[1] = data->curcmap_b[1] = 0xff;
+
+ /* initial cursor data: 64x64 block of white. */
+ data->cursize.x = data->cursize.y = 64;
+ for (i = 0; i < 512; i++)
+ data->curimage[i] = data->curmask[i] = 0xff;
+
+ /* Initial colormap: 0 is black, everything else is white */
+ data->cmap_r[0] = data->cmap_g[0] = data->cmap_b[0] = 0;
+ for (i = 1; i < 256; i++)
+ data->cmap_r[i] = data->cmap_g[i] = data->cmap_b[i] = 255;
+
+ tga_bt485_update(dc, data);
+
+ dc->dc_regs[TGA_REG_SISR] = 0x00000001; /* XXX */
+}
+
+int
+tga_bt485_set_cmap(dc, fbc)
+ struct tga_devconfig *dc;
+ struct fbcmap *fbc;
+{
+ struct bt485data *data = dc->dc_ramdac_private;
+ int error, count, index, s;
+
+ if ((u_int)fbc->index >= 256 ||
+ ((u_int)fbc->index + (u_int)fbc->count) > 256)
+ return (EINVAL);
+ if (!useracc(fbc->red, fbc->count, B_READ) ||
+ !useracc(fbc->green, fbc->count, B_READ) ||
+ !useracc(fbc->blue, fbc->count, B_READ))
+ return (EFAULT);
+
+ s = spltty();
+
+ index = fbc->index;
+ count = fbc->count;
+ copyin(fbc->red, &data->cmap_r[index], count);
+ copyin(fbc->green, &data->cmap_g[index], count);
+ copyin(fbc->blue, &data->cmap_b[index], count);
+
+ data->changed |= DATA_CMAP_CHANGED;
+
+ tga_bt485_sched_update(dc);
+ splx(s);
+
+ return (0);
+}
+
+int
+tga_bt485_get_cmap(dc, fbc)
+ struct tga_devconfig *dc;
+ struct fbcmap *fbc;
+{
+ struct bt485data *data = dc->dc_ramdac_private;
+ int error, count, index;
+
+ if ((u_int)fbc->index >= 256 ||
+ ((u_int)fbc->index + (u_int)fbc->count) > 256)
+ return (EINVAL);
+
+ count = fbc->count;
+ index = fbc->index;
+
+ error = copyout(&data->cmap_r[index], fbc->red, count);
+ if (error)
+ return (error);
+ error = copyout(&data->cmap_g[index], fbc->green, count);
+ if (error)
+ return (error);
+ error = copyout(&data->cmap_b[index], fbc->blue, count);
+ return (error);
+}
+
+int
+tga_bt485_set_cursor(dc, fbc)
+ struct tga_devconfig *dc;
+ struct fbcursor *fbc;
+{
+ struct bt485data *data = dc->dc_ramdac_private;
+ int error, count, index, v, s;
+
+ v = fbc->set;
+
+ /*
+ * For SETCMAP and SETSHAPE, verify that parameters are OK
+ * before we do anything that we can't recover from.
+ */
+ if (v & FB_CUR_SETCMAP) {
+ if ((u_int)fbc->cmap.index > 2 ||
+ ((u_int)fbc->cmap.index + (u_int)fbc->cmap.count) > 2)
+ return (EINVAL);
+ count = fbc->cmap.count;
+ if (!useracc(fbc->cmap.red, count, B_READ) ||
+ !useracc(fbc->cmap.green, count, B_READ) ||
+ !useracc(fbc->cmap.blue, count, B_READ))
+ return (EFAULT);
+ }
+ if (v & FB_CUR_SETSHAPE) {
+ if ((u_int)fbc->size.x > CURSOR_MAX_SIZE ||
+ (u_int)fbc->size.y > CURSOR_MAX_SIZE)
+ return (EINVAL);
+ count = (CURSOR_MAX_SIZE / NBBY) * data->cursize.y;
+ if (!useracc(fbc->image, count, B_READ) ||
+ !useracc(fbc->mask, count, B_READ))
+ return (EFAULT);
+ }
+
+ if (v & (FB_CUR_SETPOS | FB_CUR_SETCUR)) {
+ if (v & FB_CUR_SETPOS)
+ data->curpos = fbc->pos;
+ if (v & FB_CUR_SETCUR)
+ data->curhot = fbc->hot;
+ tga_bt485_update_curpos(dc, data);
+ }
+
+ s = spltty();
+
+ /* Parameters are OK; perform the requested operations. */
+ if (v & FB_CUR_SETCUR) {
+ data->curenb = fbc->enable;
+ data->changed |= DATA_ENB_CHANGED;
+ }
+ if (v & FB_CUR_SETCMAP) {
+ count = fbc->cmap.count;
+ index = fbc->cmap.index;
+ copyin(fbc->cmap.red, &data->cmap_r[index], count);
+ copyin(fbc->cmap.green, &data->cmap_g[index], count);
+ copyin(fbc->cmap.blue, &data->cmap_b[index], count);
+ data->changed |= DATA_CURCMAP_CHANGED;
+ }
+ if (v & FB_CUR_SETSHAPE) {
+ data->cursize = fbc->size;
+ count = (CURSOR_MAX_SIZE / NBBY) * data->cursize.y;
+ bzero(data->curimage, sizeof data->curimage);
+ bzero(data->curmask, sizeof data->curmask);
+ copyin(fbc->image, data->curimage, count); /* can't fail */
+ copyin(fbc->mask, data->curmask, count); /* can't fail */
+ data->changed |= DATA_CURSHAPE_CHANGED;
+ }
+
+ if (data->changed)
+ tga_bt485_sched_update(dc);
+ splx(s);
+
+ return (0);
+}
+
+int
+tga_bt485_get_cursor(dc, fbc)
+ struct tga_devconfig *dc;
+ struct fbcursor *fbc;
+{
+ struct bt485data *data = dc->dc_ramdac_private;
+ int error, count;
+
+ fbc->set = FB_CUR_SETALL; /* we return everything they want */
+ fbc->enable = data->curenb; /* SETCUR */
+ fbc->pos = data->curpos; /* SETPOS */
+ fbc->hot = data->curhot; /* SETHOT */
+
+ fbc->cmap.index = 0; /* SETCMAP */
+ fbc->cmap.count = 2;
+ if (fbc->cmap.red != NULL) {
+ error = copyout(data->curcmap_r, fbc->cmap.red, 2);
+ if (error)
+ return (error);
+ }
+ if (fbc->cmap.green != NULL) {
+ error = copyout(data->curcmap_g, fbc->cmap.green, 2);
+ if (error)
+ return (error);
+ }
+ if (fbc->cmap.blue != NULL) {
+ error = copyout(data->curcmap_b, fbc->cmap.blue, 2);
+ if (error)
+ return (error);
+ }
+
+ fbc->size = data->cursize; /* SETSHAPE */
+ if (fbc->image != NULL) {
+ count = (CURSOR_MAX_SIZE / NBBY) * data->cursize.y;
+ error = copyout(data->curimage, fbc->image, count);
+ if (error)
+ return (error);
+ error = copyout(data->curmask, fbc->mask, count);
+ if (error)
+ return (error);
+ }
+
+ return (0);
+}
+
+int
+tga_bt485_set_curpos(dc, fbp)
+ struct tga_devconfig *dc;
+ struct fbcurpos *fbp;
+{
+ struct bt485data *data = dc->dc_ramdac_private;
+
+ data->curpos = *fbp;
+ tga_bt485_update_curpos(dc, data);
+
+ return (0);
+}
+
+int
+tga_bt485_get_curpos(dc, fbp)
+ struct tga_devconfig *dc;
+ struct fbcurpos *fbp;
+{
+ struct bt485data *data = dc->dc_ramdac_private;
+
+ *fbp = data->curpos;
+ return (0);
+}
+
+int
+tga_bt485_get_curmax(dc, fbp)
+ struct tga_devconfig *dc;
+ struct fbcurpos *fbp;
+{
+ struct bt485data *data = dc->dc_ramdac_private;
+
+ fbp->x = fbp->y = CURSOR_MAX_SIZE;
+ return (0);
+}
+
+int
+tga_bt485_intr(v)
+ void *v;
+{
+ struct tga_devconfig *dc = v;
+
+ if ((dc->dc_regs[TGA_REG_SISR] & 0x00010001) != 0x00010001)
+ return 0;
+ tga_bt485_update(dc, dc->dc_ramdac_private);
+ dc->dc_regs[TGA_REG_SISR] = 0x00000001;
+ return (1);
+}
+
+/*****************************************************************************/
+
+/*
+ * Internal functions.
+ */
+
+inline void
+tga_bt485_wr_d(tgaregs, btreg, val)
+ volatile tga_reg_t *tgaregs;
+ u_int btreg;
+ u_int8_t val;
+{
+
+ if (btreg > BT485_REG_MAX)
+ panic("tga_bt485_wr_d: reg %d out of range\n", btreg);
+
+ tgaregs[TGA_REG_EPDR] = (btreg << 9) | (0 << 8 ) | val; /* XXX */
+ wbflush();
+}
+
+inline u_int8_t
+tga_bt485_rd_d(tgaregs, btreg)
+ volatile tga_reg_t *tgaregs;
+ u_int btreg;
+{
+ tga_reg_t rdval;
+
+ if (btreg > BT485_REG_MAX)
+ panic("tga_bt485_rd_d: reg %d out of range\n", btreg);
+
+ tgaregs[TGA_REG_EPSR] = (btreg << 1) | 0x1; /* XXX */
+ wbflush();
+
+ rdval = tgaregs[TGA_REG_EPDR];
+ return (rdval >> 16) & 0xff; /* XXX */
+}
+
+inline void
+tga_bt485_wr_i(tgaregs, ireg, val)
+ volatile tga_reg_t *tgaregs;
+ u_int8_t ireg;
+ u_int8_t val;
+{
+ tga_bt485_wr_d(tgaregs, BT485_REG_PCRAM_WRADDR, ireg);
+ tga_bt485_wr_d(tgaregs, BT485_REG_EXTENDED, val);
+}
+
+inline u_int8_t
+tga_bt485_rd_i(tgaregs, ireg)
+ volatile tga_reg_t *tgaregs;
+ u_int8_t ireg;
+{
+ tga_bt485_wr_d(tgaregs, BT485_REG_PCRAM_WRADDR, ireg);
+ return (tga_bt485_rd_d(tgaregs, BT485_REG_EXTENDED));
+}
+
+void
+tga_bt485_update(dc, data)
+ struct tga_devconfig *dc;
+ struct bt485data *data;
+{
+ u_int8_t regval;
+ int count, i, v;
+
+ v = data->changed;
+ data->changed = 0;
+
+ if (v & DATA_ENB_CHANGED) {
+ regval = tga_bt485_rd_d(dc->dc_regs, BT485_REG_COMMAND_2);
+ if (data->curenb)
+ regval |= 0x01;
+ else
+ regval &= ~0x03;
+ tga_bt485_wr_d(dc->dc_regs, BT485_REG_COMMAND_2, regval);
+ }
+
+ if (v & DATA_CURCMAP_CHANGED) {
+ /* addr[9:0] assumed to be 0 */
+ /* set addr[7:0] to 1 */
+ tga_bt485_wr_d(dc->dc_regs, BT485_REG_COC_WRADDR, 0x01);
+
+ /* spit out the cursor data */
+ for (i = 0; i < 2; i++) {
+ tga_bt485_wr_d(dc->dc_regs, BT485_REG_COCDATA,
+ data->curcmap_r[i]);
+ tga_bt485_wr_d(dc->dc_regs, BT485_REG_COCDATA,
+ data->curcmap_g[i]);
+ tga_bt485_wr_d(dc->dc_regs, BT485_REG_COCDATA,
+ data->curcmap_b[i]);
+ }
+ }
+
+ if (v & DATA_CURSHAPE_CHANGED) {
+ count = (CURSOR_MAX_SIZE / NBBY) * data->cursize.y;
+
+ /*
+ * Write the cursor image data:
+ * set addr[9:8] to 0,
+ * set addr[7:0] to 0,
+ * spit it all out.
+ */
+ regval = tga_bt485_rd_i(dc->dc_regs,
+ BT485_IREG_COMMAND_3);
+ regval &= ~0x03;
+ tga_bt485_wr_i(dc->dc_regs, BT485_IREG_COMMAND_3,
+ regval);
+ tga_bt485_wr_d(dc->dc_regs, BT485_REG_PCRAM_WRADDR, 0);
+ for (i = 0; i < count; i++)
+ tga_bt485_wr_d(dc->dc_regs, BT485_REG_CURSOR_RAM,
+ data->curimage[i]);
+
+ /*
+ * Write the cursor mask data:
+ * set addr[9:8] to 2,
+ * set addr[7:0] to 0,
+ * spit it all out.
+ */
+ regval = tga_bt485_rd_i(dc->dc_regs,
+ BT485_IREG_COMMAND_3);
+ regval &= ~0x03; regval |= 0x02;
+ tga_bt485_wr_i(dc->dc_regs, BT485_IREG_COMMAND_3,
+ regval);
+ tga_bt485_wr_d(dc->dc_regs, BT485_REG_PCRAM_WRADDR, 0);
+ for (i = 0; i < count; i++)
+ tga_bt485_wr_d(dc->dc_regs, BT485_REG_CURSOR_RAM,
+ data->curmask[i]);
+
+ /* set addr[9:0] back to 0 */
+ regval = tga_bt485_rd_i(dc->dc_regs, BT485_IREG_COMMAND_3);
+ regval &= ~0x03;
+ tga_bt485_wr_i(dc->dc_regs, BT485_IREG_COMMAND_3, regval);
+ }
+
+ if (v & DATA_CMAP_CHANGED) {
+ /* addr[9:0] assumed to be 0 */
+ /* set addr[7:0] to 0 */
+ tga_bt485_wr_d(dc->dc_regs, BT485_REG_PCRAM_WRADDR, 0x00);
+
+ /* spit out the cursor data */
+ for (i = 0; i < 256; i++) {
+ tga_bt485_wr_d(dc->dc_regs, BT485_REG_PALETTE,
+ data->cmap_r[i]);
+ tga_bt485_wr_d(dc->dc_regs, BT485_REG_PALETTE,
+ data->cmap_g[i]);
+ tga_bt485_wr_d(dc->dc_regs, BT485_REG_PALETTE,
+ data->cmap_b[i]);
+ }
+ }
+}
+
+void
+tga_bt485_update_curpos(dc, data)
+ struct tga_devconfig *dc;
+ struct bt485data *data;
+{
+ int s, x, y;
+
+ s = spltty();
+
+ x = data->curpos.x + CURSOR_MAX_SIZE - data->curhot.x;
+ y = data->curpos.y + CURSOR_MAX_SIZE - data->curhot.y;
+ tga_bt485_wr_d(dc->dc_regs, BT485_REG_CURSOR_X_LOW, x & 0xff);
+ tga_bt485_wr_d(dc->dc_regs, BT485_REG_CURSOR_X_HIGH, (x >> 8) & 0x0f);
+ tga_bt485_wr_d(dc->dc_regs, BT485_REG_CURSOR_Y_LOW, y & 0xff);
+ tga_bt485_wr_d(dc->dc_regs, BT485_REG_CURSOR_Y_HIGH, (y >> 8) & 0x0f);
+
+ splx(s);
+}
diff --git a/sys/arch/alpha/pci/tga_conf.c b/sys/arch/alpha/pci/tga_conf.c
new file mode 100644
index 00000000000..114e6964789
--- /dev/null
+++ b/sys/arch/alpha/pci/tga_conf.c
@@ -0,0 +1,183 @@
+/* $NetBSD: tga_conf.c,v 1.2 1996/04/12 06:09:18 cgd Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#include <sys/param.h>
+#include <sys/device.h>
+
+#include <dev/pci/pcivar.h>
+#include <machine/tgareg.h>
+#include <alpha/pci/tgavar.h>
+
+#undef KB
+#define KB * 1024
+#undef MB
+#define MB * 1024 * 1024
+
+static const struct tga_conf tga_configs[TGA_TYPE_UNKNOWN] = {
+ /* TGA_TYPE_T8_01 */
+ {
+ "T8-01",
+ &tga_ramdac_bt485,
+ 8,
+ 4 MB,
+ 2 KB,
+ 1, { 2 MB, 0 }, { 1 MB, 0 },
+ 0, { 0, 0 }, { 0, 0 },
+ },
+ /* TGA_TYPE_T8_02 */
+ {
+ "T8-02",
+ &tga_ramdac_bt485,
+ 8,
+ 4 MB,
+ 4 KB,
+ 1, { 2 MB, 0 }, { 2 MB, 0 },
+ 0, { 0, 0 }, { 0, 0 },
+ },
+ /* TGA_TYPE_T8_22 */
+ {
+ "T8-22",
+ &tga_ramdac_bt485,
+ 8,
+ 8 MB,
+ 4 KB,
+ 1, { 4 MB, 0 }, { 2 MB, 0 },
+ 1, { 6 MB, 0 }, { 2 MB, 0 },
+ },
+ /* TGA_TYPE_T8_44 */
+ {
+ "T8-44",
+ &tga_ramdac_bt485,
+ 8,
+ 16 MB,
+ 4 KB,
+ 2, { 8 MB, 12 MB }, { 2 MB, 2 MB },
+ 2, { 10 MB, 14 MB }, { 2 MB, 2 MB },
+ },
+ /* TGA_TYPE_T32_04 */
+ {
+ "T32-04",
+ &tga_ramdac_bt463,
+ 32,
+ 16 MB,
+ 8 KB,
+ 1, { 8 MB, 0 }, { 4 MB, 0 },
+ 0, { 0, 0 }, { 0, 0 },
+ },
+ /* TGA_TYPE_T32_08 */
+ {
+ "T32-08",
+ &tga_ramdac_bt463,
+ 32,
+ 16 MB,
+ 16 KB,
+ 1, { 8 MB, 0 }, { 8 MB, 0 },
+ 0, { 0, 0 }, { 0, 0 },
+ },
+ /* TGA_TYPE_T32_88 */
+ {
+ "T32-88",
+ &tga_ramdac_bt463,
+ 32,
+ 32 MB,
+ 16 KB,
+ 1, { 16 MB, 0 }, { 8 MB, 0 },
+ 1, { 24 MB, 0 }, { 8 MB, 0 },
+ },
+};
+
+#undef KB
+#undef MB
+
+int
+tga_identify(regs)
+ tga_reg_t *regs;
+{
+ int type;
+ int deep, addrmask, wide;
+
+ deep = (regs[TGA_REG_GDER] & 0x1) != 0; /* XXX */
+ addrmask = ((regs[TGA_REG_GDER] >> 2) & 0x7); /* XXX */
+ wide = (regs[TGA_REG_GDER] & 0x200) == 0; /* XXX */
+
+ type = TGA_TYPE_UNKNOWN;
+
+ if (!deep) {
+ /* 8bpp frame buffer */
+
+ if (addrmask == 0x0) {
+ /* 4MB core map; T8-01 or T8-02 */
+
+ if (!wide)
+ type = TGA_TYPE_T8_01;
+ else
+ type = TGA_TYPE_T8_02;
+ } else if (addrmask == 0x1) {
+ /* 8MB core map; T8-22 */
+
+ if (wide) /* sanity */
+ type = TGA_TYPE_T8_22;
+ } else if (addrmask == 0x3) {
+ /* 16MB core map; T8-44 */
+
+ if (wide) /* sanity */
+ type = TGA_TYPE_T8_44;
+ }
+ } else {
+ /* 32bpp frame buffer */
+
+ if (addrmask == 0x3) {
+ /* 16MB core map; T32-04 or T32-08 */
+
+ if (!wide)
+ type = TGA_TYPE_T32_04;
+ else
+ type = TGA_TYPE_T32_08;
+ } else if (addrmask == 0x7) {
+ /* 32MB core map; T32-88 */
+
+ if (wide) /* sanity */
+ type = TGA_TYPE_T32_88;
+ }
+ }
+
+ return (type);
+}
+
+const struct tga_conf *
+tga_getconf(type)
+ int type;
+{
+
+ if (type >= 0 && type < TGA_TYPE_UNKNOWN)
+ return &tga_configs[type];
+
+ return (NULL);
+}
+
diff --git a/sys/arch/alpha/pci/tgavar.h b/sys/arch/alpha/pci/tgavar.h
index b1ab195c624..f4cad9b7777 100644
--- a/sys/arch/alpha/pci/tgavar.h
+++ b/sys/arch/alpha/pci/tgavar.h
@@ -1,7 +1,7 @@
-/* $NetBSD: tgavar.h,v 1.3 1995/11/23 02:38:31 cgd Exp $ */
+/* $NetBSD: tgavar.h,v 1.5 1996/04/12 06:09:21 cgd Exp $ */
/*
- * Copyright (c) 1995 Carnegie-Mellon University.
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -27,27 +27,40 @@
* rights to redistribute these changes.
*/
-#include <alpha/pci/tgareg.h>
+#include <machine/tgareg.h>
#include <dev/rcons/raster.h>
-#include <dev/pseudo/rcons.h>
-#include <dev/pseudo/ansicons.h>
+#include <alpha/wscons/wsconsvar.h>
+#include <alpha/wscons/wscons_raster.h>
struct tga_devconfig;
+struct fbcmap;
+struct fbcursor;
+struct fbcurpos;
struct tga_ramdac_conf {
char *tgar_name;
- void (*tgar_set_cpos) __P((struct tga_devconfig *, int, int));
- void (*tgar_get_cpos) __P((struct tga_devconfig *, int *, int *));
- /* set cursor shape */
- /* set cursor location */
- /* set cursor colormap? */
- /* set colormap? */
+ void (*tgar_init) __P((struct tga_devconfig *, int));
+ int (*tgar_intr) __P((void *));
+ int (*tgar_set_cmap) __P((struct tga_devconfig *,
+ struct fbcmap *));
+ int (*tgar_get_cmap) __P((struct tga_devconfig *,
+ struct fbcmap *));
+ int (*tgar_set_cursor) __P((struct tga_devconfig *,
+ struct fbcursor *));
+ int (*tgar_get_cursor) __P((struct tga_devconfig *,
+ struct fbcursor *));
+ int (*tgar_set_curpos) __P((struct tga_devconfig *,
+ struct fbcurpos *));
+ int (*tgar_get_curpos) __P((struct tga_devconfig *,
+ struct fbcurpos *));
+ int (*tgar_get_curmax) __P((struct tga_devconfig *,
+ struct fbcurpos *));
};
struct tga_conf {
char *tgac_name; /* name for this board type */
- __const struct tga_ramdac_conf
+ const struct tga_ramdac_conf
*tgac_ramdac; /* the RAMDAC type; see above */
int tgac_phys_depth; /* physical frame buffer depth */
vm_size_t tgac_cspace_size; /* core space size */
@@ -63,20 +76,16 @@ struct tga_conf {
};
struct tga_devconfig {
- __const struct pci_conf_fns *dc_pcf;
- void *dc_pcfa;
- __const struct pci_mem_fns *dc_pmf;
- void *dc_pmfa;
- __const struct pci_pio_fns *dc_ppf;
- void *dc_ppfa;
+ bus_chipset_tag_t dc_bc;
+ pci_chipset_tag_t dc_pc;
- pci_conftag_t dc_pcitag; /* PCI tag */
- pci_moffset_t dc_pcipaddr; /* PCI phys addr. */
+ pcitag_t dc_pcitag; /* PCI tag */
+ bus_mem_addr_t dc_pcipaddr; /* PCI phys addr. */
tga_reg_t *dc_regs; /* registers; XXX: need aliases */
int dc_tga_type; /* the device type; see below */
- __const struct tga_conf *dc_tgaconf; /* device buffer configuration */
+ const struct tga_conf *dc_tgaconf; /* device buffer configuration */
vm_offset_t dc_vaddr; /* memory space virtual base address */
vm_offset_t dc_paddr; /* memory space physical base address */
@@ -89,7 +98,9 @@ struct tga_devconfig {
struct raster dc_raster; /* raster description */
struct rcons dc_rcons; /* raster blitter control info */
- struct ansicons dc_ansicons; /* ansi console emulator info XXX */
+
+ int dc_blanked; /* currently had video disabled */
+ void *dc_ramdac_private; /* RAMDAC private storage */
};
struct tga_softc {
@@ -97,6 +108,7 @@ struct tga_softc {
struct tga_devconfig *sc_dc; /* device configuration */
void *sc_intr; /* interrupt handler info */
+ /* XXX should record intr fns/arg */
};
#define TGA_TYPE_T8_01 0 /* 8bpp, 1MB */
@@ -108,13 +120,20 @@ struct tga_softc {
#define TGA_TYPE_T32_88 6 /* 32bpp, 16MB */
#define TGA_TYPE_UNKNOWN 7 /* unknown */
-#define TGA_CURSOR_OFF -1 /* pass to tgar_cpos to disable */
-
#define DEVICE_IS_TGA(class, id) \
- (PCI_VENDOR(id) == PCI_VENDOR_DEC && \
- PCI_PRODUCT(id) == PCI_PRODUCT_DEC_21030)
+ ((PCI_VENDOR(id) == PCI_VENDOR_DEC && \
+ PCI_PRODUCT(id) == PCI_PRODUCT_DEC_21030) ? 10 : 0)
+
+void tga_console __P((bus_chipset_tag_t, pci_chipset_tag_t, int, int, int));
+
+int tga_identify __P((tga_reg_t *));
+const struct tga_conf *tga_getconf __P((int));
+
+extern const struct tga_ramdac_conf tga_ramdac_bt463;
+extern const struct tga_ramdac_conf tga_ramdac_bt485;
-void tga_console __P((__const struct pci_conf_fns *, void *,
- __const struct pci_mem_fns *, void *,
- __const struct pci_pio_fns *, void *,
- pci_bus_t, pci_device_t, pci_function_t));
+int tga_builtin_set_cursor __P((struct tga_devconfig *, struct fbcursor *));
+int tga_builtin_get_cursor __P((struct tga_devconfig *, struct fbcursor *));
+int tga_builtin_set_curpos __P((struct tga_devconfig *, struct fbcurpos *));
+int tga_builtin_get_curpos __P((struct tga_devconfig *, struct fbcurpos *));
+int tga_builtin_get_curmax __P((struct tga_devconfig *, struct fbcurpos *));
diff --git a/sys/arch/alpha/pci/wscons.c b/sys/arch/alpha/pci/wscons.c
deleted file mode 100644
index fa5a988cf09..00000000000
--- a/sys/arch/alpha/pci/wscons.c
+++ /dev/null
@@ -1,383 +0,0 @@
-/* $NetBSD: wscons.c,v 1.3 1995/11/23 02:38:36 cgd Exp $ */
-
-/*
- * Copyright (c) 1995 Carnegie-Mellon University.
- * All rights reserved.
- *
- * Author: Chris G. Demetriou
- *
- * Permission to use, copy, modify and distribute this software and
- * its documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-#include <sys/param.h>
-#include <sys/device.h>
-#include <sys/kernel.h>
-#include <sys/conf.h>
-#include <sys/systm.h>
-#include <sys/ioctl.h>
-#include <sys/proc.h>
-#include <sys/tty.h>
-#include <sys/termios.h>
-
-#include <dev/cons.h>
-#include <dev/pseudo/ansicons.h>
-#include <alpha/pci/wsconsvar.h>
-
-#define NWSC 16 /* XXX XXX XXX */
-
-#define WSCUNIT(dev) minor(dev)
-
-struct wsc_softc {
- int sc_flags;
-
- struct device *sc_odev;
- struct ansicons *sc_ansicons;
-
- struct tty *sc_tty;
-};
-
-#define WSC_INPUT 0x01
-#define WSC_OUTPUT 0x02
-#define WSC_ALIVE (WSC_INPUT | WSC_OUTPUT)
-
-struct wsc_softc wsc_sc[NWSC]; /* XXX XXX XXX */
-int nwsc = NWSC;
-int nextiwsc;
-int nextowsc;
-
-void wscstart __P((struct tty *));
-int wscparam __P((struct tty *, struct termios *));
-
-int wsccngetc __P((dev_t));
-void wsccnputc __P((dev_t, int));
-void wsccnpollc __P((dev_t, int));
-
-struct ansicons *wsc_console_ansicons;
-void *wsc_input_arg;
-int (*wsc_console_getc) __P((void *)) = NULL;
-void (*wsc_console_pollc) __P((void *, int)) = NULL;
-struct consdev wsccons = { NULL, NULL, wsccngetc, wsccnputc,
- wsccnpollc, NODEV, 1 };
-
-int wsc_kbdfocusunit = -1; /* XXX */
-
-int
-wscattach_output(dev, console, acp, acf, acfarg, mrow, mcol, crow, ccol)
- struct device *dev;
- int console;
- struct ansicons *acp;
- struct ansicons_functions *acf;
- void *acfarg;
- int mrow, mcol, crow, ccol;
-{
-
- if (nextowsc >= nwsc)
- return 0;
-
- wsc_sc[nextowsc].sc_odev = dev;
- wsc_sc[nextowsc].sc_ansicons = acp;
-
- if (wsc_kbdfocusunit == -1)
- wsc_kbdfocusunit = nextowsc;
-
- if (!console)
- ansicons_attach(acp, acf, acfarg, mrow, mcol, crow, ccol);
- else {
- wsc_kbdfocusunit = nextowsc;
- wsccons.cn_dev = makedev(25, nextowsc);
- }
-
- wsc_sc[nextowsc].sc_flags |= WSC_OUTPUT;
- wsc_sc[nextowsc].sc_tty = ttymalloc();
-
- printf("wsc%d: %s attached as output\n", nextowsc, dev->dv_xname);
- if (console)
- printf("wsc%d: console\n", nextowsc);
-
- nextowsc++;
- return 1;
-}
-
-void
-wscattach_input(dev, cookie, getc, pollc)
- struct device *dev;
- void *cookie;
- int (*getc) __P((void *));
- void (*pollc) __P((void *, int));
-{
-
- printf("wsc: %s attached as input device\n", dev->dv_xname);
-
- wsc_input_arg = cookie;
- wsc_console_getc = getc;
- wsc_console_pollc = pollc;
-}
-
-int
-wscopen(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- struct wsc_softc *sc;
- int unit = WSCUNIT(dev);
- struct tty *tp;
-
- if (unit >= nwsc)
- return ENXIO;
- sc = &wsc_sc[unit];
- if (sc == 0)
- return ENXIO;
-
- if ((sc->sc_flags & WSC_ALIVE) == 0)
- return ENXIO;
-
- if (!sc->sc_tty)
- panic("wscopen: no tty!");
- tp = sc->sc_tty;
-
- tp->t_oproc = wscstart;
- tp->t_param = wscparam;
- tp->t_dev = dev;
- if ((tp->t_state & TS_ISOPEN) == 0) {
- tp->t_state |= TS_WOPEN;
- ttychars(tp);
- tp->t_iflag = TTYDEF_IFLAG;
- tp->t_oflag = TTYDEF_OFLAG;
- tp->t_cflag = TTYDEF_CFLAG;
- tp->t_lflag = TTYDEF_LFLAG;
- tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
- wscparam(tp, &tp->t_termios);
- ttsetwater(tp);
- } else if ((tp->t_state & TS_XCLUDE) != 0 && p->p_ucred->cr_uid != 0)
- return EBUSY;
- tp->t_state |= TS_CARR_ON;
-
- return ((*linesw[tp->t_line].l_open)(dev, tp));
-}
-
-int
-wscclose(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- struct wsc_softc *sc = &wsc_sc[WSCUNIT(dev)];
- struct tty *tp = sc->sc_tty;
-
- (*linesw[tp->t_line].l_close)(tp, flag);
- ttyclose(tp);
-#ifdef notyet /* XXX */
- ttyfree(tp);
-#endif
- return(0);
-}
-
-int
-wscread(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
-{
- struct wsc_softc *sc = &wsc_sc[WSCUNIT(dev)];
- struct tty *tp = sc->sc_tty;
-
- return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
-}
-
-int
-wscwrite(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
-{
- struct wsc_softc *sc = &wsc_sc[WSCUNIT(dev)];
- struct tty *tp = sc->sc_tty;
-
- return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
-}
-
-struct tty *
-wsctty(dev)
- dev_t dev;
-{
- struct wsc_softc *sc = &wsc_sc[WSCUNIT(dev)];
- struct tty *tp = sc->sc_tty;
-
- return (tp);
-}
-
-int
-wscioctl(dev, cmd, data, flag, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- struct wsc_softc *sc = &wsc_sc[WSCUNIT(dev)];
- struct tty *tp = sc->sc_tty;
- int error;
-
- error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
- if (error >= 0)
- return error;
- error = ttioctl(tp, cmd, data, flag, p);
- if (error >= 0)
- return error;
-
- switch (cmd) {
- default:
- return (ENOTTY);
- }
-
-#ifdef DIAGNOSTIC
- panic("wscioctl: impossible");
-#endif
-}
-
-void
-wscstart(tp)
- register struct tty *tp;
-{
- register int s, n, i;
- char buf[OBUFSIZ];
-
- s = spltty();
- if (tp->t_state & (TS_TIMEOUT | TS_BUSY | TS_TTSTOP)) {
- splx(s);
- return;
- }
- tp->t_state |= TS_BUSY;
- splx(s);
- n = q_to_b(&tp->t_outq, buf, sizeof(buf));
- for (i = 0; i < n; ++i)
- buf[i] &= 0177; /* strip parity (argh) */
- ansicons_input(wsc_sc[WSCUNIT(tp->t_dev)].sc_ansicons, buf, n);
-
- s = spltty();
- tp->t_state &= ~TS_BUSY;
- /* Come back if there's more to do */
- if (tp->t_outq.c_cc) {
- tp->t_state |= TS_TIMEOUT;
- timeout(ttrstrt, tp, 1);
- }
- if (tp->t_outq.c_cc <= tp->t_lowat) {
- if (tp->t_state&TS_ASLEEP) {
- tp->t_state &= ~TS_ASLEEP;
- wakeup((caddr_t)&tp->t_outq);
- }
- selwakeup(&tp->t_wsel);
- }
- splx(s);
-}
-
-void
-wscstop(tp, flag)
- struct tty *tp;
- int flag;
-{
-
-}
-
-/*
- * Set line parameters.
- */
-int
-wscparam(tp, t)
- struct tty *tp;
- struct termios *t;
-{
-
- tp->t_ispeed = t->c_ispeed;
- tp->t_ospeed = t->c_ospeed;
- tp->t_cflag = t->c_cflag;
- return 0;
-}
-
-/*
- * keyboard input!
- */
-void
-wscons_kbdinput(cp)
- char *cp;
-{
- struct wsc_softc *sc;
- struct tty *tp;
-
- if (wsc_kbdfocusunit == -1)
- return;
-
- sc = &wsc_sc[wsc_kbdfocusunit];
- tp = sc->sc_tty;
-
- while (*cp)
- (*linesw[tp->t_line].l_rint)(*cp++, tp);
-}
-
-/*
- * XXX CONSOLE HANDLING GUNK.
- */
-
-void
-wsc_console(acp, acf, acfarg, mrow, mcol, crow, ccol)
- struct ansicons *acp;
- struct ansicons_functions *acf;
- void *acfarg;
- int mrow, mcol, crow, ccol;
-{
-
- wsc_console_ansicons = acp;
- ansicons_attach(acp, acf, acfarg, mrow, mcol, crow, ccol);
-
- cn_tab = &wsccons;
-}
-
-void
-wsccnputc(dev, ic)
- dev_t dev;
- int ic;
-{
- char c = ic;
-
- ansicons_input(wsc_console_ansicons, &c, 1);
-}
-
-int
-wsccngetc(dev)
- dev_t dev;
-{
-
- if (wsc_console_getc != NULL)
- return (*wsc_console_getc)(wsc_input_arg);
- else
- return '\0';
-}
-
-void
-wsccnpollc(dev, i)
- dev_t dev;
- int i;
-{
-
- if (wsc_console_pollc != NULL)
- (*wsc_console_pollc)(wsc_input_arg, i);
-}
diff --git a/sys/arch/alpha/stand/OSFpal.c b/sys/arch/alpha/stand/OSFpal.c
index bfe46b2d727..54fed6eca06 100644
--- a/sys/arch/alpha/stand/OSFpal.c
+++ b/sys/arch/alpha/stand/OSFpal.c
@@ -1,3 +1,31 @@
+/* $NetBSD: OSFpal.c,v 1.2 1996/04/12 06:09:30 cgd Exp $ */
+
+/*
+ * Copyright (c) 1994, 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Keith Bostic
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
#include <sys/types.h>
diff --git a/sys/arch/alpha/stand/bbinfo.h b/sys/arch/alpha/stand/bbinfo.h
index 8da100b28db..e83faf540f7 100644
--- a/sys/arch/alpha/stand/bbinfo.h
+++ b/sys/arch/alpha/stand/bbinfo.h
@@ -1,3 +1,31 @@
+/* $NetBSD: bbinfo.h,v 1.2 1996/04/12 06:09:34 cgd Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
struct bbinfoloc {
u_int64_t magic1;
diff --git a/sys/arch/alpha/stand/boot/Makefile b/sys/arch/alpha/stand/boot/Makefile
index 23c3c283e7c..1c79f284abb 100644
--- a/sys/arch/alpha/stand/boot/Makefile
+++ b/sys/arch/alpha/stand/boot/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.5 1995/11/23 02:39:20 cgd Exp $
+# $NetBSD: Makefile,v 1.6 1996/04/12 01:35:15 cgd Exp $
.PATH: ${.CURDIR}/.. ${.CURDIR}/../../../../lib/libsa
@@ -6,7 +6,7 @@ BOOT_PROG = boot
BOOT_RELOC = ${SECONDARY_LOAD_ADDRESS}
BOOT_SRCS = start.S boot.c disk.c conf.c prom.c prom_disp.S OSFpal.c
-BOOT_SRCS+= alloc.c bzero.c close.c dev.c devopen.c disklabel.c
+BOOT_SRCS+= alloc.c bzero.c close.c dev.c devopen.c disklabel.c dkcksum.c
BOOT_SRCS+= getfile.c gets.c ioctl.c lseek.c open.c printf.c read.c
BOOT_SRCS+= strcmp.c ufs.c write.c bcopy.c filesystem.c strlen.c
BOOT_SRCS+= ntohl.c prom_swpal.S
diff --git a/sys/arch/alpha/stand/boot/boot.c b/sys/arch/alpha/stand/boot/boot.c
index 0abbb15e7e8..85daa6aa43e 100644
--- a/sys/arch/alpha/stand/boot/boot.c
+++ b/sys/arch/alpha/stand/boot/boot.c
@@ -1,4 +1,4 @@
-/* $NetBSD: boot.c,v 1.4 1995/11/23 02:39:27 cgd Exp $ */
+/* $NetBSD: boot.c,v 1.6 1996/05/10 00:15:08 cgd Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -43,15 +43,15 @@
#include <sys/param.h>
#include <sys/exec.h>
+#include <sys/exec_ecoff.h>
#include <machine/prom.h>
-#include "include/coff.h"
#define _KERNEL
#include "include/pte.h"
static int aout_exec __P((int, struct exec *, u_int64_t *));
-static int coff_exec __P((int, struct exechdr *, u_int64_t *));
+static int coff_exec __P((int, struct ecoff_exechdr *, u_int64_t *));
static int loadfile __P((char *, u_int64_t *));
char line[64] = "/netbsd";
@@ -160,7 +160,7 @@ loadfile(fname, entryp)
struct devices *dp;
union {
struct exec aout;
- struct exechdr coff;
+ struct ecoff_exechdr coff;
} hdr;
ssize_t nr;
int fd, rval;
@@ -179,7 +179,7 @@ loadfile(fname, entryp)
}
/* Exec a.out or COFF. */
- rval = N_COFFBADMAG(hdr.coff.a) ?
+ rval = ECOFF_BADMAG(&hdr.coff) ? /* XXX check aouthdr */
aout_exec(fd, &hdr.aout, entryp) :
coff_exec(fd, &hdr.coff, entryp);
@@ -237,13 +237,13 @@ aout_exec(fd, aout, entryp)
static int
coff_exec(fd, coff, entryp)
int fd;
- struct exechdr *coff;
+ struct ecoff_exechdr *coff;
u_int64_t *entryp;
{
/* Read in text. */
(void)printf("%lu", coff->a.tsize);
- (void)lseek(fd, N_COFFTXTOFF(coff->f, coff->a), 0);
+ (void)lseek(fd, ECOFF_TXTOFF(coff), 0);
if (read(fd, (void *)coff->a.text_start, coff->a.tsize) !=
coff->a.tsize) {
(void)printf("read text: %d\n", errno);
diff --git a/sys/arch/alpha/stand/boot/version b/sys/arch/alpha/stand/boot/version
index a7634431ffb..40daa71ed5d 100644
--- a/sys/arch/alpha/stand/boot/version
+++ b/sys/arch/alpha/stand/boot/version
@@ -1,7 +1,8 @@
-$NetBSD: version,v 1.4 1995/11/23 02:40:09 cgd Exp $
+$NetBSD: version,v 1.5 1996/05/09 23:54:18 cgd Exp $
1.1: Initial version
1.2: don't forget the Id string!
1.3: make it work on AlphaStations
-1.4: Re-import from master sources.
-1.5: Complete rewrite of boot block code.
+1.4-1: Re-import from master sources
+1.4-2: Complete rewrite of boot block code
+1.5: Update for new ECOFF headers
diff --git a/sys/arch/alpha/stand/bootxx.c b/sys/arch/alpha/stand/bootxx.c
index 48c21f3c7fa..3707a45fa5a 100644
--- a/sys/arch/alpha/stand/bootxx.c
+++ b/sys/arch/alpha/stand/bootxx.c
@@ -1,3 +1,32 @@
+/* $NetBSD: bootxx.c,v 1.2 1996/04/12 06:09:36 cgd Exp $ */
+
+/*
+ * Copyright (c) 1995 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
#include <sys/param.h>
#include <machine/prom.h>
diff --git a/sys/arch/alpha/stand/headersize.c b/sys/arch/alpha/stand/headersize.c
index f586ff2d734..23d64a5556d 100644
--- a/sys/arch/alpha/stand/headersize.c
+++ b/sys/arch/alpha/stand/headersize.c
@@ -1,7 +1,7 @@
-/* $NetBSD: headersize.c,v 1.1 1995/11/23 02:38:59 cgd Exp $ */
+/* $NetBSD: headersize.c,v 1.3.4.1 1996/06/13 18:35:33 cgd Exp $ */
/*
- * Copyright (c) 1995 Carnegie-Mellon University.
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -29,19 +29,20 @@
#include <sys/types.h>
#include <sys/exec.h>
-#include <machine/coff.h>
+#include <sys/exec_ecoff.h>
#define HDR_BUFSIZE 512
main()
{
char buf[HDR_BUFSIZE];
+ struct ecoff_exechdr *execp;
if (read(0, &buf, HDR_BUFSIZE) < HDR_BUFSIZE) {
perror("read");
exit(1);
}
+ execp = (struct ecoff_exechdr *)buf;
- printf("%d\n", N_COFFTXTOFF(*((struct filehdr *)buf),
- *((struct aouthdr *)(buf + sizeof(struct filehdr)))) );
+ printf("%d\n", ECOFF_TXTOFF(execp));
}
diff --git a/sys/arch/alpha/stand/prom_disp.S b/sys/arch/alpha/stand/prom_disp.S
index aed575a0d98..cfb06148f0a 100644
--- a/sys/arch/alpha/stand/prom_disp.S
+++ b/sys/arch/alpha/stand/prom_disp.S
@@ -1,7 +1,7 @@
-/* $NetBSD: prom_disp.S,v 1.1 1995/11/23 02:39:10 cgd Exp $ */
+/* $NetBSD: prom_disp.S,v 1.3 1996/04/12 06:09:38 cgd Exp $ */
/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
+ * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -27,7 +27,7 @@
* rights to redistribute these changes.
*/
-#ifndef LOCORE
+#ifndef _LOCORE
#include "include/asm.h"
#include "include/prom.h"
#include "include/rpb.h"
diff --git a/sys/arch/alpha/tc/cfb.c b/sys/arch/alpha/tc/cfb.c
new file mode 100644
index 00000000000..1de6783756b
--- /dev/null
+++ b/sys/arch/alpha/tc/cfb.c
@@ -0,0 +1,346 @@
+/* $NetBSD: cfb.c,v 1.1 1996/05/01 23:25:03 cgd Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/device.h>
+#include <sys/malloc.h>
+#include <sys/buf.h>
+#include <sys/conf.h>
+#include <sys/ioctl.h>
+
+#include <machine/bus.h>
+#include <machine/intr.h>
+
+#include <dev/tc/tcvar.h>
+#include <machine/cfbreg.h>
+#include <alpha/tc/cfbvar.h>
+#if 0
+#include <alpha/tc/bt459reg.h>
+#endif
+
+#include <dev/rcons/raster.h>
+#include <alpha/wscons/wscons_raster.h>
+#include <alpha/wscons/wsconsvar.h>
+#include <machine/fbio.h>
+
+#include <machine/autoconf.h>
+#include <machine/pte.h>
+
+int cfbmatch __P((struct device *, void *, void *));
+void cfbattach __P((struct device *, struct device *, void *));
+int cfbprint __P((void *, char *));
+
+struct cfattach cfb_ca = {
+ sizeof(struct cfb_softc), cfbmatch, cfbattach,
+};
+
+struct cfdriver cfb_cd = {
+ NULL, "cfb", DV_DULL,
+};
+
+void cfb_getdevconfig __P((tc_addr_t dense_addr, struct cfb_devconfig *dc));
+struct cfb_devconfig cfb_console_dc;
+
+struct wscons_emulfuncs cfb_emulfuncs = {
+ rcons_cursor, /* could use hardware cursor; punt */
+ rcons_putstr,
+ rcons_copycols,
+ rcons_erasecols,
+ rcons_copyrows,
+ rcons_eraserows,
+};
+
+int cfbioctl __P((struct device *, u_long, caddr_t, int, struct proc *));
+int cfbmmap __P((struct device *, off_t, int));
+
+int cfbintr __P((void *));
+
+int
+cfbmatch(parent, match, aux)
+ struct device *parent;
+ void *match, *aux;
+{
+ struct cfdata *cf = match;
+ struct tc_attach_args *ta = aux;
+
+ if (strncmp("PMAG-BA ", ta->ta_modname, TC_ROM_LLEN) != 0)
+ return (0);
+
+ return (10);
+}
+
+void
+cfb_getdevconfig(dense_addr, dc)
+ tc_addr_t dense_addr;
+ struct cfb_devconfig *dc;
+{
+ struct raster *rap;
+ struct rcons *rcp;
+ char *ramdacregp;
+ int i;
+
+ dc->dc_vaddr = dense_addr;
+ dc->dc_paddr = k0segtophys(dc->dc_vaddr); /* XXX */
+ dc->dc_size = CFB_SIZE;
+
+ ramdacregp = (char *)dc->dc_vaddr + CFB_RAMDAC_OFFSET;
+
+ dc->dc_wid = 1024;
+ dc->dc_ht = 864;
+ dc->dc_depth = 8; /* 8 plane */
+ dc->dc_rowbytes = dc->dc_wid * (dc->dc_depth / 8);
+
+ dc->dc_videobase = dc->dc_vaddr + CFB_FB_OFFSET;
+
+ /* Initialize the RAMDAC/colormap */
+ /* start XXX XXX XXX */
+ (*(volatile u_int32_t *)(ramdacregp + CFB_RAMDAC_ADDRLOW)) = 0;
+ (*(volatile u_int32_t *)(ramdacregp + CFB_RAMDAC_ADDRHIGH)) = 0;
+ tc_wmb();
+ for (i = 0; i < 256; i++) {
+ (*(volatile u_int32_t *)(ramdacregp + CFB_RAMDAC_CMAPDATA)) =
+ i ? 0xff : 0;
+ tc_wmb();
+ (*(volatile u_int32_t *)(ramdacregp + CFB_RAMDAC_CMAPDATA)) =
+ i ? 0xff : 0;
+ tc_wmb();
+ (*(volatile u_int32_t *)(ramdacregp + CFB_RAMDAC_CMAPDATA)) =
+ i ? 0xff : 0;
+ tc_wmb();
+ }
+ /* end XXX XXX XXX */
+
+ /* clear the screen */
+ for (i = 0; i < dc->dc_ht * dc->dc_rowbytes; i += sizeof(u_int32_t))
+ *(u_int32_t *)(dc->dc_videobase + i) = 0x00000000;
+
+ rap = &dc->dc_raster;
+ rap->width = dc->dc_wid;
+ rap->height = dc->dc_ht;
+ rap->depth = 8;
+ rap->linelongs = dc->dc_rowbytes / sizeof(u_int32_t);
+ rap->pixels = (u_int32_t *)dc->dc_videobase;
+
+ /* initialize the raster console blitter */
+ rcp = &dc->dc_rcons;
+ rcp->rc_sp = rap;
+ rcp->rc_crow = rcp->rc_ccol = -1;
+ rcp->rc_crowp = &rcp->rc_crow;
+ rcp->rc_ccolp = &rcp->rc_ccol;
+ rcons_init(rcp, 34, 80);
+}
+
+void
+cfbattach(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ struct cfb_softc *sc = (struct cfb_softc *)self;
+ struct tc_attach_args *ta = aux;
+ struct wscons_attach_args waa;
+ struct wscons_odev_spec *wo;
+ int console;
+ char *x;
+
+ console = 0; /* XXX */
+ if (console)
+ sc->sc_dc = &cfb_console_dc;
+ else {
+ sc->sc_dc = (struct cfb_devconfig *)
+ malloc(sizeof(struct cfb_devconfig), M_DEVBUF, M_WAITOK);
+ cfb_getdevconfig(ta->ta_addr, sc->sc_dc);
+ }
+ if (sc->sc_dc->dc_vaddr == NULL) {
+ printf(": couldn't map memory space; punt!\n");
+ return;
+ }
+ printf(": %d x %d, %dbpp\n", sc->sc_dc->dc_wid, sc->sc_dc->dc_ht,
+ sc->sc_dc->dc_depth);
+
+ /* Establish an interrupt handler, and clear any pending interrupts */
+ tc_intr_establish(parent, ta->ta_cookie, TC_IPL_TTY, cfbintr, sc);
+ *(volatile u_int32_t *)(sc->sc_dc->dc_vaddr + CFB_IREQCTRL_OFFSET) = 0;
+
+ /* initialize the raster */
+ waa.waa_isconsole = console;
+ wo = &waa.waa_odev_spec;
+ wo->wo_ef = &cfb_emulfuncs;
+ wo->wo_efa = &sc->sc_dc->dc_rcons;
+ wo->wo_nrows = sc->sc_dc->dc_rcons.rc_maxrow;
+ wo->wo_ncols = sc->sc_dc->dc_rcons.rc_maxcol;
+ wo->wo_crow = 0;
+ wo->wo_ccol = 0;
+ wo->wo_ioctl = cfbioctl;
+ wo->wo_mmap = cfbmmap;
+
+ config_found(self, &waa, cfbprint);
+}
+
+int
+cfbprint(aux, pnp)
+ void *aux;
+ char *pnp;
+{
+
+ if (pnp)
+ printf("wscons at %s", pnp);
+ return (UNCONF);
+}
+
+int
+cfbioctl(dev, cmd, data, flag, p)
+ struct device *dev;
+ u_long cmd;
+ caddr_t data;
+ int flag;
+ struct proc *p;
+{
+ struct cfb_softc *sc = (struct cfb_softc *)dev;
+ struct cfb_devconfig *dc = sc->sc_dc;
+
+ switch (cmd) {
+ case FBIOGTYPE:
+#define fbt ((struct fbtype *)data)
+ fbt->fb_type = FBTYPE_CFB;
+ fbt->fb_height = sc->sc_dc->dc_ht;
+ fbt->fb_width = sc->sc_dc->dc_wid;
+ fbt->fb_depth = sc->sc_dc->dc_depth;
+ fbt->fb_cmsize = 256; /* XXX ??? */
+ fbt->fb_size = sc->sc_dc->dc_size;
+#undef fbt
+ return (0);
+
+#if 0
+ case FBIOPUTCMAP:
+ return (*tgar->tgar_set_cmap)(dc, (struct fbcmap *)data);
+
+ case FBIOGETCMAP:
+ return (*tgar->tgar_get_cmap)(dc, (struct fbcmap *)data);
+#endif
+
+ case FBIOGATTR:
+ return (ENOTTY); /* XXX ? */
+
+#if 0
+ case FBIOSVIDEO:
+ if (*(int *)data == FBVIDEO_OFF)
+ cfb_blank(sc->sc_dc);
+ else
+ cfb_unblank(sc->sc_dc);
+ return (0);
+#endif
+
+ case FBIOGVIDEO:
+ *(int *)data = dc->dc_blanked ? FBVIDEO_OFF : FBVIDEO_ON;
+ return (0);
+
+#if 0
+ case FBIOSCURSOR:
+ return (*tgar->tgar_set_cursor)(dc, (struct fbcursor *)data);
+
+ case FBIOGCURSOR:
+ return (*tgar->tgar_get_cursor)(dc, (struct fbcursor *)data);
+
+ case FBIOSCURPOS:
+ return (*tgar->tgar_set_curpos)(dc, (struct fbcurpos *)data);
+
+ case FBIOGCURPOS:
+ return (*tgar->tgar_get_curpos)(dc, (struct fbcurpos *)data);
+
+ case FBIOGCURMAX:
+ return (*tgar->tgar_get_curmax)(dc, (struct fbcurpos *)data);
+#endif
+ }
+ return (-1);
+}
+
+int
+cfbmmap(dev, offset, prot)
+ struct device *dev;
+ off_t offset;
+ int prot;
+{
+ struct cfb_softc *sc = (struct cfb_softc *)dev;
+
+ if (offset > CFB_SIZE)
+ return -1;
+ return alpha_btop(sc->sc_dc->dc_paddr + offset);
+}
+
+int
+cfbintr(v)
+ void *v;
+{
+ struct cfb_softc *sc = v;
+
+ *(volatile u_int32_t *)(sc->sc_dc->dc_vaddr + CFB_IREQCTRL_OFFSET) = 0;
+
+ return (1);
+}
+
+#if 0
+void
+tga_console(bc, pc, bus, device, function)
+ bus_chipset_tag_t bc;
+ pci_chipset_tag_t pc;
+ int bus, device, function;
+{
+ struct tga_devconfig *dcp = &tga_console_dc;
+ struct wscons_odev_spec wo;
+
+ tga_getdevconfig(bc, pc, pci_make_tag(pc, bus, device, function), dcp);
+
+ /* sanity checks */
+ if (dcp->dc_vaddr == NULL)
+ panic("tga_console(%d, %d): couldn't map memory space",
+ device, function);
+ if (dcp->dc_tgaconf == NULL)
+ panic("tga_console(%d, %d): unknown board configuration",
+ device, function);
+
+ /*
+ * Initialize the RAMDAC but DO NOT allocate any private storage.
+ * Initialization includes disabling cursor, setting a sane
+ * colormap, etc. It will be reinitialized in tgaattach().
+ */
+ (*dcp->dc_tgaconf->tgac_ramdac->tgar_init)(dcp, 0);
+
+ wo.wo_ef = &tga_emulfuncs;
+ wo.wo_efa = &dcp->dc_rcons;
+ wo.wo_nrows = dcp->dc_rcons.rc_maxrow;
+ wo.wo_ncols = dcp->dc_rcons.rc_maxcol;
+ wo.wo_crow = 0;
+ wo.wo_ccol = 0;
+ /* ioctl and mmap are unused until real attachment. */
+
+ wscons_attach_console(&wo);
+}
+#endif
diff --git a/sys/arch/alpha/tc/cfbvar.h b/sys/arch/alpha/tc/cfbvar.h
new file mode 100644
index 00000000000..bd90951e812
--- /dev/null
+++ b/sys/arch/alpha/tc/cfbvar.h
@@ -0,0 +1,62 @@
+/* $NetBSD: cfbvar.h,v 1.1 1996/05/01 23:25:04 cgd Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#include <machine/cfbreg.h>
+#include <dev/rcons/raster.h>
+#include <alpha/wscons/wsconsvar.h>
+#include <alpha/wscons/wscons_raster.h>
+
+struct cfb_devconfig;
+struct fbcmap;
+struct fbcursor;
+struct fbcurpos;
+
+struct cfb_devconfig {
+ vm_offset_t dc_vaddr; /* memory space virtual base address */
+ vm_offset_t dc_paddr; /* memory space physical base address */
+ vm_offset_t dc_size; /* size of slot memory */
+
+ int dc_wid; /* width of frame buffer */
+ int dc_ht; /* height of frame buffer */
+ int dc_depth; /* depth, bits per pixel */
+ int dc_rowbytes; /* bytes in a FB scan line */
+
+ vm_offset_t dc_videobase; /* base of flat frame buffer */
+
+ struct raster dc_raster; /* raster description */
+ struct rcons dc_rcons; /* raster blitter control info */
+
+ int dc_blanked; /* currently has video disabled */
+};
+
+struct cfb_softc {
+ struct device sc_dev;
+
+ struct cfb_devconfig *sc_dc; /* device configuration */
+};
diff --git a/sys/arch/alpha/tc/esp.c b/sys/arch/alpha/tc/esp.c
index a7ec01b33ae..d1b4a2d2605 100644
--- a/sys/arch/alpha/tc/esp.c
+++ b/sys/arch/alpha/tc/esp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: esp.c,v 1.6 1995/12/20 00:40:21 cgd Exp $ */
+/* $NetBSD: esp.c,v 1.8.4.1 1996/06/05 00:39:03 cgd Exp $ */
/*
* Copyright (c) 1994 Peter Galbavy
@@ -93,9 +93,12 @@ int esp_debug = 0; /*ESP_SHOWPHASE|ESP_SHOWMISC|ESP_SHOWTRAC|ESP_SHOWCMDS;*/
/*static*/ void esp_abort __P((struct esp_softc *, struct ecb *));
/* Linkup to the rest of the kernel */
-struct cfdriver espcd = {
- NULL, "esp", espmatch, espattach,
- DV_DULL, sizeof(struct esp_softc)
+struct cfattach esp_ca = {
+ sizeof(struct esp_softc), espmatch, espattach,
+};
+
+struct cfdriver esp_cd = {
+ NULL, "esp", DV_DULL,
};
struct scsi_adapter esp_switch = {
@@ -190,8 +193,8 @@ espattach(parent, self, aux)
mapiodev(ca->ca_ra.ra_reg, 0, ca->ca_ra.ra_len, ca->ca_bustype);
}
#else
- sc->sc_reg = (volatile u_int32_t *)tcdsdev->tcdsda_tc.tcda_addr;
- sc->sc_cookie = tcdsdev->tcdsda_tc.tcda_cookie;
+ sc->sc_reg = (volatile u_int32_t *)tcdsdev->tcdsda_addr;
+ sc->sc_cookie = tcdsdev->tcdsda_cookie;
sc->sc_dma = tcdsdev->tcdsda_sc;
printf(": address %x", sc->sc_reg);
@@ -213,7 +216,7 @@ espattach(parent, self, aux)
sc->sc_freq = ((struct sbus_softc *)
sc->sc_dev.dv_parent)->sc_clockfreq;
#else
- if (parent->dv_cfdata->cf_driver == &tcdscd) {
+ if (parent->dv_cfdata->cf_driver == &tcds_cd) {
sc->sc_id = tcdsdev->tcdsda_id;
sc->sc_freq = tcdsdev->tcdsda_freq;
} else {
@@ -367,8 +370,8 @@ espattach(parent, self, aux)
sc->sc_ih.ih_fun = (void *) espintr;
sc->sc_ih.ih_arg = sc;
intr_establish(sc->sc_pri, &sc->sc_ih);
-#endif
evcnt_attach(&sc->sc_dev, "intr", &sc->sc_intrcnt);
+#endif
/*
* fill in the prototype scsi_link.
@@ -889,7 +892,7 @@ esp_done(ecb)
if (xs->error == XS_SENSE) {
printf("sense=%2x; ", xs->sense.error_code);
if (xs->sense.error_code == 0x70)
- printf("extcode: %x; ", xs->sense.extended_flags);
+ printf("extcode: %x; ", xs->sense.flags);
}
}
if ((xs->resid || xs->error > XS_SENSE) && esp_debug & ESP_SHOWMISC) {
diff --git a/sys/arch/alpha/tc/ioasic.c b/sys/arch/alpha/tc/ioasic.c
index 209c0e68314..2e154efd1e3 100644
--- a/sys/arch/alpha/tc/ioasic.c
+++ b/sys/arch/alpha/tc/ioasic.c
@@ -1,7 +1,7 @@
-/* $NetBSD: ioasic.c,v 1.1 1995/12/20 00:43:20 cgd Exp $ */
+/* $NetBSD: ioasic.c,v 1.4.4.1 1996/06/05 00:39:05 cgd Exp $ */
/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
+ * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Keith Bostic, Chris G. Demetriou
@@ -35,6 +35,9 @@
#include <machine/autoconf.h>
#include <machine/pte.h>
#include <machine/rpb.h>
+#ifndef EVCNT_COUNTERS
+#include <machine/intrcnt.h>
+#endif
#include <dev/tc/tcvar.h>
#include <alpha/tc/ioasicreg.h>
@@ -51,9 +54,14 @@ struct ioasic_softc {
int ioasicmatch __P((struct device *, void *, void *));
void ioasicattach __P((struct device *, struct device *, void *));
int ioasicprint(void *, char *);
-struct cfdriver ioasiccd =
- { NULL, "ioasic", ioasicmatch, ioasicattach, DV_DULL,
- sizeof(struct ioasic_softc) };
+
+struct cfattach ioasic_ca = {
+ sizeof(struct ioasic_softc), ioasicmatch, ioasicattach,
+};
+
+struct cfdriver ioasic_cd = {
+ NULL, "ioasic", DV_DULL,
+};
int ioasic_intr __P((void *));
int ioasic_intrnull __P((void *));
@@ -75,7 +83,8 @@ struct ioasic_dev {
void *iad_cookie;
u_int32_t iad_intrbits;
} ioasic_devs[] = {
- { "lance ", 0x000c0000, C(IOASIC_DEV_LANCE), IOASIC_INTR_LANCE, },
+ /* XXX lance name */
+ { "lance", 0x000c0000, C(IOASIC_DEV_LANCE), IOASIC_INTR_LANCE, },
{ "z8530 ", 0x00100000, C(IOASIC_DEV_SCC0), IOASIC_INTR_SCC_0, },
{ "z8530 ", 0x00180000, C(IOASIC_DEV_SCC1), IOASIC_INTR_SCC_1, },
{ "TOY_RTC ", 0x00200000, C(IOASIC_DEV_BOGUS), 0, },
@@ -101,10 +110,10 @@ ioasicmatch(parent, cfdata, aux)
void *cfdata;
void *aux;
{
- struct tcdev_attach_args *tcdev = aux;
+ struct tc_attach_args *ta = aux;
/* Make sure that we're looking for this type of device. */
- if (strncmp("FLAMG-IO", tcdev->tcda_modname, TC_ROM_LLEN))
+ if (strncmp("FLAMG-IO", ta->ta_modname, TC_ROM_LLEN))
return (0);
/* Check that it can actually exist. */
@@ -123,15 +132,15 @@ ioasicattach(parent, self, aux)
void *aux;
{
struct ioasic_softc *sc = (struct ioasic_softc *)self;
- struct tcdev_attach_args *tcdev = aux;
+ struct tc_attach_args *ta = aux;
struct ioasicdev_attach_args ioasicdev;
u_long i;
ioasicfound = 1;
- sc->sc_base = tcdev->tcda_addr;
+ sc->sc_base = ta->ta_addr;
ioasic_base = sc->sc_base; /* XXX XXX XXX */
- sc->sc_cookie = tcdev->tcda_cookie;
+ sc->sc_cookie = ta->ta_cookie;
#ifdef DEC_3000_300
if (cputype == ST_DEC_3000_300) {
@@ -292,10 +301,18 @@ ioasic_intr(val)
sir = *sirp;
+#ifdef EVCNT_COUNTERS
+ /* No interrupt counting via evcnt counters */
+ XXX BREAK HERE XXX
+#else /* !EVCNT_COUNTERS */
+#define INCRINTRCNT(slot) intrcnt[INTRCNT_IOASIC + slot]++
+#endif /* EVCNT_COUNTERS */
+
/* XXX DUPLICATION OF INTERRUPT BIT INFORMATION... */
#define CHECKINTR(slot, bits) \
if (sir & bits) { \
ifound = 1; \
+ INCRINTRCNT(slot); \
(*ioasicintrs[slot].iai_func) \
(ioasicintrs[slot].iai_arg); \
}
@@ -335,42 +352,3 @@ ioasic_lance_dma_setup(v)
IOASIC_CSR_DMAEN_LANCE;
tc_mb();
}
-
-#ifdef DEC_3000_300
-void
-ioasic_intr_300_opt0_enable(enable)
- int enable;
-{
-
- if (enable)
- *(volatile u_int32_t *)IOASIC_REG_IMSK(ioasic_base) |=
- IOASIC_INTR_300_OPT0;
- else
- *(volatile u_int32_t *)IOASIC_REG_IMSK(ioasic_base) &=
- ~IOASIC_INTR_300_OPT0;
-}
-
-void
-ioasic_intr_300_opt1_enable(enable)
- int enable;
-{
-
- if (enable)
- *(volatile u_int32_t *)IOASIC_REG_IMSK(ioasic_base) |=
- IOASIC_INTR_300_OPT1;
- else
- *(volatile u_int32_t *)IOASIC_REG_IMSK(ioasic_base) &=
- ~IOASIC_INTR_300_OPT1;
-}
-
-void
-ioasic_300_opts_isintr(opt0, opt1)
- int *opt0, *opt1;
-{
- u_int32_t sir;
-
- sir = *(volatile u_int32_t *)IOASIC_REG_INTR(ioasic_base);
- *opt0 = sir & IOASIC_INTR_300_OPT0;
- *opt1 = sir & IOASIC_INTR_300_OPT1;
-}
-#endif
diff --git a/sys/arch/alpha/tc/mcclock_ioasic.c b/sys/arch/alpha/tc/mcclock_ioasic.c
new file mode 100644
index 00000000000..340a75f82c1
--- /dev/null
+++ b/sys/arch/alpha/tc/mcclock_ioasic.c
@@ -0,0 +1,112 @@
+/* $NetBSD: mcclock_ioasic.c,v 1.2 1996/04/17 22:22:58 cgd Exp $ */
+
+/*
+ * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#include <sys/param.h>
+#include <sys/kernel.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+
+#include <alpha/alpha/clockvar.h>
+#include <alpha/alpha/mcclockvar.h>
+#include <dev/ic/mc146818reg.h>
+#include <dev/tc/tcreg.h>
+#include <dev/tc/tcvar.h>
+#include <dev/tc/ioasicvar.h> /* XXX */
+
+struct mcclock_ioasic_clockdatum {
+ u_char datum;
+ char pad[3];
+};
+
+struct mcclock_ioasic_softc {
+ struct mcclock_softc sc_mcclock;
+
+ struct mcclock_ioasic_clockdatum *sc_dp;
+};
+
+int mcclock_ioasic_match __P((struct device *, void *, void *));
+void mcclock_ioasic_attach __P((struct device *, struct device *, void *));
+
+struct cfattach mcclock_ioasic_ca = {
+ sizeof (struct mcclock_ioasic_softc), mcclock_ioasic_match,
+ mcclock_ioasic_attach,
+};
+
+void mcclock_ioasic_write __P((struct mcclock_softc *, u_int, u_int));
+u_int mcclock_ioasic_read __P((struct mcclock_softc *, u_int));
+
+const struct mcclock_busfns mcclock_ioasic_busfns = {
+ mcclock_ioasic_write, mcclock_ioasic_read,
+};
+
+int
+mcclock_ioasic_match(parent, match, aux)
+ struct device *parent;
+ void *match, *aux;
+{
+ struct ioasicdev_attach_args *d = aux;
+
+ if (strncmp("TOY_RTC ", d->iada_modname, TC_ROM_LLEN))
+ return (0);
+
+ return (1);
+}
+
+void
+mcclock_ioasic_attach(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ struct ioasicdev_attach_args *ioasicdev = aux;
+ struct mcclock_ioasic_softc *sc = (struct mcclock_ioasic_softc *)self;
+
+ sc->sc_dp = (struct mcclock_ioasic_clockdatum *)ioasicdev->iada_addr;
+
+ mcclock_attach(&sc->sc_mcclock, &mcclock_ioasic_busfns);
+}
+
+void
+mcclock_ioasic_write(dev, reg, datum)
+ struct mcclock_softc *dev;
+ u_int reg, datum;
+{
+ struct mcclock_ioasic_softc *sc = (struct mcclock_ioasic_softc *)dev;
+
+ sc->sc_dp[reg].datum = datum;
+}
+
+u_int
+mcclock_ioasic_read(dev, reg)
+ struct mcclock_softc *dev;
+ u_int reg;
+{
+ struct mcclock_ioasic_softc *sc = (struct mcclock_ioasic_softc *)dev;
+
+ return (sc->sc_dp[reg].datum);
+}
diff --git a/sys/arch/alpha/tc/scc.c b/sys/arch/alpha/tc/scc.c
index cb2f4718217..c8b30499bb0 100644
--- a/sys/arch/alpha/tc/scc.c
+++ b/sys/arch/alpha/tc/scc.c
@@ -1,7 +1,7 @@
-/* $NetBSD: scc.c,v 1.11 1995/12/20 00:43:24 cgd Exp $ */
+/* $NetBSD: scc.c,v 1.16.4.2 1996/06/03 19:44:41 cgd Exp $ */
/*
- * Copyright (c) 1991,1990,1989,1994,1995 Carnegie Mellon University
+ * Copyright (c) 1991,1990,1989,1994,1995,1996 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
@@ -63,7 +63,7 @@
* @(#)scc.c 8.2 (Berkeley) 11/30/93
*/
-#include <scc.h>
+#include "scc.h"
#if NSCC > 0
/*
* Intel 82530 dual usart chip driver. Supports the serial port(s) on the
@@ -175,8 +175,14 @@ struct speedtab sccspeedtab[] = {
/* Definition of the driver for autoconfig. */
static int sccmatch(struct device *, void *, void *);
static void sccattach(struct device *, struct device *, void *);
-struct cfdriver scccd =
- { NULL, "scc", sccmatch, sccattach, DV_TTY, sizeof (struct scc_softc) };
+
+struct cfattach scc_ca = {
+ sizeof (struct scc_softc), sccmatch, sccattach,
+};
+
+struct cfdriver scc_cd = {
+ NULL, "scc", DV_TTY,
+};
int sccGetc __P((dev_t));
void sccPutc __P((dev_t, int));
@@ -299,6 +305,8 @@ sccattach(parent, self, aux)
for (cntr = 0; cntr < 2; cntr++) {
pdp->p_addr = (void *)sccaddr;
tp = scc_tty[sc->sc_dv.dv_unit * 2 + cntr] = ttymalloc();
+ if (cntr == 0)
+ tty_attach(tp);
pdp->p_arg = (long)tp;
pdp->p_fcn = (void (*)())0;
tp->t_dev = (dev_t)((sc->sc_dv.dv_unit << 1) | cntr);
@@ -349,7 +357,7 @@ sccattach(parent, self, aux)
s = spltty();
ctty.t_dev = makedev(SCCDEV,
sc->sc_dv.dv_unit == 0 ? SCCCOMM2_PORT : SCCCOMM3_PORT);
- cterm.c_cflag = CS8;
+ cterm.c_cflag = (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8;
cterm.c_ospeed = cterm.c_ispeed = 9600;
(void) sccparam(&ctty, &cterm);
DELAY(1000);
@@ -457,9 +465,9 @@ sccopen(dev, flag, mode, p)
int s, error = 0;
unit = SCCUNIT(dev);
- if (unit >= scccd.cd_ndevs)
+ if (unit >= scc_cd.cd_ndevs)
return (ENXIO);
- sc = scccd.cd_devs[unit];
+ sc = scc_cd.cd_devs[unit];
if (!sc)
return (ENXIO);
@@ -467,8 +475,10 @@ sccopen(dev, flag, mode, p)
if (sc->scc_pdma[line].p_addr == NULL)
return (ENXIO);
tp = scc_tty[minor(dev)];
- if (tp == NULL)
+ if (tp == NULL) {
tp = scc_tty[minor(dev)] = ttymalloc();
+ tty_attach(tp);
+ }
tp->t_oproc = sccstart;
tp->t_param = sccparam;
tp->t_dev = dev;
@@ -514,7 +524,7 @@ sccclose(dev, flag, mode, p)
int flag, mode;
struct proc *p;
{
- register struct scc_softc *sc = scccd.cd_devs[SCCUNIT(dev)];
+ register struct scc_softc *sc = scc_cd.cd_devs[SCCUNIT(dev)];
register struct tty *tp;
register int line;
@@ -586,7 +596,7 @@ sccioctl(dev, cmd, data, flag, p)
return (error);
line = SCCLINE(dev);
- sc = scccd.cd_devs[SCCUNIT(dev)];
+ sc = scc_cd.cd_devs[SCCUNIT(dev)];
switch (cmd) {
case TIOCSBRK:
@@ -671,7 +681,7 @@ sccparam(tp, t)
return (0);
}
- sc = scccd.cd_devs[SCCUNIT(tp->t_dev)];
+ sc = scc_cd.cd_devs[SCCUNIT(tp->t_dev)];
line = SCCLINE(tp->t_dev);
regs = (scc_regmap_t *)sc->scc_pdma[line].p_addr;
@@ -786,7 +796,7 @@ sccintr(xxxunit)
register int cc, chan, rr1, rr2, rr3;
int overrun = 0;
- sc = scccd.cd_devs[unit];
+ sc = scc_cd.cd_devs[unit];
regs = (scc_regmap_t *)sc->scc_pdma[0].p_addr;
unit <<= 1;
for (;;) {
@@ -948,7 +958,7 @@ sccstart(tp)
u_char temp;
int s, sendone;
- sc = scccd.cd_devs[SCCUNIT(tp->t_dev)];
+ sc = scc_cd.cd_devs[SCCUNIT(tp->t_dev)];
dp = &sc->scc_pdma[SCCLINE(tp->t_dev)];
regs = (scc_regmap_t *)dp->p_addr;
s = spltty();
@@ -982,6 +992,7 @@ sccstart(tp)
}
goto out;
}
+#if 0
if (tp->t_flags & (RAW|LITOUT))
cc = ndqb(&tp->t_outq, 0);
else {
@@ -993,6 +1004,9 @@ sccstart(tp)
goto out;
}
}
+#else
+ cc = ndqb(&tp->t_outq, 0);
+#endif
tp->t_state |= TS_BUSY;
dp->p_end = dp->p_mem = tp->t_outq.c_cf;
dp->p_end += cc;
@@ -1034,7 +1048,7 @@ sccstop(tp, flag)
register struct scc_softc *sc;
register int s;
- sc = scccd.cd_devs[SCCUNIT(tp->t_dev)];
+ sc = scc_cd.cd_devs[SCCUNIT(tp->t_dev)];
dp = &sc->scc_pdma[SCCLINE(tp->t_dev)];
s = spltty();
if (tp->t_state & TS_BUSY) {
@@ -1058,7 +1072,7 @@ sccmctl(dev, bits, how)
register u_char value;
int s;
- sc = scccd.cd_devs[SCCUNIT(dev)];
+ sc = scc_cd.cd_devs[SCCUNIT(dev)];
line = SCCLINE(dev);
regs = (scc_regmap_t *)sc->scc_pdma[line].p_addr;
s = spltty();
@@ -1122,7 +1136,7 @@ scc_modem_intr(dev)
register u_char value;
int s;
- sc = scccd.cd_devs[SCCUNIT(dev)];
+ sc = scc_cd.cd_devs[SCCUNIT(dev)];
tp = scc_tty[minor(dev)];
chan = SCCLINE(dev);
regs = (scc_regmap_t *)sc->scc_pdma[chan].p_addr;
@@ -1160,7 +1174,7 @@ sccGetc(dev)
int s;
line = SCCLINE(dev);
- sc = scccd.cd_devs[SCCUNIT(dev)];
+ sc = scc_cd.cd_devs[SCCUNIT(dev)];
regs = (scc_regmap_t *)sc->scc_pdma[line].p_addr;
if (!regs)
return (0);
@@ -1202,7 +1216,7 @@ sccPutc(dev, c)
s = splhigh();
line = SCCLINE(dev);
- sc = scccd.cd_devs[SCCUNIT(dev)];
+ sc = scc_cd.cd_devs[SCCUNIT(dev)];
regs = (scc_regmap_t *)sc->scc_pdma[line].p_addr;
/*
diff --git a/sys/arch/alpha/tc/sfb.c b/sys/arch/alpha/tc/sfb.c
new file mode 100644
index 00000000000..acf0d68da63
--- /dev/null
+++ b/sys/arch/alpha/tc/sfb.c
@@ -0,0 +1,411 @@
+/* $NetBSD: sfb.c,v 1.1 1996/05/01 21:15:50 cgd Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/device.h>
+#include <sys/malloc.h>
+#include <sys/buf.h>
+#include <sys/conf.h>
+#include <sys/ioctl.h>
+
+#include <machine/bus.h>
+#include <machine/intr.h>
+
+#include <dev/tc/tcvar.h>
+#include <machine/sfbreg.h>
+#include <alpha/tc/sfbvar.h>
+#if 0
+#include <alpha/tc/bt459reg.h>
+#endif
+
+#include <dev/rcons/raster.h>
+#include <alpha/wscons/wscons_raster.h>
+#include <alpha/wscons/wsconsvar.h>
+#include <machine/fbio.h>
+
+#include <machine/autoconf.h>
+#include <machine/pte.h>
+
+int sfbmatch __P((struct device *, void *, void *));
+void sfbattach __P((struct device *, struct device *, void *));
+int sfbprint __P((void *, char *));
+
+struct cfattach sfb_ca = {
+ sizeof(struct sfb_softc), sfbmatch, sfbattach,
+};
+
+struct cfdriver sfb_cd = {
+ NULL, "sfb", DV_DULL,
+};
+
+void sfb_getdevconfig __P((tc_addr_t dense_addr, struct sfb_devconfig *dc));
+struct sfb_devconfig sfb_console_dc;
+
+struct wscons_emulfuncs sfb_emulfuncs = {
+ rcons_cursor, /* could use hardware cursor; punt */
+ rcons_putstr,
+ rcons_copycols,
+ rcons_erasecols,
+ rcons_copyrows,
+ rcons_eraserows,
+};
+
+int sfbioctl __P((struct device *, u_long, caddr_t, int, struct proc *));
+int sfbmmap __P((struct device *, off_t, int));
+
+#if 0
+void sfb_blank __P((struct sfb_devconfig *));
+void sfb_unblank __P((struct sfb_devconfig *));
+#endif
+
+int
+sfbmatch(parent, match, aux)
+ struct device *parent;
+ void *match, *aux;
+{
+ struct cfdata *cf = match;
+ struct tc_attach_args *ta = aux;
+
+ if (strncmp("PMAGB-BA", ta->ta_modname, TC_ROM_LLEN) != 0)
+ return (0);
+
+ return (10);
+}
+
+void
+sfb_getdevconfig(dense_addr, dc)
+ tc_addr_t dense_addr;
+ struct sfb_devconfig *dc;
+{
+ struct raster *rap;
+ struct rcons *rcp;
+ char *regp, *ramdacregp;
+ int i;
+
+ dc->dc_vaddr = dense_addr;
+ dc->dc_paddr = k0segtophys(dc->dc_vaddr); /* XXX */
+ dc->dc_size = SFB_SIZE;
+
+ regp = (char *)dc->dc_vaddr + SFB_ASIC_OFFSET;
+ ramdacregp = (char *)dc->dc_vaddr + SFB_RAMDAC_OFFSET;
+
+ dc->dc_wid =
+ (*(volatile u_int32_t *)(regp + SFB_ASIC_VIDEO_HSETUP) & 0x1ff) * 4;
+ dc->dc_ht =
+ (*(volatile u_int32_t *)(regp + SFB_ASIC_VIDEO_VSETUP) & 0x7ff);
+
+ switch (*(volatile u_int32_t *)(regp + SFB_ASIC_DEEP)) {
+ case 0:
+ case 1: /* XXX by the book; wrong? */
+ dc->dc_depth = 8; /* 8 plane */
+ break;
+ case 2:
+ dc->dc_depth = 16; /* 16 plane */
+ break;
+ case 4:
+ dc->dc_depth = 32; /* 32 plane */
+ break;
+ default:
+ dc->dc_depth = 8; /* XXX can't happen? */
+ break;
+ }
+
+ dc->dc_rowbytes = dc->dc_wid * (dc->dc_depth / 8);
+
+ dc->dc_videobase = dc->dc_vaddr + SFB_FB_OFFSET +
+ ((*(volatile u_int32_t *)(regp + SFB_ASIC_VIDEO_BASE)) *
+ 4096 * (dc->dc_depth / 8));
+
+ (*(volatile u_int32_t *)(regp + SFB_ASIC_MODE)) = 0;
+ tc_wmb();
+ (*(volatile u_int32_t *)(regp + SFB_ASIC_VIDEO_VALID)) = 1;
+ tc_wmb();
+
+ /*
+ * Set all bits in the pixel mask, to enable writes to all pixels.
+ * It seems that the console firmware clears some of them
+ * under some circumstances, which causes cute vertical stripes.
+ */
+ (*(volatile u_int32_t *)(regp + SFB_ASIC_PIXELMASK)) = 0xffffffff;
+ tc_wmb();
+ (*(volatile u_int32_t *)(regp + SFB_ASIC_PLANEMASK)) = 0xffffffff;
+ tc_wmb();
+
+ /* Initialize the RAMDAC/colormap */
+ /* start XXX XXX XXX */
+ (*(volatile u_int32_t *)(ramdacregp + SFB_RAMDAC_ADDRLOW)) = 0;
+ (*(volatile u_int32_t *)(ramdacregp + SFB_RAMDAC_ADDRHIGH)) = 0;
+ tc_wmb();
+ for (i = 0; i < 256; i++) {
+ (*(volatile u_int32_t *)(ramdacregp + SFB_RAMDAC_CMAPDATA)) =
+ i ? 0xff : 0;
+ tc_wmb();
+ (*(volatile u_int32_t *)(ramdacregp + SFB_RAMDAC_CMAPDATA)) =
+ i ? 0xff : 0;
+ tc_wmb();
+ (*(volatile u_int32_t *)(ramdacregp + SFB_RAMDAC_CMAPDATA)) =
+ i ? 0xff : 0;
+ tc_wmb();
+ }
+ /* end XXX XXX XXX */
+
+ /* clear the screen */
+ for (i = 0; i < dc->dc_ht * dc->dc_rowbytes; i += sizeof(u_int32_t))
+ *(u_int32_t *)(dc->dc_videobase + i) = 0x00000000;
+
+ /* initialize the raster */
+ rap = &dc->dc_raster;
+ rap->width = dc->dc_wid;
+ rap->height = dc->dc_ht;
+ rap->depth = 8;
+ rap->linelongs = dc->dc_rowbytes / sizeof(u_int32_t);
+ rap->pixels = (u_int32_t *)dc->dc_videobase;
+
+ /* initialize the raster console blitter */
+ rcp = &dc->dc_rcons;
+ rcp->rc_sp = rap;
+ rcp->rc_crow = rcp->rc_ccol = -1;
+ rcp->rc_crowp = &rcp->rc_crow;
+ rcp->rc_ccolp = &rcp->rc_ccol;
+ rcons_init(rcp, 34, 80);
+}
+
+void
+sfbattach(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ struct sfb_softc *sc = (struct sfb_softc *)self;
+ struct tc_attach_args *ta = aux;
+ struct wscons_attach_args waa;
+ struct wscons_odev_spec *wo;
+ int console;
+ char *x;
+
+ console = 0; /* XXX */
+ if (console)
+ sc->sc_dc = &sfb_console_dc;
+ else {
+ sc->sc_dc = (struct sfb_devconfig *)
+ malloc(sizeof(struct sfb_devconfig), M_DEVBUF, M_WAITOK);
+ sfb_getdevconfig(ta->ta_addr, sc->sc_dc);
+ }
+ if (sc->sc_dc->dc_vaddr == NULL) {
+ printf(": couldn't map memory space; punt!\n");
+ return;
+ }
+ printf(": %d x %d, %dbpp\n", sc->sc_dc->dc_wid, sc->sc_dc->dc_ht,
+ sc->sc_dc->dc_depth);
+
+#if 0
+ x = (char *)ta->ta_addr + SFB_ASIC_OFFSET;
+ printf("%s: Video Base Address = 0x%x\n", self->dv_xname,
+ *(u_int32_t *)(x + SFB_ASIC_VIDEO_BASE));
+ printf("%s: Horizontal Setup = 0x%x\n", self->dv_xname,
+ *(u_int32_t *)(x + SFB_ASIC_VIDEO_HSETUP));
+ printf("%s: Vertical Setup = 0x%x\n", self->dv_xname,
+ *(u_int32_t *)(x + SFB_ASIC_VIDEO_VSETUP));
+#endif
+
+ waa.waa_isconsole = console;
+ wo = &waa.waa_odev_spec;
+ wo->wo_ef = &sfb_emulfuncs;
+ wo->wo_efa = &sc->sc_dc->dc_rcons;
+ wo->wo_nrows = sc->sc_dc->dc_rcons.rc_maxrow;
+ wo->wo_ncols = sc->sc_dc->dc_rcons.rc_maxcol;
+ wo->wo_crow = 0;
+ wo->wo_ccol = 0;
+ wo->wo_ioctl = sfbioctl;
+ wo->wo_mmap = sfbmmap;
+
+ config_found(self, &waa, sfbprint);
+}
+
+int
+sfbprint(aux, pnp)
+ void *aux;
+ char *pnp;
+{
+
+ if (pnp)
+ printf("wscons at %s", pnp);
+ return (UNCONF);
+}
+
+int
+sfbioctl(dev, cmd, data, flag, p)
+ struct device *dev;
+ u_long cmd;
+ caddr_t data;
+ int flag;
+ struct proc *p;
+{
+ struct sfb_softc *sc = (struct sfb_softc *)dev;
+ struct sfb_devconfig *dc = sc->sc_dc;
+
+ switch (cmd) {
+ case FBIOGTYPE:
+#define fbt ((struct fbtype *)data)
+ fbt->fb_type = FBTYPE_SFB;
+ fbt->fb_height = sc->sc_dc->dc_ht;
+ fbt->fb_width = sc->sc_dc->dc_wid;
+ fbt->fb_depth = sc->sc_dc->dc_depth;
+ fbt->fb_cmsize = 256; /* XXX ??? */
+ fbt->fb_size = sc->sc_dc->dc_size;
+#undef fbt
+ return (0);
+
+#if 0
+ case FBIOPUTCMAP:
+ return (*tgar->tgar_set_cmap)(dc, (struct fbcmap *)data);
+
+ case FBIOGETCMAP:
+ return (*tgar->tgar_get_cmap)(dc, (struct fbcmap *)data);
+#endif
+
+ case FBIOGATTR:
+ return (ENOTTY); /* XXX ? */
+
+#if 0
+ case FBIOSVIDEO:
+ if (*(int *)data == FBVIDEO_OFF)
+ sfb_blank(sc->sc_dc);
+ else
+ sfb_unblank(sc->sc_dc);
+ return (0);
+#endif
+
+ case FBIOGVIDEO:
+ *(int *)data = dc->dc_blanked ? FBVIDEO_OFF : FBVIDEO_ON;
+ return (0);
+
+#if 0
+ case FBIOSCURSOR:
+ return (*tgar->tgar_set_cursor)(dc, (struct fbcursor *)data);
+
+ case FBIOGCURSOR:
+ return (*tgar->tgar_get_cursor)(dc, (struct fbcursor *)data);
+
+ case FBIOSCURPOS:
+ return (*tgar->tgar_set_curpos)(dc, (struct fbcurpos *)data);
+
+ case FBIOGCURPOS:
+ return (*tgar->tgar_get_curpos)(dc, (struct fbcurpos *)data);
+
+ case FBIOGCURMAX:
+ return (*tgar->tgar_get_curmax)(dc, (struct fbcurpos *)data);
+#endif
+ }
+ return (-1);
+}
+
+int
+sfbmmap(dev, offset, prot)
+ struct device *dev;
+ off_t offset;
+ int prot;
+{
+ struct sfb_softc *sc = (struct sfb_softc *)dev;
+
+ if (offset > SFB_SIZE)
+ return -1;
+ return alpha_btop(sc->sc_dc->dc_paddr + offset);
+}
+
+#if 0
+void
+tga_console(bc, pc, bus, device, function)
+ bus_chipset_tag_t bc;
+ pci_chipset_tag_t pc;
+ int bus, device, function;
+{
+ struct tga_devconfig *dcp = &tga_console_dc;
+ struct wscons_odev_spec wo;
+
+ tga_getdevconfig(bc, pc, pci_make_tag(pc, bus, device, function), dcp);
+
+ /* sanity checks */
+ if (dcp->dc_vaddr == NULL)
+ panic("tga_console(%d, %d): couldn't map memory space",
+ device, function);
+ if (dcp->dc_tgaconf == NULL)
+ panic("tga_console(%d, %d): unknown board configuration",
+ device, function);
+
+ /*
+ * Initialize the RAMDAC but DO NOT allocate any private storage.
+ * Initialization includes disabling cursor, setting a sane
+ * colormap, etc. It will be reinitialized in tgaattach().
+ */
+ (*dcp->dc_tgaconf->tgac_ramdac->tgar_init)(dcp, 0);
+
+ wo.wo_ef = &tga_emulfuncs;
+ wo.wo_efa = &dcp->dc_rcons;
+ wo.wo_nrows = dcp->dc_rcons.rc_maxrow;
+ wo.wo_ncols = dcp->dc_rcons.rc_maxcol;
+ wo.wo_crow = 0;
+ wo.wo_ccol = 0;
+ /* ioctl and mmap are unused until real attachment. */
+
+ wscons_attach_console(&wo);
+}
+#endif
+
+#if 0
+/*
+ * Functions to blank and unblank the display.
+ */
+void
+sfb_blank(dc)
+ struct sfb_devconfig *dc;
+{
+ char *regp = (char *)dc->dc_vaddr + SFB_ASIC_OFFSET;
+
+ if (!dc->dc_blanked) {
+ dc->dc_blanked = 1;
+ *(volatile u_int32_t *)(regp + SFB_ASIC_VIDEO_VALID) = 0;
+ tc_wmb();
+ }
+}
+
+void
+sfb_unblank(dc)
+ struct sfb_devconfig *dc;
+{
+ char *regp = (char *)dc->dc_vaddr + SFB_ASIC_OFFSET;
+
+ if (dc->dc_blanked) {
+ dc->dc_blanked = 0;
+ *(volatile u_int32_t *)(regp + SFB_ASIC_VIDEO_VALID) = 1;
+ tc_wmb();
+ }
+}
+#endif
diff --git a/sys/arch/alpha/tc/sfbvar.h b/sys/arch/alpha/tc/sfbvar.h
new file mode 100644
index 00000000000..afcd451f0f0
--- /dev/null
+++ b/sys/arch/alpha/tc/sfbvar.h
@@ -0,0 +1,62 @@
+/* $NetBSD: sfbvar.h,v 1.1 1996/05/01 21:15:51 cgd Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#include <machine/sfbreg.h>
+#include <dev/rcons/raster.h>
+#include <alpha/wscons/wsconsvar.h>
+#include <alpha/wscons/wscons_raster.h>
+
+struct sfb_devconfig;
+struct fbcmap;
+struct fbcursor;
+struct fbcurpos;
+
+struct sfb_devconfig {
+ vm_offset_t dc_vaddr; /* memory space virtual base address */
+ vm_offset_t dc_paddr; /* memory space physical base address */
+ vm_offset_t dc_size; /* size of slot memory */
+
+ int dc_wid; /* width of frame buffer */
+ int dc_ht; /* height of frame buffer */
+ int dc_depth; /* depth, bits per pixel */
+ int dc_rowbytes; /* bytes in a FB scan line */
+
+ vm_offset_t dc_videobase; /* base of flat frame buffer */
+
+ struct raster dc_raster; /* raster description */
+ struct rcons dc_rcons; /* raster blitter control info */
+
+ int dc_blanked; /* currently has video disabled */
+};
+
+struct sfb_softc {
+ struct device sc_dev;
+
+ struct sfb_devconfig *sc_dc; /* device configuration */
+};
diff --git a/sys/arch/alpha/tc/tc_3000_300.c b/sys/arch/alpha/tc/tc_3000_300.c
index 571afab6148..0321893acdb 100644
--- a/sys/arch/alpha/tc/tc_3000_300.c
+++ b/sys/arch/alpha/tc/tc_3000_300.c
@@ -1,7 +1,7 @@
-/* $NetBSD: tc_3000_300.c,v 1.4 1995/12/20 00:43:27 cgd Exp $ */
+/* $NetBSD: tc_3000_300.c,v 1.7.4.1 1996/06/05 00:39:06 cgd Exp $ */
/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
+ * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -32,10 +32,14 @@
#include <machine/autoconf.h>
#include <machine/pte.h>
+#ifndef EVCNT_COUNTERS
+#include <machine/intrcnt.h>
+#endif
#include <dev/tc/tcvar.h>
#include <alpha/tc/tc_conf.h>
#include <alpha/tc/tc_3000_300.h>
+#include <alpha/tc/ioasicreg.h>
void tc_3000_300_intr_setup __P((void));
void tc_3000_300_intr_establish __P((struct device *, void *,
@@ -48,6 +52,14 @@ int tc_3000_300_intrnull __P((void *));
#define C(x) ((void *)(u_long)x)
#define KV(x) (phystok0seg(x))
+/*
+ * We have to read and modify the IOASIC registers directly, because
+ * the TC option slot interrupt request and mask bits are stored there,
+ * and the ioasic code isn't initted when we need to frob some interrupt
+ * bits.
+ */
+#define DEC_3000_300_IOASIC_ADDR KV(0x1a0000000)
+
struct tc_slotdesc tc_3000_300_slots[] = {
{ KV(0x100000000), C(TC_3000_300_DEV_OPT0), }, /* 0 - opt slot 0 */
{ KV(0x120000000), C(TC_3000_300_DEV_OPT1), }, /* 1 - opt slot 1 */
@@ -71,21 +83,17 @@ struct tcintr {
void *tci_arg;
} tc_3000_300_intr[TC_3000_300_NCOOKIES];
-/* XXX */
-void ioasic_intr_300_opt0_enable __P((int));
-void ioasic_intr_300_opt1_enable __P((int));
-void ioasic_300_opts_isintr __P((int *, int *));
-
void
tc_3000_300_intr_setup()
{
+ volatile u_int32_t *imskp;
u_long i;
/*
- * Sisable all interrupts that we can (can't disable builtins).
+ * Disable all interrupts that we can (can't disable builtins).
*/
- ioasic_intr_300_opt0_enable(0);
- ioasic_intr_300_opt1_enable(0);
+ imskp = (volatile u_int32_t *)IOASIC_REG_IMSK(DEC_3000_300_IOASIC_ADDR);
+ *imskp &= ~(IOASIC_INTR_300_OPT0 | IOASIC_INTR_300_OPT1);
/*
* Set up interrupt handlers.
@@ -103,6 +111,7 @@ tc_3000_300_intr_establish(tcadev, cookie, level, func, arg)
tc_intrlevel_t level;
int (*func) __P((void *));
{
+ volatile u_int32_t *imskp;
u_long dev = (u_long)cookie;
#ifdef DIAGNOSTIC
@@ -115,12 +124,13 @@ tc_3000_300_intr_establish(tcadev, cookie, level, func, arg)
tc_3000_300_intr[dev].tci_func = func;
tc_3000_300_intr[dev].tci_arg = arg;
+ imskp = (volatile u_int32_t *)IOASIC_REG_IMSK(DEC_3000_300_IOASIC_ADDR);
switch (dev) {
case TC_3000_300_DEV_OPT0:
- ioasic_intr_300_opt0_enable(1);
+ *imskp |= IOASIC_INTR_300_OPT0;
break;
case TC_3000_300_DEV_OPT1:
- ioasic_intr_300_opt1_enable(1);
+ *imskp |= IOASIC_INTR_300_OPT1;
break;
default:
/* interrupts for builtins always enabled */
@@ -133,6 +143,7 @@ tc_3000_300_intr_disestablish(tcadev, cookie)
struct device *tcadev;
void *cookie;
{
+ volatile u_int32_t *imskp;
u_long dev = (u_long)cookie;
#ifdef DIAGNOSTIC
@@ -143,12 +154,13 @@ tc_3000_300_intr_disestablish(tcadev, cookie)
panic("tc_3000_300_intr_disestablish: cookie %d bad intr",
dev);
+ imskp = (volatile u_int32_t *)IOASIC_REG_IMSK(DEC_3000_300_IOASIC_ADDR);
switch (dev) {
case TC_3000_300_DEV_OPT0:
- ioasic_intr_300_opt0_enable(0);
+ *imskp &= ~IOASIC_INTR_300_OPT0;
break;
case TC_3000_300_DEV_OPT1:
- ioasic_intr_300_opt1_enable(0);
+ *imskp &= ~IOASIC_INTR_300_OPT1;
break;
default:
/* interrupts for builtins always enabled */
@@ -173,7 +185,7 @@ tc_3000_300_iointr(framep, vec)
void *framep;
int vec;
{
- u_int32_t ir;
+ u_int32_t tcir, ioasicir, ioasicimr;
int opt0intr, opt1intr, ifound;
#ifdef DIAGNOSTIC
@@ -190,33 +202,53 @@ tc_3000_300_iointr(framep, vec)
tc_syncbus();
/* find out what interrupts/errors occurred */
- ir = *(volatile u_int32_t *)TC_3000_300_IR;
- ioasic_300_opts_isintr(&opt0intr, &opt1intr);
+ tcir = *(volatile u_int32_t *)TC_3000_300_IR;
+ ioasicir = *(volatile u_int32_t *)
+ IOASIC_REG_INTR(DEC_3000_300_IOASIC_ADDR);
+ ioasicimr = *(volatile u_int32_t *)
+ IOASIC_REG_IMSK(DEC_3000_300_IOASIC_ADDR);
tc_mb();
+ /* Ignore interrupts that aren't enabled out. */
+ ioasicir &= ioasicimr;
+
/* clear the interrupts/errors we found. */
- *(volatile u_int32_t *)TC_3000_300_IR = ir;
+ *(volatile u_int32_t *)TC_3000_300_IR = tcir;
/* XXX can't clear TC option slot interrupts here? */
tc_wmb();
ifound = 0;
+
+#ifdef EVCNT_COUNTERS
+ /* No interrupt counting via evcnt counters */
+ XXX BREAK HERE XXX
+#else /* !EVCNT_COUNTERS */
+#define INCRINTRCNT(slot) intrcnt[INTRCNT_KN16 + slot]++
+#endif /* EVCNT_COUNTERS */
+
#define CHECKINTR(slot, flag) \
- if (flag) { \
+ if (flag) { \
ifound = 1; \
+ INCRINTRCNT(slot); \
(*tc_3000_300_intr[slot].tci_func) \
(tc_3000_300_intr[slot].tci_arg); \
}
/* Do them in order of priority; highest slot # first. */
- CHECKINTR(TC_3000_300_DEV_CXTURBO, ir & TC_3000_300_IR_CXTURBO);
- CHECKINTR(TC_3000_300_DEV_IOASIC, ir & TC_3000_300_IR_IOASIC);
- CHECKINTR(TC_3000_300_DEV_TCDS, ir & TC_3000_300_IR_TCDS);
- CHECKINTR(TC_3000_300_DEV_OPT1, opt1intr);
- CHECKINTR(TC_3000_300_DEV_OPT0, opt0intr);
+ CHECKINTR(TC_3000_300_DEV_CXTURBO,
+ tcir & TC_3000_300_IR_CXTURBO);
+ CHECKINTR(TC_3000_300_DEV_IOASIC,
+ (tcir & TC_3000_300_IR_IOASIC) &&
+ (ioasicir & ~(IOASIC_INTR_300_OPT1|IOASIC_INTR_300_OPT0)));
+ CHECKINTR(TC_3000_300_DEV_TCDS, tcir & TC_3000_300_IR_TCDS);
+ CHECKINTR(TC_3000_300_DEV_OPT1,
+ ioasicir & IOASIC_INTR_300_OPT1);
+ CHECKINTR(TC_3000_300_DEV_OPT0,
+ ioasicir & IOASIC_INTR_300_OPT0);
#undef CHECKINTR
#ifdef DIAGNOSTIC
#define PRINTINTR(msg, bits) \
- if (ir & bits) \
+ if (tcir & bits) \
printf(msg);
PRINTINTR("BCache tag parity error\n",
TC_3000_300_IR_BCTAGPARITY);
diff --git a/sys/arch/alpha/tc/tc_3000_500.c b/sys/arch/alpha/tc/tc_3000_500.c
index 1ac7250e57c..336ce43e8ad 100644
--- a/sys/arch/alpha/tc/tc_3000_500.c
+++ b/sys/arch/alpha/tc/tc_3000_500.c
@@ -1,7 +1,7 @@
-/* $NetBSD: tc_3000_500.c,v 1.3 1995/12/20 00:43:30 cgd Exp $ */
+/* $NetBSD: tc_3000_500.c,v 1.4.4.3 1996/06/13 18:35:35 cgd Exp $ */
/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
+ * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -32,6 +32,9 @@
#include <machine/autoconf.h>
#include <machine/pte.h>
+#ifndef EVCNT_COUNTERS
+#include <machine/intrcnt.h>
+#endif
#include <dev/tc/tcvar.h>
#include <alpha/tc/tc_conf.h>
@@ -86,19 +89,21 @@ struct tcintr {
void *tci_arg;
} tc_3000_500_intr[TC_3000_500_NCOOKIES];
+u_int32_t tc_3000_500_imask; /* intrs we want to ignore; mirrors IMR. */
+
void
tc_3000_500_intr_setup()
{
u_long i;
- u_int32_t imr;
/*
- * Disable all slot interrupts.
+ * Disable all slot interrupts. Note that this cannot
+ * actually disable CXTurbo, TCDS, and IOASIC interrupts.
*/
- imr = *(volatile u_int32_t *)TC_3000_500_IMR_READ;
+ tc_3000_500_imask = *(volatile u_int32_t *)TC_3000_500_IMR_READ;
for (i = 0; i < TC_3000_500_NCOOKIES; i++)
- imr |= tc_3000_500_intrbits[i];
- *(volatile u_int32_t *)TC_3000_500_IMR_WRITE = imr;
+ tc_3000_500_imask |= tc_3000_500_intrbits[i];
+ *(volatile u_int32_t *)TC_3000_500_IMR_WRITE = tc_3000_500_imask;
tc_mb();
/*
@@ -118,7 +123,6 @@ tc_3000_500_intr_establish(tcadev, cookie, level, func, arg)
int (*func) __P((void *));
{
u_long dev = (u_long)cookie;
- u_int32_t imr;
#ifdef DIAGNOSTIC
/* XXX bounds-check cookie. */
@@ -130,9 +134,8 @@ tc_3000_500_intr_establish(tcadev, cookie, level, func, arg)
tc_3000_500_intr[dev].tci_func = func;
tc_3000_500_intr[dev].tci_arg = arg;
- imr = *(volatile u_int32_t *)TC_3000_500_IMR_READ;
- imr &= ~tc_3000_500_intrbits[dev];
- *(volatile u_int32_t *)TC_3000_500_IMR_WRITE = imr;
+ tc_3000_500_imask &= ~tc_3000_500_intrbits[dev];
+ *(volatile u_int32_t *)TC_3000_500_IMR_WRITE = tc_3000_500_imask;
tc_mb();
}
@@ -142,7 +145,6 @@ tc_3000_500_intr_disestablish(tcadev, cookie)
void *cookie;
{
u_long dev = (u_long)cookie;
- u_int32_t imr;
#ifdef DIAGNOSTIC
/* XXX bounds-check cookie. */
@@ -152,9 +154,8 @@ tc_3000_500_intr_disestablish(tcadev, cookie)
panic("tc_3000_500_intr_disestablish: cookie %d bad intr",
dev);
- imr = *(volatile u_int32_t *)TC_3000_500_IMR_READ;
- imr |= tc_3000_500_intrbits[dev];
- *(volatile u_int32_t *)TC_3000_500_IMR_WRITE = imr;
+ tc_3000_500_imask |= tc_3000_500_intrbits[dev];
+ *(volatile u_int32_t *)TC_3000_500_IMR_WRITE = tc_3000_500_imask;
tc_mb();
tc_3000_500_intr[dev].tci_func = tc_3000_500_intrnull;
@@ -192,10 +193,22 @@ tc_3000_500_iointr(framep, vec)
tc_syncbus();
ir = *(volatile u_int32_t *)TC_3000_500_IR_CLEAR;
+ /* Ignore interrupts that we haven't enabled. */
+ ir &= ~(tc_3000_500_imask & 0x1ff);
+
ifound = 0;
+
+#ifdef EVCNT_COUNTERS
+ /* No interrupt counting via evcnt counters */
+ XXX BREAK HERE XXX
+#else /* !EVCNT_COUNTERS */
+#define INCRINTRCNT(slot) intrcnt[INTRCNT_KN15 + slot]++
+#endif /* EVCNT_COUNTERS */
+
#define CHECKINTR(slot) \
if (ir & tc_3000_500_intrbits[slot]) { \
ifound = 1; \
+ INCRINTRCNT(slot); \
(*tc_3000_500_intr[slot].tci_func) \
(tc_3000_500_intr[slot].tci_arg); \
}
diff --git a/sys/arch/alpha/tc/tc_bus_io.c b/sys/arch/alpha/tc/tc_bus_io.c
new file mode 100644
index 00000000000..5bd03d0254e
--- /dev/null
+++ b/sys/arch/alpha/tc/tc_bus_io.c
@@ -0,0 +1,318 @@
+/* $NetBSD: tc_bus_io.c,v 1.1.4.1 1996/06/13 17:41:51 cgd Exp $ */
+
+/*
+ * Copyright (c) 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+/*
+ * TurboChannel "bus I/O" functions:
+ * These functions make no sense for TC, and just panic.
+ */
+
+#include <sys/param.h>
+#include <sys/malloc.h>
+#include <sys/syslog.h>
+#include <sys/device.h>
+#include <vm/vm.h>
+
+#include <machine/bus.h>
+
+int tc_io_map __P((void *, bus_io_addr_t, bus_io_size_t,
+ bus_io_handle_t *));
+void tc_io_unmap __P((void *, bus_io_handle_t,
+ bus_io_size_t));
+int tc_io_subregion __P((void *, bus_io_handle_t, bus_io_size_t,
+ bus_io_size_t, bus_io_handle_t *));
+u_int8_t tc_io_read_1 __P((void *, bus_io_handle_t,
+ bus_io_size_t));
+u_int16_t tc_io_read_2 __P((void *, bus_io_handle_t,
+ bus_io_size_t));
+u_int32_t tc_io_read_4 __P((void *, bus_io_handle_t,
+ bus_io_size_t));
+u_int64_t tc_io_read_8 __P((void *, bus_io_handle_t,
+ bus_io_size_t));
+void tc_io_read_multi_1 __P((void *, bus_io_handle_t,
+ bus_io_size_t, u_int8_t *, bus_io_size_t));
+void tc_io_read_multi_2 __P((void *, bus_io_handle_t,
+ bus_io_size_t, u_int16_t *, bus_io_size_t));
+void tc_io_read_multi_4 __P((void *, bus_io_handle_t,
+ bus_io_size_t, u_int32_t *, bus_io_size_t));
+void tc_io_read_multi_8 __P((void *, bus_io_handle_t,
+ bus_io_size_t, u_int64_t *, bus_io_size_t));
+void tc_io_write_1 __P((void *, bus_io_handle_t,
+ bus_io_size_t, u_int8_t));
+void tc_io_write_2 __P((void *, bus_io_handle_t,
+ bus_io_size_t, u_int16_t));
+void tc_io_write_4 __P((void *, bus_io_handle_t,
+ bus_io_size_t, u_int32_t));
+void tc_io_write_8 __P((void *, bus_io_handle_t,
+ bus_io_size_t, u_int64_t));
+void tc_io_write_multi_1 __P((void *, bus_io_handle_t,
+ bus_io_size_t, const u_int8_t *, bus_io_size_t));
+void tc_io_write_multi_2 __P((void *, bus_io_handle_t,
+ bus_io_size_t, const u_int16_t *, bus_io_size_t));
+void tc_io_write_multi_4 __P((void *, bus_io_handle_t,
+ bus_io_size_t, const u_int32_t *, bus_io_size_t));
+void tc_io_write_multi_8 __P((void *, bus_io_handle_t,
+ bus_io_size_t, const u_int64_t *, bus_io_size_t));
+
+void
+tc_bus_io_init(bc, iov)
+ bus_chipset_tag_t bc;
+ void *iov;
+{
+
+ bc->bc_i_v = iov;
+
+ bc->bc_i_map = tc_io_map;
+ bc->bc_i_unmap = tc_io_unmap;
+ bc->bc_i_subregion = tc_io_subregion;
+
+ bc->bc_ir1 = tc_io_read_1;
+ bc->bc_ir2 = tc_io_read_2;
+ bc->bc_ir4 = tc_io_read_4;
+ bc->bc_ir8 = tc_io_read_8;
+
+ bc->bc_irm1 = tc_io_read_multi_1;
+ bc->bc_irm2 = tc_io_read_multi_2;
+ bc->bc_irm4 = tc_io_read_multi_4;
+ bc->bc_irm8 = tc_io_read_multi_8;
+
+ bc->bc_iw1 = tc_io_write_1;
+ bc->bc_iw2 = tc_io_write_2;
+ bc->bc_iw4 = tc_io_write_4;
+ bc->bc_iw8 = tc_io_write_8;
+
+ bc->bc_iwm1 = tc_io_write_multi_1;
+ bc->bc_iwm2 = tc_io_write_multi_2;
+ bc->bc_iwm4 = tc_io_write_multi_4;
+ bc->bc_iwm8 = tc_io_write_multi_8;
+}
+
+static const char *tc_bus_io_panicstr = "tc_io_%s nonsensical; unimplemented";
+
+int
+tc_io_map(v, ioaddr, iosize, iohp)
+ void *v;
+ bus_io_addr_t ioaddr;
+ bus_io_size_t iosize;
+ bus_io_handle_t *iohp;
+{
+
+ panic(tc_bus_io_panicstr, "map");
+}
+
+void
+tc_io_unmap(v, ioh, iosize)
+ void *v;
+ bus_io_handle_t ioh;
+ bus_io_size_t iosize;
+{
+
+ panic(tc_bus_io_panicstr, "unmap");
+}
+
+int
+tc_io_subregion(v, ioh, offset, size, nioh)
+ void *v;
+ bus_io_handle_t ioh, *nioh;
+ bus_io_size_t offset, size;
+{
+
+ panic(tc_bus_io_panicstr, "subregion");
+}
+
+u_int8_t
+tc_io_read_1(v, ioh, off)
+ void *v;
+ bus_io_handle_t ioh;
+ bus_io_size_t off;
+{
+
+ panic(tc_bus_io_panicstr, "read_1");
+}
+
+u_int16_t
+tc_io_read_2(v, ioh, off)
+ void *v;
+ bus_io_handle_t ioh;
+ bus_io_size_t off;
+{
+
+ panic(tc_bus_io_panicstr, "read_2");
+}
+
+u_int32_t
+tc_io_read_4(v, ioh, off)
+ void *v;
+ bus_io_handle_t ioh;
+ bus_io_size_t off;
+{
+
+ panic(tc_bus_io_panicstr, "read_4");
+}
+
+u_int64_t
+tc_io_read_8(v, ioh, off)
+ void *v;
+ bus_io_handle_t ioh;
+ bus_io_size_t off;
+{
+
+ panic(tc_bus_io_panicstr, "read_8");
+}
+
+void
+tc_io_read_multi_1(v, ioh, off, addr, count)
+ void *v;
+ bus_io_handle_t ioh;
+ bus_io_size_t off, count;
+ u_int8_t *addr;
+{
+
+ panic(tc_bus_io_panicstr, "read_multi_1");
+}
+
+void
+tc_io_read_multi_2(v, ioh, off, addr, count)
+ void *v;
+ bus_io_handle_t ioh;
+ bus_io_size_t off, count;
+ u_int16_t *addr;
+{
+
+ panic(tc_bus_io_panicstr, "read_multi_2");
+}
+
+void
+tc_io_read_multi_4(v, ioh, off, addr, count)
+ void *v;
+ bus_io_handle_t ioh;
+ bus_io_size_t off, count;
+ u_int32_t *addr;
+{
+
+ panic(tc_bus_io_panicstr, "read_multi_4");
+}
+
+void
+tc_io_read_multi_8(v, ioh, off, addr, count)
+ void *v;
+ bus_io_handle_t ioh;
+ bus_io_size_t off, count;
+ u_int64_t *addr;
+{
+
+ panic(tc_bus_io_panicstr, "read_multi_8");
+}
+
+void
+tc_io_write_1(v, ioh, off, val)
+ void *v;
+ bus_io_handle_t ioh;
+ bus_io_size_t off;
+ u_int8_t val;
+{
+
+ panic(tc_bus_io_panicstr, "write_1");
+}
+
+void
+tc_io_write_2(v, ioh, off, val)
+ void *v;
+ bus_io_handle_t ioh;
+ bus_io_size_t off;
+ u_int16_t val;
+{
+
+ panic(tc_bus_io_panicstr, "write_2");
+}
+
+void
+tc_io_write_4(v, ioh, off, val)
+ void *v;
+ bus_io_handle_t ioh;
+ bus_io_size_t off;
+ u_int32_t val;
+{
+
+ panic(tc_bus_io_panicstr, "write_4");
+}
+
+void
+tc_io_write_8(v, ioh, off, val)
+ void *v;
+ bus_io_handle_t ioh;
+ bus_io_size_t off;
+ u_int64_t val;
+{
+
+ panic(tc_bus_io_panicstr, "write_8");
+}
+
+void
+tc_io_write_multi_1(v, ioh, off, addr, count)
+ void *v;
+ bus_io_handle_t ioh;
+ bus_io_size_t off, count;
+ const u_int8_t *addr;
+{
+
+ panic(tc_bus_io_panicstr, "write_multi_1");
+}
+
+void
+tc_io_write_multi_2(v, ioh, off, addr, count)
+ void *v;
+ bus_io_handle_t ioh;
+ bus_io_size_t off, count;
+ const u_int16_t *addr;
+{
+
+ panic(tc_bus_io_panicstr, "write_multi_2");
+}
+
+void
+tc_io_write_multi_4(v, ioh, off, addr, count)
+ void *v;
+ bus_io_handle_t ioh;
+ bus_io_size_t off, count;
+ const u_int32_t *addr;
+{
+
+ panic(tc_bus_io_panicstr, "write_multi_4");
+}
+
+void
+tc_io_write_multi_8(v, ioh, off, addr, count)
+ void *v;
+ bus_io_handle_t ioh;
+ bus_io_size_t off, count;
+ const u_int64_t *addr;
+{
+
+ panic(tc_bus_io_panicstr, "write_multi_8");
+}
diff --git a/sys/arch/alpha/tc/tc_bus_mem.c b/sys/arch/alpha/tc/tc_bus_mem.c
new file mode 100644
index 00000000000..922dd831a8b
--- /dev/null
+++ b/sys/arch/alpha/tc/tc_bus_mem.c
@@ -0,0 +1,313 @@
+/* $NetBSD: tc_bus_mem.c,v 1.2.4.2 1996/06/13 17:42:51 cgd Exp $ */
+
+/*
+ * Copyright (c) 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+/*
+ * Common TurboChannel Chipset "bus memory" functions.
+ */
+
+#include <sys/param.h>
+#include <sys/malloc.h>
+#include <sys/syslog.h>
+#include <sys/device.h>
+#include <vm/vm.h>
+
+#include <machine/bus.h>
+#include <dev/tc/tcvar.h>
+
+int tc_mem_map __P((void *, bus_mem_addr_t, bus_mem_size_t,
+ int, bus_mem_handle_t *));
+void tc_mem_unmap __P((void *, bus_mem_handle_t,
+ bus_mem_size_t));
+int tc_mem_subregion __P((void *, bus_mem_handle_t, bus_mem_size_t,
+ bus_mem_size_t, bus_mem_handle_t *));
+u_int8_t tc_mem_read_1 __P((void *, bus_mem_handle_t,
+ bus_mem_size_t));
+u_int16_t tc_mem_read_2 __P((void *, bus_mem_handle_t,
+ bus_mem_size_t));
+u_int32_t tc_mem_read_4 __P((void *, bus_mem_handle_t,
+ bus_mem_size_t));
+u_int64_t tc_mem_read_8 __P((void *, bus_mem_handle_t,
+ bus_mem_size_t));
+void tc_mem_write_1 __P((void *, bus_mem_handle_t,
+ bus_mem_size_t, u_int8_t));
+void tc_mem_write_2 __P((void *, bus_mem_handle_t,
+ bus_mem_size_t, u_int16_t));
+void tc_mem_write_4 __P((void *, bus_mem_handle_t,
+ bus_mem_size_t, u_int32_t));
+void tc_mem_write_8 __P((void *, bus_mem_handle_t,
+ bus_mem_size_t, u_int64_t));
+
+/* XXX DOES NOT BELONG */
+vm_offset_t tc_XXX_dmamap __P((void *));
+
+void
+tc_bus_mem_init(bc, memv)
+ bus_chipset_tag_t bc;
+ void *memv;
+{
+
+ bc->bc_m_v = memv;
+
+ bc->bc_m_map = tc_mem_map;
+ bc->bc_m_unmap = tc_mem_unmap;
+ bc->bc_m_subregion = tc_mem_subregion;
+
+ bc->bc_mr1 = tc_mem_read_1;
+ bc->bc_mr2 = tc_mem_read_2;
+ bc->bc_mr4 = tc_mem_read_4;
+ bc->bc_mr8 = tc_mem_read_8;
+
+ bc->bc_mw1 = tc_mem_write_1;
+ bc->bc_mw2 = tc_mem_write_2;
+ bc->bc_mw4 = tc_mem_write_4;
+ bc->bc_mw8 = tc_mem_write_8;
+
+ /* XXX DOES NOT BELONG */
+ bc->bc_XXX_dmamap = tc_XXX_dmamap;
+}
+
+int
+tc_mem_map(v, memaddr, memsize, cacheable, memhp)
+ void *v;
+ bus_mem_addr_t memaddr;
+ bus_mem_size_t memsize;
+ int cacheable;
+ bus_mem_handle_t *memhp;
+{
+
+ if (memaddr & 0x7)
+ panic("tc_mem_map needs 8 byte alignment");
+ if (cacheable)
+ *memhp = phystok0seg(memaddr);
+ else
+ *memhp = phystok0seg(TC_DENSE_TO_SPARSE(memaddr));
+ return (0);
+}
+
+void
+tc_mem_unmap(v, memh, memsize)
+ void *v;
+ bus_mem_handle_t memh;
+ bus_mem_size_t memsize;
+{
+
+ /* XXX nothing to do. */
+}
+
+int
+tc_mem_subregion(v, memh, offset, size, nmemh)
+ void *v;
+ bus_mem_handle_t memh, *nmemh;
+ bus_mem_size_t offset, size;
+{
+
+ /* Disallow subregioning that would make the handle unaligned. */
+ if ((offset & 0x7) != 0)
+ return (1);
+
+ if ((memh & TC_SPACE_SPARSE) != 0)
+ *nmemh = memh + (offset << 1);
+ else
+ *nmemh = memh + offset;
+
+ return (0);
+}
+
+u_int8_t
+tc_mem_read_1(v, memh, off)
+ void *v;
+ bus_mem_handle_t memh;
+ bus_mem_size_t off;
+{
+ volatile u_int8_t *p;
+
+ wbflush();
+
+ if ((memh & TC_SPACE_SPARSE) != 0)
+ panic("tc_mem_read_1 not implemented for sparse space");
+
+ p = (u_int8_t *)(memh + off);
+ return (*p);
+}
+
+u_int16_t
+tc_mem_read_2(v, memh, off)
+ void *v;
+ bus_mem_handle_t memh;
+ bus_mem_size_t off;
+{
+ volatile u_int16_t *p;
+
+ wbflush();
+
+ if ((memh & TC_SPACE_SPARSE) != 0)
+ panic("tc_mem_read_2 not implemented for sparse space");
+
+ p = (u_int16_t *)(memh + off);
+ return (*p);
+}
+
+u_int32_t
+tc_mem_read_4(v, memh, off)
+ void *v;
+ bus_mem_handle_t memh;
+ bus_mem_size_t off;
+{
+ volatile u_int32_t *p;
+
+ wbflush();
+
+ if ((memh & TC_SPACE_SPARSE) != 0)
+ /* Nothing special to do for 4-byte sparse space accesses */
+ p = (u_int32_t *)(memh + (off << 1));
+ else
+ p = (u_int32_t *)(memh + off);
+ return (*p);
+}
+
+u_int64_t
+tc_mem_read_8(v, memh, off)
+ void *v;
+ bus_mem_handle_t memh;
+ bus_mem_size_t off;
+{
+ volatile u_int64_t *p;
+
+ wbflush();
+
+ if ((memh & TC_SPACE_SPARSE) != 0)
+ panic("tc_mem_read_8 not implemented for sparse space");
+
+ p = (u_int64_t *)(memh + off);
+ return (*p);
+}
+
+void
+tc_mem_write_1(v, memh, off, val)
+ void *v;
+ bus_mem_handle_t memh;
+ bus_mem_size_t off;
+ u_int8_t val;
+{
+
+ if ((memh & TC_SPACE_SPARSE) != 0) {
+ volatile u_int64_t *p, v;
+ u_int64_t shift, msk;
+
+ shift = off & 0x3;
+ off &= 0x3;
+
+ p = (u_int64_t *)(memh + (off << 1));
+
+ msk = ~(0x1 << shift) & 0xf;
+ v = (msk << 32) | (((u_int64_t)val) << (shift * 8));
+
+ *p = val;
+ } else {
+ volatile u_int8_t *p;
+
+ p = (u_int8_t *)(memh + off);
+ *p = val;
+ }
+ wbflush();
+}
+
+void
+tc_mem_write_2(v, memh, off, val)
+ void *v;
+ bus_mem_handle_t memh;
+ bus_mem_size_t off;
+ u_int16_t val;
+{
+
+ if ((memh & TC_SPACE_SPARSE) != 0) {
+ volatile u_int64_t *p, v;
+ u_int64_t shift, msk;
+
+ shift = off & 0x2;
+ off &= 0x3;
+
+ p = (u_int64_t *)(memh + (off << 1));
+
+ msk = ~(0x3 << shift) & 0xf;
+ v = (msk << 32) | (((u_int64_t)val) << (shift * 8));
+
+ *p = val;
+ } else {
+ volatile u_int16_t *p;
+
+ p = (u_int16_t *)(memh + off);
+ *p = val;
+ }
+ wbflush();
+}
+
+void
+tc_mem_write_4(v, memh, off, val)
+ void *v;
+ bus_mem_handle_t memh;
+ bus_mem_size_t off;
+ u_int32_t val;
+{
+ volatile u_int32_t *p;
+
+ if ((memh & TC_SPACE_SPARSE) != 0)
+ /* Nothing special to do for 4-byte sparse space accesses */
+ p = (u_int32_t *)(memh + (off << 1));
+ else
+ p = (u_int32_t *)(memh + off);
+ *p = val;
+ wbflush();
+}
+
+void
+tc_mem_write_8(v, memh, off, val)
+ void *v;
+ bus_mem_handle_t memh;
+ bus_mem_size_t off;
+ u_int64_t val;
+{
+ volatile u_int64_t *p;
+
+ if ((memh & TC_SPACE_SPARSE) != 0)
+ panic("tc_mem_read_8 not implemented for sparse space");
+
+ p = (u_int64_t *)(memh + off);
+ *p = val;
+ wbflush();
+}
+
+/* XXX DOES NOT BELONG */
+vm_offset_t
+tc_XXX_dmamap(addr)
+ void *addr;
+{
+
+ return (vtophys(addr));
+}
diff --git a/sys/arch/alpha/include/tc_machdep.h b/sys/arch/alpha/tc/tc_machdep.h
index 5287f43b048..5287f43b048 100644
--- a/sys/arch/alpha/include/tc_machdep.h
+++ b/sys/arch/alpha/tc/tc_machdep.h
diff --git a/sys/arch/alpha/tc/tcasic.c b/sys/arch/alpha/tc/tcasic.c
index 9524b08957f..742029d3f54 100644
--- a/sys/arch/alpha/tc/tcasic.c
+++ b/sys/arch/alpha/tc/tcasic.c
@@ -1,7 +1,7 @@
-/* $NetBSD: tcasic.c,v 1.1 1995/12/20 00:43:34 cgd Exp $ */
+/* $NetBSD: tcasic.c,v 1.5 1996/05/17 23:58:43 cgd Exp $ */
/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
+ * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -39,9 +39,14 @@
/* Definition of the driver for autoconfig. */
int tcasicmatch(struct device *, void *, void *);
void tcasicattach(struct device *, struct device *, void *);
-struct cfdriver tcasiccd =
- { NULL, "tcasic", tcasicmatch, tcasicattach, DV_DULL,
- sizeof (struct device) };
+
+struct cfattach tcasic_ca = {
+ sizeof (struct device), tcasicmatch, tcasicattach,
+};
+
+struct cfdriver tcasic_cd = {
+ NULL, "tcasic", DV_DULL,
+};
int tcasicprint __P((void *, char *));
@@ -59,7 +64,7 @@ tcasicmatch(parent, cfdata, aux)
struct confargs *ca = aux;
/* Make sure that we're looking for a TurboChannel ASIC. */
- if (strcmp(ca->ca_name, tcasiccd.cd_name))
+ if (strcmp(ca->ca_name, tcasic_cd.cd_name))
return (0);
/* Make sure that the system supports a TurboChannel ASIC. */
@@ -78,54 +83,61 @@ tcasicattach(parent, self, aux)
struct device *self;
void *aux;
{
- struct tc_attach_args tc;
+ struct tcbus_attach_args tba;
void (*intr_setup) __P((void));
void (*iointr) __P((void *, int));
+ struct alpha_bus_chipset bc;
+ printf("\n");
tcasicfound = 1;
switch (cputype) {
#ifdef DEC_3000_500
case ST_DEC_3000_500:
- printf(": 25MHz\n");
intr_setup = tc_3000_500_intr_setup;
iointr = tc_3000_500_iointr;
- tc.tca_nslots = tc_3000_500_nslots;
- tc.tca_slots = tc_3000_500_slots;
- tc.tca_nbuiltins = tc_3000_500_nbuiltins;
- tc.tca_builtins = tc_3000_500_builtins;
- tc.tca_intr_establish = tc_3000_500_intr_establish;
- tc.tca_intr_disestablish = tc_3000_500_intr_disestablish;
+ tba.tba_busname = "tc";
+ tba.tba_speed = TC_SPEED_25_MHZ;
+ tba.tba_nslots = tc_3000_500_nslots;
+ tba.tba_slots = tc_3000_500_slots;
+ tba.tba_nbuiltins = tc_3000_500_nbuiltins;
+ tba.tba_builtins = tc_3000_500_builtins;
+ tba.tba_intr_establish = tc_3000_500_intr_establish;
+ tba.tba_intr_disestablish = tc_3000_500_intr_disestablish;
break;
#endif /* DEC_3000_500 */
#ifdef DEC_3000_300
case ST_DEC_3000_300:
- printf(": 12.5MHz\n");
intr_setup = tc_3000_300_intr_setup;
iointr = tc_3000_300_iointr;
- tc.tca_nslots = tc_3000_300_nslots;
- tc.tca_slots = tc_3000_300_slots;
- tc.tca_nbuiltins = tc_3000_300_nbuiltins;
- tc.tca_builtins = tc_3000_300_builtins;
- tc.tca_intr_establish = tc_3000_300_intr_establish;
- tc.tca_intr_disestablish = tc_3000_300_intr_disestablish;
+ tba.tba_busname = "tc";
+ tba.tba_speed = TC_SPEED_12_5_MHZ;
+ tba.tba_nslots = tc_3000_300_nslots;
+ tba.tba_slots = tc_3000_300_slots;
+ tba.tba_nbuiltins = tc_3000_300_nbuiltins;
+ tba.tba_builtins = tc_3000_300_builtins;
+ tba.tba_intr_establish = tc_3000_300_intr_establish;
+ tba.tba_intr_disestablish = tc_3000_300_intr_disestablish;
break;
#endif /* DEC_3000_300 */
default:
- printf("\n");
panic("tcasicattach: bad cputype");
}
+ tc_bus_io_init(&bc, NULL);
+ tc_bus_mem_init(&bc, NULL);
+ tba.tba_bc = &bc;
+
(*intr_setup)();
set_iointr(iointr);
- config_found(self, &tc, tcasicprint);
+ config_found(self, &tba, tcasicprint);
}
int
diff --git a/sys/arch/alpha/tc/tcds.c b/sys/arch/alpha/tc/tcds.c
index 6c0c6490fec..940ac21c698 100644
--- a/sys/arch/alpha/tc/tcds.c
+++ b/sys/arch/alpha/tc/tcds.c
@@ -1,7 +1,7 @@
-/* $NetBSD: tcds.c,v 1.6 1995/12/20 00:40:29 cgd Exp $ */
+/* $NetBSD: tcds.c,v 1.9.4.2 1996/06/05 01:32:26 cgd Exp $ */
/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
+ * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Keith Bostic, Chris G. Demetriou
@@ -34,6 +34,9 @@
#include <machine/pte.h>
#include <machine/rpb.h>
+#ifndef EVCNT_COUNTERS
+#include <machine/intrcnt.h>
+#endif
#include <dev/tc/tcreg.h>
#include <dev/tc/tcvar.h>
@@ -55,8 +58,14 @@ struct tcds_softc {
int tcdsmatch __P((struct device *, void *, void *));
void tcdsattach __P((struct device *, struct device *, void *));
int tcdsprint(void *, char *);
-struct cfdriver tcdscd =
- { NULL, "tcds", tcdsmatch, tcdsattach, DV_DULL, sizeof(struct tcds_softc) };
+
+struct cfattach tcds_ca = {
+ sizeof(struct tcds_softc), tcdsmatch, tcdsattach,
+};
+
+struct cfdriver tcds_cd = {
+ NULL, "tcds", DV_DULL,
+};
/*static*/ int tcds_intr __P((void *));
/*static*/ int tcds_intrnull __P((void *));
@@ -67,11 +76,11 @@ tcdsmatch(parent, cfdata, aux)
void *cfdata;
void *aux;
{
- struct tcdev_attach_args *tcdev = aux;
+ struct tc_attach_args *ta = aux;
extern int cputype;
/* Make sure that we're looking for this type of device. */
- if (strncmp("PMAZ-DS ", tcdev->tcda_modname, TC_ROM_LLEN))
+ if (strncmp("PMAZ-DS ", ta->ta_modname, TC_ROM_LLEN))
return (0);
/* PMAZ-FS? */
@@ -88,7 +97,7 @@ tcdsattach(parent, self, aux)
void *aux;
{
struct tcds_softc *sc = (struct tcds_softc *)self;
- struct tcdev_attach_args *tcdev = aux;
+ struct tc_attach_args *ta = aux;
struct tcdsdev_attach_args tcdsdev;
struct tcds_slotconfig *slotc;
int i;
@@ -96,8 +105,8 @@ tcdsattach(parent, self, aux)
printf("\n");
- sc->sc_base = tcdev->tcda_addr;
- sc->sc_cookie = tcdev->tcda_cookie;
+ sc->sc_base = ta->ta_addr;
+ sc->sc_cookie = ta->ta_cookie;
sc->sc_cir = TCDS_REG(sc->sc_base, TCDS_CIR);
sc->sc_imer = TCDS_REG(sc->sc_base, TCDS_IMER);
@@ -196,11 +205,11 @@ tcdsprint(aux, pnp)
void *aux;
char *pnp;
{
- struct tcdev_attach_args *tcdev = aux;
+ struct tc_attach_args *ta = aux;
if (pnp)
- printf("%s at %s", tcdev->tcda_modname, pnp);
- printf(" slot 0x%lx", tcdev->tcda_slot);
+ printf("%s at %s", ta->ta_modname, pnp);
+ printf(" slot %d", ta->ta_slot);
return (UNCONF);
}
@@ -349,8 +358,16 @@ tcds_intr(val)
tc_syncbus();
wbflush();
+#ifdef EVCNT_COUNTERS
+ /* No interrupt counting via evcnt counters */
+ XXX BREAK HERE XXX
+#else
+#define INCRINTRCNT(slot) intrcnt[INTRCNT_TCDS + slot]++
+#endif
+
#define CHECKINTR(slot) \
if (ir & sc->sc_slots[slot].sc_intrbits) { \
+ INCRINTRCNT(slot); \
(void)(*sc->sc_slots[slot].sc_intrhand) \
(sc->sc_slots[slot].sc_intrarg); \
}
diff --git a/sys/arch/alpha/tc/tcdsvar.h b/sys/arch/alpha/tc/tcdsvar.h
index 5bee7191694..540db9c8538 100644
--- a/sys/arch/alpha/tc/tcdsvar.h
+++ b/sys/arch/alpha/tc/tcdsvar.h
@@ -1,7 +1,7 @@
-/* $NetBSD: tcdsvar.h,v 1.1 1995/12/20 00:40:41 cgd Exp $ */
+/* $NetBSD: tcdsvar.h,v 1.3 1996/04/12 06:10:18 cgd Exp $ */
/*
- * Copyright (c) 1995 Carnegie-Mellon University.
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
@@ -66,16 +66,16 @@ struct tcds_slotconfig {
};
struct tcdsdev_attach_args {
- struct tcdev_attach_args tcdsda_tc;
+ struct tc_attach_args tcdsda_ta;
struct tcds_slotconfig *tcdsda_sc;
u_int tcdsda_id;
u_int tcdsda_freq;
};
-#define tcdsda_modname tcdsda_tc.tcda_modname
-#define tcdsda_slot tcdsda_tc.tcda_slot
-#define tcdsda_offset tcdsda_tc.tcda_offset
-#define tcdsda_addr tcdsda_tc.tcda_addr
-#define tcdsda_cookie tcdsda_tc.tcda_cookie
+#define tcdsda_modname tcdsda_ta.ta_modname
+#define tcdsda_slot tcdsda_ta.ta_slot
+#define tcdsda_offset tcdsda_ta.ta_offset
+#define tcdsda_addr tcdsda_ta.ta_addr
+#define tcdsda_cookie tcdsda_ta.ta_cookie
#define TCDS_REG(base, off) \
(volatile u_int32_t *)TC_DENSE_TO_SPARSE((base) + (off))
@@ -105,4 +105,4 @@ int tcds_dmaintr __P((struct tcds_slotconfig *));
* The TCDS (bus) cfdriver, so that subdevices can more
* easily tell what bus they're on.
*/
-extern struct cfdriver tcdscd;
+extern struct cfdriver tcds_cd;
diff --git a/sys/arch/alpha/wscons/ascii.h b/sys/arch/alpha/wscons/ascii.h
new file mode 100644
index 00000000000..dc4775022c9
--- /dev/null
+++ b/sys/arch/alpha/wscons/ascii.h
@@ -0,0 +1,10 @@
+/* $NetBSD: ascii.h,v 1.1 1996/04/12 02:00:42 cgd Exp $ */
+
+#define ASCII_BEL 0x07 /* bell */
+#define ASCII_BS 0x08 /* backspace */
+#define ASCII_HT 0x09 /* horizontal tab */
+#define ASCII_LF 0x0a /* line feed */
+#define ASCII_VT 0x0b /* vertical tab(?); up one line */
+#define ASCII_NP 0x0c /* next page; form feed */
+#define ASCII_CR 0x0d /* carriage return */
+#define ASCII_ESC 0x1b /* escape */
diff --git a/sys/arch/alpha/wscons/event.c b/sys/arch/alpha/wscons/event.c
new file mode 100644
index 00000000000..3c34d962c83
--- /dev/null
+++ b/sys/arch/alpha/wscons/event.c
@@ -0,0 +1,172 @@
+/* $NetBSD: event.c,v 1.1.4.1 1996/05/29 22:26:54 cgd Exp $ */
+
+/*
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Lawrence Berkeley Laboratory.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)event.c 8.1 (Berkeley) 6/11/93
+ */
+
+/*
+ * Internal `Firm_event' interface for the keyboard and mouse drivers.
+ */
+
+#include <sys/param.h>
+#include <sys/fcntl.h>
+#include <sys/malloc.h>
+#include <sys/proc.h>
+#include <sys/systm.h>
+#include <sys/vnode.h>
+
+#include <machine/vuid_event.h>
+#include <alpha/wscons/event_var.h>
+
+/*
+ * Initialize a firm_event queue.
+ */
+void
+ev_init(ev)
+ register struct evvar *ev;
+{
+
+ ev->ev_get = ev->ev_put = 0;
+ ev->ev_q = malloc((u_long)EV_QSIZE * sizeof(struct firm_event),
+ M_DEVBUF, M_WAITOK);
+ bzero((caddr_t)ev->ev_q, EV_QSIZE * sizeof(struct firm_event));
+}
+
+/*
+ * Tear down a firm_event queue.
+ */
+void
+ev_fini(ev)
+ register struct evvar *ev;
+{
+
+ free(ev->ev_q, M_DEVBUF);
+}
+
+/*
+ * User-level interface: read, select.
+ * (User cannot write an event queue.)
+ */
+int
+ev_read(ev, uio, flags)
+ register struct evvar *ev;
+ struct uio *uio;
+ int flags;
+{
+ int s, n, cnt, error;
+
+ /*
+ * Make sure we can return at least 1.
+ */
+ if (uio->uio_resid < sizeof(struct firm_event))
+ return (EMSGSIZE); /* ??? */
+ s = splev();
+ while (ev->ev_get == ev->ev_put) {
+ if (flags & IO_NDELAY) {
+ splx(s);
+ return (EWOULDBLOCK);
+ }
+ ev->ev_wanted = 1;
+ error = tsleep((caddr_t)ev, PEVENT | PCATCH, "firm_event", 0);
+ if (error) {
+ splx(s);
+ return (error);
+ }
+ }
+ /*
+ * Move firm_events from tail end of queue (there is at least one
+ * there).
+ */
+ if (ev->ev_put < ev->ev_get)
+ cnt = EV_QSIZE - ev->ev_get; /* events in [get..QSIZE) */
+ else
+ cnt = ev->ev_put - ev->ev_get; /* events in [get..put) */
+ splx(s);
+ n = howmany(uio->uio_resid, sizeof(struct firm_event));
+ if (cnt > n)
+ cnt = n;
+ error = uiomove((caddr_t)&ev->ev_q[ev->ev_get],
+ cnt * sizeof(struct firm_event), uio);
+ n -= cnt;
+ /*
+ * If we do not wrap to 0, used up all our space, or had an error,
+ * stop. Otherwise move from front of queue to put index, if there
+ * is anything there to move.
+ */
+ if ((ev->ev_get = (ev->ev_get + cnt) % EV_QSIZE) != 0 ||
+ n == 0 || error || (cnt = ev->ev_put) == 0)
+ return (error);
+ if (cnt > n)
+ cnt = n;
+ error = uiomove((caddr_t)&ev->ev_q[0],
+ cnt * sizeof(struct firm_event), uio);
+ ev->ev_get = cnt;
+ return (error);
+}
+
+int
+ev_select(ev, rw, p)
+ register struct evvar *ev;
+ int rw;
+ struct proc *p;
+{
+ int s = splev();
+
+ switch (rw) {
+
+ case FREAD:
+ /* succeed if there is something to read */
+ if (ev->ev_get != ev->ev_put) {
+ splx(s);
+ return (1);
+ }
+ selrecord(p, &ev->ev_sel);
+ break;
+
+ case FWRITE:
+ splx(s);
+ return (1); /* always fails => never blocks */
+ }
+ splx(s);
+ return (0);
+}
diff --git a/sys/arch/alpha/wscons/event_var.h b/sys/arch/alpha/wscons/event_var.h
new file mode 100644
index 00000000000..b63213d315f
--- /dev/null
+++ b/sys/arch/alpha/wscons/event_var.h
@@ -0,0 +1,87 @@
+/* $NetBSD: event_var.h,v 1.1 1996/04/12 02:00:45 cgd Exp $ */
+
+/*
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Lawrence Berkeley Laboratory.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)event_var.h 8.1 (Berkeley) 6/11/93
+ */
+
+/*
+ * Internal `Firm_event' interface for the keyboard and mouse drivers.
+ * The drivers are expected not to place events in the queue above spltty(),
+ * i.e., are expected to run off serial ports.
+ */
+
+/* EV_QSIZE should be a power of two so that `%' is fast */
+#define EV_QSIZE 256 /* may need tuning; this uses 2k */
+
+struct evvar {
+ u_int ev_get; /* get (read) index (modified synchronously) */
+ volatile u_int ev_put; /* put (write) index (modified by interrupt) */
+ struct selinfo ev_sel; /* process selecting */
+ struct proc *ev_io; /* process that opened queue (can get SIGIO) */
+ char ev_wanted; /* wake up on input ready */
+ char ev_async; /* send SIGIO on input ready */
+ struct firm_event *ev_q;/* circular buffer (queue) of events */
+};
+
+#define splev() spltty()
+
+#define EV_WAKEUP(ev) { \
+ selwakeup(&(ev)->ev_sel); \
+ if ((ev)->ev_wanted) { \
+ (ev)->ev_wanted = 0; \
+ wakeup((caddr_t)(ev)); \
+ } \
+ if ((ev)->ev_async) \
+ psignal((ev)->ev_io, SIGIO); \
+}
+
+void ev_init __P((struct evvar *));
+void ev_fini __P((struct evvar *));
+int ev_read __P((struct evvar *, struct uio *, int));
+int ev_select __P((struct evvar *, int, struct proc *));
+
+/*
+ * PEVENT is set just above PSOCK, which is just above TTIPRI, on the
+ * theory that mouse and keyboard `user' input should be quick.
+ */
+#define PEVENT 23
diff --git a/sys/arch/alpha/wscons/kbd.c b/sys/arch/alpha/wscons/kbd.c
new file mode 100644
index 00000000000..67cd26fcee5
--- /dev/null
+++ b/sys/arch/alpha/wscons/kbd.c
@@ -0,0 +1,334 @@
+/* $NetBSD: kbd.c,v 1.1 1996/04/12 02:00:46 cgd Exp $ */
+
+/*
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Lawrence Berkeley Laboratory.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)kbd.c 8.2 (Berkeley) 10/30/93
+ */
+
+/*
+ * Keyboard driver (/dev/kbd -- note that we do not have minor numbers
+ * [yet?]). Translates incoming bytes to ASCII or to `firm_events' and
+ * passes them up to the appropriate reader.
+ */
+
+#include <sys/param.h>
+#include <sys/conf.h>
+#include <sys/device.h>
+#include <sys/ioctl.h>
+#include <sys/kernel.h>
+#include <sys/proc.h>
+#include <sys/syslog.h>
+#include <sys/systm.h>
+#include <sys/tty.h>
+
+#include <machine/autoconf.h>
+
+#include <machine/vuid_event.h>
+#include <machine/kbio.h> /* XXX FOR KIOCSDIRECT */
+#include <machine/wsconsio.h> /* XXX for bell ioctls */
+#include <alpha/wscons/event_var.h>
+#include <alpha/wscons/wsconsvar.h>
+
+struct kbd_softc {
+ struct device *k_idev; /* the input device */
+ struct wscons_idev_spec k_ispec; /* the input device information */
+
+ int k_evmode; /* set if we should produce events */
+ struct evvar k_events; /* event queue state */
+ char *k_repeatcp; /* repeated character (string) */
+ int k_repeating; /* we've called timeout() */
+ int k_repeat_start; /* how long (ms) until repeat */
+ int k_repeat_step; /* how long (ms) until more repeats */
+
+ struct wsconsio_bell_data k_belldata;
+} kbd_softc;
+
+void
+kbdattach(idev, ispec)
+ struct device *idev;
+ struct wscons_idev_spec *ispec;
+{
+ register struct kbd_softc *k = &kbd_softc;
+
+ /*
+ * It would be nice if the repeat rates were in ticks.
+ * However, if they were, we couldn't set them here, as
+ * hz might not be set up yet!
+ */
+ k->k_repeat_start = 200;
+ k->k_repeat_step = 50;
+
+ k->k_belldata.wbd_pitch = 1500; /* 1500 Hz */
+ k->k_belldata.wbd_period = 100; /* 100 ms */
+ k->k_belldata.wbd_volume = 50; /* 50% volume */
+
+ k->k_idev = idev;
+ k->k_ispec = *ispec;
+}
+
+void
+kbd_repeat(void *arg)
+{
+ struct kbd_softc *k = (struct kbd_softc *)arg;
+ int s = spltty();
+
+ if (k->k_repeating && k->k_repeatcp != NULL) {
+ wscons_input(k->k_repeatcp);
+ timeout(kbd_repeat, k, (hz * k->k_repeat_step) / 1000);
+ }
+ splx(s);
+}
+
+void
+kbd_input(register int c)
+{
+ register struct kbd_softc *k = &kbd_softc;
+ register struct firm_event *fe;
+ register int put;
+ char *cp;
+
+ if (k->k_repeating) {
+ k->k_repeating = 0;
+ untimeout(kbd_repeat, k);
+ }
+
+ /*
+ * If /dev/kbd is not connected in event mode translate and
+ * send upstream.
+ */
+ if (!k->k_evmode) {
+ cp = (*k->k_ispec.wi_translate)(k->k_idev, c);
+ if (cp != NULL) {
+ wscons_input(cp);
+ k->k_repeating = 1;
+ k->k_repeatcp = cp;
+ timeout(kbd_repeat, k, (hz * k->k_repeat_start) / 1000);
+ }
+ return;
+ }
+
+ /*
+ * Keyboard is generating events. Turn this keystroke into an
+ * event and put it in the queue. If the queue is full, the
+ * keystroke is lost (sorry!).
+ */
+ put = k->k_events.ev_put;
+ fe = &k->k_events.ev_q[put];
+ put = (put + 1) % EV_QSIZE;
+ if (put == k->k_events.ev_get) {
+ log(LOG_WARNING, "keyboard event queue overflow\n"); /* ??? */
+ return;
+ }
+ fe->id = c & k->k_ispec.wi_keymask;
+ fe->value = (c & k->k_ispec.wi_keyupmask) != 0 ? VKEY_UP : VKEY_DOWN;
+ microtime(&fe->time);
+ k->k_events.ev_put = put;
+ EV_WAKEUP(&k->k_events);
+}
+
+int
+kbdopen(dev_t dev, int flags, int mode, struct proc *p)
+{
+ int s;
+ struct tty *tp;
+
+ if (kbd_softc.k_events.ev_io)
+ return (EBUSY);
+ kbd_softc.k_events.ev_io = p;
+ ev_init(&kbd_softc.k_events);
+ kbd_softc.k_evmode = 1;
+ return (0);
+}
+
+int
+kbdclose(dev_t dev, int flags, int mode, struct proc *p)
+{
+
+ /*
+ * Turn off event mode, dump the queue, and close the keyboard
+ * unless it is supplying console input.
+ */
+ kbd_softc.k_evmode = 0;
+ ev_fini(&kbd_softc.k_events);
+ kbd_softc.k_events.ev_io = NULL;
+ return (0);
+}
+
+int
+kbdread(dev_t dev, struct uio *uio, int flags)
+{
+
+ return (ev_read(&kbd_softc.k_events, uio, flags));
+}
+
+/* this routine should not exist, but is convenient to write here for now */
+int
+kbdwrite(dev_t dev, struct uio *uio, int flags)
+{
+
+ return (EOPNOTSUPP);
+}
+
+int
+kbdioctl(dev_t dev, u_long cmd, register caddr_t data, int flag, struct proc *p)
+{
+ struct kbd_softc *k = &kbd_softc;
+ struct wsconsio_bell_data *wbd;
+ int rv;
+
+ rv = ENOTTY;
+ switch (cmd) {
+#if 0
+ case KIOCSDIRECT:
+ k->k_evmode = *(int *)data;
+ return (0);
+#endif
+
+ case FIONBIO: /* we will remove this someday (soon???) */
+ return (0);
+
+ case FIOASYNC:
+ k->k_events.ev_async = *(int *)data != 0;
+ return (0);
+
+ case TIOCSPGRP:
+ if (*(int *)data != k->k_events.ev_io->p_pgid)
+ return (EPERM);
+ return (0);
+
+ case WSCONSIO_BELL:
+ if (k->k_ispec.wi_bell != NULL)
+ (*k->k_ispec.wi_bell)(k->k_idev, &k->k_belldata);
+ return (0);
+
+ case WSCONSIO_COMPLEXBELL:
+ if (k->k_ispec.wi_bell != NULL) {
+ wbd = (struct wsconsio_bell_data *)data;
+ if ((wbd->wbd_flags & WSCONSIO_BELLDATA_PITCH) == 0)
+ wbd->wbd_pitch = k->k_belldata.wbd_pitch;
+ if ((wbd->wbd_flags & WSCONSIO_BELLDATA_PERIOD) == 0)
+ wbd->wbd_period = k->k_belldata.wbd_period;
+ if ((wbd->wbd_flags & WSCONSIO_BELLDATA_VOLUME) == 0)
+ wbd->wbd_volume = k->k_belldata.wbd_volume;
+
+ (*k->k_ispec.wi_bell)(k->k_idev, wbd);
+ }
+ return (0);
+
+ case WSCONSIO_SETBELL:
+ wbd = (struct wsconsio_bell_data *)data;
+ if ((wbd->wbd_flags & WSCONSIO_BELLDATA_PITCH) != 0)
+ k->k_belldata.wbd_pitch = wbd->wbd_pitch;
+ if ((wbd->wbd_flags & WSCONSIO_BELLDATA_PERIOD) != 0)
+ k->k_belldata.wbd_period = wbd->wbd_period;
+ if ((wbd->wbd_flags & WSCONSIO_BELLDATA_VOLUME) != 0)
+ k->k_belldata.wbd_volume = wbd->wbd_volume;
+ return (0);
+
+ case WSCONSIO_GETBELL:
+ wbd = (struct wsconsio_bell_data *)data;
+ wbd->wbd_flags = WSCONSIO_BELLDATA_PITCH |
+ WSCONSIO_BELLDATA_PERIOD | WSCONSIO_BELLDATA_VOLUME;
+ wbd->wbd_pitch = k->k_belldata.wbd_pitch;
+ wbd->wbd_period = k->k_belldata.wbd_period;
+ wbd->wbd_volume = k->k_belldata.wbd_volume ;
+ return (0);
+
+#if 0 /* XXX */
+ /* XXX KEY-REPEAT RATE SETTING */
+#endif /* XXX */
+
+ default:
+ if (k->k_ispec.wi_ioctl != NULL)
+ rv = (*k->k_ispec.wi_ioctl)(k->k_idev, cmd, data,
+ flag, p);
+ }
+ return (rv);
+}
+
+int
+kbdselect(dev_t dev, int rw, struct proc *p)
+{
+
+ return (ev_select(&kbd_softc.k_events, rw, p));
+}
+
+/* Ring the console bell. (For wscons terminal emulator and other code) */
+void
+wscons_kbd_bell()
+{
+ struct kbd_softc *k = &kbd_softc;
+
+ if (k->k_ispec.wi_bell != NULL)
+ (*k->k_ispec.wi_bell)(k->k_idev, &k->k_belldata);
+}
+
+/*
+ * Console handling functions.
+ */
+
+int
+kbd_cngetc(dev)
+ dev_t dev;
+{
+ struct kbd_softc *k = &kbd_softc;
+
+ if (kbd_softc.k_evmode) /* XXX? */
+ return 0;
+ if (k->k_ispec.wi_getc != NULL)
+ return (*k->k_ispec.wi_getc)(k->k_idev);
+ else
+ return 0;
+}
+
+void
+kbd_cnpollc(dev, on)
+ dev_t dev;
+ int on;
+{
+ struct kbd_softc *k = &kbd_softc;
+
+ if (kbd_softc.k_evmode) /* XXX? */
+ return;
+ if (k->k_ispec.wi_pollc != NULL)
+ (*k->k_ispec.wi_pollc)(k->k_idev, on);
+}
diff --git a/sys/arch/alpha/wscons/ms.c b/sys/arch/alpha/wscons/ms.c
new file mode 100644
index 00000000000..240a0b4bfd6
--- /dev/null
+++ b/sys/arch/alpha/wscons/ms.c
@@ -0,0 +1,285 @@
+/* $NetBSD: ms.c,v 1.1 1996/04/12 02:00:47 cgd Exp $ */
+
+/*
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Lawrence Berkeley Laboratory.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)ms.c 8.1 (Berkeley) 6/11/93
+ */
+
+/*
+ * Mouse driver.
+ */
+
+#include <sys/param.h>
+#include <sys/conf.h>
+#include <sys/ioctl.h>
+#include <sys/kernel.h>
+#include <sys/proc.h>
+#include <sys/syslog.h>
+#include <sys/systm.h>
+#include <sys/tty.h>
+
+#include <machine/vuid_event.h>
+#include <alpha/wscons/event_var.h>
+#include <alpha/wscons/wsconsvar.h>
+
+struct ms_softc {
+ struct device *ms_dev;
+ struct wscons_mdev_spec ms_spec;
+ char ms_mb; /* mouse button state */
+ char ms_ub; /* user button state */
+ int ms_dx; /* delta-x */
+ int ms_dy; /* delta-y */
+ volatile int ms_ready; /* event queue is ready */
+ struct evvar ms_events; /* event queue state */
+} ms_softc;
+
+void
+msattach(mdev, mspec)
+ struct device *mdev;
+ struct wscons_mdev_spec *mspec;
+{
+ register struct ms_softc *m = &ms_softc;
+
+ m->ms_dev = mdev;
+ m->ms_spec = *mspec;
+}
+
+void
+ms_event(buttons, dx, dy)
+ char buttons; /* 0 is up */
+ int dx, dy;
+{
+ register struct firm_event *fe;
+ register struct ms_softc *ms = &ms_softc;
+ register int mb, ub, d, get, put, any;
+ static const char to_one[] = { 1, 2, 2, 4, 4, 4, 4 };
+ static const int to_id[] = { MS_RIGHT, MS_MIDDLE, 0, MS_LEFT };
+
+ /*
+ * Discard input if not ready.
+ */
+ if (ms->ms_ready == 0)
+ return;
+
+ ms->ms_mb = (buttons) & 0x7;
+ ms->ms_dx += dx;
+ ms->ms_dy += dy;
+
+ /*
+ * We have at least one event (mouse button, delta-X, or
+ * delta-Y; possibly all three, and possibly three separate
+ * button events). Deliver these events until we are out
+ * of changes or out of room. As events get delivered,
+ * mark them `unchanged'.
+ */
+ any = 0;
+ get = ms->ms_events.ev_get;
+ put = ms->ms_events.ev_put;
+ fe = &ms->ms_events.ev_q[put];
+
+ /* NEXT prepares to put the next event, backing off if necessary */
+#define NEXT \
+ if ((++put) % EV_QSIZE == get) { \
+ put--; \
+ goto out; \
+ }
+ /* ADVANCE completes the `put' of the event */
+#define ADVANCE \
+ fe++; \
+ if (put >= EV_QSIZE) { \
+ put = 0; \
+ fe = &ms->ms_events.ev_q[0]; \
+ } \
+ any = 1
+
+ mb = ms->ms_mb;
+ ub = ms->ms_ub;
+ while ((d = mb ^ ub) != 0) {
+ /*
+ * Mouse button change. Convert up to three changes
+ * to the `first' change, and drop it into the event queue.
+ */
+ NEXT;
+ d = to_one[d - 1]; /* from 1..7 to {1,2,4} */
+ fe->id = to_id[d - 1]; /* from {1,2,4} to ID */
+ fe->value = mb & d ? VKEY_DOWN : VKEY_UP;
+ fe->time = time;
+ ADVANCE;
+ ub ^= d;
+ }
+ if (ms->ms_dx) {
+ NEXT;
+ fe->id = LOC_X_DELTA;
+ fe->value = ms->ms_dx;
+ fe->time = time;
+ ADVANCE;
+ ms->ms_dx = 0;
+ }
+ if (ms->ms_dy) {
+ NEXT;
+ fe->id = LOC_Y_DELTA;
+ fe->value = ms->ms_dy;
+ fe->time = time;
+ ADVANCE;
+ ms->ms_dy = 0;
+ }
+out:
+ if (any) {
+ ms->ms_ub = ub;
+ ms->ms_events.ev_put = put;
+ EV_WAKEUP(&ms->ms_events);
+ }
+}
+
+int
+msopen(dev, flags, mode, p)
+ dev_t dev;
+ int flags, mode;
+ struct proc *p;
+{
+ int s, error;
+
+ if (ms_softc.ms_dev == NULL) /* never attached! */
+ return (ENXIO);
+
+ if (ms_softc.ms_events.ev_io)
+ return (EBUSY);
+
+ ms_softc.ms_events.ev_io = p;
+ ev_init(&ms_softc.ms_events); /* may cause sleep */
+
+ ms_softc.ms_ready = 1; /* start accepting events */
+
+ error = (*ms_softc.ms_spec.wm_enable)(ms_softc.ms_dev);
+
+ if (error) {
+ ms_softc.ms_ready = 0; /* stop accepting events */
+ ev_fini(&ms_softc.ms_events);
+ ms_softc.ms_events.ev_io = NULL;
+ return (error);
+ }
+
+ return (0);
+}
+
+int
+msclose(dev, flags, mode, p)
+ dev_t dev;
+ int flags, mode;
+ struct proc *p;
+{
+
+ (*ms_softc.ms_spec.wm_disable)(ms_softc.ms_dev);
+
+ ms_softc.ms_ready = 0; /* stop accepting events */
+ ev_fini(&ms_softc.ms_events);
+ ms_softc.ms_events.ev_io = NULL;
+ return (0);
+}
+
+int
+msread(dev, uio, flags)
+ dev_t dev;
+ struct uio *uio;
+ int flags;
+{
+
+ return (ev_read(&ms_softc.ms_events, uio, flags));
+}
+
+/* this routine should not exist, but is convenient to write here for now */
+int
+mswrite(dev, uio, flags)
+ dev_t dev;
+ struct uio *uio;
+ int flags;
+{
+
+ return (EOPNOTSUPP);
+}
+
+int
+msioctl(dev, cmd, data, flag, p)
+ dev_t dev;
+ u_long cmd;
+ register caddr_t data;
+ int flag;
+ struct proc *p;
+{
+ int s;
+
+ switch (cmd) {
+
+ case FIONBIO: /* we will remove this someday (soon???) */
+ return (0);
+
+ case FIOASYNC:
+ ms_softc.ms_events.ev_async = *(int *)data != 0;
+ return (0);
+
+ case TIOCSPGRP:
+ if (*(int *)data != ms_softc.ms_events.ev_io->p_pgid)
+ return (EPERM);
+ return (0);
+
+ case VUIDGFORMAT:
+ /* we only do firm_events */
+ *(int *)data = VUID_FIRM_EVENT;
+ return (0);
+
+ case VUIDSFORMAT:
+ if (*(int *)data != VUID_FIRM_EVENT)
+ return (EINVAL);
+ return (0);
+ }
+ return (ENOTTY);
+}
+
+int
+msselect(dev, rw, p)
+ dev_t dev;
+ int rw;
+ struct proc *p;
+{
+
+ return (ev_select(&ms_softc.ms_events, rw, p));
+}
diff --git a/sys/arch/alpha/wscons/wscons.c b/sys/arch/alpha/wscons/wscons.c
new file mode 100644
index 00000000000..2845895227d
--- /dev/null
+++ b/sys/arch/alpha/wscons/wscons.c
@@ -0,0 +1,495 @@
+/* $NetBSD: wscons.c,v 1.3.4.1 1996/06/03 18:54:35 cgd Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#include <sys/param.h>
+#include <sys/device.h>
+#include <sys/kernel.h>
+#include <sys/conf.h>
+#include <sys/systm.h>
+#include <sys/malloc.h>
+#include <sys/ioctl.h>
+#include <sys/proc.h>
+#include <sys/tty.h>
+#include <sys/termios.h>
+
+#include <dev/cons.h>
+#include <alpha/wscons/wsconsvar.h>
+#include <alpha/wscons/wscons_emul.h>
+#include <machine/wsconsio.h>
+
+cdev_decl(wscons);
+
+/* Macros to clear/set/test flags. */
+#define SET(t, f) (t) |= (f)
+#define CLR(t, f) (t) &= ~(f)
+#define ISSET(t, f) ((t) & (f))
+
+/*
+ * Autoconfiguration glue.
+ */
+struct wscons_softc {
+ struct device sc_dev;
+
+ struct wscons_emul_data *sc_emul_data;
+ struct tty *sc_tty;
+
+ wscons_ioctl_t sc_ioctl;
+ wscons_mmap_t sc_mmap;
+};
+
+int wsconsmatch __P((struct device *, void *, void *));
+void wsconsattach __P((struct device *, struct device *, void *));
+
+struct cfattach wscons_ca = {
+ sizeof (struct wscons_softc), wsconsmatch, wsconsattach,
+};
+
+struct cfdriver wscons_cd = {
+ NULL, "wscons", DV_TTY,
+};
+
+/*
+ * Console handing functions and variables.
+ */
+int wscons_console_attached; /* polled console fns attached */
+int wscons_console_unit = -1;
+struct wscons_emul_data wscons_console_emul_data;
+
+int wscons_cngetc __P((dev_t));
+void wscons_cnputc __P((dev_t, int));
+void wscons_cnpollc __P((dev_t, int));
+
+struct consdev wscons_consdev =
+ { NULL, NULL, wscons_cngetc, wscons_cnputc, wscons_cnpollc, NODEV, 1 };
+
+/*
+ * Input focus handling: where characters from the keyboard are sent.
+ */
+int wscons_input_focus = -1;
+
+/*
+ * TTY interface helpers.
+ */
+
+#define WSCUNIT(dev) minor(dev)
+
+void wsconsstart __P((struct tty *));
+int wsconsparam __P((struct tty *, struct termios *));
+
+
+/*
+ * Output device selection and attachment.
+ */
+
+int
+wsconsmatch(parent, cfdata, aux)
+ struct device *parent;
+ void *cfdata;
+ void *aux;
+{
+ struct wscons_attach_args *waa = aux;
+ struct cfdata *cf = cfdata;
+
+ if (waa->waa_isconsole && wscons_console_unit != -1)
+ panic("wsconsmatch: multiple consoles?");
+
+ /* If console-ness specified... */
+ if (cf->wsconscf_console != -1) {
+ /*
+ * If exact match, return match with high priority,
+ * else return don't match.
+ */
+ if ((cf->wsconscf_console && waa->waa_isconsole) ||
+ (!cf->wsconscf_console && !waa->waa_isconsole))
+ return (10);
+ else
+ return (0);
+ }
+
+ /* Otherwise match with low priority. */
+ return (1);
+}
+
+void
+wsconsattach(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ struct wscons_attach_args *waa = aux;
+ struct wscons_softc *sc = (struct wscons_softc *)self;
+ int console;
+
+ console = waa->waa_isconsole;
+ if (console)
+ printf(": console");
+
+ /*
+ * If output has already been set up, record it now. Otherwise,
+ * do the setup.
+ */
+ if (console) {
+ sc->sc_emul_data = &wscons_console_emul_data;
+ wscons_console_unit = sc->sc_dev.dv_unit;
+ wscons_consdev.cn_dev =
+ makedev(25, wscons_console_unit); /* XXX */
+ } else {
+ sc->sc_emul_data = malloc(sizeof(*sc->sc_emul_data), M_DEVBUF,
+ M_WAITOK);
+ wscons_emul_attach(sc->sc_emul_data, &waa->waa_odev_spec);
+ }
+
+ /*
+ * Set wscons input focus if this is the console device,
+ * or if we've not yet set the input focus.
+ */
+ if (console || wscons_input_focus == -1)
+ wscons_input_focus = sc->sc_dev.dv_unit;
+
+ /*
+ * Set up the device's tty structure.
+ */
+ sc->sc_tty = ttymalloc();
+ tty_attach(sc->sc_tty);
+
+ /*
+ * Record other relevant information: ioctl and mmap functions.
+ */
+ sc->sc_ioctl = waa->waa_odev_spec.wo_ioctl;
+ sc->sc_mmap = waa->waa_odev_spec.wo_mmap;
+
+ printf("\n");
+}
+
+
+/*
+ * Keyboard input handling.
+ */
+
+void
+wscons_input(cp)
+ char *cp;
+{
+ struct wscons_softc *sc;
+ struct tty *tp;
+
+ if (wscons_input_focus == -1)
+ return;
+
+#ifdef DIAGNOSTIC
+ if (wscons_input_focus >= wscons_cd.cd_ndevs)
+ panic("wscons_input: bogus input focus");
+ sc = wscons_cd.cd_devs[wscons_input_focus];
+ if (sc == NULL)
+ panic("wscons_input: null input device");
+ tp = sc->sc_tty;
+ if (tp == NULL)
+ panic("wscons_input: no tty");
+#else
+ sc = wscons_cd.cd_devs[wscons_input_focus];
+ tp = sc->sc_tty;
+#endif
+
+ while (*cp)
+ (*linesw[tp->t_line].l_rint)(*cp++, tp);
+}
+
+
+/*
+ * Console (output) tty-handling functions.
+ */
+
+int
+wsconsopen(dev, flag, mode, p)
+ dev_t dev;
+ int flag, mode;
+ struct proc *p;
+{
+ struct wscons_softc *sc;
+ int unit = WSCUNIT(dev), newopen, rv;
+ struct tty *tp;
+
+ if (unit >= wscons_cd.cd_ndevs)
+ return ENXIO;
+ sc = wscons_cd.cd_devs[unit];
+ if (sc == NULL)
+ return ENXIO;
+
+#ifdef DIAGNOSTIC
+ if (!sc->sc_tty)
+ panic("wscopen: no tty!");
+#endif
+ tp = sc->sc_tty;
+
+ tp->t_oproc = wsconsstart;
+ tp->t_param = wsconsparam;
+ tp->t_dev = dev;
+ newopen = (tp->t_state & TS_ISOPEN) == 0;
+ if (newopen) {
+ tp->t_state |= TS_WOPEN;
+ ttychars(tp);
+ tp->t_iflag = TTYDEF_IFLAG;
+ tp->t_oflag = TTYDEF_OFLAG;
+ tp->t_cflag = TTYDEF_CFLAG;
+ tp->t_lflag = TTYDEF_LFLAG;
+ tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
+ wsconsparam(tp, &tp->t_termios);
+ ttsetwater(tp);
+ } else if ((tp->t_state & TS_XCLUDE) != 0 && p->p_ucred->cr_uid != 0)
+ return EBUSY;
+ tp->t_state |= TS_CARR_ON;
+
+ rv = ((*linesw[tp->t_line].l_open)(dev, tp));
+ if (newopen && (rv == 0)) {
+ /* set window sizes to be correct */
+ tp->t_winsize.ws_row = sc->sc_emul_data->ac_nrow;
+ tp->t_winsize.ws_col = sc->sc_emul_data->ac_ncol;
+ }
+ return (rv);
+}
+
+int
+wsconsclose(dev, flag, mode, p)
+ dev_t dev;
+ int flag, mode;
+ struct proc *p;
+{
+ struct wscons_softc *sc = wscons_cd.cd_devs[WSCUNIT(dev)];
+ struct tty *tp = sc->sc_tty;
+
+ (*linesw[tp->t_line].l_close)(tp, flag);
+ ttyclose(tp);
+ return(0);
+}
+
+int
+wsconsread(dev, uio, flag)
+ dev_t dev;
+ struct uio *uio;
+ int flag;
+{
+ struct wscons_softc *sc = wscons_cd.cd_devs[WSCUNIT(dev)];
+ struct tty *tp = sc->sc_tty;
+
+ return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
+}
+
+int
+wsconswrite(dev, uio, flag)
+ dev_t dev;
+ struct uio *uio;
+ int flag;
+{
+ struct wscons_softc *sc = wscons_cd.cd_devs[WSCUNIT(dev)];
+ struct tty *tp = sc->sc_tty;
+
+ return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
+}
+
+struct tty *
+wsconstty(dev)
+ dev_t dev;
+{
+ struct wscons_softc *sc = wscons_cd.cd_devs[WSCUNIT(dev)];
+ struct tty *tp = sc->sc_tty;
+
+ return (tp);
+}
+
+int
+wsconsioctl(dev, cmd, data, flag, p)
+ dev_t dev;
+ u_long cmd;
+ caddr_t data;
+ int flag;
+ struct proc *p;
+{
+ struct wscons_softc *sc = wscons_cd.cd_devs[WSCUNIT(dev)];
+ struct tty *tp = sc->sc_tty;
+ int error;
+
+ /* do the line discipline ioctls first */
+ error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
+ if (error >= 0)
+ return error;
+
+ /* then the tty ioctls */
+ error = ttioctl(tp, cmd, data, flag, p);
+ if (error >= 0)
+ return error;
+
+ /* then the underlying frame buffer device ioctls */
+ if (sc->sc_ioctl != NULL)
+ error = (*sc->sc_ioctl)(sc->sc_dev.dv_parent, cmd, data,
+ flag, p);
+ if (error >= 0)
+ return error;
+
+ /*
+ * then the keyboard ioctls, if we have input focus.
+ * This is done last because it's a special case: it will
+ * return ENOTTY (not -1) if it can't figure out what
+ * to do with the request.
+ */
+ if (WSCUNIT(dev) == wscons_input_focus)
+ error = kbdioctl(0, cmd, data, flag, p); /* XXX dev */
+ else
+ error = ENOTTY;
+
+ return (error);
+}
+
+int
+wsconsmmap(dev, offset, prot)
+ dev_t dev;
+ int offset; /* XXX */
+ int prot;
+{
+ struct wscons_softc *sc = wscons_cd.cd_devs[WSCUNIT(dev)];
+
+ if (sc->sc_ioctl != NULL)
+ return (*sc->sc_mmap)(sc->sc_dev.dv_parent, offset, prot);
+ else
+ return -1;
+}
+
+void
+wsconsstart(tp)
+ register struct tty *tp;
+{
+ struct wscons_softc *sc;
+ register int s, n, i;
+ char buf[OBUFSIZ];
+
+ s = spltty();
+ if (tp->t_state & (TS_TIMEOUT | TS_BUSY | TS_TTSTOP)) {
+ splx(s);
+ return;
+ }
+ tp->t_state |= TS_BUSY;
+ splx(s);
+
+ n = q_to_b(&tp->t_outq, buf, sizeof(buf));
+ for (i = 0; i < n; ++i)
+ buf[i] &= 0177; /* strip parity (argh) */
+
+ sc = wscons_cd.cd_devs[WSCUNIT(tp->t_dev)];
+ wscons_emul_input(sc->sc_emul_data, buf, n);
+
+ s = spltty();
+ tp->t_state &= ~TS_BUSY;
+ /* Come back if there's more to do */
+ if (tp->t_outq.c_cc) {
+ tp->t_state |= TS_TIMEOUT;
+ timeout(ttrstrt, tp, 1);
+ }
+ if (tp->t_outq.c_cc <= tp->t_lowat) {
+ if (tp->t_state&TS_ASLEEP) {
+ tp->t_state &= ~TS_ASLEEP;
+ wakeup((caddr_t)&tp->t_outq);
+ }
+ selwakeup(&tp->t_wsel);
+ }
+ splx(s);
+}
+
+int
+wsconsstop(tp, flag)
+ struct tty *tp;
+ int flag;
+{
+ int s;
+
+ /* XXX ??? */
+ s = spltty();
+ if (ISSET(tp->t_state, TS_BUSY))
+ if (!ISSET(tp->t_state, TS_TTSTOP))
+ SET(tp->t_state, TS_FLUSH);
+ splx(s);
+}
+
+/*
+ * Set line parameters.
+ */
+int
+wsconsparam(tp, t)
+ struct tty *tp;
+ struct termios *t;
+{
+
+ tp->t_ispeed = t->c_ispeed;
+ tp->t_ospeed = t->c_ospeed;
+ tp->t_cflag = t->c_cflag;
+ return 0;
+}
+
+
+/*
+ * Polled-console handing setup and manipulation.
+ */
+
+void
+wscons_attach_console(wo)
+ const struct wscons_odev_spec *wo;
+{
+
+ if (wscons_console_attached)
+ panic("wscons_attach_console: multiple times");
+
+ wscons_emul_attach(&wscons_console_emul_data, wo);
+ cn_tab = &wscons_consdev;
+ wscons_console_attached = 1;
+}
+
+void
+wscons_cnputc(dev, ic)
+ dev_t dev;
+ int ic;
+{
+ char c = ic;
+
+ if (wscons_console_attached)
+ wscons_emul_input(&wscons_console_emul_data, &c, 1);
+}
+
+int
+wscons_cngetc(dev)
+ dev_t dev;
+{
+
+ return kbd_cngetc(dev); /* XXX XXX */
+}
+
+void
+wscons_cnpollc(dev, i)
+ dev_t dev;
+ int i;
+{
+
+ kbd_cngetc(dev, i); /* XXX XXX */
+}
diff --git a/sys/arch/alpha/wscons/wscons_emul.c b/sys/arch/alpha/wscons/wscons_emul.c
new file mode 100644
index 00000000000..cb218fd5cd0
--- /dev/null
+++ b/sys/arch/alpha/wscons/wscons_emul.c
@@ -0,0 +1,416 @@
+/* $NetBSD: wscons_emul.c,v 1.2 1996/04/12 06:10:29 cgd Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+/*
+ * Console emulator for a 'generic' ANSI X3.64 console.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <alpha/wscons/wsconsvar.h>
+#include <alpha/wscons/wscons_emul.h>
+#include <alpha/wscons/ascii.h>
+
+void
+wscons_emul_attach(we, wo)
+ struct wscons_emul_data *we;
+ const struct wscons_odev_spec *wo;
+{
+ int i;
+
+#ifdef DIAGNOSTIC
+ if (we == NULL || wo == NULL)
+ panic("wscons_emul_attach: bogus args");
+ if (wo->wo_ef == NULL)
+ panic("wscons_emul_attach: bogus emul functions");
+#endif
+ if (wo->wo_nrows < 0 || wo->wo_ncols < 0)
+ panic("wscons_emul_attach: bogus size");
+ if (wo->wo_crow < 0 || wo->wo_ccol < 0 ||
+ wo->wo_crow >= wo->wo_nrows || wo->wo_ccol >= wo->wo_ncols)
+ panic("wscons_emul_attach: bogus location (n: %d/%d, c: %d/%d",
+ wo->wo_nrows, wo->wo_ncols, wo->wo_crow, wo->wo_ccol);
+
+ we->ac_state = ANSICONS_STATE_NORMAL;
+ we->ac_ef = wo->wo_ef;
+ we->ac_efa = wo->wo_efa;
+
+ we->ac_nrow = wo->wo_nrows;
+ we->ac_ncol = wo->wo_ncols;
+
+ we->ac_crow = wo->wo_crow;
+ we->ac_ccol = wo->wo_ccol;
+
+ for (i = 0; i < ANSICONS_NARGS; i++)
+ we->ac_args[i] = 0;
+
+ (*we->ac_ef->wef_cursor)(we->ac_efa, 1, we->ac_crow, we->ac_ccol);
+}
+
+static inline int
+wscons_emul_input_normal(we, c)
+ struct wscons_emul_data *we;
+ char c;
+{
+ int newstate = ANSICONS_STATE_NORMAL;
+ int n;
+
+ switch (c) {
+ case ASCII_BEL:
+ wscons_kbd_bell();
+ break;
+
+ case ASCII_BS:
+ if (we->ac_ccol > 0)
+ we->ac_ccol--;
+ break;
+
+ case ASCII_HT:
+ n = 8 - (we->ac_ccol & 7);
+ if (we->ac_ccol + n >= we->ac_ncol)
+ n = we->ac_ncol - we->ac_ccol - 1;
+
+ (*we->ac_ef->wef_erasecols)(we->ac_efa, we->ac_crow,
+ we->ac_ccol, we->ac_ccol + n);
+
+ we->ac_ccol += n;
+ break;
+
+ case ASCII_LF:
+ if (we->ac_crow < we->ac_nrow - 1) {
+ we->ac_crow++;
+ break;
+ }
+
+#ifdef DIAGNOSTIC
+ if (we->ac_crow >= we->ac_nrow)
+ panic("wscons_emul: didn't scroll (1)");
+#endif
+
+#if 0
+ (*we->ac_ef->wef_copyrows)(we->ac_efa, 1, 0,
+ we->ac_nrow - 1);
+ (*we->ac_ef->wef_eraserows)(we->ac_efa,
+ we->ac_nrow - 1, 1);
+#else
+ (*we->ac_ef->wef_copyrows)(we->ac_efa, 10, 0,
+ we->ac_nrow - 10);
+ (*we->ac_ef->wef_eraserows)(we->ac_efa,
+ we->ac_nrow - 10, 10);
+ we->ac_crow -= 10 - 1;
+#endif
+ break;
+
+ case ASCII_VT:
+ if (we->ac_crow > 0)
+ we->ac_crow--;
+ break;
+
+ case ASCII_NP:
+ (*we->ac_ef->wef_eraserows)(we->ac_efa,
+ 0, we->ac_nrow - 1);
+
+ we->ac_ccol = 0;
+ we->ac_crow = 0;
+ break;
+
+ case ASCII_CR:
+ we->ac_ccol = 0;
+ break;
+
+ case ASCII_ESC:
+ if (we->ac_state == ANSICONS_STATE_NORMAL) {
+ newstate = ANSICONS_STATE_HAVEESC;
+ break;
+ }
+ /* else fall through; we're printing one out */
+
+ default:
+ (*we->ac_ef->wef_putstr)(we->ac_efa,
+ we->ac_crow, we->ac_ccol, &c, 1);
+ we->ac_ccol++;
+
+ /* if the current column is still on the current line, done. */
+ if (we->ac_ccol < we->ac_ncol)
+ break;
+
+ /* wrap the column around. */
+ we->ac_ccol = 0;
+
+ /* if the current row isn't the last, increment and leave. */
+ if (we->ac_crow < we->ac_nrow - 1) {
+ we->ac_crow++;
+ break;
+ }
+
+#ifdef DIAGNOSTIC
+ /* check against row overflow */
+ if (we->ac_crow >= we->ac_nrow)
+ panic("wscons_emul: didn't scroll (2)");
+#endif
+
+#if 0
+ /* scroll all of the rows up one; leave current row # alone */
+ (*we->ac_ef->wef_copyrows)(we->ac_efa, 1, 0,
+ we->ac_nrow - 1);
+ (*we->ac_ef->wef_eraserows)(we->ac_efa,
+ we->ac_nrow - 1, 1);
+#else
+ (*we->ac_ef->wef_copyrows)(we->ac_efa, 10, 0,
+ we->ac_nrow - 10);
+ (*we->ac_ef->wef_eraserows)(we->ac_efa,
+ we->ac_nrow - 10, 10);
+ we->ac_crow -= 10 - 1;
+#endif
+ break;
+ }
+
+ return newstate;
+}
+
+static inline int
+wscons_emul_input_haveesc(we, c)
+ struct wscons_emul_data *we;
+ char c;
+{
+ int newstate = ANSICONS_STATE_NORMAL;
+ int i;
+
+ switch (c) {
+ case '[':
+ for (i = 0; i < ANSICONS_NARGS; i++)
+ we->ac_args[i] = 0;
+ newstate = ANSICONS_STATE_CONTROL;
+ break;
+
+ default:
+ wscons_emul_input_normal(we, ASCII_ESC); /* special cased */
+ newstate = wscons_emul_input_normal(we, c);
+ break;
+ }
+
+ return newstate;
+}
+
+static inline void
+wscons_emul_docontrol(we, c)
+ struct wscons_emul_data *we;
+ char c;
+{
+ int n, m;
+
+#if 0
+ printf("control: %c: %d, %d\n", c, we->ac_args[0], we->ac_args[1]);
+#endif
+ switch (c) {
+ case 'A': /* Cursor Up */
+ n = we->ac_args[0] ? we->ac_args[0] : 1;
+ n = min(n, we->ac_crow);
+ we->ac_crow -= n;
+ break;
+
+ case 'B': /* Cursor Down */
+ n = we->ac_args[0] ? we->ac_args[0] : 1;
+ n = min(n, we->ac_nrow - we->ac_crow - 1);
+ we->ac_crow += n;
+ break;
+
+ case 'C': /* Cursor Forward */
+ n = we->ac_args[0] ? we->ac_args[0] : 1;
+ n = min(n, we->ac_ncol - we->ac_ccol - 1);
+ we->ac_ccol += n;
+ break;
+
+ case 'D': /* Cursor Backward */
+ n = we->ac_args[0] ? we->ac_args[0] : 1;
+ n = min(n, we->ac_ccol);
+ we->ac_ccol -= n;
+ break;
+
+ case 'E': /* Cursor Next Line */
+ n = we->ac_args[0] ? we->ac_args[0] : 1;
+ n = min(n, we->ac_nrow - we->ac_crow - 1);
+ we->ac_crow += n;
+ we->ac_ccol = 0;
+ break;
+
+ case 'f': /* Horizontal and Vertical Position */
+ case 'H': /* Cursor Position */
+ m = we->ac_args[1] ? we->ac_args[1] : 1; /* arg 1 */
+ m = min(m, we->ac_nrow);
+
+ n = we->ac_args[0] ? we->ac_args[0] : 1; /* arg 2 */
+ n = min(n, we->ac_ncol);
+
+ we->ac_crow = m - 1;
+ we->ac_ccol = n - 1;
+ break;
+
+ case 'J': /* Erase in Display */
+ (*we->ac_ef->wef_erasecols)(we->ac_efa, we->ac_crow,
+ we->ac_ccol, we->ac_ncol - we->ac_ccol);
+ if (we->ac_crow + 1 < we->ac_nrow)
+ (*we->ac_ef->wef_eraserows)(we->ac_efa,
+ we->ac_crow + 1, we->ac_nrow - we->ac_crow - 1);
+ break;
+
+ case 'K': /* Erase in Line */
+ (*we->ac_ef->wef_erasecols)(we->ac_efa, we->ac_crow,
+ we->ac_ccol, we->ac_ncol - we->ac_ccol);
+ break;
+
+ case 'L': /* Insert Line */
+ {
+ int copy_src, copy_dst, copy_nlines;
+
+ n = we->ac_args[0] ? we->ac_args[0] : 1;
+ n = min(n, we->ac_nrow - we->ac_crow);
+
+ copy_src = we->ac_crow;
+ copy_dst = we->ac_crow + n;
+ copy_nlines = we->ac_nrow - copy_dst;
+ if (copy_nlines > 0)
+ (*we->ac_ef->wef_copyrows)(we->ac_efa,
+ copy_src, copy_dst, copy_nlines);
+
+ (*we->ac_ef->wef_eraserows)(we->ac_efa,
+ we->ac_crow, n);
+ }
+ break;
+
+ case 'M': /* Delete Line */
+ {
+ int copy_src, copy_dst, copy_nlines;
+
+ n = we->ac_args[0] ? we->ac_args[0] : 1;
+ n = min(n, we->ac_nrow - we->ac_crow);
+
+ copy_src = we->ac_crow + n;
+ copy_dst = we->ac_crow;
+ copy_nlines = we->ac_nrow - copy_src;
+ if (copy_nlines > 0)
+ (*we->ac_ef->wef_copyrows)(we->ac_efa,
+ copy_src, copy_dst, copy_nlines);
+
+ (*we->ac_ef->wef_eraserows)(we->ac_efa,
+ we->ac_crow + copy_nlines,
+ we->ac_nrow - (we->ac_crow + copy_nlines));
+ }
+ break;
+
+ case 'P': /* Delete Character */
+ {
+ int copy_src, copy_dst, copy_ncols;
+
+ n = we->ac_args[0] ? we->ac_args[0] : 1;
+ n = min(n, we->ac_ncol - we->ac_ccol);
+
+ copy_src = we->ac_ccol + n;
+ copy_dst = we->ac_ccol;
+ copy_ncols = we->ac_ncol - copy_src;
+ if (copy_ncols > 0)
+ (*we->ac_ef->wef_copycols)(we->ac_efa,
+ we->ac_crow, copy_src, copy_dst,
+ copy_ncols);
+
+ (*we->ac_ef->wef_erasecols)(we->ac_efa,
+ we->ac_crow, we->ac_ccol + copy_ncols,
+ we->ac_ncol - (we->ac_ccol + copy_ncols));
+ break;
+ }
+ break;
+ }
+}
+
+static inline int
+wscons_emul_input_control(we, c)
+ struct wscons_emul_data *we;
+ char c;
+{
+ int newstate = ANSICONS_STATE_CONTROL;
+ int i;
+
+ switch (c) {
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ we->ac_args[0] *= 10;
+ we->ac_args[0] += c - '0';
+ break;
+
+ case ';':
+ for (i = 0; i < ANSICONS_NARGS - 1; i++)
+ we->ac_args[i + 1] = we->ac_args[i];
+ we->ac_args[0] = 0;
+ break;
+
+ default:
+ wscons_emul_docontrol(we, c);
+ newstate = ANSICONS_STATE_NORMAL;
+ break;
+ }
+
+ return newstate;
+}
+
+void
+wscons_emul_input(we, cp, n)
+ struct wscons_emul_data *we;
+ char *cp;
+ int n;
+{
+ int newstate;
+
+ (*we->ac_ef->wef_cursor)(we->ac_efa, 0, we->ac_crow, we->ac_ccol);
+ for (; n; n--, cp++) {
+ switch (we->ac_state) {
+ case ANSICONS_STATE_NORMAL:
+ newstate = wscons_emul_input_normal(we, *cp);
+ break;
+
+ case ANSICONS_STATE_HAVEESC:
+ newstate = wscons_emul_input_haveesc(we, *cp);
+ break;
+
+ case ANSICONS_STATE_CONTROL:
+ newstate = wscons_emul_input_control(we, *cp);
+ break;
+
+ default:
+#ifdef DIAGNOSTIC
+ panic("wscons_emul: invalid state %d\n", we->ac_state);
+#endif
+ /* try to recover, if things get screwed up... */
+ newstate = ANSICONS_STATE_NORMAL;
+ break;
+ }
+
+ we->ac_state = newstate;
+ }
+ (*we->ac_ef->wef_cursor)(we->ac_efa, 1, we->ac_crow, we->ac_ccol);
+}
diff --git a/sys/arch/alpha/wscons/wscons_emul.h b/sys/arch/alpha/wscons/wscons_emul.h
new file mode 100644
index 00000000000..acae6a9b158
--- /dev/null
+++ b/sys/arch/alpha/wscons/wscons_emul.h
@@ -0,0 +1,50 @@
+/* $NetBSD: wscons_emul.h,v 1.2 1996/04/12 06:10:32 cgd Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#define ANSICONS_NARGS 4
+
+struct wscons_emul_data {
+ int ac_state; /* current state; see below */
+
+ const struct wscons_emulfuncs *ac_ef; /* emul. callback functions */
+ void *ac_efa; /* arg. for callbacks */
+
+ int ac_nrow, ac_ncol; /* number of rows/columns */
+ int ac_crow, ac_ccol; /* current row/column */
+
+ u_int ac_args[ANSICONS_NARGS]; /* emulation args */
+};
+
+#define ANSICONS_STATE_NORMAL 0 /* normal processing */
+#define ANSICONS_STATE_HAVEESC 1 /* seen start of ctl seq */
+#define ANSICONS_STATE_CONTROL 2 /* processing ctl seq */
+
+void wscons_emul_attach __P((struct wscons_emul_data *,
+ const struct wscons_odev_spec *));
+void wscons_emul_input __P((struct wscons_emul_data *, char *, int));
diff --git a/sys/arch/alpha/wscons/wscons_raster.h b/sys/arch/alpha/wscons/wscons_raster.h
new file mode 100644
index 00000000000..33edc0cab95
--- /dev/null
+++ b/sys/arch/alpha/wscons/wscons_raster.h
@@ -0,0 +1,93 @@
+/* $NetBSD: wscons_raster.h,v 1.1 1996/04/12 02:00:51 cgd Exp $ */
+
+/*
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Lawrence Berkeley Laboratory.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)fbvar.h 8.1 (Berkeley) 6/11/93
+ */
+
+#ifndef _DEV_PSEUDO_RCONS_H_
+#define _DEV_PSEUDO_RCONS_H_
+
+struct rcons {
+ /* Console raster. Filled in before rcons_init(). */
+ struct raster *rc_sp; /* frame buffer raster */
+ int *rc_crowp; /* ptr to cursror row */
+ int *rc_ccolp; /* ptr to cursror column */
+
+ /* Number of rows/columns on raster. Filled in by rcons_init(). */
+ int rc_maxrow; /* emulator height of screen */
+ int rc_maxcol; /* emulator width of screen */
+
+ /* Font information. Filled in by rcons_init(). */
+ struct raster_font *rc_font; /* font and related info */
+ int rc_font_ascent; /* distance from font to char origin */
+
+ /* Raster console state. Filled in by rcons_init(). */
+ u_int rc_bits; /* see defines below */
+ int rc_xorigin; /* x origin for first column */
+ int rc_yorigin; /* y origin for first row */
+ int rc_raswidth; /* raster width for row copies */
+ int rc_ras_blank; /* current screen blank raster op */
+
+ /* Internal cursor row and column. XXX Weird Sun cursor pointers. */
+ int rc_crow; /* internal cursror row */
+ int rc_ccol; /* ptr to cursror column */
+};
+
+#define RC_STANDOUT 0x001 /* standout mode */
+/* #define RC_BOLD 0x? /* boldface mode */
+#define RC_INVERT 0x002 /* inverted screen colors */
+#define RC_CURSOR 0x004 /* cursor currently displayed */
+
+/* Initialization functions. */
+void rcons_init __P((struct rcons *rc, int mrow, int mcol));
+
+/* Console emulation interface functions. See ansicons.h for more info. */
+void rcons_cursor __P((void *, int, int, int));
+void rcons_invert __P((void *, int));
+void rcons_putstr __P((void *, int, int, char *, int));
+void rcons_copycols __P((void *, int, int, int, int));
+void rcons_erasecols __P((void *, int, int, int));
+void rcons_copyrows __P((void *, int, int, int));
+void rcons_eraserows __P((void *, int, int));
+
+#endif /* _DEV_PSEUDO_RCONS_H_ */
diff --git a/sys/arch/alpha/wscons/wscons_rfont.h b/sys/arch/alpha/wscons/wscons_rfont.h
new file mode 100644
index 00000000000..c836524b372
--- /dev/null
+++ b/sys/arch/alpha/wscons/wscons_rfont.h
@@ -0,0 +1,1010 @@
+/* $NetBSD: wscons_rfont.h,v 1.1 1996/04/12 02:00:52 cgd Exp $ */
+
+/*
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to the Computer Systems
+ * Engineering Group at Lawrence Berkeley Laboratory and to the University
+ * of California at Berkeley by Jef Poskanzer.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)gallant19.h 8.1 (Berkeley) 6/11/93
+ */
+
+static u_int32_t gallant19_32_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x000018c0, 0x000003c0, 0x000030c0,
+ 0x000030c0, 0x00001ee0, 0x00000000, 0x00000000, 0x00002000, 0x0000e000,
+ 0x00006000, 0x00006fc0, 0x00006060, 0x00006060, 0x00007060, 0x00004f80,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_32 = { 12, 22, 1, 1, gallant19_32_pixels, 0 };
+
+static u_int32_t gallant19_33_pixels[] = {
+ 0x00000000,
+ 0x06000000, 0x06000000, 0x06000060, 0x06000060, 0x06000060, 0x060031e0,
+ 0x06006060, 0x06006060, 0x060070e0, 0x06001e70, 0x06000000, 0x00000000,
+ 0x00000000, 0x06000000, 0x06000000, 0x000030c0, 0x00006060, 0x00006000,
+ 0x00003000, 0x00000f80, 0x00000000
+};
+static struct raster gallant19_33 = { 12, 22, 1, 1, gallant19_33_pixels, 0 };
+
+static u_int32_t gallant19_34_pixels[] = {
+ 0x00000000,
+ 0x19800c00, 0x19801e00, 0x19800000, 0x19800000, 0x19800000, 0x19800000,
+ 0x00000000, 0x000031e0, 0x000060c0, 0x00003180, 0x00006000, 0x00003fe0,
+ 0x00004020, 0x00007fc0, 0x00001000, 0x00007000, 0x00003000, 0x000039c0,
+ 0x000030c0, 0x000030c0, 0x00000000
+};
+static struct raster gallant19_34 = { 12, 22, 1, 1, gallant19_34_pixels, 0 };
+
+static u_int32_t gallant19_35_pixels[] = {
+ 0x00000000,
+ 0x03300600, 0x03300600, 0x03300600, 0x06601f80, 0x1ff00000, 0x1ff00000,
+ 0x0cc00000, 0x0cc000c0, 0x19800000, 0x198000c0, 0x7fc000c0, 0x7fc000c0,
+ 0x330000c0, 0x660000c0, 0x660030c0, 0x00001f00, 0x00006000, 0x00006000,
+ 0x00006000, 0x00006300, 0x00000000
+};
+static struct raster gallant19_35 = { 12, 22, 1, 1, gallant19_35_pixels, 0 };
+
+static u_int32_t gallant19_36_pixels[] = {
+ 0x00000000,
+ 0x06000600, 0x1f800600, 0x3fc00600, 0x66e00600, 0x66600600, 0x66001f80,
+ 0x3e000000, 0x1f800000, 0x07c00000, 0x06600000, 0x06600000, 0x66606ee0,
+ 0x7fc06660, 0x3f806660, 0x06006660, 0x0000ef70, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_36 = { 12, 22, 1, 1, gallant19_36_pixels, 0 };
+
+static u_int32_t gallant19_37_pixels[] = {
+ 0x00000000,
+ 0x38600000, 0x44c00000, 0x44c00000, 0x458011c0, 0x39806060, 0x03006060,
+ 0x03007040, 0x06001f00, 0x0c000000, 0x0c000000, 0x19c00000, 0x1a200000,
+ 0x32200000, 0x322071c0, 0x61c06060, 0x00006060, 0x00006040, 0x00007f00,
+ 0x00006000, 0x00006000, 0x00000000
+};
+static struct raster gallant19_37 = { 12, 22, 1, 1, gallant19_37_pixels, 0 };
+
+static u_int32_t gallant19_38_pixels[] = {
+ 0x00000000,
+ 0x07000060, 0x0f800060, 0x18c00000, 0x18c00000, 0x18c00000, 0x0f8034c0,
+ 0x1e003000, 0x3e003000, 0x77003000, 0x63607800, 0x61e00000, 0x61c00000,
+ 0x61800000, 0x3fe00000, 0x1e600000, 0x000030c0, 0x00003800, 0x00000780,
+ 0x000020c0, 0x00003f80, 0x00000000
+};
+static struct raster gallant19_38 = { 12, 22, 1, 1, gallant19_38_pixels, 0 };
+
+static u_int32_t gallant19_39_pixels[] = {
+ 0x00000000,
+ 0x0c000c20, 0x1e000780, 0x1e000000, 0x06000000, 0x06000000, 0x0c000000,
+ 0x18000000, 0x100030c0, 0x000030c0, 0x000030c0, 0x000030c0, 0x00001e60,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00006020,
+ 0x00003040, 0x00001880, 0x00000000
+};
+static struct raster gallant19_39 = { 12, 22, 1, 1, gallant19_39_pixels, 0 };
+
+static u_int32_t gallant19_40_pixels[] = {
+ 0x00000000,
+ 0x00c06620, 0x01803b40, 0x03801980, 0x03001980, 0x07000000, 0x06000000,
+ 0x06000000, 0x06000000, 0x06000000, 0x06007040, 0x07001d00, 0x03000700,
+ 0x038011c0, 0x0180f1f0, 0x00c00000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00006020, 0x00000000
+};
+static struct raster gallant19_40 = { 12, 22, 1, 1, gallant19_40_pixels, 0 };
+
+static u_int32_t gallant19_41_pixels[] = {
+ 0x00000000,
+ 0x30000000, 0x180060e0, 0x1c000380, 0x0c000e00, 0x0e003820, 0x06007fe0,
+ 0x06000000, 0x06000000, 0x060001c0, 0x06000300, 0x0e000180, 0x0c000300,
+ 0x1c000300, 0x18000180, 0x30000300, 0x000001c0, 0x00000000, 0x00000000,
+ 0x00000600, 0x00000600, 0x00000000
+};
+static struct raster gallant19_41 = { 12, 22, 1, 1, gallant19_41_pixels, 0 };
+
+static u_int32_t gallant19_42_pixels[] = {
+ 0x00000000,
+ 0x00003800, 0x00000c00, 0x00001800, 0x00000c00, 0x0f000c00, 0x06001800,
+ 0x66600c00, 0x76e03800, 0x19800000, 0x00000000, 0x19800000, 0x76e00000,
+ 0x66600000, 0x06000000, 0x0f001c20, 0x000036c0, 0x00004380, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_42 = { 12, 22, 1, 1, gallant19_42_pixels, 0 };
+
+static u_int32_t gallant19_43_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x06000000,
+ 0x06000000, 0x06000000, 0x06000000, 0x7fe00000, 0x7fe00000, 0x06000000,
+ 0x06000000, 0x06000000, 0x06000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_43 = { 12, 22, 1, 1, gallant19_43_pixels, 0 };
+
+static u_int32_t gallant19_44_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x0c000000, 0x1e000000, 0x1e000000, 0x06000000, 0x06000000, 0x0c000000,
+ 0x18000000, 0x10000000, 0x00000000
+};
+static struct raster gallant19_44 = { 12, 22, 1, 1, gallant19_44_pixels, 0 };
+
+static u_int32_t gallant19_45_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x7fe00000, 0x7fe00000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_45 = { 12, 22, 1, 1, gallant19_45_pixels, 0 };
+
+static u_int32_t gallant19_46_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0c000000,
+ 0x1e000000, 0x1e000000, 0x0c000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_46 = { 12, 22, 1, 1, gallant19_46_pixels, 0 };
+
+static u_int32_t gallant19_47_pixels[] = {
+ 0x00000000,
+ 0x00600000, 0x00c00000, 0x00c00000, 0x01800000, 0x01800000, 0x03000000,
+ 0x03000000, 0x06000000, 0x0c000000, 0x0c000000, 0x18000000, 0x18000000,
+ 0x30000000, 0x30000000, 0x60000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_47 = { 12, 22, 1, 1, gallant19_47_pixels, 0 };
+
+static u_int32_t gallant19_48_pixels[] = {
+ 0x00000000,
+ 0x07000000, 0x0f800000, 0x11800000, 0x10c00000, 0x30c00000, 0x30c00000,
+ 0x30c00000, 0x30c00000, 0x30c00000, 0x30c00000, 0x30c00000, 0x30800000,
+ 0x18800000, 0x1f000000, 0x0e000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_48 = { 12, 22, 1, 1, gallant19_48_pixels, 0 };
+
+static u_int32_t gallant19_49_pixels[] = {
+ 0x00000000,
+ 0x02000000, 0x06000000, 0x0e000000, 0x1e000000, 0x36000000, 0x06000000,
+ 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000,
+ 0x06000000, 0x06000000, 0x3fc00000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_49 = { 12, 22, 1, 1, gallant19_49_pixels, 0 };
+
+static u_int32_t gallant19_50_pixels[] = {
+ 0x00000000,
+ 0x1f000000, 0x3f800000, 0x61c00000, 0x40c00000, 0x00c00000, 0x00c00000,
+ 0x00c00000, 0x01800000, 0x03000000, 0x06000000, 0x0c000000, 0x18000000,
+ 0x30200000, 0x7fe00000, 0x7fe00000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_50 = { 12, 22, 1, 1, gallant19_50_pixels, 0 };
+
+static u_int32_t gallant19_51_pixels[] = {
+ 0x00000000,
+ 0x0f800000, 0x1fc00000, 0x20e00000, 0x40600000, 0x00600000, 0x00e00000,
+ 0x07c00000, 0x0fc00000, 0x00e00000, 0x00600000, 0x00600000, 0x40600000,
+ 0x60400000, 0x3f800000, 0x1f000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_51 = { 12, 22, 1, 1, gallant19_51_pixels, 0 };
+
+static u_int32_t gallant19_52_pixels[] = {
+ 0x00000000,
+ 0x01800000, 0x03800000, 0x03800000, 0x05800000, 0x05800000, 0x09800000,
+ 0x09800000, 0x11800000, 0x11800000, 0x21800000, 0x3fe00000, 0x7fe00000,
+ 0x01800000, 0x01800000, 0x01800000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_52 = { 12, 22, 1, 1, gallant19_52_pixels, 0 };
+
+static u_int32_t gallant19_53_pixels[] = {
+ 0x00000000,
+ 0x0fc00000, 0x0fc00000, 0x10000000, 0x10000000, 0x20000000, 0x3f800000,
+ 0x31c00000, 0x00e00000, 0x00600000, 0x00600000, 0x00600000, 0x40600000,
+ 0x60600000, 0x30c00000, 0x1f800000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_53 = { 12, 22, 1, 1, gallant19_53_pixels, 0 };
+
+static u_int32_t gallant19_54_pixels[] = {
+ 0x00000000,
+ 0x07000000, 0x0c000000, 0x18000000, 0x30000000, 0x30000000, 0x60000000,
+ 0x67800000, 0x6fc00000, 0x70e00000, 0x60600000, 0x60600000, 0x60600000,
+ 0x70400000, 0x3f800000, 0x1f000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_54 = { 12, 22, 1, 1, gallant19_54_pixels, 0 };
+
+static u_int32_t gallant19_55_pixels[] = {
+ 0x00000000,
+ 0x1fe00000, 0x3fe00000, 0x60400000, 0x00400000, 0x00c00000, 0x00800000,
+ 0x00800000, 0x01800000, 0x01000000, 0x01000000, 0x03000000, 0x02000000,
+ 0x02000000, 0x06000000, 0x04000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_55 = { 12, 22, 1, 1, gallant19_55_pixels, 0 };
+
+static u_int32_t gallant19_56_pixels[] = {
+ 0x00000000,
+ 0x0f000000, 0x11800000, 0x30c00000, 0x30c00000, 0x30c00000, 0x18800000,
+ 0x0d000000, 0x06000000, 0x0b000000, 0x11800000, 0x30c00000, 0x30c00000,
+ 0x30c00000, 0x18800000, 0x0f000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_56 = { 12, 22, 1, 1, gallant19_56_pixels, 0 };
+
+static u_int32_t gallant19_57_pixels[] = {
+ 0x00000000,
+ 0x0f800000, 0x11c00000, 0x20e00000, 0x60600000, 0x60600000, 0x60600000,
+ 0x70e00000, 0x3f600000, 0x1e600000, 0x00600000, 0x00c00000, 0x00c00000,
+ 0x01800000, 0x07000000, 0x3c000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_57 = { 12, 22, 1, 1, gallant19_57_pixels, 0 };
+
+static u_int32_t gallant19_58_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0c000000,
+ 0x1e000000, 0x1e000000, 0x0c000000, 0x00000000, 0x00000000, 0x0c000000,
+ 0x1e000000, 0x1e000000, 0x0c000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_58 = { 12, 22, 1, 1, gallant19_58_pixels, 0 };
+
+static u_int32_t gallant19_59_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x0c000000, 0x1e000000, 0x1e000000, 0x0c000000, 0x00000000, 0x00000000,
+ 0x0c000000, 0x1e000000, 0x1e000000, 0x06000000, 0x06000000, 0x0c000000,
+ 0x18000000, 0x10000000, 0x00000000
+};
+static struct raster gallant19_59 = { 12, 22, 1, 1, gallant19_59_pixels, 0 };
+
+static u_int32_t gallant19_60_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00600000,
+ 0x01c00000, 0x07000000, 0x1e000000, 0x78000000, 0x78000000, 0x1e000000,
+ 0x07000000, 0x01c00000, 0x00600000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_60 = { 12, 22, 1, 1, gallant19_60_pixels, 0 };
+
+static u_int32_t gallant19_61_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x7fc00000, 0x7fc00000, 0x00000000, 0x00000000, 0x7fc00000,
+ 0x7fc00000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_61 = { 12, 22, 1, 1, gallant19_61_pixels, 0 };
+
+static u_int32_t gallant19_62_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x60000000,
+ 0x38000000, 0x1e000000, 0x07800000, 0x01e00000, 0x01e00000, 0x07800000,
+ 0x1e000000, 0x38000000, 0x60000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_62 = { 12, 22, 1, 1, gallant19_62_pixels, 0 };
+
+static u_int32_t gallant19_63_pixels[] = {
+ 0x00000000,
+ 0x0f000000, 0x1f800000, 0x39c00000, 0x20c00000, 0x00c00000, 0x00c00000,
+ 0x01800000, 0x03000000, 0x06000000, 0x0c000000, 0x0c000000, 0x00000000,
+ 0x00000000, 0x0c000000, 0x0c000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_63 = { 12, 22, 1, 1, gallant19_63_pixels, 0 };
+
+static u_int32_t gallant19_64_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x0f800000, 0x3fc00000, 0x30600000,
+ 0x60600000, 0x67200000, 0x6fa00000, 0x6ca00000, 0x6ca00000, 0x67e00000,
+ 0x60000000, 0x30000000, 0x3fe00000, 0x0fe00000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_64 = { 12, 22, 1, 1, gallant19_64_pixels, 0 };
+
+static u_int32_t gallant19_65_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x06000000, 0x06000000, 0x0b000000, 0x0b000000, 0x09000000,
+ 0x11800000, 0x11800000, 0x10800000, 0x3fc00000, 0x20c00000, 0x20400000,
+ 0x40600000, 0x40600000, 0xe0f00000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_65 = { 12, 22, 1, 1, gallant19_65_pixels, 0 };
+
+static u_int32_t gallant19_66_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0xff000000, 0x60800000, 0x60c00000, 0x60c00000, 0x60c00000,
+ 0x61800000, 0x7f800000, 0x60c00000, 0x60600000, 0x60600000, 0x60600000,
+ 0x60600000, 0x60c00000, 0xff800000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_66 = { 12, 22, 1, 1, gallant19_66_pixels, 0 };
+
+static u_int32_t gallant19_67_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x0fc00000, 0x10600000, 0x20200000, 0x20000000, 0x60000000,
+ 0x60000000, 0x60000000, 0x60000000, 0x60000000, 0x60000000, 0x20000000,
+ 0x30200000, 0x18400000, 0x0f800000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_67 = { 12, 22, 1, 1, gallant19_67_pixels, 0 };
+
+static u_int32_t gallant19_68_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0xff000000, 0x61c00000, 0x60c00000, 0x60600000, 0x60600000,
+ 0x60600000, 0x60600000, 0x60600000, 0x60600000, 0x60600000, 0x60600000,
+ 0x60400000, 0x61800000, 0xfe000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_68 = { 12, 22, 1, 1, gallant19_68_pixels, 0 };
+
+static u_int32_t gallant19_69_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x7fc00000, 0x30400000, 0x30400000, 0x30000000, 0x30000000,
+ 0x30800000, 0x3f800000, 0x30800000, 0x30000000, 0x30000000, 0x30000000,
+ 0x30200000, 0x30200000, 0x7fe00000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_69 = { 12, 22, 1, 1, gallant19_69_pixels, 0 };
+
+static u_int32_t gallant19_70_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x7fc00000, 0x30400000, 0x30400000, 0x30000000, 0x30000000,
+ 0x30800000, 0x3f800000, 0x30800000, 0x30000000, 0x30000000, 0x30000000,
+ 0x30000000, 0x30000000, 0x78000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_70 = { 12, 22, 1, 1, gallant19_70_pixels, 0 };
+
+static u_int32_t gallant19_71_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x0fc00000, 0x10600000, 0x20200000, 0x20000000, 0x60000000,
+ 0x60000000, 0x60000000, 0x60000000, 0x61f00000, 0x60600000, 0x20600000,
+ 0x30600000, 0x18600000, 0x0f800000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_71 = { 12, 22, 1, 1, gallant19_71_pixels, 0 };
+
+static u_int32_t gallant19_72_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0xf0f00000, 0x60600000, 0x60600000, 0x60600000, 0x60600000,
+ 0x60600000, 0x7fe00000, 0x60600000, 0x60600000, 0x60600000, 0x60600000,
+ 0x60600000, 0x60600000, 0xf0f00000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_72 = { 12, 22, 1, 1, gallant19_72_pixels, 0 };
+
+static u_int32_t gallant19_73_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x1f800000, 0x06000000, 0x06000000, 0x06000000, 0x06000000,
+ 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000,
+ 0x06000000, 0x06000000, 0x1f800000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_73 = { 12, 22, 1, 1, gallant19_73_pixels, 0 };
+
+static u_int32_t gallant19_74_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x1f800000, 0x06000000, 0x06000000, 0x06000000, 0x06000000,
+ 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000,
+ 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x04000000,
+ 0x38000000, 0x30000000, 0x00000000
+};
+static struct raster gallant19_74 = { 12, 22, 1, 1, gallant19_74_pixels, 0 };
+
+static u_int32_t gallant19_75_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0xf0e00000, 0x61800000, 0x63000000, 0x66000000, 0x6c000000,
+ 0x78000000, 0x78000000, 0x7c000000, 0x6e000000, 0x67000000, 0x63800000,
+ 0x61c00000, 0x60e00000, 0xf0700000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_75 = { 12, 22, 1, 1, gallant19_75_pixels, 0 };
+
+static u_int32_t gallant19_76_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x78000000, 0x30000000, 0x30000000, 0x30000000, 0x30000000,
+ 0x30000000, 0x30000000, 0x30000000, 0x30000000, 0x30000000, 0x30000000,
+ 0x30200000, 0x30200000, 0x7fe00000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_76 = { 12, 22, 1, 1, gallant19_76_pixels, 0 };
+
+static u_int32_t gallant19_77_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0xe0700000, 0x60e00000, 0x70e00000, 0x70e00000, 0x70e00000,
+ 0x59600000, 0x59600000, 0x59600000, 0x4d600000, 0x4e600000, 0x4e600000,
+ 0x44600000, 0x44600000, 0xe4f00000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_77 = { 12, 22, 1, 1, gallant19_77_pixels, 0 };
+
+static u_int32_t gallant19_78_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0xc0700000, 0x60200000, 0x70200000, 0x78200000, 0x58200000,
+ 0x4c200000, 0x46200000, 0x47200000, 0x43200000, 0x41a00000, 0x40e00000,
+ 0x40e00000, 0x40600000, 0xe0300000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_78 = { 12, 22, 1, 1, gallant19_78_pixels, 0 };
+
+static u_int32_t gallant19_79_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x0f000000, 0x11c00000, 0x20c00000, 0x20600000, 0x60600000,
+ 0x60600000, 0x60600000, 0x60600000, 0x60600000, 0x60600000, 0x20400000,
+ 0x30400000, 0x18800000, 0x0f000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_79 = { 12, 22, 1, 1, gallant19_79_pixels, 0 };
+
+static u_int32_t gallant19_80_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x7f800000, 0x30c00000, 0x30600000, 0x30600000, 0x30600000,
+ 0x30c00000, 0x37800000, 0x30000000, 0x30000000, 0x30000000, 0x30000000,
+ 0x30000000, 0x30000000, 0x78000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_80 = { 12, 22, 1, 1, gallant19_80_pixels, 0 };
+
+static u_int32_t gallant19_81_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x0f000000, 0x11c00000, 0x20c00000, 0x20600000, 0x60600000,
+ 0x60600000, 0x60600000, 0x60600000, 0x60600000, 0x60600000, 0x30400000,
+ 0x38400000, 0x1f800000, 0x0e000000, 0x1f000000, 0x23900000, 0x01e00000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_81 = { 12, 22, 1, 1, gallant19_81_pixels, 0 };
+
+static u_int32_t gallant19_82_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0xff000000, 0x61800000, 0x60c00000, 0x60c00000, 0x60c00000,
+ 0x60800000, 0x7f000000, 0x7c000000, 0x6e000000, 0x67000000, 0x63800000,
+ 0x61c00000, 0x60e00000, 0xf0700000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_82 = { 12, 22, 1, 1, gallant19_82_pixels, 0 };
+
+static u_int32_t gallant19_83_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x1fe00000, 0x30600000, 0x60200000, 0x60200000, 0x70000000,
+ 0x3c000000, 0x1e000000, 0x07800000, 0x01c00000, 0x00e00000, 0x40600000,
+ 0x40600000, 0x60c00000, 0x7f800000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_83 = { 12, 22, 1, 1, gallant19_83_pixels, 0 };
+
+static u_int32_t gallant19_84_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x7fe00000, 0x46200000, 0x06000000, 0x06000000, 0x06000000,
+ 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000,
+ 0x06000000, 0x06000000, 0x1f800000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_84 = { 12, 22, 1, 1, gallant19_84_pixels, 0 };
+
+static u_int32_t gallant19_85_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0xf0700000, 0x60200000, 0x60200000, 0x60200000, 0x60200000,
+ 0x60200000, 0x60200000, 0x60200000, 0x60200000, 0x60200000, 0x60200000,
+ 0x70400000, 0x3fc00000, 0x1f800000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_85 = { 12, 22, 1, 1, gallant19_85_pixels, 0 };
+
+static u_int32_t gallant19_86_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0xe0e00000, 0x60400000, 0x30800000, 0x30800000, 0x30800000,
+ 0x19000000, 0x19000000, 0x19000000, 0x0c000000, 0x0e000000, 0x0e000000,
+ 0x04000000, 0x04000000, 0x04000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_86 = { 12, 22, 1, 1, gallant19_86_pixels, 0 };
+
+static u_int32_t gallant19_87_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0xfef00000, 0x66200000, 0x66200000, 0x66200000, 0x76200000,
+ 0x77400000, 0x33400000, 0x37400000, 0x3bc00000, 0x3b800000, 0x19800000,
+ 0x19800000, 0x19800000, 0x19800000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_87 = { 12, 22, 1, 1, gallant19_87_pixels, 0 };
+
+static u_int32_t gallant19_88_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0xf0700000, 0x60200000, 0x30400000, 0x38800000, 0x18800000,
+ 0x0d000000, 0x06000000, 0x06000000, 0x0b000000, 0x11800000, 0x11c00000,
+ 0x20c00000, 0x40600000, 0xe0f00000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_88 = { 12, 22, 1, 1, gallant19_88_pixels, 0 };
+
+static u_int32_t gallant19_89_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0xf0700000, 0x60200000, 0x30400000, 0x18800000, 0x18800000,
+ 0x0d000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000,
+ 0x06000000, 0x06000000, 0x0f000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_89 = { 12, 22, 1, 1, gallant19_89_pixels, 0 };
+
+static u_int32_t gallant19_90_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x3fe00000, 0x20c00000, 0x00c00000, 0x01800000, 0x01800000,
+ 0x03000000, 0x03000000, 0x06000000, 0x06000000, 0x0c000000, 0x0c000000,
+ 0x18000000, 0x18200000, 0x3fe00000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_90 = { 12, 22, 1, 1, gallant19_90_pixels, 0 };
+
+static u_int32_t gallant19_91_pixels[] = {
+ 0x00000000,
+ 0x07c00000, 0x07c00000, 0x06000000, 0x06000000, 0x06000000, 0x06000000,
+ 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000,
+ 0x06000000, 0x07c00000, 0x07c00000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_91 = { 12, 22, 1, 1, gallant19_91_pixels, 0 };
+
+static u_int32_t gallant19_92_pixels[] = {
+ 0x00000000,
+ 0x60000000, 0x60000000, 0x30000000, 0x30000000, 0x18000000, 0x18000000,
+ 0x0c000000, 0x0c000000, 0x06000000, 0x03000000, 0x03000000, 0x01800000,
+ 0x01800000, 0x00c00000, 0x00c00000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_92 = { 12, 22, 1, 1, gallant19_92_pixels, 0 };
+
+static u_int32_t gallant19_93_pixels[] = {
+ 0x00000000,
+ 0x7c000000, 0x7c000000, 0x0c000000, 0x0c000000, 0x0c000000, 0x0c000000,
+ 0x0c000000, 0x0c000000, 0x0c000000, 0x0c000000, 0x0c000000, 0x0c000000,
+ 0x0c000000, 0x7c000000, 0x7c000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_93 = { 12, 22, 1, 1, gallant19_93_pixels, 0 };
+
+static u_int32_t gallant19_94_pixels[] = {
+ 0x00000000,
+ 0x04000000, 0x0e000000, 0x1b000000, 0x31800000, 0x60c00000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_94 = { 12, 22, 1, 1, gallant19_94_pixels, 0 };
+
+static u_int32_t gallant19_95_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xfff00000, 0xfff00000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_95 = { 12, 22, 1, 1, gallant19_95_pixels, 0 };
+
+static u_int32_t gallant19_96_pixels[] = {
+ 0x00000000,
+ 0x01000000, 0x03000000, 0x06000000, 0x06000000, 0x07800000, 0x07800000,
+ 0x03000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_96 = { 12, 22, 1, 1, gallant19_96_pixels, 0 };
+
+static u_int32_t gallant19_97_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0f800000,
+ 0x18c00000, 0x10c00000, 0x03c00000, 0x1cc00000, 0x30c00000, 0x30c00000,
+ 0x30c00000, 0x39c00000, 0x1ee00000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_97 = { 12, 22, 1, 1, gallant19_97_pixels, 0 };
+
+static u_int32_t gallant19_98_pixels[] = {
+ 0x00000000,
+ 0x20000000, 0x60000000, 0xe0000000, 0x60000000, 0x60000000, 0x67800000,
+ 0x6fc00000, 0x70e00000, 0x60600000, 0x60600000, 0x60600000, 0x60600000,
+ 0x70600000, 0x78c00000, 0x4f800000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_98 = { 12, 22, 1, 1, gallant19_98_pixels, 0 };
+
+static u_int32_t gallant19_99_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x1f800000,
+ 0x31c00000, 0x20c00000, 0x60000000, 0x60000000, 0x60000000, 0x60000000,
+ 0x70400000, 0x30c00000, 0x1f800000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_99 = { 12, 22, 1, 1, gallant19_99_pixels, 0 };
+
+static u_int32_t gallant19_100_pixels[] = {
+ 0x00000000,
+ 0x00600000, 0x00e00000, 0x00600000, 0x00600000, 0x00600000, 0x0f600000,
+ 0x31e00000, 0x20e00000, 0x60600000, 0x60600000, 0x60600000, 0x60600000,
+ 0x70e00000, 0x39600000, 0x1e700000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_100 = { 12, 22, 1, 1, gallant19_100_pixels, 0 };
+
+static u_int32_t gallant19_101_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0f000000,
+ 0x30c00000, 0x60600000, 0x60600000, 0x7fe00000, 0x60000000, 0x60000000,
+ 0x30000000, 0x18600000, 0x0f800000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_101 = { 12, 22, 1, 1, gallant19_101_pixels, 0 };
+
+static u_int32_t gallant19_102_pixels[] = {
+ 0x00000000,
+ 0x03800000, 0x04c00000, 0x04c00000, 0x0c000000, 0x0c000000, 0x0c000000,
+ 0x0c000000, 0x1f800000, 0x0c000000, 0x0c000000, 0x0c000000, 0x0c000000,
+ 0x0c000000, 0x0c000000, 0x1e000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_102 = { 12, 22, 1, 1, gallant19_102_pixels, 0 };
+
+static u_int32_t gallant19_103_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x1f200000,
+ 0x31e00000, 0x60c00000, 0x60c00000, 0x60c00000, 0x31800000, 0x3f000000,
+ 0x60000000, 0x7fc00000, 0x3fe00000, 0x20600000, 0x40200000, 0x40200000,
+ 0x7fc00000, 0x3f800000, 0x00000000
+};
+static struct raster gallant19_103 = { 12, 22, 1, 1, gallant19_103_pixels, 0 };
+
+static u_int32_t gallant19_104_pixels[] = {
+ 0x00000000,
+ 0x10000000, 0x30000000, 0x70000000, 0x30000000, 0x30000000, 0x37800000,
+ 0x39c00000, 0x30c00000, 0x30c00000, 0x30c00000, 0x30c00000, 0x30c00000,
+ 0x30c00000, 0x30c00000, 0x79e00000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_104 = { 12, 22, 1, 1, gallant19_104_pixels, 0 };
+
+static u_int32_t gallant19_105_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x06000000, 0x06000000, 0x00000000, 0x00000000, 0x1e000000,
+ 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000,
+ 0x06000000, 0x06000000, 0x1f800000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_105 = { 12, 22, 1, 1, gallant19_105_pixels, 0 };
+
+static u_int32_t gallant19_106_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00c00000, 0x00c00000, 0x00000000, 0x00000000, 0x03c00000,
+ 0x00c00000, 0x00c00000, 0x00c00000, 0x00c00000, 0x00c00000, 0x00c00000,
+ 0x00c00000, 0x00c00000, 0x00c00000, 0x20c00000, 0x30c00000, 0x38800000,
+ 0x1f000000, 0x0e000000, 0x00000000
+};
+static struct raster gallant19_106 = { 12, 22, 1, 1, gallant19_106_pixels, 0 };
+
+static u_int32_t gallant19_107_pixels[] = {
+ 0x00000000,
+ 0x60000000, 0xe0000000, 0x60000000, 0x60000000, 0x60000000, 0x61c00000,
+ 0x63000000, 0x66000000, 0x7c000000, 0x78000000, 0x7c000000, 0x6e000000,
+ 0x67000000, 0x63800000, 0xf1e00000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_107 = { 12, 22, 1, 1, gallant19_107_pixels, 0 };
+
+static u_int32_t gallant19_108_pixels[] = {
+ 0x00000000,
+ 0x1e000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000,
+ 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000,
+ 0x06000000, 0x06000000, 0x1f800000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_108 = { 12, 22, 1, 1, gallant19_108_pixels, 0 };
+
+static u_int32_t gallant19_109_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xddc00000,
+ 0x6ee00000, 0x66600000, 0x66600000, 0x66600000, 0x66600000, 0x66600000,
+ 0x66600000, 0x66600000, 0xef700000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_109 = { 12, 22, 1, 1, gallant19_109_pixels, 0 };
+
+static u_int32_t gallant19_110_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x27800000,
+ 0x79c00000, 0x30c00000, 0x30c00000, 0x30c00000, 0x30c00000, 0x30c00000,
+ 0x30c00000, 0x30c00000, 0x79e00000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_110 = { 12, 22, 1, 1, gallant19_110_pixels, 0 };
+
+static u_int32_t gallant19_111_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0f800000,
+ 0x11c00000, 0x20e00000, 0x60600000, 0x60600000, 0x60600000, 0x60600000,
+ 0x70400000, 0x38800000, 0x1f000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_111 = { 12, 22, 1, 1, gallant19_111_pixels, 0 };
+
+static u_int32_t gallant19_112_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xef800000,
+ 0x71c00000, 0x60e00000, 0x60600000, 0x60600000, 0x60600000, 0x60600000,
+ 0x60400000, 0x70800000, 0x7f000000, 0x60000000, 0x60000000, 0x60000000,
+ 0x60000000, 0xf0000000, 0x00000000
+};
+static struct raster gallant19_112 = { 12, 22, 1, 1, gallant19_112_pixels, 0 };
+
+static u_int32_t gallant19_113_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0f200000,
+ 0x11e00000, 0x20e00000, 0x60600000, 0x60600000, 0x60600000, 0x60600000,
+ 0x70600000, 0x38e00000, 0x1fe00000, 0x00600000, 0x00600000, 0x00600000,
+ 0x00600000, 0x00f00000, 0x00000000
+};
+static struct raster gallant19_113 = { 12, 22, 1, 1, gallant19_113_pixels, 0 };
+
+static u_int32_t gallant19_114_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x73800000,
+ 0x34c00000, 0x38c00000, 0x30000000, 0x30000000, 0x30000000, 0x30000000,
+ 0x30000000, 0x30000000, 0x78000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_114 = { 12, 22, 1, 1, gallant19_114_pixels, 0 };
+
+static u_int32_t gallant19_115_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x1fc00000,
+ 0x30c00000, 0x30400000, 0x38000000, 0x1e000000, 0x07800000, 0x01c00000,
+ 0x20c00000, 0x30c00000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_115 = { 12, 22, 1, 1, gallant19_115_pixels, 0 };
+
+static u_int32_t gallant19_116_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x04000000, 0x04000000, 0x0c000000, 0x7fc00000,
+ 0x0c000000, 0x0c000000, 0x0c000000, 0x0c000000, 0x0c000000, 0x0c000000,
+ 0x0c200000, 0x0e400000, 0x07800000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_116 = { 12, 22, 1, 1, gallant19_116_pixels, 0 };
+
+static u_int32_t gallant19_117_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x79e00000,
+ 0x30c00000, 0x30c00000, 0x30c00000, 0x30c00000, 0x30c00000, 0x30c00000,
+ 0x30c00000, 0x39c00000, 0x1e600000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_117 = { 12, 22, 1, 1, gallant19_117_pixels, 0 };
+
+static u_int32_t gallant19_118_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xf0700000,
+ 0x60200000, 0x30400000, 0x30400000, 0x18800000, 0x18800000, 0x0d000000,
+ 0x0d000000, 0x06000000, 0x06000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_118 = { 12, 22, 1, 1, gallant19_118_pixels, 0 };
+
+static u_int32_t gallant19_119_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xff700000,
+ 0x66200000, 0x66200000, 0x66200000, 0x37400000, 0x3b400000, 0x3b400000,
+ 0x19800000, 0x19800000, 0x19800000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_119 = { 12, 22, 1, 1, gallant19_119_pixels, 0 };
+
+static u_int32_t gallant19_120_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xf8f00000,
+ 0x70400000, 0x38800000, 0x1d000000, 0x0e000000, 0x07000000, 0x0b800000,
+ 0x11c00000, 0x20e00000, 0xf1f00000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_120 = { 12, 22, 1, 1, gallant19_120_pixels, 0 };
+
+static u_int32_t gallant19_121_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xf0f00000,
+ 0x60200000, 0x30400000, 0x30400000, 0x18800000, 0x18800000, 0x0d000000,
+ 0x0d000000, 0x06000000, 0x06000000, 0x04000000, 0x0c000000, 0x08000000,
+ 0x78000000, 0x70000000, 0x00000000
+};
+static struct raster gallant19_121 = { 12, 22, 1, 1, gallant19_121_pixels, 0 };
+
+static u_int32_t gallant19_122_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x7fe00000,
+ 0x60e00000, 0x41c00000, 0x03800000, 0x07000000, 0x0e000000, 0x1c000000,
+ 0x38200000, 0x70600000, 0x7fe00000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_122 = { 12, 22, 1, 1, gallant19_122_pixels, 0 };
+
+static u_int32_t gallant19_123_pixels[] = {
+ 0x00000000,
+ 0x01c00000, 0x03000000, 0x03000000, 0x01800000, 0x01800000, 0x01800000,
+ 0x03000000, 0x07000000, 0x03000000, 0x01800000, 0x01800000, 0x01800000,
+ 0x03000000, 0x03000000, 0x01c00000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_123 = { 12, 22, 1, 1, gallant19_123_pixels, 0 };
+
+static u_int32_t gallant19_124_pixels[] = {
+ 0x00000000,
+ 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000,
+ 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000,
+ 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000,
+ 0x06000000, 0x06000000, 0x00000000
+};
+static struct raster gallant19_124 = { 12, 22, 1, 1, gallant19_124_pixels, 0 };
+
+static u_int32_t gallant19_125_pixels[] = {
+ 0x00000000,
+ 0x38000000, 0x0c000000, 0x0c000000, 0x18000000, 0x18000000, 0x18000000,
+ 0x0c000000, 0x0e000000, 0x0c000000, 0x18000000, 0x18000000, 0x18000000,
+ 0x0c000000, 0x0c000000, 0x38000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_125 = { 12, 22, 1, 1, gallant19_125_pixels, 0 };
+
+static u_int32_t gallant19_126_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x1c200000, 0x3e600000, 0x36c00000, 0x67c00000,
+ 0x43800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_126 = { 12, 22, 1, 1, gallant19_126_pixels, 0 };
+
+#define null2 {0}, {0}
+#define null4 null2, null2
+#define null8 null4, null4
+#define null16 null8, null8
+#define null32 null16, null16
+#define null64 null32, null32
+#define null128 null64, null64
+
+struct raster_font gallant19 = {
+ 12, 22, 15, RASFONT_FIXEDWIDTH|RASFONT_NOVERTICALMOVEMENT,
+ {
+ null32,
+ { &gallant19_32, 0, -15, 12, 0 },
+ { &gallant19_33, 0, -15, 12, 0 },
+ { &gallant19_34, 0, -15, 12, 0 },
+ { &gallant19_35, 0, -15, 12, 0 },
+ { &gallant19_36, 0, -15, 12, 0 },
+ { &gallant19_37, 0, -15, 12, 0 },
+ { &gallant19_38, 0, -15, 12, 0 },
+ { &gallant19_39, 0, -15, 12, 0 },
+ { &gallant19_40, 0, -15, 12, 0 },
+ { &gallant19_41, 0, -15, 12, 0 },
+ { &gallant19_42, 0, -15, 12, 0 },
+ { &gallant19_43, 0, -15, 12, 0 },
+ { &gallant19_44, 0, -15, 12, 0 },
+ { &gallant19_45, 0, -15, 12, 0 },
+ { &gallant19_46, 0, -15, 12, 0 },
+ { &gallant19_47, 0, -15, 12, 0 },
+ { &gallant19_48, 0, -15, 12, 0 },
+ { &gallant19_49, 0, -15, 12, 0 },
+ { &gallant19_50, 0, -15, 12, 0 },
+ { &gallant19_51, 0, -15, 12, 0 },
+ { &gallant19_52, 0, -15, 12, 0 },
+ { &gallant19_53, 0, -15, 12, 0 },
+ { &gallant19_54, 0, -15, 12, 0 },
+ { &gallant19_55, 0, -15, 12, 0 },
+ { &gallant19_56, 0, -15, 12, 0 },
+ { &gallant19_57, 0, -15, 12, 0 },
+ { &gallant19_58, 0, -15, 12, 0 },
+ { &gallant19_59, 0, -15, 12, 0 },
+ { &gallant19_60, 0, -15, 12, 0 },
+ { &gallant19_61, 0, -15, 12, 0 },
+ { &gallant19_62, 0, -15, 12, 0 },
+ { &gallant19_63, 0, -15, 12, 0 },
+ { &gallant19_64, 0, -15, 12, 0 },
+ { &gallant19_65, 0, -15, 12, 0 },
+ { &gallant19_66, 0, -15, 12, 0 },
+ { &gallant19_67, 0, -15, 12, 0 },
+ { &gallant19_68, 0, -15, 12, 0 },
+ { &gallant19_69, 0, -15, 12, 0 },
+ { &gallant19_70, 0, -15, 12, 0 },
+ { &gallant19_71, 0, -15, 12, 0 },
+ { &gallant19_72, 0, -15, 12, 0 },
+ { &gallant19_73, 0, -15, 12, 0 },
+ { &gallant19_74, 0, -15, 12, 0 },
+ { &gallant19_75, 0, -15, 12, 0 },
+ { &gallant19_76, 0, -15, 12, 0 },
+ { &gallant19_77, 0, -15, 12, 0 },
+ { &gallant19_78, 0, -15, 12, 0 },
+ { &gallant19_79, 0, -15, 12, 0 },
+ { &gallant19_80, 0, -15, 12, 0 },
+ { &gallant19_81, 0, -15, 12, 0 },
+ { &gallant19_82, 0, -15, 12, 0 },
+ { &gallant19_83, 0, -15, 12, 0 },
+ { &gallant19_84, 0, -15, 12, 0 },
+ { &gallant19_85, 0, -15, 12, 0 },
+ { &gallant19_86, 0, -15, 12, 0 },
+ { &gallant19_87, 0, -15, 12, 0 },
+ { &gallant19_88, 0, -15, 12, 0 },
+ { &gallant19_89, 0, -15, 12, 0 },
+ { &gallant19_90, 0, -15, 12, 0 },
+ { &gallant19_91, 0, -15, 12, 0 },
+ { &gallant19_92, 0, -15, 12, 0 },
+ { &gallant19_93, 0, -15, 12, 0 },
+ { &gallant19_94, 0, -15, 12, 0 },
+ { &gallant19_95, 0, -15, 12, 0 },
+ { &gallant19_96, 0, -15, 12, 0 },
+ { &gallant19_97, 0, -15, 12, 0 },
+ { &gallant19_98, 0, -15, 12, 0 },
+ { &gallant19_99, 0, -15, 12, 0 },
+ { &gallant19_100, 0, -15, 12, 0 },
+ { &gallant19_101, 0, -15, 12, 0 },
+ { &gallant19_102, 0, -15, 12, 0 },
+ { &gallant19_103, 0, -15, 12, 0 },
+ { &gallant19_104, 0, -15, 12, 0 },
+ { &gallant19_105, 0, -15, 12, 0 },
+ { &gallant19_106, 0, -15, 12, 0 },
+ { &gallant19_107, 0, -15, 12, 0 },
+ { &gallant19_108, 0, -15, 12, 0 },
+ { &gallant19_109, 0, -15, 12, 0 },
+ { &gallant19_110, 0, -15, 12, 0 },
+ { &gallant19_111, 0, -15, 12, 0 },
+ { &gallant19_112, 0, -15, 12, 0 },
+ { &gallant19_113, 0, -15, 12, 0 },
+ { &gallant19_114, 0, -15, 12, 0 },
+ { &gallant19_115, 0, -15, 12, 0 },
+ { &gallant19_116, 0, -15, 12, 0 },
+ { &gallant19_117, 0, -15, 12, 0 },
+ { &gallant19_118, 0, -15, 12, 0 },
+ { &gallant19_119, 0, -15, 12, 0 },
+ { &gallant19_120, 0, -15, 12, 0 },
+ { &gallant19_121, 0, -15, 12, 0 },
+ { &gallant19_122, 0, -15, 12, 0 },
+ { &gallant19_123, 0, -15, 12, 0 },
+ { &gallant19_124, 0, -15, 12, 0 },
+ { &gallant19_125, 0, -15, 12, 0 },
+ { &gallant19_126, 0, -15, 12, 0 },
+ { 0 },
+ null128
+ },
+#ifdef COLORFONT_CACHE
+ (struct raster_fontcache*) -1
+#endif /*COLORFONT_CACHE*/
+};
diff --git a/sys/arch/alpha/wscons/wscons_rinit.c b/sys/arch/alpha/wscons/wscons_rinit.c
new file mode 100644
index 00000000000..7b7348a3746
--- /dev/null
+++ b/sys/arch/alpha/wscons/wscons_rinit.c
@@ -0,0 +1,134 @@
+/* $NetBSD: wscons_rinit.c,v 1.1 1996/04/12 02:00:54 cgd Exp $ */
+
+/*
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Lawrence Berkeley Laboratory.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)rcons_font.c 8.1 (Berkeley) 6/11/93
+ */
+
+#include <sys/param.h>
+#include <sys/kernel.h>
+#include <sys/device.h>
+
+#include <dev/rcons/raster.h>
+#include <alpha/wscons/wscons_raster.h>
+
+#include <alpha/wscons/wscons_rfont.h>
+
+void
+rcons_initfont(rc, fp)
+ struct rcons *rc;
+ struct raster_font *fp;
+{
+ static int initfontdone;
+
+ rc->rc_font = fp;
+
+ /* Get distance to top and bottom of font from font origin */
+ rc->rc_font_ascent = -(rc->rc_font->chars)['a'].homey;
+
+#if !defined(MSBYTE_FIRST) && !defined(MSBIT_FIRST) /* XXX other cases */
+ /* swap byte order on font data. ick. */
+ if (!initfontdone) {
+ int ch, i, n, bit;
+ u_int32_t *pix, npix;
+
+ for (ch = 0; ch < 256; ch++) {
+ if (rc->rc_font->chars[ch].r == 0)
+ continue;
+
+ n = rc->rc_font->chars[ch].r->linelongs *
+ rc->rc_font->chars[ch].r->height;
+ pix = rc->rc_font->chars[ch].r->pixels;
+
+ for (i = 0; i < n; i++) {
+ npix = 0;
+ for (bit = 0; bit < 32; bit++)
+ if (pix[i] & (1 << bit))
+ npix |= (1 << (31 - bit));
+ pix[i] = npix;
+ }
+ }
+ }
+#endif
+
+ initfontdone = 1;
+}
+
+void
+rcons_init(rc, mrow, mcol)
+ struct rcons *rc;
+ int mrow, mcol;
+{
+ struct raster *rp = rc->rc_sp;
+ int i;
+
+ rcons_initfont(rc, &gallant19);
+
+ i = rp->height / rc->rc_font->height;
+ rc->rc_maxrow = min(i, mrow);
+
+ i = rp->width / rc->rc_font->width;
+ rc->rc_maxcol = min(i, mcol);
+
+ /* Center emulator screen (but align x origin to 32 bits) */
+ rc->rc_xorigin =
+ ((rp->width - rc->rc_maxcol * rc->rc_font->width) / 2) & ~0x1f;
+ rc->rc_yorigin =
+ (rp->height - rc->rc_maxrow * rc->rc_font->height) / 2;
+
+ /* Raster width used for row copies */
+ rc->rc_raswidth = rc->rc_maxcol * rc->rc_font->width;
+ if (rc->rc_raswidth & 0x1f) {
+ /* Pad to 32 bits */
+ i = (rc->rc_raswidth + 0x1f) & ~0x1f;
+ /* Make sure width isn't too wide */
+ if (rc->rc_xorigin + i <= rp->width)
+ rc->rc_raswidth = i;
+ }
+
+ rc->rc_ras_blank = RAS_CLEAR;
+ rc->rc_bits = 0;
+
+ /* If cursor position given, assume it's there and drawn. */
+ if (*rc->rc_crowp != -1 && *rc->rc_ccolp != -1)
+ rc->rc_bits |= RC_CURSOR;
+}
diff --git a/sys/arch/alpha/wscons/wscons_rops.c b/sys/arch/alpha/wscons/wscons_rops.c
new file mode 100644
index 00000000000..f571bf184d3
--- /dev/null
+++ b/sys/arch/alpha/wscons/wscons_rops.c
@@ -0,0 +1,217 @@
+/* $NetBSD: wscons_rops.c,v 1.1 1996/04/12 02:00:55 cgd Exp $ */
+
+/*
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Lawrence Berkeley Laboratory.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)rcons_subr.c 8.1 (Berkeley) 6/11/93
+ */
+
+#include <sys/param.h>
+#include <sys/device.h>
+
+#include <dev/rcons/raster.h>
+#include <alpha/wscons/wscons_raster.h>
+
+/*
+ * Paint (or unpaint) the cursor.
+ * Pays no lip service to hardware cursors.
+ */
+void
+rcons_cursor(id, on, row, col)
+ void *id;
+ int on, row, col;
+{
+ register struct rcons *rc = id;
+ register int x, y;
+
+ /* turn the cursor off */
+ if (!on) {
+ /* make sure it's on */
+ if ((rc->rc_bits & RC_CURSOR) == 0)
+ return;
+
+ row = *rc->rc_crowp;
+ col = *rc->rc_ccolp;
+ } else {
+ /* unpaint the old copy. */
+ *rc->rc_crowp = row;
+ *rc->rc_ccolp = col;
+ }
+
+ x = col * rc->rc_font->width + rc->rc_xorigin;
+ y = row * rc->rc_font->height + rc->rc_yorigin;
+
+ raster_op(rc->rc_sp, x, y,
+#ifdef notdef
+ /* XXX This is the right way but too slow */
+ rc->rc_font->chars[(int)' '].r->width,
+ rc->rc_font->chars[(int)' '].r->height,
+#else
+ rc->rc_font->width, rc->rc_font->height,
+#endif
+ RAS_INVERT,
+ (struct raster *) 0, 0, 0);
+
+ rc->rc_bits ^= RC_CURSOR;
+}
+
+/*
+ * Actually write a string to the frame buffer.
+ */
+void
+rcons_putstr(id, row, col, str, n)
+ void *id;
+ int row, col, n;
+ char *str;
+{
+ struct rcons *rc = id;
+ register int x, y, op;
+
+ x = col * rc->rc_font->width + rc->rc_xorigin;
+ y = row * rc->rc_font->height + rc->rc_font_ascent + rc->rc_yorigin;
+
+ op = RAS_SRC;
+ if (((rc->rc_bits & RC_STANDOUT) != 0) ^
+ ((rc->rc_bits & RC_INVERT) != 0))
+ op = RAS_NOT(op);
+ raster_textn(rc->rc_sp, x, y, op, rc->rc_font, str, n);
+}
+
+/*
+ * Possibly change to white-on-black or black-on-white modes.
+ */
+void
+rcons_invert(id, inverted)
+ void *id;
+ int inverted;
+{
+ struct rcons *rc = id;
+
+ if (((rc->rc_bits & RC_INVERT) != 0) ^ inverted) {
+ /* Invert the display */
+ raster_op(rc->rc_sp, 0, 0, rc->rc_sp->width, rc->rc_sp->height,
+ RAS_INVERT, (struct raster *) 0, 0, 0);
+
+ /* Swap things around */
+ rc->rc_ras_blank = RAS_NOT(rc->rc_ras_blank);
+ rc->rc_bits ^= RC_INVERT;
+ }
+}
+
+/*
+ * Copy columns (characters) in a row (line).
+ */
+void
+rcons_copycols(id, row, srccol, dstcol, ncols)
+ void *id;
+ int row, srccol, dstcol, ncols;
+{
+ struct rcons *rc = id;
+ int y, srcx, dstx, nx;
+
+ y = rc->rc_yorigin + rc->rc_font->height * row;
+ srcx = rc->rc_xorigin + rc->rc_font->width * srccol;
+ dstx = rc->rc_xorigin + rc->rc_font->width * dstcol;
+ nx = rc->rc_font->width * ncols;
+
+ raster_op(rc->rc_sp, dstx, y,
+ nx, rc->rc_font->height, RAS_SRC,
+ rc->rc_sp, srcx, y);
+}
+
+/*
+ * Clear columns (characters) in a row (line).
+ */
+void
+rcons_erasecols(id, row, startcol, ncols)
+ void *id;
+ int row, startcol, ncols;
+{
+ struct rcons *rc = id;
+ int y, startx, nx;
+
+ y = rc->rc_yorigin + rc->rc_font->height * row;
+ startx = rc->rc_xorigin + rc->rc_font->width * startcol;
+ nx = rc->rc_font->width * ncols;
+
+ raster_op(rc->rc_sp, startx, y,
+ nx, rc->rc_font->height, rc->rc_ras_blank,
+ (struct raster *) 0, 0, 0);
+}
+
+/*
+ * Copy rows (lines).
+ */
+void
+rcons_copyrows(id, srcrow, dstrow, nrows)
+ void *id;
+ int srcrow, dstrow, nrows;
+{
+ struct rcons *rc = id;
+ int srcy, dsty, ny;
+
+ srcy = rc->rc_yorigin + rc->rc_font->height * srcrow;
+ dsty = rc->rc_yorigin + rc->rc_font->height * dstrow;
+ ny = rc->rc_font->height * nrows;
+
+ raster_op(rc->rc_sp, rc->rc_xorigin, dsty,
+ rc->rc_raswidth, ny, RAS_SRC,
+ rc->rc_sp, rc->rc_xorigin, srcy);
+}
+
+/*
+ * Erase rows (lines).
+ */
+void
+rcons_eraserows(id, startrow, nrows)
+ void *id;
+ int startrow, nrows;
+{
+ struct rcons *rc = id;
+ int starty, ny;
+
+ starty = rc->rc_yorigin + rc->rc_font->height * startrow;
+ ny = rc->rc_font->height * nrows;
+
+ raster_op(rc->rc_sp, rc->rc_xorigin, starty,
+ rc->rc_raswidth, ny, rc->rc_ras_blank,
+ (struct raster *) 0, 0, 0);
+}
diff --git a/sys/arch/alpha/wscons/wsconsvar.h b/sys/arch/alpha/wscons/wsconsvar.h
new file mode 100644
index 00000000000..433480d52ea
--- /dev/null
+++ b/sys/arch/alpha/wscons/wsconsvar.h
@@ -0,0 +1,111 @@
+/* $NetBSD: wsconsvar.h,v 1.2 1996/04/12 06:10:36 cgd Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#ifndef _ALPHA_WSCONS_WSCONSVAR_H_
+#define _ALPHA_WSCONS_WSCONSVAR_H_
+
+struct device;
+
+typedef int (*wscons_ioctl_t) __P((struct device *dev, u_long cmd,
+ caddr_t data, int flag, struct proc *p));
+typedef int (*wscons_mmap_t) __P((struct device *dev, off_t off,
+ int prot));
+
+struct wscons_emulfuncs {
+ void (*wef_cursor) __P((void *c, int on, int row, int col));
+ void (*wef_putstr) __P((void *c, int row, int col, char *cp,
+ int n));
+
+ void (*wef_copycols) __P((void *c, int row, int srccol, int dstcol,
+ int ncols));
+ void (*wef_erasecols) __P((void *c, int row, int startcol,
+ int ncols));
+
+ void (*wef_copyrows) __P((void *c, int srcrow, int dstrow,
+ int nrows));
+ void (*wef_eraserows) __P((void *c, int row, int nrows));
+};
+
+struct wscons_odev_spec {
+ const struct wscons_emulfuncs *wo_ef; /* emulation functions */
+ void *wo_efa; /* emulation function cookie */
+
+ int wo_nrows, wo_ncols; /* number of rows & cols */
+ int wo_crow, wo_ccol; /* current row & col */
+
+ wscons_ioctl_t wo_ioctl;
+ wscons_mmap_t wo_mmap;
+};
+
+struct wsconsio_bell_data;
+
+struct wscons_idev_spec {
+ int (*wi_getc) __P((struct device *c));
+ void (*wi_pollc) __P((struct device *c, int on));
+ void (*wi_bell) __P((struct device *c, struct wsconsio_bell_data *));
+ wscons_ioctl_t wi_ioctl;
+ char *(*wi_translate) __P((struct device *c, int code));
+ int wi_keymask; /* keyboard code mask */
+ int wi_keyupmask; /* key went up (vs. down) */
+};
+
+struct wscons_mdev_spec {
+ int (*wm_enable) __P((struct device *));
+ int (*wm_disable) __P((struct device *));
+};
+
+struct wscons_attach_args { /* attaches output device */
+ int waa_isconsole; /* is it the console unit? */
+ struct wscons_odev_spec waa_odev_spec; /* mostly ignored if cons. */
+};
+
+#define wsconscf_console cf_loc[0] /* spec'd to be console? */
+
+/*
+ * Attach the console output device. This is called _very_ early
+ * on in the boot process.
+ */
+void wscons_attach_console __P((const struct wscons_odev_spec *));
+
+/*
+ * Attach the console input device. At this point, it's assumed
+ * that there can be only one. This happens after the input device
+ * has been probed. (XXX boot -d won't work...)
+ */
+void wscons_attach_input __P((struct device *,
+ const struct wscons_idev_spec *));
+
+/*
+ * Transfer a string of characters from the console input device to
+ * the wscons buffer. (XXX raw scancodes? pass ioctl, or something?
+ * then need length.)
+ */
+void wscons_input __P((char *));
+
+#endif /* _ALPHA_WSCONS_WSCONSVAR_H_ */
diff --git a/sys/dev/wscons/ascii.h b/sys/dev/wscons/ascii.h
new file mode 100644
index 00000000000..dc4775022c9
--- /dev/null
+++ b/sys/dev/wscons/ascii.h
@@ -0,0 +1,10 @@
+/* $NetBSD: ascii.h,v 1.1 1996/04/12 02:00:42 cgd Exp $ */
+
+#define ASCII_BEL 0x07 /* bell */
+#define ASCII_BS 0x08 /* backspace */
+#define ASCII_HT 0x09 /* horizontal tab */
+#define ASCII_LF 0x0a /* line feed */
+#define ASCII_VT 0x0b /* vertical tab(?); up one line */
+#define ASCII_NP 0x0c /* next page; form feed */
+#define ASCII_CR 0x0d /* carriage return */
+#define ASCII_ESC 0x1b /* escape */
diff --git a/sys/dev/wscons/event.c b/sys/dev/wscons/event.c
new file mode 100644
index 00000000000..3c34d962c83
--- /dev/null
+++ b/sys/dev/wscons/event.c
@@ -0,0 +1,172 @@
+/* $NetBSD: event.c,v 1.1.4.1 1996/05/29 22:26:54 cgd Exp $ */
+
+/*
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Lawrence Berkeley Laboratory.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)event.c 8.1 (Berkeley) 6/11/93
+ */
+
+/*
+ * Internal `Firm_event' interface for the keyboard and mouse drivers.
+ */
+
+#include <sys/param.h>
+#include <sys/fcntl.h>
+#include <sys/malloc.h>
+#include <sys/proc.h>
+#include <sys/systm.h>
+#include <sys/vnode.h>
+
+#include <machine/vuid_event.h>
+#include <alpha/wscons/event_var.h>
+
+/*
+ * Initialize a firm_event queue.
+ */
+void
+ev_init(ev)
+ register struct evvar *ev;
+{
+
+ ev->ev_get = ev->ev_put = 0;
+ ev->ev_q = malloc((u_long)EV_QSIZE * sizeof(struct firm_event),
+ M_DEVBUF, M_WAITOK);
+ bzero((caddr_t)ev->ev_q, EV_QSIZE * sizeof(struct firm_event));
+}
+
+/*
+ * Tear down a firm_event queue.
+ */
+void
+ev_fini(ev)
+ register struct evvar *ev;
+{
+
+ free(ev->ev_q, M_DEVBUF);
+}
+
+/*
+ * User-level interface: read, select.
+ * (User cannot write an event queue.)
+ */
+int
+ev_read(ev, uio, flags)
+ register struct evvar *ev;
+ struct uio *uio;
+ int flags;
+{
+ int s, n, cnt, error;
+
+ /*
+ * Make sure we can return at least 1.
+ */
+ if (uio->uio_resid < sizeof(struct firm_event))
+ return (EMSGSIZE); /* ??? */
+ s = splev();
+ while (ev->ev_get == ev->ev_put) {
+ if (flags & IO_NDELAY) {
+ splx(s);
+ return (EWOULDBLOCK);
+ }
+ ev->ev_wanted = 1;
+ error = tsleep((caddr_t)ev, PEVENT | PCATCH, "firm_event", 0);
+ if (error) {
+ splx(s);
+ return (error);
+ }
+ }
+ /*
+ * Move firm_events from tail end of queue (there is at least one
+ * there).
+ */
+ if (ev->ev_put < ev->ev_get)
+ cnt = EV_QSIZE - ev->ev_get; /* events in [get..QSIZE) */
+ else
+ cnt = ev->ev_put - ev->ev_get; /* events in [get..put) */
+ splx(s);
+ n = howmany(uio->uio_resid, sizeof(struct firm_event));
+ if (cnt > n)
+ cnt = n;
+ error = uiomove((caddr_t)&ev->ev_q[ev->ev_get],
+ cnt * sizeof(struct firm_event), uio);
+ n -= cnt;
+ /*
+ * If we do not wrap to 0, used up all our space, or had an error,
+ * stop. Otherwise move from front of queue to put index, if there
+ * is anything there to move.
+ */
+ if ((ev->ev_get = (ev->ev_get + cnt) % EV_QSIZE) != 0 ||
+ n == 0 || error || (cnt = ev->ev_put) == 0)
+ return (error);
+ if (cnt > n)
+ cnt = n;
+ error = uiomove((caddr_t)&ev->ev_q[0],
+ cnt * sizeof(struct firm_event), uio);
+ ev->ev_get = cnt;
+ return (error);
+}
+
+int
+ev_select(ev, rw, p)
+ register struct evvar *ev;
+ int rw;
+ struct proc *p;
+{
+ int s = splev();
+
+ switch (rw) {
+
+ case FREAD:
+ /* succeed if there is something to read */
+ if (ev->ev_get != ev->ev_put) {
+ splx(s);
+ return (1);
+ }
+ selrecord(p, &ev->ev_sel);
+ break;
+
+ case FWRITE:
+ splx(s);
+ return (1); /* always fails => never blocks */
+ }
+ splx(s);
+ return (0);
+}
diff --git a/sys/dev/wscons/event_var.h b/sys/dev/wscons/event_var.h
new file mode 100644
index 00000000000..b63213d315f
--- /dev/null
+++ b/sys/dev/wscons/event_var.h
@@ -0,0 +1,87 @@
+/* $NetBSD: event_var.h,v 1.1 1996/04/12 02:00:45 cgd Exp $ */
+
+/*
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Lawrence Berkeley Laboratory.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)event_var.h 8.1 (Berkeley) 6/11/93
+ */
+
+/*
+ * Internal `Firm_event' interface for the keyboard and mouse drivers.
+ * The drivers are expected not to place events in the queue above spltty(),
+ * i.e., are expected to run off serial ports.
+ */
+
+/* EV_QSIZE should be a power of two so that `%' is fast */
+#define EV_QSIZE 256 /* may need tuning; this uses 2k */
+
+struct evvar {
+ u_int ev_get; /* get (read) index (modified synchronously) */
+ volatile u_int ev_put; /* put (write) index (modified by interrupt) */
+ struct selinfo ev_sel; /* process selecting */
+ struct proc *ev_io; /* process that opened queue (can get SIGIO) */
+ char ev_wanted; /* wake up on input ready */
+ char ev_async; /* send SIGIO on input ready */
+ struct firm_event *ev_q;/* circular buffer (queue) of events */
+};
+
+#define splev() spltty()
+
+#define EV_WAKEUP(ev) { \
+ selwakeup(&(ev)->ev_sel); \
+ if ((ev)->ev_wanted) { \
+ (ev)->ev_wanted = 0; \
+ wakeup((caddr_t)(ev)); \
+ } \
+ if ((ev)->ev_async) \
+ psignal((ev)->ev_io, SIGIO); \
+}
+
+void ev_init __P((struct evvar *));
+void ev_fini __P((struct evvar *));
+int ev_read __P((struct evvar *, struct uio *, int));
+int ev_select __P((struct evvar *, int, struct proc *));
+
+/*
+ * PEVENT is set just above PSOCK, which is just above TTIPRI, on the
+ * theory that mouse and keyboard `user' input should be quick.
+ */
+#define PEVENT 23
diff --git a/sys/dev/wscons/kbd.c b/sys/dev/wscons/kbd.c
new file mode 100644
index 00000000000..67cd26fcee5
--- /dev/null
+++ b/sys/dev/wscons/kbd.c
@@ -0,0 +1,334 @@
+/* $NetBSD: kbd.c,v 1.1 1996/04/12 02:00:46 cgd Exp $ */
+
+/*
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Lawrence Berkeley Laboratory.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)kbd.c 8.2 (Berkeley) 10/30/93
+ */
+
+/*
+ * Keyboard driver (/dev/kbd -- note that we do not have minor numbers
+ * [yet?]). Translates incoming bytes to ASCII or to `firm_events' and
+ * passes them up to the appropriate reader.
+ */
+
+#include <sys/param.h>
+#include <sys/conf.h>
+#include <sys/device.h>
+#include <sys/ioctl.h>
+#include <sys/kernel.h>
+#include <sys/proc.h>
+#include <sys/syslog.h>
+#include <sys/systm.h>
+#include <sys/tty.h>
+
+#include <machine/autoconf.h>
+
+#include <machine/vuid_event.h>
+#include <machine/kbio.h> /* XXX FOR KIOCSDIRECT */
+#include <machine/wsconsio.h> /* XXX for bell ioctls */
+#include <alpha/wscons/event_var.h>
+#include <alpha/wscons/wsconsvar.h>
+
+struct kbd_softc {
+ struct device *k_idev; /* the input device */
+ struct wscons_idev_spec k_ispec; /* the input device information */
+
+ int k_evmode; /* set if we should produce events */
+ struct evvar k_events; /* event queue state */
+ char *k_repeatcp; /* repeated character (string) */
+ int k_repeating; /* we've called timeout() */
+ int k_repeat_start; /* how long (ms) until repeat */
+ int k_repeat_step; /* how long (ms) until more repeats */
+
+ struct wsconsio_bell_data k_belldata;
+} kbd_softc;
+
+void
+kbdattach(idev, ispec)
+ struct device *idev;
+ struct wscons_idev_spec *ispec;
+{
+ register struct kbd_softc *k = &kbd_softc;
+
+ /*
+ * It would be nice if the repeat rates were in ticks.
+ * However, if they were, we couldn't set them here, as
+ * hz might not be set up yet!
+ */
+ k->k_repeat_start = 200;
+ k->k_repeat_step = 50;
+
+ k->k_belldata.wbd_pitch = 1500; /* 1500 Hz */
+ k->k_belldata.wbd_period = 100; /* 100 ms */
+ k->k_belldata.wbd_volume = 50; /* 50% volume */
+
+ k->k_idev = idev;
+ k->k_ispec = *ispec;
+}
+
+void
+kbd_repeat(void *arg)
+{
+ struct kbd_softc *k = (struct kbd_softc *)arg;
+ int s = spltty();
+
+ if (k->k_repeating && k->k_repeatcp != NULL) {
+ wscons_input(k->k_repeatcp);
+ timeout(kbd_repeat, k, (hz * k->k_repeat_step) / 1000);
+ }
+ splx(s);
+}
+
+void
+kbd_input(register int c)
+{
+ register struct kbd_softc *k = &kbd_softc;
+ register struct firm_event *fe;
+ register int put;
+ char *cp;
+
+ if (k->k_repeating) {
+ k->k_repeating = 0;
+ untimeout(kbd_repeat, k);
+ }
+
+ /*
+ * If /dev/kbd is not connected in event mode translate and
+ * send upstream.
+ */
+ if (!k->k_evmode) {
+ cp = (*k->k_ispec.wi_translate)(k->k_idev, c);
+ if (cp != NULL) {
+ wscons_input(cp);
+ k->k_repeating = 1;
+ k->k_repeatcp = cp;
+ timeout(kbd_repeat, k, (hz * k->k_repeat_start) / 1000);
+ }
+ return;
+ }
+
+ /*
+ * Keyboard is generating events. Turn this keystroke into an
+ * event and put it in the queue. If the queue is full, the
+ * keystroke is lost (sorry!).
+ */
+ put = k->k_events.ev_put;
+ fe = &k->k_events.ev_q[put];
+ put = (put + 1) % EV_QSIZE;
+ if (put == k->k_events.ev_get) {
+ log(LOG_WARNING, "keyboard event queue overflow\n"); /* ??? */
+ return;
+ }
+ fe->id = c & k->k_ispec.wi_keymask;
+ fe->value = (c & k->k_ispec.wi_keyupmask) != 0 ? VKEY_UP : VKEY_DOWN;
+ microtime(&fe->time);
+ k->k_events.ev_put = put;
+ EV_WAKEUP(&k->k_events);
+}
+
+int
+kbdopen(dev_t dev, int flags, int mode, struct proc *p)
+{
+ int s;
+ struct tty *tp;
+
+ if (kbd_softc.k_events.ev_io)
+ return (EBUSY);
+ kbd_softc.k_events.ev_io = p;
+ ev_init(&kbd_softc.k_events);
+ kbd_softc.k_evmode = 1;
+ return (0);
+}
+
+int
+kbdclose(dev_t dev, int flags, int mode, struct proc *p)
+{
+
+ /*
+ * Turn off event mode, dump the queue, and close the keyboard
+ * unless it is supplying console input.
+ */
+ kbd_softc.k_evmode = 0;
+ ev_fini(&kbd_softc.k_events);
+ kbd_softc.k_events.ev_io = NULL;
+ return (0);
+}
+
+int
+kbdread(dev_t dev, struct uio *uio, int flags)
+{
+
+ return (ev_read(&kbd_softc.k_events, uio, flags));
+}
+
+/* this routine should not exist, but is convenient to write here for now */
+int
+kbdwrite(dev_t dev, struct uio *uio, int flags)
+{
+
+ return (EOPNOTSUPP);
+}
+
+int
+kbdioctl(dev_t dev, u_long cmd, register caddr_t data, int flag, struct proc *p)
+{
+ struct kbd_softc *k = &kbd_softc;
+ struct wsconsio_bell_data *wbd;
+ int rv;
+
+ rv = ENOTTY;
+ switch (cmd) {
+#if 0
+ case KIOCSDIRECT:
+ k->k_evmode = *(int *)data;
+ return (0);
+#endif
+
+ case FIONBIO: /* we will remove this someday (soon???) */
+ return (0);
+
+ case FIOASYNC:
+ k->k_events.ev_async = *(int *)data != 0;
+ return (0);
+
+ case TIOCSPGRP:
+ if (*(int *)data != k->k_events.ev_io->p_pgid)
+ return (EPERM);
+ return (0);
+
+ case WSCONSIO_BELL:
+ if (k->k_ispec.wi_bell != NULL)
+ (*k->k_ispec.wi_bell)(k->k_idev, &k->k_belldata);
+ return (0);
+
+ case WSCONSIO_COMPLEXBELL:
+ if (k->k_ispec.wi_bell != NULL) {
+ wbd = (struct wsconsio_bell_data *)data;
+ if ((wbd->wbd_flags & WSCONSIO_BELLDATA_PITCH) == 0)
+ wbd->wbd_pitch = k->k_belldata.wbd_pitch;
+ if ((wbd->wbd_flags & WSCONSIO_BELLDATA_PERIOD) == 0)
+ wbd->wbd_period = k->k_belldata.wbd_period;
+ if ((wbd->wbd_flags & WSCONSIO_BELLDATA_VOLUME) == 0)
+ wbd->wbd_volume = k->k_belldata.wbd_volume;
+
+ (*k->k_ispec.wi_bell)(k->k_idev, wbd);
+ }
+ return (0);
+
+ case WSCONSIO_SETBELL:
+ wbd = (struct wsconsio_bell_data *)data;
+ if ((wbd->wbd_flags & WSCONSIO_BELLDATA_PITCH) != 0)
+ k->k_belldata.wbd_pitch = wbd->wbd_pitch;
+ if ((wbd->wbd_flags & WSCONSIO_BELLDATA_PERIOD) != 0)
+ k->k_belldata.wbd_period = wbd->wbd_period;
+ if ((wbd->wbd_flags & WSCONSIO_BELLDATA_VOLUME) != 0)
+ k->k_belldata.wbd_volume = wbd->wbd_volume;
+ return (0);
+
+ case WSCONSIO_GETBELL:
+ wbd = (struct wsconsio_bell_data *)data;
+ wbd->wbd_flags = WSCONSIO_BELLDATA_PITCH |
+ WSCONSIO_BELLDATA_PERIOD | WSCONSIO_BELLDATA_VOLUME;
+ wbd->wbd_pitch = k->k_belldata.wbd_pitch;
+ wbd->wbd_period = k->k_belldata.wbd_period;
+ wbd->wbd_volume = k->k_belldata.wbd_volume ;
+ return (0);
+
+#if 0 /* XXX */
+ /* XXX KEY-REPEAT RATE SETTING */
+#endif /* XXX */
+
+ default:
+ if (k->k_ispec.wi_ioctl != NULL)
+ rv = (*k->k_ispec.wi_ioctl)(k->k_idev, cmd, data,
+ flag, p);
+ }
+ return (rv);
+}
+
+int
+kbdselect(dev_t dev, int rw, struct proc *p)
+{
+
+ return (ev_select(&kbd_softc.k_events, rw, p));
+}
+
+/* Ring the console bell. (For wscons terminal emulator and other code) */
+void
+wscons_kbd_bell()
+{
+ struct kbd_softc *k = &kbd_softc;
+
+ if (k->k_ispec.wi_bell != NULL)
+ (*k->k_ispec.wi_bell)(k->k_idev, &k->k_belldata);
+}
+
+/*
+ * Console handling functions.
+ */
+
+int
+kbd_cngetc(dev)
+ dev_t dev;
+{
+ struct kbd_softc *k = &kbd_softc;
+
+ if (kbd_softc.k_evmode) /* XXX? */
+ return 0;
+ if (k->k_ispec.wi_getc != NULL)
+ return (*k->k_ispec.wi_getc)(k->k_idev);
+ else
+ return 0;
+}
+
+void
+kbd_cnpollc(dev, on)
+ dev_t dev;
+ int on;
+{
+ struct kbd_softc *k = &kbd_softc;
+
+ if (kbd_softc.k_evmode) /* XXX? */
+ return;
+ if (k->k_ispec.wi_pollc != NULL)
+ (*k->k_ispec.wi_pollc)(k->k_idev, on);
+}
diff --git a/sys/dev/wscons/ms.c b/sys/dev/wscons/ms.c
new file mode 100644
index 00000000000..240a0b4bfd6
--- /dev/null
+++ b/sys/dev/wscons/ms.c
@@ -0,0 +1,285 @@
+/* $NetBSD: ms.c,v 1.1 1996/04/12 02:00:47 cgd Exp $ */
+
+/*
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Lawrence Berkeley Laboratory.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)ms.c 8.1 (Berkeley) 6/11/93
+ */
+
+/*
+ * Mouse driver.
+ */
+
+#include <sys/param.h>
+#include <sys/conf.h>
+#include <sys/ioctl.h>
+#include <sys/kernel.h>
+#include <sys/proc.h>
+#include <sys/syslog.h>
+#include <sys/systm.h>
+#include <sys/tty.h>
+
+#include <machine/vuid_event.h>
+#include <alpha/wscons/event_var.h>
+#include <alpha/wscons/wsconsvar.h>
+
+struct ms_softc {
+ struct device *ms_dev;
+ struct wscons_mdev_spec ms_spec;
+ char ms_mb; /* mouse button state */
+ char ms_ub; /* user button state */
+ int ms_dx; /* delta-x */
+ int ms_dy; /* delta-y */
+ volatile int ms_ready; /* event queue is ready */
+ struct evvar ms_events; /* event queue state */
+} ms_softc;
+
+void
+msattach(mdev, mspec)
+ struct device *mdev;
+ struct wscons_mdev_spec *mspec;
+{
+ register struct ms_softc *m = &ms_softc;
+
+ m->ms_dev = mdev;
+ m->ms_spec = *mspec;
+}
+
+void
+ms_event(buttons, dx, dy)
+ char buttons; /* 0 is up */
+ int dx, dy;
+{
+ register struct firm_event *fe;
+ register struct ms_softc *ms = &ms_softc;
+ register int mb, ub, d, get, put, any;
+ static const char to_one[] = { 1, 2, 2, 4, 4, 4, 4 };
+ static const int to_id[] = { MS_RIGHT, MS_MIDDLE, 0, MS_LEFT };
+
+ /*
+ * Discard input if not ready.
+ */
+ if (ms->ms_ready == 0)
+ return;
+
+ ms->ms_mb = (buttons) & 0x7;
+ ms->ms_dx += dx;
+ ms->ms_dy += dy;
+
+ /*
+ * We have at least one event (mouse button, delta-X, or
+ * delta-Y; possibly all three, and possibly three separate
+ * button events). Deliver these events until we are out
+ * of changes or out of room. As events get delivered,
+ * mark them `unchanged'.
+ */
+ any = 0;
+ get = ms->ms_events.ev_get;
+ put = ms->ms_events.ev_put;
+ fe = &ms->ms_events.ev_q[put];
+
+ /* NEXT prepares to put the next event, backing off if necessary */
+#define NEXT \
+ if ((++put) % EV_QSIZE == get) { \
+ put--; \
+ goto out; \
+ }
+ /* ADVANCE completes the `put' of the event */
+#define ADVANCE \
+ fe++; \
+ if (put >= EV_QSIZE) { \
+ put = 0; \
+ fe = &ms->ms_events.ev_q[0]; \
+ } \
+ any = 1
+
+ mb = ms->ms_mb;
+ ub = ms->ms_ub;
+ while ((d = mb ^ ub) != 0) {
+ /*
+ * Mouse button change. Convert up to three changes
+ * to the `first' change, and drop it into the event queue.
+ */
+ NEXT;
+ d = to_one[d - 1]; /* from 1..7 to {1,2,4} */
+ fe->id = to_id[d - 1]; /* from {1,2,4} to ID */
+ fe->value = mb & d ? VKEY_DOWN : VKEY_UP;
+ fe->time = time;
+ ADVANCE;
+ ub ^= d;
+ }
+ if (ms->ms_dx) {
+ NEXT;
+ fe->id = LOC_X_DELTA;
+ fe->value = ms->ms_dx;
+ fe->time = time;
+ ADVANCE;
+ ms->ms_dx = 0;
+ }
+ if (ms->ms_dy) {
+ NEXT;
+ fe->id = LOC_Y_DELTA;
+ fe->value = ms->ms_dy;
+ fe->time = time;
+ ADVANCE;
+ ms->ms_dy = 0;
+ }
+out:
+ if (any) {
+ ms->ms_ub = ub;
+ ms->ms_events.ev_put = put;
+ EV_WAKEUP(&ms->ms_events);
+ }
+}
+
+int
+msopen(dev, flags, mode, p)
+ dev_t dev;
+ int flags, mode;
+ struct proc *p;
+{
+ int s, error;
+
+ if (ms_softc.ms_dev == NULL) /* never attached! */
+ return (ENXIO);
+
+ if (ms_softc.ms_events.ev_io)
+ return (EBUSY);
+
+ ms_softc.ms_events.ev_io = p;
+ ev_init(&ms_softc.ms_events); /* may cause sleep */
+
+ ms_softc.ms_ready = 1; /* start accepting events */
+
+ error = (*ms_softc.ms_spec.wm_enable)(ms_softc.ms_dev);
+
+ if (error) {
+ ms_softc.ms_ready = 0; /* stop accepting events */
+ ev_fini(&ms_softc.ms_events);
+ ms_softc.ms_events.ev_io = NULL;
+ return (error);
+ }
+
+ return (0);
+}
+
+int
+msclose(dev, flags, mode, p)
+ dev_t dev;
+ int flags, mode;
+ struct proc *p;
+{
+
+ (*ms_softc.ms_spec.wm_disable)(ms_softc.ms_dev);
+
+ ms_softc.ms_ready = 0; /* stop accepting events */
+ ev_fini(&ms_softc.ms_events);
+ ms_softc.ms_events.ev_io = NULL;
+ return (0);
+}
+
+int
+msread(dev, uio, flags)
+ dev_t dev;
+ struct uio *uio;
+ int flags;
+{
+
+ return (ev_read(&ms_softc.ms_events, uio, flags));
+}
+
+/* this routine should not exist, but is convenient to write here for now */
+int
+mswrite(dev, uio, flags)
+ dev_t dev;
+ struct uio *uio;
+ int flags;
+{
+
+ return (EOPNOTSUPP);
+}
+
+int
+msioctl(dev, cmd, data, flag, p)
+ dev_t dev;
+ u_long cmd;
+ register caddr_t data;
+ int flag;
+ struct proc *p;
+{
+ int s;
+
+ switch (cmd) {
+
+ case FIONBIO: /* we will remove this someday (soon???) */
+ return (0);
+
+ case FIOASYNC:
+ ms_softc.ms_events.ev_async = *(int *)data != 0;
+ return (0);
+
+ case TIOCSPGRP:
+ if (*(int *)data != ms_softc.ms_events.ev_io->p_pgid)
+ return (EPERM);
+ return (0);
+
+ case VUIDGFORMAT:
+ /* we only do firm_events */
+ *(int *)data = VUID_FIRM_EVENT;
+ return (0);
+
+ case VUIDSFORMAT:
+ if (*(int *)data != VUID_FIRM_EVENT)
+ return (EINVAL);
+ return (0);
+ }
+ return (ENOTTY);
+}
+
+int
+msselect(dev, rw, p)
+ dev_t dev;
+ int rw;
+ struct proc *p;
+{
+
+ return (ev_select(&ms_softc.ms_events, rw, p));
+}
diff --git a/sys/dev/wscons/wscons.c b/sys/dev/wscons/wscons.c
new file mode 100644
index 00000000000..2845895227d
--- /dev/null
+++ b/sys/dev/wscons/wscons.c
@@ -0,0 +1,495 @@
+/* $NetBSD: wscons.c,v 1.3.4.1 1996/06/03 18:54:35 cgd Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#include <sys/param.h>
+#include <sys/device.h>
+#include <sys/kernel.h>
+#include <sys/conf.h>
+#include <sys/systm.h>
+#include <sys/malloc.h>
+#include <sys/ioctl.h>
+#include <sys/proc.h>
+#include <sys/tty.h>
+#include <sys/termios.h>
+
+#include <dev/cons.h>
+#include <alpha/wscons/wsconsvar.h>
+#include <alpha/wscons/wscons_emul.h>
+#include <machine/wsconsio.h>
+
+cdev_decl(wscons);
+
+/* Macros to clear/set/test flags. */
+#define SET(t, f) (t) |= (f)
+#define CLR(t, f) (t) &= ~(f)
+#define ISSET(t, f) ((t) & (f))
+
+/*
+ * Autoconfiguration glue.
+ */
+struct wscons_softc {
+ struct device sc_dev;
+
+ struct wscons_emul_data *sc_emul_data;
+ struct tty *sc_tty;
+
+ wscons_ioctl_t sc_ioctl;
+ wscons_mmap_t sc_mmap;
+};
+
+int wsconsmatch __P((struct device *, void *, void *));
+void wsconsattach __P((struct device *, struct device *, void *));
+
+struct cfattach wscons_ca = {
+ sizeof (struct wscons_softc), wsconsmatch, wsconsattach,
+};
+
+struct cfdriver wscons_cd = {
+ NULL, "wscons", DV_TTY,
+};
+
+/*
+ * Console handing functions and variables.
+ */
+int wscons_console_attached; /* polled console fns attached */
+int wscons_console_unit = -1;
+struct wscons_emul_data wscons_console_emul_data;
+
+int wscons_cngetc __P((dev_t));
+void wscons_cnputc __P((dev_t, int));
+void wscons_cnpollc __P((dev_t, int));
+
+struct consdev wscons_consdev =
+ { NULL, NULL, wscons_cngetc, wscons_cnputc, wscons_cnpollc, NODEV, 1 };
+
+/*
+ * Input focus handling: where characters from the keyboard are sent.
+ */
+int wscons_input_focus = -1;
+
+/*
+ * TTY interface helpers.
+ */
+
+#define WSCUNIT(dev) minor(dev)
+
+void wsconsstart __P((struct tty *));
+int wsconsparam __P((struct tty *, struct termios *));
+
+
+/*
+ * Output device selection and attachment.
+ */
+
+int
+wsconsmatch(parent, cfdata, aux)
+ struct device *parent;
+ void *cfdata;
+ void *aux;
+{
+ struct wscons_attach_args *waa = aux;
+ struct cfdata *cf = cfdata;
+
+ if (waa->waa_isconsole && wscons_console_unit != -1)
+ panic("wsconsmatch: multiple consoles?");
+
+ /* If console-ness specified... */
+ if (cf->wsconscf_console != -1) {
+ /*
+ * If exact match, return match with high priority,
+ * else return don't match.
+ */
+ if ((cf->wsconscf_console && waa->waa_isconsole) ||
+ (!cf->wsconscf_console && !waa->waa_isconsole))
+ return (10);
+ else
+ return (0);
+ }
+
+ /* Otherwise match with low priority. */
+ return (1);
+}
+
+void
+wsconsattach(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ struct wscons_attach_args *waa = aux;
+ struct wscons_softc *sc = (struct wscons_softc *)self;
+ int console;
+
+ console = waa->waa_isconsole;
+ if (console)
+ printf(": console");
+
+ /*
+ * If output has already been set up, record it now. Otherwise,
+ * do the setup.
+ */
+ if (console) {
+ sc->sc_emul_data = &wscons_console_emul_data;
+ wscons_console_unit = sc->sc_dev.dv_unit;
+ wscons_consdev.cn_dev =
+ makedev(25, wscons_console_unit); /* XXX */
+ } else {
+ sc->sc_emul_data = malloc(sizeof(*sc->sc_emul_data), M_DEVBUF,
+ M_WAITOK);
+ wscons_emul_attach(sc->sc_emul_data, &waa->waa_odev_spec);
+ }
+
+ /*
+ * Set wscons input focus if this is the console device,
+ * or if we've not yet set the input focus.
+ */
+ if (console || wscons_input_focus == -1)
+ wscons_input_focus = sc->sc_dev.dv_unit;
+
+ /*
+ * Set up the device's tty structure.
+ */
+ sc->sc_tty = ttymalloc();
+ tty_attach(sc->sc_tty);
+
+ /*
+ * Record other relevant information: ioctl and mmap functions.
+ */
+ sc->sc_ioctl = waa->waa_odev_spec.wo_ioctl;
+ sc->sc_mmap = waa->waa_odev_spec.wo_mmap;
+
+ printf("\n");
+}
+
+
+/*
+ * Keyboard input handling.
+ */
+
+void
+wscons_input(cp)
+ char *cp;
+{
+ struct wscons_softc *sc;
+ struct tty *tp;
+
+ if (wscons_input_focus == -1)
+ return;
+
+#ifdef DIAGNOSTIC
+ if (wscons_input_focus >= wscons_cd.cd_ndevs)
+ panic("wscons_input: bogus input focus");
+ sc = wscons_cd.cd_devs[wscons_input_focus];
+ if (sc == NULL)
+ panic("wscons_input: null input device");
+ tp = sc->sc_tty;
+ if (tp == NULL)
+ panic("wscons_input: no tty");
+#else
+ sc = wscons_cd.cd_devs[wscons_input_focus];
+ tp = sc->sc_tty;
+#endif
+
+ while (*cp)
+ (*linesw[tp->t_line].l_rint)(*cp++, tp);
+}
+
+
+/*
+ * Console (output) tty-handling functions.
+ */
+
+int
+wsconsopen(dev, flag, mode, p)
+ dev_t dev;
+ int flag, mode;
+ struct proc *p;
+{
+ struct wscons_softc *sc;
+ int unit = WSCUNIT(dev), newopen, rv;
+ struct tty *tp;
+
+ if (unit >= wscons_cd.cd_ndevs)
+ return ENXIO;
+ sc = wscons_cd.cd_devs[unit];
+ if (sc == NULL)
+ return ENXIO;
+
+#ifdef DIAGNOSTIC
+ if (!sc->sc_tty)
+ panic("wscopen: no tty!");
+#endif
+ tp = sc->sc_tty;
+
+ tp->t_oproc = wsconsstart;
+ tp->t_param = wsconsparam;
+ tp->t_dev = dev;
+ newopen = (tp->t_state & TS_ISOPEN) == 0;
+ if (newopen) {
+ tp->t_state |= TS_WOPEN;
+ ttychars(tp);
+ tp->t_iflag = TTYDEF_IFLAG;
+ tp->t_oflag = TTYDEF_OFLAG;
+ tp->t_cflag = TTYDEF_CFLAG;
+ tp->t_lflag = TTYDEF_LFLAG;
+ tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
+ wsconsparam(tp, &tp->t_termios);
+ ttsetwater(tp);
+ } else if ((tp->t_state & TS_XCLUDE) != 0 && p->p_ucred->cr_uid != 0)
+ return EBUSY;
+ tp->t_state |= TS_CARR_ON;
+
+ rv = ((*linesw[tp->t_line].l_open)(dev, tp));
+ if (newopen && (rv == 0)) {
+ /* set window sizes to be correct */
+ tp->t_winsize.ws_row = sc->sc_emul_data->ac_nrow;
+ tp->t_winsize.ws_col = sc->sc_emul_data->ac_ncol;
+ }
+ return (rv);
+}
+
+int
+wsconsclose(dev, flag, mode, p)
+ dev_t dev;
+ int flag, mode;
+ struct proc *p;
+{
+ struct wscons_softc *sc = wscons_cd.cd_devs[WSCUNIT(dev)];
+ struct tty *tp = sc->sc_tty;
+
+ (*linesw[tp->t_line].l_close)(tp, flag);
+ ttyclose(tp);
+ return(0);
+}
+
+int
+wsconsread(dev, uio, flag)
+ dev_t dev;
+ struct uio *uio;
+ int flag;
+{
+ struct wscons_softc *sc = wscons_cd.cd_devs[WSCUNIT(dev)];
+ struct tty *tp = sc->sc_tty;
+
+ return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
+}
+
+int
+wsconswrite(dev, uio, flag)
+ dev_t dev;
+ struct uio *uio;
+ int flag;
+{
+ struct wscons_softc *sc = wscons_cd.cd_devs[WSCUNIT(dev)];
+ struct tty *tp = sc->sc_tty;
+
+ return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
+}
+
+struct tty *
+wsconstty(dev)
+ dev_t dev;
+{
+ struct wscons_softc *sc = wscons_cd.cd_devs[WSCUNIT(dev)];
+ struct tty *tp = sc->sc_tty;
+
+ return (tp);
+}
+
+int
+wsconsioctl(dev, cmd, data, flag, p)
+ dev_t dev;
+ u_long cmd;
+ caddr_t data;
+ int flag;
+ struct proc *p;
+{
+ struct wscons_softc *sc = wscons_cd.cd_devs[WSCUNIT(dev)];
+ struct tty *tp = sc->sc_tty;
+ int error;
+
+ /* do the line discipline ioctls first */
+ error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
+ if (error >= 0)
+ return error;
+
+ /* then the tty ioctls */
+ error = ttioctl(tp, cmd, data, flag, p);
+ if (error >= 0)
+ return error;
+
+ /* then the underlying frame buffer device ioctls */
+ if (sc->sc_ioctl != NULL)
+ error = (*sc->sc_ioctl)(sc->sc_dev.dv_parent, cmd, data,
+ flag, p);
+ if (error >= 0)
+ return error;
+
+ /*
+ * then the keyboard ioctls, if we have input focus.
+ * This is done last because it's a special case: it will
+ * return ENOTTY (not -1) if it can't figure out what
+ * to do with the request.
+ */
+ if (WSCUNIT(dev) == wscons_input_focus)
+ error = kbdioctl(0, cmd, data, flag, p); /* XXX dev */
+ else
+ error = ENOTTY;
+
+ return (error);
+}
+
+int
+wsconsmmap(dev, offset, prot)
+ dev_t dev;
+ int offset; /* XXX */
+ int prot;
+{
+ struct wscons_softc *sc = wscons_cd.cd_devs[WSCUNIT(dev)];
+
+ if (sc->sc_ioctl != NULL)
+ return (*sc->sc_mmap)(sc->sc_dev.dv_parent, offset, prot);
+ else
+ return -1;
+}
+
+void
+wsconsstart(tp)
+ register struct tty *tp;
+{
+ struct wscons_softc *sc;
+ register int s, n, i;
+ char buf[OBUFSIZ];
+
+ s = spltty();
+ if (tp->t_state & (TS_TIMEOUT | TS_BUSY | TS_TTSTOP)) {
+ splx(s);
+ return;
+ }
+ tp->t_state |= TS_BUSY;
+ splx(s);
+
+ n = q_to_b(&tp->t_outq, buf, sizeof(buf));
+ for (i = 0; i < n; ++i)
+ buf[i] &= 0177; /* strip parity (argh) */
+
+ sc = wscons_cd.cd_devs[WSCUNIT(tp->t_dev)];
+ wscons_emul_input(sc->sc_emul_data, buf, n);
+
+ s = spltty();
+ tp->t_state &= ~TS_BUSY;
+ /* Come back if there's more to do */
+ if (tp->t_outq.c_cc) {
+ tp->t_state |= TS_TIMEOUT;
+ timeout(ttrstrt, tp, 1);
+ }
+ if (tp->t_outq.c_cc <= tp->t_lowat) {
+ if (tp->t_state&TS_ASLEEP) {
+ tp->t_state &= ~TS_ASLEEP;
+ wakeup((caddr_t)&tp->t_outq);
+ }
+ selwakeup(&tp->t_wsel);
+ }
+ splx(s);
+}
+
+int
+wsconsstop(tp, flag)
+ struct tty *tp;
+ int flag;
+{
+ int s;
+
+ /* XXX ??? */
+ s = spltty();
+ if (ISSET(tp->t_state, TS_BUSY))
+ if (!ISSET(tp->t_state, TS_TTSTOP))
+ SET(tp->t_state, TS_FLUSH);
+ splx(s);
+}
+
+/*
+ * Set line parameters.
+ */
+int
+wsconsparam(tp, t)
+ struct tty *tp;
+ struct termios *t;
+{
+
+ tp->t_ispeed = t->c_ispeed;
+ tp->t_ospeed = t->c_ospeed;
+ tp->t_cflag = t->c_cflag;
+ return 0;
+}
+
+
+/*
+ * Polled-console handing setup and manipulation.
+ */
+
+void
+wscons_attach_console(wo)
+ const struct wscons_odev_spec *wo;
+{
+
+ if (wscons_console_attached)
+ panic("wscons_attach_console: multiple times");
+
+ wscons_emul_attach(&wscons_console_emul_data, wo);
+ cn_tab = &wscons_consdev;
+ wscons_console_attached = 1;
+}
+
+void
+wscons_cnputc(dev, ic)
+ dev_t dev;
+ int ic;
+{
+ char c = ic;
+
+ if (wscons_console_attached)
+ wscons_emul_input(&wscons_console_emul_data, &c, 1);
+}
+
+int
+wscons_cngetc(dev)
+ dev_t dev;
+{
+
+ return kbd_cngetc(dev); /* XXX XXX */
+}
+
+void
+wscons_cnpollc(dev, i)
+ dev_t dev;
+ int i;
+{
+
+ kbd_cngetc(dev, i); /* XXX XXX */
+}
diff --git a/sys/dev/wscons/wscons_emul.c b/sys/dev/wscons/wscons_emul.c
new file mode 100644
index 00000000000..cb218fd5cd0
--- /dev/null
+++ b/sys/dev/wscons/wscons_emul.c
@@ -0,0 +1,416 @@
+/* $NetBSD: wscons_emul.c,v 1.2 1996/04/12 06:10:29 cgd Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+/*
+ * Console emulator for a 'generic' ANSI X3.64 console.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <alpha/wscons/wsconsvar.h>
+#include <alpha/wscons/wscons_emul.h>
+#include <alpha/wscons/ascii.h>
+
+void
+wscons_emul_attach(we, wo)
+ struct wscons_emul_data *we;
+ const struct wscons_odev_spec *wo;
+{
+ int i;
+
+#ifdef DIAGNOSTIC
+ if (we == NULL || wo == NULL)
+ panic("wscons_emul_attach: bogus args");
+ if (wo->wo_ef == NULL)
+ panic("wscons_emul_attach: bogus emul functions");
+#endif
+ if (wo->wo_nrows < 0 || wo->wo_ncols < 0)
+ panic("wscons_emul_attach: bogus size");
+ if (wo->wo_crow < 0 || wo->wo_ccol < 0 ||
+ wo->wo_crow >= wo->wo_nrows || wo->wo_ccol >= wo->wo_ncols)
+ panic("wscons_emul_attach: bogus location (n: %d/%d, c: %d/%d",
+ wo->wo_nrows, wo->wo_ncols, wo->wo_crow, wo->wo_ccol);
+
+ we->ac_state = ANSICONS_STATE_NORMAL;
+ we->ac_ef = wo->wo_ef;
+ we->ac_efa = wo->wo_efa;
+
+ we->ac_nrow = wo->wo_nrows;
+ we->ac_ncol = wo->wo_ncols;
+
+ we->ac_crow = wo->wo_crow;
+ we->ac_ccol = wo->wo_ccol;
+
+ for (i = 0; i < ANSICONS_NARGS; i++)
+ we->ac_args[i] = 0;
+
+ (*we->ac_ef->wef_cursor)(we->ac_efa, 1, we->ac_crow, we->ac_ccol);
+}
+
+static inline int
+wscons_emul_input_normal(we, c)
+ struct wscons_emul_data *we;
+ char c;
+{
+ int newstate = ANSICONS_STATE_NORMAL;
+ int n;
+
+ switch (c) {
+ case ASCII_BEL:
+ wscons_kbd_bell();
+ break;
+
+ case ASCII_BS:
+ if (we->ac_ccol > 0)
+ we->ac_ccol--;
+ break;
+
+ case ASCII_HT:
+ n = 8 - (we->ac_ccol & 7);
+ if (we->ac_ccol + n >= we->ac_ncol)
+ n = we->ac_ncol - we->ac_ccol - 1;
+
+ (*we->ac_ef->wef_erasecols)(we->ac_efa, we->ac_crow,
+ we->ac_ccol, we->ac_ccol + n);
+
+ we->ac_ccol += n;
+ break;
+
+ case ASCII_LF:
+ if (we->ac_crow < we->ac_nrow - 1) {
+ we->ac_crow++;
+ break;
+ }
+
+#ifdef DIAGNOSTIC
+ if (we->ac_crow >= we->ac_nrow)
+ panic("wscons_emul: didn't scroll (1)");
+#endif
+
+#if 0
+ (*we->ac_ef->wef_copyrows)(we->ac_efa, 1, 0,
+ we->ac_nrow - 1);
+ (*we->ac_ef->wef_eraserows)(we->ac_efa,
+ we->ac_nrow - 1, 1);
+#else
+ (*we->ac_ef->wef_copyrows)(we->ac_efa, 10, 0,
+ we->ac_nrow - 10);
+ (*we->ac_ef->wef_eraserows)(we->ac_efa,
+ we->ac_nrow - 10, 10);
+ we->ac_crow -= 10 - 1;
+#endif
+ break;
+
+ case ASCII_VT:
+ if (we->ac_crow > 0)
+ we->ac_crow--;
+ break;
+
+ case ASCII_NP:
+ (*we->ac_ef->wef_eraserows)(we->ac_efa,
+ 0, we->ac_nrow - 1);
+
+ we->ac_ccol = 0;
+ we->ac_crow = 0;
+ break;
+
+ case ASCII_CR:
+ we->ac_ccol = 0;
+ break;
+
+ case ASCII_ESC:
+ if (we->ac_state == ANSICONS_STATE_NORMAL) {
+ newstate = ANSICONS_STATE_HAVEESC;
+ break;
+ }
+ /* else fall through; we're printing one out */
+
+ default:
+ (*we->ac_ef->wef_putstr)(we->ac_efa,
+ we->ac_crow, we->ac_ccol, &c, 1);
+ we->ac_ccol++;
+
+ /* if the current column is still on the current line, done. */
+ if (we->ac_ccol < we->ac_ncol)
+ break;
+
+ /* wrap the column around. */
+ we->ac_ccol = 0;
+
+ /* if the current row isn't the last, increment and leave. */
+ if (we->ac_crow < we->ac_nrow - 1) {
+ we->ac_crow++;
+ break;
+ }
+
+#ifdef DIAGNOSTIC
+ /* check against row overflow */
+ if (we->ac_crow >= we->ac_nrow)
+ panic("wscons_emul: didn't scroll (2)");
+#endif
+
+#if 0
+ /* scroll all of the rows up one; leave current row # alone */
+ (*we->ac_ef->wef_copyrows)(we->ac_efa, 1, 0,
+ we->ac_nrow - 1);
+ (*we->ac_ef->wef_eraserows)(we->ac_efa,
+ we->ac_nrow - 1, 1);
+#else
+ (*we->ac_ef->wef_copyrows)(we->ac_efa, 10, 0,
+ we->ac_nrow - 10);
+ (*we->ac_ef->wef_eraserows)(we->ac_efa,
+ we->ac_nrow - 10, 10);
+ we->ac_crow -= 10 - 1;
+#endif
+ break;
+ }
+
+ return newstate;
+}
+
+static inline int
+wscons_emul_input_haveesc(we, c)
+ struct wscons_emul_data *we;
+ char c;
+{
+ int newstate = ANSICONS_STATE_NORMAL;
+ int i;
+
+ switch (c) {
+ case '[':
+ for (i = 0; i < ANSICONS_NARGS; i++)
+ we->ac_args[i] = 0;
+ newstate = ANSICONS_STATE_CONTROL;
+ break;
+
+ default:
+ wscons_emul_input_normal(we, ASCII_ESC); /* special cased */
+ newstate = wscons_emul_input_normal(we, c);
+ break;
+ }
+
+ return newstate;
+}
+
+static inline void
+wscons_emul_docontrol(we, c)
+ struct wscons_emul_data *we;
+ char c;
+{
+ int n, m;
+
+#if 0
+ printf("control: %c: %d, %d\n", c, we->ac_args[0], we->ac_args[1]);
+#endif
+ switch (c) {
+ case 'A': /* Cursor Up */
+ n = we->ac_args[0] ? we->ac_args[0] : 1;
+ n = min(n, we->ac_crow);
+ we->ac_crow -= n;
+ break;
+
+ case 'B': /* Cursor Down */
+ n = we->ac_args[0] ? we->ac_args[0] : 1;
+ n = min(n, we->ac_nrow - we->ac_crow - 1);
+ we->ac_crow += n;
+ break;
+
+ case 'C': /* Cursor Forward */
+ n = we->ac_args[0] ? we->ac_args[0] : 1;
+ n = min(n, we->ac_ncol - we->ac_ccol - 1);
+ we->ac_ccol += n;
+ break;
+
+ case 'D': /* Cursor Backward */
+ n = we->ac_args[0] ? we->ac_args[0] : 1;
+ n = min(n, we->ac_ccol);
+ we->ac_ccol -= n;
+ break;
+
+ case 'E': /* Cursor Next Line */
+ n = we->ac_args[0] ? we->ac_args[0] : 1;
+ n = min(n, we->ac_nrow - we->ac_crow - 1);
+ we->ac_crow += n;
+ we->ac_ccol = 0;
+ break;
+
+ case 'f': /* Horizontal and Vertical Position */
+ case 'H': /* Cursor Position */
+ m = we->ac_args[1] ? we->ac_args[1] : 1; /* arg 1 */
+ m = min(m, we->ac_nrow);
+
+ n = we->ac_args[0] ? we->ac_args[0] : 1; /* arg 2 */
+ n = min(n, we->ac_ncol);
+
+ we->ac_crow = m - 1;
+ we->ac_ccol = n - 1;
+ break;
+
+ case 'J': /* Erase in Display */
+ (*we->ac_ef->wef_erasecols)(we->ac_efa, we->ac_crow,
+ we->ac_ccol, we->ac_ncol - we->ac_ccol);
+ if (we->ac_crow + 1 < we->ac_nrow)
+ (*we->ac_ef->wef_eraserows)(we->ac_efa,
+ we->ac_crow + 1, we->ac_nrow - we->ac_crow - 1);
+ break;
+
+ case 'K': /* Erase in Line */
+ (*we->ac_ef->wef_erasecols)(we->ac_efa, we->ac_crow,
+ we->ac_ccol, we->ac_ncol - we->ac_ccol);
+ break;
+
+ case 'L': /* Insert Line */
+ {
+ int copy_src, copy_dst, copy_nlines;
+
+ n = we->ac_args[0] ? we->ac_args[0] : 1;
+ n = min(n, we->ac_nrow - we->ac_crow);
+
+ copy_src = we->ac_crow;
+ copy_dst = we->ac_crow + n;
+ copy_nlines = we->ac_nrow - copy_dst;
+ if (copy_nlines > 0)
+ (*we->ac_ef->wef_copyrows)(we->ac_efa,
+ copy_src, copy_dst, copy_nlines);
+
+ (*we->ac_ef->wef_eraserows)(we->ac_efa,
+ we->ac_crow, n);
+ }
+ break;
+
+ case 'M': /* Delete Line */
+ {
+ int copy_src, copy_dst, copy_nlines;
+
+ n = we->ac_args[0] ? we->ac_args[0] : 1;
+ n = min(n, we->ac_nrow - we->ac_crow);
+
+ copy_src = we->ac_crow + n;
+ copy_dst = we->ac_crow;
+ copy_nlines = we->ac_nrow - copy_src;
+ if (copy_nlines > 0)
+ (*we->ac_ef->wef_copyrows)(we->ac_efa,
+ copy_src, copy_dst, copy_nlines);
+
+ (*we->ac_ef->wef_eraserows)(we->ac_efa,
+ we->ac_crow + copy_nlines,
+ we->ac_nrow - (we->ac_crow + copy_nlines));
+ }
+ break;
+
+ case 'P': /* Delete Character */
+ {
+ int copy_src, copy_dst, copy_ncols;
+
+ n = we->ac_args[0] ? we->ac_args[0] : 1;
+ n = min(n, we->ac_ncol - we->ac_ccol);
+
+ copy_src = we->ac_ccol + n;
+ copy_dst = we->ac_ccol;
+ copy_ncols = we->ac_ncol - copy_src;
+ if (copy_ncols > 0)
+ (*we->ac_ef->wef_copycols)(we->ac_efa,
+ we->ac_crow, copy_src, copy_dst,
+ copy_ncols);
+
+ (*we->ac_ef->wef_erasecols)(we->ac_efa,
+ we->ac_crow, we->ac_ccol + copy_ncols,
+ we->ac_ncol - (we->ac_ccol + copy_ncols));
+ break;
+ }
+ break;
+ }
+}
+
+static inline int
+wscons_emul_input_control(we, c)
+ struct wscons_emul_data *we;
+ char c;
+{
+ int newstate = ANSICONS_STATE_CONTROL;
+ int i;
+
+ switch (c) {
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ we->ac_args[0] *= 10;
+ we->ac_args[0] += c - '0';
+ break;
+
+ case ';':
+ for (i = 0; i < ANSICONS_NARGS - 1; i++)
+ we->ac_args[i + 1] = we->ac_args[i];
+ we->ac_args[0] = 0;
+ break;
+
+ default:
+ wscons_emul_docontrol(we, c);
+ newstate = ANSICONS_STATE_NORMAL;
+ break;
+ }
+
+ return newstate;
+}
+
+void
+wscons_emul_input(we, cp, n)
+ struct wscons_emul_data *we;
+ char *cp;
+ int n;
+{
+ int newstate;
+
+ (*we->ac_ef->wef_cursor)(we->ac_efa, 0, we->ac_crow, we->ac_ccol);
+ for (; n; n--, cp++) {
+ switch (we->ac_state) {
+ case ANSICONS_STATE_NORMAL:
+ newstate = wscons_emul_input_normal(we, *cp);
+ break;
+
+ case ANSICONS_STATE_HAVEESC:
+ newstate = wscons_emul_input_haveesc(we, *cp);
+ break;
+
+ case ANSICONS_STATE_CONTROL:
+ newstate = wscons_emul_input_control(we, *cp);
+ break;
+
+ default:
+#ifdef DIAGNOSTIC
+ panic("wscons_emul: invalid state %d\n", we->ac_state);
+#endif
+ /* try to recover, if things get screwed up... */
+ newstate = ANSICONS_STATE_NORMAL;
+ break;
+ }
+
+ we->ac_state = newstate;
+ }
+ (*we->ac_ef->wef_cursor)(we->ac_efa, 1, we->ac_crow, we->ac_ccol);
+}
diff --git a/sys/dev/wscons/wscons_emul.h b/sys/dev/wscons/wscons_emul.h
new file mode 100644
index 00000000000..acae6a9b158
--- /dev/null
+++ b/sys/dev/wscons/wscons_emul.h
@@ -0,0 +1,50 @@
+/* $NetBSD: wscons_emul.h,v 1.2 1996/04/12 06:10:32 cgd Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#define ANSICONS_NARGS 4
+
+struct wscons_emul_data {
+ int ac_state; /* current state; see below */
+
+ const struct wscons_emulfuncs *ac_ef; /* emul. callback functions */
+ void *ac_efa; /* arg. for callbacks */
+
+ int ac_nrow, ac_ncol; /* number of rows/columns */
+ int ac_crow, ac_ccol; /* current row/column */
+
+ u_int ac_args[ANSICONS_NARGS]; /* emulation args */
+};
+
+#define ANSICONS_STATE_NORMAL 0 /* normal processing */
+#define ANSICONS_STATE_HAVEESC 1 /* seen start of ctl seq */
+#define ANSICONS_STATE_CONTROL 2 /* processing ctl seq */
+
+void wscons_emul_attach __P((struct wscons_emul_data *,
+ const struct wscons_odev_spec *));
+void wscons_emul_input __P((struct wscons_emul_data *, char *, int));
diff --git a/sys/dev/wscons/wscons_raster.h b/sys/dev/wscons/wscons_raster.h
new file mode 100644
index 00000000000..33edc0cab95
--- /dev/null
+++ b/sys/dev/wscons/wscons_raster.h
@@ -0,0 +1,93 @@
+/* $NetBSD: wscons_raster.h,v 1.1 1996/04/12 02:00:51 cgd Exp $ */
+
+/*
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Lawrence Berkeley Laboratory.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)fbvar.h 8.1 (Berkeley) 6/11/93
+ */
+
+#ifndef _DEV_PSEUDO_RCONS_H_
+#define _DEV_PSEUDO_RCONS_H_
+
+struct rcons {
+ /* Console raster. Filled in before rcons_init(). */
+ struct raster *rc_sp; /* frame buffer raster */
+ int *rc_crowp; /* ptr to cursror row */
+ int *rc_ccolp; /* ptr to cursror column */
+
+ /* Number of rows/columns on raster. Filled in by rcons_init(). */
+ int rc_maxrow; /* emulator height of screen */
+ int rc_maxcol; /* emulator width of screen */
+
+ /* Font information. Filled in by rcons_init(). */
+ struct raster_font *rc_font; /* font and related info */
+ int rc_font_ascent; /* distance from font to char origin */
+
+ /* Raster console state. Filled in by rcons_init(). */
+ u_int rc_bits; /* see defines below */
+ int rc_xorigin; /* x origin for first column */
+ int rc_yorigin; /* y origin for first row */
+ int rc_raswidth; /* raster width for row copies */
+ int rc_ras_blank; /* current screen blank raster op */
+
+ /* Internal cursor row and column. XXX Weird Sun cursor pointers. */
+ int rc_crow; /* internal cursror row */
+ int rc_ccol; /* ptr to cursror column */
+};
+
+#define RC_STANDOUT 0x001 /* standout mode */
+/* #define RC_BOLD 0x? /* boldface mode */
+#define RC_INVERT 0x002 /* inverted screen colors */
+#define RC_CURSOR 0x004 /* cursor currently displayed */
+
+/* Initialization functions. */
+void rcons_init __P((struct rcons *rc, int mrow, int mcol));
+
+/* Console emulation interface functions. See ansicons.h for more info. */
+void rcons_cursor __P((void *, int, int, int));
+void rcons_invert __P((void *, int));
+void rcons_putstr __P((void *, int, int, char *, int));
+void rcons_copycols __P((void *, int, int, int, int));
+void rcons_erasecols __P((void *, int, int, int));
+void rcons_copyrows __P((void *, int, int, int));
+void rcons_eraserows __P((void *, int, int));
+
+#endif /* _DEV_PSEUDO_RCONS_H_ */
diff --git a/sys/dev/wscons/wscons_rfont.h b/sys/dev/wscons/wscons_rfont.h
new file mode 100644
index 00000000000..c836524b372
--- /dev/null
+++ b/sys/dev/wscons/wscons_rfont.h
@@ -0,0 +1,1010 @@
+/* $NetBSD: wscons_rfont.h,v 1.1 1996/04/12 02:00:52 cgd Exp $ */
+
+/*
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to the Computer Systems
+ * Engineering Group at Lawrence Berkeley Laboratory and to the University
+ * of California at Berkeley by Jef Poskanzer.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)gallant19.h 8.1 (Berkeley) 6/11/93
+ */
+
+static u_int32_t gallant19_32_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x000018c0, 0x000003c0, 0x000030c0,
+ 0x000030c0, 0x00001ee0, 0x00000000, 0x00000000, 0x00002000, 0x0000e000,
+ 0x00006000, 0x00006fc0, 0x00006060, 0x00006060, 0x00007060, 0x00004f80,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_32 = { 12, 22, 1, 1, gallant19_32_pixels, 0 };
+
+static u_int32_t gallant19_33_pixels[] = {
+ 0x00000000,
+ 0x06000000, 0x06000000, 0x06000060, 0x06000060, 0x06000060, 0x060031e0,
+ 0x06006060, 0x06006060, 0x060070e0, 0x06001e70, 0x06000000, 0x00000000,
+ 0x00000000, 0x06000000, 0x06000000, 0x000030c0, 0x00006060, 0x00006000,
+ 0x00003000, 0x00000f80, 0x00000000
+};
+static struct raster gallant19_33 = { 12, 22, 1, 1, gallant19_33_pixels, 0 };
+
+static u_int32_t gallant19_34_pixels[] = {
+ 0x00000000,
+ 0x19800c00, 0x19801e00, 0x19800000, 0x19800000, 0x19800000, 0x19800000,
+ 0x00000000, 0x000031e0, 0x000060c0, 0x00003180, 0x00006000, 0x00003fe0,
+ 0x00004020, 0x00007fc0, 0x00001000, 0x00007000, 0x00003000, 0x000039c0,
+ 0x000030c0, 0x000030c0, 0x00000000
+};
+static struct raster gallant19_34 = { 12, 22, 1, 1, gallant19_34_pixels, 0 };
+
+static u_int32_t gallant19_35_pixels[] = {
+ 0x00000000,
+ 0x03300600, 0x03300600, 0x03300600, 0x06601f80, 0x1ff00000, 0x1ff00000,
+ 0x0cc00000, 0x0cc000c0, 0x19800000, 0x198000c0, 0x7fc000c0, 0x7fc000c0,
+ 0x330000c0, 0x660000c0, 0x660030c0, 0x00001f00, 0x00006000, 0x00006000,
+ 0x00006000, 0x00006300, 0x00000000
+};
+static struct raster gallant19_35 = { 12, 22, 1, 1, gallant19_35_pixels, 0 };
+
+static u_int32_t gallant19_36_pixels[] = {
+ 0x00000000,
+ 0x06000600, 0x1f800600, 0x3fc00600, 0x66e00600, 0x66600600, 0x66001f80,
+ 0x3e000000, 0x1f800000, 0x07c00000, 0x06600000, 0x06600000, 0x66606ee0,
+ 0x7fc06660, 0x3f806660, 0x06006660, 0x0000ef70, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_36 = { 12, 22, 1, 1, gallant19_36_pixels, 0 };
+
+static u_int32_t gallant19_37_pixels[] = {
+ 0x00000000,
+ 0x38600000, 0x44c00000, 0x44c00000, 0x458011c0, 0x39806060, 0x03006060,
+ 0x03007040, 0x06001f00, 0x0c000000, 0x0c000000, 0x19c00000, 0x1a200000,
+ 0x32200000, 0x322071c0, 0x61c06060, 0x00006060, 0x00006040, 0x00007f00,
+ 0x00006000, 0x00006000, 0x00000000
+};
+static struct raster gallant19_37 = { 12, 22, 1, 1, gallant19_37_pixels, 0 };
+
+static u_int32_t gallant19_38_pixels[] = {
+ 0x00000000,
+ 0x07000060, 0x0f800060, 0x18c00000, 0x18c00000, 0x18c00000, 0x0f8034c0,
+ 0x1e003000, 0x3e003000, 0x77003000, 0x63607800, 0x61e00000, 0x61c00000,
+ 0x61800000, 0x3fe00000, 0x1e600000, 0x000030c0, 0x00003800, 0x00000780,
+ 0x000020c0, 0x00003f80, 0x00000000
+};
+static struct raster gallant19_38 = { 12, 22, 1, 1, gallant19_38_pixels, 0 };
+
+static u_int32_t gallant19_39_pixels[] = {
+ 0x00000000,
+ 0x0c000c20, 0x1e000780, 0x1e000000, 0x06000000, 0x06000000, 0x0c000000,
+ 0x18000000, 0x100030c0, 0x000030c0, 0x000030c0, 0x000030c0, 0x00001e60,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00006020,
+ 0x00003040, 0x00001880, 0x00000000
+};
+static struct raster gallant19_39 = { 12, 22, 1, 1, gallant19_39_pixels, 0 };
+
+static u_int32_t gallant19_40_pixels[] = {
+ 0x00000000,
+ 0x00c06620, 0x01803b40, 0x03801980, 0x03001980, 0x07000000, 0x06000000,
+ 0x06000000, 0x06000000, 0x06000000, 0x06007040, 0x07001d00, 0x03000700,
+ 0x038011c0, 0x0180f1f0, 0x00c00000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00006020, 0x00000000
+};
+static struct raster gallant19_40 = { 12, 22, 1, 1, gallant19_40_pixels, 0 };
+
+static u_int32_t gallant19_41_pixels[] = {
+ 0x00000000,
+ 0x30000000, 0x180060e0, 0x1c000380, 0x0c000e00, 0x0e003820, 0x06007fe0,
+ 0x06000000, 0x06000000, 0x060001c0, 0x06000300, 0x0e000180, 0x0c000300,
+ 0x1c000300, 0x18000180, 0x30000300, 0x000001c0, 0x00000000, 0x00000000,
+ 0x00000600, 0x00000600, 0x00000000
+};
+static struct raster gallant19_41 = { 12, 22, 1, 1, gallant19_41_pixels, 0 };
+
+static u_int32_t gallant19_42_pixels[] = {
+ 0x00000000,
+ 0x00003800, 0x00000c00, 0x00001800, 0x00000c00, 0x0f000c00, 0x06001800,
+ 0x66600c00, 0x76e03800, 0x19800000, 0x00000000, 0x19800000, 0x76e00000,
+ 0x66600000, 0x06000000, 0x0f001c20, 0x000036c0, 0x00004380, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_42 = { 12, 22, 1, 1, gallant19_42_pixels, 0 };
+
+static u_int32_t gallant19_43_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x06000000,
+ 0x06000000, 0x06000000, 0x06000000, 0x7fe00000, 0x7fe00000, 0x06000000,
+ 0x06000000, 0x06000000, 0x06000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_43 = { 12, 22, 1, 1, gallant19_43_pixels, 0 };
+
+static u_int32_t gallant19_44_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x0c000000, 0x1e000000, 0x1e000000, 0x06000000, 0x06000000, 0x0c000000,
+ 0x18000000, 0x10000000, 0x00000000
+};
+static struct raster gallant19_44 = { 12, 22, 1, 1, gallant19_44_pixels, 0 };
+
+static u_int32_t gallant19_45_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x7fe00000, 0x7fe00000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_45 = { 12, 22, 1, 1, gallant19_45_pixels, 0 };
+
+static u_int32_t gallant19_46_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0c000000,
+ 0x1e000000, 0x1e000000, 0x0c000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_46 = { 12, 22, 1, 1, gallant19_46_pixels, 0 };
+
+static u_int32_t gallant19_47_pixels[] = {
+ 0x00000000,
+ 0x00600000, 0x00c00000, 0x00c00000, 0x01800000, 0x01800000, 0x03000000,
+ 0x03000000, 0x06000000, 0x0c000000, 0x0c000000, 0x18000000, 0x18000000,
+ 0x30000000, 0x30000000, 0x60000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_47 = { 12, 22, 1, 1, gallant19_47_pixels, 0 };
+
+static u_int32_t gallant19_48_pixels[] = {
+ 0x00000000,
+ 0x07000000, 0x0f800000, 0x11800000, 0x10c00000, 0x30c00000, 0x30c00000,
+ 0x30c00000, 0x30c00000, 0x30c00000, 0x30c00000, 0x30c00000, 0x30800000,
+ 0x18800000, 0x1f000000, 0x0e000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_48 = { 12, 22, 1, 1, gallant19_48_pixels, 0 };
+
+static u_int32_t gallant19_49_pixels[] = {
+ 0x00000000,
+ 0x02000000, 0x06000000, 0x0e000000, 0x1e000000, 0x36000000, 0x06000000,
+ 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000,
+ 0x06000000, 0x06000000, 0x3fc00000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_49 = { 12, 22, 1, 1, gallant19_49_pixels, 0 };
+
+static u_int32_t gallant19_50_pixels[] = {
+ 0x00000000,
+ 0x1f000000, 0x3f800000, 0x61c00000, 0x40c00000, 0x00c00000, 0x00c00000,
+ 0x00c00000, 0x01800000, 0x03000000, 0x06000000, 0x0c000000, 0x18000000,
+ 0x30200000, 0x7fe00000, 0x7fe00000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_50 = { 12, 22, 1, 1, gallant19_50_pixels, 0 };
+
+static u_int32_t gallant19_51_pixels[] = {
+ 0x00000000,
+ 0x0f800000, 0x1fc00000, 0x20e00000, 0x40600000, 0x00600000, 0x00e00000,
+ 0x07c00000, 0x0fc00000, 0x00e00000, 0x00600000, 0x00600000, 0x40600000,
+ 0x60400000, 0x3f800000, 0x1f000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_51 = { 12, 22, 1, 1, gallant19_51_pixels, 0 };
+
+static u_int32_t gallant19_52_pixels[] = {
+ 0x00000000,
+ 0x01800000, 0x03800000, 0x03800000, 0x05800000, 0x05800000, 0x09800000,
+ 0x09800000, 0x11800000, 0x11800000, 0x21800000, 0x3fe00000, 0x7fe00000,
+ 0x01800000, 0x01800000, 0x01800000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_52 = { 12, 22, 1, 1, gallant19_52_pixels, 0 };
+
+static u_int32_t gallant19_53_pixels[] = {
+ 0x00000000,
+ 0x0fc00000, 0x0fc00000, 0x10000000, 0x10000000, 0x20000000, 0x3f800000,
+ 0x31c00000, 0x00e00000, 0x00600000, 0x00600000, 0x00600000, 0x40600000,
+ 0x60600000, 0x30c00000, 0x1f800000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_53 = { 12, 22, 1, 1, gallant19_53_pixels, 0 };
+
+static u_int32_t gallant19_54_pixels[] = {
+ 0x00000000,
+ 0x07000000, 0x0c000000, 0x18000000, 0x30000000, 0x30000000, 0x60000000,
+ 0x67800000, 0x6fc00000, 0x70e00000, 0x60600000, 0x60600000, 0x60600000,
+ 0x70400000, 0x3f800000, 0x1f000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_54 = { 12, 22, 1, 1, gallant19_54_pixels, 0 };
+
+static u_int32_t gallant19_55_pixels[] = {
+ 0x00000000,
+ 0x1fe00000, 0x3fe00000, 0x60400000, 0x00400000, 0x00c00000, 0x00800000,
+ 0x00800000, 0x01800000, 0x01000000, 0x01000000, 0x03000000, 0x02000000,
+ 0x02000000, 0x06000000, 0x04000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_55 = { 12, 22, 1, 1, gallant19_55_pixels, 0 };
+
+static u_int32_t gallant19_56_pixels[] = {
+ 0x00000000,
+ 0x0f000000, 0x11800000, 0x30c00000, 0x30c00000, 0x30c00000, 0x18800000,
+ 0x0d000000, 0x06000000, 0x0b000000, 0x11800000, 0x30c00000, 0x30c00000,
+ 0x30c00000, 0x18800000, 0x0f000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_56 = { 12, 22, 1, 1, gallant19_56_pixels, 0 };
+
+static u_int32_t gallant19_57_pixels[] = {
+ 0x00000000,
+ 0x0f800000, 0x11c00000, 0x20e00000, 0x60600000, 0x60600000, 0x60600000,
+ 0x70e00000, 0x3f600000, 0x1e600000, 0x00600000, 0x00c00000, 0x00c00000,
+ 0x01800000, 0x07000000, 0x3c000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_57 = { 12, 22, 1, 1, gallant19_57_pixels, 0 };
+
+static u_int32_t gallant19_58_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0c000000,
+ 0x1e000000, 0x1e000000, 0x0c000000, 0x00000000, 0x00000000, 0x0c000000,
+ 0x1e000000, 0x1e000000, 0x0c000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_58 = { 12, 22, 1, 1, gallant19_58_pixels, 0 };
+
+static u_int32_t gallant19_59_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x0c000000, 0x1e000000, 0x1e000000, 0x0c000000, 0x00000000, 0x00000000,
+ 0x0c000000, 0x1e000000, 0x1e000000, 0x06000000, 0x06000000, 0x0c000000,
+ 0x18000000, 0x10000000, 0x00000000
+};
+static struct raster gallant19_59 = { 12, 22, 1, 1, gallant19_59_pixels, 0 };
+
+static u_int32_t gallant19_60_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00600000,
+ 0x01c00000, 0x07000000, 0x1e000000, 0x78000000, 0x78000000, 0x1e000000,
+ 0x07000000, 0x01c00000, 0x00600000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_60 = { 12, 22, 1, 1, gallant19_60_pixels, 0 };
+
+static u_int32_t gallant19_61_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x7fc00000, 0x7fc00000, 0x00000000, 0x00000000, 0x7fc00000,
+ 0x7fc00000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_61 = { 12, 22, 1, 1, gallant19_61_pixels, 0 };
+
+static u_int32_t gallant19_62_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x60000000,
+ 0x38000000, 0x1e000000, 0x07800000, 0x01e00000, 0x01e00000, 0x07800000,
+ 0x1e000000, 0x38000000, 0x60000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_62 = { 12, 22, 1, 1, gallant19_62_pixels, 0 };
+
+static u_int32_t gallant19_63_pixels[] = {
+ 0x00000000,
+ 0x0f000000, 0x1f800000, 0x39c00000, 0x20c00000, 0x00c00000, 0x00c00000,
+ 0x01800000, 0x03000000, 0x06000000, 0x0c000000, 0x0c000000, 0x00000000,
+ 0x00000000, 0x0c000000, 0x0c000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_63 = { 12, 22, 1, 1, gallant19_63_pixels, 0 };
+
+static u_int32_t gallant19_64_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x0f800000, 0x3fc00000, 0x30600000,
+ 0x60600000, 0x67200000, 0x6fa00000, 0x6ca00000, 0x6ca00000, 0x67e00000,
+ 0x60000000, 0x30000000, 0x3fe00000, 0x0fe00000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_64 = { 12, 22, 1, 1, gallant19_64_pixels, 0 };
+
+static u_int32_t gallant19_65_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x06000000, 0x06000000, 0x0b000000, 0x0b000000, 0x09000000,
+ 0x11800000, 0x11800000, 0x10800000, 0x3fc00000, 0x20c00000, 0x20400000,
+ 0x40600000, 0x40600000, 0xe0f00000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_65 = { 12, 22, 1, 1, gallant19_65_pixels, 0 };
+
+static u_int32_t gallant19_66_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0xff000000, 0x60800000, 0x60c00000, 0x60c00000, 0x60c00000,
+ 0x61800000, 0x7f800000, 0x60c00000, 0x60600000, 0x60600000, 0x60600000,
+ 0x60600000, 0x60c00000, 0xff800000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_66 = { 12, 22, 1, 1, gallant19_66_pixels, 0 };
+
+static u_int32_t gallant19_67_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x0fc00000, 0x10600000, 0x20200000, 0x20000000, 0x60000000,
+ 0x60000000, 0x60000000, 0x60000000, 0x60000000, 0x60000000, 0x20000000,
+ 0x30200000, 0x18400000, 0x0f800000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_67 = { 12, 22, 1, 1, gallant19_67_pixels, 0 };
+
+static u_int32_t gallant19_68_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0xff000000, 0x61c00000, 0x60c00000, 0x60600000, 0x60600000,
+ 0x60600000, 0x60600000, 0x60600000, 0x60600000, 0x60600000, 0x60600000,
+ 0x60400000, 0x61800000, 0xfe000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_68 = { 12, 22, 1, 1, gallant19_68_pixels, 0 };
+
+static u_int32_t gallant19_69_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x7fc00000, 0x30400000, 0x30400000, 0x30000000, 0x30000000,
+ 0x30800000, 0x3f800000, 0x30800000, 0x30000000, 0x30000000, 0x30000000,
+ 0x30200000, 0x30200000, 0x7fe00000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_69 = { 12, 22, 1, 1, gallant19_69_pixels, 0 };
+
+static u_int32_t gallant19_70_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x7fc00000, 0x30400000, 0x30400000, 0x30000000, 0x30000000,
+ 0x30800000, 0x3f800000, 0x30800000, 0x30000000, 0x30000000, 0x30000000,
+ 0x30000000, 0x30000000, 0x78000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_70 = { 12, 22, 1, 1, gallant19_70_pixels, 0 };
+
+static u_int32_t gallant19_71_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x0fc00000, 0x10600000, 0x20200000, 0x20000000, 0x60000000,
+ 0x60000000, 0x60000000, 0x60000000, 0x61f00000, 0x60600000, 0x20600000,
+ 0x30600000, 0x18600000, 0x0f800000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_71 = { 12, 22, 1, 1, gallant19_71_pixels, 0 };
+
+static u_int32_t gallant19_72_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0xf0f00000, 0x60600000, 0x60600000, 0x60600000, 0x60600000,
+ 0x60600000, 0x7fe00000, 0x60600000, 0x60600000, 0x60600000, 0x60600000,
+ 0x60600000, 0x60600000, 0xf0f00000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_72 = { 12, 22, 1, 1, gallant19_72_pixels, 0 };
+
+static u_int32_t gallant19_73_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x1f800000, 0x06000000, 0x06000000, 0x06000000, 0x06000000,
+ 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000,
+ 0x06000000, 0x06000000, 0x1f800000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_73 = { 12, 22, 1, 1, gallant19_73_pixels, 0 };
+
+static u_int32_t gallant19_74_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x1f800000, 0x06000000, 0x06000000, 0x06000000, 0x06000000,
+ 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000,
+ 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x04000000,
+ 0x38000000, 0x30000000, 0x00000000
+};
+static struct raster gallant19_74 = { 12, 22, 1, 1, gallant19_74_pixels, 0 };
+
+static u_int32_t gallant19_75_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0xf0e00000, 0x61800000, 0x63000000, 0x66000000, 0x6c000000,
+ 0x78000000, 0x78000000, 0x7c000000, 0x6e000000, 0x67000000, 0x63800000,
+ 0x61c00000, 0x60e00000, 0xf0700000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_75 = { 12, 22, 1, 1, gallant19_75_pixels, 0 };
+
+static u_int32_t gallant19_76_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x78000000, 0x30000000, 0x30000000, 0x30000000, 0x30000000,
+ 0x30000000, 0x30000000, 0x30000000, 0x30000000, 0x30000000, 0x30000000,
+ 0x30200000, 0x30200000, 0x7fe00000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_76 = { 12, 22, 1, 1, gallant19_76_pixels, 0 };
+
+static u_int32_t gallant19_77_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0xe0700000, 0x60e00000, 0x70e00000, 0x70e00000, 0x70e00000,
+ 0x59600000, 0x59600000, 0x59600000, 0x4d600000, 0x4e600000, 0x4e600000,
+ 0x44600000, 0x44600000, 0xe4f00000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_77 = { 12, 22, 1, 1, gallant19_77_pixels, 0 };
+
+static u_int32_t gallant19_78_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0xc0700000, 0x60200000, 0x70200000, 0x78200000, 0x58200000,
+ 0x4c200000, 0x46200000, 0x47200000, 0x43200000, 0x41a00000, 0x40e00000,
+ 0x40e00000, 0x40600000, 0xe0300000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_78 = { 12, 22, 1, 1, gallant19_78_pixels, 0 };
+
+static u_int32_t gallant19_79_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x0f000000, 0x11c00000, 0x20c00000, 0x20600000, 0x60600000,
+ 0x60600000, 0x60600000, 0x60600000, 0x60600000, 0x60600000, 0x20400000,
+ 0x30400000, 0x18800000, 0x0f000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_79 = { 12, 22, 1, 1, gallant19_79_pixels, 0 };
+
+static u_int32_t gallant19_80_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x7f800000, 0x30c00000, 0x30600000, 0x30600000, 0x30600000,
+ 0x30c00000, 0x37800000, 0x30000000, 0x30000000, 0x30000000, 0x30000000,
+ 0x30000000, 0x30000000, 0x78000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_80 = { 12, 22, 1, 1, gallant19_80_pixels, 0 };
+
+static u_int32_t gallant19_81_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x0f000000, 0x11c00000, 0x20c00000, 0x20600000, 0x60600000,
+ 0x60600000, 0x60600000, 0x60600000, 0x60600000, 0x60600000, 0x30400000,
+ 0x38400000, 0x1f800000, 0x0e000000, 0x1f000000, 0x23900000, 0x01e00000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_81 = { 12, 22, 1, 1, gallant19_81_pixels, 0 };
+
+static u_int32_t gallant19_82_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0xff000000, 0x61800000, 0x60c00000, 0x60c00000, 0x60c00000,
+ 0x60800000, 0x7f000000, 0x7c000000, 0x6e000000, 0x67000000, 0x63800000,
+ 0x61c00000, 0x60e00000, 0xf0700000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_82 = { 12, 22, 1, 1, gallant19_82_pixels, 0 };
+
+static u_int32_t gallant19_83_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x1fe00000, 0x30600000, 0x60200000, 0x60200000, 0x70000000,
+ 0x3c000000, 0x1e000000, 0x07800000, 0x01c00000, 0x00e00000, 0x40600000,
+ 0x40600000, 0x60c00000, 0x7f800000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_83 = { 12, 22, 1, 1, gallant19_83_pixels, 0 };
+
+static u_int32_t gallant19_84_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x7fe00000, 0x46200000, 0x06000000, 0x06000000, 0x06000000,
+ 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000,
+ 0x06000000, 0x06000000, 0x1f800000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_84 = { 12, 22, 1, 1, gallant19_84_pixels, 0 };
+
+static u_int32_t gallant19_85_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0xf0700000, 0x60200000, 0x60200000, 0x60200000, 0x60200000,
+ 0x60200000, 0x60200000, 0x60200000, 0x60200000, 0x60200000, 0x60200000,
+ 0x70400000, 0x3fc00000, 0x1f800000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_85 = { 12, 22, 1, 1, gallant19_85_pixels, 0 };
+
+static u_int32_t gallant19_86_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0xe0e00000, 0x60400000, 0x30800000, 0x30800000, 0x30800000,
+ 0x19000000, 0x19000000, 0x19000000, 0x0c000000, 0x0e000000, 0x0e000000,
+ 0x04000000, 0x04000000, 0x04000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_86 = { 12, 22, 1, 1, gallant19_86_pixels, 0 };
+
+static u_int32_t gallant19_87_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0xfef00000, 0x66200000, 0x66200000, 0x66200000, 0x76200000,
+ 0x77400000, 0x33400000, 0x37400000, 0x3bc00000, 0x3b800000, 0x19800000,
+ 0x19800000, 0x19800000, 0x19800000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_87 = { 12, 22, 1, 1, gallant19_87_pixels, 0 };
+
+static u_int32_t gallant19_88_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0xf0700000, 0x60200000, 0x30400000, 0x38800000, 0x18800000,
+ 0x0d000000, 0x06000000, 0x06000000, 0x0b000000, 0x11800000, 0x11c00000,
+ 0x20c00000, 0x40600000, 0xe0f00000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_88 = { 12, 22, 1, 1, gallant19_88_pixels, 0 };
+
+static u_int32_t gallant19_89_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0xf0700000, 0x60200000, 0x30400000, 0x18800000, 0x18800000,
+ 0x0d000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000,
+ 0x06000000, 0x06000000, 0x0f000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_89 = { 12, 22, 1, 1, gallant19_89_pixels, 0 };
+
+static u_int32_t gallant19_90_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x3fe00000, 0x20c00000, 0x00c00000, 0x01800000, 0x01800000,
+ 0x03000000, 0x03000000, 0x06000000, 0x06000000, 0x0c000000, 0x0c000000,
+ 0x18000000, 0x18200000, 0x3fe00000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_90 = { 12, 22, 1, 1, gallant19_90_pixels, 0 };
+
+static u_int32_t gallant19_91_pixels[] = {
+ 0x00000000,
+ 0x07c00000, 0x07c00000, 0x06000000, 0x06000000, 0x06000000, 0x06000000,
+ 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000,
+ 0x06000000, 0x07c00000, 0x07c00000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_91 = { 12, 22, 1, 1, gallant19_91_pixels, 0 };
+
+static u_int32_t gallant19_92_pixels[] = {
+ 0x00000000,
+ 0x60000000, 0x60000000, 0x30000000, 0x30000000, 0x18000000, 0x18000000,
+ 0x0c000000, 0x0c000000, 0x06000000, 0x03000000, 0x03000000, 0x01800000,
+ 0x01800000, 0x00c00000, 0x00c00000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_92 = { 12, 22, 1, 1, gallant19_92_pixels, 0 };
+
+static u_int32_t gallant19_93_pixels[] = {
+ 0x00000000,
+ 0x7c000000, 0x7c000000, 0x0c000000, 0x0c000000, 0x0c000000, 0x0c000000,
+ 0x0c000000, 0x0c000000, 0x0c000000, 0x0c000000, 0x0c000000, 0x0c000000,
+ 0x0c000000, 0x7c000000, 0x7c000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_93 = { 12, 22, 1, 1, gallant19_93_pixels, 0 };
+
+static u_int32_t gallant19_94_pixels[] = {
+ 0x00000000,
+ 0x04000000, 0x0e000000, 0x1b000000, 0x31800000, 0x60c00000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_94 = { 12, 22, 1, 1, gallant19_94_pixels, 0 };
+
+static u_int32_t gallant19_95_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xfff00000, 0xfff00000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_95 = { 12, 22, 1, 1, gallant19_95_pixels, 0 };
+
+static u_int32_t gallant19_96_pixels[] = {
+ 0x00000000,
+ 0x01000000, 0x03000000, 0x06000000, 0x06000000, 0x07800000, 0x07800000,
+ 0x03000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_96 = { 12, 22, 1, 1, gallant19_96_pixels, 0 };
+
+static u_int32_t gallant19_97_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0f800000,
+ 0x18c00000, 0x10c00000, 0x03c00000, 0x1cc00000, 0x30c00000, 0x30c00000,
+ 0x30c00000, 0x39c00000, 0x1ee00000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_97 = { 12, 22, 1, 1, gallant19_97_pixels, 0 };
+
+static u_int32_t gallant19_98_pixels[] = {
+ 0x00000000,
+ 0x20000000, 0x60000000, 0xe0000000, 0x60000000, 0x60000000, 0x67800000,
+ 0x6fc00000, 0x70e00000, 0x60600000, 0x60600000, 0x60600000, 0x60600000,
+ 0x70600000, 0x78c00000, 0x4f800000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_98 = { 12, 22, 1, 1, gallant19_98_pixels, 0 };
+
+static u_int32_t gallant19_99_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x1f800000,
+ 0x31c00000, 0x20c00000, 0x60000000, 0x60000000, 0x60000000, 0x60000000,
+ 0x70400000, 0x30c00000, 0x1f800000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_99 = { 12, 22, 1, 1, gallant19_99_pixels, 0 };
+
+static u_int32_t gallant19_100_pixels[] = {
+ 0x00000000,
+ 0x00600000, 0x00e00000, 0x00600000, 0x00600000, 0x00600000, 0x0f600000,
+ 0x31e00000, 0x20e00000, 0x60600000, 0x60600000, 0x60600000, 0x60600000,
+ 0x70e00000, 0x39600000, 0x1e700000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_100 = { 12, 22, 1, 1, gallant19_100_pixels, 0 };
+
+static u_int32_t gallant19_101_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0f000000,
+ 0x30c00000, 0x60600000, 0x60600000, 0x7fe00000, 0x60000000, 0x60000000,
+ 0x30000000, 0x18600000, 0x0f800000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_101 = { 12, 22, 1, 1, gallant19_101_pixels, 0 };
+
+static u_int32_t gallant19_102_pixels[] = {
+ 0x00000000,
+ 0x03800000, 0x04c00000, 0x04c00000, 0x0c000000, 0x0c000000, 0x0c000000,
+ 0x0c000000, 0x1f800000, 0x0c000000, 0x0c000000, 0x0c000000, 0x0c000000,
+ 0x0c000000, 0x0c000000, 0x1e000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_102 = { 12, 22, 1, 1, gallant19_102_pixels, 0 };
+
+static u_int32_t gallant19_103_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x1f200000,
+ 0x31e00000, 0x60c00000, 0x60c00000, 0x60c00000, 0x31800000, 0x3f000000,
+ 0x60000000, 0x7fc00000, 0x3fe00000, 0x20600000, 0x40200000, 0x40200000,
+ 0x7fc00000, 0x3f800000, 0x00000000
+};
+static struct raster gallant19_103 = { 12, 22, 1, 1, gallant19_103_pixels, 0 };
+
+static u_int32_t gallant19_104_pixels[] = {
+ 0x00000000,
+ 0x10000000, 0x30000000, 0x70000000, 0x30000000, 0x30000000, 0x37800000,
+ 0x39c00000, 0x30c00000, 0x30c00000, 0x30c00000, 0x30c00000, 0x30c00000,
+ 0x30c00000, 0x30c00000, 0x79e00000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_104 = { 12, 22, 1, 1, gallant19_104_pixels, 0 };
+
+static u_int32_t gallant19_105_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x06000000, 0x06000000, 0x00000000, 0x00000000, 0x1e000000,
+ 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000,
+ 0x06000000, 0x06000000, 0x1f800000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_105 = { 12, 22, 1, 1, gallant19_105_pixels, 0 };
+
+static u_int32_t gallant19_106_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00c00000, 0x00c00000, 0x00000000, 0x00000000, 0x03c00000,
+ 0x00c00000, 0x00c00000, 0x00c00000, 0x00c00000, 0x00c00000, 0x00c00000,
+ 0x00c00000, 0x00c00000, 0x00c00000, 0x20c00000, 0x30c00000, 0x38800000,
+ 0x1f000000, 0x0e000000, 0x00000000
+};
+static struct raster gallant19_106 = { 12, 22, 1, 1, gallant19_106_pixels, 0 };
+
+static u_int32_t gallant19_107_pixels[] = {
+ 0x00000000,
+ 0x60000000, 0xe0000000, 0x60000000, 0x60000000, 0x60000000, 0x61c00000,
+ 0x63000000, 0x66000000, 0x7c000000, 0x78000000, 0x7c000000, 0x6e000000,
+ 0x67000000, 0x63800000, 0xf1e00000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_107 = { 12, 22, 1, 1, gallant19_107_pixels, 0 };
+
+static u_int32_t gallant19_108_pixels[] = {
+ 0x00000000,
+ 0x1e000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000,
+ 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000,
+ 0x06000000, 0x06000000, 0x1f800000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_108 = { 12, 22, 1, 1, gallant19_108_pixels, 0 };
+
+static u_int32_t gallant19_109_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xddc00000,
+ 0x6ee00000, 0x66600000, 0x66600000, 0x66600000, 0x66600000, 0x66600000,
+ 0x66600000, 0x66600000, 0xef700000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_109 = { 12, 22, 1, 1, gallant19_109_pixels, 0 };
+
+static u_int32_t gallant19_110_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x27800000,
+ 0x79c00000, 0x30c00000, 0x30c00000, 0x30c00000, 0x30c00000, 0x30c00000,
+ 0x30c00000, 0x30c00000, 0x79e00000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_110 = { 12, 22, 1, 1, gallant19_110_pixels, 0 };
+
+static u_int32_t gallant19_111_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0f800000,
+ 0x11c00000, 0x20e00000, 0x60600000, 0x60600000, 0x60600000, 0x60600000,
+ 0x70400000, 0x38800000, 0x1f000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_111 = { 12, 22, 1, 1, gallant19_111_pixels, 0 };
+
+static u_int32_t gallant19_112_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xef800000,
+ 0x71c00000, 0x60e00000, 0x60600000, 0x60600000, 0x60600000, 0x60600000,
+ 0x60400000, 0x70800000, 0x7f000000, 0x60000000, 0x60000000, 0x60000000,
+ 0x60000000, 0xf0000000, 0x00000000
+};
+static struct raster gallant19_112 = { 12, 22, 1, 1, gallant19_112_pixels, 0 };
+
+static u_int32_t gallant19_113_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0f200000,
+ 0x11e00000, 0x20e00000, 0x60600000, 0x60600000, 0x60600000, 0x60600000,
+ 0x70600000, 0x38e00000, 0x1fe00000, 0x00600000, 0x00600000, 0x00600000,
+ 0x00600000, 0x00f00000, 0x00000000
+};
+static struct raster gallant19_113 = { 12, 22, 1, 1, gallant19_113_pixels, 0 };
+
+static u_int32_t gallant19_114_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x73800000,
+ 0x34c00000, 0x38c00000, 0x30000000, 0x30000000, 0x30000000, 0x30000000,
+ 0x30000000, 0x30000000, 0x78000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_114 = { 12, 22, 1, 1, gallant19_114_pixels, 0 };
+
+static u_int32_t gallant19_115_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x1fc00000,
+ 0x30c00000, 0x30400000, 0x38000000, 0x1e000000, 0x07800000, 0x01c00000,
+ 0x20c00000, 0x30c00000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_115 = { 12, 22, 1, 1, gallant19_115_pixels, 0 };
+
+static u_int32_t gallant19_116_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x04000000, 0x04000000, 0x0c000000, 0x7fc00000,
+ 0x0c000000, 0x0c000000, 0x0c000000, 0x0c000000, 0x0c000000, 0x0c000000,
+ 0x0c200000, 0x0e400000, 0x07800000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_116 = { 12, 22, 1, 1, gallant19_116_pixels, 0 };
+
+static u_int32_t gallant19_117_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x79e00000,
+ 0x30c00000, 0x30c00000, 0x30c00000, 0x30c00000, 0x30c00000, 0x30c00000,
+ 0x30c00000, 0x39c00000, 0x1e600000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_117 = { 12, 22, 1, 1, gallant19_117_pixels, 0 };
+
+static u_int32_t gallant19_118_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xf0700000,
+ 0x60200000, 0x30400000, 0x30400000, 0x18800000, 0x18800000, 0x0d000000,
+ 0x0d000000, 0x06000000, 0x06000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_118 = { 12, 22, 1, 1, gallant19_118_pixels, 0 };
+
+static u_int32_t gallant19_119_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xff700000,
+ 0x66200000, 0x66200000, 0x66200000, 0x37400000, 0x3b400000, 0x3b400000,
+ 0x19800000, 0x19800000, 0x19800000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_119 = { 12, 22, 1, 1, gallant19_119_pixels, 0 };
+
+static u_int32_t gallant19_120_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xf8f00000,
+ 0x70400000, 0x38800000, 0x1d000000, 0x0e000000, 0x07000000, 0x0b800000,
+ 0x11c00000, 0x20e00000, 0xf1f00000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_120 = { 12, 22, 1, 1, gallant19_120_pixels, 0 };
+
+static u_int32_t gallant19_121_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xf0f00000,
+ 0x60200000, 0x30400000, 0x30400000, 0x18800000, 0x18800000, 0x0d000000,
+ 0x0d000000, 0x06000000, 0x06000000, 0x04000000, 0x0c000000, 0x08000000,
+ 0x78000000, 0x70000000, 0x00000000
+};
+static struct raster gallant19_121 = { 12, 22, 1, 1, gallant19_121_pixels, 0 };
+
+static u_int32_t gallant19_122_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x7fe00000,
+ 0x60e00000, 0x41c00000, 0x03800000, 0x07000000, 0x0e000000, 0x1c000000,
+ 0x38200000, 0x70600000, 0x7fe00000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_122 = { 12, 22, 1, 1, gallant19_122_pixels, 0 };
+
+static u_int32_t gallant19_123_pixels[] = {
+ 0x00000000,
+ 0x01c00000, 0x03000000, 0x03000000, 0x01800000, 0x01800000, 0x01800000,
+ 0x03000000, 0x07000000, 0x03000000, 0x01800000, 0x01800000, 0x01800000,
+ 0x03000000, 0x03000000, 0x01c00000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_123 = { 12, 22, 1, 1, gallant19_123_pixels, 0 };
+
+static u_int32_t gallant19_124_pixels[] = {
+ 0x00000000,
+ 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000,
+ 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000,
+ 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000,
+ 0x06000000, 0x06000000, 0x00000000
+};
+static struct raster gallant19_124 = { 12, 22, 1, 1, gallant19_124_pixels, 0 };
+
+static u_int32_t gallant19_125_pixels[] = {
+ 0x00000000,
+ 0x38000000, 0x0c000000, 0x0c000000, 0x18000000, 0x18000000, 0x18000000,
+ 0x0c000000, 0x0e000000, 0x0c000000, 0x18000000, 0x18000000, 0x18000000,
+ 0x0c000000, 0x0c000000, 0x38000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_125 = { 12, 22, 1, 1, gallant19_125_pixels, 0 };
+
+static u_int32_t gallant19_126_pixels[] = {
+ 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x1c200000, 0x3e600000, 0x36c00000, 0x67c00000,
+ 0x43800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000
+};
+static struct raster gallant19_126 = { 12, 22, 1, 1, gallant19_126_pixels, 0 };
+
+#define null2 {0}, {0}
+#define null4 null2, null2
+#define null8 null4, null4
+#define null16 null8, null8
+#define null32 null16, null16
+#define null64 null32, null32
+#define null128 null64, null64
+
+struct raster_font gallant19 = {
+ 12, 22, 15, RASFONT_FIXEDWIDTH|RASFONT_NOVERTICALMOVEMENT,
+ {
+ null32,
+ { &gallant19_32, 0, -15, 12, 0 },
+ { &gallant19_33, 0, -15, 12, 0 },
+ { &gallant19_34, 0, -15, 12, 0 },
+ { &gallant19_35, 0, -15, 12, 0 },
+ { &gallant19_36, 0, -15, 12, 0 },
+ { &gallant19_37, 0, -15, 12, 0 },
+ { &gallant19_38, 0, -15, 12, 0 },
+ { &gallant19_39, 0, -15, 12, 0 },
+ { &gallant19_40, 0, -15, 12, 0 },
+ { &gallant19_41, 0, -15, 12, 0 },
+ { &gallant19_42, 0, -15, 12, 0 },
+ { &gallant19_43, 0, -15, 12, 0 },
+ { &gallant19_44, 0, -15, 12, 0 },
+ { &gallant19_45, 0, -15, 12, 0 },
+ { &gallant19_46, 0, -15, 12, 0 },
+ { &gallant19_47, 0, -15, 12, 0 },
+ { &gallant19_48, 0, -15, 12, 0 },
+ { &gallant19_49, 0, -15, 12, 0 },
+ { &gallant19_50, 0, -15, 12, 0 },
+ { &gallant19_51, 0, -15, 12, 0 },
+ { &gallant19_52, 0, -15, 12, 0 },
+ { &gallant19_53, 0, -15, 12, 0 },
+ { &gallant19_54, 0, -15, 12, 0 },
+ { &gallant19_55, 0, -15, 12, 0 },
+ { &gallant19_56, 0, -15, 12, 0 },
+ { &gallant19_57, 0, -15, 12, 0 },
+ { &gallant19_58, 0, -15, 12, 0 },
+ { &gallant19_59, 0, -15, 12, 0 },
+ { &gallant19_60, 0, -15, 12, 0 },
+ { &gallant19_61, 0, -15, 12, 0 },
+ { &gallant19_62, 0, -15, 12, 0 },
+ { &gallant19_63, 0, -15, 12, 0 },
+ { &gallant19_64, 0, -15, 12, 0 },
+ { &gallant19_65, 0, -15, 12, 0 },
+ { &gallant19_66, 0, -15, 12, 0 },
+ { &gallant19_67, 0, -15, 12, 0 },
+ { &gallant19_68, 0, -15, 12, 0 },
+ { &gallant19_69, 0, -15, 12, 0 },
+ { &gallant19_70, 0, -15, 12, 0 },
+ { &gallant19_71, 0, -15, 12, 0 },
+ { &gallant19_72, 0, -15, 12, 0 },
+ { &gallant19_73, 0, -15, 12, 0 },
+ { &gallant19_74, 0, -15, 12, 0 },
+ { &gallant19_75, 0, -15, 12, 0 },
+ { &gallant19_76, 0, -15, 12, 0 },
+ { &gallant19_77, 0, -15, 12, 0 },
+ { &gallant19_78, 0, -15, 12, 0 },
+ { &gallant19_79, 0, -15, 12, 0 },
+ { &gallant19_80, 0, -15, 12, 0 },
+ { &gallant19_81, 0, -15, 12, 0 },
+ { &gallant19_82, 0, -15, 12, 0 },
+ { &gallant19_83, 0, -15, 12, 0 },
+ { &gallant19_84, 0, -15, 12, 0 },
+ { &gallant19_85, 0, -15, 12, 0 },
+ { &gallant19_86, 0, -15, 12, 0 },
+ { &gallant19_87, 0, -15, 12, 0 },
+ { &gallant19_88, 0, -15, 12, 0 },
+ { &gallant19_89, 0, -15, 12, 0 },
+ { &gallant19_90, 0, -15, 12, 0 },
+ { &gallant19_91, 0, -15, 12, 0 },
+ { &gallant19_92, 0, -15, 12, 0 },
+ { &gallant19_93, 0, -15, 12, 0 },
+ { &gallant19_94, 0, -15, 12, 0 },
+ { &gallant19_95, 0, -15, 12, 0 },
+ { &gallant19_96, 0, -15, 12, 0 },
+ { &gallant19_97, 0, -15, 12, 0 },
+ { &gallant19_98, 0, -15, 12, 0 },
+ { &gallant19_99, 0, -15, 12, 0 },
+ { &gallant19_100, 0, -15, 12, 0 },
+ { &gallant19_101, 0, -15, 12, 0 },
+ { &gallant19_102, 0, -15, 12, 0 },
+ { &gallant19_103, 0, -15, 12, 0 },
+ { &gallant19_104, 0, -15, 12, 0 },
+ { &gallant19_105, 0, -15, 12, 0 },
+ { &gallant19_106, 0, -15, 12, 0 },
+ { &gallant19_107, 0, -15, 12, 0 },
+ { &gallant19_108, 0, -15, 12, 0 },
+ { &gallant19_109, 0, -15, 12, 0 },
+ { &gallant19_110, 0, -15, 12, 0 },
+ { &gallant19_111, 0, -15, 12, 0 },
+ { &gallant19_112, 0, -15, 12, 0 },
+ { &gallant19_113, 0, -15, 12, 0 },
+ { &gallant19_114, 0, -15, 12, 0 },
+ { &gallant19_115, 0, -15, 12, 0 },
+ { &gallant19_116, 0, -15, 12, 0 },
+ { &gallant19_117, 0, -15, 12, 0 },
+ { &gallant19_118, 0, -15, 12, 0 },
+ { &gallant19_119, 0, -15, 12, 0 },
+ { &gallant19_120, 0, -15, 12, 0 },
+ { &gallant19_121, 0, -15, 12, 0 },
+ { &gallant19_122, 0, -15, 12, 0 },
+ { &gallant19_123, 0, -15, 12, 0 },
+ { &gallant19_124, 0, -15, 12, 0 },
+ { &gallant19_125, 0, -15, 12, 0 },
+ { &gallant19_126, 0, -15, 12, 0 },
+ { 0 },
+ null128
+ },
+#ifdef COLORFONT_CACHE
+ (struct raster_fontcache*) -1
+#endif /*COLORFONT_CACHE*/
+};
diff --git a/sys/dev/wscons/wscons_rinit.c b/sys/dev/wscons/wscons_rinit.c
new file mode 100644
index 00000000000..7b7348a3746
--- /dev/null
+++ b/sys/dev/wscons/wscons_rinit.c
@@ -0,0 +1,134 @@
+/* $NetBSD: wscons_rinit.c,v 1.1 1996/04/12 02:00:54 cgd Exp $ */
+
+/*
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Lawrence Berkeley Laboratory.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)rcons_font.c 8.1 (Berkeley) 6/11/93
+ */
+
+#include <sys/param.h>
+#include <sys/kernel.h>
+#include <sys/device.h>
+
+#include <dev/rcons/raster.h>
+#include <alpha/wscons/wscons_raster.h>
+
+#include <alpha/wscons/wscons_rfont.h>
+
+void
+rcons_initfont(rc, fp)
+ struct rcons *rc;
+ struct raster_font *fp;
+{
+ static int initfontdone;
+
+ rc->rc_font = fp;
+
+ /* Get distance to top and bottom of font from font origin */
+ rc->rc_font_ascent = -(rc->rc_font->chars)['a'].homey;
+
+#if !defined(MSBYTE_FIRST) && !defined(MSBIT_FIRST) /* XXX other cases */
+ /* swap byte order on font data. ick. */
+ if (!initfontdone) {
+ int ch, i, n, bit;
+ u_int32_t *pix, npix;
+
+ for (ch = 0; ch < 256; ch++) {
+ if (rc->rc_font->chars[ch].r == 0)
+ continue;
+
+ n = rc->rc_font->chars[ch].r->linelongs *
+ rc->rc_font->chars[ch].r->height;
+ pix = rc->rc_font->chars[ch].r->pixels;
+
+ for (i = 0; i < n; i++) {
+ npix = 0;
+ for (bit = 0; bit < 32; bit++)
+ if (pix[i] & (1 << bit))
+ npix |= (1 << (31 - bit));
+ pix[i] = npix;
+ }
+ }
+ }
+#endif
+
+ initfontdone = 1;
+}
+
+void
+rcons_init(rc, mrow, mcol)
+ struct rcons *rc;
+ int mrow, mcol;
+{
+ struct raster *rp = rc->rc_sp;
+ int i;
+
+ rcons_initfont(rc, &gallant19);
+
+ i = rp->height / rc->rc_font->height;
+ rc->rc_maxrow = min(i, mrow);
+
+ i = rp->width / rc->rc_font->width;
+ rc->rc_maxcol = min(i, mcol);
+
+ /* Center emulator screen (but align x origin to 32 bits) */
+ rc->rc_xorigin =
+ ((rp->width - rc->rc_maxcol * rc->rc_font->width) / 2) & ~0x1f;
+ rc->rc_yorigin =
+ (rp->height - rc->rc_maxrow * rc->rc_font->height) / 2;
+
+ /* Raster width used for row copies */
+ rc->rc_raswidth = rc->rc_maxcol * rc->rc_font->width;
+ if (rc->rc_raswidth & 0x1f) {
+ /* Pad to 32 bits */
+ i = (rc->rc_raswidth + 0x1f) & ~0x1f;
+ /* Make sure width isn't too wide */
+ if (rc->rc_xorigin + i <= rp->width)
+ rc->rc_raswidth = i;
+ }
+
+ rc->rc_ras_blank = RAS_CLEAR;
+ rc->rc_bits = 0;
+
+ /* If cursor position given, assume it's there and drawn. */
+ if (*rc->rc_crowp != -1 && *rc->rc_ccolp != -1)
+ rc->rc_bits |= RC_CURSOR;
+}
diff --git a/sys/dev/wscons/wscons_rops.c b/sys/dev/wscons/wscons_rops.c
new file mode 100644
index 00000000000..f571bf184d3
--- /dev/null
+++ b/sys/dev/wscons/wscons_rops.c
@@ -0,0 +1,217 @@
+/* $NetBSD: wscons_rops.c,v 1.1 1996/04/12 02:00:55 cgd Exp $ */
+
+/*
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Lawrence Berkeley Laboratory.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)rcons_subr.c 8.1 (Berkeley) 6/11/93
+ */
+
+#include <sys/param.h>
+#include <sys/device.h>
+
+#include <dev/rcons/raster.h>
+#include <alpha/wscons/wscons_raster.h>
+
+/*
+ * Paint (or unpaint) the cursor.
+ * Pays no lip service to hardware cursors.
+ */
+void
+rcons_cursor(id, on, row, col)
+ void *id;
+ int on, row, col;
+{
+ register struct rcons *rc = id;
+ register int x, y;
+
+ /* turn the cursor off */
+ if (!on) {
+ /* make sure it's on */
+ if ((rc->rc_bits & RC_CURSOR) == 0)
+ return;
+
+ row = *rc->rc_crowp;
+ col = *rc->rc_ccolp;
+ } else {
+ /* unpaint the old copy. */
+ *rc->rc_crowp = row;
+ *rc->rc_ccolp = col;
+ }
+
+ x = col * rc->rc_font->width + rc->rc_xorigin;
+ y = row * rc->rc_font->height + rc->rc_yorigin;
+
+ raster_op(rc->rc_sp, x, y,
+#ifdef notdef
+ /* XXX This is the right way but too slow */
+ rc->rc_font->chars[(int)' '].r->width,
+ rc->rc_font->chars[(int)' '].r->height,
+#else
+ rc->rc_font->width, rc->rc_font->height,
+#endif
+ RAS_INVERT,
+ (struct raster *) 0, 0, 0);
+
+ rc->rc_bits ^= RC_CURSOR;
+}
+
+/*
+ * Actually write a string to the frame buffer.
+ */
+void
+rcons_putstr(id, row, col, str, n)
+ void *id;
+ int row, col, n;
+ char *str;
+{
+ struct rcons *rc = id;
+ register int x, y, op;
+
+ x = col * rc->rc_font->width + rc->rc_xorigin;
+ y = row * rc->rc_font->height + rc->rc_font_ascent + rc->rc_yorigin;
+
+ op = RAS_SRC;
+ if (((rc->rc_bits & RC_STANDOUT) != 0) ^
+ ((rc->rc_bits & RC_INVERT) != 0))
+ op = RAS_NOT(op);
+ raster_textn(rc->rc_sp, x, y, op, rc->rc_font, str, n);
+}
+
+/*
+ * Possibly change to white-on-black or black-on-white modes.
+ */
+void
+rcons_invert(id, inverted)
+ void *id;
+ int inverted;
+{
+ struct rcons *rc = id;
+
+ if (((rc->rc_bits & RC_INVERT) != 0) ^ inverted) {
+ /* Invert the display */
+ raster_op(rc->rc_sp, 0, 0, rc->rc_sp->width, rc->rc_sp->height,
+ RAS_INVERT, (struct raster *) 0, 0, 0);
+
+ /* Swap things around */
+ rc->rc_ras_blank = RAS_NOT(rc->rc_ras_blank);
+ rc->rc_bits ^= RC_INVERT;
+ }
+}
+
+/*
+ * Copy columns (characters) in a row (line).
+ */
+void
+rcons_copycols(id, row, srccol, dstcol, ncols)
+ void *id;
+ int row, srccol, dstcol, ncols;
+{
+ struct rcons *rc = id;
+ int y, srcx, dstx, nx;
+
+ y = rc->rc_yorigin + rc->rc_font->height * row;
+ srcx = rc->rc_xorigin + rc->rc_font->width * srccol;
+ dstx = rc->rc_xorigin + rc->rc_font->width * dstcol;
+ nx = rc->rc_font->width * ncols;
+
+ raster_op(rc->rc_sp, dstx, y,
+ nx, rc->rc_font->height, RAS_SRC,
+ rc->rc_sp, srcx, y);
+}
+
+/*
+ * Clear columns (characters) in a row (line).
+ */
+void
+rcons_erasecols(id, row, startcol, ncols)
+ void *id;
+ int row, startcol, ncols;
+{
+ struct rcons *rc = id;
+ int y, startx, nx;
+
+ y = rc->rc_yorigin + rc->rc_font->height * row;
+ startx = rc->rc_xorigin + rc->rc_font->width * startcol;
+ nx = rc->rc_font->width * ncols;
+
+ raster_op(rc->rc_sp, startx, y,
+ nx, rc->rc_font->height, rc->rc_ras_blank,
+ (struct raster *) 0, 0, 0);
+}
+
+/*
+ * Copy rows (lines).
+ */
+void
+rcons_copyrows(id, srcrow, dstrow, nrows)
+ void *id;
+ int srcrow, dstrow, nrows;
+{
+ struct rcons *rc = id;
+ int srcy, dsty, ny;
+
+ srcy = rc->rc_yorigin + rc->rc_font->height * srcrow;
+ dsty = rc->rc_yorigin + rc->rc_font->height * dstrow;
+ ny = rc->rc_font->height * nrows;
+
+ raster_op(rc->rc_sp, rc->rc_xorigin, dsty,
+ rc->rc_raswidth, ny, RAS_SRC,
+ rc->rc_sp, rc->rc_xorigin, srcy);
+}
+
+/*
+ * Erase rows (lines).
+ */
+void
+rcons_eraserows(id, startrow, nrows)
+ void *id;
+ int startrow, nrows;
+{
+ struct rcons *rc = id;
+ int starty, ny;
+
+ starty = rc->rc_yorigin + rc->rc_font->height * startrow;
+ ny = rc->rc_font->height * nrows;
+
+ raster_op(rc->rc_sp, rc->rc_xorigin, starty,
+ rc->rc_raswidth, ny, rc->rc_ras_blank,
+ (struct raster *) 0, 0, 0);
+}
diff --git a/sys/dev/wscons/wsconsvar.h b/sys/dev/wscons/wsconsvar.h
new file mode 100644
index 00000000000..433480d52ea
--- /dev/null
+++ b/sys/dev/wscons/wsconsvar.h
@@ -0,0 +1,111 @@
+/* $NetBSD: wsconsvar.h,v 1.2 1996/04/12 06:10:36 cgd Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#ifndef _ALPHA_WSCONS_WSCONSVAR_H_
+#define _ALPHA_WSCONS_WSCONSVAR_H_
+
+struct device;
+
+typedef int (*wscons_ioctl_t) __P((struct device *dev, u_long cmd,
+ caddr_t data, int flag, struct proc *p));
+typedef int (*wscons_mmap_t) __P((struct device *dev, off_t off,
+ int prot));
+
+struct wscons_emulfuncs {
+ void (*wef_cursor) __P((void *c, int on, int row, int col));
+ void (*wef_putstr) __P((void *c, int row, int col, char *cp,
+ int n));
+
+ void (*wef_copycols) __P((void *c, int row, int srccol, int dstcol,
+ int ncols));
+ void (*wef_erasecols) __P((void *c, int row, int startcol,
+ int ncols));
+
+ void (*wef_copyrows) __P((void *c, int srcrow, int dstrow,
+ int nrows));
+ void (*wef_eraserows) __P((void *c, int row, int nrows));
+};
+
+struct wscons_odev_spec {
+ const struct wscons_emulfuncs *wo_ef; /* emulation functions */
+ void *wo_efa; /* emulation function cookie */
+
+ int wo_nrows, wo_ncols; /* number of rows & cols */
+ int wo_crow, wo_ccol; /* current row & col */
+
+ wscons_ioctl_t wo_ioctl;
+ wscons_mmap_t wo_mmap;
+};
+
+struct wsconsio_bell_data;
+
+struct wscons_idev_spec {
+ int (*wi_getc) __P((struct device *c));
+ void (*wi_pollc) __P((struct device *c, int on));
+ void (*wi_bell) __P((struct device *c, struct wsconsio_bell_data *));
+ wscons_ioctl_t wi_ioctl;
+ char *(*wi_translate) __P((struct device *c, int code));
+ int wi_keymask; /* keyboard code mask */
+ int wi_keyupmask; /* key went up (vs. down) */
+};
+
+struct wscons_mdev_spec {
+ int (*wm_enable) __P((struct device *));
+ int (*wm_disable) __P((struct device *));
+};
+
+struct wscons_attach_args { /* attaches output device */
+ int waa_isconsole; /* is it the console unit? */
+ struct wscons_odev_spec waa_odev_spec; /* mostly ignored if cons. */
+};
+
+#define wsconscf_console cf_loc[0] /* spec'd to be console? */
+
+/*
+ * Attach the console output device. This is called _very_ early
+ * on in the boot process.
+ */
+void wscons_attach_console __P((const struct wscons_odev_spec *));
+
+/*
+ * Attach the console input device. At this point, it's assumed
+ * that there can be only one. This happens after the input device
+ * has been probed. (XXX boot -d won't work...)
+ */
+void wscons_attach_input __P((struct device *,
+ const struct wscons_idev_spec *));
+
+/*
+ * Transfer a string of characters from the console input device to
+ * the wscons buffer. (XXX raw scancodes? pass ioctl, or something?
+ * then need length.)
+ */
+void wscons_input __P((char *));
+
+#endif /* _ALPHA_WSCONS_WSCONSVAR_H_ */