Commit b1d53f0c authored by Linus Torvalds's avatar Linus Torvalds

This removes the files orphaned by the earlier PC9800 removal

parent bffc8f71
#
# arch/i386/boot/Makefile
#
# This file is subject to the terms and conditions of the GNU General Public
# License. See the file "COPYING" in the main directory of this archive
# for more details.
#
# Copyright (C) 1994 by Linus Torvalds
#
# ROOT_DEV specifies the default root-device when making the image.
# This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case
# the default of FLOPPY is used by 'build'.
ROOT_DEV := CURRENT
# If you want to preset the SVGA mode, uncomment the next line and
# set SVGA_MODE to whatever number you want.
# Set it to -DSVGA_MODE=NORMAL_VGA if you just want the EGA/VGA mode.
# The number is the same as you would ordinarily press at bootup.
SVGA_MODE := -DSVGA_MODE=NORMAL_VGA
# If you want the RAM disk device, define this to be the size in blocks.
#RAMDISK := -DRAMDISK=512
targets := vmlinux.bin bootsect bootsect.o setup setup.o \
zImage bzImage
subdir- := compressed
host-progs := tools/build
# ---------------------------------------------------------------------------
$(obj)/zImage: IMAGE_OFFSET := 0x1000
$(obj)/zImage: EXTRA_AFLAGS := -traditional $(SVGA_MODE) $(RAMDISK)
$(obj)/bzImage: IMAGE_OFFSET := 0x100000
$(obj)/bzImage: EXTRA_AFLAGS := -traditional $(SVGA_MODE) $(RAMDISK) -D__BIG_KERNEL__
$(obj)/bzImage: BUILDFLAGS := -b
quiet_cmd_image = BUILD $@
cmd_image = $(obj)/tools/build $(BUILDFLAGS) $(obj)/bootsect $(obj)/setup \
$(obj)/vmlinux.bin $(ROOT_DEV) > $@
$(obj)/zImage $(obj)/bzImage: $(obj)/bootsect $(obj)/setup \
$(obj)/vmlinux.bin $(obj)/tools/build FORCE
$(call if_changed,image)
@echo 'Kernel: $@ is ready'
$(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE
$(call if_changed,objcopy)
LDFLAGS_bootsect := -Ttext 0x0 -s --oformat binary
LDFLAGS_setup := -Ttext 0x0 -s --oformat binary -e begtext
$(obj)/setup $(obj)/bootsect: %: %.o FORCE
$(call if_changed,ld)
$(obj)/compressed/vmlinux: FORCE
$(Q)$(MAKE) $(build)=$(obj)/compressed IMAGE_OFFSET=$(IMAGE_OFFSET) $@
# Set this if you want to pass append arguments to the zdisk/fdimage kernel
FDARGS =
$(obj)/mtools.conf: $(src)/mtools.conf.in
sed -e 's|@OBJ@|$(obj)|g' < $< > $@
# This requires write access to /dev/fd0
zdisk: $(BOOTIMAGE) $(obj)/mtools.conf
MTOOLSRC=$(obj)/mtools.conf mformat a: ; sync
syslinux /dev/fd0 ; sync
echo 'default linux $(FDARGS)' | \
MTOOLSRC=$(src)/mtools.conf mcopy - a:syslinux.cfg
MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) a:linux ; sync
# These require being root or having syslinux 2.02 or higher installed
fdimage fdimage144: $(BOOTIMAGE) $(obj)/mtools.conf
dd if=/dev/zero of=$(obj)/fdimage bs=1024 count=1440
MTOOLSRC=$(obj)/mtools.conf mformat v: ; sync
syslinux $(obj)/fdimage ; sync
echo 'default linux $(FDARGS)' | \
MTOOLSRC=$(obj)/mtools.conf mcopy - v:syslinux.cfg
MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) v:linux ; sync
fdimage288: $(BOOTIMAGE) $(obj)/mtools.conf
dd if=/dev/zero of=$(obj)/fdimage bs=1024 count=2880
MTOOLSRC=$(obj)/mtools.conf mformat w: ; sync
syslinux $(obj)/fdimage ; sync
echo 'default linux $(FDARGS)' | \
MTOOLSRC=$(obj)/mtools.conf mcopy - w:syslinux.cfg
MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) w:linux ; sync
zlilo: $(BOOTIMAGE)
if [ -f $(INSTALL_PATH)/vmlinuz ]; then mv $(INSTALL_PATH)/vmlinuz $(INSTALL_PATH)/vmlinuz.old; fi
if [ -f $(INSTALL_PATH)/System.map ]; then mv $(INSTALL_PATH)/System.map $(INSTALL_PATH)/System.old; fi
cat $(BOOTIMAGE) > $(INSTALL_PATH)/vmlinuz
cp System.map $(INSTALL_PATH)/
if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi
install: $(BOOTIMAGE)
sh $(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)"
This diff is collapsed.
#!/bin/sh
#
# arch/i386/boot/install.sh
#
# This file is subject to the terms and conditions of the GNU General Public
# License. See the file "COPYING" in the main directory of this archive
# for more details.
#
# Copyright (C) 1995 by Linus Torvalds
#
# Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin
#
# "make install" script for i386 architecture
#
# Arguments:
# $1 - kernel version
# $2 - kernel image file
# $3 - kernel map file
# $4 - default install path (blank if root directory)
#
# User may have a custom install script
if [ -x ~/bin/installkernel ]; then exec ~/bin/installkernel "$@"; fi
if [ -x /sbin/installkernel ]; then exec /sbin/installkernel "$@"; fi
# Default install - same as make zlilo
if [ -f $4/vmlinuz ]; then
mv $4/vmlinuz $4/vmlinuz.old
fi
if [ -f $4/System.map ]; then
mv $4/System.map $4/System.old
fi
cat $2 > $4/vmlinuz
cp $3 $4/System.map
if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi
#
# mtools configuration file for "make (b)zdisk"
#
# Actual floppy drive
drive a:
file="/dev/fd0"
# 1.44 MB floppy disk image
drive v:
file="@OBJ@/fdimage" cylinders=80 heads=2 sectors=18 filter
# 2.88 MB floppy disk image (mostly for virtual uses)
drive w:
file="@OBJ@/fdimage" cylinders=80 heads=2 sectors=36 filter
This diff is collapsed.
/* video.S
*
* Video mode setup, etc. for NEC PC-9800 series.
*
* Copyright (C) 1997,98,99 Linux/98 project <seraphim@kmc.kyoto-u.ac.jp>
*
* Based on the video.S for IBM PC:
* copyright (C) Martin Mares <mj@atrey.karlin.mff.cuni.cz>
*/
/* Positions of various video parameters passed to the kernel */
/* (see also include/linux/tty.h) */
#define PARAM_CURSOR_POS 0x00
#define PARAM_VIDEO_PAGE 0x04
#define PARAM_VIDEO_MODE 0x06
#define PARAM_VIDEO_COLS 0x07
#define PARAM_VIDEO_EGA_BX 0x0a
#define PARAM_VIDEO_LINES 0x0e
#define PARAM_HAVE_VGA 0x0f
#define PARAM_FONT_POINTS 0x10
#define PARAM_VIDEO98_COMPAT 0x0a
#define PARAM_VIDEO98_HIRESO 0x0b
#define PARAM_VIDEO98_MACHTYPE 0x0c
#define PARAM_VIDEO98_LINES 0x0e
#define PARAM_VIDEO98_COLS 0x0f
# PARAM_LFB_* and PARAM_VESAPM_* are unused on PC-9800.
# This is the main entry point called by setup.S
# %ds *must* be pointing to the bootsector
video: xorw %ax, %ax
movw %ax, %es # %es = 0
movb %es:BIOS_FLAG, %al
movb %al, PARAM_VIDEO_MODE
movb $0, PARAM_VIDEO98_HIRESO # 0 = normal
movw $NORMAL_TEXT, PARAM_VIDEO_PAGE
testb $0x8, %al
movw $(80 * 256 + 25), %ax
jz 1f
# hireso machine.
movb $1, PARAM_VIDEO98_HIRESO # !0 = hi-reso
movb $(HIRESO_TEXT >> 8), PARAM_VIDEO_PAGE + 1
movw $(80 * 256 + 31), %ax
1: movw %ax, PARAM_VIDEO98_LINES # also sets VIDEO98_COLS
movb $0xc0, %ch # 400-line graphic mode
movb $0x42, %ah
int $0x18
movw $80, PARAM_VIDEO_COLS
movw $msg_probing, %si
call prtstr_cs
# Check vendor from font pattern of `A'...
1: inb $0x60, %al # wait V-sync
testb $0x20, %al
jnz 1b
2: inb $0x60, %al
testb $0x20, %al
jz 2b
movb $0x00, %al # select font of `A'
outb %al, $0xa1
movb $0x41, %al
outb %al, $0xa3
movw $8, %cx
movw PARAM_VIDEO_PAGE, %ax
cmpw $NORMAL_TEXT, %ax
je 3f
movb $24, %cl # for hi-reso machine
3: addw $0x400, %ax # %ax = CG window segment
pushw %ds
movw %ax, %ds
xorw %dx, %dx # get sum of `A' pattern...
xorw %si, %si
4: lodsw
addw %ax, %dx
loop 4b
popw %ds
movw %dx, %ax
movw $msg_nec, %si
xorw %bx, %bx # vendor info will go into %bx
testb $8, %es:BIOS_FLAG
jnz check_hireso_vendor
cmpw $0xc7f8, %ax
je 5f
jmp 6f
check_hireso_vendor:
cmpw $0x9639, %ax # XXX: NOT VERIFIED!!!
je 5f
6: incw %bx # compatible machine
movw $msg_compat, %si
5: movb %bl, PARAM_VIDEO98_COMPAT
call prtstr_cs
movw $msg_fontdata, %si
call prtstr_cs # " (CG sum of A = 0x"
movw %dx, %ax
call prthex
call prtstr_cs # ") PC-98"
movb $'0', %al
pushw %ds
pushw $0xf8e8
popw %ds
cmpw $0x2198, (0)
popw %ds
jne 7f
movb $'2', %al
7: call prtchr
call prtstr_cs # "1 "
movb $0, PARAM_VIDEO98_MACHTYPE
#if 0 /* XXX - This check is bogus? [0000:BIOS_FLAG2]-bit7 does NOT
indicate whether it is a note machine, but merely indicates
whether it has ``RAM drive''. */
# check note machine
testb $0x80, %es:BIOS_FLAG2
jnz is_note
pushw %ds
pushw $0xfd80
popw %ds
movb (4), %al
popw %ds
cmpb $0x20, %al # EPSON note A
je epson_note
cmpb $0x22, %al # EPSON note W
je epson_note
cmpb $0x27, %al # EPSON note AE
je epson_note
cmpb $0x2a, %al # EPSON note WR
jne note_done
epson_note:
movb $1, PARAM_VIDEO98_MACHTYPE
movw $msg_note, %si
call prtstr_cs
note_done:
#endif
# print h98 ? (only NEC)
cmpb $0, PARAM_VIDEO98_COMPAT
jnz 8f # not NEC -> not H98
testb $0x80, %es:BIOS_FLAG5
jz 8f # have NESA bus -> H98
movw $msg_h98, %si
call prtstr_cs
orb $2, PARAM_VIDEO98_MACHTYPE
8: testb $0x40, %es:BIOS_FLAG5
jz 9f
movw $msg_gs, %si
call prtstr_cs # only prints it :-)
9:
movw $msg_normal, %si # "normal"
testb $0x8, %es:BIOS_FLAG
jz 1f
movw $msg_hireso, %si
1: call prtstr_cs
movw $msg_sysclk, %si
call prtstr_cs
movb $'5', %al
testb $0x80, %es:BIOS_FLAG
jz 2f
movb $'8', %al
2: call prtchr
call prtstr_cs
#if 0
testb $0x40, %es:(0x45c)
jz no_30line # no 30-line support
movb %es:KB_SHFT_STS, %al
testb $0x01, %al # is SHIFT key pressed?
jz no_30line
testb $0x10, %al # is CTRL key pressed?
jnz line40
# switch to 30-line mode
movb $30, PARAM_VIDEO98_LINES
movw $msg_30line, %si
jmp 3f
line40:
movb $37, PARAM_VIDEO98_LINES
movw $40, PARAM_VIDEO_LINES
movw $msg_40line, %si
3: call prtstr_cs
movb $0x32, %bh
movw $0x300c, %ax
int $0x18 # switch video mode
movb $0x0c, %ah
int $0x18 # turn on text plane
movw %cs:cursor_address, %dx
movb $0x13, %ah
int $0x18 # move cursor to correct place
mov $0x11, %ah
int $0x18 # turn on text plane
call prtstr_cs # "Ok.\r\n"
no_30line:
#endif
ret
prtstr_cs:
pushw %ds
pushw %cs
popw %ds
call prtstr
popw %ds
ret
# prthex is for debugging purposes, and prints %ax in hexadecimal.
prthex: pushw %cx
movw $4, %cx
1: rolw $4, %ax
pushw %ax
andb $0xf, %al
cmpb $10, %al
sbbb $0x69, %al
das
call prtchr
popw %ax
loop 1b
popw %cx
ret
msg_probing: .string "Probing machine: "
msg_nec: .string "NEC"
msg_compat: .string "compatible"
msg_fontdata: .string " (CG sum of A = 0x"
.string ") PC-98"
.string "1 "
msg_gs: .string "(GS) "
msg_h98: .string "(H98) "
msg_normal: .string "normal"
msg_hireso: .string "Hi-reso"
msg_sysclk: .string " mode, system clock "
.string "MHz\r\n"
#if 0
msg_40line: # cpp will concat following lines, so the assembler can deal.
.ascii "\
Video mode will be adjusted to 37-line (so-called ``40-line'') mode later.\r\n\
THIS MODE MAY DAMAGE YOUR MONITOR PHYSICALLY. USE AT YOUR OWN RISK.\r\n"
msg_30line: .string "Switching video mode to 30-line (640x480) mode... "
.string "Ok.\r\n"
#endif
#
# Makefile for the linux kernel.
#
obj-y := setup.o topology.o std_resources.o
/*
* Machine specific setup for pc9800
*/
#include <linux/config.h>
#include <linux/mm.h>
#include <linux/smp.h>
#include <linux/init.h>
#include <linux/irq.h>
#include <linux/interrupt.h>
#include <linux/apm_bios.h>
#include <asm/setup.h>
#include <asm/arch_hooks.h>
struct sys_desc_table_struct {
unsigned short length;
unsigned char table[0];
};
/**
* pre_intr_init_hook - initialisation prior to setting up interrupt vectors
*
* Description:
* Perform any necessary interrupt initialisation prior to setting up
* the "ordinary" interrupt call gates. For legacy reasons, the ISA
* interrupts should be initialised here if the machine emulates a PC
* in any way.
**/
void __init pre_intr_init_hook(void)
{
init_ISA_irqs();
}
/*
* IRQ7 is cascade interrupt to second interrupt controller
*/
static struct irqaction irq7 = { no_action, 0, 0, "cascade", NULL, NULL};
/**
* intr_init_hook - post gate setup interrupt initialisation
*
* Description:
* Fill in any interrupts that may have been left out by the general
* init_IRQ() routine. interrupts having to do with the machine rather
* than the devices on the I/O bus (like APIC interrupts in intel MP
* systems) are started here.
**/
void __init intr_init_hook(void)
{
#ifdef CONFIG_X86_LOCAL_APIC
apic_intr_init();
#endif
setup_irq(7, &irq7);
}
/**
* pre_setup_arch_hook - hook called prior to any setup_arch() execution
*
* Description:
* generally used to activate any machine specific identification
* routines that may be needed before setup_arch() runs. On VISWS
* this is used to get the board revision and type.
**/
void __init pre_setup_arch_hook(void)
{
SYS_DESC_TABLE.length = 0;
MCA_bus = 0;
/* In PC-9800, APM BIOS version is written in BCD...?? */
APM_BIOS_INFO.version = (APM_BIOS_INFO.version & 0xff00)
| ((APM_BIOS_INFO.version & 0x00f0) >> 4);
}
/**
* trap_init_hook - initialise system specific traps
*
* Description:
* Called as the final act of trap_init(). Used in VISWS to initialise
* the various board specific APIC traps.
**/
void __init trap_init_hook(void)
{
}
static struct irqaction irq0 = { timer_interrupt, SA_INTERRUPT, 0, "timer", NULL, NULL};
/**
* time_init_hook - do any specific initialisations for the system timer.
*
* Description:
* Must plug the system timer interrupt source at HZ into the IRQ listed
* in irq_vectors.h:TIMER_IRQ
**/
void __init time_init_hook(void)
{
setup_irq(0, &irq0);
}
#ifdef CONFIG_MCA
/**
* mca_nmi_hook - hook into MCA specific NMI chain
*
* Description:
* The MCA (Microchannel Architecture) has an NMI chain for NMI sources
* along the MCA bus. Use this to hook into that chain if you will need
* it.
**/
void __init mca_nmi_hook(void)
{
/* If I recall correctly, there's a whole bunch of other things that
* we can do to check for NMI problems, but that's all I know about
* at the moment.
*/
printk("NMI generated from unknown source!\n");
}
#endif
/*
* Machine specific resource allocation for PC-9800.
* Written by Osamu Tomita <tomita@cinet.co.jp>
*/
#include <linux/ioport.h>
#include <asm/io.h>
#include <asm/std_resources.h>
static char str_pic1[] = "pic1";
static char str_dma[] = "dma";
static char str_pic2[] = "pic2";
static char str_calender_clock[] = "calender clock";
static char str_system[] = "system";
static char str_nmi_control[] = "nmi control";
static char str_kanji_rom[] = "kanji rom";
static char str_keyboard[] = "keyboard";
static char str_text_gdc[] = "text gdc";
static char str_crtc[] = "crtc";
static char str_timer[] = "timer";
static char str_graphic_gdc[] = "graphic gdc";
static char str_dma_ex_bank[] = "dma ex. bank";
static char str_beep_freq[] = "beep freq.";
static char str_mouse_pio[] = "mouse pio";
struct resource standard_io_resources[] = {
{ str_pic1, 0x00, 0x00, IORESOURCE_BUSY },
{ str_dma, 0x01, 0x01, IORESOURCE_BUSY },
{ str_pic1, 0x02, 0x02, IORESOURCE_BUSY },
{ str_dma, 0x03, 0x03, IORESOURCE_BUSY },
{ str_dma, 0x05, 0x05, IORESOURCE_BUSY },
{ str_dma, 0x07, 0x07, IORESOURCE_BUSY },
{ str_pic2, 0x08, 0x08, IORESOURCE_BUSY },
{ str_dma, 0x09, 0x09, IORESOURCE_BUSY },
{ str_pic2, 0x0a, 0x0a, IORESOURCE_BUSY },
{ str_dma, 0x0b, 0x0b, IORESOURCE_BUSY },
{ str_dma, 0x0d, 0x0d, IORESOURCE_BUSY },
{ str_dma, 0x0f, 0x0f, IORESOURCE_BUSY },
{ str_dma, 0x11, 0x11, IORESOURCE_BUSY },
{ str_dma, 0x13, 0x13, IORESOURCE_BUSY },
{ str_dma, 0x15, 0x15, IORESOURCE_BUSY },
{ str_dma, 0x17, 0x17, IORESOURCE_BUSY },
{ str_dma, 0x19, 0x19, IORESOURCE_BUSY },
{ str_dma, 0x1b, 0x1b, IORESOURCE_BUSY },
{ str_dma, 0x1d, 0x1d, IORESOURCE_BUSY },
{ str_dma, 0x1f, 0x1f, IORESOURCE_BUSY },
{ str_calender_clock, 0x20, 0x20, 0 },
{ str_dma, 0x21, 0x21, IORESOURCE_BUSY },
{ str_calender_clock, 0x22, 0x22, 0 },
{ str_dma, 0x23, 0x23, IORESOURCE_BUSY },
{ str_dma, 0x25, 0x25, IORESOURCE_BUSY },
{ str_dma, 0x27, 0x27, IORESOURCE_BUSY },
{ str_dma, 0x29, 0x29, IORESOURCE_BUSY },
{ str_dma, 0x2b, 0x2b, IORESOURCE_BUSY },
{ str_dma, 0x2d, 0x2d, IORESOURCE_BUSY },
{ str_system, 0x31, 0x31, IORESOURCE_BUSY },
{ str_system, 0x33, 0x33, IORESOURCE_BUSY },
{ str_system, 0x35, 0x35, IORESOURCE_BUSY },
{ str_system, 0x37, 0x37, IORESOURCE_BUSY },
{ str_nmi_control, 0x50, 0x50, IORESOURCE_BUSY },
{ str_nmi_control, 0x52, 0x52, IORESOURCE_BUSY },
{ "time stamp", 0x5c, 0x5f, IORESOURCE_BUSY },
{ str_kanji_rom, 0xa1, 0xa1, IORESOURCE_BUSY },
{ str_kanji_rom, 0xa3, 0xa3, IORESOURCE_BUSY },
{ str_kanji_rom, 0xa5, 0xa5, IORESOURCE_BUSY },
{ str_kanji_rom, 0xa7, 0xa7, IORESOURCE_BUSY },
{ str_kanji_rom, 0xa9, 0xa9, IORESOURCE_BUSY },
{ str_keyboard, 0x41, 0x41, IORESOURCE_BUSY },
{ str_keyboard, 0x43, 0x43, IORESOURCE_BUSY },
{ str_text_gdc, 0x60, 0x60, IORESOURCE_BUSY },
{ str_text_gdc, 0x62, 0x62, IORESOURCE_BUSY },
{ str_text_gdc, 0x64, 0x64, IORESOURCE_BUSY },
{ str_text_gdc, 0x66, 0x66, IORESOURCE_BUSY },
{ str_text_gdc, 0x68, 0x68, IORESOURCE_BUSY },
{ str_text_gdc, 0x6a, 0x6a, IORESOURCE_BUSY },
{ str_text_gdc, 0x6c, 0x6c, IORESOURCE_BUSY },
{ str_text_gdc, 0x6e, 0x6e, IORESOURCE_BUSY },
{ str_crtc, 0x70, 0x70, IORESOURCE_BUSY },
{ str_crtc, 0x72, 0x72, IORESOURCE_BUSY },
{ str_crtc, 0x74, 0x74, IORESOURCE_BUSY },
{ str_crtc, 0x74, 0x74, IORESOURCE_BUSY },
{ str_crtc, 0x76, 0x76, IORESOURCE_BUSY },
{ str_crtc, 0x78, 0x78, IORESOURCE_BUSY },
{ str_crtc, 0x7a, 0x7a, IORESOURCE_BUSY },
{ str_timer, 0x71, 0x71, IORESOURCE_BUSY },
{ str_timer, 0x73, 0x73, IORESOURCE_BUSY },
{ str_timer, 0x75, 0x75, IORESOURCE_BUSY },
{ str_timer, 0x77, 0x77, IORESOURCE_BUSY },
{ str_graphic_gdc, 0xa0, 0xa0, IORESOURCE_BUSY },
{ str_graphic_gdc, 0xa2, 0xa2, IORESOURCE_BUSY },
{ str_graphic_gdc, 0xa4, 0xa4, IORESOURCE_BUSY },
{ str_graphic_gdc, 0xa6, 0xa6, IORESOURCE_BUSY },
{ "cpu", 0xf0, 0xf7, IORESOURCE_BUSY },
{ "fpu", 0xf8, 0xff, IORESOURCE_BUSY },
{ str_dma_ex_bank, 0x0e05, 0x0e05, 0 },
{ str_dma_ex_bank, 0x0e07, 0x0e07, 0 },
{ str_dma_ex_bank, 0x0e09, 0x0e09, 0 },
{ str_dma_ex_bank, 0x0e0b, 0x0e0b, 0 },
{ str_beep_freq, 0x3fd9, 0x3fd9, IORESOURCE_BUSY },
{ str_beep_freq, 0x3fdb, 0x3fdb, IORESOURCE_BUSY },
{ str_beep_freq, 0x3fdd, 0x3fdd, IORESOURCE_BUSY },
{ str_beep_freq, 0x3fdf, 0x3fdf, IORESOURCE_BUSY },
/* All PC-9800 have (exactly) one mouse interface. */
{ str_mouse_pio, 0x7fd9, 0x7fd9, 0 },
{ str_mouse_pio, 0x7fdb, 0x7fdb, 0 },
{ str_mouse_pio, 0x7fdd, 0x7fdd, 0 },
{ str_mouse_pio, 0x7fdf, 0x7fdf, 0 },
{ "mouse timer", 0xbfdb, 0xbfdb, 0 },
{ "mouse irq", 0x98d7, 0x98d7, 0 },
};
#define STANDARD_IO_RESOURCES (sizeof(standard_io_resources)/sizeof(struct resource))
static struct resource tvram_resource = { "Text VRAM/CG window", 0xa0000, 0xa4fff, IORESOURCE_BUSY };
static struct resource gvram_brg_resource = { "Graphic VRAM (B/R/G)", 0xa8000, 0xbffff, IORESOURCE_BUSY };
static struct resource gvram_e_resource = { "Graphic VRAM (E)", 0xe0000, 0xe7fff, IORESOURCE_BUSY };
/* System ROM resources */
#define MAXROMS 6
static struct resource rom_resources[MAXROMS] = {
{ "System ROM", 0xe8000, 0xfffff, IORESOURCE_BUSY }
};
void __init probe_roms(void)
{
int i;
__u8 *xrom_id;
int roms = 1;
request_resource(&iomem_resource, rom_resources+0);
xrom_id = (__u8 *) isa_bus_to_virt(PC9800SCA_XROM_ID + 0x10);
for (i = 0; i < 16; i++) {
if (xrom_id[i] & 0x80) {
int j;
for (j = i + 1; j < 16 && (xrom_id[j] & 0x80); j++)
;
rom_resources[roms].start = 0x0d0000 + i * 0x001000;
rom_resources[roms].end = 0x0d0000 + j * 0x001000 - 1;
rom_resources[roms].name = "Extension ROM";
rom_resources[roms].flags = IORESOURCE_BUSY;
request_resource(&iomem_resource,
rom_resources + roms);
if (++roms >= MAXROMS)
return;
}
}
}
void __init request_graphics_resource(void)
{
int i;
if (PC9800_HIGHRESO_P()) {
tvram_resource.start = 0xe0000;
tvram_resource.end = 0xe4fff;
gvram_brg_resource.name = "Graphic VRAM";
gvram_brg_resource.start = 0xc0000;
gvram_brg_resource.end = 0xdffff;
}
request_resource(&iomem_resource, &tvram_resource);
request_resource(&iomem_resource, &gvram_brg_resource);
if (!PC9800_HIGHRESO_P())
request_resource(&iomem_resource, &gvram_e_resource);
if (PC9800_HIGHRESO_P() || PC9800_9821_P()) {
static char graphics[] = "graphics";
static struct resource graphics_resources[] = {
{ graphics, 0x9a0, 0x9a0, 0 },
{ graphics, 0x9a2, 0x9a2, 0 },
{ graphics, 0x9a4, 0x9a4, 0 },
{ graphics, 0x9a6, 0x9a6, 0 },
{ graphics, 0x9a8, 0x9a8, 0 },
{ graphics, 0x9aa, 0x9aa, 0 },
{ graphics, 0x9ac, 0x9ac, 0 },
{ graphics, 0x9ae, 0x9ae, 0 },
};
#define GRAPHICS_RESOURCES (sizeof(graphics_resources)/sizeof(struct resource))
for (i = 0; i < GRAPHICS_RESOURCES; i++)
request_resource(&ioport_resource, graphics_resources + i);
}
}
void __init request_standard_io_resources(void)
{
int i;
for (i = 0; i < STANDARD_IO_RESOURCES; i++)
request_resource(&ioport_resource, standard_io_resources+i);
}
/*
* arch/i386/mach-pc9800/topology.c - Populate driverfs with topology information
*
* Written by: Matthew Dobson, IBM Corporation
* Original Code: Paul Dorwin, IBM Corporation, Patrick Mochel, OSDL
*
* Copyright (C) 2002, IBM Corp.
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
* NON INFRINGEMENT. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Modify for PC-9800 by Osamu Tomita <tomita@cinet.co.jp>
*
*/
#include <linux/init.h>
#include <linux/smp.h>
#include <asm/cpu.h>
struct i386_cpu cpu_devices[NR_CPUS];
static int __init topology_init(void)
{
int i;
for (i = 0; i < NR_CPUS; i++)
if (cpu_possible(i)) arch_register_cpu(i);
return 0;
}
subsys_initcall(topology_init);
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* ide_pc9800.c
*
* Copyright (C) 1997-2000 Linux/98 project,
* Kyoto University Microcomputer Club.
*/
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/ioport.h>
#include <linux/ide.h>
#include <linux/init.h>
#include <asm/io.h>
#include <asm/pc9800.h>
#define PC9800_IDE_BANKSELECT 0x432
#undef PC9800_IDE_DEBUG
static void pc9800_select(ide_drive_t *drive)
{
#ifdef PC9800_IDE_DEBUG
byte old;
/* Too noisy: */
/* printk(KERN_DEBUG "pc9800_select(%s)\n", drive->name); */
outb(0x80, PC9800_IDE_BANKSELECT);
old = inb(PC9800_IDE_BANKSELECT);
if (old != HWIF(drive)->index)
printk(KERN_DEBUG "ide-pc9800: switching bank #%d -> #%d\n",
old, HWIF(drive)->index);
#endif
outb(HWIF(drive)->index, PC9800_IDE_BANKSELECT);
}
void __init ide_probe_for_pc9800(void)
{
u8 saved_bank;
if (!PC9800_9821_P() /* || !PC9821_IDEIF_DOUBLE_P() */)
return;
if (!request_region(PC9800_IDE_BANKSELECT, 1, "ide0/1 bank")) {
printk(KERN_ERR
"ide: bank select port (%#x) is already occupied!\n",
PC9800_IDE_BANKSELECT);
return;
}
/* Do actual probing. */
if ((saved_bank = inb(PC9800_IDE_BANKSELECT)) == (u8) ~0
|| (outb(saved_bank ^ 1, PC9800_IDE_BANKSELECT),
/* Next outb is dummy for reading status. */
outb(0x80, PC9800_IDE_BANKSELECT),
inb(PC9800_IDE_BANKSELECT) != (saved_bank ^ 1))) {
printk(KERN_INFO
"ide: pc9800 type bank selecting port not found\n");
release_region(PC9800_IDE_BANKSELECT, 1);
return;
}
/* Restore original value, just in case. */
outb(saved_bank, PC9800_IDE_BANKSELECT);
/* These ports are reseved by IDE I/F. */
if (!request_region(0x430, 1, "ide") ||
!request_region(0x435, 1, "ide")) {
printk(KERN_WARNING
"ide: IO port 0x430 and 0x435 are reserved for IDE"
" the card using these ports may not work\n");
}
if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET] == HD_DATA &&
ide_hwifs[1].io_ports[IDE_DATA_OFFSET] == HD_DATA) {
ide_hwifs[0].chipset = ide_pc9800;
ide_hwifs[0].mate = &ide_hwifs[1];
ide_hwifs[0].selectproc = pc9800_select;
ide_hwifs[1].chipset = ide_pc9800;
ide_hwifs[1].mate = &ide_hwifs[0];
ide_hwifs[1].selectproc = pc9800_select;
}
}
/*
* drivers/input/keyboard/98kbd.c
*
* PC-9801 keyboard driver for Linux
*
* Based on atkbd.c and xtkbd.c written by Vojtech Pavlik
*
* Copyright (c) 2002 Osamu Tomita
* Copyright (c) 1999-2001 Vojtech Pavlik
*/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/input.h>
#include <linux/init.h>
#include <linux/serio.h>
#include <asm/io.h>
#include <asm/pc9800.h>
MODULE_AUTHOR("Osamu Tomita <tomita@cinet.co.jp>");
MODULE_DESCRIPTION("PC-9801 keyboard driver");
MODULE_LICENSE("GPL");
#define KBD98_KEY 0x7f
#define KBD98_RELEASE 0x80
static unsigned char kbd98_keycode[256] = {
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 43, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 41, 26, 28, 30, 31, 32,
33, 34, 35, 36, 37, 38, 39, 40, 27, 44, 45, 46, 47, 48, 49, 50,
51, 52, 53, 12, 57, 92,109,104,110,111,103,105,106,108,102,107,
74, 98, 71, 72, 73, 55, 75, 76, 77, 78, 79, 80, 81,117, 82,121,
83, 94, 87, 88,183,184,185, 0, 0, 0, 0, 0, 0, 0,102, 0,
99,133, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 0, 0, 0, 0,
54, 58, 42, 56, 29
};
struct jis_kbd_conv {
unsigned char scancode;
struct {
unsigned char shift;
unsigned char keycode;
} emul[2];
};
static struct jis_kbd_conv kbd98_jis[] = {
{0x02, {{0, 3}, {1, 40}}},
{0x06, {{0, 7}, {1, 8}}},
{0x07, {{0, 8}, {0, 40}}},
{0x08, {{0, 9}, {1, 10}}},
{0x09, {{0, 10}, {1, 11}}},
{0x0a, {{0, 11}, {1, 255}}},
{0x0b, {{0, 12}, {0, 13}}},
{0x0c, {{1, 7}, {0, 41}}},
{0x1a, {{1, 3}, {1, 41}}},
{0x26, {{0, 39}, {1, 13}}},
{0x27, {{1, 39}, {1, 9}}},
{0x33, {{0, 255}, {1, 12}}},
{0xff, {{0, 255}, {1, 255}}} /* terminater */
};
#define KBD98_CMD_SETEXKEY 0x1095 /* Enable/Disable Windows, Appli key */
#define KBD98_CMD_SETRATE 0x109c /* Set typematic rate */
#define KBD98_CMD_SETLEDS 0x109d /* Set keyboard leds */
#define KBD98_CMD_GETLEDS 0x119d /* Get keyboard leds */
#define KBD98_CMD_GETID 0x019f
#define KBD98_RET_ACK 0xfa
#define KBD98_RET_NAK 0xfc /* Command NACK, send the cmd again */
#define KBD98_KEY_JIS_EMUL 253
#define KBD98_KEY_UNKNOWN 254
#define KBD98_KEY_NULL 255
static char *kbd98_name = "PC-9801 Keyboard";
struct kbd98 {
unsigned char keycode[256];
struct input_dev dev;
struct serio *serio;
char phys[32];
unsigned char cmdbuf[4];
unsigned char cmdcnt;
signed char ack;
unsigned char shift;
struct {
unsigned char scancode;
unsigned char keycode;
} emul;
struct jis_kbd_conv jis[16];
};
irqreturn_t kbd98_interrupt(struct serio *serio, unsigned char data,
unsigned int flags, struct pt_regs *regs)
{
struct kbd98 *kbd98 = serio->private;
unsigned char scancode, keycode;
int press, i;
switch (data) {
case KBD98_RET_ACK:
kbd98->ack = 1;
goto out;
case KBD98_RET_NAK:
kbd98->ack = -1;
goto out;
}
if (kbd98->cmdcnt) {
kbd98->cmdbuf[--kbd98->cmdcnt] = data;
goto out;
}
scancode = data & KBD98_KEY;
keycode = kbd98->keycode[scancode];
press = !(data & KBD98_RELEASE);
if (kbd98->emul.scancode != KBD98_KEY_UNKNOWN
&& scancode != kbd98->emul.scancode) {
input_report_key(&kbd98->dev, kbd98->emul.keycode, 0);
kbd98->emul.scancode = KBD98_KEY_UNKNOWN;
}
if (keycode == KEY_RIGHTSHIFT)
kbd98->shift = press;
switch (keycode) {
case KEY_2:
case KEY_6:
case KEY_7:
case KEY_8:
case KEY_9:
case KEY_0:
case KEY_MINUS:
case KEY_EQUAL:
case KEY_GRAVE:
case KEY_SEMICOLON:
case KEY_APOSTROPHE:
/* emulation: JIS keyboard to US101 keyboard */
i = 0;
while (kbd98->jis[i].scancode != 0xff) {
if (scancode == kbd98->jis[i].scancode)
break;
i ++;
}
keycode = kbd98->jis[i].emul[kbd98->shift].keycode;
if (keycode == KBD98_KEY_NULL)
break;
if (press) {
kbd98->emul.scancode = scancode;
kbd98->emul.keycode = keycode;
if (kbd98->jis[i].emul[kbd98->shift].shift
!= kbd98->shift)
input_report_key(&kbd98->dev,
KEY_RIGHTSHIFT,
!(kbd98->shift));
}
input_report_key(&kbd98->dev, keycode, press);
if (!press) {
if (kbd98->jis[i].emul[kbd98->shift].shift
!= kbd98->shift)
input_report_key(&kbd98->dev,
KEY_RIGHTSHIFT,
kbd98->shift);
kbd98->emul.scancode = KBD98_KEY_UNKNOWN;
}
input_sync(&kbd98->dev);
break;
case KEY_CAPSLOCK:
input_report_key(&kbd98->dev, keycode, 1);
input_sync(&kbd98->dev);
input_report_key(&kbd98->dev, keycode, 0);
input_sync(&kbd98->dev);
break;
case KBD98_KEY_NULL:
break;
case 0:
printk(KERN_WARNING "kbd98.c: Unknown key (scancode %#x) %s.\n",
data & KBD98_KEY, data & KBD98_RELEASE ? "released" : "pressed");
break;
default:
input_report_key(&kbd98->dev, keycode, press);
input_sync(&kbd98->dev);
break;
}
out:
return IRQ_HANDLED;
}
/*
* kbd98_sendbyte() sends a byte to the keyboard, and waits for
* acknowledge. It doesn't handle resends according to the keyboard
* protocol specs, because if these are needed, the keyboard needs
* replacement anyway, and they only make a mess in the protocol.
*/
static int kbd98_sendbyte(struct kbd98 *kbd98, unsigned char byte)
{
int timeout = 10000; /* 100 msec */
kbd98->ack = 0;
if (serio_write(kbd98->serio, byte))
return -1;
while (!kbd98->ack && timeout--) udelay(10);
return -(kbd98->ack <= 0);
}
/*
* kbd98_command() sends a command, and its parameters to the keyboard,
* then waits for the response and puts it in the param array.
*/
static int kbd98_command(struct kbd98 *kbd98, unsigned char *param, int command)
{
int timeout = 50000; /* 500 msec */
int send = (command >> 12) & 0xf;
int receive = (command >> 8) & 0xf;
int i;
kbd98->cmdcnt = receive;
if (command & 0xff)
if (kbd98_sendbyte(kbd98, command & 0xff))
return (kbd98->cmdcnt = 0) - 1;
for (i = 0; i < send; i++)
if (kbd98_sendbyte(kbd98, param[i]))
return (kbd98->cmdcnt = 0) - 1;
while (kbd98->cmdcnt && timeout--) udelay(10);
if (param)
for (i = 0; i < receive; i++)
param[i] = kbd98->cmdbuf[(receive - 1) - i];
if (kbd98->cmdcnt)
return (kbd98->cmdcnt = 0) - 1;
return 0;
}
/*
* Event callback from the input module. Events that change the state of
* the hardware are processed here.
*/
static int kbd98_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
{
struct kbd98 *kbd98 = dev->private;
char param[2];
switch (type) {
case EV_LED:
if (__PC9800SCA_TEST_BIT(0x481, 3)) {
/* 98note with Num Lock key */
/* keep Num Lock status */
*param = 0x60;
if (kbd98_command(kbd98, param,
KBD98_CMD_GETLEDS))
printk(KERN_DEBUG
"kbd98: Get keyboard LED"
" status Error\n");
*param &= 1;
} else {
/* desktop PC-9801 */
*param = 1; /* Always set Num Lock */
}
*param |= 0x70
| (test_bit(LED_CAPSL, dev->led) ? 4 : 0)
| (test_bit(LED_KANA, dev->led) ? 8 : 0);
kbd98_command(kbd98, param, KBD98_CMD_SETLEDS);
return 0;
}
return -1;
}
void kbd98_connect(struct serio *serio, struct serio_dev *dev)
{
struct kbd98 *kbd98;
int i;
if ((serio->type & SERIO_TYPE) != SERIO_PC9800)
return;
if (!(kbd98 = kmalloc(sizeof(struct kbd98), GFP_KERNEL)))
return;
memset(kbd98, 0, sizeof(struct kbd98));
kbd98->emul.scancode = KBD98_KEY_UNKNOWN;
kbd98->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_LED) | BIT(EV_REP);
kbd98->dev.ledbit[0] = BIT(LED_NUML) | BIT(LED_CAPSL) | BIT(LED_KANA);
kbd98->serio = serio;
init_input_dev(&kbd98->dev);
kbd98->dev.keycode = kbd98->keycode;
kbd98->dev.keycodesize = sizeof(unsigned char);
kbd98->dev.keycodemax = ARRAY_SIZE(kbd98_keycode);
kbd98->dev.event = kbd98_event;
kbd98->dev.private = kbd98;
serio->private = kbd98;
if (serio_open(serio, dev)) {
kfree(kbd98);
return;
}
memcpy(kbd98->jis, kbd98_jis, sizeof(kbd98_jis));
memcpy(kbd98->keycode, kbd98_keycode, sizeof(kbd98->keycode));
for (i = 0; i < 255; i++)
set_bit(kbd98->keycode[i], kbd98->dev.keybit);
clear_bit(0, kbd98->dev.keybit);
sprintf(kbd98->phys, "%s/input0", serio->phys);
kbd98->dev.name = kbd98_name;
kbd98->dev.phys = kbd98->phys;
kbd98->dev.id.bustype = BUS_XTKBD;
kbd98->dev.id.vendor = 0x0002;
kbd98->dev.id.product = 0x0001;
kbd98->dev.id.version = 0x0100;
input_register_device(&kbd98->dev);
printk(KERN_INFO "input: %s on %s\n", kbd98_name, serio->phys);
}
void kbd98_disconnect(struct serio *serio)
{
struct kbd98 *kbd98 = serio->private;
input_unregister_device(&kbd98->dev);
serio_close(serio);
kfree(kbd98);
}
struct serio_dev kbd98_dev = {
.interrupt = kbd98_interrupt,
.connect = kbd98_connect,
.disconnect = kbd98_disconnect
};
int __init kbd98_init(void)
{
serio_register_device(&kbd98_dev);
return 0;
}
void __exit kbd98_exit(void)
{
serio_unregister_device(&kbd98_dev);
}
module_init(kbd98_init);
module_exit(kbd98_exit);
/*
* PC-9800 Speaker beeper driver for Linux
*
* Copyright (c) 2002 Osamu Tomita
* Copyright (c) 2002 Vojtech Pavlik
* Copyright (c) 1992 Orest Zborowski
*
*/
/*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/input.h>
#include <asm/8253pit.h>
#include <asm/io.h>
MODULE_AUTHOR("Osamu Tomita <tomita@cinet.co.jp>");
MODULE_DESCRIPTION("PC-9800 Speaker beeper driver");
MODULE_LICENSE("GPL");
static char spkr98_name[] = "PC-9801 Speaker";
static char spkr98_phys[] = "isa3fdb/input0";
static struct input_dev spkr98_dev;
spinlock_t i8253_beep_lock = SPIN_LOCK_UNLOCKED;
static int spkr98_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
{
unsigned int count = 0;
unsigned long flags;
if (type != EV_SND)
return -1;
switch (code) {
case SND_BELL: if (value) value = 1000;
case SND_TONE: break;
default: return -1;
}
if (value > 20 && value < 32767)
count = PIT_TICK_RATE / value;
spin_lock_irqsave(&i8253_beep_lock, flags);
if (count) {
outb(0x76, 0x3fdf);
outb(0, 0x5f);
outb(count & 0xff, 0x3fdb);
outb(0, 0x5f);
outb((count >> 8) & 0xff, 0x3fdb);
/* beep on */
outb(6, 0x37);
} else {
/* beep off */
outb(7, 0x37);
}
spin_unlock_irqrestore(&i8253_beep_lock, flags);
return 0;
}
static int __init spkr98_init(void)
{
spkr98_dev.evbit[0] = BIT(EV_SND);
spkr98_dev.sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE);
spkr98_dev.event = spkr98_event;
spkr98_dev.name = spkr98_name;
spkr98_dev.phys = spkr98_phys;
spkr98_dev.id.bustype = BUS_ISA;
spkr98_dev.id.vendor = 0x001f;
spkr98_dev.id.product = 0x0001;
spkr98_dev.id.version = 0x0100;
input_register_device(&spkr98_dev);
printk(KERN_INFO "input: %s\n", spkr98_name);
return 0;
}
static void __exit spkr98_exit(void)
{
input_unregister_device(&spkr98_dev);
}
module_init(spkr98_init);
module_exit(spkr98_exit);
/*
*
* Copyright (c) 2002 Osamu Tomita
*
* Based on the work of:
* James Banks Matthew Dillon
* David Giller Nathan Laredo
* Linus Torvalds Johan Myreen
* Cliff Matthews Philip Blundell
* Russell King Vojtech Pavlik
*/
/*
* NEC PC-9801 Bus Mouse Driver for Linux
*/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <linux/config.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/delay.h>
#include <linux/ioport.h>
#include <linux/init.h>
#include <linux/input.h>
#include <linux/interrupt.h>
#include <asm/io.h>
#include <asm/irq.h>
MODULE_AUTHOR("Osamu Tomita <tomita@cinet.co.jp>");
MODULE_DESCRIPTION("PC-9801 busmouse driver");
MODULE_LICENSE("GPL");
#define PC98BM_BASE 0x7fd9
#define PC98BM_DATA_PORT PC98BM_BASE + 0
/* PC98BM_SIGNATURE_PORT does not exist */
#define PC98BM_CONTROL_PORT PC98BM_BASE + 4
/* PC98BM_INTERRUPT_PORT does not exist */
#define PC98BM_CONFIG_PORT PC98BM_BASE + 6
#define PC98BM_ENABLE_IRQ 0x00
#define PC98BM_DISABLE_IRQ 0x10
#define PC98BM_READ_X_LOW 0x80
#define PC98BM_READ_X_HIGH 0xa0
#define PC98BM_READ_Y_LOW 0xc0
#define PC98BM_READ_Y_HIGH 0xe0
#define PC98BM_DEFAULT_MODE 0x93
/* PC98BM_CONFIG_BYTE is not used */
/* PC98BM_SIGNATURE_BYTE is not used */
#define PC98BM_TIMER_PORT 0xbfdb
#define PC98BM_DEFAULT_TIMER_VAL 0x00
#define PC98BM_IRQ 13
static int pc98bm_irq = PC98BM_IRQ;
module_param_named(irq, pc98bm_irq, uint, 0);
MODULE_PARM_DESC(irq, "IRQ number (13=default)");
__obsolete_setup("pc98bm_irq=");
static int pc98bm_used = 0;
static irqreturn_t pc98bm_interrupt(int irq, void *dev_id, struct pt_regs *regs);
static int pc98bm_open(struct input_dev *dev)
{
if (pc98bm_used++)
return 0;
if (request_irq(pc98bm_irq, pc98bm_interrupt, 0, "98busmouse", NULL)) {
pc98bm_used--;
printk(KERN_ERR "98busmouse.c: Can't allocate irq %d\n", pc98bm_irq);
return -EBUSY;
}
outb(PC98BM_ENABLE_IRQ, PC98BM_CONTROL_PORT);
return 0;
}
static void pc98bm_close(struct input_dev *dev)
{
if (--pc98bm_used)
return;
outb(PC98BM_DISABLE_IRQ, PC98BM_CONTROL_PORT);
free_irq(pc98bm_irq, NULL);
}
static struct input_dev pc98bm_dev = {
.evbit = { BIT(EV_KEY) | BIT(EV_REL) },
.keybit = { [LONG(BTN_LEFT)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT) },
.relbit = { BIT(REL_X) | BIT(REL_Y) },
.open = pc98bm_open,
.close = pc98bm_close,
.name = "PC-9801 bus mouse",
.phys = "isa7fd9/input0",
.id = {
.bustype = BUS_ISA,
.vendor = 0x0004,
.product = 0x0001,
.version = 0x0100,
},
};
static irqreturn_t pc98bm_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
char dx, dy;
unsigned char buttons;
outb(PC98BM_READ_X_LOW, PC98BM_CONTROL_PORT);
dx = (inb(PC98BM_DATA_PORT) & 0xf);
outb(PC98BM_READ_X_HIGH, PC98BM_CONTROL_PORT);
dx |= (inb(PC98BM_DATA_PORT) & 0xf) << 4;
outb(PC98BM_READ_Y_LOW, PC98BM_CONTROL_PORT);
dy = (inb(PC98BM_DATA_PORT) & 0xf);
outb(PC98BM_READ_Y_HIGH, PC98BM_CONTROL_PORT);
buttons = inb(PC98BM_DATA_PORT);
dy |= (buttons & 0xf) << 4;
buttons = ~buttons >> 5;
input_report_rel(&pc98bm_dev, REL_X, dx);
input_report_rel(&pc98bm_dev, REL_Y, dy);
input_report_key(&pc98bm_dev, BTN_RIGHT, buttons & 1);
input_report_key(&pc98bm_dev, BTN_MIDDLE, buttons & 2);
input_report_key(&pc98bm_dev, BTN_LEFT, buttons & 4);
input_sync(&pc98bm_dev);
outb(PC98BM_ENABLE_IRQ, PC98BM_CONTROL_PORT);
return IRQ_HANDLED;
}
static int __init pc98bm_init(void)
{
int i;
for (i = 0; i <= 6; i += 2) {
if (!request_region(PC98BM_BASE + i, 1, "98busmouse")) {
printk(KERN_ERR "98busmouse.c: Can't allocate ports at %#x\n", PC98BM_BASE + i);
while (i > 0) {
i -= 2;
release_region(PC98BM_BASE + i, 1);
}
return -EBUSY;
}
}
if (!request_region(PC98BM_TIMER_PORT, 1, "98busmouse")) {
printk(KERN_ERR "98busmouse.c: Can't allocate ports at %#x\n", PC98BM_TIMER_PORT);
for (i = 0; i <= 6; i += 2)
release_region(PC98BM_BASE + i, 1);
return -EBUSY;
}
outb(PC98BM_DEFAULT_MODE, PC98BM_CONFIG_PORT);
outb(PC98BM_DISABLE_IRQ, PC98BM_CONTROL_PORT);
outb(PC98BM_DEFAULT_TIMER_VAL, PC98BM_TIMER_PORT);
input_register_device(&pc98bm_dev);
printk(KERN_INFO "input: PC-9801 bus mouse at %#x irq %d\n", PC98BM_BASE, pc98bm_irq);
return 0;
}
static void __exit pc98bm_exit(void)
{
int i;
input_unregister_device(&pc98bm_dev);
for (i = 0; i <= 6; i += 2)
release_region(PC98BM_BASE + i, 1);
release_region(PC98BM_TIMER_PORT, 1);
}
module_init(pc98bm_init);
module_exit(pc98bm_exit);
/*
* NEC PC-9801 keyboard controller driver for Linux
*
* Copyright (c) 1999-2002 Osamu Tomita <tomita@cinet.co.jp>
* Based on i8042.c written by Vojtech Pavlik
*/
/*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*/
#include <linux/config.h>
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/ioport.h>
#include <linux/init.h>
#include <linux/serio.h>
#include <linux/sched.h>
#include <asm/io.h>
MODULE_AUTHOR("Osamu Tomita <tomita@cinet.co.jp>");
MODULE_DESCRIPTION("NEC PC-9801 keyboard controller driver");
MODULE_LICENSE("GPL");
/*
* Names.
*/
#define KBD98_PHYS_DESC "isa0041/serio0"
/*
* IRQs.
*/
#define KBD98_IRQ 1
/*
* Register numbers.
*/
#define KBD98_COMMAND_REG 0x43
#define KBD98_STATUS_REG 0x43
#define KBD98_DATA_REG 0x41
spinlock_t kbd98io_lock = SPIN_LOCK_UNLOCKED;
static struct serio kbd98_port;
extern struct pt_regs *kbd_pt_regs;
static irqreturn_t kbd98io_interrupt(int irq, void *dev_id, struct pt_regs *regs);
/*
* kbd98_flush() flushes all data that may be in the keyboard buffers
*/
static int kbd98_flush(void)
{
unsigned long flags;
spin_lock_irqsave(&kbd98io_lock, flags);
while (inb(KBD98_STATUS_REG) & 0x02) /* RxRDY */
inb(KBD98_DATA_REG);
if (inb(KBD98_STATUS_REG) & 0x38)
printk("98kbd-io: Keyboard error!\n");
spin_unlock_irqrestore(&kbd98io_lock, flags);
return 0;
}
/*
* kbd98_write() sends a byte out through the keyboard interface.
*/
static int kbd98_write(struct serio *port, unsigned char c)
{
unsigned long flags;
spin_lock_irqsave(&kbd98io_lock, flags);
outb(0, 0x5f); /* wait */
outb(0x17, KBD98_COMMAND_REG); /* enable send command */
outb(0, 0x5f); /* wait */
outb(c, KBD98_DATA_REG);
outb(0, 0x5f); /* wait */
outb(0x16, KBD98_COMMAND_REG); /* disable send command */
outb(0, 0x5f); /* wait */
spin_unlock_irqrestore(&kbd98io_lock, flags);
return 0;
}
/*
* kbd98_open() is called when a port is open by the higher layer.
* It allocates the interrupt and enables in in the chip.
*/
static int kbd98_open(struct serio *port)
{
kbd98_flush();
if (request_irq(KBD98_IRQ, kbd98io_interrupt, 0, "kbd98", NULL)) {
printk(KERN_ERR "98kbd-io.c: Can't get irq %d for %s, unregistering the port.\n", KBD98_IRQ, "KBD");
serio_unregister_port(port);
return -1;
}
return 0;
}
static void kbd98_close(struct serio *port)
{
free_irq(KBD98_IRQ, NULL);
kbd98_flush();
}
/*
* Structures for registering the devices in the serio.c module.
*/
static struct serio kbd98_port =
{
.type = SERIO_PC9800,
.write = kbd98_write,
.open = kbd98_open,
.close = kbd98_close,
.driver = NULL,
.name = "PC-9801 Kbd Port",
.phys = KBD98_PHYS_DESC,
};
/*
* kbd98io_interrupt() is the most important function in this driver -
* it handles the interrupts from keyboard, and sends incoming bytes
* to the upper layers.
*/
static irqreturn_t kbd98io_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
unsigned long flags;
unsigned char data;
spin_lock_irqsave(&kbd98io_lock, flags);
data = inb(KBD98_DATA_REG);
spin_unlock_irqrestore(&kbd98io_lock, flags);
serio_interrupt(&kbd98_port, data, 0, regs);
return IRQ_HANDLED;
}
int __init kbd98io_init(void)
{
serio_register_port(&kbd98_port);
printk(KERN_INFO "serio: PC-9801 %s port at %#lx,%#lx irq %d\n",
"KBD",
(unsigned long) KBD98_DATA_REG,
(unsigned long) KBD98_COMMAND_REG,
KBD98_IRQ);
return 0;
}
void __exit kbd98io_exit(void)
{
serio_unregister_port(&kbd98_port);
}
module_init(kbd98io_init);
module_exit(kbd98io_exit);
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
*
* drivers/scsi/pc980155.h
*
* PC-9801-55 SCSI host adapter driver
*
* Copyright (C) 1997-2003 Kyoto University Microcomputer Club
* (Linux/98 project)
* Tomoharu Ugawa <ohirune@kmc.gr.jp>
*
*/
#ifndef __PC980155_H
#define __PC980155_H
#include "wd33c93.h"
#define REG_ADDRST (base_io)
#define REG_CONTRL (base_io + 2)
#define REG_CWRITE (base_io + 4)
#define REG_STATRD (base_io + 4)
#define WD_MEMORYBANK 0x30
#define WD_RESETINT 0x33
static inline uchar read_pc980155(const wd33c93_regs regs, uchar reg_num)
{
outb(reg_num, regs.SASR);
return (uchar)inb(regs.SCMD);
}
static inline void write_memorybank(const wd33c93_regs regs, uchar value)
{
outb(WD_MEMORYBANK, regs.SASR);
outb(value, regs.SCMD);
}
#define read_pc980155_resetint(regs) \
read_pc980155((regs), WD_RESETINT)
#define pc980155_int_enable(regs) \
write_memorybank((regs), read_pc980155((regs), WD_MEMORYBANK) | 0x04)
#define pc980155_int_disable(regs) \
write_memorybank((regs), read_pc980155((regs), WD_MEMORYBANK) & ~0x04)
#define pc980155_assert_bus_reset(regs) \
write_memorybank((regs), read_pc980155((regs), WD_MEMORYBANK) | 0x02)
#define pc980155_negate_bus_reset(regs) \
write_memorybank((regs), read_pc980155((regs), WD_MEMORYBANK) & ~0x02)
#endif /* __PC980155_H */
/*
* Copyright (C) 2003 Osamu Tomita <tomita@cinet.co.jp>
*
* PC9801 BIOS geometry handling.
*/
#include <linux/module.h>
#include <linux/fs.h>
#include <linux/kernel.h>
#include <linux/genhd.h>
#include <linux/blkdev.h>
#include <asm/pc9800.h>
#include "scsi.h"
#include "hosts.h"
static int pc98_first_bios_param(struct scsi_device *sdev, int *ip)
{
const u8 *p = (&__PC9800SCA(u8, PC9800SCA_SCSI_PARAMS) + sdev->id * 4);
ip[0] = p[1]; /* # of heads */
ip[1] = p[0]; /* # of sectors/track */
ip[2] = *(u16 *)&p[2] & 0x0fff; /* # of cylinders */
if (p[3] & (1 << 6)) { /* #-of-cylinders is 16-bit */
ip[2] |= (ip[0] & 0xf0) << 8;
ip[0] &= 0x0f;
}
return 0;
}
int pc98_bios_param(struct scsi_device *sdev, struct block_device *bdev,
sector_t capacity, int *ip)
{
struct Scsi_Host *first_real = first_real_host();
/*
* XXX
* XXX This needs to become a sysfs attribute that's set
* XXX by code that knows which host is the first one.
* XXX
* XXX Currently we support only one host on with a
* XXX PC98ish HBA.
* XXX
*/
if (1 || sdev->host == first_real && sdev->id < 7 &&
__PC9800SCA_TEST_BIT(PC9800SCA_DISK_EQUIPS, sdev->id))
return pc98_first_bios_param(sdev, ip);
/* Assume PC-9801-92 compatible parameters for HAs without BIOS. */
ip[0] = 8;
ip[1] = 32;
ip[2] = capacity / (8 * 32);
if (ip[2] > 65535) { /* if capacity >= 8GB */
/* Recent on-board adapters seem to use this parameter. */
ip[1] = 128;
ip[2] = capacity / (8 * 128);
if (ip[2] > 65535) { /* if capacity >= 32GB */
/* Clip the number of cylinders. Currently
this is the limit that we deal with. */
ip[2] = 65535;
}
}
return 0;
}
EXPORT_SYMBOL(pc98_bios_param);
This diff is collapsed.
This diff is collapsed.
/*
* NEC PC-9800 series partition supports
*
* Copyright (C) 1998-2000 Kyoto University Microcomputer Club
*/
#define NEC98_PTABLE_MAGIC 0xAA55
extern int nec98_partition(struct parsed_partitions *state,
struct block_device *bdev);
This diff is collapsed.
#ifndef _MACH_BIOS_EBDA_H
#define _MACH_BIOS_EBDA_H
/*
* PC-9800 has no EBDA.
* Its BIOS uses 0x40E for other purpose,
* Not pointer to 4K EBDA area.
*/
static inline unsigned int get_bios_ebda(void)
{
return 0; /* 0 means none */
}
#endif /* _MACH_BIOS_EBDA_H */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment