More merge.

(1) Remove mk30line (moved to /usr/sbin, but not in our source tree yet)

(2) Delete unneeded (well, harmful now :) code to prohibit #including
    of isa_device.h from PC98 sources.

(3) Remove files now equal to their ISA/PC-AT counterparts.

Submitted by:	The FreeBSD(98) Development Team
This commit is contained in:
Satoshi Asami 1996-09-04 09:52:31 +00:00
parent a7d542e842
commit 30cb1d45ae
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=18029
13 changed files with 466 additions and 2419 deletions

View file

@ -2,7 +2,7 @@
# files marked standard are always included.
#
# modified for PC-9801 after:
# $Id: files.pc98,v 1.3 1996/08/31 15:06:30 asami Exp $
# $Id: files.pc98,v 1.4 1996/09/03 10:23:12 asami Exp $
#
aic7xxx_asm optional ahc device-driver \
dependency "$S/dev/aic7xxx/aic7xxx_asm.c" \
@ -29,7 +29,7 @@ linux_assym.h optional compat_linux \
clean "linux_assym.h"
#
i386/scsi/93cx6.c optional ahc device-driver
pc98/apm/apm.c optional apm device-driver
i386/apm/apm.c optional apm device-driver
i386/apm/apm_setup.s optional apm
#i386/eisa/3c5x9.c optional ep device-driver
#i386/eisa/aic7770.c optional ahc device-driver
@ -131,8 +131,8 @@ pc98/pc98/npx.c optional npx device-driver
pc98/pc98/pcaudio.c optional pca device-driver
pc98/pc98/matcd/matcd.c optional matcd device-driver
pc98/pc98/pcibus.c optional pci device-driver
pc98/pc98/pcicx.c optional ze device-driver
pc98/pc98/pcicx.c optional zp device-driver
i386/isa/pcicx.c optional ze device-driver
i386/isa/pcicx.c optional zp device-driver
pc98/isa/pcvt/pcvt_drv.c optional vt device-driver
pc98/isa/pcvt/pcvt_ext.c optional vt device-driver
pc98/isa/pcvt/pcvt_kbd.c optional vt device-driver
@ -145,7 +145,7 @@ pc98/isa/qcam.c optional qcam device-driver
pc98/isa/qcamio.c optional qcam device-driver
pc98/pc98/random_machdep.c standard
pc98/isa/rc.c optional rc device-driver
pc98/pc98/scd.c optional scd device-driver
i386/isa/scd.c optional scd device-driver
pc98/isa/seagate.c optional sea device-driver
pc98/isa/si.c optional si device-driver
pc98/isa/si_code.c optional si device-driver

View file

