Initial revision
This commit is contained in:
55
include/ibm/bios.h
Normal file
55
include/ibm/bios.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/* BIOS definitions. Each BIOS entry has an index that is to be used with the
|
||||
* sys_bioscopy() system call. The raw addresses, sizes, and magic numbers
|
||||
* are defined here as well. The values that are defined here were collected
|
||||
* from various kernel files in MINIX 2.0.4.
|
||||
*
|
||||
* Author: Jorrit N. Herder
|
||||
*/
|
||||
|
||||
#ifndef _BIOS_H
|
||||
#define _BIOS_H
|
||||
|
||||
/* Memory check (is stopped on reboot). */
|
||||
#define BIOS_MEM_CHECK 0 /* address to stop memory check */
|
||||
#define ADR_MEM_CHECK 0x472L
|
||||
#define LEN_MEM_CHECK 1L
|
||||
#define STOP_MEM_CHECK 0x1234 /* magic number to stop memory check */
|
||||
|
||||
/* Centronics printers. */
|
||||
#define BIOS_PRN_PORTBASE 1 /* base of printer ports */
|
||||
#define ADR_PRN_PORTBASE 0x408L
|
||||
#define LEN_PRN_PORTBASE 2L
|
||||
|
||||
/* Hard disk parameter vectors. */
|
||||
#define BIOS_WINI_PARAMS 2 /* number of hard disk drives */
|
||||
#define ADR_WINI_PARAMS 0x475L
|
||||
#define LEN_WINI_PARAMS 1L
|
||||
#define BIOS_WINI_0_PARM_VEC 3 /* disk 0 parameters */
|
||||
#define ADR_WINI_0_PARM_VEC 0x41*4L
|
||||
#define LEN_WINI_0_PARM_VEC 4L
|
||||
#define BIOS_WINI_1_PARM_VEC 4 /* disk 1 parameters */
|
||||
#define ADR_WINI_1_PARM_VEC 0x46*4L
|
||||
#define LEN_WINI_1_PARM_VEC 4L
|
||||
|
||||
/* Video controller (VDU). */
|
||||
#define BIOS_VDU_COLUMNS 5
|
||||
#define ADR_VDU_COLUMNS 0x44AL
|
||||
#define LEN_VDU_COLUMNS 2L
|
||||
#define BIOS_VDU_CRTBASE 6
|
||||
#define ADR_VDU_CRTBASE 0x463L
|
||||
#define LEN_VDU_CRTBASE 2L
|
||||
#define BIOS_VDU_ROWS 7
|
||||
#define ADR_VDU_ROWS 0x484L
|
||||
#define LEN_VDU_ROWS 1L
|
||||
#define BIOS_VDU_FONTLINES 8
|
||||
#define ADR_VDU_FONTLINES 0x485L
|
||||
#define LEN_VDU_FONTLINES 2L
|
||||
|
||||
/* Machine ID. */
|
||||
#define BIOS_MACHINE_ID 9
|
||||
#define ADR_MACHINE_ID 0xFFFFEL
|
||||
#define LEN_MACHINE_ID 1L
|
||||
#define PS_386_MACHINE 0xF8 /* Machine ID byte for PS/2 model 80 */
|
||||
#define PC_AT_MACHINE 0xFC /* PC/AT, PC/XT286, PS/2 models 50/60 */
|
||||
|
||||
#endif /* _BIOS_H */
|
||||
86
include/ibm/cmos.h
Executable file
86
include/ibm/cmos.h
Executable file
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
ibm/cmos.h
|
||||
|
||||
Created: Dec 1998 by Philip Homburg <philip@cs.vu.nl>
|
||||
|
||||
Definitions for the CMOS/realtime clock. Based on the datasheet for the
|
||||
Dallas DS12887, compatible with the Motorola MC146818
|
||||
*/
|
||||
|
||||
#define RTC_INDEX 0x70 /* Bit 7 = NMI enable (1) / disable (0)
|
||||
* bits 0..6 index
|
||||
*/
|
||||
#define RTC_IO 0x71 /* Data register,
|
||||
* Note: the operation following a write to
|
||||
* RTC_INDEX should an access (read or write)
|
||||
* to RTC_IO
|
||||
*/
|
||||
|
||||
#define RTC_SEC 0x0 /* Seconds register */
|
||||
#define RTC_SEC_ALRM 0x1 /* Seconds register for alarm */
|
||||
#define RTC_MIN 0x2 /* Minutes register */
|
||||
#define RTC_MIN_ALRM 0x3 /* Minutes register for alarm */
|
||||
#define RTC_HOUR 0x4 /* Hours register */
|
||||
#define RTC_HOUR_ALRM 0x5 /* Hours register for alarm */
|
||||
#define RTC_WDAY 0x6 /* Day of the week, 1..7, Sunday = 1 */
|
||||
#define RTC_MDAY 0x7 /* Day of the month, 1..31 */
|
||||
#define RTC_MONTH 0x8 /* Month, 1..12 */
|
||||
#define RTC_YEAR 0x9 /* Year, 0..99 */
|
||||
#define RTC_REG_A 0xA
|
||||
#define RTC_A_UIP 0x80 /* Update in progress. When clear,
|
||||
* no update will occur for 244
|
||||
* micro seconds.
|
||||
*/
|
||||
#define RTC_A_DV 0x70 /* Divider bits, valid values are: */
|
||||
#define RTC_A_DV_OK 0x20 /* Normal */
|
||||
#define RTC_A_DV_STOP 0x70 /* Stop, a re-start starts
|
||||
* halfway through a cycle,
|
||||
* i.e. the update occurs after
|
||||
* 500ms.
|
||||
*/
|
||||
#define RTC_A_RS 0x0F /* Int. freq */
|
||||
/* 0 None
|
||||
* 1 256 Hz
|
||||
* 2 128 Hz
|
||||
* 3 8192 Hz
|
||||
* 4 4096 Hz
|
||||
* 5 2048 Hz
|
||||
* 6 1024 Hz
|
||||
* 7 512 Hz
|
||||
* 8 256 Hz
|
||||
* 9 128 Hz
|
||||
* 10 64 Hz
|
||||
* 11 32 Hz
|
||||
* 12 16 Hz
|
||||
* 13 8 Hz
|
||||
* 14 4 Hz
|
||||
* 15 2 Hz
|
||||
*/
|
||||
#define RTC_A_RS_DEF 6 /* Default freq. */
|
||||
#define RTC_REG_B 0xB
|
||||
#define RTC_B_SET 0x80 /* Inhibit updates */
|
||||
#define RTC_B_PIE 0x40 /* Enable periodic interrupts */
|
||||
#define RTC_B_AIE 0x20 /* Enable alarm interrupts */
|
||||
#define RTC_B_UIE 0x10 /* Enable update ended interrupts */
|
||||
#define RTC_B_SQWE 0x08 /* Enable square wave output */
|
||||
#define RTC_B_DM_BCD 0x04 /* Data is in BCD (otherwise binary) */
|
||||
#define RTC_B_24 0x02 /* Count hours in 24-hour mode */
|
||||
#define RTC_B_DSE 0x01 /* Automatic (wrong) daylight savings
|
||||
* updates
|
||||
*/
|
||||
#define RTC_REG_C 0xC
|
||||
|
||||
|
||||
/* Contents of the general purpose CMOS RAM (source IBM reference manual) */
|
||||
#define CMOS_STATUS 0xE
|
||||
#define CS_LOST_POWER 0x80 /* Chip lost power */
|
||||
#define CS_BAD_CHKSUM 0x40 /* Checksum is incorrect */
|
||||
#define CS_BAD_CONFIG 0x20 /* Bad configuration info */
|
||||
#define CS_BAD_MEMSIZE 0x10 /* Wrong memory size of CMOS */
|
||||
#define CS_BAD_HD 0x08 /* Harddisk failed */
|
||||
#define CS_BAD_TIME 0x04 /* CMOS time is invalid */
|
||||
/* bits 0 and 1 are reserved */
|
||||
|
||||
/*
|
||||
* $PchId: cmos.h,v 1.1 1998/12/16 09:14:21 philip Exp $
|
||||
*/
|
||||
20
include/ibm/diskparm.h
Executable file
20
include/ibm/diskparm.h
Executable file
@@ -0,0 +1,20 @@
|
||||
/* PC (and AT) BIOS structure to hold disk parameters. Under Minix, it is
|
||||
* used mainly for formatting.
|
||||
*/
|
||||
|
||||
#ifndef _DISKPARM_H
|
||||
#define _DISKPARM_H
|
||||
struct disk_parameter_s {
|
||||
char spec1;
|
||||
char spec2;
|
||||
char motor_turnoff_sec;
|
||||
char sector_size_code;
|
||||
char sectors_per_cylinder;
|
||||
char gap_length;
|
||||
char dtl;
|
||||
char gap_length_for_format;
|
||||
char fill_byte_for_format;
|
||||
char head_settle_msec;
|
||||
char motor_start_eigth_sec;
|
||||
};
|
||||
#endif /* _DISKPARM_H */
|
||||
63
include/ibm/int86.h
Executable file
63
include/ibm/int86.h
Executable file
@@ -0,0 +1,63 @@
|
||||
/* int86.h - 8086 interrupt types Author: Kees J. Bot
|
||||
* 3 May 2000
|
||||
*/
|
||||
|
||||
/* Registers used in an PC real mode call for BIOS or DOS services. A
|
||||
* driver is called through the vector if the interrupt number is zero.
|
||||
*/
|
||||
union reg86 {
|
||||
struct l {
|
||||
u32_t ef; /* 32 bit flags (output only) */
|
||||
u32_t vec; /* Driver vector (input only) */
|
||||
u32_t _ds_es[1];
|
||||
u32_t eax; /* 32 bit general registers */
|
||||
u32_t ebx;
|
||||
u32_t ecx;
|
||||
u32_t edx;
|
||||
u32_t esi;
|
||||
u32_t edi;
|
||||
u32_t ebp;
|
||||
} l;
|
||||
struct w {
|
||||
u16_t f, _ef[1]; /* 16 bit flags (output only) */
|
||||
u16_t off, seg; /* Driver vector (input only) */
|
||||
u16_t ds, es; /* DS and ES real mode segment regs */
|
||||
u16_t ax, _eax[1]; /* 16 bit general registers */
|
||||
u16_t bx, _ebx[1];
|
||||
u16_t cx, _ecx[1];
|
||||
u16_t dx, _edx[1];
|
||||
u16_t si, _esi[1];
|
||||
u16_t di, _edi[1];
|
||||
u16_t bp, _ebp[1];
|
||||
} w;
|
||||
struct b {
|
||||
u8_t intno, _intno[3]; /* Interrupt number (input only) */
|
||||
u8_t _vec[4];
|
||||
u8_t _ds_es[4];
|
||||
u8_t al, ah, _eax[2]; /* 8 bit general registers */
|
||||
u8_t bl, bh, _ebx[2];
|
||||
u8_t cl, ch, _ecx[2];
|
||||
u8_t dl, dh, _edx[2];
|
||||
u8_t _esi[4];
|
||||
u8_t _edi[4];
|
||||
u8_t _ebp[4];
|
||||
} b;
|
||||
};
|
||||
|
||||
#ifdef _SYSTEM /* Kernel: Registers used in an 8086 interrupt */
|
||||
EXTERN union reg86 reg86;
|
||||
#endif
|
||||
|
||||
/* Parameters passed on ioctls to the memory task. */
|
||||
|
||||
struct mio_int86 { /* MIOCINT86 */
|
||||
union reg86 reg86; /* x86 registers as above */
|
||||
u16_t off, seg; /* Address of kernel buffer */
|
||||
void *buf; /* User data buffer */
|
||||
size_t len; /* Size of user buffer */
|
||||
};
|
||||
|
||||
struct mio_ldt86 { /* MIOCGLDT86, MIOCSLDT86 */
|
||||
size_t idx; /* Index in process' LDT */
|
||||
u16_t entry[4]; /* One LDT entry to get or set. */
|
||||
};
|
||||
62
include/ibm/interrupt.h
Normal file
62
include/ibm/interrupt.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/* Interrupt numbers and hardware vectors. */
|
||||
|
||||
#ifndef _INTERRUPT_H
|
||||
#define _INTERRUPT_H
|
||||
|
||||
#if (CHIP == INTEL)
|
||||
|
||||
/* 8259A interrupt controller ports. */
|
||||
#define INT_CTL 0x20 /* I/O port for interrupt controller */
|
||||
#define INT_CTLMASK 0x21 /* setting bits in this port disables ints */
|
||||
#define INT2_CTL 0xA0 /* I/O port for second interrupt controller */
|
||||
#define INT2_CTLMASK 0xA1 /* setting bits in this port disables ints */
|
||||
|
||||
/* Magic numbers for interrupt controller. */
|
||||
#define ENABLE 0x20 /* code used to re-enable after an interrupt */
|
||||
|
||||
|
||||
/* Interrupt vectors defined/reserved by processor. */
|
||||
#define DIVIDE_VECTOR 0 /* divide error */
|
||||
#define DEBUG_VECTOR 1 /* single step (trace) */
|
||||
#define NMI_VECTOR 2 /* non-maskable interrupt */
|
||||
#define BREAKPOINT_VECTOR 3 /* software breakpoint */
|
||||
#define OVERFLOW_VECTOR 4 /* from INTO */
|
||||
|
||||
/* Fixed system call vector. */
|
||||
#define SYS_VECTOR 32 /* system calls are made with int SYSVEC */
|
||||
#define SYS386_VECTOR 33 /* except 386 system calls use this */
|
||||
#define LEVEL0_VECTOR 34 /* for execution of a function at level 0 */
|
||||
|
||||
/* Suitable irq bases for hardware interrupts. Reprogram the 8259(s) from
|
||||
* the PC BIOS defaults since the BIOS doesn't respect all the processor's
|
||||
* reserved vectors (0 to 31).
|
||||
*/
|
||||
#define BIOS_IRQ0_VEC 0x08 /* base of IRQ0-7 vectors used by BIOS */
|
||||
#define BIOS_IRQ8_VEC 0x70 /* base of IRQ8-15 vectors used by BIOS */
|
||||
#define IRQ0_VECTOR 0x50 /* nice vectors to relocate IRQ0-7 to */
|
||||
#define IRQ8_VECTOR 0x70 /* no need to move IRQ8-15 */
|
||||
|
||||
/* Hardware interrupt numbers. */
|
||||
#define NR_IRQ_VECTORS 16
|
||||
#define CLOCK_IRQ 0
|
||||
#define KEYBOARD_IRQ 1
|
||||
#define CASCADE_IRQ 2 /* cascade enable for 2nd AT controller */
|
||||
#define ETHER_IRQ 3 /* default ethernet interrupt vector */
|
||||
#define SECONDARY_IRQ 3 /* RS232 interrupt vector for port 2 */
|
||||
#define RS232_IRQ 4 /* RS232 interrupt vector for port 1 */
|
||||
#define XT_WINI_IRQ 5 /* xt winchester */
|
||||
#define FLOPPY_IRQ 6 /* floppy disk */
|
||||
#define PRINTER_IRQ 7
|
||||
#define AT_WINI_0_IRQ 14 /* at winchester controller 0 */
|
||||
#define AT_WINI_1_IRQ 15 /* at winchester controller 1 */
|
||||
|
||||
|
||||
/* Interrupt number to hardware vector. */
|
||||
#define BIOS_VECTOR(irq) \
|
||||
(((irq) < 8 ? BIOS_IRQ0_VEC : BIOS_IRQ8_VEC) + ((irq) & 0x07))
|
||||
#define VECTOR(irq) \
|
||||
(((irq) < 8 ? IRQ0_VECTOR : IRQ8_VECTOR) + ((irq) & 0x07))
|
||||
|
||||
#endif /* (CHIP == INTEL) */
|
||||
|
||||
#endif /* _INTERRUPT_H */
|
||||
26
include/ibm/partition.h
Executable file
26
include/ibm/partition.h
Executable file
@@ -0,0 +1,26 @@
|
||||
/* Description of entry in partition table. */
|
||||
#ifndef _PARTITION_H
|
||||
#define _PARTITION_H
|
||||
|
||||
struct part_entry {
|
||||
unsigned char bootind; /* boot indicator 0/ACTIVE_FLAG */
|
||||
unsigned char start_head; /* head value for first sector */
|
||||
unsigned char start_sec; /* sector value + cyl bits for first sector */
|
||||
unsigned char start_cyl; /* track value for first sector */
|
||||
unsigned char sysind; /* system indicator */
|
||||
unsigned char last_head; /* head value for last sector */
|
||||
unsigned char last_sec; /* sector value + cyl bits for last sector */
|
||||
unsigned char last_cyl; /* track value for last sector */
|
||||
unsigned long lowsec; /* logical first sector */
|
||||
unsigned long size; /* size of partition in sectors */
|
||||
};
|
||||
|
||||
#define ACTIVE_FLAG 0x80 /* value for active in bootind field (hd0) */
|
||||
#define NR_PARTITIONS 4 /* number of entries in partition table */
|
||||
#define PART_TABLE_OFF 0x1BE /* offset of partition table in boot sector */
|
||||
|
||||
/* Partition types. */
|
||||
#define NO_PART 0x00 /* unused entry */
|
||||
#define MINIX_PART 0x81 /* Minix partition type */
|
||||
|
||||
#endif /* _PARTITION_H */
|
||||
29
include/ibm/portio.h
Executable file
29
include/ibm/portio.h
Executable file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
ibm/portio.h
|
||||
|
||||
Created: Jan 15, 1992 by Philip Homburg
|
||||
*/
|
||||
|
||||
#ifndef _PORTIO_H_
|
||||
#define _PORTIO_H_
|
||||
|
||||
#ifndef _TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
unsigned inb(U16_t _port);
|
||||
unsigned inw(U16_t _port);
|
||||
unsigned inl(U32_t _port);
|
||||
void outb(U16_t _port, U8_t _value);
|
||||
void outw(U16_t _port, U16_t _value);
|
||||
void outl(U16_t _port, U32_t _value);
|
||||
void insb(U16_t _port, void *_buf, size_t _count);
|
||||
void insw(U16_t _port, void *_buf, size_t _count);
|
||||
void insl(U16_t _port, void *_buf, size_t _count);
|
||||
void outsb(U16_t _port, void *_buf, size_t _count);
|
||||
void outsw(U16_t _port, void *_buf, size_t _count);
|
||||
void outsl(U16_t _port, void *_buf, size_t _count);
|
||||
void intr_disable(void);
|
||||
void intr_enable(void);
|
||||
|
||||
#endif /* _PORTIO_H_ */
|
||||
17
include/ibm/ports.h
Normal file
17
include/ibm/ports.h
Normal file
@@ -0,0 +1,17 @@
|
||||
/* Addresses and magic numbers for miscellaneous ports. */
|
||||
|
||||
#ifndef _PORTS_H
|
||||
#define _PORTS_H
|
||||
|
||||
#if (CHIP == INTEL)
|
||||
|
||||
/* Miscellaneous ports. */
|
||||
#define PCR 0x65 /* Planar Control Register */
|
||||
#define PORT_B 0x61 /* I/O port for 8255 port B (kbd, beeper...) */
|
||||
#define TIMER0 0x40 /* I/O port for timer channel 0 */
|
||||
#define TIMER2 0x42 /* I/O port for timer channel 2 */
|
||||
#define TIMER_MODE 0x43 /* I/O port for timer mode control */
|
||||
|
||||
#endif /* (CHIP == INTEL) */
|
||||
|
||||
#endif /* _PORTS_H */
|
||||
Reference in New Issue
Block a user