@ -31,13 +31,9 @@
* SUCH DAMAGE.
*
* from: @(#)isa_device.h 7.1 (Berkeley) 5/9/91
* $Id: isa_device.h,v 1.29 1996/04/08 19:38:57 smpatel Exp $
* $Id: isa_device.h,v 1.30 1996/06/14 11:01:19 asami Exp $
*/
#ifdef PC98
#error isa_device.h is included from PC-9801 source
#endif
#ifndef _I386_ISA_ISA_DEVICE_H_
#define _I386_ISA_ISA_DEVICE_H_

View file

@ -2,7 +2,7 @@
# files marked standard are always included.
#
# modified for PC-9801 after:
# $Id: files.pc98,v 1.3 1996/08/31 15:06:30 asami Exp $
# $Id: files.pc98,v 1.4 1996/09/03 10:23:12 asami Exp $
#
aic7xxx_asm optional ahc device-driver \
dependency "$S/dev/aic7xxx/aic7xxx_asm.c" \
@ -29,7 +29,7 @@ linux_assym.h optional compat_linux \
clean "linux_assym.h"
#
i386/scsi/93cx6.c optional ahc device-driver
pc98/apm/apm.c optional apm device-driver
i386/apm/apm.c optional apm device-driver
i386/apm/apm_setup.s optional apm
#i386/eisa/3c5x9.c optional ep device-driver
#i386/eisa/aic7770.c optional ahc device-driver
@ -131,8 +131,8 @@ pc98/pc98/npx.c optional npx device-driver
pc98/pc98/pcaudio.c optional pca device-driver
pc98/pc98/matcd/matcd.c optional matcd device-driver
pc98/pc98/pcibus.c optional pci device-driver
pc98/pc98/pcicx.c optional ze device-driver
pc98/pc98/pcicx.c optional zp device-driver
i386/isa/pcicx.c optional ze device-driver
i386/isa/pcicx.c optional zp device-driver
pc98/isa/pcvt/pcvt_drv.c optional vt device-driver
pc98/isa/pcvt/pcvt_ext.c optional vt device-driver
pc98/isa/pcvt/pcvt_kbd.c optional vt device-driver
@ -145,7 +145,7 @@ pc98/isa/qcam.c optional qcam device-driver
pc98/isa/qcamio.c optional qcam device-driver
pc98/pc98/random_machdep.c standard
pc98/isa/rc.c optional rc device-driver
pc98/pc98/scd.c optional scd device-driver
i386/isa/scd.c optional scd device-driver
pc98/isa/seagate.c optional sea device-driver
pc98/isa/si.c optional si device-driver
pc98/isa/si_code.c optional si device-driver

View file

@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
* $Id: machdep.c,v 1.3 1996/08/30 10:42:53 asami Exp $
* $Id: machdep.c,v 1.4 1996/09/03 10:23:16 asami Exp $
*/
#include "npx.h"
@ -1114,39 +1114,63 @@ init386(first)
biosextmem = rtcin(RTC_EXTLO)+ (rtcin(RTC_EXTHI)<<8);
/*
* Print a warning and set it to the safest value if the official
* BIOS interface (bootblock supplied) disagrees with the
* hackish interface used above. Eventually only the official
* interface should be used. This is necessary for some machines
* who 'steal' memory from the basemem for use as BIOS memory.
* If BIOS tells us that it has more than 640k in the basemem,
* don't believe it - set it to 640k.
*/
if (biosbasemem > 640) {
printf("Preposterous RTC basemem of %dK, truncating to 640K\n",
biosbasemem);
biosbasemem = 640;
}
if (bootinfo.bi_memsizes_valid && bootinfo.bi_basemem > 640) {
printf("Preposterous BIOS basemem of %dK, truncating to 640K\n",
bootinfo.bi_basemem);
bootinfo.bi_basemem = 640;
}
/*
* Warn if the official BIOS interface disagrees with the RTC
* interface used above about the amount of base memory or the
* amount of extended memory. Prefer the BIOS value for the base
* memory. This is necessary for machines that `steal' base
* memory for use as BIOS memory, at least if we are going to use
* the BIOS for apm. Prefer the RTC value for extended memory.
* Eventually the hackish interface shouldn't even be looked at.
*/
if (bootinfo.bi_memsizes_valid) {
if (bootinfo.bi_basemem != biosbasemem) {
vm_offset_t pa, va, tmpva;
vm_size_t size;
unsigned *pte;
vm_offset_t pa;
printf("BIOS basemem (%ldK) != RTC basemem (%dK), ",
bootinfo.bi_basemem, biosbasemem);
printf("setting to BIOS value.\n");
printf(
"BIOS basemem (%ldK) != RTC basemem (%dK), setting to BIOS value\n",
biosbasemem = bootinfo.bi_basemem;
/*
* XXX - Map this 'hole' of memory in the same manner
* as the ISA_HOLE (read/write/non-cacheable), since
* the BIOS 'fudges' it to become part of the ISA_HOLE.
* XXX if biosbasemem is now < 640, there is `hole'
* between the end of base memory and the start of
* ISA memory. The hole may be empty or it may
* contain BIOS code or data. Map it read/write so
* that the BIOS can write to it. (Memory from 0 to
* the physical end of the kernel is mapped read-only
* to begin with and then parts of it are remapped.
* The parts that aren't remapped form holes that
* remain read-only and are unused by the kernel.
* The base memory area is below the physical end of
* the kernel and right now forms a read-only hole.
* The part of it from 0 to
* (trunc_page(biosbasemem * 1024) - 1) will be
* remapped and used by the kernel later.)
*
* This code is similar to the code used in
* pmap_mapdev, but since no memory needs to be
* allocated we simply change the mapping.
*/
pa = biosbasemem * 1024;
va = pa + KERNBASE;
size = roundup(ISA_HOLE_START - pa, PAGE_SIZE);
for (tmpva = va; size > 0;) {
pte = (unsigned *)vtopte(tmpva);
*pte = pa | PG_RW | PG_V | PG_N;
size -= PAGE_SIZE;
tmpva += PAGE_SIZE;
pa += PAGE_SIZE;
for (pa = trunc_page(biosbasemem * 1024);
pa < ISA_HOLE_START; pa += PAGE_SIZE) {
unsigned *pte;
pte = (unsigned *)vtopte(pa + KERNBASE);
*pte = pa | PG_RW | PG_V;
}
}
if (bootinfo.bi_extmem != biosextmem)
@ -1155,13 +1179,6 @@ init386(first)
}
#endif
/*
* If BIOS tells us that it has more than 640k in the basemem,
* don't believe it - set it to 640k.
*/
if (biosbasemem > 640)
biosbasemem = 640;
/*
* Some 386 machines might give us a bogus number for extended
* mem. If this happens, stop now.

View file

@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)trap.c 7.4 (Berkeley) 5/13/91
* $Id: trap.c,v 1.3 1996/08/30 10:42:54 asami Exp $
* $Id: trap.c,v 1.4 1996/09/03 10:23:17 asami Exp $
*/
/*
@ -165,7 +165,7 @@ userret(p, frame, oticks)
* mi_switch()'ed, we might not be on the queue indicated by
* our priority.
*/
s = splclock();
s = splhigh();
setrunqueue(p);
p->p_stats->p_ru.ru_nivcsw++;
mi_switch();

View file

@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
* $Id: machdep.c,v 1.3 1996/08/30 10:42:53 asami Exp $
* $Id: machdep.c,v 1.4 1996/09/03 10:23:16 asami Exp $
*/
#include "npx.h"
@ -1114,39 +1114,63 @@ init386(first)
biosextmem = rtcin(RTC_EXTLO)+ (rtcin(RTC_EXTHI)<<8);
/*
* Print a warning and set it to the safest value if the official
* BIOS interface (bootblock supplied) disagrees with the
* hackish interface used above. Eventually only the official
* interface should be used. This is necessary for some machines
* who 'steal' memory from the basemem for use as BIOS memory.
* If BIOS tells us that it has more than 640k in the basemem,
* don't believe it - set it to 640k.
*/
if (biosbasemem > 640) {
printf("Preposterous RTC basemem of %dK, truncating to 640K\n",
biosbasemem);
biosbasemem = 640;
}
if (bootinfo.bi_memsizes_valid && bootinfo.bi_basemem > 640) {
printf("Preposterous BIOS basemem of %dK, truncating to 640K\n",
bootinfo.bi_basemem);
bootinfo.bi_basemem = 640;
}
/*
* Warn if the official BIOS interface disagrees with the RTC
* interface used above about the amount of base memory or the
* amount of extended memory. Prefer the BIOS value for the base
* memory. This is necessary for machines that `steal' base
* memory for use as BIOS memory, at least if we are going to use
* the BIOS for apm. Prefer the RTC value for extended memory.
* Eventually the hackish interface shouldn't even be looked at.
*/
if (bootinfo.bi_memsizes_valid) {
if (bootinfo.bi_basemem != biosbasemem) {
vm_offset_t pa, va, tmpva;
vm_size_t size;
unsigned *pte;
vm_offset_t pa;
printf("BIOS basemem (%ldK) != RTC basemem (%dK), ",
bootinfo.bi_basemem, biosbasemem);
printf("setting to BIOS value.\n");
printf(
"BIOS basemem (%ldK) != RTC basemem (%dK), setting to BIOS value\n",
biosbasemem = bootinfo.bi_basemem;
/*
* XXX - Map this 'hole' of memory in the same manner
* as the ISA_HOLE (read/write/non-cacheable), since
* the BIOS 'fudges' it to become part of the ISA_HOLE.
* XXX if biosbasemem is now < 640, there is `hole'
* between the end of base memory and the start of
* ISA memory. The hole may be empty or it may
* contain BIOS code or data. Map it read/write so
* that the BIOS can write to it. (Memory from 0 to
* the physical end of the kernel is mapped read-only
* to begin with and then parts of it are remapped.
* The parts that aren't remapped form holes that
* remain read-only and are unused by the kernel.
* The base memory area is below the physical end of
* the kernel and right now forms a read-only hole.
* The part of it from 0 to
* (trunc_page(biosbasemem * 1024) - 1) will be
* remapped and used by the kernel later.)
*
* This code is similar to the code used in
* pmap_mapdev, but since no memory needs to be
* allocated we simply change the mapping.
*/
pa = biosbasemem * 1024;
va = pa + KERNBASE;
size = roundup(ISA_HOLE_START - pa, PAGE_SIZE);
for (tmpva = va; size > 0;) {
pte = (unsigned *)vtopte(tmpva);
*pte = pa | PG_RW | PG_V | PG_N;
size -= PAGE_SIZE;
tmpva += PAGE_SIZE;
pa += PAGE_SIZE;
for (pa = trunc_page(biosbasemem * 1024);
pa < ISA_HOLE_START; pa += PAGE_SIZE) {
unsigned *pte;
pte = (unsigned *)vtopte(pa + KERNBASE);
*pte = pa | PG_RW | PG_V;
}
}
if (bootinfo.bi_extmem != biosextmem)
@ -1155,13 +1179,6 @@ init386(first)
}
#endif
/*
* If BIOS tells us that it has more than 640k in the basemem,
* don't believe it - set it to 640k.
*/
if (biosbasemem > 640)
biosbasemem = 640;
/*
* Some 386 machines might give us a bogus number for extended
* mem. If this happens, stop now.

View file

@ -1,61 +0,0 @@
#!/usr/bin/perl
#
# Copyright (c) KATO Takenori, 1994-1995. 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 as
# the first lines of this file unmodified.
# 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. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
#
# Default
($HS, $VS, $HBP, $HFP, $VBP, $VFP) = (7, 8, 7, 9, 25, 7);
# set module name
print("Enter module file name: ");
$module = <STDIN>;
open(MODULE, "<$module") || die "Can't open $module.\n";
# read module file
while (<MODULE>) {
if (/\t\tdb\t255/) {
($HS, $VS, $HBP, $HFP, $VBP, $VFP) =
/^\t\tdb\t255, (\d+)\+1,(\d+), (\d+)\+1,(\d+)\+1, (\d+),(\d+).*/;
}
}
close(MODULE);
print("Enter number of lines: ");
$ROW = <STDIN>;
# open /sys/pc98/pc98/module.h
open(MODULE_H, ">/sys/pc98/pc98/module.h") || die "Can't open module.h\n";
# write
printf(MODULE_H "#define\tLINE30_ROW\t%d\n", $ROW);
printf(MODULE_H "#define\t_HS\t%d + 1\n", $HS);
printf(MODULE_H "#define\t_VS\t%d\n", $VS);
printf(MODULE_H "#define\t_HFP\t%d + 1\n", $HFP);
printf(MODULE_H "#define\t_HBP\t%d + 1\n", $HBP);
printf(MODULE_H "#define\t_VFP\t%d\n", $VFP);
printf(MODULE_H "#define\t_VBP\t%d\n", $VBP);
close(MODULE_H);

View file

@ -1,181 +0,0 @@
/*-
* TODO:
* [1] integrate into current if_ed.c
* [2] parse tuples to find out where to map the shared memory buffer,
* and what to write into the configuration register
* [3] move pcic-specific code into a separate module.
*
* Device driver for IBM PCMCIA Credit Card Adapter for Ethernet,
* if_ze.c
*
* Based on the Device driver for National Semiconductor DS8390 ethernet
* adapters by David Greenman. Modifications for PCMCIA by Keith Moore.
* Adapted for FreeBSD 1.1.5 by Jordan Hubbard.
*
* Currently supports only the IBM Credit Card Adapter for Ethernet, but
* could probably work with other PCMCIA cards also, if it were modified
* to get the locations of the PCMCIA configuration option register (COR)
* by parsing the configuration tuples, rather than by hard-coding in
* the value expected by IBM's card.
*
* Sources for data on the PCMCIA/IBM CCAE specific portions of the driver:
*
* [1] _Local Area Network Credit Card Adapters Technical Reference_,
* IBM Corp., SC30-3585-00, part # 33G9243.
* [2] "pre-alpha" PCMCIA support code for Linux by Barry Jaspan.
* [3] Intel 82536SL PC Card Interface Controller Data Sheet, Intel
* Order Number 290423-002
* [4] National Semiconductor DP83902A ST-NIC (tm) Serial Network
* Interface Controller for Twisted Pair data sheet.
*
*
* Copyright (C) 1993, David Greenman. This software may be used, modified,
* copied, distributed, and sold, in both source and binary form provided
* that the above copyright and these terms are retained. Under no
* circumstances is the author responsible for the proper functioning
* of this software, nor does the author assume any responsibility
* for damages incurred with its use.
*/
#ifndef __PCIC_H__
#define __PCIC_H__
/*****************************************************************************
* pcmcia controller chip (PCIC) support *
* (eventually, move this to a separate file) *
*****************************************************************************/
#include "ic/i82365.h"
/*
* Each PCIC chip (82365SL or clone) can handle two card slots, and there
* can be up to four PCICs in a system. (On some machines, not all of the
* address lines are decoded, so a card may appear to be in more than one
* slot.)
*/
#define MAXSLOT 8
/*
* To access a register on the PCIC for a particular slot, you
* first write the correct OFFSET value for that slot in the
* INDEX register for the PCIC controller. You then read or write
* the value from or to the DATA register for that controller.
*
* The first pair of chips shares I/O addresses for DATA and INDEX,
* as does the second pair. (To the programmer, it looks like each
* pair is a single chip.) The i/o port addresses are hard-wired
* into the PCIC; so the following addresses should be valid for
* any machine that uses this chip.
*/
#define PCIC_INDEX_0 0x3E0 /* index reg, chips 0 and 1 */
#define PCIC_DATA_0 0x3E1 /* data register, chips 0 and 1 */
#define PCIC_INDEX_1 0x3E2 /* index reg, chips 1 and 2 */
#define PCIC_DATA_1 0x3E3 /* data register, chips 1 and 2 */
/*
* Given a slot number, calculate the INDEX and DATA registers
* to talk to that slot. OFFSET is added to the register number
* to address the registers for a particular slot.
*/
#define INDEX(slot) ((slot) < 4 ? PCIC_INDEX_0 : PCIC_INDEX_1)
#define DATA(slot) ((slot) < 4 ? PCIC_DATA_0 : PCIC_DATA_1)
#define OFFSET(slot) ((slot) % 4 * 0x40)
/*
* There are 5 sets (windows) of memory mapping registers on the PCIC chip
* for each slot, numbered 0..4.
*
* They start at 10/50 hex within the chip's register space (not system
* I/O space), and are eight addresses apart. These are actually pairs of
* 8-bit-wide registers (low byte first, then high byte) since the
* address fields are actually 12 bits long. The upper bits are used
* for other things like 8/16-bit select and wait states.
*
* Memory mapping registers include start/stop addresses to define the
* region to be mapped (in terms of system memory addresses), and
* an offset register to allow for translation from system space
* to card space. The lower 12 bits aren't included in these, so memory is
* mapped in 4K chunks.
*/
#define MEM_START_ADDR(window) (((window) * 0x08) + 0x10)
#define MEM_STOP_ADDR(window) (((window) * 0x08) + 0x12)
#define MEM_OFFSET(window) (((window) * 0x08) + 0x14)
/*
* this bit gets set in the address window enable register (PCIC_ADDRWINE)
* to enable a particular address window.
*/
#define MEM_ENABLE_BIT(window) ((1) << (window))
/*
* There are two i/o port addressing windows. I/O ports cannot be
* relocated within system i/o space (unless the card doesn't decode
* all of the address bits); unlike card memory, there is no address
* translation offset.
*/
#define IO_START_ADDR(window) ((window) ? PCIC_IO1_STL : PCIC_IO0_STL)
#define IO_STOP_ADDR(window) ((window) ? PCIC_IO1_SPL : PCIC_IO0_SPL)
#define IO_ENABLE_BIT(window) ((window) ? PCIC_IO1_EN : PCIC_IO0_EN)
#define IO_CS16_BIT(window) ((window) ? PCIC_IO1_CS16 : PCIC_IO0_CS16)
/*
* types of mapped memory
*/
enum memtype { COMMON, ATTRIBUTE };
/*
* read a byte from a pcic register for a particular slot
*/
static inline unsigned char
pcic_getb (int slot, int reg)
{
outb (INDEX(slot), OFFSET (slot) + reg);
return inb (DATA (slot));
}
/*
* write a byte to a pcic register for a particular slot
*/
static inline void
pcic_putb (int slot, int reg, unsigned char val)
{
outb (INDEX(slot), OFFSET (slot) + reg);
outb (DATA (slot), val);
}
/*
* read a word from a pcic register for a particular slot
*/
static inline unsigned short
pcic_getw (int slot, int reg)
{
return pcic_getb (slot, reg) | (pcic_getb (slot, reg+1) << 8);
}
/*
* write a word to a pcic register at a particular slot
*/
static inline void
pcic_putw (int slot, int reg, unsigned short val)
{
pcic_putb (slot, reg, val & 0xff);
pcic_putb (slot, reg + 1, (val >> 8) & 0xff);
}
void pcic_print_regs (int slot);
void pcic_map_memory (int slot, int window, unsigned long sys_addr,
unsigned long card_addr, unsigned long length,
enum memtype type, int width);
void pcic_unmap_memory (int slot, int window);
void pcic_map_io (int slot, int window, unsigned short base,
unsigned short length, unsigned short width);
#ifdef TEST
void pcic_unmap_io (int slot, int window);
#endif /* TEST */
void pcic_map_irq (int slot, int irq);
void pcic_power_on (int slot);
void pcic_power_off (int slot);
void pcic_reset (int slot);
#endif /* __PCIC_H__ */

View file

@ -1,236 +0,0 @@
/*-
* TODO:
* [1] integrate into current if_ed.c
* [2] parse tuples to find out where to map the shared memory buffer,
* and what to write into the configuration register
* [3] move pcic-specific code into a separate module.
*
* Device driver for IBM PCMCIA Credit Card Adapter for Ethernet,
* if_ze.c
*
* Based on the Device driver for National Semiconductor DS8390 ethernet
* adapters by David Greenman. Modifications for PCMCIA by Keith Moore.
* Adapted for FreeBSD 1.1.5 by Jordan Hubbard.
*
* Currently supports only the IBM Credit Card Adapter for Ethernet, but
* could probably work with other PCMCIA cards also, if it were modified
* to get the locations of the PCMCIA configuration option register (COR)
* by parsing the configuration tuples, rather than by hard-coding in
* the value expected by IBM's card.
*
* Sources for data on the PCMCIA/IBM CCAE specific portions of the driver:
*
* [1] _Local Area Network Credit Card Adapters Technical Reference_,
* IBM Corp., SC30-3585-00, part # 33G9243.
* [2] "pre-alpha" PCMCIA support code for Linux by Barry Jaspan.
* [3] Intel 82536SL PC Card Interface Controller Data Sheet, Intel
* Order Number 290423-002
* [4] National Semiconductor DP83902A ST-NIC (tm) Serial Network
* Interface Controller for Twisted Pair data sheet.
*
*
* Copyright (C) 1993, David Greenman. This software may be used, modified,
* copied, distributed, and sold, in both source and binary form provided
* that the above copyright and these terms are retained. Under no
* circumstances is the author responsible for the proper functioning
* of this software, nor does the author assume any responsibility
* for damages incurred with its use.
*/
#include <sys/param.h>
#if defined(__FreeBSD__)
#include <sys/systm.h>
#include <sys/kernel.h>
#include <machine/clock.h>
#endif
#include <i386/isa/isa_device.h>
#ifdef PC98
#include <pc98/pc98/pcic.h>
#else
#include <i386/isa/pcic.h>
#endif
/*
* map a portion of the card's memory space into system memory
* space.
*
* slot = # of the slot the card is plugged into
* window = which pcic memory map registers to use (0..4)
* sys_addr = base system PHYSICAL memory address where we want it. must
* be on an appropriate boundary (lower 12 bits are zero).
* card_addr = the base address of the card's memory to correspond
* to sys_addr
* length = length of the segment to map (may be rounded up as necessary)
* type = which card memory space to map (attribute or shared)
* width = 1 for byte-wide mapping; 2 for word (16-bit) mapping.
*/
void
pcic_map_memory (int slot, int window, unsigned long sys_addr,
unsigned long card_addr, unsigned long length,
enum memtype type, int width)
{
unsigned short offset;
unsigned short mem_start_addr;
unsigned short mem_stop_addr;
sys_addr >>= 12;
card_addr >>= 12;
length >>= 12;
/*
* compute an offset for the chip such that
* (sys_addr + offset) = card_addr
* but the arithmetic is done modulo 2^14
*/
offset = (card_addr - sys_addr) & 0x3FFF;
/*
* now OR in the bit for "attribute memory" if necessary
*/
if (type == ATTRIBUTE) {
offset |= (PCIC_REG << 8);
/* REG == "region active" pin on card */
}
/*
* okay, set up the chip memory mapping registers, and turn
* on the enable bit for this window.
* if we are doing 16-bit wide accesses (width == 2),
* turn on the appropriate bit.
*
* XXX for now, we set all of the wait state bits to zero.
* Not really sure how they should be set.
*/
mem_start_addr = sys_addr & 0xFFF;
if (width == 2)
mem_start_addr |= (PCIC_DATA16 << 8);
mem_stop_addr = (sys_addr + length) & 0xFFF;
pcic_putw (slot, MEM_START_ADDR(window), mem_start_addr);
pcic_putw (slot, MEM_STOP_ADDR(window), mem_stop_addr);
pcic_putw (slot, MEM_OFFSET(window), offset);
/*
* Assert the bit (PCIC_MEMCS16) that says to decode all of
* the address lines.
*/
pcic_putb (slot, PCIC_ADDRWINE,
pcic_getb (slot, PCIC_ADDRWINE) |
MEM_ENABLE_BIT(window) | PCIC_MEMCS16);
}
void
pcic_unmap_memory (int slot, int window)
{
/*
* seems like we need to turn off the enable bit first, after which
* we can clear the registers out just to be sure.
*/
pcic_putb (slot, PCIC_ADDRWINE,
pcic_getb (slot, PCIC_ADDRWINE) & ~MEM_ENABLE_BIT(window));
pcic_putw (slot, MEM_START_ADDR(window), 0);
pcic_putw (slot, MEM_STOP_ADDR(window), 0);
pcic_putw (slot, MEM_OFFSET(window), 0);
}
/*
* map a range of addresses into system i/o space
* (no translation of i/o addresses is possible)
*
* 'width' is:
* + 0 to tell the PCIC to generate the ISA IOCS16* signal from
* the PCMCIA IOIS16* signal.
* + 1 to select 8-bit width
* + 2 to select 16-bit width
*/
void
pcic_map_io (int slot, int window, unsigned short base, unsigned short length,
unsigned short width)
{
unsigned char x;
pcic_putw (slot, IO_START_ADDR(window), base);
pcic_putw (slot, IO_STOP_ADDR(window), base+length-1);
/*
* select the bits that determine whether
* an i/o operation is 8 or 16 bits wide
*/
x = pcic_getb (slot, PCIC_IOCTL);
switch (width) {
case 0: /* PCMCIA card decides */
if (window)
x = (x & 0xf0) | PCIC_IO1_CS16;
else
x = (x & 0x0f) | PCIC_IO0_CS16;
break;
case 1: /* 8 bits wide */
break;
case 2: /* 16 bits wide */
if (window)
x = (x & 0xf0) | PCIC_IO1_16BIT;
else
x = (x & 0x0f) | PCIC_IO0_16BIT;
break;
}
pcic_putb (slot, PCIC_IOCTL, x);
pcic_putb (slot, PCIC_ADDRWINE,
pcic_getb (slot, PCIC_ADDRWINE) | IO_ENABLE_BIT(window));
}
#ifdef TEST
void
pcic_unmap_io (int slot, int window)
{
pcic_putb (slot, PCIC_ADDRWINE,
pcic_getb (slot, PCIC_ADDRWINE) & ~IO_ENABLE_BIT(window));
pcic_putw (slot, IO_START_ADDR(window), 0);
pcic_putw (slot, IO_STOP_ADDR(window), 0);
}
#endif /* TEST */
/*
* tell the PCIC which irq we want to use. only the following are legal:
* 3, 4, 5, 7, 9, 10, 11, 12, 14, 15
*
* NB: 'irq' is an interrupt NUMBER, not a MASK as in struct isa_device.
*/
void
pcic_map_irq (int slot, int irq)
{
if (irq < 3 || irq == 6 || irq == 8 || irq == 13 || irq > 15) {
printf ("zp: pcic_map_irq (slot %d): illegal irq %d\n", slot, irq);
return;
}
pcic_putb (slot, PCIC_INT_GEN,
pcic_getb (slot, PCIC_INT_GEN) | (irq & 0x0F));
}
void
pcic_power_on (int slot)
{
pcic_putb (slot, PCIC_STATUS,
pcic_getb (slot, PCIC_STATUS) | PCIC_POW);
DELAY (100000);
pcic_putb (slot, PCIC_POWER,
pcic_getb (slot, PCIC_POWER) | PCIC_DISRST | PCIC_PCPWRE);
DELAY (100000);
pcic_putb (slot, PCIC_POWER,
pcic_getb (slot, PCIC_POWER) | PCIC_OUTENA);
}
void
pcic_power_off (int slot)
{
pcic_putb (slot, PCIC_POWER,
pcic_getb (slot, PCIC_POWER) & ~(PCIC_OUTENA|PCIC_PCPWRE));
}
void
pcic_reset (int slot)
{
/* assert RESET (by clearing a bit!), wait a bit, and de-assert it */
pcic_putb (slot, PCIC_INT_GEN,
pcic_getb (slot, PCIC_INT_GEN) & ~PCIC_CARDRESET);
DELAY (100000);
pcic_putb (slot, PCIC_INT_GEN,
pcic_getb (slot, PCIC_INT_GEN) | PCIC_CARDRESET);
}

File diff suppressed because it is too large Load diff

View file

@ -4,12 +4,12 @@
* v1.4 by Eric S. Raymond (esr@snark.thyrsus.com) Aug 1993
* modified for FreeBSD by Andrew A. Chernov <ache@astral.msk.su>
*
* $Id: spkr.c,v 1.2 1996/07/23 07:46:39 asami Exp $
* $Id: spkr.c,v 1.3 1996/08/30 10:43:09 asami Exp $
*/
/*
* modified for PC98
* $Id: spkr.c,v 1.2 1996/07/23 07:46:39 asami Exp $
* $Id: spkr.c,v 1.3 1996/08/30 10:43:09 asami Exp $
*/
#include "speaker.h"
@ -26,7 +26,6 @@
#include <sys/conf.h>
#ifdef PC98
#include <pc98/pc98/pc98.h>
#include <pc98/pc98/pc98_device.h>
#include <pc98/pc98/timerreg.h>
#else
#include <i386/isa/isa.h>

File diff suppressed because it is too large Load diff

View file

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: syscons.h,v 1.1.1.1 1996/06/14 10:04:47 asami Exp $
* $Id: syscons.h,v 1.2 1996/07/23 07:46:42 asami Exp $
*/
#ifndef _PC98_PC98_SYSCONS_H_
@ -60,8 +60,8 @@
#define SWITCH_WAIT_ACQ 0x00080
#define BUFFER_SAVED 0x00100
#define CURSOR_ENABLED 0x00200
#define CURSOR_SHOWN 0x00400
#define MOUSE_ENABLED 0x00800
#define MOUSE_ENABLED 0x00400
#define MOUSE_MOVED 0x00800
#define MOUSE_CUTTING 0x01000
/* configuration flags */
@ -176,12 +176,12 @@ typedef struct scr_stat {
term_stat term; /* terminal emulation stuff */
int status; /* status (bitfield) */
u_short *cursor_pos; /* cursor buffer position */
u_short *cursor_oldpos; /* cursor old buffer position */
u_short cursor_saveunder; /* saved chars under cursor */
char cursor_start; /* cursor start line # */
char cursor_end; /* cursor end line # */
u_short *mouse_pos; /* mouse buffer position */
u_short *mouse_oldpos; /* mouse old buffer position */
u_short mouse_saveunder[4]; /* saved chars under mouse */
short mouse_xpos; /* mouse x coordinate */
short mouse_ypos; /* mouse y coordinate */
short mouse_buttons; /* mouse buttons */
@ -224,7 +224,9 @@ typedef struct default_attr {
} default_attr;
void load_palette(void);
void set_border(int color);
void set_border(u_char color);
void set_mode(scr_stat *scp);
void copy_font(int operation, int font_type, char* font_image);
#ifdef PC98
unsigned int at2pc98(unsigned int attr);