merge to NetBSD-current (DeskStation and Algor support is currently broken)
This commit is contained in:
parent
c2c3950608
commit
564df9b630
@ -1,32 +1,35 @@
|
||||
# $NetBSD: Makefile,v 1.5 2000/01/23 20:07:59 soda Exp $
|
||||
# $NetBSD: Makefile,v 1.6 2000/01/23 21:01:48 soda Exp $
|
||||
# $OpenBSD: Makefile,v 1.5 1997/05/19 10:34:53 pefo Exp $
|
||||
# from: @(#)Makefile 8.1 (Berkeley) 6/16/93
|
||||
|
||||
# Makefile for pica tags file and boot blocks
|
||||
# Makefile for arc tags file and boot blocks
|
||||
|
||||
# Find where mips source files are for inclusion in tags
|
||||
.include <../mips/Makefile.inc>
|
||||
|
||||
TPICA= ../pica/tags
|
||||
SPICA= ../pica/pica/*.[ch] ../pica/include/*.[ch] \
|
||||
../pica/dev/*.[ch] ../pica/ultrix/*.[ch]
|
||||
APICA= ../pica/pica/*.s
|
||||
TARC= ../arc/tags
|
||||
SARC= ../arc/algor/*.[ch] ../arc/arc/*.[ch] ../arc/dev/*.[ch] \
|
||||
../arc/dti/*.[ch] ../arc/include/*.h ../arc/isa/*.[ch] \
|
||||
../arc/pci/*.[ch] ../arc/pica/*.[ch]
|
||||
AARC= ../arc/arc/*.S
|
||||
|
||||
# Directories in which to place tags links
|
||||
DPICA= dev dist include pica
|
||||
DARC= algor arc dev dti include isa pci pica
|
||||
|
||||
.include "../../kern/Make.tags.inc"
|
||||
|
||||
tags:
|
||||
-ctags -wdtf ${TPICA} ${SPICA} ${SMIPS} ${COMM}
|
||||
egrep "^LEAF(.*)|^[AN]LEAF(.*)|^NON_LEAF(.*)" ${APICA} ${AMIPS} | \
|
||||
-ctags -wdtf ${TARC} ${SARC} ${SMIPS} ${COMM}
|
||||
egrep "^LEAF(.*)|^[AN]LEAF(.*)|^NON_LEAF(.*)" ${AARC} ${AMIPS} | \
|
||||
sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \
|
||||
>> ${TPICA}
|
||||
sort -o ${TPICA} ${TPICA}
|
||||
>> ${TARC}
|
||||
sort -o ${TARC} ${TARC}
|
||||
|
||||
links:
|
||||
-for i in ${DPICA}; do \
|
||||
-for i in ${DARC}; do \
|
||||
cd $$i && rm -f tags; ln -s ../tags tags; done
|
||||
|
||||
|
||||
SUBDIR= include
|
||||
SUBDIR= include stand
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
|
@ -1,37 +1,59 @@
|
||||
$NetBSD: TODO,v 1.3 2000/01/23 20:08:00 soda Exp $
|
||||
$NetBSD: TODO,v 1.4 2000/01/23 21:01:48 soda Exp $
|
||||
|
||||
To do list (not in any particular order).
|
||||
|
||||
o Improve pmap_zero_page and pmap_copy_page. Speed and flushing.
|
||||
|
||||
o Move the RO and WIRED attribute from the pte to the pv table.
|
||||
This saves four instructions in the tlb miss handler.
|
||||
InWork: Have a test version. The system hangs after a while. Not solved yet.
|
||||
Also, is it worth the effort to remove 4 instr. in TLB-miss handler?
|
||||
|
||||
o Update MAKEDEV to create all devices correctly.
|
||||
|
||||
o Boot. Standalone boot program instead of booting the kernel directly?
|
||||
|
||||
o Create boot package for distribution.
|
||||
|
||||
o sigsetjmp/siglongjmp missing....
|
||||
|
||||
o Add more videomodes to pccons driver. 50kHz and 64kHz monitors?
|
||||
InWork: This seems to be hard. Need more info on the chip.
|
||||
This seems to be hard. Need more info on the chip.
|
||||
|
||||
o Find out why bitmap load to S3-928 flashes screen.
|
||||
Know why (enable linear mode). Need S3 info.
|
||||
|
||||
o Would be nice to have Motif...
|
||||
|
||||
o ELF shared libraries......
|
||||
|
||||
o GDB. The current one does not work correctly with current toolchain.
|
||||
|
||||
o ISA driver. ISA dma, interrupt etc.
|
||||
Know why (enable linear mode). Need S3 info.
|
||||
|
||||
o Can we have 32 double registers?
|
||||
|
||||
o 64bit kernel/userland
|
||||
|
||||
o source code structure is quite obsolete,
|
||||
general clean up is needed as nisimura-san suggested.
|
||||
especially:
|
||||
|
||||
- introduce struct platform and remove ugly ``switch (cputype)''
|
||||
in many places.
|
||||
|
||||
- implement and use bus_dma
|
||||
|
||||
- clean up bus_space implementation, remove inb/outb
|
||||
|
||||
- eliminate OpenBSD compat #define symbols
|
||||
|
||||
o fix kernel start address
|
||||
|
||||
o merge new wscons
|
||||
|
||||
o parse ARC BIOS configuration information and use it
|
||||
|
||||
o fix implementation of DELAY(), clean up clock implementation
|
||||
|
||||
o if_sn.c ether address handling clean up
|
||||
|
||||
o use MI driver
|
||||
|
||||
- use MI ncr53c9x driver instead of home grown asc
|
||||
|
||||
- use MI bha driver instead of home grown btl
|
||||
|
||||
- make sonic driver MI, and share it with mac68k, newsmips/apbus
|
||||
|
||||
- make fd driver MI, and share it with i386
|
||||
(contact christos about MI fd driver)
|
||||
|
||||
- make pccons MI, and share it with i386,
|
||||
or simply eliminate pccons
|
||||
|
||||
Lots of other things.....
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* $NetBSD: algor.h,v 1.2 2000/01/23 21:01:49 soda Exp $ */
|
||||
/* $OpenBSD: algor.h,v 1.3 1997/04/19 17:19:36 pefo Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* $NetBSD: algorbus.c,v 1.2 2000/01/23 21:01:49 soda Exp $ */
|
||||
/* $OpenBSD: algorbus.c,v 1.3 1997/04/19 17:19:37 pefo Exp $ */
|
||||
|
||||
/*
|
||||
@ -38,7 +39,6 @@
|
||||
#include <sys/user.h>
|
||||
#include <sys/device.h>
|
||||
|
||||
#include <machine/pte.h>
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/pio.h>
|
||||
#include <machine/intr.h>
|
||||
@ -56,7 +56,7 @@ struct algor_softc {
|
||||
};
|
||||
|
||||
/* Definition of the driver for autoconfig. */
|
||||
int algormatch(struct device *, void *, void *);
|
||||
int algormatch(struct device *, struct cfdata *, void *);
|
||||
void algorattach(struct device *, struct device *, void *);
|
||||
int algorprint(void *, const char *);
|
||||
|
||||
@ -148,12 +148,11 @@ struct algor_dev *algor_cpu_devs[] = {
|
||||
int nalgor_cpu_devs = sizeof algor_cpu_devs / sizeof algor_cpu_devs[0];
|
||||
|
||||
int
|
||||
algormatch(parent, cfdata, aux)
|
||||
algormatch(parent, match, aux)
|
||||
struct device *parent;
|
||||
void *cfdata;
|
||||
struct cfdata *match;
|
||||
void *aux;
|
||||
{
|
||||
struct cfdata *cf = cfdata;
|
||||
struct confargs *ca = aux;
|
||||
|
||||
/* Make sure that we're looking for a ALGORITHMICS BUS */
|
||||
@ -161,7 +160,7 @@ algormatch(parent, cfdata, aux)
|
||||
return (0);
|
||||
|
||||
/* Make sure that unit exists. */
|
||||
if (cf->cf_unit != 0 ||
|
||||
if (match->cf_unit != 0 ||
|
||||
cputype > nalgor_cpu_devs || algor_cpu_devs[cputype] == NULL)
|
||||
return (0);
|
||||
|
||||
@ -184,8 +183,8 @@ algorattach(parent, self, aux)
|
||||
sc->sc_devs = algor_cpu_devs[cputype];
|
||||
|
||||
/* set up interrupt handlers */
|
||||
set_intr(INT_MASK_1, algor_iointr, 2);
|
||||
set_intr(INT_MASK_4, algor_errintr, 0);
|
||||
set_intr(MIPS_INT_MASK_1, algor_iointr, 2);
|
||||
set_intr(MIPS_INT_MASK_4, algor_errintr, 0);
|
||||
|
||||
sc->sc_bus.ab_dv = (struct device *)sc;
|
||||
sc->sc_bus.ab_type = BUS_ALGOR;
|
||||
@ -256,10 +255,10 @@ algor_intr_establish(ca, handler, arg)
|
||||
outb(P4032_IXR2, p4032_ixr >> 16);
|
||||
|
||||
if(slot == 0) { /* Slot 0 is special, clock */
|
||||
set_intr(INT_MASK_0 << ipl, algor_clkintr, ipl + 1);
|
||||
set_intr(MIPS_INT_MASK_0 << ipl, algor_clkintr, ipl + 1);
|
||||
}
|
||||
else {
|
||||
set_intr(INT_MASK_0 << ipl, algor_iointr, ipl + 1);
|
||||
set_intr(MIPS_INT_MASK_0 << ipl, algor_iointr, ipl + 1);
|
||||
}
|
||||
|
||||
p4032_imask |= dev->ps_mask;
|
||||
@ -308,7 +307,7 @@ algor_pci_intr_establish(ih, level, handler, arg, name)
|
||||
outb(P4032_IXR1, p4032_ixr >> 8);
|
||||
outb(P4032_IXR2, p4032_ixr >> 16);
|
||||
|
||||
set_intr(INT_MASK_0 << level, algor_iointr, level + 1);
|
||||
set_intr(MIPS_INT_MASK_0 << level, algor_iointr, level + 1);
|
||||
|
||||
p4032_imask |= imask;
|
||||
outb(P4032_IMR, p4032_imask);
|
||||
@ -403,9 +402,9 @@ algor_clkintr(mask, cf)
|
||||
hardclock(cf);
|
||||
|
||||
/* Re-enable clock interrupts */
|
||||
splx(INT_MASK_0 << IPL_CLOCK | SR_INT_ENAB);
|
||||
splx(MIPS_INT_MASK_0 << IPL_CLOCK | MIPS_SR_INT_IE);
|
||||
|
||||
return(~(INT_MASK_0 << IPL_CLOCK)); /* Keep clock interrupts enabled */
|
||||
return(~(MIPS_INT_MASK_0 << IPL_CLOCK)); /* Keep clock interrupts enabled */
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,5 @@
|
||||
/* $NetBSD: arc_trap.c,v 1.7 2000/01/23 20:08:51 soda Exp $ */
|
||||
/* $NetBSD: arc_trap.c,v 1.8 2000/01/23 21:01:49 soda Exp $ */
|
||||
/* $OpenBSD: trap.c,v 1.5 1996/09/02 11:33:24 pefo Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
@ -42,86 +43,94 @@
|
||||
* @(#)trap.c 8.5 (Berkeley) 1/11/94
|
||||
*/
|
||||
|
||||
#include "opt_ktrace.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/signalvar.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <sys/user.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/device.h>
|
||||
#ifdef KTRACE
|
||||
#include <sys/ktrace.h>
|
||||
#endif
|
||||
#include <net/netisr.h>
|
||||
|
||||
#include <vm/vm.h>
|
||||
#include <vm/vm_kern.h>
|
||||
#include <vm/vm_page.h>
|
||||
|
||||
#include <machine/trap.h>
|
||||
#include <machine/psl.h>
|
||||
#include <machine/reg.h>
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/pio.h>
|
||||
#include <machine/autoconf.h>
|
||||
#include <machine/pte.h>
|
||||
#include <machine/pmap.h>
|
||||
#include <machine/mips_opcode.h>
|
||||
|
||||
#include <vm/vm.h>
|
||||
#include <vm/vm_kern.h>
|
||||
#include <vm/vm_page.h>
|
||||
|
||||
#include <pica/pica/pica.h>
|
||||
#include <arc/pica/pica.h>
|
||||
#include <arc/arc/arctype.h>
|
||||
extern u_int cputype;
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/syslog.h>
|
||||
|
||||
struct proc *machFPCurProcPtr; /* pointer to last proc to use FP */
|
||||
|
||||
struct {
|
||||
int int_mask;
|
||||
int (*int_hand)();
|
||||
int (*int_hand)(u_int, struct clockframe *);
|
||||
} cpu_int_tab[8];
|
||||
|
||||
int cpu_int_mask; /* External cpu interrupt mask */
|
||||
|
||||
int
|
||||
pica_hardware_intr(mask, pc, statusReg, causeReg)
|
||||
arc_hardware_intr(mask, pc, statusReg, causeReg)
|
||||
unsigned mask;
|
||||
unsigned pc;
|
||||
unsigned statusReg;
|
||||
unsigned causeReg;
|
||||
{
|
||||
register int i;
|
||||
struct clockframe cf;
|
||||
|
||||
cf.pc = pc;
|
||||
cf.sr = statusReg;
|
||||
#if 0 /* remove this for merged mips trap code. (this member isn't used) */
|
||||
cf.cr = causeReg;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Check off all enabled interrupts. Called interrupt routine
|
||||
* returns mask of interrupts to reenable.
|
||||
*/
|
||||
for(i = 0; i < 5; i++) {
|
||||
if(cpu_int_tab[i].int_mask & mask) {
|
||||
causeReg &= (*cpu_int_tab[i].int_hand)(mask, pc, statusReg, causeReg);
|
||||
causeReg &= (*cpu_int_tab[i].int_hand)(mask, &cf);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Reenable all non served hardware levels.
|
||||
*/
|
||||
return ((statusReg & ~causeReg & MIPS_HARD_INT_MASK) |
|
||||
MIPS_SR_INT_ENAB);
|
||||
return ((statusReg & ~causeReg & MIPS3_HARD_INT_MASK) | MIPS_SR_INT_IE);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Set up handler for external interrupt events.
|
||||
* Events are checked in priority order.
|
||||
*/
|
||||
void
|
||||
set_intr(mask, int_hand, prio)
|
||||
int mask;
|
||||
int (*int_hand)();
|
||||
int (*int_hand)(u_int, struct clockframe *);
|
||||
int prio;
|
||||
{
|
||||
if(prio > 4)
|
||||
if(prio > 5)
|
||||
panic("set_intr: to high priority");
|
||||
|
||||
if(cpu_int_tab[prio].int_mask != 0)
|
||||
if(cpu_int_tab[prio].int_mask != 0 &&
|
||||
(cpu_int_tab[prio].int_mask != mask ||
|
||||
cpu_int_tab[prio].int_hand != int_hand))
|
||||
panic("set_intr: int already set");
|
||||
|
||||
cpu_int_tab[prio].int_hand = int_hand;
|
||||
@ -129,17 +138,30 @@ set_intr(mask, int_hand, prio)
|
||||
cpu_int_mask |= mask >> 10;
|
||||
|
||||
/*
|
||||
* Update external interrupt mask but dont enable clock.
|
||||
* Update external interrupt mask but don't enable clock.
|
||||
*/
|
||||
out32(PICA_SYS_EXT_IMASK, cpu_int_mask & (~MIPS_INT_MASK_4 >> 10));
|
||||
switch(cputype) {
|
||||
case ACER_PICA_61:
|
||||
case MAGNUM:
|
||||
out32(R4030_SYS_EXT_IMASK,
|
||||
cpu_int_mask & (~MIPS_INT_MASK_4 >> 10));
|
||||
break;
|
||||
|
||||
case DESKSTATION_TYNE:
|
||||
break;
|
||||
case DESKSTATION_RPC44:
|
||||
break;
|
||||
case ALGOR_P4032:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* MemErrorInterrupts --
|
||||
* pica_errintr - for the ACER PICA_61
|
||||
* arc_errintr - for the ACER PICA_61
|
||||
*
|
||||
* Handler an interrupt for the control register.
|
||||
*
|
||||
@ -152,26 +174,19 @@ set_intr(mask, int_hand, prio)
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
static void
|
||||
pica_errintr()
|
||||
arc_errintr()
|
||||
{
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* how does the Pica report memory errors?
|
||||
* how should we handle them?
|
||||
*/
|
||||
#if 0
|
||||
volatile u_short *sysCSRPtr =
|
||||
(u_short *)MACH_PHYS_TO_UNCACHED(KN01_SYS_CSR);
|
||||
(u_short *)MIPS_PHYS_TO_KSEG1(KN01_SYS_CSR);
|
||||
u_short csr;
|
||||
|
||||
csr = *sysCSRPtr;
|
||||
|
||||
if (csr & KN01_CSR_MERR) {
|
||||
printf("Memory error at 0x%x\n",
|
||||
*(unsigned *)MACH_PHYS_TO_UNCACHED(KN01_SYS_ERRADR));
|
||||
*(unsigned *)MIPS_PHYS_TO_KSEG1(KN01_SYS_ERRADR));
|
||||
panic("Mem error interrupt");
|
||||
}
|
||||
*sysCSRPtr = (csr & ~KN01_CSR_MBZ) | 0xff;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
@ -1,4 +1,6 @@
|
||||
/* $NetBSD: arcbios.c,v 1.2 2000/01/23 21:01:50 soda Exp $ */
|
||||
/* $OpenBSD: arcbios.c,v 1.8 1997/05/01 15:13:28 pefo Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996 M. Warner Losh. All rights reserved.
|
||||
* Copyright (c) 1996 Per Fogelstrom. All rights reserved.
|
||||
@ -32,19 +34,13 @@
|
||||
#include <sys/systm.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/user.h>
|
||||
#include <lib/libkern/libkern.h>
|
||||
#include <machine/pte.h>
|
||||
#include <sys/kcore.h>
|
||||
#include <vm/vm.h>
|
||||
#include <dev/cons.h>
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/memconf.h>
|
||||
#include <machine/param.h>
|
||||
#include <arc/arc/arcbios.h>
|
||||
#include <arc/arc/arctype.h>
|
||||
|
||||
arc_param_blk_t *bios_base = (arc_param_blk_t *) 0x80001000;
|
||||
|
||||
extern int cputype; /* Mother board type */
|
||||
extern int physmem; /* Total physical memory size */
|
||||
|
||||
int Bios_Read __P((int, char *, int, int *));
|
||||
int Bios_Write __P((int, char *, int, int *));
|
||||
int Bios_Open __P((char *, int, u_int *));
|
||||
@ -54,12 +50,10 @@ arc_sid_t *Bios_GetSystemId __P((void));
|
||||
arc_config_t *Bios_GetChild __P((arc_config_t *));
|
||||
arc_dsp_stat_t *Bios_GetDisplayStatus __P((int));
|
||||
|
||||
static void bios_configure_memory __P((void));
|
||||
static int get_cpu_type __P((void));
|
||||
char vendor[sizeof(((arc_sid_t *)0)->vendor) + 1];
|
||||
char prodid[sizeof(((arc_sid_t *)0)->prodid) + 1];
|
||||
|
||||
char buf[100]; /*XXX*/
|
||||
arc_dsp_stat_t displayinfo; /* Save area for display status info. */
|
||||
|
||||
static struct systypes {
|
||||
char *sys_vend; /* Vendor ID if name is ambigous */
|
||||
char *sys_name; /* May be left NULL if name is sufficient */
|
||||
@ -129,180 +123,216 @@ ARC_Call(Bios_TestUnicodeCharacter, 0x8c);
|
||||
ARC_Call(Bios_GetDisplayStatus, 0x90);
|
||||
|
||||
/*
|
||||
* Simple getchar/putchar interface.
|
||||
* BIOS based console, for early stage.
|
||||
*/
|
||||
|
||||
int biosgetc __P((dev_t));
|
||||
void biosputc __P((dev_t, int));
|
||||
|
||||
/* this is to fake out the console routines, while booting. */
|
||||
struct consdev bioscons = {
|
||||
NULL, NULL, biosgetc, biosputc, nullcnpollc, NODEV, CN_DEAD
|
||||
};
|
||||
|
||||
int
|
||||
bios_getchar()
|
||||
biosgetc(dev)
|
||||
dev_t dev;
|
||||
{
|
||||
char buf[4];
|
||||
int cnt;
|
||||
int cnt;
|
||||
char buf;
|
||||
|
||||
if(Bios_Read(0, &buf[0], 1, &cnt) != 0)
|
||||
return(-1);
|
||||
return(buf[0] & 255);
|
||||
if (Bios_Read(0, &buf, 1, &cnt) != arc_ESUCCESS)
|
||||
return (-1);
|
||||
return (buf & 255);
|
||||
}
|
||||
|
||||
void
|
||||
bios_putchar(c)
|
||||
char c;
|
||||
biosputc(dev, ch)
|
||||
dev_t dev;
|
||||
int ch;
|
||||
{
|
||||
char buf[4];
|
||||
int cnt;
|
||||
int cnt;
|
||||
char buf;
|
||||
|
||||
if(c == '\n') {
|
||||
buf[0] = '\r';
|
||||
buf[1] = c;
|
||||
cnt = 2;
|
||||
if(displayinfo.CursorYPosition < displayinfo.CursorMaxYPosition)
|
||||
displayinfo.CursorYPosition++;
|
||||
}
|
||||
else {
|
||||
buf[0] = c;
|
||||
cnt = 1;
|
||||
}
|
||||
Bios_Write(1, &buf[0], cnt, &cnt);
|
||||
buf = ch;
|
||||
Bios_Write(1, &buf, 1, &cnt);
|
||||
}
|
||||
|
||||
void
|
||||
bios_putstring(s)
|
||||
char *s;
|
||||
bios_init_console()
|
||||
{
|
||||
while(*s) {
|
||||
bios_putchar(*s++);
|
||||
static int initialized = 0;
|
||||
|
||||
if (!initialized) {
|
||||
initialized = 1;
|
||||
/* fake out the console routines, for now */
|
||||
cn_tab = &bioscons;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Get memory descriptor for the memory configuration and
|
||||
* create a layout database used by pmap init to set up
|
||||
* the memory system. Note that kernel option "MACHINE_NONCONTIG"
|
||||
* the memory system. Note that kernel option "MACHINE_NEW_NONCONTIG"
|
||||
* must be set for systems with non contigous physical memory.
|
||||
*
|
||||
* Concatenate obvious adjecent segments.
|
||||
*/
|
||||
static void
|
||||
bios_configure_memory()
|
||||
int
|
||||
bios_configure_memory(mem_reserved, mem_clusters, mem_cluster_cnt_return)
|
||||
int *mem_reserved;
|
||||
phys_ram_seg_t *mem_clusters;
|
||||
int *mem_cluster_cnt_return;
|
||||
{
|
||||
arc_mem_t *descr = 0;
|
||||
struct mem_descriptor *m;
|
||||
int physmem = 0; /* Total physical memory size */
|
||||
int mem_cluster_cnt = 0;
|
||||
|
||||
arc_mem_t *descr = NULL;
|
||||
vm_offset_t seg_start, seg_end;
|
||||
int i;
|
||||
|
||||
descr = (arc_mem_t *)Bios_GetMemoryDescriptor(descr);
|
||||
while(descr != 0) {
|
||||
int i, reserved;
|
||||
|
||||
while ((descr = Bios_GetMemoryDescriptor(descr)) != NULL) {
|
||||
seg_start = descr->BasePage * 4096;
|
||||
seg_end = seg_start + descr->PageCount * 4096;
|
||||
|
||||
switch(descr->Type) {
|
||||
case BadMemory: /* Have no use for theese */
|
||||
#ifdef BIOS_MEMORY_DEBUG
|
||||
printf("memory type:%d, 0x%8lx..%8lx, size:%8ld bytes\n",
|
||||
descr->Type, seg_start, seg_end, seg_end - seg_start);
|
||||
#endif
|
||||
|
||||
switch (descr->Type) {
|
||||
case BadMemory: /* Have no use for these */
|
||||
break;
|
||||
|
||||
case ExeceptionBlock:
|
||||
case SystemParameterBlock:
|
||||
case FreeMemory:
|
||||
case FirmwareTemporary:
|
||||
case FirmwarePermanent:
|
||||
case FreeContigous:
|
||||
physmem += descr->PageCount * 4096;
|
||||
m = 0;
|
||||
for( i = 0; i < MAXMEMSEGS; i++) {
|
||||
if(mem_layout[i].mem_size == 0) {
|
||||
if(m == 0)
|
||||
m = &mem_layout[i]; /* free */
|
||||
}
|
||||
else if(seg_end == mem_layout[i].mem_start) {
|
||||
m = &mem_layout[i];
|
||||
m->mem_start = seg_start;
|
||||
m->mem_size += seg_end - seg_start;
|
||||
}
|
||||
else if(mem_layout[i].mem_start +
|
||||
mem_layout[i].mem_size == seg_start) {
|
||||
m = &mem_layout[i];
|
||||
m->mem_size += seg_end - seg_start;
|
||||
}
|
||||
}
|
||||
if(m && m->mem_size == 0) {
|
||||
m->mem_start = seg_start;
|
||||
m->mem_size = seg_end - seg_start;
|
||||
}
|
||||
break;
|
||||
reserved = 1;
|
||||
goto account_it;
|
||||
|
||||
case FreeMemory:
|
||||
case LoadedProgram: /* This is the loaded kernel */
|
||||
case FirmwareTemporary:
|
||||
case FreeContigous:
|
||||
reserved = 0;
|
||||
account_it:
|
||||
physmem += descr->PageCount * 4096;
|
||||
|
||||
for (i = 0; i < mem_cluster_cnt; ) {
|
||||
if (mem_reserved[i] == reserved &&
|
||||
mem_clusters[i].start == seg_end)
|
||||
seg_end += mem_clusters[i].size;
|
||||
else if (mem_reserved[i] == reserved &&
|
||||
mem_clusters[i].start +
|
||||
mem_clusters[i].size == seg_start)
|
||||
seg_start = mem_clusters[i].start;
|
||||
else { /* do not merge the cluster */
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
--mem_cluster_cnt;
|
||||
mem_reserved[i] = mem_reserved[mem_cluster_cnt];
|
||||
mem_clusters[i] = mem_clusters[mem_cluster_cnt];
|
||||
}
|
||||
/* assert(i == mem_cluster_cnt); */
|
||||
if (mem_cluster_cnt >= VM_PHYSSEG_MAX) {
|
||||
printf("VM_PHYSSEG_MAX too small\n");
|
||||
for (;;)
|
||||
;
|
||||
}
|
||||
mem_reserved[i] = reserved;
|
||||
mem_clusters[i].start = seg_start;
|
||||
mem_clusters[i].size = seg_end - seg_start;
|
||||
mem_cluster_cnt++;
|
||||
break;
|
||||
|
||||
default: /* Unknown type, leave it alone... */
|
||||
break;
|
||||
}
|
||||
descr = (arc_mem_t *)Bios_GetMemoryDescriptor(descr);
|
||||
}
|
||||
|
||||
#if 0
|
||||
for( i = 0; i < MAXMEMSEGS; i++) {
|
||||
if(mem_layout[i].mem_size) {
|
||||
sprintf(buf, "MEM %d, 0x%x, 0x%x\n",i,
|
||||
mem_layout[i].mem_start,
|
||||
mem_layout[i].mem_size);
|
||||
bios_putstring(buf);
|
||||
}
|
||||
}
|
||||
#ifdef MEMORY_DEBUG
|
||||
for (i = 0; i < mem_cluster_cnt; i++)
|
||||
printf("mem_clusters[%d] = %d:{ 0x%8lx, 0x%8lx }\n", i,
|
||||
mem_reserved[i],
|
||||
(long)mem_clusters[i].start,
|
||||
(long)mem_clusters[i].size);
|
||||
printf("physmem = %d\n", physmem);
|
||||
#endif
|
||||
|
||||
*mem_cluster_cnt_return = mem_cluster_cnt;
|
||||
return (physmem);
|
||||
}
|
||||
|
||||
/*
|
||||
* Find out system type.
|
||||
*/
|
||||
static int
|
||||
get_cpu_type()
|
||||
int
|
||||
bios_ident()
|
||||
{
|
||||
arc_config_t *cf;
|
||||
arc_sid_t *sid;
|
||||
int i;
|
||||
|
||||
if((bios_base->magic != ARC_PARAM_BLK_MAGIC) &&
|
||||
(bios_base->magic != ARC_PARAM_BLK_MAGIC_BUG)) {
|
||||
return(-1); /* This is not an ARC system */
|
||||
if ((ArcBiosBase->magic != ARC_PARAM_BLK_MAGIC) &&
|
||||
(ArcBiosBase->magic != ARC_PARAM_BLK_MAGIC_BUG)) {
|
||||
return (-1); /* This is not an ARC system */
|
||||
}
|
||||
|
||||
sid = (arc_sid_t *)Bios_GetSystemId();
|
||||
cf = (arc_config_t *)Bios_GetChild(NULL);
|
||||
if(cf) {
|
||||
for(i = 0; i < KNOWNSYSTEMS; i++) {
|
||||
if(strcmp(sys_types[i].sys_name, cf->id) != 0)
|
||||
#ifdef BIOS_IDENT_DEBUG
|
||||
bios_init_console();
|
||||
#endif
|
||||
sid = Bios_GetSystemId();
|
||||
if (sid) {
|
||||
bcopy(sid->vendor, vendor, sizeof(sid->vendor));
|
||||
vendor[sizeof(vendor) - 1] = 0;
|
||||
bcopy(sid->prodid, prodid, sizeof(sid->prodid));
|
||||
prodid[sizeof(prodid) - 1] = 0;
|
||||
#ifdef BIOS_IDENT_DEBUG
|
||||
printf("BIOS Vendor ID [%8.8s]\n", sid->vendor);
|
||||
printf("BIOS Product ID [%02x", sid->prodid[0]);
|
||||
for (i = 1; i < sizeof(sid->prodid); i++)
|
||||
printf(":%02x", sid->prodid[i]);
|
||||
printf("]\n");
|
||||
#endif
|
||||
} else {
|
||||
strcpy(vendor, "N/A");
|
||||
strcpy(prodid, "N/A");
|
||||
}
|
||||
cf = Bios_GetChild(NULL);
|
||||
if (cf) {
|
||||
#ifdef BIOS_IDENT_DEBUG
|
||||
printf("BIOS System ID [%s]\n", cf->id);
|
||||
#endif
|
||||
for (i = 0; i < KNOWNSYSTEMS; i++) {
|
||||
if (strcmp(sys_types[i].sys_name, cf->id) != 0)
|
||||
continue;
|
||||
if(sys_types[i].sys_vend &&
|
||||
strncmp(sys_types[i].sys_vend, sid->vendor, 8) != 0)
|
||||
if (sys_types[i].sys_vend &&
|
||||
strncmp(sys_types[i].sys_vend, sid->vendor,
|
||||
sizeof(sid->vendor)) != 0)
|
||||
continue;
|
||||
return(sys_types[i].sys_type); /* Found it. */
|
||||
return (sys_types[i].sys_type); /* Found it. */
|
||||
}
|
||||
}
|
||||
|
||||
bios_putstring("UNIDENTIFIED ARC SYSTEM `");
|
||||
if(cf)
|
||||
bios_putstring(cf->id);
|
||||
else
|
||||
bios_putstring("????????");
|
||||
bios_putstring("' VENDOR `");
|
||||
sid->vendor[8] = 0;
|
||||
bios_putstring("sid->vendor");
|
||||
bios_putstring("'. Please contact OpenBSD (www.openbsd.org).\n");
|
||||
while(1);
|
||||
bios_init_console();
|
||||
printf("UNIDENTIFIED ARC SYSTEM [%s] VENDOR [%8.8s] PRODID [%02x",
|
||||
cf ? cf->id : "N/A", vendor, prodid[0]);
|
||||
for (i = 1; i < sizeof(sid->prodid); i++)
|
||||
printf(":%02x", prodid[i]);
|
||||
printf("]\n");
|
||||
printf("Please contact NetBSD (mailto: port-mips@netbsd.org).\n");
|
||||
for (;;)
|
||||
;
|
||||
}
|
||||
|
||||
/*
|
||||
* Incomplete version of bios_ident
|
||||
* save various information of BIOS for future use.
|
||||
*/
|
||||
void
|
||||
bios_ident()
|
||||
bios_save_info()
|
||||
{
|
||||
cputype = get_cpu_type();
|
||||
if(cputype < 0) {
|
||||
return;
|
||||
}
|
||||
bios_configure_memory();
|
||||
displayinfo = *(arc_dsp_stat_t *)Bios_GetDisplayStatus(1);
|
||||
displayinfo = *Bios_GetDisplayStatus(1);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -311,10 +341,10 @@ bios_ident()
|
||||
*/
|
||||
void
|
||||
bios_display_info(xpos, ypos, xsize, ysize)
|
||||
int *xpos;
|
||||
int *ypos;
|
||||
int *xsize;
|
||||
int *ysize;
|
||||
int *xpos;
|
||||
int *ypos;
|
||||
int *xsize;
|
||||
int *ysize;
|
||||
{
|
||||
*xpos = displayinfo.CursorXPosition;
|
||||
*ypos = displayinfo.CursorYPosition;
|
||||
@ -333,32 +363,27 @@ bios_load_miniroot(path, where)
|
||||
{
|
||||
u_int file;
|
||||
u_int count;
|
||||
int i;
|
||||
char s[32];
|
||||
int error, size = 0;
|
||||
static char mrdefault[] =
|
||||
{"scsi(0)disk(0)rdisk(0)partition(1)\\miniroot" };
|
||||
|
||||
static char mrdefault[] = {"scsi(0)disk(0)rdisk(0)partition(1)\\miniroot" };
|
||||
|
||||
bios_putstring("Loading miniroot:");
|
||||
|
||||
if(path == 0)
|
||||
if (path == 0)
|
||||
path = mrdefault;
|
||||
bios_putstring(path);
|
||||
bios_putstring("\n");
|
||||
printf("Loading miniroot: %s\n", path);
|
||||
|
||||
if((i = Bios_Open(path,0,&file)) != arc_ESUCCESS) {
|
||||
sprintf(s, "Error %d. Load failed!\n", i);
|
||||
bios_putstring(s);
|
||||
return(-1);
|
||||
if ((error = Bios_Open(path, 0, &file)) != arc_ESUCCESS) {
|
||||
printf("Error %d. Load failed!\n", error);
|
||||
return (-1);
|
||||
}
|
||||
do {
|
||||
|
||||
i = Bios_Read(file, where, 4096, &count);
|
||||
bios_putstring(".");
|
||||
error = Bios_Read(file, where, 4096, &count);
|
||||
cnputc('.');
|
||||
where += count;
|
||||
} while((i == 0) && (count != 0));
|
||||
size += count;
|
||||
} while ((error == arc_ESUCCESS) && (count != 0));
|
||||
|
||||
Bios_Close(file);
|
||||
bios_putstring("\nLoaded.\n");
|
||||
return(0);
|
||||
printf("\nLoaded.\n");
|
||||
return (size);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
/* $NetBSD: arcbios.h,v 1.2 2000/01/23 21:01:50 soda Exp $ */
|
||||
/* $OpenBSD: arcbios.h,v 1.4 1997/05/01 15:13:30 pefo Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996 M. Warner Losh. All rights reserved.
|
||||
*
|
||||
@ -329,11 +331,13 @@ typedef struct arc_param_blk
|
||||
#define ArcBiosBase ((arc_param_blk_t *) 0x80001000)
|
||||
#define ArcBios (ArcBiosBase->firmware_vect)
|
||||
|
||||
|
||||
int bios_getchar __P((void));
|
||||
void bios_putchar __P((char));
|
||||
void bios_putstring __P((char *));
|
||||
void bios_ident __P((void));
|
||||
/*
|
||||
* All functions except bios_ident() should be called only if
|
||||
* bios_ident() returns >= 0.
|
||||
*/
|
||||
int bios_ident __P((void));
|
||||
void bios_init_console __P((void));
|
||||
int bios_configure_memory __P((int *, phys_ram_seg_t *, int *));
|
||||
void bios_save_info __P((void));
|
||||
void bios_display_info __P((int *, int *, int *, int *));
|
||||
int bios_load_miniroot __P((char *, caddr_t));
|
||||
|
||||
int bios_load_miniroot __P((char *, caddr_t));
|
||||
|
@ -1,13 +1,9 @@
|
||||
/* $NetBSD: arctype.h,v 1.3 2000/01/23 20:09:00 soda Exp $ */
|
||||
/* $NetBSD: arctype.h,v 1.4 2000/01/23 21:01:50 soda Exp $ */
|
||||
/* $OpenBSD: arctype.h,v 1.4 1997/03/12 19:16:37 pefo Exp $ */
|
||||
|
||||
/*-
|
||||
* 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 Mach Operating System project at Carnegie-Mellon University,
|
||||
* Ralph Campbell and Rick Macklem.
|
||||
*
|
||||
/*
|
||||
* Copyright (c) 1997 Per Fogelstrom
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
@ -18,17 +14,16 @@
|
||||
* 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 product includes software developed under OpenBSD by
|
||||
* Per Fogelstrom.
|
||||
* 4. 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 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
|
||||
* 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
|
||||
@ -36,11 +31,13 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)picatype.h 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
/*
|
||||
* Mother board type byte of "systype" environment variable.
|
||||
*/
|
||||
#define MIPS_PICA_61 0x1 /* Acer Labs Pica 61 */
|
||||
#define ACER_PICA_61 0x1 /* Acer Labs Pica 61 */
|
||||
#define ACER_PICA_61 0x1 /* Acer Labs Pica 61 */
|
||||
#define MAGNUM 0x2 /* Mips MAGNUM R4000 */
|
||||
#define DESKSTATION_RPC44 0x3 /* Deskstation xxx */
|
||||
#define DESKSTATION_TYNE 0x4 /* Deskstation xxx */
|
||||
#define NKK_AQUARIUS 0x5 /* NKK R4{67}00 PC */
|
||||
#define ALGOR_P4032 0x6 /* ALGORITHMICS P-4032 VR4300 */
|
||||
|
@ -1,6 +1,8 @@
|
||||
/* $NetBSD: autoconf.c,v 1.12 2000/01/23 20:09:01 soda Exp $ */
|
||||
/* $NetBSD: autoconf.c,v 1.13 2000/01/23 21:01:50 soda Exp $ */
|
||||
/* $OpenBSD: autoconf.c,v 1.9 1997/05/18 13:45:20 pefo Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Per Fogelstrom
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
@ -58,19 +60,20 @@
|
||||
#include <sys/reboot.h>
|
||||
#include <sys/device.h>
|
||||
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/autoconf.h>
|
||||
|
||||
void findroot __P((struct device **devpp, int *partp));
|
||||
int getpno __P((char **cp));
|
||||
|
||||
/*
|
||||
* The following several variables are related to
|
||||
* the configuration process, and are used in initializing
|
||||
* the machine.
|
||||
*/
|
||||
int cpuspeed = 150; /* approx # instr per usec. */
|
||||
extern int pica_boardtype;
|
||||
|
||||
void findroot __P((struct device **devpp, int *partp));
|
||||
int getpno __P((char **cp));
|
||||
|
||||
void findroot __P((struct device **, int *));
|
||||
|
||||
/*
|
||||
* Configure all devices found that we know about.
|
||||
@ -79,13 +82,18 @@ int getpno __P((char **cp));
|
||||
void
|
||||
cpu_configure()
|
||||
{
|
||||
|
||||
(void)splhigh(); /* To be really shure.. */
|
||||
if(config_rootfound("mainbus", "mainbus") == NULL)
|
||||
(void)splhigh(); /* To be really sure.. */
|
||||
if (config_rootfound("mainbus", "mainbus") == NULL)
|
||||
panic("no mainbus found");
|
||||
(void)spl0();
|
||||
|
||||
/* Configuration is finished, turn on interrupts. */
|
||||
_splnone(); /* enable all source forcing SOFT_INTs cleared */
|
||||
}
|
||||
|
||||
#if defined(NFS_BOOT_BOOTP) || defined(NFS_BOOT_DHCP)
|
||||
int nfs_boot_rfc951 = 1;
|
||||
#endif
|
||||
|
||||
void
|
||||
cpu_rootconf()
|
||||
{
|
||||
@ -150,35 +158,59 @@ findroot(devpp, partp)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
struct devmap {
|
||||
char *attachment;
|
||||
char *dev;
|
||||
};
|
||||
|
||||
/*
|
||||
* Look at the string 'cp' and decode the boot device.
|
||||
* Boot names look like: scsi()disk(n)rdisk()partition(1)\bsd
|
||||
* (beware for empty scsi id's...)
|
||||
*/
|
||||
void
|
||||
makebootdev(cp)
|
||||
char *cp;
|
||||
{
|
||||
int majdev, unit, ctrl;
|
||||
char dv[8];
|
||||
int ctrl, unit, part, i;
|
||||
static struct devmap devmap[] = {
|
||||
{ "multi", "fd" },
|
||||
{ "eisa", "wd" },
|
||||
{ "scsi", "sd" },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
struct devmap *dp = &devmap[0];
|
||||
|
||||
bootdev = B_DEVMAGIC;
|
||||
|
||||
dv[0] = *cp;
|
||||
ctrl = getpno(&cp);
|
||||
if(*cp++ == ')') {
|
||||
dv[1] = *cp;
|
||||
unit = getpno(&cp);
|
||||
|
||||
for (majdev = 0; majdev < sizeof(dev_name2blk)/sizeof(dev_name2blk[0]); majdev++)
|
||||
if (dv[0] == dev_name2blk[majdev].d_name[0] &&
|
||||
dv[1] == dev_name2blk[majdev].d_name[1] &&
|
||||
cp[0] == ')')
|
||||
bootdev = MAKEBOOTDEV(majdev, 0, ctrl, unit,0);
|
||||
while (dp->attachment) {
|
||||
if (strncmp (cp, dp->attachment, strlen(dp->attachment)) == 0)
|
||||
break;
|
||||
dp++;
|
||||
}
|
||||
}
|
||||
if (!dp->attachment) {
|
||||
printf("Warning: boot device unrecognized: %s\n", cp);
|
||||
return;
|
||||
}
|
||||
ctrl = getpno(&cp);
|
||||
if (*cp++ == ')')
|
||||
unit = getpno(&cp);
|
||||
else
|
||||
unit = 0;
|
||||
if (*cp++ == ')')
|
||||
getpno(&cp);
|
||||
#if 0 /* ignore partition number */
|
||||
if (*cp++ == ')')
|
||||
part = getpno(&cp) - 1;
|
||||
else
|
||||
#endif
|
||||
part = 0;
|
||||
|
||||
for (i = 0; dev_name2blk[i].d_name != NULL; i++)
|
||||
if (strcmp(dp->dev, dev_name2blk[i].d_name) == 0)
|
||||
bootdev = MAKEBOOTDEV(dev_name2blk[i].d_maj, 0,
|
||||
ctrl, unit, part);
|
||||
}
|
||||
|
||||
int
|
||||
getpno(cp)
|
||||
|
@ -1,4 +1,5 @@
|
||||
/* $NetBSD: clock.c,v 1.8 2000/01/23 20:09:03 soda Exp $ */
|
||||
/* $NetBSD: clock.c,v 1.9 2000/01/23 21:01:50 soda Exp $ */
|
||||
/* $OpenBSD: clock.c,v 1.5 1997/04/19 17:19:39 pefo Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
@ -48,24 +49,37 @@
|
||||
#include <sys/device.h>
|
||||
|
||||
#include <machine/autoconf.h>
|
||||
#include <machine/machConst.h>
|
||||
#include <pica/pica/clockvar.h>
|
||||
#include <pica/pica/picatype.h>
|
||||
#include <machine/cpu.h>
|
||||
#include <arc/arc/clockvar.h>
|
||||
#include <arc/arc/arctype.h>
|
||||
|
||||
#include <dev/isa/isavar.h>
|
||||
#include <machine/isa_machdep.h>
|
||||
|
||||
extern int cputype; /* What kind of cpu we are running on */
|
||||
|
||||
int clock_started = 0;
|
||||
|
||||
/* Definition of the driver for autoconfig. */
|
||||
static int clockmatch __P((struct device *, void *, void *));
|
||||
static int clockmatch __P((struct device *, struct cfdata *, void *));
|
||||
static void clockattach __P((struct device *, struct device *, void *));
|
||||
|
||||
struct cfattach clock_ca = {
|
||||
extern struct cfdriver aclock_cd;
|
||||
|
||||
struct cfattach aclock_isa_ca = {
|
||||
sizeof(struct clock_softc), clockmatch, clockattach
|
||||
};
|
||||
|
||||
extern struct cfdriver clock_cd;
|
||||
struct cfattach aclock_pica_ca = {
|
||||
sizeof(struct clock_softc), clockmatch, clockattach
|
||||
};
|
||||
|
||||
struct cfattach aclock_algor_ca = {
|
||||
sizeof(struct clock_softc), clockmatch, clockattach
|
||||
};
|
||||
|
||||
void mcclock_attach __P((struct device *, struct device *, void *));
|
||||
int clockintr __P((void *));
|
||||
|
||||
#define SECMIN ((unsigned)60) /* seconds per minute */
|
||||
#define SECHOUR ((unsigned)(60*SECMIN)) /* seconds per hour */
|
||||
@ -75,58 +89,81 @@ void mcclock_attach __P((struct device *, struct device *, void *));
|
||||
#define LEAPYEAR(year) (((year) % 4) == 0)
|
||||
|
||||
static int
|
||||
clockmatch(parent, cfdata, aux)
|
||||
clockmatch(parent, match, aux)
|
||||
struct device *parent;
|
||||
void *cfdata;
|
||||
struct cfdata *match;
|
||||
void *aux;
|
||||
{
|
||||
struct cfdata *cf = cfdata;
|
||||
struct confargs *ca = aux;
|
||||
|
||||
/* See how many clocks this system has */
|
||||
switch (cputype) {
|
||||
|
||||
case MIPS_PICA_61:
|
||||
case ACER_PICA_61:
|
||||
case MAGNUM:
|
||||
/* make sure that we're looking for this type of device. */
|
||||
if (!BUS_MATCHNAME(ca, "dallas_rtc"))
|
||||
return (0);
|
||||
|
||||
if (cf->cf_unit >= 1)
|
||||
return (0);
|
||||
break;
|
||||
|
||||
case DESKSTATION_RPC44:
|
||||
case DESKSTATION_TYNE:
|
||||
case ALGOR_P4032:
|
||||
break;
|
||||
|
||||
default:
|
||||
panic("unknown CPU");
|
||||
}
|
||||
|
||||
if (match->cf_unit >= 1)
|
||||
return (0);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
int
|
||||
clockintr(cf)
|
||||
void *cf;
|
||||
{
|
||||
if(clock_started)
|
||||
hardclock((struct clockframe *)cf);
|
||||
return(1);
|
||||
}
|
||||
|
||||
static void
|
||||
clockattach(parent, self, aux)
|
||||
struct device *parent;
|
||||
struct device *self;
|
||||
void *aux;
|
||||
{
|
||||
struct isa_attach_args *ia = aux;
|
||||
|
||||
mcclock_attach(parent, self, aux);
|
||||
|
||||
switch (cputype) {
|
||||
|
||||
case MIPS_PICA_61:
|
||||
mcclock_attach(parent, self, aux);
|
||||
case ACER_PICA_61:
|
||||
case ALGOR_P4032:
|
||||
BUS_INTR_ESTABLISH((struct confargs *)aux,
|
||||
(intr_handler_t)hardclock, self);
|
||||
break;
|
||||
|
||||
case MAGNUM:
|
||||
BUS_INTR_ESTABLISH((struct confargs *)aux,
|
||||
(intr_handler_t)clockintr, self);
|
||||
break;
|
||||
|
||||
case DESKSTATION_RPC44:
|
||||
case DESKSTATION_TYNE:
|
||||
(void)isa_intr_establish(ia->ia_ic,
|
||||
0, 1, 3, clockintr, 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
panic("clockattach: it didn't get here. really.");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* establish the clock interrupt; it's a special case
|
||||
*/
|
||||
BUS_INTR_ESTABLISH((struct confargs *)aux,
|
||||
(intr_handler_t) hardclock, self);
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
@ -162,15 +199,20 @@ void
|
||||
cpu_initclocks()
|
||||
{
|
||||
extern int tickadj;
|
||||
struct clock_softc *csc = (struct clock_softc *)clock_cd.cd_devs[0];
|
||||
struct clock_softc *csc = (struct clock_softc *)aclock_cd.cd_devs[0];
|
||||
|
||||
hz = 100; /* 100 Hz */
|
||||
tick = 1000000 / hz; /* number of micro-seconds between interrupts */
|
||||
|
||||
/*
|
||||
* Start the clock.
|
||||
*/
|
||||
/* Assume 100 Hz */
|
||||
hz = 100;
|
||||
|
||||
/* Start the clock. */
|
||||
(*csc->sc_init)(csc);
|
||||
|
||||
/* Recalculate theese if clock init changed hz */
|
||||
tick = 1000000 / hz; /* number of micro-seconds between interrupts */
|
||||
tickadj = 240000 / (60 * hz); /* can adjust 240ms in 60s */
|
||||
|
||||
clock_started++;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -202,10 +244,10 @@ inittodr(base)
|
||||
time_t base;
|
||||
{
|
||||
struct tod_time c;
|
||||
struct clock_softc *csc = (struct clock_softc *)clock_cd.cd_devs[0];
|
||||
struct clock_softc *csc = (struct clock_softc *)aclock_cd.cd_devs[0];
|
||||
register int days, yr;
|
||||
long deltat;
|
||||
int badbase, s;
|
||||
int badbase;
|
||||
|
||||
if (base < 5*SECYR) {
|
||||
printf("WARNING: preposterous time in file system");
|
||||
@ -254,7 +296,7 @@ inittodr(base)
|
||||
deltat = -deltat;
|
||||
if (deltat < 2 * SECDAY)
|
||||
return;
|
||||
printf("WARNING: clock %s %d days",
|
||||
printf("WARNING: clock %s %ld days",
|
||||
time.tv_sec < base ? "lost" : "gained", deltat / SECDAY);
|
||||
}
|
||||
bad:
|
||||
@ -272,9 +314,10 @@ void
|
||||
resettodr()
|
||||
{
|
||||
struct tod_time c;
|
||||
struct clock_softc *csc = (struct clock_softc *)clock_cd.cd_devs[0];
|
||||
register int t, t2;
|
||||
int s;
|
||||
struct clock_softc *csc = (struct clock_softc *)aclock_cd.cd_devs[0];
|
||||
int t, t2;
|
||||
|
||||
(void) &t; /* shut off gcc unused-variable warnings */
|
||||
|
||||
if(!csc->sc_initted)
|
||||
return;
|
||||
|
@ -1,4 +1,6 @@
|
||||
/* $NetBSD: clock_mc.c,v 1.4 2000/01/23 20:09:03 soda Exp $ */
|
||||
/* $NetBSD: clock_mc.c,v 1.5 2000/01/23 21:01:50 soda Exp $ */
|
||||
/* $OpenBSD: clock_mc.c,v 1.7 1997/04/19 17:19:40 pefo Exp $ */
|
||||
/* NetBSD: clock_mc.c,v 1.2 1995/06/28 04:30:30 cgd Exp */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
@ -50,17 +52,25 @@
|
||||
#include <machine/autoconf.h>
|
||||
#include <machine/pio.h>
|
||||
|
||||
#include <pica/pica/clockvar.h>
|
||||
#include <pica/pica/picatype.h>
|
||||
#include <pica/pica/pica.h>
|
||||
#include <dev/isa/isareg.h>
|
||||
#include <dev/isa/isavar.h>
|
||||
#include <dev/ic/mc146818reg.h>
|
||||
|
||||
#include <arc/arc/clockvar.h>
|
||||
#include <arc/arc/arctype.h>
|
||||
#include <arc/pica/pica.h>
|
||||
#include <arc/algor/algor.h>
|
||||
#include <machine/isa_machdep.h>
|
||||
#include <arc/isa/timerreg.h>
|
||||
|
||||
extern u_int cputype;
|
||||
extern int cpu_int_mask;
|
||||
|
||||
void mcclock_attach __P((struct device *parent,
|
||||
struct device *self, void *aux));
|
||||
static void mcclock_init __P((struct clock_softc *csc));
|
||||
static void mcclock_init_pica __P((struct clock_softc *csc));
|
||||
static void mcclock_init_tyne __P((struct clock_softc *csc));
|
||||
static void mcclock_init_p4032 __P((struct clock_softc *csc));
|
||||
static void mcclock_get __P((struct clock_softc *csc, time_t base,
|
||||
struct tod_time *ct));
|
||||
static void mcclock_set __P((struct clock_softc *csc,
|
||||
@ -70,7 +80,6 @@ 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));
|
||||
void *mc_addr;
|
||||
};
|
||||
|
||||
#define mc146818_write(sc, reg, datum) \
|
||||
@ -78,12 +87,23 @@ struct mcclockdata {
|
||||
#define mc146818_read(sc, reg) \
|
||||
(*((struct mcclockdata *)sc->sc_data)->mc_read)(sc, reg)
|
||||
|
||||
#if defined(MIPS_PICA_61)
|
||||
/* Acer Pica clock access code */
|
||||
static void mc_write_pica __P((struct clock_softc *csc, u_int reg,
|
||||
u_int datum));
|
||||
static u_int mc_read_pica __P((struct clock_softc *csc, u_int reg));
|
||||
static struct mcclockdata mcclockdata_pica = { mc_write_pica, mc_read_pica };
|
||||
#endif
|
||||
|
||||
/* Deskstation clock access code */
|
||||
static void mc_write_tyne __P((struct clock_softc *csc, u_int reg,
|
||||
u_int datum));
|
||||
static u_int mc_read_tyne __P((struct clock_softc *csc, u_int reg));
|
||||
static struct mcclockdata mcclockdata_tyne = { mc_write_tyne, mc_read_tyne };
|
||||
|
||||
/* Algorithmics P4032 clock access code */
|
||||
static void mc_write_p4032 __P((struct clock_softc *csc, u_int reg,
|
||||
u_int datum));
|
||||
static u_int mc_read_p4032 __P((struct clock_softc *csc, u_int reg));
|
||||
static struct mcclockdata mcclockdata_p4032 = { mc_write_p4032, mc_read_p4032 };
|
||||
|
||||
void
|
||||
mcclock_attach(parent, self, aux)
|
||||
@ -93,43 +113,73 @@ mcclock_attach(parent, self, aux)
|
||||
{
|
||||
struct clock_softc *csc = (struct clock_softc *)self;
|
||||
|
||||
register volatile struct chiptime *c;
|
||||
struct confargs *ca = aux;
|
||||
|
||||
printf(": mc146818 or compatible");
|
||||
|
||||
csc->sc_init = mcclock_init;
|
||||
csc->sc_get = mcclock_get;
|
||||
csc->sc_set = mcclock_set;
|
||||
|
||||
switch (cputype) {
|
||||
|
||||
case MIPS_PICA_61:
|
||||
/*
|
||||
* XXX should really allocate a new one and copy, or
|
||||
* something. unlikely we'll have more than one...
|
||||
*/
|
||||
case ACER_PICA_61:
|
||||
case MAGNUM:
|
||||
csc->sc_init = mcclock_init_pica;
|
||||
csc->sc_data = &mcclockdata_pica;
|
||||
mcclockdata_pica.mc_addr = BUS_CVTADDR(ca);
|
||||
mc146818_write(csc, MC_REGB, MC_REGB_BINARY | MC_REGB_24HR);
|
||||
break;
|
||||
|
||||
case DESKSTATION_RPC44:
|
||||
case DESKSTATION_TYNE:
|
||||
csc->sc_init = mcclock_init_tyne;
|
||||
csc->sc_data = &mcclockdata_tyne;
|
||||
mc146818_write(csc, MC_REGB, MC_REGB_BINARY | MC_REGB_24HR);
|
||||
break;
|
||||
|
||||
case ALGOR_P4032:
|
||||
csc->sc_init = mcclock_init_p4032;
|
||||
csc->sc_data = &mcclockdata_p4032;
|
||||
mc146818_write(csc, MC_REGB, MC_REGB_BINARY|MC_REGB_24HR|MC_REGB_SQWE);
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("\n");
|
||||
panic("don't know how to set up for other system types.");
|
||||
}
|
||||
|
||||
/* Turn interrupts off, just in case. */
|
||||
mc146818_write(csc, MC_REGB, MC_REGB_BINARY | MC_REGB_24HR);
|
||||
}
|
||||
|
||||
static void
|
||||
mcclock_init(csc)
|
||||
mcclock_init_pica(csc)
|
||||
struct clock_softc *csc;
|
||||
{
|
||||
/* XXX Does not really belong here but for the moment we don't care */
|
||||
out32(PICA_SYS_IT_VALUE, 9); /* 10ms - 1 */
|
||||
out32(R4030_SYS_IT_VALUE, 9); /* 10ms - 1 */
|
||||
/* Enable periodic clock interrupt */
|
||||
out32(PICA_SYS_EXT_IMASK, cpu_int_mask);
|
||||
out32(R4030_SYS_EXT_IMASK, cpu_int_mask);
|
||||
}
|
||||
|
||||
static void
|
||||
mcclock_init_tyne(csc)
|
||||
struct clock_softc *csc;
|
||||
{
|
||||
isa_outb(IO_TIMER1 + TIMER_MODE,
|
||||
TIMER_SEL0 | TIMER_16BIT | TIMER_RATEGEN);
|
||||
isa_outb(IO_TIMER1 + TIMER_CNTR0, TIMER_DIV(hz) % 256);
|
||||
isa_outb(IO_TIMER1 + TIMER_CNTR0, TIMER_DIV(hz) / 256);
|
||||
}
|
||||
|
||||
static void
|
||||
mcclock_init_p4032(csc)
|
||||
struct clock_softc *csc;
|
||||
{
|
||||
int s;
|
||||
char cv;
|
||||
|
||||
hz = 256; /* NOTE! We are going at 256 Hz! */
|
||||
s = splclock();
|
||||
cv = mc146818_read(csc, MC_REGA) & ~MC_REGA_RSMASK;
|
||||
mc146818_write(csc, MC_REGA, cv | MC_RATE_256_Hz);
|
||||
cv = mc146818_read(csc, MC_REGB);
|
||||
mc146818_write(csc, MC_REGB, cv | MC_REGB_PIE);
|
||||
splx(s);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -155,6 +205,8 @@ mcclock_get(csc, base, ct)
|
||||
ct->day = regs[MC_DOM];
|
||||
ct->mon = regs[MC_MONTH];
|
||||
ct->year = regs[MC_YEAR];
|
||||
if(cputype == ALGOR_P4032)
|
||||
ct->year -= 80;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -170,7 +222,7 @@ mcclock_set(csc, ct)
|
||||
|
||||
s = splclock();
|
||||
MC146818_GETTOD(csc, ®s);
|
||||
splx(s);
|
||||
printf("%d-%d-%d, %d:%d:%d\n", regs[MC_YEAR], regs[MC_MONTH], regs[MC_DOM], regs[MC_HOUR], regs[MC_MIN], regs[MC_SEC]);
|
||||
|
||||
regs[MC_SEC] = ct->sec;
|
||||
regs[MC_MIN] = ct->min;
|
||||
@ -178,22 +230,23 @@ mcclock_set(csc, ct)
|
||||
regs[MC_DOW] = ct->dow;
|
||||
regs[MC_DOM] = ct->day;
|
||||
regs[MC_MONTH] = ct->mon;
|
||||
regs[MC_YEAR] = ct->year;
|
||||
if(cputype == ALGOR_P4032)
|
||||
regs[MC_YEAR] = ct->year + 80;
|
||||
else
|
||||
regs[MC_YEAR] = ct->year;
|
||||
|
||||
s = splclock();
|
||||
MC146818_PUTTOD(csc, ®s);
|
||||
MC146818_GETTOD(csc, ®s);
|
||||
printf("%d-%d-%d, %d:%d:%d\n", regs[MC_YEAR], regs[MC_MONTH], regs[MC_DOM], regs[MC_HOUR], regs[MC_MIN], regs[MC_SEC]);
|
||||
splx(s);
|
||||
}
|
||||
|
||||
|
||||
#if defined(ACER_PICA_61)
|
||||
|
||||
static void
|
||||
mc_write_pica(csc, reg, datum)
|
||||
struct clock_softc *csc;
|
||||
u_int reg, datum;
|
||||
{
|
||||
int i,as;
|
||||
int as;
|
||||
|
||||
as = in32(PICA_SYS_ISA_AS) & 0x80;
|
||||
out32(PICA_SYS_ISA_AS, as | reg);
|
||||
@ -212,4 +265,45 @@ mc_read_pica(csc, reg)
|
||||
i = inb(PICA_SYS_CLOCK);
|
||||
return(i);
|
||||
}
|
||||
#endif /*ACER_PICA_61*/
|
||||
|
||||
static void
|
||||
mc_write_tyne(csc, reg, datum)
|
||||
struct clock_softc *csc;
|
||||
u_int reg, datum;
|
||||
{
|
||||
isa_outb(IO_RTC, reg);
|
||||
isa_outb(IO_RTC+1, datum);
|
||||
}
|
||||
|
||||
static u_int
|
||||
mc_read_tyne(csc, reg)
|
||||
struct clock_softc *csc;
|
||||
u_int reg;
|
||||
{
|
||||
int i;
|
||||
|
||||
isa_outb(IO_RTC, reg);
|
||||
i = isa_inb(IO_RTC+1);
|
||||
return(i);
|
||||
}
|
||||
|
||||
static void
|
||||
mc_write_p4032(csc, reg, datum)
|
||||
struct clock_softc *csc;
|
||||
u_int reg, datum;
|
||||
{
|
||||
outb(P4032_CLOCK, reg);
|
||||
outb(P4032_CLOCK+4, datum);
|
||||
}
|
||||
|
||||
static u_int
|
||||
mc_read_p4032(csc, reg)
|
||||
struct clock_softc *csc;
|
||||
u_int reg;
|
||||
{
|
||||
int i;
|
||||
|
||||
outb(P4032_CLOCK, reg);
|
||||
i = inb(P4032_CLOCK+4) & 0xff;
|
||||
return(i);
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
/* $NetBSD: clockvar.h,v 1.2 2000/01/23 21:01:51 soda Exp $ */
|
||||
/* $OpenBSD: clockvar.h,v 1.1.1.1 1996/06/24 09:07:20 pefo Exp $ */
|
||||
/* $NetBSD: clockvar.h,v 1.1.1.3 2000/01/23 20:24:24 soda Exp $ */
|
||||
/* NetBSD: clockvar.h,v 1.1 1995/06/28 02:44:59 cgd Exp */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
|
||||
|
@ -1,4 +1,5 @@
|
||||
/* $NetBSD: conf.c,v 1.13 2000/01/23 20:09:06 soda Exp $ */
|
||||
/* $NetBSD: conf.c,v 1.14 2000/01/23 21:01:51 soda Exp $ */
|
||||
/* $OpenBSD: conf.c,v 1.17 1997/05/21 18:31:31 pefo Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -59,9 +60,16 @@ bdev_decl(sd);
|
||||
#include "cd.h"
|
||||
bdev_decl(cd);
|
||||
#include "fdc.h"
|
||||
#define fdopen Fdopen
|
||||
bdev_decl(fd);
|
||||
#undef fdopen
|
||||
#include "wd.h"
|
||||
bdev_decl(wd);
|
||||
#if 0 /* XXX - should be fixed */
|
||||
#include "acd.h"
|
||||
bdev_decl(acd);
|
||||
#endif
|
||||
#include "ccd.h"
|
||||
#include "md.h"
|
||||
bdev_decl(md);
|
||||
|
||||
struct bdevsw bdevsw[] =
|
||||
{
|
||||
@ -69,13 +77,15 @@ struct bdevsw bdevsw[] =
|
||||
bdev_swap_init(1,sw), /* 1: should be here swap pseudo-dev */
|
||||
bdev_disk_init(NVND,vnd), /* 2: vnode disk driver */
|
||||
bdev_disk_init(NCD,cd), /* 3: SCSI CD-ROM */
|
||||
bdev_notdef(), /* 4: */
|
||||
bdev_disk_init(NWD,wd), /* 4: ST506/ESDI/IDE disk */
|
||||
#if 0 /* XXX - should be fixed */
|
||||
bdev_disk_init(NACD,acd), /* 5: ATAPI CD-ROM */
|
||||
#else
|
||||
bdev_notdef(), /* 5: */
|
||||
bdev_notdef(), /* 6: */
|
||||
#define fdopen Fdopen
|
||||
#endif
|
||||
bdev_disk_init(NCCD,ccd), /* 6: concatenated disk driver */
|
||||
bdev_disk_init(NFDC,fd), /* 7: Floppy disk driver */
|
||||
#undef fdopen
|
||||
bdev_notdef(), /* 8: */
|
||||
bdev_disk_init(NMD,md), /* 8: memory disk (for install) */
|
||||
bdev_notdef(), /* 9: */
|
||||
bdev_notdef(), /* 10: */
|
||||
bdev_notdef(), /* 11: */
|
||||
@ -112,6 +122,9 @@ int nblkdev = sizeof (bdevsw) / sizeof (bdevsw[0]);
|
||||
cdev_decl(cn);
|
||||
cdev_decl(sw);
|
||||
cdev_decl(ctty);
|
||||
#if 0 /* XXX - should be fixed */
|
||||
cdev_decl(random);
|
||||
#endif
|
||||
#define mmread mmrw
|
||||
#define mmwrite mmrw
|
||||
dev_type_read(mmrw);
|
||||
@ -128,23 +141,32 @@ cdev_decl(fd);
|
||||
#include "st.h"
|
||||
cdev_decl(st);
|
||||
#include "fdc.h"
|
||||
#define fdopen Fdopen
|
||||
bdev_decl(fd);
|
||||
#undef fdopen
|
||||
cdev_decl(vnd);
|
||||
cdev_decl(md);
|
||||
#include "bpfilter.h"
|
||||
cdev_decl(bpf);
|
||||
#include "pcom.h"
|
||||
#include "com.h"
|
||||
cdev_decl(com);
|
||||
#include "lpt.h"
|
||||
cdev_decl(lpt);
|
||||
cdev_decl(sd);
|
||||
#include "pc.h"
|
||||
cdev_decl(pc);
|
||||
cdev_decl(pms);
|
||||
cdev_decl(opms);
|
||||
cdev_decl(cd);
|
||||
dev_decl(filedesc,open);
|
||||
#include "ss.h"
|
||||
#include "uk.h"
|
||||
cdev_decl(uk);
|
||||
cdev_decl(wd);
|
||||
#if 0 /* XXX - should be fixed */
|
||||
cdev_decl(acd);
|
||||
#endif
|
||||
|
||||
/* open, close, read, ioctl */
|
||||
#include "ipfilter.h"
|
||||
cdev_decl(ipl);
|
||||
|
||||
#include "rnd.h"
|
||||
|
||||
#include "scsibus.h"
|
||||
@ -165,19 +187,21 @@ struct cdevsw cdevsw[] =
|
||||
cdev_tape_init(NST,st), /* 10: SCSI tape */
|
||||
cdev_disk_init(NVND,vnd), /* 11: vnode disk */
|
||||
cdev_bpftun_init(NBPFILTER,bpf),/* 12: berkeley packet filter */
|
||||
#define fdopen Fdopen
|
||||
cdev_disk_init(NFDC,fd), /* 13: Floppy disk */
|
||||
#undef fdopen
|
||||
cdev_pc_init(1,pc), /* 14: builtin pc style console dev */
|
||||
cdev_mouse_init(1,pms), /* 15: builtin PS2 style mouse */
|
||||
cdev_lpt_init(NLPT,lpt), /* 16: lpt paralell printer interface */
|
||||
cdev_tty_init(NPCOM,com), /* 17: com 16C450 serial interface */
|
||||
cdev_notdef(), /* 18: */
|
||||
cdev_pc_init(NPC,pc), /* 14: builtin pc style console dev */
|
||||
cdev_mouse_init(NPC,opms), /* 15: builtin PS2 style mouse */
|
||||
cdev_lpt_init(NLPT,lpt), /* 16: Parallel printer interface */
|
||||
cdev_tty_init(NCOM,com), /* 17: 16C450 serial interface */
|
||||
cdev_disk_init(NWD,wd), /* 18: ST506/ESDI/IDE disk */
|
||||
#if 0 /* XXX - should be fixed */
|
||||
cdev_disk_init(NACD,acd), /* 19: ATAPI CD-ROM */
|
||||
#else
|
||||
cdev_notdef(), /* 19: */
|
||||
#endif
|
||||
cdev_tty_init(NPTY,pts), /* 20: pseudo-tty slave */
|
||||
cdev_ptc_init(NPTY,ptc), /* 21: pseudo-tty master */
|
||||
cdev_notdef(), /* 22: */
|
||||
cdev_notdef(), /* 23: */
|
||||
cdev_disk_init(NMD,md), /* 22: memory disk device */
|
||||
cdev_disk_init(NCCD,ccd), /* 23: concatenated disk driver */
|
||||
cdev_notdef(), /* 24: */
|
||||
cdev_notdef(), /* 25: */
|
||||
cdev_notdef(), /* 26: */
|
||||
@ -185,9 +209,11 @@ struct cdevsw cdevsw[] =
|
||||
cdev_notdef(), /* 28: */
|
||||
cdev_notdef(), /* 29: */
|
||||
cdev_notdef(), /* 30: */
|
||||
cdev_ipf_init(NIPFILTER,ipl), /* 31: ip-filter device */
|
||||
cdev_rnd_init(NRND,rnd), /* 32: random source pseudo-device */
|
||||
cdev_scsibus_init(NSCSIBUS,scsibus), /* 33: SCSI bus */
|
||||
cdev_ipf_init(NIPFILTER,ipl), /* 31: IP filter log */
|
||||
cdev_uk_init(NUK,uk), /* 32: unknown SCSI */
|
||||
cdev_rnd_init(NRND,rnd), /* 33: random source pseudo-device */
|
||||
cdev_scanner_init(NSS,ss), /* 34: SCSI scanner */
|
||||
cdev_scsibus_init(NSCSIBUS,scsibus), /* 35: SCSI bus */
|
||||
};
|
||||
|
||||
int nchrdev = sizeof (cdevsw) / sizeof (cdevsw[0]);
|
||||
@ -260,11 +286,11 @@ static int chrtoblktbl[MAXDEV] = {
|
||||
/* 15 */ NODEV,
|
||||
/* 16 */ NODEV,
|
||||
/* 17 */ NODEV,
|
||||
/* 18 */ NODEV,
|
||||
/* 19 */ NODEV,
|
||||
/* 18 */ 4,
|
||||
/* 19 */ 5,
|
||||
/* 20 */ NODEV,
|
||||
/* 21 */ NODEV,
|
||||
/* 22 */ NODEV,
|
||||
/* 22 */ 8,
|
||||
/* 23 */ NODEV,
|
||||
/* 24 */ NODEV,
|
||||
/* 25 */ NODEV,
|
||||
@ -315,24 +341,3 @@ chrtoblk(dev)
|
||||
return (NODEV);
|
||||
return (makedev(blkmaj, minor(dev)));
|
||||
}
|
||||
|
||||
/*
|
||||
* This entire table could be autoconfig()ed but that would mean that
|
||||
* the kernel's idea of the console would be out of sync with that of
|
||||
* the standalone boot. I think it best that they both use the same
|
||||
* known algorithm unless we see a pressing need otherwise.
|
||||
*/
|
||||
#include <dev/cons.h>
|
||||
|
||||
cons_decl(pc);
|
||||
cons_decl(com);
|
||||
|
||||
struct consdev constab[] = {
|
||||
#if NPC + NVT > 0
|
||||
cons_init(pc),
|
||||
#endif
|
||||
#if NPCOM > 0
|
||||
cons_init(com),
|
||||
#endif
|
||||
{ 0 },
|
||||
};
|
||||
|
@ -1,58 +1,64 @@
|
||||
/* $NetBSD: cpu.c,v 1.7 2000/01/23 20:09:07 soda Exp $ */
|
||||
/* $NetBSD: cpu.c,v 1.8 2000/01/23 21:01:51 soda Exp $ */
|
||||
/* $OpenBSD: cpu.c,v 1.8 1997/04/19 17:19:41 pefo Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Author: Per Fogelstrom
|
||||
* Copyright (c) 1997 Per Fogelstrom
|
||||
*
|
||||
* 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
|
||||
* 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 under OpenBSD by
|
||||
* Per Fogelstrom.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
* 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.
|
||||
*
|
||||
* 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/proc.h>
|
||||
#include <sys/user.h>
|
||||
#include <sys/device.h>
|
||||
#include <vm/vm.h>
|
||||
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/autoconf.h>
|
||||
|
||||
|
||||
/* Definition of the driver for autoconfig. */
|
||||
static int cpumatch(struct device *, void *, void *);
|
||||
static int cpumatch(struct device *, struct cfdata *, void *);
|
||||
static void cpuattach(struct device *, struct device *, void *);
|
||||
|
||||
struct cfattach cpu_ca = {
|
||||
sizeof(struct device), cpumatch, cpuattach
|
||||
};
|
||||
|
||||
extern struct cfdriver cpu_cd;
|
||||
|
||||
extern void cpu_identify __P((void));
|
||||
|
||||
static int
|
||||
cpumatch(parent, cfdata, aux)
|
||||
cpumatch(parent, match, aux)
|
||||
struct device *parent;
|
||||
void *cfdata;
|
||||
struct cfdata *match;
|
||||
void *aux;
|
||||
{
|
||||
struct cfdata *cf = cfdata;
|
||||
struct confargs *ca = aux;
|
||||
|
||||
/* make sure that we're looking for a CPU. */
|
||||
@ -68,10 +74,12 @@ cpuattach(parent, dev, aux)
|
||||
struct device *dev;
|
||||
void *aux;
|
||||
{
|
||||
struct pcs *p;
|
||||
int needcomma, needrev, i;
|
||||
|
||||
printf(": ");
|
||||
cpu_identify();
|
||||
}
|
||||
|
||||
#if 1
|
||||
cpu_identify();
|
||||
#else /* XXX - before do this, fix pmax, newsmips */
|
||||
cpu_identify(dev);
|
||||
#endif
|
||||
}
|
||||
|
@ -1,205 +1,391 @@
|
||||
/* $NetBSD: disksubr.c,v 1.6 2000/01/23 20:09:09 soda Exp $ */
|
||||
/* $NetBSD: disksubr.c,v 1.7 2000/01/23 21:01:51 soda Exp $ */
|
||||
/* $OpenBSD: disksubr.c,v 1.14 1997/05/08 00:14:29 deraadt Exp $ */
|
||||
/* NetBSD: disksubr.c,v 1.40 1999/05/06 15:45:51 christos Exp */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
|
||||
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Authors: Keith Bostic, Chris G. Demetriou, Per Fogelstrom (R4000)
|
||||
*
|
||||
* 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
|
||||
* 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.
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
* 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.
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie the
|
||||
* rights to redistribute these changes.
|
||||
* @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/ioccom.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/disklabel.h>
|
||||
#include <sys/disk.h>
|
||||
#include <sys/syslog.h>
|
||||
|
||||
#include <dev/scsipi/scsi_all.h>
|
||||
#include <dev/scsipi/scsipi_all.h>
|
||||
#include <dev/scsipi/scsiconf.h>
|
||||
#include "opt_mbr.h"
|
||||
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/autoconf.h>
|
||||
int fat_types[] = { MBR_PTYPE_FAT12, MBR_PTYPE_FAT16S,
|
||||
MBR_PTYPE_FAT16B, MBR_PTYPE_FAT32,
|
||||
MBR_PTYPE_FAT32L, MBR_PTYPE_FAT16L,
|
||||
-1 };
|
||||
|
||||
extern struct device *bootdv;
|
||||
#define NO_MBR_SIGNATURE ((struct mbr_partition *) -1)
|
||||
|
||||
/* was this the boot device ? */
|
||||
void
|
||||
dk_establish(dk, dev)
|
||||
struct disk *dk;
|
||||
struct device *dev;
|
||||
static struct mbr_partition *
|
||||
mbr_findslice __P((struct mbr_partition* dp, struct buf *bp));
|
||||
|
||||
|
||||
/*
|
||||
* Scan MBR for NetBSD partittion.
|
||||
*
|
||||
* OpenBSD source suggests MBR_MAGIC does not always exist, so,
|
||||
* assume the MBR is valid.
|
||||
*
|
||||
* Copy valid MBR partition-table into dp, and if a NetBSD
|
||||
* partition is found, return a pointer to it; else return NULL.
|
||||
*/
|
||||
static
|
||||
struct mbr_partition *
|
||||
mbr_findslice(dp, bp)
|
||||
struct mbr_partition *dp;
|
||||
struct buf *bp;
|
||||
{
|
||||
#ifdef NOTDEF
|
||||
/* XXX: sd -> scsibus -> esp */
|
||||
struct bootpath *bp = ((struct esp_softc *)dev->dv_parent->dv_parent)->sc_bp;
|
||||
char name[10];
|
||||
|
||||
#define CRAZYMAP(v) ((v) == 3 ? 0 : (v) == 0 ? 3 : (v))
|
||||
|
||||
if (bp == NULL) {
|
||||
printf("no boot path\n");
|
||||
return;
|
||||
}
|
||||
sprintf(name, "%s%d", bp->name, CRAZYMAP(bp->val[0]));
|
||||
if (strcmp(name, dev->dv_xname) == 0) {
|
||||
bootdv = dev; /* got it! */
|
||||
}
|
||||
struct mbr_partition *ourdp = NULL;
|
||||
#if 0
|
||||
u_int16_t *mbrmagicp;
|
||||
#endif
|
||||
return;
|
||||
int i;
|
||||
|
||||
#if 0
|
||||
/* Note: Magic number is little-endian. */
|
||||
mbrmagicp = (u_int16_t *)(bp->b_data + MBR_MAGICOFF);
|
||||
if (*mbrmagicp != MBR_MAGIC)
|
||||
return (NO_MBR_SIGNATURE);
|
||||
#endif
|
||||
|
||||
/* XXX how do we check veracity/bounds of this? */
|
||||
memcpy(dp, bp->b_data + MBR_PARTOFF, NMBRPART * sizeof(*dp));
|
||||
|
||||
/* look for NetBSD partition */
|
||||
for (i = 0; i < NMBRPART; i++) {
|
||||
if (dp[i].mbrp_typ == MBR_PTYPE_NETBSD) {
|
||||
ourdp = &dp[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef COMPAT_386BSD_MBRPART
|
||||
/* didn't find it -- look for 386BSD partition */
|
||||
if (!ourdp) {
|
||||
for (i = 0; i < NMBRPART; i++) {
|
||||
if (dp[i].mbrp_typ == MBR_PTYPE_386BSD) {
|
||||
printf("WARNING: old BSD partition ID!\n");
|
||||
ourdp = &dp[i];
|
||||
/*
|
||||
* If more than one matches, take last,
|
||||
* as NetBSD install tool does.
|
||||
*/
|
||||
#if 0
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* COMPAT_386BSD_MBRPART */
|
||||
|
||||
/* didn't find it -- look for OpenBSD partition */
|
||||
if (!ourdp) {
|
||||
for (i = 0; i < NMBRPART; i++) {
|
||||
if (dp[i].mbrp_typ == MBR_PTYPE_OPENBSD) {
|
||||
printf("WARNING: using OpenBSD partition\n");
|
||||
ourdp = &dp[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (ourdp);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Attempt to read a disk label from a device
|
||||
* using the indicated stategy routine.
|
||||
* The label must be partly set up before this:
|
||||
* secpercyl and anything required in the strategy routine
|
||||
* (e.g., sector size) must be filled in before calling us.
|
||||
* secpercyl, secsize and anything required for a block i/o read
|
||||
* operation in the driver's strategy/start routines
|
||||
* must be filled in before calling us.
|
||||
*
|
||||
* If dos partition table requested, attempt to load it and
|
||||
* find disklabel inside a DOS partition. Also, if bad block
|
||||
* table needed, attempt to extract it as well. Return buffer
|
||||
* for use in signalling errors if requested.
|
||||
*
|
||||
* Returns null on success and an error string on failure.
|
||||
*/
|
||||
char *
|
||||
readdisklabel(dev, strat, lp, clp)
|
||||
readdisklabel(dev, strat, lp, osdep)
|
||||
dev_t dev;
|
||||
void (*strat)();
|
||||
void (*strat) __P((struct buf *));
|
||||
struct disklabel *lp;
|
||||
struct cpu_disklabel *clp;
|
||||
struct cpu_disklabel *osdep;
|
||||
{
|
||||
struct mbr_partition *dp;
|
||||
struct partition *pp;
|
||||
struct dkbad *bdp;
|
||||
struct buf *bp;
|
||||
struct disklabel *dlp;
|
||||
struct dos_partition *dp = clp->dosparts;
|
||||
char *msg = NULL;
|
||||
int dospartoff = 0;
|
||||
int i;
|
||||
int dospartoff, cyl, i, *ip;
|
||||
int use_openbsd_part = 0;
|
||||
|
||||
/* minimal requirements for archtypal disk label */
|
||||
if (lp->d_secsize == 0)
|
||||
lp->d_secsize = DEV_BSIZE;
|
||||
if (lp->d_secperunit == 0)
|
||||
lp->d_secperunit = 0x1fffffff;
|
||||
lp->d_secperunit = 0x1fffffff;
|
||||
#if 0
|
||||
if (lp->d_ncylinders == 16383) {
|
||||
printf("disklabel: Disk > 8G ... readjusting chs %d/%d/%d to ",
|
||||
lp->d_ncylinders, lp->d_ntracks, lp->d_nsectors);
|
||||
lp->d_ncylinders = lp->d_secperunit / lp->d_ntracks / lp->d_nsectors;
|
||||
printf("%d/%d/%d\n",
|
||||
lp->d_ncylinders, lp->d_ntracks, lp->d_nsectors);
|
||||
}
|
||||
#endif
|
||||
lp->d_npartitions = RAW_PART + 1;
|
||||
for(i = 0; i < RAW_PART; i++) {
|
||||
for (i = 0; i < RAW_PART; i++) {
|
||||
lp->d_partitions[i].p_size = 0;
|
||||
lp->d_partitions[i].p_offset = 0;
|
||||
}
|
||||
if (lp->d_partitions[RAW_PART].p_size == 0)
|
||||
lp->d_partitions[RAW_PART].p_size = 0x1fffffff;
|
||||
lp->d_partitions[RAW_PART].p_offset = 0;
|
||||
if (lp->d_partitions[i].p_size == 0)
|
||||
lp->d_partitions[i].p_size = 0x1fffffff;
|
||||
lp->d_partitions[i].p_offset = 0;
|
||||
|
||||
/* obtain buffer to probe drive with */
|
||||
/* get a buffer and initialize it */
|
||||
bp = geteblk((int)lp->d_secsize);
|
||||
bp->b_dev = dev;
|
||||
|
||||
/* do dos partitions in the process of getting disklabel? */
|
||||
if (dp) {
|
||||
/* read master boot record */
|
||||
bp->b_blkno = DOSBBSECTOR;
|
||||
bp->b_bcount = lp->d_secsize;
|
||||
bp->b_flags = B_BUSY | B_READ;
|
||||
bp->b_resid = 0;
|
||||
(*strat)(bp);
|
||||
dospartoff = 0;
|
||||
cyl = LABELSECTOR / lp->d_secpercyl;
|
||||
if (!osdep)
|
||||
goto nombrpart;
|
||||
dp = osdep->dosparts;
|
||||
|
||||
/* if successful, wander through dos partition table */
|
||||
if (biowait(bp)) {
|
||||
msg = "dos partition I/O error";
|
||||
goto done;
|
||||
} else if (*(unsigned int *)(bp->b_data) == 0x8ec033fa) {
|
||||
/* XXX how do we check veracity/bounds of this? */
|
||||
bcopy(bp->b_data + DOSPARTOFF, dp, NDOSPART * sizeof(*dp));
|
||||
for (i = 0; i < NDOSPART; i++, dp++) {
|
||||
/* is this ours? */
|
||||
if (dp->dp_size && dp->dp_typ == DOSPTYP_386BSD
|
||||
&& dospartoff == 0) {
|
||||
dospartoff = dp->dp_start;
|
||||
|
||||
/* set part a to show NetBSD part */
|
||||
lp->d_partitions[0].p_size = dp->dp_size;
|
||||
lp->d_partitions[0].p_offset = dp->dp_start;
|
||||
lp->d_ntracks = dp->dp_ehd + 1;
|
||||
lp->d_nsectors = DPSECT(dp->dp_esect);
|
||||
lp->d_secpercyl = lp->d_ntracks * lp->d_nsectors;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/* next, dig out disk label */
|
||||
bp->b_blkno = dospartoff + LABELSECTOR;
|
||||
bp->b_resid = 0;
|
||||
/* XXX - OpenBSD supports disklabel in EXT partition, but we don't */
|
||||
/* read master boot record */
|
||||
bp->b_blkno = MBR_BBSECTOR;
|
||||
bp->b_bcount = lp->d_secsize;
|
||||
bp->b_flags = B_BUSY | B_READ;
|
||||
(*strat)(bp);
|
||||
bp->b_cylinder = MBR_BBSECTOR / lp->d_secpercyl;
|
||||
(*strat)(bp);
|
||||
|
||||
/* if successful, wander through dos partition table */
|
||||
if (biowait(bp)) {
|
||||
msg = "dos partition I/O error";
|
||||
goto done;
|
||||
} else {
|
||||
struct mbr_partition *ourdp = NULL;
|
||||
|
||||
ourdp = mbr_findslice(dp, bp);
|
||||
if (ourdp == NO_MBR_SIGNATURE)
|
||||
goto nombrpart;
|
||||
|
||||
for (i = 0; i < NMBRPART; i++, dp++) {
|
||||
/* Install in partition e, f, g, or h. */
|
||||
pp = &lp->d_partitions[RAW_PART + 1 + i];
|
||||
pp->p_offset = dp->mbrp_start;
|
||||
pp->p_size = dp->mbrp_size;
|
||||
for (ip = fat_types; *ip != -1; ip++) {
|
||||
if (dp->mbrp_typ == *ip)
|
||||
pp->p_fstype = FS_MSDOS;
|
||||
}
|
||||
if (dp->mbrp_typ == MBR_PTYPE_LNXEXT2)
|
||||
pp->p_fstype = FS_EX2FS;
|
||||
|
||||
if (dp->mbrp_typ == MBR_PTYPE_NTFS)
|
||||
pp->p_fstype = FS_NTFS;
|
||||
|
||||
/* is this ours? */
|
||||
if (dp == ourdp) {
|
||||
/* need sector address for SCSI/IDE,
|
||||
cylinder for ESDI/ST506/RLL */
|
||||
dospartoff = dp->mbrp_start;
|
||||
cyl = MBR_PCYL(dp->mbrp_scyl, dp->mbrp_ssect);
|
||||
|
||||
/* update disklabel with details */
|
||||
lp->d_partitions[2].p_size =
|
||||
dp->mbrp_size;
|
||||
lp->d_partitions[2].p_offset =
|
||||
dp->mbrp_start;
|
||||
|
||||
if (dp->mbrp_typ == MBR_PTYPE_OPENBSD) {
|
||||
use_openbsd_part = 1;
|
||||
}
|
||||
#if 0
|
||||
if (lp->d_ntracks != dp->mbrp_ehd + 1 ||
|
||||
lp->d_nsectors != DPSECT(dp->mbrp_esect)) {
|
||||
printf("disklabel: BIOS sees chs %d/%d/%d as ",
|
||||
lp->d_ncylinders, lp->d_ntracks,
|
||||
lp->d_nsectors);
|
||||
lp->d_ntracks = dp->mbrp_ehd + 1;
|
||||
lp->d_nsectors = DPSECT(dp->mbrp_esect);
|
||||
lp->d_secpercyl = lp->d_ntracks * lp->d_nsectors;
|
||||
lp->d_ncylinders = lp->d_secperunit / lp->d_secpercyl;
|
||||
if (! lp->d_ncylinders)
|
||||
lp->d_ncylinders = 1;
|
||||
printf("%d/%d/%d\n",
|
||||
lp->d_ncylinders, lp->d_ntracks,
|
||||
lp->d_nsectors);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
lp->d_npartitions = RAW_PART + 1 + i;
|
||||
}
|
||||
|
||||
nombrpart:
|
||||
/* next, dig out disk label */
|
||||
bp->b_blkno = dospartoff + LABELSECTOR;
|
||||
bp->b_cylinder = cyl;
|
||||
bp->b_bcount = lp->d_secsize;
|
||||
bp->b_flags = B_BUSY | B_READ;
|
||||
(*strat)(bp);
|
||||
|
||||
/* if successful, locate disk label within block and validate */
|
||||
if (biowait(bp)) {
|
||||
msg = "disk label read error";
|
||||
msg = "disk label I/O error";
|
||||
goto done;
|
||||
}
|
||||
for (dlp = (struct disklabel *)bp->b_data;
|
||||
dlp <= (struct disklabel *)(bp->b_data + lp->d_secsize - sizeof(*dlp));
|
||||
dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
|
||||
if (dlp->d_magic != DISKMAGIC || dlp->d_magic2 != DISKMAGIC) {
|
||||
if (msg == NULL)
|
||||
msg = "no disk label";
|
||||
} else if (dlp->d_npartitions > MAXPARTITIONS ||
|
||||
dkcksum(dlp) != 0)
|
||||
msg = "disk label corrupted";
|
||||
else {
|
||||
if (use_openbsd_part) {
|
||||
if (dlp->d_npartitions < MAXPARTITIONS) {
|
||||
/* save OpenBSD d partition */
|
||||
dlp->d_partitions[dlp->d_npartitions] =
|
||||
dlp->d_partitions[RAW_PART];
|
||||
dlp->d_npartitions++;
|
||||
}
|
||||
dlp->d_partitions[RAW_PART] =
|
||||
dlp->d_partitions[OPENBSD_RAW_PART];
|
||||
dlp->d_partitions[OPENBSD_RAW_PART] =
|
||||
lp->d_partitions[2];
|
||||
}
|
||||
*lp = *dlp;
|
||||
msg = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (msg) {
|
||||
/* XXX - OpenBSD calls iso_disklabelspoof() here */
|
||||
goto done;
|
||||
}
|
||||
|
||||
dlp = (struct disklabel *)(bp->b_un.b_addr + LABELOFFSET);
|
||||
if (dlp->d_magic == DISKMAGIC) {
|
||||
if (dkcksum(dlp)) {
|
||||
msg = "NetBSD disk label corrupted";
|
||||
goto done;
|
||||
}
|
||||
*lp = *dlp;
|
||||
goto done;
|
||||
/* obtain bad sector table if requested and present */
|
||||
if (osdep && (lp->d_flags & D_BADSECT)) {
|
||||
struct dkbad *db;
|
||||
|
||||
bdp = &osdep->bad;
|
||||
i = 0;
|
||||
do {
|
||||
/* read a bad sector table */
|
||||
bp->b_flags = B_BUSY | B_READ;
|
||||
bp->b_blkno = lp->d_secperunit - lp->d_nsectors + i;
|
||||
if (lp->d_secsize > DEV_BSIZE)
|
||||
bp->b_blkno *= lp->d_secsize / DEV_BSIZE;
|
||||
else
|
||||
bp->b_blkno /= DEV_BSIZE / lp->d_secsize;
|
||||
bp->b_bcount = lp->d_secsize;
|
||||
bp->b_cylinder = lp->d_ncylinders - 1;
|
||||
(*strat)(bp);
|
||||
|
||||
/* if successful, validate, otherwise try another */
|
||||
if (biowait(bp)) {
|
||||
msg = "bad sector table I/O error";
|
||||
} else {
|
||||
db = (struct dkbad *)(bp->b_data);
|
||||
#define DKBAD_MAGIC 0x4321
|
||||
if (db->bt_mbz == 0
|
||||
&& db->bt_flag == DKBAD_MAGIC) {
|
||||
msg = NULL;
|
||||
*bdp = *db;
|
||||
break;
|
||||
} else
|
||||
msg = "bad sector table corrupted";
|
||||
}
|
||||
} while ((bp->b_flags & B_ERROR) && (i += 2) < 10 &&
|
||||
i < lp->d_nsectors);
|
||||
}
|
||||
msg = "no disk label";
|
||||
|
||||
done:
|
||||
bp->b_flags = B_INVAL | B_AGE | B_READ;
|
||||
bp->b_flags |= B_INVAL;
|
||||
brelse(bp);
|
||||
return (msg);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check new disk label for sensibility before setting it.
|
||||
* Check new disk label for sensibility
|
||||
* before setting it.
|
||||
*/
|
||||
int
|
||||
setdisklabel(olp, nlp, openmask, clp)
|
||||
register struct disklabel *olp, *nlp;
|
||||
setdisklabel(olp, nlp, openmask, osdep)
|
||||
struct disklabel *olp, *nlp;
|
||||
u_long openmask;
|
||||
struct cpu_disklabel *clp;
|
||||
struct cpu_disklabel *osdep;
|
||||
{
|
||||
register i;
|
||||
register struct partition *opp, *npp;
|
||||
int i;
|
||||
struct partition *opp, *npp;
|
||||
|
||||
/* sanity clause */
|
||||
if (nlp->d_secpercyl == 0 || nlp->d_secsize == 0 ||
|
||||
(nlp->d_secsize % DEV_BSIZE) != 0)
|
||||
return(EINVAL);
|
||||
if (nlp->d_secpercyl == 0 || nlp->d_secsize == 0
|
||||
|| (nlp->d_secsize % DEV_BSIZE) != 0)
|
||||
return(EINVAL);
|
||||
|
||||
#ifdef notdef
|
||||
/* XXX WHY WAS THIS HERE?! */
|
||||
/* special case to allow disklabel to be invalidated */
|
||||
if (nlp->d_magic == 0xffffffff) {
|
||||
if (nlp->d_magic == 0xffffffff) {
|
||||
*olp = *nlp;
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (nlp->d_magic != DISKMAGIC || nlp->d_magic2 != DISKMAGIC ||
|
||||
dkcksum(nlp) != 0)
|
||||
dkcksum(nlp) != 0)
|
||||
return (EINVAL);
|
||||
|
||||
while ((i = ffs((long)openmask)) != 0) {
|
||||
i--;
|
||||
/* XXX missing check if other dos partitions will be overwritten */
|
||||
|
||||
while (openmask != 0) {
|
||||
i = ffs(openmask) - 1;
|
||||
openmask &= ~(1 << i);
|
||||
if (nlp->d_npartitions <= i)
|
||||
return (EBUSY);
|
||||
@ -208,9 +394,9 @@ setdisklabel(olp, nlp, openmask, clp)
|
||||
if (npp->p_offset != opp->p_offset || npp->p_size < opp->p_size)
|
||||
return (EBUSY);
|
||||
/*
|
||||
* Copy internally-set partition information
|
||||
* if new label doesn't include it. XXX
|
||||
*/
|
||||
* Copy internally-set partition information
|
||||
* if new label doesn't include it. XXX
|
||||
*/
|
||||
if (npp->p_fstype == FS_UNUSED && opp->p_fstype != FS_UNUSED) {
|
||||
npp->p_fstype = opp->p_fstype;
|
||||
npp->p_fsize = opp->p_fsize;
|
||||
@ -218,78 +404,108 @@ setdisklabel(olp, nlp, openmask, clp)
|
||||
npp->p_cpg = opp->p_cpg;
|
||||
}
|
||||
}
|
||||
nlp->d_checksum = 0;
|
||||
nlp->d_checksum = dkcksum(nlp);
|
||||
nlp->d_checksum = 0;
|
||||
nlp->d_checksum = dkcksum(nlp);
|
||||
*olp = *nlp;
|
||||
return (0);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Write disk label back to device after modification.
|
||||
* this means write out the Rigid disk blocks to represent the
|
||||
* label. Hope the user was carefull.
|
||||
*/
|
||||
int
|
||||
writedisklabel(dev, strat, lp, clp)
|
||||
writedisklabel(dev, strat, lp, osdep)
|
||||
dev_t dev;
|
||||
void (*strat)();
|
||||
register struct disklabel *lp;
|
||||
struct cpu_disklabel *clp;
|
||||
void (*strat) __P((struct buf *));
|
||||
struct disklabel *lp;
|
||||
struct cpu_disklabel *osdep;
|
||||
{
|
||||
struct buf *bp;
|
||||
struct mbr_partition *dp;
|
||||
struct buf *bp;
|
||||
struct disklabel *dlp;
|
||||
struct dos_partition *dp = clp->dosparts;
|
||||
int error = 0, i;
|
||||
int dospartoff = 0;
|
||||
int error, dospartoff, cyl;
|
||||
|
||||
/* get a buffer and initialize it */
|
||||
bp = geteblk((int)lp->d_secsize);
|
||||
bp->b_dev = dev;
|
||||
|
||||
/* do dos partitions in the process of getting disklabel? */
|
||||
if (dp) {
|
||||
/* read master boot record */
|
||||
bp->b_blkno = DOSBBSECTOR;
|
||||
bp->b_bcount = lp->d_secsize;
|
||||
bp->b_flags = B_BUSY | B_READ;
|
||||
bp->b_resid = 0;
|
||||
(*strat)(bp);
|
||||
dospartoff = 0;
|
||||
cyl = LABELSECTOR / lp->d_secpercyl;
|
||||
if (!osdep)
|
||||
goto nombrpart;
|
||||
dp = osdep->dosparts;
|
||||
|
||||
if (((error = biowait(bp)) == 0)
|
||||
&& *(unsigned int *)(bp->b_data) == 0x8ec033fa) {
|
||||
/* XXX how do we check veracity/bounds of this? */
|
||||
bcopy(bp->b_data + DOSPARTOFF, dp, NDOSPART * sizeof(*dp));
|
||||
for (i = 0; i < NDOSPART; i++, dp++) {
|
||||
/* is this ours? */
|
||||
if (dp->dp_size && dp->dp_typ == DOSPTYP_386BSD
|
||||
&& dospartoff == 0) {
|
||||
dospartoff = dp->dp_start;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
bp->b_blkno = dospartoff + LABELSECTOR;
|
||||
bp->b_resid = 0;
|
||||
/* read master boot record */
|
||||
bp->b_blkno = MBR_BBSECTOR;
|
||||
bp->b_bcount = lp->d_secsize;
|
||||
bp->b_flags = B_READ; /* get current label */
|
||||
bp->b_flags = B_BUSY | B_READ;
|
||||
bp->b_cylinder = MBR_BBSECTOR / lp->d_secpercyl;
|
||||
(*strat)(bp);
|
||||
if (error = biowait(bp))
|
||||
|
||||
if ((error = biowait(bp)) == 0) {
|
||||
struct mbr_partition *ourdp = NULL;
|
||||
|
||||
ourdp = mbr_findslice(dp, bp);
|
||||
if (ourdp == NO_MBR_SIGNATURE)
|
||||
goto nombrpart;
|
||||
|
||||
if (ourdp->mbrp_typ == MBR_PTYPE_OPENBSD) {
|
||||
/* do not override OpenBSD disklabel */
|
||||
error = ESRCH;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (ourdp) {
|
||||
/* need sector address for SCSI/IDE,
|
||||
cylinder for ESDI/ST506/RLL */
|
||||
dospartoff = ourdp->mbrp_start;
|
||||
cyl = MBR_PCYL(ourdp->mbrp_scyl, ourdp->mbrp_ssect);
|
||||
}
|
||||
}
|
||||
|
||||
nombrpart:
|
||||
#ifdef maybe
|
||||
/* disklabel in appropriate location? */
|
||||
if (lp->d_partitions[2].p_offset != 0
|
||||
&& lp->d_partitions[2].p_offset != dospartoff) {
|
||||
error = EXDEV;
|
||||
goto done;
|
||||
}
|
||||
#endif
|
||||
|
||||
dlp = (struct disklabel *)(bp->b_un.b_addr + LABELOFFSET);
|
||||
*dlp = *lp; /* struct assignment */
|
||||
|
||||
bp->b_flags = B_WRITE;
|
||||
/* next, dig out disk label */
|
||||
bp->b_blkno = dospartoff + LABELSECTOR;
|
||||
bp->b_cylinder = cyl;
|
||||
bp->b_bcount = lp->d_secsize;
|
||||
bp->b_flags = B_BUSY | B_READ;
|
||||
(*strat)(bp);
|
||||
error = biowait(bp);
|
||||
|
||||
/* if successful, locate disk label within block and validate */
|
||||
if ((error = biowait(bp)) != 0)
|
||||
goto done;
|
||||
for (dlp = (struct disklabel *)bp->b_data;
|
||||
dlp <= (struct disklabel *)(bp->b_data + lp->d_secsize - sizeof(*dlp));
|
||||
dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
|
||||
if (dlp->d_magic == DISKMAGIC && dlp->d_magic2 == DISKMAGIC &&
|
||||
dkcksum(dlp) == 0) {
|
||||
*dlp = *lp;
|
||||
bp->b_flags = B_BUSY | B_WRITE;
|
||||
(*strat)(bp);
|
||||
error = biowait(bp);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
error = ESRCH;
|
||||
|
||||
done:
|
||||
bp->b_flags |= B_INVAL;
|
||||
brelse(bp);
|
||||
return (error);
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* Determine the size of the transfer, and make sure it is
|
||||
* within the boundaries of the partition. Adjust transfer
|
||||
* if needed, and signal errors or early completion.
|
||||
@ -300,41 +516,54 @@ bounds_check_with_label(bp, lp, wlabel)
|
||||
struct disklabel *lp;
|
||||
int wlabel;
|
||||
{
|
||||
#define dkpart(dev) (minor(dev) & 7)
|
||||
struct partition *p = lp->d_partitions + DISKPART(bp->b_dev);
|
||||
int labelsector = lp->d_partitions[2].p_offset + LABELSECTOR;
|
||||
int sz;
|
||||
|
||||
struct partition *p = lp->d_partitions + dkpart(bp->b_dev);
|
||||
int labelsect = lp->d_partitions[RAW_PART].p_offset;
|
||||
int maxsz = p->p_size;
|
||||
int sz = (bp->b_bcount + DEV_BSIZE - 1) >> DEV_BSHIFT;
|
||||
sz = howmany(bp->b_bcount, lp->d_secsize);
|
||||
|
||||
/* overwriting disk label ? */
|
||||
/* XXX should also protect bootstrap in first 8K */
|
||||
if (bp->b_blkno + p->p_offset == LABELSECTOR + labelsect &&
|
||||
(bp->b_flags & B_READ) == 0 && wlabel == 0) {
|
||||
if (bp->b_blkno + sz > p->p_size) {
|
||||
sz = p->p_size - bp->b_blkno;
|
||||
if (sz == 0) {
|
||||
/* If exactly at end of disk, return EOF. */
|
||||
bp->b_resid = bp->b_bcount;
|
||||
goto done;
|
||||
}
|
||||
if (sz < 0) {
|
||||
/* If past end of disk, return EINVAL. */
|
||||
bp->b_error = EINVAL;
|
||||
goto bad;
|
||||
}
|
||||
/* Otherwise, truncate request. */
|
||||
bp->b_bcount = sz << DEV_BSHIFT;
|
||||
}
|
||||
|
||||
/* Overwriting disk label? */
|
||||
if (bp->b_blkno + p->p_offset <= labelsector &&
|
||||
#if LABELSECTOR != 0
|
||||
bp->b_blkno + p->p_offset + sz > labelsector &&
|
||||
#endif
|
||||
(bp->b_flags & B_READ) == 0 && !wlabel) {
|
||||
bp->b_error = EROFS;
|
||||
goto bad;
|
||||
}
|
||||
|
||||
/* beyond partition? */
|
||||
if (bp->b_blkno < 0 || bp->b_blkno + sz > maxsz) {
|
||||
/* if exactly at end of disk, return an EOF */
|
||||
if (bp->b_blkno == maxsz) {
|
||||
bp->b_resid = bp->b_bcount;
|
||||
return(0);
|
||||
}
|
||||
/* or truncate if part of it fits */
|
||||
sz = maxsz - bp->b_blkno;
|
||||
if (sz <= 0) {
|
||||
bp->b_error = EINVAL;
|
||||
goto bad;
|
||||
}
|
||||
bp->b_bcount = sz << DEV_BSHIFT;
|
||||
}
|
||||
|
||||
/* calculate cylinder for disksort to order transfers with */
|
||||
bp->b_resid = (bp->b_blkno + p->p_offset) / lp->d_secpercyl;
|
||||
return(1);
|
||||
bp->b_cylinder = (bp->b_blkno + p->p_offset) /
|
||||
(lp->d_secsize / DEV_BSIZE) / lp->d_secpercyl;
|
||||
return (1);
|
||||
|
||||
bad:
|
||||
bp->b_flags |= B_ERROR;
|
||||
return(-1);
|
||||
done:
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* For bootstrapping / device */
|
||||
void
|
||||
dk_establish(dk, dev)
|
||||
struct disk *dk;
|
||||
struct device *dev;
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -1,11 +1,190 @@
|
||||
/* $NetBSD: locore_machdep.S,v 1.4 2000/01/23 20:08:53 soda Exp $ */
|
||||
/* $NetBSD: locore_machdep.S,v 1.5 2000/01/23 21:01:51 soda Exp $ */
|
||||
/* $OpenBSD: locore.S,v 1.12 1997/04/19 17:19:43 pefo Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Digital Equipment Corporation 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.
|
||||
*
|
||||
* Copyright (C) 1989 Digital Equipment Corporation.
|
||||
* Permission to use, copy, modify, and distribute this software and
|
||||
* its documentation for any purpose and without fee is hereby granted,
|
||||
* provided that the above copyright notice appears in all copies.
|
||||
* Digital Equipment Corporation makes no representations about the
|
||||
* suitability of this software for any purpose. It is provided "as is"
|
||||
* without express or implied warranty.
|
||||
*
|
||||
* from: Header: /sprite/src/kernel/mach/ds3100.md/RCS/loMem.s,
|
||||
* v 1.1 89/07/11 17:55:04 nelson Exp SPRITE (DECWRL)
|
||||
* from: Header: /sprite/src/kernel/mach/ds3100.md/RCS/machAsm.s,
|
||||
* v 9.2 90/01/29 18:00:39 shirriff Exp SPRITE (DECWRL)
|
||||
* from: Header: /sprite/src/kernel/vm/ds3100.md/vmPmaxAsm.s,
|
||||
* v 1.1 89/07/10 14:27:41 nelson Exp SPRITE (DECWRL)
|
||||
*
|
||||
* from: @(#)locore.s 8.5 (Berkeley) 1/4/94
|
||||
*/
|
||||
|
||||
/*
|
||||
* ARC-specific mips locore code
|
||||
*/
|
||||
|
||||
#include <mips/asm.h>
|
||||
#include <mips/cpuregs.h> /* XXX - misnomer? */
|
||||
#include <machine/endian.h>
|
||||
|
||||
.set noreorder
|
||||
|
||||
/*
|
||||
* GCC2 seems to want to call __main in main() for some reason.
|
||||
*/
|
||||
LEAF(__main)
|
||||
j ra
|
||||
nop
|
||||
END(__main)
|
||||
|
||||
|
||||
/*
|
||||
* Block I/O routines mainly used by I/O drivers.
|
||||
*
|
||||
* Args as: a0 = port
|
||||
* a1 = memory address
|
||||
* a2 = count
|
||||
*/
|
||||
LEAF(insb)
|
||||
beq a2, zero, 2f
|
||||
addu a2, a1
|
||||
1:
|
||||
lbu v0, 0(a0)
|
||||
addiu a1, 1
|
||||
bne a1, a2, 1b
|
||||
sb v0, -1(a1)
|
||||
2:
|
||||
jr ra
|
||||
nop
|
||||
END(insb)
|
||||
|
||||
LEAF(insw)
|
||||
beq a2, zero, 2f
|
||||
addu a2, a2
|
||||
addu a2, a1
|
||||
1:
|
||||
lhu v0, 0(a0)
|
||||
addiu a1, 2
|
||||
bne a1, a2, 1b
|
||||
sh v0, -2(a1)
|
||||
2:
|
||||
jr ra
|
||||
nop
|
||||
END(insw)
|
||||
|
||||
LEAF(insl)
|
||||
beq a2, zero, 2f
|
||||
sll a2, 2
|
||||
addu a2, a1
|
||||
1:
|
||||
lw v0, 0(a0)
|
||||
addiu a1, 4
|
||||
bne a1, a2, 1b
|
||||
sw v0, -4(a1)
|
||||
2:
|
||||
jr ra
|
||||
nop
|
||||
END(insl)
|
||||
|
||||
LEAF(outsb)
|
||||
beq a2, zero, 2f
|
||||
addu a2, a1
|
||||
1:
|
||||
lbu v0, 0(a1)
|
||||
addiu a1, 1
|
||||
bne a1, a2, 1b
|
||||
sb v0, 0(a0)
|
||||
2:
|
||||
jr ra
|
||||
nop
|
||||
END(outsb)
|
||||
|
||||
LEAF(outsw)
|
||||
beq a2, zero, 2f
|
||||
addu a2, a2
|
||||
li v0, 1
|
||||
and v0, a1
|
||||
bne v0, zero, 3f # arghh, unaligned.
|
||||
addu a2, a1
|
||||
1:
|
||||
lhu v0, 0(a1)
|
||||
addiu a1, 2
|
||||
bne a1, a2, 1b
|
||||
sh v0, 0(a0)
|
||||
2:
|
||||
jr ra
|
||||
nop
|
||||
3:
|
||||
LWHI v0, 0(a1)
|
||||
LWLO v0, 3(a1)
|
||||
addiu a1, 2
|
||||
bne a1, a2, 3b
|
||||
sh v0, 0(a0)
|
||||
|
||||
jr ra
|
||||
nop
|
||||
END(outsw)
|
||||
|
||||
LEAF(outsl)
|
||||
beq a2, zero, 2f
|
||||
sll a2, 2
|
||||
li v0, 3
|
||||
and v0, a1
|
||||
bne v0, zero, 3f # arghh, unaligned.
|
||||
addu a2, a1
|
||||
1:
|
||||
lw v0, 0(a1)
|
||||
addiu a1, 4
|
||||
bne a1, a2, 1b
|
||||
sw v0, 0(a0)
|
||||
2:
|
||||
jr ra
|
||||
nop
|
||||
3:
|
||||
LWHI v0, 0(a1)
|
||||
LWLO v0, 3(a1)
|
||||
addiu a1, 4
|
||||
bne a1, a2, 3b
|
||||
sw v0, 0(a0)
|
||||
|
||||
jr ra
|
||||
nop
|
||||
END(outsl)
|
||||
|
||||
/*
|
||||
* fillw(pat, addr, count)
|
||||
@ -21,29 +200,209 @@ LEAF(fillw)
|
||||
nop
|
||||
END(fillw)
|
||||
|
||||
/*#ifdef DEBUG*/ /* for minidebug.c: fix trap() to use this */
|
||||
#if 0
|
||||
/*
|
||||
* Read a long and return it.
|
||||
* Note: addresses can be unaligned!
|
||||
*
|
||||
* long
|
||||
L* mdbpeek(addr)
|
||||
L* caddt_t addr;
|
||||
L* {
|
||||
L* return (*(long *)addr);
|
||||
L* }
|
||||
*/
|
||||
LEAF(mdbpeek)
|
||||
li v0, MDBERR
|
||||
sw v0, UADDR+U_PCB_ONFAULT
|
||||
and v0, a0, 3 # unaligned address?
|
||||
bne v0, zero, 1f
|
||||
nop
|
||||
b 2f
|
||||
lw v0, (a0) # aligned access
|
||||
1:
|
||||
LWHI v0, 0(a0) # get next 4 bytes (unaligned)
|
||||
LWLO v0, 3(a0)
|
||||
2:
|
||||
j ra # made it w/o errors
|
||||
sw zero, UADDR+U_PCB_ONFAULT
|
||||
mdberr:
|
||||
li v0, 1 # trap sends us here
|
||||
sw v0, mdbmkfault
|
||||
j ra
|
||||
nop
|
||||
END(mdbpeek)
|
||||
|
||||
/*
|
||||
* Write a long to 'addr'.
|
||||
* Note: addresses can be unaligned!
|
||||
*
|
||||
L* void
|
||||
L* mdbpoke(addr, value)
|
||||
L* caddt_t addr;
|
||||
L* long value;
|
||||
L* {
|
||||
L* *(long *)addr = value;
|
||||
L* }
|
||||
*/
|
||||
LEAF(mdbpoke)
|
||||
li v0, MDBERR
|
||||
sw v0, UADDR+U_PCB_ONFAULT
|
||||
and v0, a0, 3 # unaligned address?
|
||||
bne v0, zero, 1f
|
||||
nop
|
||||
b 2f
|
||||
sw a1, (a0) # aligned access
|
||||
1:
|
||||
SWHI a1, 0(a0) # store next 4 bytes (unaligned)
|
||||
SWLO a1, 3(a0)
|
||||
and a0, a0, ~3 # align address for cache flush
|
||||
2:
|
||||
sw zero, UADDR+U_PCB_ONFAULT
|
||||
b R4K_FlushICache # flush instruction cache
|
||||
li a1, 8
|
||||
END(mdbpoke)
|
||||
|
||||
/*
|
||||
* Save registers and state so we can do a 'mdbreset' (like longjmp) later.
|
||||
* Always returns zero.
|
||||
*
|
||||
L* int mdb_savearea[11];
|
||||
L*
|
||||
L* int
|
||||
L* mdbsetexit()
|
||||
L* {
|
||||
L* mdb_savearea[0] = 0;
|
||||
L* return (0);
|
||||
L* }
|
||||
*/
|
||||
.comm mdb_savearea, (11 * 4)
|
||||
|
||||
LEAF(mdbsetexit)
|
||||
la a0, mdb_savearea
|
||||
sw s0, 0(a0)
|
||||
sw s1, 4(a0)
|
||||
sw s2, 8(a0)
|
||||
sw s3, 12(a0)
|
||||
sw s4, 16(a0)
|
||||
sw s5, 20(a0)
|
||||
sw s6, 24(a0)
|
||||
sw s7, 28(a0)
|
||||
sw sp, 32(a0)
|
||||
sw s8, 36(a0)
|
||||
sw ra, 40(a0)
|
||||
j ra
|
||||
move v0, zero
|
||||
END(mdbsetexit)
|
||||
|
||||
/*
|
||||
* Restore registers and state (like longjmp) and return x.
|
||||
*
|
||||
L* int
|
||||
L* mdbreset(x)
|
||||
L* {
|
||||
L* return (x);
|
||||
L* }
|
||||
*/
|
||||
LEAF(mdbreset)
|
||||
la v0, mdb_savearea
|
||||
lw ra, 40(v0)
|
||||
lw s0, 0(v0)
|
||||
lw s1, 4(v0)
|
||||
lw s2, 8(v0)
|
||||
lw s3, 12(v0)
|
||||
lw s4, 16(v0)
|
||||
lw s5, 20(v0)
|
||||
lw s6, 24(v0)
|
||||
lw s7, 28(v0)
|
||||
lw sp, 32(v0)
|
||||
lw s8, 36(v0)
|
||||
j ra
|
||||
move v0, a0
|
||||
END(mdbreset)
|
||||
|
||||
/*
|
||||
* Trap into the debugger.
|
||||
*
|
||||
L* void
|
||||
L* mdbpanic()
|
||||
L* {
|
||||
L* }
|
||||
*/
|
||||
LEAF(mdbpanic)
|
||||
break BREAK_SOVER_VAL
|
||||
j ra
|
||||
nop
|
||||
END(mdbpanic)
|
||||
#endif /* DEBUG */
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
*
|
||||
* mips3_TLBWriteIndexedVPS --
|
||||
*
|
||||
* Write the given entry into the TLB at the given index.
|
||||
* Pass full r4000 tlb info icnluding variable page size mask.
|
||||
*
|
||||
* mips3_TLBWriteIndexed(index, tlb)
|
||||
* unsigned index;
|
||||
* tlb *tlb;
|
||||
*
|
||||
* Results:
|
||||
* None.
|
||||
*
|
||||
* Side effects:
|
||||
* TLB entry set.
|
||||
*
|
||||
*--------------------------------------------------------------------------
|
||||
*/
|
||||
LEAF(mips3_TLBWriteIndexedVPS)
|
||||
mfc0 v1, MIPS_COP_0_STATUS_REG # Save the status register.
|
||||
mtc0 zero, MIPS_COP_0_STATUS_REG # Disable interrupts
|
||||
nop
|
||||
lw a2, 8(a1)
|
||||
lw a3, 12(a1)
|
||||
dmfc0 t0, MIPS_COP_0_TLB_HI # Save the current PID.
|
||||
|
||||
dmtc0 a2, MIPS_COP_0_TLB_LO0 # Set up entry low0.
|
||||
dmtc0 a3, MIPS_COP_0_TLB_LO1 # Set up entry low1.
|
||||
nop
|
||||
lw a2, 0(a1)
|
||||
lw a3, 4(a1)
|
||||
nop
|
||||
mtc0 a0, MIPS_COP_0_TLB_INDEX # Set the index.
|
||||
dmtc0 a2, MIPS_COP_0_TLB_PG_MASK # Set up entry mask.
|
||||
dmtc0 a3, MIPS_COP_0_TLB_HI # Set up entry high.
|
||||
nop
|
||||
tlbwi # Write the TLB
|
||||
nop
|
||||
nop
|
||||
nop # Delay for effect
|
||||
nop
|
||||
|
||||
dmtc0 t0, MIPS_COP_0_TLB_HI # Restore the PID.
|
||||
nop
|
||||
dmtc0 zero, MIPS_COP_0_TLB_PG_MASK # Default mask value.
|
||||
j ra
|
||||
mtc0 v1, MIPS_COP_0_STATUS_REG # Restore the status register
|
||||
END(mips3_TLBWriteIndexedVPS)
|
||||
|
||||
|
||||
/*
|
||||
* Interrupt counters for vmstat.
|
||||
* XXX These aren't used yet.
|
||||
*/
|
||||
.data
|
||||
.globl intrcnt
|
||||
.globl eintrcnt
|
||||
.globl intrnames
|
||||
.globl eintrnames
|
||||
intrnames:
|
||||
.asciiz "spur"
|
||||
.asciiz "hil"
|
||||
.asciiz "lev2"
|
||||
.asciiz "lev3"
|
||||
.asciiz "lev4"
|
||||
.asciiz "lev5"
|
||||
.asciiz "dma"
|
||||
.asciiz "clock"
|
||||
.asciiz "statclock"
|
||||
.asciiz "nmi"
|
||||
eintrnames:
|
||||
.align 2
|
||||
intrcnt:
|
||||
.word 0,0,0,0,0,0,0,0,0,0
|
||||
eintrcnt:
|
||||
.globl _C_LABEL(intrcnt)
|
||||
.globl _C_LABEL(eintrcnt)
|
||||
.globl _C_LABEL(intrnames)
|
||||
.globl _C_LABEL(eintrnames)
|
||||
_C_LABEL(intrnames):
|
||||
.asciiz "softclock"
|
||||
.asciiz "softnet"
|
||||
.asciiz "fpu"
|
||||
_C_LABEL(eintrnames):
|
||||
.align 3
|
||||
_C_LABEL(intrcnt):
|
||||
.word 0,0,0
|
||||
_C_LABEL(eintrcnt):
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,6 @@
|
||||
/* $NetBSD: mainbus.c,v 1.7 2000/01/23 20:09:14 soda Exp $ */
|
||||
/* $NetBSD: mainbus.c,v 1.8 2000/01/23 21:01:52 soda Exp $ */
|
||||
/* $OpenBSD: mainbus.c,v 1.6 1997/04/19 17:19:45 pefo Exp $ */
|
||||
/* NetBSD: mainbus.c,v 1.3 1995/06/28 02:45:10 cgd Exp */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
|
||||
@ -32,7 +34,7 @@
|
||||
#include <sys/device.h>
|
||||
#include <sys/reboot.h>
|
||||
|
||||
#include <pica/pica/picatype.h>
|
||||
#include <arc/arc/arctype.h>
|
||||
#include <machine/autoconf.h>
|
||||
|
||||
struct mainbus_softc {
|
||||
@ -41,7 +43,7 @@ struct mainbus_softc {
|
||||
};
|
||||
|
||||
/* Definition of the mainbus driver. */
|
||||
static int mbmatch __P((struct device *, void *, void *));
|
||||
static int mbmatch __P((struct device *, struct cfdata *, void *));
|
||||
static void mbattach __P((struct device *, struct device *, void *));
|
||||
static int mbprint __P((void *, const char *));
|
||||
|
||||
@ -55,17 +57,16 @@ caddr_t mb_cvtaddr __P((struct confargs *));
|
||||
int mb_matchname __P((struct confargs *, char *));
|
||||
|
||||
static int
|
||||
mbmatch(parent, cfdata, aux)
|
||||
mbmatch(parent, match, aux)
|
||||
struct device *parent;
|
||||
void *cfdata;
|
||||
struct cfdata *match;
|
||||
void *aux;
|
||||
{
|
||||
struct cfdata *cf = cfdata;
|
||||
|
||||
/*
|
||||
* Only one mainbus, but some people are stupid...
|
||||
*/
|
||||
if (cf->cf_unit > 0)
|
||||
if (match->cf_unit > 0)
|
||||
return(0);
|
||||
|
||||
/*
|
||||
@ -82,7 +83,7 @@ mbattach(parent, self, aux)
|
||||
{
|
||||
struct mainbus_softc *sc = (struct mainbus_softc *)self;
|
||||
struct confargs nca;
|
||||
extern int cputype, ncpus;
|
||||
extern int cputype;
|
||||
|
||||
printf("\n");
|
||||
|
||||
@ -104,7 +105,7 @@ mbattach(parent, self, aux)
|
||||
nca.ca_bus = &sc->sc_bus;
|
||||
config_found(self, &nca, mbprint);
|
||||
|
||||
if (cputype == ACER_PICA_61) {
|
||||
if (cputype == ACER_PICA_61 || cputype == MAGNUM) {
|
||||
/* we have a PICA bus! */
|
||||
nca.ca_name = "pica";
|
||||
nca.ca_slot = 0;
|
||||
@ -112,9 +113,30 @@ mbattach(parent, self, aux)
|
||||
nca.ca_bus = &sc->sc_bus;
|
||||
config_found(self, &nca, mbprint);
|
||||
}
|
||||
if (cputype == ACER_PICA_61) {
|
||||
/* we have an ISA bus! */
|
||||
nca.ca_name = "isa";
|
||||
else if (cputype == ALGOR_P4032) {
|
||||
/* we have an ALGOR bus! :-) */
|
||||
nca.ca_name = "algor";
|
||||
nca.ca_slot = 0;
|
||||
nca.ca_offset = 0;
|
||||
nca.ca_bus = &sc->sc_bus;
|
||||
config_found(self, &nca, mbprint);
|
||||
}
|
||||
|
||||
/* The following machines have a PCI bus */
|
||||
if (cputype == ALGOR_P4032) {
|
||||
nca.ca_name = "pbcpcibr";
|
||||
nca.ca_slot = 0;
|
||||
nca.ca_offset = 0;
|
||||
nca.ca_bus = &sc->sc_bus;
|
||||
config_found(self, &nca, mbprint);
|
||||
}
|
||||
|
||||
/* The following machines have an ISA bus */
|
||||
if (cputype == ACER_PICA_61 ||
|
||||
cputype == MAGNUM ||
|
||||
cputype == DESKSTATION_TYNE ||
|
||||
cputype == DESKSTATION_RPC44) {
|
||||
nca.ca_name = "isabr";
|
||||
nca.ca_slot = 0;
|
||||
nca.ca_offset = 0;
|
||||
nca.ca_bus = &sc->sc_bus;
|
||||
|
@ -1,4 +1,5 @@
|
||||
/* $NetBSD: minidebug.c,v 1.6 2000/01/23 20:09:15 soda Exp $ */
|
||||
/* $NetBSD: minidebug.c,v 1.7 2000/01/23 21:01:52 soda Exp $ */
|
||||
/* $OpenBSD: minidebug.c,v 1.5 1997/04/19 17:19:46 pefo Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
@ -42,13 +43,19 @@
|
||||
* Define machine dependent primitives for mdb.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <machine/pte.h>
|
||||
#include <vm/vm_prot.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/user.h>
|
||||
#include <dev/cons.h>
|
||||
#include <vm/vm.h>
|
||||
#undef SP
|
||||
#include <machine/machConst.h>
|
||||
#include <machine/pte.h>
|
||||
#include <mips/locore.h>
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/reg.h>
|
||||
#include <machine/pcb.h>
|
||||
#include <machine/regnum.h>
|
||||
#include <machine/intr.h>
|
||||
#include <machine/trap.h>
|
||||
#include <machine/mips_opcode.h>
|
||||
|
||||
@ -57,7 +64,6 @@
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
void pica_dump_tlb(int, int);
|
||||
|
||||
static char *op_name[64] = {
|
||||
/* 0 */ "spec", "bcond","j", "jal", "beq", "bne", "blez", "bgtz",
|
||||
@ -133,7 +139,27 @@ static char *c0_reg[32] = {
|
||||
"c0r24","c0r25","ecc","cacheerr","taglo","taghi","errepc","c0r31"
|
||||
};
|
||||
|
||||
extern u_int mdbpeek __P((int));
|
||||
extern void mdbpoke __P((int, int));
|
||||
extern void trapDump __P((char *));
|
||||
extern void stacktrace __P((void));
|
||||
extern u_int MachEmulateBranch __P((int *, int, int, u_int));
|
||||
extern char *trap_type[];
|
||||
extern int num_tlbentries;
|
||||
static void arc_dump_tlb __P((int,int));
|
||||
static void prt_break __P((void));
|
||||
static int mdbprintins __P((int, int));
|
||||
static void mdbsetsstep __P((void));
|
||||
static int mdbclrsstep __P((int));
|
||||
static void print_regs __P((void));
|
||||
static void break_insert __P((void));
|
||||
static void break_restore __P((void));
|
||||
static int break_find __P((int));
|
||||
|
||||
void set_break __P((int va));
|
||||
void del_break __P((int va));
|
||||
int mdb __P((int causeReg, int vadr, int p, int kernelmode));
|
||||
|
||||
|
||||
struct pcb mdbpcb;
|
||||
int mdbmkfault;
|
||||
@ -147,12 +173,13 @@ struct brk {
|
||||
/*
|
||||
* Mini debugger for kernel.
|
||||
*/
|
||||
int gethex(u_int *val, u_int dotval)
|
||||
static int
|
||||
gethex(u_int *val, u_int dotval)
|
||||
{
|
||||
u_int c;
|
||||
|
||||
*val = 0;
|
||||
while((c = cngetc()) != '\e' && c != '\n') {
|
||||
while((c = cngetc()) != '\e' && c != '\n' && c != '\r') {
|
||||
if(c >= '0' && c <= '9') {
|
||||
*val = (*val << 4) + c - '0';
|
||||
cnputc(c);
|
||||
@ -174,9 +201,12 @@ int gethex(u_int *val, u_int dotval)
|
||||
cnputc(c);
|
||||
}
|
||||
}
|
||||
if(c == '\r')
|
||||
c = '\n';
|
||||
return(c);
|
||||
}
|
||||
|
||||
static
|
||||
void dump(u_int *addr, u_int size)
|
||||
{
|
||||
int cnt;
|
||||
@ -191,7 +221,8 @@ void dump(u_int *addr, u_int size)
|
||||
}
|
||||
}
|
||||
|
||||
void print_regs()
|
||||
static void
|
||||
print_regs()
|
||||
{
|
||||
printf("\n");
|
||||
printf("T0-7 %08x %08x %08x %08x %08x %08x %08x %08x\n",
|
||||
@ -217,7 +248,8 @@ void print_regs()
|
||||
mdbpcb.pcb_regs[RA],mdbpcb.pcb_regs[SR]);
|
||||
}
|
||||
|
||||
set_break(va)
|
||||
void
|
||||
set_break(int va)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -232,7 +264,8 @@ set_break(va)
|
||||
printf(" Break table full!!");
|
||||
}
|
||||
|
||||
del_break(va)
|
||||
void
|
||||
del_break(int va)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -246,6 +279,7 @@ del_break(va)
|
||||
printf(" Break to remove not found!!");
|
||||
}
|
||||
|
||||
static void
|
||||
break_insert()
|
||||
{
|
||||
int i;
|
||||
@ -254,12 +288,13 @@ break_insert()
|
||||
if(brk_tab[i].addr != 0) {
|
||||
brk_tab[i].inst = *(u_int *)brk_tab[i].addr;
|
||||
*(u_int *)brk_tab[i].addr = MIPS_BREAK_BRKPT;
|
||||
MachFlushDCache(brk_tab[i].addr,4);
|
||||
MachFlushICache(brk_tab[i].addr,4);
|
||||
mips3_FlushDCache(brk_tab[i].addr,4);
|
||||
mips3_FlushICache(brk_tab[i].addr,4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
break_restore()
|
||||
{
|
||||
int i;
|
||||
@ -267,13 +302,15 @@ break_restore()
|
||||
for(i = 0; i < MAXBRK; i++) {
|
||||
if(brk_tab[i].addr != 0) {
|
||||
*(u_int *)brk_tab[i].addr = brk_tab[i].inst;
|
||||
MachFlushDCache(brk_tab[i].addr,4);
|
||||
MachFlushICache(brk_tab[i].addr,4);
|
||||
mips3_FlushDCache(brk_tab[i].addr,4);
|
||||
mips3_FlushICache(brk_tab[i].addr,4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
break_find(va)
|
||||
int va;
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -285,6 +322,7 @@ break_find(va)
|
||||
return(-1);
|
||||
}
|
||||
|
||||
void
|
||||
prt_break()
|
||||
{
|
||||
int i;
|
||||
@ -296,7 +334,9 @@ prt_break()
|
||||
}
|
||||
}
|
||||
}
|
||||
mdb(causeReg, vadr, p, kernelmode)
|
||||
|
||||
int
|
||||
mdb(int causeReg, int vadr, int p, int kernelmode)
|
||||
{
|
||||
int c;
|
||||
int newaddr;
|
||||
@ -305,7 +345,7 @@ mdb(causeReg, vadr, p, kernelmode)
|
||||
static int ssandrun; /* Single step and run flag (when cont at brk) */
|
||||
|
||||
splhigh();
|
||||
cause = (causeReg & MIPS_CR_EXC_CODE) >> MIPS_CR_EXC_CODE_SHIFT;
|
||||
cause = (causeReg & MIPS3_CR_EXC_CODE) >> MIPS_CR_EXC_CODE_SHIFT;
|
||||
newaddr = (int)(mdbpcb.pcb_regs[PC]);
|
||||
switch(cause) {
|
||||
case T_BREAK:
|
||||
@ -351,7 +391,8 @@ static int ssandrun; /* Single step and run flag (when cont at brk) */
|
||||
ssandrun = 0;
|
||||
break_restore();
|
||||
|
||||
while(c = cngetc()) {
|
||||
while(1) {
|
||||
c = cngetc();
|
||||
switch(c) {
|
||||
case 'T':
|
||||
trapDump("Debugger");
|
||||
@ -408,7 +449,10 @@ static int ssandrun; /* Single step and run flag (when cont at brk) */
|
||||
break_insert();
|
||||
}
|
||||
return(TRUE);
|
||||
|
||||
case 'S':
|
||||
printf("Stack traceback:\n");
|
||||
stacktrace();
|
||||
return(TRUE);
|
||||
case 's':
|
||||
set_break(mdbpcb.pcb_regs[PC] + 8);
|
||||
return(TRUE);
|
||||
@ -511,9 +555,9 @@ static int ssandrun; /* Single step and run flag (when cont at brk) */
|
||||
|
||||
case 't':
|
||||
printf("tlb-dump\n");
|
||||
pica_dump_tlb(0,23);
|
||||
arc_dump_tlb(0,23);
|
||||
(void)cngetc();
|
||||
pica_dump_tlb(24,47);
|
||||
arc_dump_tlb(24,47);
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
@ -522,12 +566,12 @@ static int ssandrun; /* Single step and run flag (when cont at brk) */
|
||||
switch(c) {
|
||||
case 't':
|
||||
printf("tlb");
|
||||
MachTLBFlush();
|
||||
mips3_TLBFlush(num_tlbentries);
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
printf("cache");
|
||||
MachFlushCache();
|
||||
mips3_FlushCache();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@ -543,11 +587,11 @@ static int ssandrun; /* Single step and run flag (when cont at brk) */
|
||||
u_int mdb_ss_addr;
|
||||
u_int mdb_ss_instr;
|
||||
|
||||
static void
|
||||
mdbsetsstep()
|
||||
{
|
||||
register u_int va;
|
||||
register int *locr0 = mdbpcb.pcb_regs;
|
||||
int i;
|
||||
|
||||
/* compute next address after current location */
|
||||
if(mdbpeek(locr0[PC]) != 0) {
|
||||
@ -566,15 +610,15 @@ mdbsetsstep()
|
||||
if ((int)va < 0) {
|
||||
/* kernel address */
|
||||
mdb_ss_instr = mdbpeek(va);
|
||||
mdbpoke((caddr_t)va, MIPS_BREAK_SSTEP);
|
||||
MachFlushDCache(va,4);
|
||||
MachFlushICache(va,4);
|
||||
mdbpoke(va, MIPS_BREAK_SSTEP);
|
||||
mips3_FlushDCache(va,4);
|
||||
mips3_FlushICache(va,4);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
mdbclrsstep(cr)
|
||||
int cr;
|
||||
static int
|
||||
mdbclrsstep(int cr)
|
||||
{
|
||||
register u_int pc, va;
|
||||
u_int instr;
|
||||
@ -596,9 +640,9 @@ mdbclrsstep(cr)
|
||||
|
||||
if ((int)va < 0) {
|
||||
/* kernel address */
|
||||
mdbpoke((caddr_t)va, mdb_ss_instr);
|
||||
MachFlushDCache(va,4);
|
||||
MachFlushICache(va,4);
|
||||
mdbpoke(va, mdb_ss_instr);
|
||||
mips3_FlushDCache(va,4);
|
||||
mips3_FlushICache(va,4);
|
||||
mdb_ss_addr = 0;
|
||||
return(TRUE);
|
||||
}
|
||||
@ -608,29 +652,10 @@ mdbclrsstep(cr)
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
void
|
||||
mdbreadc(lp)
|
||||
char *lp;
|
||||
{
|
||||
int c;
|
||||
|
||||
c = cngetc();
|
||||
if (c == '\r')
|
||||
c = '\n';
|
||||
*lp = c;
|
||||
}
|
||||
|
||||
void
|
||||
mdbwrite(lp, len)
|
||||
char *lp;
|
||||
int len;
|
||||
{
|
||||
while (len-- > 0)
|
||||
cnputc(*lp++);
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
mdbprintins(ins, mdbdot)
|
||||
static int
|
||||
mdbprintins(int ins, int mdbdot)
|
||||
{
|
||||
InstFmt i;
|
||||
int delay = 0;
|
||||
@ -901,187 +926,12 @@ mdbprintins(ins, mdbdot)
|
||||
return(delay);
|
||||
}
|
||||
|
||||
#define MIPS_JR_RA 0x03e00008 /* instruction code for jr ra */
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* Print a stack backtrace.
|
||||
*/
|
||||
void
|
||||
mdbstacktrace(printlocals)
|
||||
int printlocals;
|
||||
{
|
||||
u_int pc, sp, ra, va, subr;
|
||||
int a0, a1, a2, a3;
|
||||
u_int instr, mask;
|
||||
InstFmt i;
|
||||
int more, stksize;
|
||||
extern MachKernGenException();
|
||||
extern MachUserGenException();
|
||||
extern MachKernIntr();
|
||||
extern MachUserIntr();
|
||||
extern setsoftclock();
|
||||
|
||||
/* get initial values from the exception frame */
|
||||
sp = mdbpcb.pcb_regs[SP];
|
||||
pc = mdbpcb.pcb_regs[PC];
|
||||
ra = mdbpcb.pcb_regs[RA];
|
||||
a0 = mdbpcb.pcb_regs[A0];
|
||||
a1 = mdbpcb.pcb_regs[A1];
|
||||
a2 = mdbpcb.pcb_regs[A2];
|
||||
a3 = mdbpcb.pcb_regs[A3];
|
||||
|
||||
loop:
|
||||
/* check for current PC in the kernel interrupt handler code */
|
||||
if (pc >= (u_int)MachKernIntr && pc < (u_int)MachUserIntr) {
|
||||
/* NOTE: the offsets depend on the code in locore.s */
|
||||
printf("interupt\n");
|
||||
a0 = mdbchkget(sp + 36, DSP);
|
||||
a1 = mdbchkget(sp + 40, DSP);
|
||||
a2 = mdbchkget(sp + 44, DSP);
|
||||
a3 = mdbchkget(sp + 48, DSP);
|
||||
pc = mdbchkget(sp + 20, DSP);
|
||||
ra = mdbchkget(sp + 92, DSP);
|
||||
sp = mdbchkget(sp + 100, DSP);
|
||||
}
|
||||
|
||||
/* check for current PC in the exception handler code */
|
||||
if (pc >= 0x80000000 && pc < (u_int)setsoftclock) {
|
||||
ra = 0;
|
||||
subr = 0;
|
||||
goto done;
|
||||
}
|
||||
/*
|
||||
* Find the beginning of the current subroutine by scanning backwards
|
||||
* from the current PC for the end of the previous subroutine.
|
||||
*/
|
||||
va = pc - sizeof(int);
|
||||
while ((instr = mdbchkget(va, ISP)) != MIPS_JR_RA)
|
||||
va -= sizeof(int);
|
||||
va += 2 * sizeof(int); /* skip back over branch & delay slot */
|
||||
/* skip over nulls which might separate .o files */
|
||||
while ((instr = mdbchkget(va, ISP)) == 0)
|
||||
va += sizeof(int);
|
||||
subr = va;
|
||||
|
||||
/* scan forwards to find stack size and any saved registers */
|
||||
stksize = 0;
|
||||
more = 3;
|
||||
mask = 0;
|
||||
for (; more; va += sizeof(int), more = (more == 3) ? 3 : more - 1) {
|
||||
/* stop if hit our current position */
|
||||
if (va >= pc)
|
||||
break;
|
||||
instr = mdbchkget(va, ISP);
|
||||
i.word = instr;
|
||||
switch (i.JType.op) {
|
||||
case OP_SPECIAL:
|
||||
switch (i.RType.func) {
|
||||
case OP_JR:
|
||||
case OP_JALR:
|
||||
more = 2; /* stop after next instruction */
|
||||
break;
|
||||
|
||||
case OP_SYSCALL:
|
||||
case OP_BREAK:
|
||||
more = 1; /* stop now */
|
||||
};
|
||||
break;
|
||||
|
||||
case OP_BCOND:
|
||||
case OP_J:
|
||||
case OP_JAL:
|
||||
case OP_BEQ:
|
||||
case OP_BNE:
|
||||
case OP_BLEZ:
|
||||
case OP_BGTZ:
|
||||
more = 2; /* stop after next instruction */
|
||||
break;
|
||||
|
||||
case OP_COP0:
|
||||
case OP_COP1:
|
||||
case OP_COP2:
|
||||
case OP_COP3:
|
||||
switch (i.RType.rs) {
|
||||
case OP_BCx:
|
||||
case OP_BCy:
|
||||
more = 2; /* stop after next instruction */
|
||||
};
|
||||
break;
|
||||
|
||||
case OP_SW:
|
||||
/* look for saved registers on the stack */
|
||||
if (i.IType.rs != 29)
|
||||
break;
|
||||
/* only restore the first one */
|
||||
if (mask & (1 << i.IType.rt))
|
||||
break;
|
||||
mask |= 1 << i.IType.rt;
|
||||
switch (i.IType.rt) {
|
||||
case 4: /* a0 */
|
||||
a0 = mdbchkget(sp + (short)i.IType.imm, DSP);
|
||||
break;
|
||||
|
||||
case 5: /* a1 */
|
||||
a1 = mdbchkget(sp + (short)i.IType.imm, DSP);
|
||||
break;
|
||||
|
||||
case 6: /* a2 */
|
||||
a2 = mdbchkget(sp + (short)i.IType.imm, DSP);
|
||||
break;
|
||||
|
||||
case 7: /* a3 */
|
||||
a3 = mdbchkget(sp + (short)i.IType.imm, DSP);
|
||||
break;
|
||||
|
||||
case 31: /* ra */
|
||||
ra = mdbchkget(sp + (short)i.IType.imm, DSP);
|
||||
}
|
||||
break;
|
||||
|
||||
case OP_ADDI:
|
||||
case OP_ADDIU:
|
||||
/* look for stack pointer adjustment */
|
||||
if (i.IType.rs != 29 && i.IType.rt != 29)
|
||||
break;
|
||||
stksize = (short)i.IType.imm;
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
printf("%x+%x ", subr, pc - subr); /* XXX */
|
||||
printf("(%x,%x,%x,%x)\n", a0, a1, a2, a3);
|
||||
|
||||
if (ra) {
|
||||
pc = ra;
|
||||
sp -= stksize;
|
||||
goto loop;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Very simple memory allocator for mdb.
|
||||
*/
|
||||
char *
|
||||
mdbmalloc(size)
|
||||
int size;
|
||||
{
|
||||
static char buffer[4096];
|
||||
static char *bufp = buffer;
|
||||
char *p;
|
||||
|
||||
/* round size up to sizeof(int) */
|
||||
size = (size + sizeof(int) - 1) & ~(sizeof(int) - 1);
|
||||
p = bufp;
|
||||
bufp = p + size;
|
||||
return (p);
|
||||
}
|
||||
|
||||
/*
|
||||
* Dump TLB contents.
|
||||
*/
|
||||
void pica_dump_tlb(int first,int last)
|
||||
static void
|
||||
arc_dump_tlb(int first,int last)
|
||||
{
|
||||
int tlbno;
|
||||
struct tlb tlb;
|
||||
@ -1089,20 +939,20 @@ void pica_dump_tlb(int first,int last)
|
||||
tlbno = first;
|
||||
|
||||
while(tlbno <= last) {
|
||||
MachTLBRead(tlbno, &tlb);
|
||||
if(tlb.tlb_lo0 & PG_V || tlb.tlb_lo1 & PG_V) {
|
||||
mips3_TLBRead(tlbno, &tlb);
|
||||
if(tlb.tlb_lo0 & MIPS3_PG_V || tlb.tlb_lo1 & MIPS3_PG_V) {
|
||||
printf("TLB %2d vad 0x%08x ", tlbno, tlb.tlb_hi);
|
||||
}
|
||||
else {
|
||||
printf("TLB*%2d vad 0x%08x ", tlbno, tlb.tlb_hi);
|
||||
}
|
||||
printf("0=0x%08x ", pfn_to_vad(tlb.tlb_lo0));
|
||||
printf("%c", tlb.tlb_lo0 & PG_M ? 'M' : ' ');
|
||||
printf("%c", tlb.tlb_lo0 & PG_G ? 'G' : ' ');
|
||||
printf("%c", tlb.tlb_lo0 & MIPS3_PG_M ? 'M' : ' ');
|
||||
printf("%c", tlb.tlb_lo0 & MIPS3_PG_G ? 'G' : ' ');
|
||||
printf(" atr %x ", (tlb.tlb_lo0 >> 3) & 7);
|
||||
printf("1=0x%08x ", pfn_to_vad(tlb.tlb_lo1));
|
||||
printf("%c", tlb.tlb_lo1 & PG_M ? 'M' : ' ');
|
||||
printf("%c", tlb.tlb_lo1 & PG_G ? 'G' : ' ');
|
||||
printf("%c", tlb.tlb_lo1 & MIPS3_PG_M ? 'M' : ' ');
|
||||
printf("%c", tlb.tlb_lo1 & MIPS3_PG_G ? 'G' : ' ');
|
||||
printf(" atr %x ", (tlb.tlb_lo1 >> 3) & 7);
|
||||
printf(" sz=%x\n", tlb.tlb_mask);
|
||||
|
||||
|
@ -1,68 +1,93 @@
|
||||
# $NetBSD: ARCTIC,v 1.2 2000/01/23 21:01:52 soda Exp $
|
||||
# $OpenBSD: ARCTIC,v 1.8 1997/04/29 05:16:40 deraadt Exp $
|
||||
#
|
||||
# Generic configuration file for MIPS R4x00 ARC Systems
|
||||
#
|
||||
|
||||
machine arc
|
||||
include "arch/arc/conf/std.arc"
|
||||
|
||||
maxusers 32
|
||||
|
||||
# Need to set locally
|
||||
option TIMEZONE=0 # minutes west of GMT (for)
|
||||
option DST=0 # use daylight savings rules
|
||||
options RTC_OFFSET=0 # hardware clock is this many mins. west of GMT
|
||||
|
||||
# Standard system options
|
||||
option SWAPPAGER # swap pager (anonymous and swap space)
|
||||
option DEVPAGER # device pager (mapped devices)
|
||||
options KTRACE # system call tracing support
|
||||
|
||||
# Debugging options
|
||||
option DIAGNOSTIC # extra kernel debugging checks
|
||||
option DEBUG # extra kernel debugging support
|
||||
option KTRACE # system call tracing support
|
||||
# Diagnostic/debugging support options
|
||||
options DIAGNOSTIC # extra kernel debugging checks
|
||||
options DEBUG # extra kernel debugging support
|
||||
|
||||
# System V options
|
||||
option SYSVMSG # System V-like message queues
|
||||
option SYSVSEM # System V-like semaphores
|
||||
option SYSVSHM # System V-like memory sharing
|
||||
option SHMMAXPGS=1024 # 1024 pages is the default
|
||||
option NATIVE_ELF # Arc systems uses ELF as native format
|
||||
|
||||
# Filesystem options
|
||||
option CD9660 # ISO 9660 + Rock Ridge file system
|
||||
option FDESC # user file descriptor filesystem (/dev/fd)
|
||||
option FIFO # POSIX fifo support (in all filesystems)
|
||||
option FFS,QUOTA # fast filesystem with user and group quotas
|
||||
option KERNFS # kernel data-structure filesystem
|
||||
option MFS # memory-based filesystem
|
||||
option MSDOSFS # Ability to read write MS-Dos filsystem
|
||||
option NFSCLIENT # Sun NFS-compatible filesystem (client)
|
||||
option NFSSERVER # Sun NFS-compatible filesystem (server)
|
||||
option NULLFS # null layer filesystem
|
||||
option PORTAL # portal filesystem (still experimental)
|
||||
option UMAPFS # uid/gid remapping filesystem
|
||||
|
||||
# Networking options
|
||||
option INET # Internet protocols
|
||||
option IPSEC # IP-sec
|
||||
#option TCP_COMPAT_42 # compatibility with 4.2BSD TCP/IP
|
||||
option GATEWAY # IP packet forwarding
|
||||
#option MULTICAST # Multicast support
|
||||
#option MROUTING # Multicast routing support
|
||||
#option ISO # OSI networking
|
||||
#option TPIP
|
||||
#option EON
|
||||
options SYSVMSG # System V-like message queues
|
||||
options SYSVSEM # System V-like semaphores
|
||||
options SYSVSHM # System V-like memory sharing
|
||||
options SHMMAXPGS=1024 # 1024 pages is the default
|
||||
|
||||
# Compatibilitry modules
|
||||
option COMPAT_43 # compatibility with 4.3BSD binaries
|
||||
#option COMPAT_ULTRIX # Ultrix binary compatibility (no go yet)
|
||||
options COMPAT_43 # compatibility with 4.3BSD binaries
|
||||
options COMPAT_11
|
||||
options COMPAT_12
|
||||
options COMPAT_13
|
||||
options COMPAT_14
|
||||
#options COMPAT_ULTRIX # Ultrix binary compatibility (no go yet)
|
||||
options COMPAT_386BSD_MBRPART # recognize old partition ID
|
||||
|
||||
# Filesystem options
|
||||
file-system FFS # fast filesystem
|
||||
file-system MFS # memory-based filesystem
|
||||
#file-system LFS # Log-based filesystem (still experimental)
|
||||
file-system CD9660 # ISO 9660 + Rock Ridge file system
|
||||
file-system MSDOSFS # Ability to read write MS-Dos filsystem
|
||||
file-system NFS # Sun NFS-compatible filesystem (client)
|
||||
file-system KERNFS # kernel data-structure filesystem
|
||||
file-system PROCFS # /proc
|
||||
file-system FDESC # user file descriptor filesystem
|
||||
file-system UMAPFS # uid/gid remapping filesystem
|
||||
file-system UNION # union file system
|
||||
file-system NULLFS # null layer filesystem
|
||||
file-system OVERLAY # overlay file system
|
||||
file-system PORTAL # portal filesystem (still experimental)
|
||||
|
||||
options FIFO # POSIX fifo support (in all filesystems)
|
||||
options QUOTA # FFS quotas
|
||||
#options FFS_EI # FFS Endian Independant support
|
||||
#options SOFTDEP # FFS soft updates support.
|
||||
options NFSSERVER # Sun NFS-compatible filesystem (server)
|
||||
|
||||
# Pull in config fragments for kernel crypto. This is required for
|
||||
# options IPSEC etc. to work. If you want to run with IPSEC, uncomment
|
||||
# one of these, based on whether you use crypto-us or crypto-intl, and
|
||||
# adjust the prefixes as necessary.
|
||||
|
||||
#prefix ../crypto-us/sys
|
||||
#cinclude "conf/files.crypto-us"
|
||||
#prefix
|
||||
|
||||
#prefix ../crypto-intl/sys
|
||||
#cinclude "conf/files.crypto-intl"
|
||||
#prefix
|
||||
|
||||
# Networking options
|
||||
options GATEWAY # IP packet forwarding
|
||||
options INET # Internet protocols
|
||||
#options INET6 # IPV6
|
||||
#options IPSEC # IP security
|
||||
#options IPSEC_ESP # IP security (encryption part; define w/IPSEC)
|
||||
#options IPSEC_DEBUG # debug for IP security
|
||||
#options MROUTING # Multicast routing support
|
||||
#options ISO,TPIP # OSI networking
|
||||
#options EON # OSI tunneling over IP
|
||||
#options TCP_COMPAT_42 # compatibility with 4.2BSD TCP/IP
|
||||
|
||||
# Special options
|
||||
option MACHINE_NONCONTIG # Support noncontigous memory.
|
||||
option PCCONS_FORCE_WORD # Max out at 16bit accesses to the
|
||||
options MACHINE_NONCONTIG # Support noncontigous memory.
|
||||
options PCCONS_FORCE_WORD # Max out at 16bit accesses to the
|
||||
# VGA memory
|
||||
options NFS_BOOT_BOOTP,NFS_BOOT_BOOTPARAM
|
||||
|
||||
# Specify storage configuration (its a joke..)
|
||||
config bsd root on sd0 swap on sd0 dumps on sd0
|
||||
# Specify storage configuration
|
||||
config netbsd root on ? type ?
|
||||
|
||||
#
|
||||
# Definition of system
|
||||
@ -79,7 +104,7 @@ isabr* at mainbus0
|
||||
isa* at isabr?
|
||||
#isadma0 at isa?
|
||||
|
||||
clock0 at isa? port 0x70 irq 0
|
||||
aclock0 at isa? port 0x70 irq 0
|
||||
|
||||
pc0 at isa? port 0x60 irq 1 # generic PC console device
|
||||
com0 at isa? port 0x3f8 irq 4
|
||||
@ -89,22 +114,54 @@ com3 at isa? port 0x2e8 irq 3
|
||||
ast0 at isa? port 0x1a0 irq 3 # AST 4-port serial cards
|
||||
com* at ast? slave ?
|
||||
|
||||
wdc0 at isa? port 0x1f0 irq 14 # ST506, ESDI, and IDE controllers
|
||||
wdc1 at isa? port 0x170 irq 15
|
||||
wd* at wdc? drive ?
|
||||
# ISA ST506, ESDI, and IDE controllers
|
||||
# Use flags 0x01 if you want to try to use 32bits data I/O (the driver will
|
||||
# fall back to 16bits I/O if 32bits I/O are not functional).
|
||||
# Some controllers pass the initial 32bit test, but will fail later.
|
||||
wdc0 at isa? port 0x1f0 irq 14 flags 0x00
|
||||
wdc1 at isa? port 0x170 irq 15 flags 0x00
|
||||
|
||||
atapibus* at wdc?
|
||||
acd* at atapibus? drive?
|
||||
# IDE drives
|
||||
# Flags are used only with controllers that support DMA operations
|
||||
# and mode settings (e.g. some pciide controllers)
|
||||
# The lowest order four bits (rightmost digit) of the flags define the PIO
|
||||
# mode to use, the next set of four bits the DMA mode and the third set the
|
||||
# UltraDMA mode. For each set of four bits, the 3 lower bits define the mode
|
||||
# to use, and the last bit must be 1 for this setting to be used.
|
||||
# For DMA and UDMA, 0xf (1111) means 'disable'.
|
||||
# 0x0fac means 'use PIO mode 4, DMA mode 2, disable UltraDMA'.
|
||||
# (0xc=1100, 0xa=1010, 0xf=1111)
|
||||
# 0x0000 means "use whatever the drive claims to support".
|
||||
wd* at wdc? channel ? drive ? flags 0x0000
|
||||
|
||||
# ATAPI bus support
|
||||
atapibus* at wdc? channel ?
|
||||
atapibus* at pciide? channel ?
|
||||
|
||||
# ATAPI devices
|
||||
# flags have the same meaning as for IDE drives.
|
||||
cd* at atapibus? drive ? flags 0x0000 # ATAPI CD-ROM drives
|
||||
sd* at atapibus? drive ? flags 0x0000 # ATAPI disk drives
|
||||
uk* at atapibus? drive ? flags 0x0000 # ATAPI unknown
|
||||
|
||||
|
||||
# Parallel Printer Interfaces
|
||||
|
||||
lpt0 at isa? port 0x378 irq 7
|
||||
ep0 at isa? port ? irq ? # 3C509 ethernet cards
|
||||
ed0 at isa? port 0x280 iomem 0xd0000 irq 9 # WD/SMC, 3C503, and NE[12]000
|
||||
ed1 at isa? port 0x250 iomem 0xd8000 irq 9 # ethernet cards
|
||||
ed2 at isa? port 0x300 iomem 0xcc000 irq 10 #
|
||||
|
||||
tel0 at isa? iomem 0xe0000 irq 9 # Teles S0, NICCY 1000, Creatix 8bit
|
||||
tel1 at isa? port 0xe80 iomem 0xde000 irq 11 # Teles S0/16, NICCY 1016,
|
||||
tel2 at isa? port 0x180 irq 5 # Teles S0/16.3 card (no shared memory)
|
||||
|
||||
# Network Interfaces
|
||||
|
||||
ec0 at isa? port 0x250 iomem 0xd8000 irq 9 # 3Com 3c503 Ethernet
|
||||
ep0 at isa? port ? irq ? # 3C509 ethernet cards
|
||||
ne0 at isa? port 0x280 irq 9 # NE[12]000 ethernet cards
|
||||
ne1 at isa? port 0x300 irq 10
|
||||
we0 at isa? port 0x280 iomem 0xd0000 irq 9 # WD/SMC Ethernet
|
||||
we1 at isa? port 0x300 iomem 0xcc000 irq 10
|
||||
|
||||
#tel0 at isa? iomem 0xe0000 irq 9 # Teles S0, NICCY 1000, Creatix 8bit
|
||||
#tel1 at isa? port 0xe80 iomem 0xde000 irq 11 # Teles S0/16, NICCY 1016,
|
||||
#tel2 at isa? port 0x180 irq 5 # Teles S0/16.3 card (no shared memory)
|
||||
|
||||
#aha0 at isa? port 0x330 irq ? drq ? # Adaptec 154[02] SCSI controllers
|
||||
#aha1 at isa? port 0x334 irq ? drq ? # Adaptec 154[02] SCSI controllers
|
||||
@ -133,6 +190,11 @@ pseudo-device tun 2 # network tunneling over tty
|
||||
pseudo-device pty 64 # pseudo ptys
|
||||
pseudo-device tb 1 # tablet line discipline
|
||||
pseudo-device bpfilter 8 # packet filter ports
|
||||
#pseudo-device gre 2 # generic L3 over IP tunnel
|
||||
pseudo-device loop 1 # network loopback
|
||||
pseudo-device gif 4 # IPv[46] over IPv[46] tunnel (RFC1933)
|
||||
#pseudo-device faith 1 # IPv[46] tcp relay translation i/f
|
||||
pseudo-device vnd 4 # paging to files
|
||||
pseudo-device enc 4 # IP encap
|
||||
pseudo-device ccd 4 # concatenated disks
|
||||
#pseudo-device raid 4 # RAIDframe disk driver
|
||||
#pseudo-device enc 4 # IP encap
|
||||
|
@ -1,29 +1,24 @@
|
||||
# $NetBSD: GENERIC,v 1.22 2000/01/23 20:08:03 soda Exp $
|
||||
# $NetBSD: GENERIC,v 1.23 2000/01/23 21:01:52 soda Exp $
|
||||
# $OpenBSD: GENERIC,v 1.17 1997/05/18 13:45:23 pefo Exp $
|
||||
#
|
||||
# Generic configuration file for MIPS R4400 PICA system
|
||||
# Generic configuration file for MIPS R4x00 ARC Systems
|
||||
#
|
||||
|
||||
include "arch/pica/conf/std.pica"
|
||||
include "arch/arc/conf/std.arc"
|
||||
|
||||
maxusers 8
|
||||
maxusers 32
|
||||
|
||||
# Need to set locally
|
||||
options TIMEZONE="8*60" # minutes west of GMT (for)
|
||||
options DST=1 # use daylight savings rules
|
||||
options RTC_OFFSET=0 # hardware clock is this many mins. west of GMT
|
||||
|
||||
# Standard system options
|
||||
options DIAGNOSTIC # extra kernel debugging checks
|
||||
options DEBUG # extra kernel debugging support
|
||||
options "COMPAT_43" # compatibility with 4.3BSD binaries
|
||||
options COMPAT_11
|
||||
options COMPAT_12
|
||||
options COMPAT_13
|
||||
options COMPAT_14
|
||||
#options KTRACE # system call tracing support
|
||||
options "NKMEMCLUSTERS=1024" # 4K pages in kernel malloc pool
|
||||
#options KGDB # support for kernel gdb
|
||||
#options "KGDBRATE=19200" # kernel gdb port rate (default 9600)
|
||||
#options "KGDBDEV=15*256+0" # device for kernel gdb
|
||||
options KTRACE # system call tracing support
|
||||
#options LKM # Loadable Kernel Modules
|
||||
#options NTP # NTP phase/frequency locked loop
|
||||
|
||||
# Diagnostic/debugging support options
|
||||
options DIAGNOSTIC # extra kernel debugging checks
|
||||
options DEBUG # extra kernel debugging support
|
||||
|
||||
# System V options
|
||||
options SYSVMSG # System V-like message queues
|
||||
@ -34,15 +29,17 @@ options SHMMAXPGS=1024 # 1024 pages is the default
|
||||
# Filesystem options
|
||||
file-system FFS # fast filesystem
|
||||
file-system MFS # memory-based filesystem
|
||||
#file-system LFS # Log-based filesystem (still experimental)
|
||||
file-system CD9660 # ISO 9660 + Rock Ridge file system
|
||||
file-system MSDOSFS # Ability to read write MS-Dos filsystem
|
||||
file-system NFS # Sun NFS-compatible filesystem (client)
|
||||
file-system KERNFS # kernel data-structure filesystem
|
||||
file-system MSDOSFS # Ability to read write MS-Dos filsystem
|
||||
file-system CD9660 # ISO 9660 + Rock Ridge file system
|
||||
file-system PROCFS # /proc
|
||||
file-system FDESC # user file descriptor filesystem
|
||||
#file-system UMAPFS # uid/gid remapping filesystem
|
||||
#file-system UNION # union file system
|
||||
#file-system NULLFS # null layer filesystem
|
||||
#file-system OVERLAY # overlay file system
|
||||
#file-system LFS # Log-based filesystem (still experimental)
|
||||
#file-system PORTAL # portal filesystem (still experimental)
|
||||
|
||||
options QUOTA # FFS quotas
|
||||
@ -66,30 +63,61 @@ options NFSSERVER # Sun NFS-compatible filesystem (server)
|
||||
#prefix
|
||||
|
||||
# Networking options
|
||||
#options GATEWAY # IP packet forwarding
|
||||
options INET # Internet protocols
|
||||
options INET6 # IPV6
|
||||
#options INET6 # IPV6
|
||||
#options IPSEC # IP security
|
||||
#options IPSEC_ESP # IP security (encryption part; define w/IPSEC)
|
||||
#options IPSEC_DEBUG # debug for IP security
|
||||
options "TCP_COMPAT_42" # compatibility with 4.2BSD TCP/IP
|
||||
options GATEWAY # IP packet forwarding
|
||||
#options TCP_COMPAT_42 # compatibility with 4.2BSD TCP/IP
|
||||
#options MULTICAST # Multicast support
|
||||
#options MROUTING # Multicast routing support
|
||||
#options ISO # OSI networking
|
||||
#options TPIP
|
||||
#options EON
|
||||
#options NS # XNS
|
||||
#options IPX # IPX+SPX
|
||||
#options ISO,TPIP # OSI networking
|
||||
#options EON # OSI tunneling over IP
|
||||
#options CCITT,LLC,HDLC # X.25
|
||||
#options PFIL_HOOKS # pfil(9) packet filter hooks.
|
||||
|
||||
# Compatibilitry modules
|
||||
options COMPAT_43 # compatibility with 4.3BSD binaries
|
||||
options COMPAT_11
|
||||
options COMPAT_12
|
||||
options COMPAT_13
|
||||
options COMPAT_14
|
||||
#options COMPAT_ULTRIX # Ultrix binary compatibility (no go yet)
|
||||
options COMPAT_386BSD_MBRPART # recognize old partition ID
|
||||
|
||||
options "NKMEMCLUSTERS=1024" # 4K pages in kernel malloc pool
|
||||
#options KGDB # support for kernel gdb
|
||||
#options "KGDBRATE=19200" # kernel gdb port rate (default 9600)
|
||||
#options "KGDBDEV=15*256+0" # device for kernel gdb
|
||||
|
||||
# Special options
|
||||
options MACHINE_NONCONTIG # Support noncontigous memory.
|
||||
|
||||
options NFS_BOOT_BOOTP,NFS_BOOT_BOOTPARAM
|
||||
|
||||
config netbsd root on ? type ?
|
||||
|
||||
#
|
||||
# Definition of system
|
||||
#
|
||||
mainbus0 at root
|
||||
cpu* at mainbus0
|
||||
|
||||
pica* at mainbus0
|
||||
clock0 at pica?
|
||||
#### Main local buses
|
||||
|
||||
pica* at mainbus0 # ACER Pica systems local bus.
|
||||
isabr* at mainbus0 # ISA Bus bridge (std ISA bus).
|
||||
|
||||
#### PICA bus devices
|
||||
|
||||
aclock0 at pica?
|
||||
pc0 at pica?
|
||||
pms0 at pica?
|
||||
pcom0 at pica?
|
||||
pcom1 at pica?
|
||||
opms0 at pica?
|
||||
com0 at pica?
|
||||
com1 at pica?
|
||||
lpt0 at pica?
|
||||
sn0 at pica?
|
||||
|
||||
@ -99,20 +127,99 @@ fd* at fdc? drive ?
|
||||
asc0 at pica?
|
||||
scsibus* at asc?
|
||||
|
||||
#### ISA Bus.
|
||||
|
||||
isa* at isabr?
|
||||
|
||||
aclock0 at isa? port 0x70 irq 0
|
||||
|
||||
pc0 at isa? port 0x60 irq 1 # generic PC console device
|
||||
com0 at isa? port 0x3f8 irq 4
|
||||
com1 at isa? port 0x2f8 irq 3
|
||||
com2 at isa? port 0x3e8 irq 4
|
||||
com3 at isa? port 0x2e8 irq 3
|
||||
|
||||
# ISA ST506, ESDI, and IDE controllers
|
||||
# Use flags 0x01 if you want to try to use 32bits data I/O (the driver will
|
||||
# fall back to 16bits I/O if 32bits I/O are not functional).
|
||||
# Some controllers pass the initial 32bit test, but will fail later.
|
||||
# XXX - should be configured
|
||||
#wdc0 at isa? port 0x1f0 irq 14 flags 0x00
|
||||
##wdc1 at isa? port 0x170 irq 15 flags 0x00
|
||||
|
||||
# IDE drives
|
||||
# Flags are used only with controllers that support DMA operations
|
||||
# and mode settings (e.g. some pciide controllers)
|
||||
# The lowest order four bits (rightmost digit) of the flags define the PIO
|
||||
# mode to use, the next set of four bits the DMA mode and the third set the
|
||||
# UltraDMA mode. For each set of four bits, the 3 lower bits define the mode
|
||||
# to use, and the last bit must be 1 for this setting to be used.
|
||||
# For DMA and UDMA, 0xf (1111) means 'disable'.
|
||||
# 0x0fac means 'use PIO mode 4, DMA mode 2, disable UltraDMA'.
|
||||
# (0xc=1100, 0xa=1010, 0xf=1111)
|
||||
# 0x0000 means "use whatever the drive claims to support".
|
||||
# XXX - should be configured
|
||||
#wd* at wdc? channel ? drive ? flags 0x0000
|
||||
|
||||
# ATAPI bus support
|
||||
# XXX - should be configured
|
||||
#atapibus* at wdc? channel ?
|
||||
|
||||
# ATAPI devices
|
||||
# flags have the same meaning as for IDE drives.
|
||||
# XXX - should be configured
|
||||
#cd* at atapibus? drive ? flags 0x0000 # ATAPI CD-ROM drives
|
||||
#sd* at atapibus? drive ? flags 0x0000 # ATAPI disk drives
|
||||
#uk* at atapibus? drive ? flags 0x0000 # ATAPI unknown
|
||||
|
||||
|
||||
# Parallel Printer Interfaces
|
||||
|
||||
lpt0 at isa? port 0x378 irq 7
|
||||
|
||||
|
||||
# Network Interfaces
|
||||
|
||||
# XXX - should fix conflict with files.isa
|
||||
#ec0 at isa? port 0x250 iomem 0xd8000 irq 9 # 3Com 3c503 Ethernet
|
||||
# XXX - should fix conflict with files.isa
|
||||
#ep0 at isa? port ? irq ? # 3C509 ethernet cards
|
||||
# XXX - should fix conflict with files.isa
|
||||
#ne0 at isa? port 0x280 irq 9 # NE[12]000 ethernet cards
|
||||
#ne1 at isa? port 0x300 irq 10
|
||||
#we0 at isa? port 0x280 iomem 0xd0000 irq 9 # WD/SMC Ethernet
|
||||
#we1 at isa? port 0x300 iomem 0xcc000 irq 10
|
||||
|
||||
# XXX - should be configured
|
||||
#btl0 at isa? port 0x330 irq ? drq ?
|
||||
#scsibus* at btl?
|
||||
|
||||
#### SCSI Bus devices
|
||||
|
||||
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 Devices
|
||||
|
||||
pseudo-device loop 1 # network loopback
|
||||
pseudo-device bpfilter 8 # packet filter ports
|
||||
#pseudo-device gre 2 # generic L3 over IP tunnel
|
||||
pseudo-device sl 2 # serial-line IP ports
|
||||
pseudo-device ppp 2 # serial-line PPP ports
|
||||
pseudo-device pty 64 # pseudo ptys
|
||||
pseudo-device bpfilter 16 # packet filter ports
|
||||
#pseudo-device gre 2 # generic L3 over IP tunnel
|
||||
pseudo-device loop
|
||||
pseudo-device tun 2 # network tunneling over tty
|
||||
pseudo-device gif 4 # IPv[46] over IPv[46] tunnel (RFC1933)
|
||||
#pseudo-device faith 1 # IPv[46] tcp relay translation i/f
|
||||
pseudo-device vnd 4 # virtual disk
|
||||
pseudo-device ccd 4 # concatenated disks
|
||||
pseudo-device ipfilter # ip filter
|
||||
|
||||
pseudo-device pty 64 # pseudo ptys
|
||||
pseudo-device tb 1 # tablet line discipline
|
||||
pseudo-device vnd 4 # paging to files
|
||||
pseudo-device ccd 4 # concatenated disk devices
|
||||
#pseudo-device raid 4 # RAIDframe disk driver
|
||||
#pseudo-device md 1 # memory disk devices
|
||||
# rnd is EXPERIMENTAL
|
||||
#pseudo-device rnd # /dev/random and in-kernel generator
|
||||
|
147
sys/arch/arc/conf/M403
Normal file
147
sys/arch/arc/conf/M403
Normal file
@ -0,0 +1,147 @@
|
||||
# $NetBSD: M403,v 1.1 2000/01/23 21:01:52 soda Exp $
|
||||
#
|
||||
# Generic configuration file for MIPS R4400 PICA system
|
||||
#
|
||||
|
||||
include "arch/arc/conf/std.arc"
|
||||
|
||||
maxusers 32
|
||||
|
||||
# Need to set locally
|
||||
options RTC_OFFSET=-540 # hardware clock is this many mins. west of GMT
|
||||
|
||||
# Standard system options
|
||||
options KTRACE # system call tracing support
|
||||
|
||||
# Diagnostic/debugging support options
|
||||
options DIAGNOSTIC # extra kernel debugging checks
|
||||
options DEBUG # extra kernel debugging support
|
||||
#options KGDB # support for kernel gdb
|
||||
#options "KGDBRATE=19200" # kernel gdb port rate (default 9600)
|
||||
#options "KGDBDEV=15*256+0" # device for kernel gdb
|
||||
|
||||
# System V options
|
||||
options SYSVMSG # System V-like message queues
|
||||
options SYSVSEM # System V-like semaphores
|
||||
options SYSVSHM # System V-like memory sharing
|
||||
options SHMMAXPGS=1024 # 1024 pages is the default
|
||||
|
||||
# Compatibilitry modules
|
||||
options COMPAT_43 # compatibility with 4.3BSD binaries
|
||||
options COMPAT_11
|
||||
options COMPAT_12
|
||||
options COMPAT_13
|
||||
options COMPAT_14
|
||||
#options COMPAT_ULTRIX # Ultrix binary compatibility (no go yet)
|
||||
options COMPAT_386BSD_MBRPART # recognize old partition ID
|
||||
|
||||
# Filesystem options
|
||||
file-system FFS # fast filesystem
|
||||
file-system MFS # memory-based filesystem
|
||||
#file-system LFS # Log-based filesystem (still experimental)
|
||||
file-system CD9660 # ISO 9660 + Rock Ridge file system
|
||||
file-system MSDOSFS # Ability to read write MS-Dos filsystem
|
||||
file-system NFS # Sun NFS-compatible filesystem (client)
|
||||
file-system KERNFS # kernel data-structure filesystem
|
||||
file-system PROCFS # /proc
|
||||
file-system FDESC # user file descriptor filesystem
|
||||
#file-system UMAPFS # uid/gid remapping filesystem
|
||||
#file-system UNION # union file system
|
||||
#file-system NULLFS # null layer filesystem
|
||||
#file-system OVERLAY # overlay file system
|
||||
#file-system PORTAL # portal filesystem (still experimental)
|
||||
|
||||
options QUOTA # FFS quotas
|
||||
#options FFS_EI # FFS Endian Independant support
|
||||
#options SOFTDEP # FFS soft updates support.
|
||||
options NFSSERVER # Sun NFS-compatible filesystem (server)
|
||||
|
||||
# Pull in config fragments for kernel crypto. This is required for
|
||||
# options IPSEC etc. to work. If you want to run with IPSEC, uncomment
|
||||
# one of these, based on whether you use crypto-us or crypto-intl, and
|
||||
# adjust the prefixes as necessary.
|
||||
|
||||
#prefix ../crypto-us/sys
|
||||
#cinclude "conf/files.crypto-us"
|
||||
#prefix
|
||||
|
||||
#prefix ../crypto-intl/sys
|
||||
#cinclude "conf/files.crypto-intl"
|
||||
#prefix
|
||||
|
||||
# Networking options
|
||||
options INET # Internet protocols
|
||||
#options INET6 # IPV6
|
||||
#options IPSEC # IP security
|
||||
#options IPSEC_ESP # IP security (encryption part; define w/IPSEC)
|
||||
#options IPSEC_DEBUG # debug for IP security
|
||||
#options TCP_COMPAT_42 # compatibility with 4.2BSD TCP/IP
|
||||
options GATEWAY # IP packet forwarding
|
||||
#options MULTICAST # Multicast support
|
||||
#options MROUTING # Multicast routing support
|
||||
#options ISO,TPIP # OSI networking
|
||||
#options EON # OSI tunneling over IP
|
||||
#options TCP_COMPAT_42 # compatibility with 4.2BSD TCP/IP
|
||||
|
||||
# Special options
|
||||
#options MACHINE_NONCONTIG # Support noncontigous memory.
|
||||
options NKMEMCLUSTERS=1024 # 4K pages in kernel malloc pool
|
||||
options COMCONSOLE
|
||||
|
||||
# XXX #options NFS_BOOT_BOOTP,NFS_BOOT_BOOTPARAM
|
||||
options NFS_BOOT_BOOTPARAM
|
||||
|
||||
# Specify storage configuration
|
||||
config netbsd root on ? type ?
|
||||
|
||||
#
|
||||
# Definition of system
|
||||
#
|
||||
mainbus0 at root
|
||||
cpu* at mainbus0
|
||||
|
||||
pica* at mainbus0
|
||||
|
||||
aclock0 at pica?
|
||||
#pc0 at pica?
|
||||
#opms0 at pica?
|
||||
com0 at pica?
|
||||
com1 at pica?
|
||||
lpt0 at pica?
|
||||
sn0 at pica?
|
||||
|
||||
fdc0 at pica?
|
||||
fd* at fdc? drive ?
|
||||
|
||||
asc0 at pica?
|
||||
scsibus* at asc?
|
||||
|
||||
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 ?
|
||||
|
||||
#
|
||||
# ISA Bus.
|
||||
#
|
||||
isabr* at mainbus0
|
||||
|
||||
isa* at isabr?
|
||||
|
||||
com2 at isa? port 0x3f8 irq 4
|
||||
com3 at isa? port 0x2f8 irq 3
|
||||
|
||||
|
||||
pseudo-device sl 2 # serial-line IP ports
|
||||
pseudo-device ppp 2 # serial-line PPP ports
|
||||
pseudo-device pty 64 # pseudo ptys
|
||||
pseudo-device bpfilter 16 # packet filter ports
|
||||
#pseudo-device gre 2 # generic L3 over IP tunnel
|
||||
pseudo-device loop
|
||||
pseudo-device gif 4 # IPv[46] over IPv[46] tunnel (RFC1933)
|
||||
#pseudo-device faith 1 # IPv[46] tcp relay translation i/f
|
||||
pseudo-device vnd 4 # virtual disk
|
||||
pseudo-device ccd 4 # concatenated disks
|
||||
#pseudo-device raid 4 # RAIDframe disk driver
|
@ -1,15 +1,16 @@
|
||||
# $NetBSD: Makefile.arc,v 1.29 2000/01/23 20:08:55 soda Exp $
|
||||
# $NetBSD: Makefile.arc,v 1.30 2000/01/23 21:01:52 soda Exp $
|
||||
# $OpenBSD: Makefile.arc,v 1.8 1997/05/21 10:06:49 pefo Exp $
|
||||
|
||||
# Makefile for NetBSD
|
||||
#
|
||||
# This makefile is constructed from a machine description:
|
||||
# config machineid
|
||||
# Most changes should be made in the machine description
|
||||
# /sys/arch/pica/conf/``machineid''
|
||||
# /sys/arch/arc/conf/``machineid''
|
||||
# after which you should do
|
||||
# config machineid
|
||||
# Machine generic makefile changes should be made in
|
||||
# /sys/arch/pica/conf/Makefile.pica
|
||||
# /sys/arch/arc/conf/Makefile.arc
|
||||
# after which config should be rerun for all machines of that type.
|
||||
#
|
||||
# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
|
||||
@ -30,32 +31,39 @@ LORDER?=lorder
|
||||
MKDEP?= mkdep
|
||||
NM?= nm
|
||||
RANLIB?=ranlib
|
||||
SIZE?= size
|
||||
STRIPPROG?=strip
|
||||
SIZE?= size
|
||||
ELF2AOUT?= touch # XXX
|
||||
ELF2ECOFF?= elf2ecoff
|
||||
TOUCH?= touch -f -c
|
||||
TSORT?= tsort -q
|
||||
|
||||
COPTS?= -O2
|
||||
COPTS?= -O2 # -mmemcpy # XXX: - profile this
|
||||
|
||||
TEXTADDR?= 80100000
|
||||
|
||||
# source tree is located via $S relative to the compilation directory
|
||||
.ifndef S
|
||||
#S!= cd ../../../..; pwd
|
||||
S= ../../../..
|
||||
.endif
|
||||
PICA= $S/arch/pica
|
||||
ARC= $S/arch/arc
|
||||
MIPS= $S/arch/mips
|
||||
|
||||
HAVE_GCC28!= ${CC} --version | egrep "^(2\.8|egcs)" ; echo
|
||||
INCLUDES= -I. -I$S/arch -I$S -nostdinc
|
||||
CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -Dpica
|
||||
CWARNFLAGS?= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith
|
||||
CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -Darc
|
||||
# XXX: -Werror
|
||||
CWARNFLAGS?= -Wall -Wmissing-prototypes -Wstrict-prototypes \
|
||||
-Wpointer-arith
|
||||
.if (${HAVE_GCC28} != "")
|
||||
CWARNFLAGS+= -Wno-main
|
||||
.endif
|
||||
GP?= -G 0
|
||||
GP?= -G 0 # -G 30 # XXX: check this
|
||||
CFLAGS= ${DEBUG} ${COPTS} ${CWARNFLAGS} ${GP} \
|
||||
-mips2 -mcpu=r4000 -mno-abicalls -mno-half-pic
|
||||
AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE
|
||||
LINKFLAGS= -T${MIPS}/conf/kern.ldscript -Ttext 80080000 -e start ${GP}
|
||||
AFLAGS= -x assembler-with-cpp -traditional-cpp -mips3 -D_LOCORE
|
||||
LINKFLAGS= -T${MIPS}/conf/kern.ldscript -Ttext ${TEXTADDR} -e start ${GP}
|
||||
STRIPFLAGS= -g -X -x
|
||||
|
||||
%INCLUDES
|
||||
@ -95,7 +103,10 @@ NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $<
|
||||
# ${SYSTEM_LD} swapxxx.o
|
||||
# ${SYSTEM_LD_TAIL}
|
||||
SYSTEM_OBJ= locore.o fp.o locore_machdep.o \
|
||||
param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN}
|
||||
param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN}
|
||||
.if !empty(IDENT:M-DMIPS3)
|
||||
SYSTEM_OBJ+= locore_mips3.o
|
||||
.endif
|
||||
SYSTEM_DEP= Makefile ${SYSTEM_OBJ}
|
||||
SYSTEM_LD_HEAD= @rm -f $@
|
||||
SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o ; \
|
||||
@ -115,9 +126,9 @@ LINKFLAGS+= -x
|
||||
|
||||
SYSTEM_LD_TAIL+=;\
|
||||
mv $@ $@.elf; \
|
||||
elf2aout $@.elf $@; \
|
||||
${ELF2AOUT} $@.elf $@; \
|
||||
chmod 755 $@; \
|
||||
elf2ecoff $@.elf $@.ecoff
|
||||
${ELF2ECOFF} $@.elf $@.ecoff
|
||||
|
||||
%LOAD
|
||||
|
||||
@ -126,7 +137,6 @@ assym.h: $S/kern/genassym.sh ${MIPS}/mips/genassym.cf
|
||||
< ${MIPS}/mips/genassym.cf > assym.h.tmp && \
|
||||
mv -f assym.h.tmp assym.h
|
||||
|
||||
|
||||
param.c: $S/conf/param.c
|
||||
rm -f param.c
|
||||
cp $S/conf/param.c .
|
||||
@ -143,8 +153,8 @@ newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
|
||||
|
||||
__CLEANKERNEL: .USE
|
||||
@echo "${.TARGET}ing the kernel objects"
|
||||
rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
|
||||
[Ee]rrs linterrs makelinks assym.h.tmp assym.h
|
||||
rm -f eddep *netbsd netbsd.gdb netbsd.ecoff netbsd.elf \
|
||||
tags *.[io] [a-z]*.s [Ee]rrs linterrs makelinks assym.h.tmp assym.h
|
||||
|
||||
__CLEANDEPEND: .USE
|
||||
rm -f .depend
|
||||
@ -155,7 +165,7 @@ cleandir distclean: __CLEANKERNEL __CLEANDEPEND
|
||||
|
||||
lint:
|
||||
@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
|
||||
${PICA}/pica/Locore.c ${CFILES} \
|
||||
${ARC}/arc/Locore.c ${CFILES} \
|
||||
ioconf.c param.c | \
|
||||
grep -v 'static function .* unused'
|
||||
|
||||
@ -170,17 +180,24 @@ links:
|
||||
sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
|
||||
sh makelinks && rm -f dontlink
|
||||
|
||||
#OBSOLETE:
|
||||
#SRCS= ${ARC}/arc/locore.S ${ARC}/arc/fp.S \
|
||||
# param.c ioconf.c ${CFILES} ${SFILES}
|
||||
SRCS= ${MIPS}/mips/locore.S ${MIPS}/mips/fp.S \
|
||||
${PICA}/pica/locore_machdep.S \
|
||||
${ARC}/arc/locore_machdep.S \
|
||||
param.c ioconf.c ${CFILES} ${SFILES}
|
||||
depend: .depend
|
||||
#OBSOLETE:
|
||||
#.depend: ${SRCS} assym.h param.c
|
||||
# ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${ARC}/arc/locore.S ${ARC}/arc/fp.S
|
||||
.depend: ${SRCS} assym.h param.c
|
||||
${MKDEP} ${AFLAGS} ${CPPFLAGS} ${MIPS}/mips/locore.S ${MIPS}/mips/fp.S
|
||||
${MKDEP} ${AFLAGS} ${CPPFLAGS} ${PICA}/pica/locore_machdep.S
|
||||
${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${ARC}/arc/locore_machdep.S
|
||||
${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
|
||||
[ "${SFILES}" = "" ] || \
|
||||
${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
|
||||
sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \
|
||||
${CPPFLAGS} < ${MIPS}/mips/genassym.cf
|
||||
${CPPFLAGS} ${PROF} < ${MIPS}/mips/genassym.cf
|
||||
@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
|
||||
@rm -f assym.dep
|
||||
|
||||
@ -195,17 +212,24 @@ uipc_proto.o vfs_conf.o: Makefile
|
||||
machdep.o: Makefile
|
||||
|
||||
# depend on CPU configuration
|
||||
machdep.o clock.o: Makefile
|
||||
machdep.o mainbus.o trap.o: Makefile
|
||||
|
||||
# depend on System V IPC/shmem options
|
||||
mips_machdep.o pmap.o: Makefile
|
||||
|
||||
locore.o: ${MIPS}/mips/locore.S assym.h
|
||||
${NORMAL_S}
|
||||
|
||||
locore.o: ${MIPS}/mips/locore.S ${MIPS}/mips/locore_r2000.S ${MIPS}/mips/locore_r4000.S assym.h
|
||||
locore_mips1.o: ${MIPS}/mips/locore_mips1.S assym.h
|
||||
${NORMAL_S}
|
||||
|
||||
locore_mips3.o: ${MIPS}/mips/locore_mips3.S assym.h
|
||||
${NORMAL_S}
|
||||
|
||||
fp.o: ${MIPS}/mips/fp.S assym.h
|
||||
${NORMAL_S}
|
||||
|
||||
locore_machdep.o: ${PICA}/pica/locore_machdep.S assym.h
|
||||
locore_machdep.o: ${ARC}/arc/locore_machdep.S assym.h
|
||||
${NORMAL_S}
|
||||
|
||||
%RULES
|
||||
|
@ -1,59 +1,85 @@
|
||||
# $NetBSD: P4032,v 1.2 2000/01/23 21:01:53 soda Exp $
|
||||
# $OpenBSD: P4032,v 1.1 1997/05/18 13:45:23 pefo Exp $
|
||||
#
|
||||
# Generic configuration file for Algorithmics P4032 board
|
||||
#
|
||||
|
||||
machine arc
|
||||
include "arch/arc/conf/std.arc"
|
||||
|
||||
maxusers 32
|
||||
|
||||
# Need to set locally
|
||||
options TIMEZONE=0 # minutes west of GMT (for)
|
||||
options DST=0 # use daylight savings rules
|
||||
options RTC_OFFSET=0 # hardware clock is this many mins. west of GMT
|
||||
|
||||
# Standard system options
|
||||
options SWAPPAGER # swap pager (anonymous and swap space)
|
||||
options DEVPAGER # device pager (mapped devices)
|
||||
|
||||
options DIAGNOSTIC # extra kernel debugging checks
|
||||
options KTRACE # system call tracing support
|
||||
|
||||
# Diagnostic/debugging support options
|
||||
options DIAGNOSTIC # extra kernel debugging checks
|
||||
options DEBUG # extra kernel debugging support
|
||||
options COMPAT_43 # compatibility with 4.3BSD binaries
|
||||
|
||||
# System V options
|
||||
options SYSVMSG # System V-like message queues
|
||||
options SYSVSEM # System V-like semaphores
|
||||
options SYSVSHM # System V-like memory sharing
|
||||
options SHMMAXPGS=1024 # 1024 pages is the default
|
||||
options NATIVE_ELF # Arc systems uses ELF as native format
|
||||
|
||||
# Compatibilitry modules
|
||||
options COMPAT_43 # compatibility with 4.3BSD binaries
|
||||
options COMPAT_11
|
||||
options COMPAT_12
|
||||
options COMPAT_13
|
||||
options COMPAT_14
|
||||
#options COMPAT_ULTRIX # Ultrix binary compatibility (no go yet)
|
||||
options COMPAT_386BSD_MBRPART # recognize old partition ID
|
||||
|
||||
# Filesystem options
|
||||
options CD9660 # ISO 9660 + Rock Ridge file system
|
||||
options FDESC # user file descriptor filesystem (/dev/fd)
|
||||
options FIFO # POSIX fifo support (in all filesystems)
|
||||
options FFS,QUOTA # fast filesystem with user and group quotas
|
||||
options KERNFS # kernel data-structure filesystem
|
||||
#options LFS # Log-based filesystem (still experimental)
|
||||
options MFS # memory-based filesystem
|
||||
options MSDOSFS # Ability to read write MS-Dos filsystem
|
||||
options NFSCLIENT # Sun NFS-compatible filesystem (client)
|
||||
options NFSSERVER # Sun NFS-compatible filesystem (server)
|
||||
options NULLFS # null layer filesystem
|
||||
options PORTAL # portal filesystem (still experimental)
|
||||
option PROCFS # /proc
|
||||
options UMAPFS # uid/gid remapping filesystem
|
||||
option UNION # union file system
|
||||
file-system FFS # fast filesystem with user and group quotas
|
||||
file-system MFS # memory-based filesystem
|
||||
#file-system LFS # Log-based filesystem (still experimental)
|
||||
file-system CD9660 # ISO 9660 + Rock Ridge file system
|
||||
file-system MSDOSFS # Ability to read write MS-Dos filsystem
|
||||
file-system NFS # Sun NFS-compatible filesystem (client)
|
||||
file-system KERNFS # kernel data-structure filesystem
|
||||
file-system PROCFS # /proc
|
||||
file-system FDESC # user file descriptor filesystem (/dev/fd)
|
||||
file-system UMAPFS # uid/gid remapping filesystem
|
||||
file-system UNION # union file system
|
||||
file-system NULLFS # null layer filesystem
|
||||
file-system OVERLAY # overlay file system
|
||||
file-system PORTAL # portal filesystem (still experimental)
|
||||
|
||||
options FIFO # POSIX fifo support (in all filesystems)
|
||||
options QUOTA # FFS quotas
|
||||
#options FFS_EI # FFS Endian Independant support
|
||||
#options SOFTDEP # FFS soft updates support.
|
||||
options NFSSERVER # Sun NFS-compatible filesystem (server)
|
||||
|
||||
# Pull in config fragments for kernel crypto. This is required for
|
||||
# options IPSEC etc. to work. If you want to run with IPSEC, uncomment
|
||||
# one of these, based on whether you use crypto-us or crypto-intl, and
|
||||
# adjust the prefixes as necessary.
|
||||
|
||||
#prefix ../crypto-us/sys
|
||||
#cinclude "conf/files.crypto-us"
|
||||
#prefix
|
||||
|
||||
#prefix ../crypto-intl/sys
|
||||
#cinclude "conf/files.crypto-intl"
|
||||
#prefix
|
||||
|
||||
# Networking options
|
||||
#options GATEWAY # IP packet forwarding
|
||||
options INET # Internet protocols
|
||||
#option NS # XNS
|
||||
#option IPX # IPX+SPX
|
||||
options INET6 # IPV6
|
||||
#options IPSEC # IP security
|
||||
#options IPSEC_ESP # IP security (encryption part; define w/IPSEC)
|
||||
#options IPSEC_DEBUG # debug for IP security
|
||||
#options NS # XNS
|
||||
#options IPX # IPX+SPX
|
||||
#options ISO,TPIP # OSI networking
|
||||
#options EON # OSI tunneling over IP
|
||||
#option CCITT,LLC,HDLC # X.25
|
||||
option IPFILTER # IP packet filter for security
|
||||
|
||||
#options TCP_COMPAT_42 # compatibility with 4.2BSD TCP/IP
|
||||
#options MULTICAST # Multicast support
|
||||
@ -62,8 +88,9 @@ option IPFILTER # IP packet filter for security
|
||||
# Special options
|
||||
options MACHINE_NONCONTIG # Support noncontigous memory.
|
||||
|
||||
# Specify storage configuration (its a joke..)
|
||||
config bsd swap generic
|
||||
options NFS_BOOT_BOOTP,NFS_BOOT_BOOTPARAM
|
||||
|
||||
config netbsd root on ? type ?
|
||||
|
||||
#
|
||||
# Definition of system
|
||||
@ -78,7 +105,7 @@ pbcpcibr* at mainbus0 # PCI Bus bridge.
|
||||
|
||||
#### Algor bus devices
|
||||
|
||||
clock0 at algor?
|
||||
aclock0 at algor?
|
||||
com0 at algor?
|
||||
com1 at algor?
|
||||
lpt0 at algor?
|
||||
@ -105,13 +132,17 @@ uk* at scsibus? target ? lun ?
|
||||
|
||||
pseudo-device loop 1 # network loopback
|
||||
pseudo-device bpfilter 8 # packet filter ports
|
||||
#pseudo-device gre 2 # generic L3 over IP tunnel
|
||||
pseudo-device sl 2 # serial-line IP ports
|
||||
pseudo-device ppp 2 # serial-line PPP ports
|
||||
pseudo-device tun 2 # network tunneling over tty
|
||||
pseudo-device ipfilter # ip filter
|
||||
pseudo-device gif 4 # IPv[46] over IPv[46] tunnel (RFC1933)
|
||||
#pseudo-device faith 1 # IPv[46] tcp relay translation i/f
|
||||
|
||||
pseudo-device pty 64 # pseudo ptys
|
||||
pseudo-device tb 1 # tablet line discipline
|
||||
pseudo-device vnd 4 # paging to files
|
||||
pseudo-device ccd 4 # concatenated disk devices
|
||||
pseudo-device rd 4 # ram disk.
|
||||
|
||||
pseudo-device ccd 4 # concatenated disk devices
|
||||
#pseudo-device raid 4 # RAIDframe disk driver
|
||||
pseudo-device md 4 # memory disk devices
|
||||
|
@ -1,20 +1,22 @@
|
||||
# $NetBSD: PICA,v 1.14 2000/01/23 20:08:04 soda Exp $
|
||||
# $NetBSD: PICA,v 1.15 2000/01/23 21:01:53 soda Exp $
|
||||
#
|
||||
# Generic configuration file for MIPS R4400 PICA system
|
||||
#
|
||||
include "arch/pica/conf/std.pica"
|
||||
|
||||
include "arch/arc/conf/std.arc"
|
||||
|
||||
maxusers 32
|
||||
|
||||
#options MIPS1 # R2000/R3000 support
|
||||
options MIPS3 # R4000/R4400 support
|
||||
# Need to set locally
|
||||
options RTC_OFFSET=0 # hardware clock is this many mins. west of GMT
|
||||
|
||||
# Standard system options
|
||||
options KTRACE # system call tracing support
|
||||
|
||||
# Diagnostic/debugging support options
|
||||
options DIAGNOSTIC # extra kernel debugging checks
|
||||
options DEBUG # extra kernel debugging support
|
||||
options "COMPAT_43" # compatibility with 4.3BSD binaries
|
||||
#options KTRACE # system call tracing support
|
||||
options "NKMEMCLUSTERS=1024" # 4K pages in kernel malloc pool
|
||||
#options KGDB # support for kernel gdb
|
||||
#options KGDB # support for kernel gdb
|
||||
#options "KGDBRATE=19200" # kernel gdb port rate (default 9600)
|
||||
#options "KGDBDEV=15*256+0" # device for kernel gdb
|
||||
|
||||
@ -27,41 +29,81 @@ options SHMMAXPGS=1024 # 1024 pages is the default
|
||||
# Filesystem options
|
||||
file-system FFS # fast filesystem
|
||||
file-system MFS # memory-based filesystem
|
||||
#file-system LFS # Log-based filesystem (still experimental)
|
||||
file-system CD9660 # ISO 9660 + Rock Ridge file system
|
||||
file-system MSDOSFS # Ability to read write MS-Dos filsystem
|
||||
file-system NFS # Sun NFS-compatible filesystem (client)
|
||||
file-system KERNFS # kernel data-structure filesystem
|
||||
file-system MSDOSFS # Ability to read write MS-Dos filsystem
|
||||
file-system CD9660 # ISO 9660 + Rock Ridge file system
|
||||
file-system PROCFS # /proc
|
||||
file-system FDESC # user file descriptor filesystem
|
||||
#file-system UMAPFS # uid/gid remapping filesystem
|
||||
#file-system UNION # union file system
|
||||
#file-system NULLFS # null layer filesystem
|
||||
#file-system LFS # Log-based filesystem (still experimental)
|
||||
#file-system OVERLAY # overlay file system
|
||||
#file-system PORTAL # portal filesystem (still experimental)
|
||||
|
||||
options QUOTA # FFS quotas
|
||||
#options FFS_EI # FFS Endian Independant support
|
||||
#options SOFTDEP # FFS soft updates support.
|
||||
options NFSSERVER # Sun NFS-compatible filesystem (server)
|
||||
|
||||
# Pull in config fragments for kernel crypto. This is required for
|
||||
# options IPSEC etc. to work. If you want to run with IPSEC, uncomment
|
||||
# one of these, based on whether you use crypto-us or crypto-intl, and
|
||||
# adjust the prefixes as necessary.
|
||||
|
||||
#prefix ../crypto-us/sys
|
||||
#cinclude "conf/files.crypto-us"
|
||||
#prefix
|
||||
|
||||
#prefix ../crypto-intl/sys
|
||||
#cinclude "conf/files.crypto-intl"
|
||||
#prefix
|
||||
|
||||
# Networking options
|
||||
options INET # Internet protocols
|
||||
options "TCP_COMPAT_42" # compatibility with 4.2BSD TCP/IP
|
||||
options INET6 # IPV6
|
||||
#options IPSEC # IP security
|
||||
#options IPSEC_ESP # IP security (encryption part; define w/IPSEC)
|
||||
#options IPSEC_DEBUG # debug for IP security
|
||||
#options TCP_COMPAT_42 # compatibility with 4.2BSD TCP/IP
|
||||
options GATEWAY # IP packet forwarding
|
||||
#options MULTICAST # Multicast support
|
||||
#options MROUTING # Multicast routing support
|
||||
#options ISO # OSI networking
|
||||
#options TPIP
|
||||
#options EON
|
||||
#options ISO,TPIP # OSI networking
|
||||
#options EON # OSI tunneling over IP
|
||||
|
||||
config netbsd root on sd0 type ffs
|
||||
# Compatibilitry modules
|
||||
options COMPAT_43 # compatibility with 4.3BSD binaries
|
||||
options COMPAT_11
|
||||
options COMPAT_12
|
||||
options COMPAT_13
|
||||
options COMPAT_14
|
||||
#options COMPAT_ULTRIX # Ultrix binary compatibility (no go yet)
|
||||
options COMPAT_386BSD_MBRPART # recognize old partition ID
|
||||
|
||||
# Special options
|
||||
#options MACHINE_NONCONTIG # Support noncontigous memory.
|
||||
options NKMEMCLUSTERS=1024 # 4K pages in kernel malloc pool
|
||||
|
||||
options NFS_BOOT_BOOTP,NFS_BOOT_BOOTPARAM
|
||||
|
||||
# Specify storage configuration
|
||||
config netbsd root on ? type ?
|
||||
|
||||
#
|
||||
# Definition of system
|
||||
#
|
||||
mainbus0 at root
|
||||
cpu* at mainbus0
|
||||
|
||||
pica* at mainbus0
|
||||
clock0 at pica?
|
||||
|
||||
aclock0 at pica?
|
||||
pc0 at pica?
|
||||
pms0 at pica?
|
||||
pcom0 at pica?
|
||||
pcom1 at pica?
|
||||
opms0 at pica?
|
||||
com0 at pica?
|
||||
com1 at pica?
|
||||
lpt0 at pica?
|
||||
sn0 at pica?
|
||||
|
||||
@ -74,12 +116,29 @@ scsibus* at asc?
|
||||
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 ?
|
||||
|
||||
#
|
||||
# ISA Bus.
|
||||
#
|
||||
isabr* at mainbus0
|
||||
|
||||
isa* at isabr?
|
||||
|
||||
com2 at isa? port 0x3f8 irq 4
|
||||
com3 at isa? port 0x2f8 irq 3
|
||||
|
||||
|
||||
pseudo-device loop 1 # network loopback
|
||||
pseudo-device sl 2 # serial-line IP ports
|
||||
pseudo-device ppp 2 # serial-line PPP ports
|
||||
pseudo-device tun 2 # network tunneling over tty
|
||||
pseudo-device pty 64 # pseudo ptys
|
||||
pseudo-device bpfilter 16 # packet filter ports
|
||||
pseudo-device vnd 4 # virtual disk
|
||||
#pseudo-device gre 2 # generic L3 over IP tunnel
|
||||
pseudo-device loop
|
||||
pseudo-device gif 4 # IPv[46] over IPv[46] tunnel (RFC1933)
|
||||
#pseudo-device faith 1 # IPv[46] tcp relay translation i/f
|
||||
pseudo-device vnd 4 # virtual disk
|
||||
pseudo-device ccd 4 # concatenated disks
|
||||
#pseudo-device raid 4 # RAIDframe disk driver
|
||||
|
@ -1,68 +1,99 @@
|
||||
# $NetBSD: RAMDISK,v 1.2 2000/01/23 21:01:53 soda Exp $
|
||||
# $OpenBSD: RAMDISK,v 1.2 1997/05/19 10:34:54 pefo Exp $
|
||||
#
|
||||
# Generic configuration file for MIPS R4x00 ARC Systems
|
||||
#
|
||||
|
||||
machine arc
|
||||
include "arch/arc/conf/std.arc"
|
||||
|
||||
maxusers 4
|
||||
|
||||
# Need to set locally
|
||||
options TIMEZONE=0 # minutes west of GMT (for)
|
||||
options DST=0 # use daylight savings rules
|
||||
options RTC_OFFSET=0 # hardware clock is this many mins. west of GMT
|
||||
|
||||
# Standard system options
|
||||
options SWAPPAGER # swap pager (anonymous and swap space)
|
||||
options DEVPAGER # device pager (mapped devices)
|
||||
|
||||
options DIAGNOSTIC # extra kernel debugging checks
|
||||
options KTRACE # system call tracing support
|
||||
|
||||
# Diagnostic/debugging support options
|
||||
options DIAGNOSTIC # extra kernel debugging checks
|
||||
options DEBUG # extra kernel debugging support
|
||||
options COMPAT_43 # compatibility with 4.3BSD binaries
|
||||
|
||||
# System V options
|
||||
options SYSVMSG # System V-like message queues
|
||||
options SYSVSEM # System V-like semaphores
|
||||
options SYSVSHM # System V-like memory sharing
|
||||
options SHMMAXPGS=1024 # 1024 pages is the default
|
||||
options NATIVE_ELF # Arc systems uses ELF as native format
|
||||
|
||||
# Filesystem options
|
||||
options CD9660 # ISO 9660 + Rock Ridge file system
|
||||
#options FDESC # user file descriptor filesystem (/dev/fd)
|
||||
options FIFO # POSIX fifo support (in all filesystems)
|
||||
options FFS,QUOTA # fast filesystem with user and group quotas
|
||||
options KERNFS # kernel data-structure filesystem
|
||||
options MFS # memory-based filesystem
|
||||
options MSDOSFS # Ability to read write MS-Dos filsystem
|
||||
options NFSCLIENT # Sun NFS-compatible filesystem (client)
|
||||
#options NFSSERVER # Sun NFS-compatible filesystem (server)
|
||||
#options NULLFS # null layer filesystem
|
||||
#options PORTAL # portal filesystem (still experimental)
|
||||
#options PROCFS # /proc
|
||||
#options UMAPFS # uid/gid remapping filesystem
|
||||
#options UNION # union file system
|
||||
file-system FFS # fast filesystem
|
||||
file-system MFS # memory-based filesystem
|
||||
#file-system LFS # Log-based filesystem (still experimental)
|
||||
file-system CD9660 # ISO 9660 + Rock Ridge file system
|
||||
file-system MSDOSFS # Ability to read write MS-Dos filsystem
|
||||
file-system NFS # Sun NFS-compatible filesystem (client)
|
||||
file-system KERNFS # kernel data-structure filesystem
|
||||
#file-system PROCFS # /proc
|
||||
#file-system FDESC # user file descriptor filesystem
|
||||
#file-system UMAPFS # uid/gid remapping filesystem
|
||||
#file-system UNION # union file system
|
||||
#file-system NULLFS # null layer filesystem
|
||||
#file-system OVERLAY # overlay file system
|
||||
#file-system PORTAL # portal filesystem (still experimental)
|
||||
|
||||
options FIFO # POSIX fifo support (in all filesystems)
|
||||
options QUOTA # FFS quotas
|
||||
#options FFS_EI # FFS Endian Independant support
|
||||
#options SOFTDEP # FFS soft updates support.
|
||||
#options NFSSERVER # Sun NFS-compatible filesystem (server)
|
||||
|
||||
# Pull in config fragments for kernel crypto. This is required for
|
||||
# options IPSEC etc. to work. If you want to run with IPSEC, uncomment
|
||||
# one of these, based on whether you use crypto-us or crypto-intl, and
|
||||
# adjust the prefixes as necessary.
|
||||
|
||||
#prefix ../crypto-us/sys
|
||||
#cinclude "conf/files.crypto-us"
|
||||
#prefix
|
||||
|
||||
#prefix ../crypto-intl/sys
|
||||
#cinclude "conf/files.crypto-intl"
|
||||
#prefix
|
||||
|
||||
# Networking options
|
||||
#options GATEWAY # IP packet forwarding
|
||||
options INET # Internet protocols
|
||||
#option NS # XNS
|
||||
#option IPX # IPX+SPX
|
||||
#options INET6 # IPV6
|
||||
#options IPSEC # IP security
|
||||
#options IPSEC_ESP # IP security (encryption part; define w/IPSEC)
|
||||
#options IPSEC_DEBUG # debug for IP security
|
||||
#options MROUTING # Multicast routing support
|
||||
#options NS # XNS
|
||||
#options IPX # IPX+SPX
|
||||
#options ISO,TPIP # OSI networking
|
||||
#options EON # OSI tunneling over IP
|
||||
#option CCITT,LLC,HDLC # X.25
|
||||
#option IPFILTER # IP packet filter for security
|
||||
#options CCITT,LLC,HDLC # X.25
|
||||
#options PFIL_HOOKS # pfil(9) packet filter hooks.
|
||||
|
||||
# Compatibilitry modules
|
||||
options COMPAT_43 # compatibility with 4.3BSD binaries
|
||||
options COMPAT_11
|
||||
options COMPAT_12
|
||||
options COMPAT_13
|
||||
options COMPAT_14
|
||||
#options COMPAT_ULTRIX # Ultrix binary compatibility (no go yet)
|
||||
#options TCP_COMPAT_42 # compatibility with 4.2BSD TCP/IP
|
||||
#options MULTICAST # Multicast support
|
||||
#options MROUTING # Multicast routing support
|
||||
options COMPAT_386BSD_MBRPART # recognize old partition ID
|
||||
|
||||
# Special options
|
||||
options MACHINE_NONCONTIG # Support noncontigous memory.
|
||||
|
||||
# Specify storage configuration using ramdisk
|
||||
config bsd root on rd0a swap on rd0b
|
||||
config netbsd root on md0 type ffs
|
||||
|
||||
# Enable the hooks used for initializing the ram-disk.
|
||||
options MEMORY_DISK_HOOKS
|
||||
options MEMORY_DISK_IS_ROOT # Force root on ram-disk
|
||||
options MINIROOTSIZE=8192 # 4 Megabytes
|
||||
|
||||
#
|
||||
# Definition of system
|
||||
@ -77,9 +108,9 @@ isabr* at mainbus0 # ISA Bus bridge (std ISA bus).
|
||||
|
||||
#### PICA bus devices
|
||||
|
||||
clock0 at pica?
|
||||
aclock0 at pica?
|
||||
pc0 at pica?
|
||||
pms0 at pica?
|
||||
opms0 at pica?
|
||||
com0 at pica?
|
||||
com1 at pica?
|
||||
lpt0 at pica?
|
||||
@ -95,7 +126,7 @@ scsibus* at asc?
|
||||
|
||||
isa* at isabr?
|
||||
|
||||
clock0 at isa? port 0x70 irq 0
|
||||
aclock0 at isa? port 0x70 irq 0
|
||||
|
||||
pc0 at isa? port 0x60 irq 1 # generic PC console device
|
||||
com0 at isa? port 0x3f8 irq 4
|
||||
@ -103,18 +134,42 @@ com1 at isa? port 0x2f8 irq 3
|
||||
com2 at isa? port 0x3e8 irq 4
|
||||
com3 at isa? port 0x2e8 irq 3
|
||||
|
||||
wdc0 at isa? port 0x1f0 irq 14 # ST506, ESDI, IDE controllers
|
||||
#wdc1 at isa? port 0x170 irq 15
|
||||
wd* at wdc? drive ?
|
||||
# ISA ST506, ESDI, and IDE controllers
|
||||
# Use flags 0x01 if you want to try to use 32bits data I/O (the driver will
|
||||
# fall back to 16bits I/O if 32bits I/O are not functional).
|
||||
# Some controllers pass the initial 32bit test, but will fail later.
|
||||
wdc0 at isa? port 0x1f0 irq 14 flags 0x00
|
||||
#wdc1 at isa? port 0x170 irq 15 flags 0x00
|
||||
|
||||
atapibus* at wdc?
|
||||
acd* at atapibus? drive?
|
||||
# IDE drives
|
||||
# Flags are used only with controllers that support DMA operations
|
||||
# and mode settings (e.g. some pciide controllers)
|
||||
# The lowest order four bits (rightmost digit) of the flags define the PIO
|
||||
# mode to use, the next set of four bits the DMA mode and the third set the
|
||||
# UltraDMA mode. For each set of four bits, the 3 lower bits define the mode
|
||||
# to use, and the last bit must be 1 for this setting to be used.
|
||||
# For DMA and UDMA, 0xf (1111) means 'disable'.
|
||||
# 0x0fac means 'use PIO mode 4, DMA mode 2, disable UltraDMA'.
|
||||
# (0xc=1100, 0xa=1010, 0xf=1111)
|
||||
# 0x0000 means "use whatever the drive claims to support".
|
||||
wd* at wdc? channel ? drive ? flags 0x0000
|
||||
|
||||
# ATAPI bus support
|
||||
atapibus* at wdc? channel ?
|
||||
|
||||
# ATAPI devices
|
||||
# flags have the same meaning as for IDE drives.
|
||||
cd* at atapibus? drive ? flags 0x0000 # ATAPI CD-ROM drives
|
||||
sd* at atapibus? drive ? flags 0x0000 # ATAPI disk drives
|
||||
uk* at atapibus? drive ? flags 0x0000 # ATAPI unknown
|
||||
|
||||
lpt0 at isa? port 0x378 irq 7
|
||||
ep0 at isa? port ? irq ? # 3C509 ethernet cards
|
||||
ed0 at isa? port 0x280 iomem 0xd0000 irq 9 # WD/SMC, 3C503, NE[12]000
|
||||
ed1 at isa? port 0x250 iomem 0xd8000 irq 9 # ethernet cards
|
||||
ed2 at isa? port 0x300 iomem 0xcc000 irq 10 #
|
||||
ec0 at isa? port 0x250 iomem 0xd8000 irq 9 # 3Com 3c503 Ethernet
|
||||
ep0 at isa? port ? irq ? # 3C509 ethernet cards
|
||||
ne0 at isa? port 0x280 irq 9 # NE[12]000 ethernet cards
|
||||
ne1 at isa? port 0x300 irq 10
|
||||
we0 at isa? port 0x280 iomem 0xd0000 irq 9 # WD/SMC Ethernet
|
||||
we1 at isa? port 0x300 iomem 0xcc000 irq 10
|
||||
|
||||
btl0 at isa? port 0x330 irq ? drq ?
|
||||
scsibus* at btl?
|
||||
@ -132,17 +187,17 @@ cd* at scsibus? target ? lun ?
|
||||
|
||||
pseudo-device loop 1 # network loopback
|
||||
#pseudo-device bpfilter 8 # packet filter ports
|
||||
#pseudo-device gre 2 # generic L3 over IP tunnel
|
||||
pseudo-device sl 2 # serial-line IP ports
|
||||
pseudo-device ppp 2 # serial-line PPP ports
|
||||
#pseudo-device tun 2 # network tunneling over tty
|
||||
#pseudo-device ipfilter # ip filter
|
||||
#pseudo-device gif 4 # IPv[46] over IPv[46] tunnel (RFC1933)
|
||||
#pseudo-device faith 1 # IPv[46] tcp relay translation i/f
|
||||
|
||||
#pseudo-device pty 64 # pseudo ptys
|
||||
#pseudo-device tb 1 # tablet line discipline
|
||||
#pseudo-device vnd 4 # paging to files
|
||||
#pseudo-device ccd 4 # concatenated disk devices
|
||||
pseudo-device rd 1 # Ram disk.
|
||||
|
||||
# RAMDISK stuff
|
||||
option MINIROOTSIZE=8192
|
||||
option RAMDISK_HOOKS
|
||||
|
||||
#pseudo-device ccd 4 # concatenated disk devices
|
||||
#pseudo-device raid 4 # RAIDframe disk driver
|
||||
pseudo-device md 1 # memory disk devices
|
||||
|
@ -1,88 +1,171 @@
|
||||
# $NetBSD: files.arc,v 1.13 2000/01/23 20:08:56 soda Exp $
|
||||
maxpartitions 8
|
||||
# $NetBSD: files.arc,v 1.14 2000/01/23 21:01:53 soda Exp $
|
||||
# $OpenBSD: files.arc,v 1.15 1997/05/18 13:45:24 pefo Exp $
|
||||
#
|
||||
# maxpartitions must be first item in files.${ARCH}
|
||||
#
|
||||
maxpartitions 16
|
||||
|
||||
maxusers 2 8 64
|
||||
|
||||
# Required files
|
||||
|
||||
file arch/arc/arc/autoconf.c
|
||||
file arch/arc/arc/conf.c
|
||||
file arch/arc/arc/disksubr.c
|
||||
file arch/arc/dev/dma.c
|
||||
file arch/arc/arc/machdep.c
|
||||
#file arch/arc/arc/minidebug.c
|
||||
#file arch/arc/arc/pmap.c
|
||||
#file arch/arc/arc/sys_machdep.c
|
||||
#file arch/arc/arc/trap.c
|
||||
file arch/arc/arc/arc_trap.c
|
||||
#file arch/arc/arc/vm_machdep.c
|
||||
|
||||
file arch/arc/arc/arcbios.c
|
||||
|
||||
##
|
||||
## Machine-independent ATAPI drivers
|
||||
##
|
||||
include "dev/ata/files.ata"
|
||||
major { wd = 4 }
|
||||
|
||||
#
|
||||
# System BUS types
|
||||
#
|
||||
device mainbus { } # no locators
|
||||
attach mainbus at root
|
||||
file arch/arc/arc/mainbus.c mainbus
|
||||
|
||||
# Our CPU configurator
|
||||
device cpu # not optional
|
||||
attach cpu at mainbus
|
||||
file arch/pica/pica/cpu.c cpu
|
||||
file arch/arc/arc/cpu.c cpu
|
||||
|
||||
#
|
||||
# PICA bus autoconfiguration devices
|
||||
# Magnum and PICA bus autoconfiguration devices
|
||||
#
|
||||
device pica { } # { slot = -1, offset = -1 }
|
||||
attach pica at mainbus
|
||||
file arch/pica/pica/pica.c pica needs-flag
|
||||
device pica {}
|
||||
attach pica at mainbus # optional
|
||||
file arch/arc/pica/picabus.c pica
|
||||
|
||||
# Real time clock, must have one..
|
||||
device clock
|
||||
attach clock at pica
|
||||
file arch/pica/pica/clock.c clock
|
||||
file arch/pica/pica/clock_mc.c clock
|
||||
#
|
||||
# ALGOR bus autoconfiguration devices
|
||||
#
|
||||
device algor {}
|
||||
attach algor at mainbus # optional
|
||||
file arch/arc/algor/algorbus.c algor
|
||||
|
||||
# Ethernet chip
|
||||
device sn: ifnet, ether, arp
|
||||
attach sn at pica
|
||||
file arch/pica/dev/if_sn.c sn needs-count
|
||||
#
|
||||
# ISA Bus bridge
|
||||
#
|
||||
device isabr {} : isabus
|
||||
attach isabr at mainbus # optional
|
||||
file arch/arc/isa/isabus.c isabr
|
||||
|
||||
#
|
||||
# PCI Bus bridge
|
||||
#
|
||||
device pbcpcibr {} : pcibus
|
||||
attach pbcpcibr at mainbus # optional
|
||||
file arch/arc/pci/pbcpcibus.c pbcpcibr
|
||||
|
||||
# Ethernet chip on PICA bus
|
||||
device sn: ifnet, ether, arp
|
||||
attach sn at pica
|
||||
file arch/arc/dev/if_sn.c sn needs-count
|
||||
|
||||
# Use machine independent SCSI driver routines
|
||||
include "dev/scsipi/files.scsipi"
|
||||
major {sd = 0}
|
||||
major {cd = 3}
|
||||
|
||||
# Machine dependent SCSI interface driver
|
||||
device asc: scsi
|
||||
attach asc at pica
|
||||
file arch/pica/dev/asc.c asc needs-count
|
||||
# Symbios 53C94 SCSI interface driver on PICA bus
|
||||
device asc: scsi
|
||||
attach asc at pica
|
||||
file arch/arc/dev/asc.c asc needs-count
|
||||
|
||||
# NS16450/16550 Serial line driver
|
||||
device pcom: tty
|
||||
attach pcom at pica
|
||||
file arch/pica/dev/com.c pcom needs-count
|
||||
|
||||
# Parallel printer port driver
|
||||
device lpt
|
||||
attach lpt at pica
|
||||
file arch/pica/dev/lpt.c lpt needs-count
|
||||
|
||||
# Console driver on PC-style graphics
|
||||
device pc: tty
|
||||
attach pc at pica
|
||||
device pms
|
||||
attach pms at pica
|
||||
file arch/pica/dev/pccons.c pc | pms needs-count
|
||||
|
||||
# PS2 type mouse driver.
|
||||
|
||||
# Floppy disk controller
|
||||
# Floppy disk controller on PICA bus
|
||||
device fdc {drive = -1}
|
||||
attach fdc at pica
|
||||
device fd: disk
|
||||
attach fd at fdc
|
||||
file arch/pica/dev/fd.c fdc needs-flag
|
||||
file arch/arc/dev/fd.c fdc needs-flag
|
||||
major {fd = 7}
|
||||
|
||||
# Required files
|
||||
|
||||
file arch/pica/isa/isa.c
|
||||
|
||||
file arch/pica/pica/autoconf.c
|
||||
file arch/pica/pica/conf.c
|
||||
file arch/pica/pica/disksubr.c
|
||||
file arch/pica/dev/dma.c
|
||||
file arch/pica/pica/machdep.c
|
||||
file arch/pica/pica/mainbus.c
|
||||
#file arch/pica/pica/minidebug.c
|
||||
file arch/pica/pica/pica_trap.c
|
||||
#
|
||||
# This is a dummy - don't try to use it:
|
||||
# Stock ISA bus support
|
||||
#
|
||||
define pcmcia {} # XXX dummy decl...
|
||||
|
||||
include "dev/pci/files.pci"
|
||||
include "dev/isa/files.isa"
|
||||
|
||||
# Real time clock, must have one..
|
||||
device aclock
|
||||
attach aclock at pica with aclock_pica
|
||||
attach aclock at isa with aclock_isa
|
||||
attach aclock at algor with aclock_algor
|
||||
file arch/arc/arc/clock.c aclock & (aclock_isa | aclock_pica | aclock_algor) needs-flag
|
||||
file arch/arc/arc/clock_mc.c aclock & (aclock_isa | aclock_pica | aclock_algor) needs-flag
|
||||
|
||||
# Console driver on PC-style graphics
|
||||
device pc: tty
|
||||
attach pc at pica with pc_pica
|
||||
attach pc at isa with pc_isa
|
||||
device opms: tty
|
||||
attach opms at pica
|
||||
file arch/arc/dev/pccons.c pc & (pc_pica | pc_isa) needs-flag
|
||||
|
||||
# BusLogic BT-445C VLB SCSI Controller. Special on TYNE local bus.
|
||||
device btl: scsi
|
||||
attach btl at isa
|
||||
file arch/arc/dti/btl.c btl needs-count
|
||||
|
||||
# NS16450/16550 Serial line driver
|
||||
attach com at pica with com_pica
|
||||
attach com at algor with com_algor
|
||||
file arch/arc/dev/com_lbus.c com & (com_pica | com_algor)
|
||||
|
||||
|
||||
# National Semiconductor DS8390/WD83C690-based boards
|
||||
# (WD/SMC 80x3 family, SMC Ultra [8216], 3Com 3C503, NE[12]000, and clones)
|
||||
# XXX conflicts with other ports; can't be in files.isa
|
||||
## XXX: should fix conflict with files.isa
|
||||
#device ed: ether, ifnet
|
||||
#attach ed at isa with ed_isa
|
||||
#attach ed at pcmcia with ed_pcmcia
|
||||
#file dev/isa/if_ed.c ed & (ed_isa | ed_pcmcia) needs-flag
|
||||
|
||||
# Parallel printer port driver
|
||||
attach lpt at pica with lpt_pica
|
||||
attach lpt at algor with lpt_algor
|
||||
file arch/arc/dev/lpt_lbus.c lpt & (lpt_pica | lpt_algor)
|
||||
|
||||
|
||||
#
|
||||
# PCI Bus support
|
||||
#
|
||||
|
||||
# PCI VGA display driver
|
||||
device pcivga: tty
|
||||
attach pcivga at pci
|
||||
file arch/arc/pci/pci_vga.c pcivga
|
||||
|
||||
#
|
||||
# Specials.
|
||||
#
|
||||
# memory disk for boot tape
|
||||
file arch/arc/dev/md_root.c memory_disk_hooks
|
||||
major {md = 8}
|
||||
|
||||
#
|
||||
# Common files
|
||||
#
|
||||
|
||||
file dev/cons.c
|
||||
file dev/cninit.c
|
||||
#file dev/cninit.c
|
||||
#file netinet/in_cksum.c
|
||||
#file netns/ns_cksum.c ns
|
||||
|
||||
# Ultrix binary compatibility (COMPAT_ULTRIX)
|
||||
include "compat/ultrix/files.ultrix"
|
||||
|
@ -1,7 +1,7 @@
|
||||
# $NetBSD: std.pmax,v 1.0 1995/04/28 03:10:41 jonathan Exp
|
||||
# standard pica info
|
||||
# $NetBSD: std.arc,v 1.8 2000/01/23 21:01:53 soda Exp $
|
||||
# standard arc info
|
||||
|
||||
machine pica mips
|
||||
machine arc mips
|
||||
|
||||
prefix ../gnu/sys
|
||||
cinclude "conf/files.softdep"
|
||||
@ -11,7 +11,8 @@ mainbus0 at root
|
||||
cpu* at mainbus0
|
||||
|
||||
# set CPU architecture level for kernel target
|
||||
options MIPS3
|
||||
#options MIPS1 # R2000/R3000 support
|
||||
options MIPS3 # R4000/R4400 support
|
||||
|
||||
# Standard (non-optional) system "options"
|
||||
options SWAPPAGER # swap pager (anonymous and swap space)
|
||||
@ -21,3 +22,9 @@ options DEVPAGER # device pager (mapped devices)
|
||||
# Standard exec-package options
|
||||
options EXEC_ELF32 # native exec format
|
||||
options EXEC_SCRIPT # may be unsafe
|
||||
|
||||
options MIPS3_L2CACHE_PRESENT # may have L2 cache
|
||||
options MIPS3_L2CACHE_ABSENT # may not have L2 cache
|
||||
|
||||
options __NO_SOFT_SERIAL_INTERRUPT # for "com" driver
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
/* $NetBSD: asc.c,v 1.19 2000/01/23 20:08:06 soda Exp $ */
|
||||
/* $NetBSD: asc.c,v 1.20 2000/01/23 21:01:53 soda Exp $ */
|
||||
/* $OpenBSD: asc.c,v 1.5 1997/04/19 17:19:50 pefo Exp $ */
|
||||
/* NetBSD: asc.c,v 1.10 1994/12/05 19:11:12 dean Exp */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -130,21 +132,23 @@
|
||||
#include <sys/conf.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/device.h>
|
||||
#include <vm/vm.h>
|
||||
|
||||
#include <dev/scsipi/scsi_all.h>
|
||||
#include <dev/scsipi/scsipi_all.h>
|
||||
#include <dev/scsipi/scsiconf.h>
|
||||
|
||||
#include <mips/locore.h> /* for mips3_HitFlushDCache() */
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/autoconf.h>
|
||||
#include <machine/bus.h>
|
||||
|
||||
#include <pica/dev/dma.h>
|
||||
#include <pica/dev/scsi.h>
|
||||
#include <pica/dev/ascreg.h>
|
||||
#include <arc/dev/dma.h>
|
||||
#include <arc/dev/scsi.h>
|
||||
#include <arc/dev/ascreg.h>
|
||||
|
||||
#include <pica/pica/pica.h>
|
||||
#include <pica/pica/picatype.h>
|
||||
#include <arc/pica/pica.h>
|
||||
#include <arc/arc/arctype.h>
|
||||
|
||||
|
||||
#define readback(a) { register int foo; foo = (a); }
|
||||
@ -191,8 +195,9 @@ int asc_to_scsi_period[] = {
|
||||
/*
|
||||
* Internal forward declarations.
|
||||
*/
|
||||
static void asc_reset();
|
||||
static void asc_startcmd();
|
||||
struct asc_softc;
|
||||
static void asc_reset __P((struct asc_softc *, asc_regmap_t *));
|
||||
static void asc_startcmd __P((struct asc_softc *, int));
|
||||
|
||||
#ifdef DEBUG
|
||||
int asc_debug = 1;
|
||||
@ -226,7 +231,8 @@ struct asc_log {
|
||||
*/
|
||||
typedef struct script {
|
||||
int condition; /* expected state at interrupt time */
|
||||
int (*action)(); /* extra operations */
|
||||
int (*action)(struct asc_softc *, int, int, int);
|
||||
/* extra operations */
|
||||
int command; /* command to the chip */
|
||||
struct script *next; /* index into asc_scripts for next state */
|
||||
} script_t;
|
||||
@ -234,22 +240,38 @@ typedef struct script {
|
||||
/* Matching on the condition value */
|
||||
#define SCRIPT_MATCH(ir, csr) ((ir) | (((csr) & 0x67) << 8))
|
||||
|
||||
|
||||
/* forward decls of script actions */
|
||||
static int script_nop(); /* when nothing needed */
|
||||
static int asc_end(); /* all come to an end */
|
||||
static int asc_get_status(); /* get status from target */
|
||||
static int asc_dma_in(); /* start reading data from target */
|
||||
static int asc_last_dma_in(); /* cleanup after all data is read */
|
||||
static int asc_resume_in(); /* resume data in after a message */
|
||||
static int asc_resume_dma_in(); /* resume DMA after a disconnect */
|
||||
static int asc_dma_out(); /* send data to target via dma */
|
||||
static int asc_last_dma_out(); /* cleanup after all data is written */
|
||||
static int asc_resume_out(); /* resume data out after a message */
|
||||
static int asc_resume_dma_out(); /* resume DMA after a disconnect */
|
||||
static int asc_sendsync(); /* negotiate sync xfer */
|
||||
static int asc_replysync(); /* negotiate sync xfer */
|
||||
static int asc_msg_in(); /* process a message byte */
|
||||
static int asc_disconnect(); /* process an expected disconnect */
|
||||
/* when nothing needed */
|
||||
static int script_nop __P((struct asc_softc *, int, int, int));
|
||||
/* all come to an end */
|
||||
static int asc_end __P((struct asc_softc *, int, int, int));
|
||||
/* get status from target */
|
||||
static int asc_get_status __P((struct asc_softc *, int, int, int));
|
||||
/* start reading data from target */
|
||||
static int asc_dma_in __P((struct asc_softc *, int, int, int));
|
||||
/* cleanup after all data is read */
|
||||
static int asc_last_dma_in __P((struct asc_softc *, int, int, int));
|
||||
/* resume data in after a message */
|
||||
static int asc_resume_in __P((struct asc_softc *, int, int, int));
|
||||
/* resume DMA after a disconnect */
|
||||
static int asc_resume_dma_in __P((struct asc_softc *, int, int, int));
|
||||
/* send data to target via dma */
|
||||
static int asc_dma_out __P((struct asc_softc *, int, int, int));
|
||||
/* cleanup after all data is written */
|
||||
static int asc_last_dma_out __P((struct asc_softc *, int, int, int));
|
||||
/* resume data out after a message */
|
||||
static int asc_resume_out __P((struct asc_softc *, int, int, int));
|
||||
/* resume DMA after a disconnect */
|
||||
static int asc_resume_dma_out __P((struct asc_softc *, int, int, int));
|
||||
/* negotiate sync xfer */
|
||||
static int asc_sendsync __P((struct asc_softc *, int, int, int));
|
||||
/* negotiate sync xfer */
|
||||
static int asc_replysync __P((struct asc_softc *, int, int, int));
|
||||
/* process a message byte */
|
||||
static int asc_msg_in __P((struct asc_softc *, int, int, int));
|
||||
/* process an expected disconnect */
|
||||
static int asc_disconnect __P((struct asc_softc *, int, int, int));
|
||||
|
||||
/* Define the index into asc_scripts for various state transitions */
|
||||
#define SCRIPT_DATA_IN 0
|
||||
@ -426,7 +448,8 @@ struct asc_softc {
|
||||
int ccf; /* CCF, whatever that really is? */
|
||||
int timeout_250; /* 250ms timeout */
|
||||
int tb_ticks; /* 4ns. ticks/tb channel ticks */
|
||||
struct scsipi_link sc_link; /* scsi link struct */
|
||||
int is24bit; /* if 53CF94/96-2, 24bit address */
|
||||
struct scsipi_link sc_link; /* scsipi link struct */
|
||||
struct scsipi_adapter sc_adapter;
|
||||
};
|
||||
|
||||
@ -440,7 +463,7 @@ typedef struct asc_softc *asc_softc_t;
|
||||
/*
|
||||
* Autoconfiguration data for config.
|
||||
*/
|
||||
int ascmatch __P((struct device *, void *, void *));
|
||||
int ascmatch __P((struct device *, struct cfdata *, void *));
|
||||
void ascattach __P((struct device *, struct device *, void *));
|
||||
|
||||
int asc_doprobe __P((void *, int, int, struct device *));
|
||||
@ -462,9 +485,9 @@ struct scsipi_device asc_dev = {
|
||||
/*XXX*/ NULL, /* Use default 'done' routine */
|
||||
};
|
||||
|
||||
static int asc_probe();
|
||||
static void asc_start();
|
||||
static int asc_intr();
|
||||
static int asc_intr __P((void *));
|
||||
static int asc_poll __P((struct asc_softc *, int));
|
||||
static void asc_DumpLog __P((char *));
|
||||
|
||||
/*
|
||||
* Match driver based on name
|
||||
@ -472,10 +495,9 @@ static int asc_intr();
|
||||
int
|
||||
ascmatch(parent, match, aux)
|
||||
struct device *parent;
|
||||
void *match;
|
||||
struct cfdata *match;
|
||||
void *aux;
|
||||
{
|
||||
struct cfdata *cf = match;
|
||||
struct confargs *ca = aux;
|
||||
|
||||
if(!BUS_MATCHNAME(ca, "asc"))
|
||||
@ -507,15 +529,26 @@ ascattach(parent, self, aux)
|
||||
*/
|
||||
switch (cputype) {
|
||||
case ACER_PICA_61:
|
||||
case MAGNUM:
|
||||
bufsiz = 63 * 1024; /*XXX check if code handles 0 as 64k */
|
||||
asc->dma = &asc->__dma;
|
||||
asc_dma_init(asc->dma);
|
||||
break;
|
||||
default:
|
||||
bufsiz = 64 * 1024;
|
||||
};
|
||||
/*
|
||||
* Now for timing. The pica has a 25Mhz
|
||||
* Now for timing. The pica has a 25Mhz, NEC RISCstation has a 40MHz.
|
||||
*/
|
||||
switch (cputype) {
|
||||
case MAGNUM:
|
||||
asc->min_period = ASC_MIN_PERIOD40;
|
||||
asc->max_period = ASC_MAX_PERIOD40;
|
||||
asc->ccf = ASC_CCF(40);
|
||||
asc->timeout_250 = ASC_TIMEOUT_250(40,
|
||||
asc->ccf != 0 ? asc->ccf : 8);
|
||||
asc->tb_ticks = 6; /* 6.25 */
|
||||
break;
|
||||
case ACER_PICA_61:
|
||||
asc->min_period = ASC_MIN_PERIOD25;
|
||||
asc->max_period = ASC_MAX_PERIOD25;
|
||||
@ -546,6 +579,17 @@ ascattach(parent, self, aux)
|
||||
asc->sc_id = regs->asc_cnfg1 & ASC_CNFG1_MY_BUS_ID;
|
||||
asc->myidmask = ~(1 << asc->sc_id);
|
||||
|
||||
/* identify 53CF9x-2 or not */
|
||||
regs->asc_cmd = ASC_CMD_RESET;
|
||||
wbflush(); DELAY(25);
|
||||
regs->asc_cmd = ASC_CMD_DMA | ASC_CMD_NOP;
|
||||
wbflush(); DELAY(25);
|
||||
regs->asc_cnfg2 = ASC_CNFG2_FE;
|
||||
wbflush(); DELAY(25);
|
||||
regs->asc_cmd = ASC_CMD_DMA | ASC_CMD_NOP;
|
||||
wbflush(); DELAY(25);
|
||||
asc->is24bit = regs->asc_id == ASC_ID_53CF94;
|
||||
|
||||
asc_reset(asc, regs);
|
||||
|
||||
/*
|
||||
@ -576,7 +620,8 @@ ascattach(parent, self, aux)
|
||||
*/
|
||||
BUS_INTR_ESTABLISH(ca, asc_intr, (void *)asc);
|
||||
|
||||
printf(": NCR53C94, target %d\n", id);
|
||||
printf(": %s, target %d\n", asc->is24bit ? "NCR53CF9X-2" : "NCR53C94",
|
||||
id);
|
||||
|
||||
/*
|
||||
* Fill in the adapter.
|
||||
@ -610,6 +655,7 @@ void
|
||||
asc_minphys(bp)
|
||||
struct buf *bp;
|
||||
{
|
||||
minphys(bp);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -623,17 +669,15 @@ asc_scsi_cmd(xs)
|
||||
{
|
||||
struct scsipi_link *sc_link = xs->sc_link;
|
||||
struct asc_softc *asc = sc_link->adapter_softc;
|
||||
State *state = &asc->st[sc_link->scsipi_scsi.target];
|
||||
|
||||
int flags, s;
|
||||
|
||||
flags = xs->flags;
|
||||
int dontqueue = xs->xs_control & XS_CTL_POLL;
|
||||
int s;
|
||||
|
||||
/*
|
||||
* Flush caches for any data buffer
|
||||
*/
|
||||
if(xs->datalen != 0) {
|
||||
mips3_HitFlushDCache(xs->data, xs->datalen);
|
||||
mips3_HitFlushDCache((vm_offset_t)xs->data, xs->datalen);
|
||||
}
|
||||
/*
|
||||
* The hack on the next few lines are to avoid buffers
|
||||
@ -671,7 +715,7 @@ asc_scsi_cmd(xs)
|
||||
/*
|
||||
* If in startup, interrupts not usable yet.
|
||||
*/
|
||||
if(flags & SCSI_POLL) {
|
||||
if(dontqueue) {
|
||||
return(asc_poll(asc,sc_link->scsipi_scsi.target));
|
||||
}
|
||||
splx(s);
|
||||
@ -690,7 +734,7 @@ asc_poll(asc, target)
|
||||
if(asc->regs->asc_status &ASC_CSR_INT) {
|
||||
asc_intr(asc);
|
||||
}
|
||||
if(scsicmd->flags & ITSDONE)
|
||||
if(scsicmd->xs_status & XS_STS_DONE)
|
||||
break;
|
||||
DELAY(5);
|
||||
count--;
|
||||
@ -728,9 +772,17 @@ asc_reset(asc, regs)
|
||||
regs->asc_cnfg1 = asc->sc_id | ASC_CNFG1_P_CHECK;
|
||||
/* include ASC_CNFG2_SCSI2 if you want to allow SCSI II commands */
|
||||
regs->asc_cnfg2 = /* ASC_CNFG2_RFB | ASC_CNFG2_SCSI2 | */ ASC_CNFG2_EPL;
|
||||
regs->asc_cnfg3 = 0;
|
||||
switch (cputype) {
|
||||
case MAGNUM: /* NEC RISCstation */
|
||||
/* only if EPL is FE (Feature Enable bit for 53CF94) */
|
||||
regs->asc_cnfg3 = ASC_CNFG3_FCLK; /* clock 40MHz */
|
||||
break;
|
||||
default:
|
||||
regs->asc_cnfg3 = 0;
|
||||
break;
|
||||
}
|
||||
/* zero anything else */
|
||||
ASC_TC_PUT(regs, 0);
|
||||
ASC_TC_PUT(regs, 0, asc->is24bit);
|
||||
regs->asc_syn_p = asc->min_period;
|
||||
regs->asc_syn_o = 0; /* async for now */
|
||||
wbflush();
|
||||
@ -804,17 +856,17 @@ asc_startcmd(asc, target)
|
||||
asc->script = &asc_scripts[SCRIPT_DATA_IN];
|
||||
state->flags |= DMA_IN;
|
||||
}
|
||||
else if (scsicmd->flags & SCSI_DATA_OUT) {
|
||||
else if (scsicmd->xs_control & XS_CTL_DATA_OUT) {
|
||||
asc->script = &asc_scripts[SCRIPT_DATA_OUT];
|
||||
state->flags |= DMA_OUT;
|
||||
}
|
||||
else if (scsicmd->flags & SCSI_DATA_IN) {
|
||||
else if (scsicmd->xs_control & XS_CTL_DATA_IN) {
|
||||
asc->script = &asc_scripts[SCRIPT_DATA_IN];
|
||||
state->flags |= DMA_IN;
|
||||
}
|
||||
else if (state->buflen == 0) {
|
||||
/* check for sync negotiation */
|
||||
if ((scsicmd->flags & /* SCSICMD_USE_SYNC */ 0) &&
|
||||
if ((scsicmd->xs_status & /* SCSICMD_USE_SYNC */ 0) &&
|
||||
!(state->flags & DID_SYNC)) {
|
||||
asc->script = &asc_scripts[SCRIPT_TRY_SYNC];
|
||||
state->flags |= TRY_SYNC;
|
||||
@ -843,12 +895,12 @@ asc_startcmd(asc, target)
|
||||
|
||||
/* preload the FIFO with the message and command to be sent */
|
||||
regs->asc_fifo = SCSI_DIS_REC_IDENTIFY |
|
||||
(scsicmd->sc_link->scsipi_scsi.lun & 0x07);
|
||||
(scsicmd->sc_link->scsipi_scsi.lun & 0x07);
|
||||
|
||||
for( i = 0; i < len; i++ ) {
|
||||
regs->asc_fifo = ((caddr_t)&state->cmd)[i];
|
||||
}
|
||||
ASC_TC_PUT(regs, 0);
|
||||
ASC_TC_PUT(regs, 0, asc->is24bit);
|
||||
readback(regs->asc_cmd);
|
||||
regs->asc_cmd = ASC_CMD_DMA;
|
||||
readback(regs->asc_cmd);
|
||||
@ -893,7 +945,7 @@ asc_intr(sc)
|
||||
ss = regs->asc_ss;
|
||||
|
||||
if ((status & ASC_CSR_INT) == 0) /* Make shure it's a real interrupt */
|
||||
return;
|
||||
return(0);
|
||||
|
||||
ir = regs->asc_intr; /* this resets the previous two */
|
||||
scpt = asc->script;
|
||||
@ -1013,8 +1065,6 @@ printf("asc_intr: fifo flush %d len %d fifo %x\n", fifo, len, regs->asc_fifo);
|
||||
len += fifo; /* Bytes dma'ed but not sent */
|
||||
}
|
||||
else if (state->flags & DMA_IN) {
|
||||
u_char *cp;
|
||||
|
||||
printf("asc_intr: IN: dmalen %d len %d fifo %d\n",
|
||||
state->dmalen, len, fifo); /* XXX */
|
||||
}
|
||||
@ -1026,7 +1076,7 @@ printf("asc_intr: fifo flush %d len %d fifo %x\n", fifo, len, regs->asc_fifo);
|
||||
/* save number of bytes still to be sent or received */
|
||||
state->dmaresid = len;
|
||||
state->flags &= ~DMA_IN_PROGRESS;
|
||||
ASC_TC_PUT(regs, 0);
|
||||
ASC_TC_PUT(regs, 0, asc->is24bit);
|
||||
#ifdef DEBUG
|
||||
if (asc_logp == asc_log)
|
||||
asc_log[NLOG - 1].resid = len;
|
||||
@ -1141,7 +1191,7 @@ printf("asc_intr: fifo flush %d len %d fifo %x\n", fifo, len, regs->asc_fifo);
|
||||
asc->st[i].flags = 0;
|
||||
}
|
||||
asc->target = -1;
|
||||
return;
|
||||
return(1);
|
||||
}
|
||||
|
||||
/* check for command errors */
|
||||
@ -1181,7 +1231,7 @@ printf("asc_intr: fifo flush %d len %d fifo %x\n", fifo, len, regs->asc_fifo);
|
||||
}
|
||||
asc->cmd[asc->target]->error = XS_DRIVER_STUFFUP;
|
||||
asc_end(asc, status, ss, ir);
|
||||
return;
|
||||
return(1);
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
|
||||
@ -1202,7 +1252,7 @@ printf("asc_intr: fifo flush %d len %d fifo %x\n", fifo, len, regs->asc_fifo);
|
||||
state->flags |= DISCONN;
|
||||
regs->asc_cmd = ASC_CMD_ENABLE_SEL;
|
||||
readback(regs->asc_cmd);
|
||||
return;
|
||||
return(1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1256,17 +1306,14 @@ done:
|
||||
* dispatcher (which we are returning to) will catch it
|
||||
* before returning to the interrupted code.
|
||||
*/
|
||||
return;
|
||||
return(1);
|
||||
|
||||
abort:
|
||||
#ifdef DEBUG
|
||||
asc_DumpLog("asc_intr");
|
||||
#endif
|
||||
#if 0
|
||||
panic("asc_intr");
|
||||
#else
|
||||
cpu_reboot(4, NULL); /* XXX */
|
||||
#endif
|
||||
return(1);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1277,8 +1324,8 @@ abort:
|
||||
/* ARGSUSED */
|
||||
static int
|
||||
script_nop(asc, status, ss, ir)
|
||||
register asc_softc_t asc;
|
||||
register int status, ss, ir;
|
||||
asc_softc_t asc;
|
||||
int status, ss, ir;
|
||||
{
|
||||
return (1);
|
||||
}
|
||||
@ -1335,8 +1382,8 @@ asc_get_status(asc, status, ss, ir)
|
||||
/* ARGSUSED */
|
||||
static int
|
||||
asc_end(asc, status, ss, ir)
|
||||
register asc_softc_t asc;
|
||||
register int status, ss, ir;
|
||||
asc_softc_t asc;
|
||||
int status, ss, ir;
|
||||
{
|
||||
struct scsipi_xfer *scsicmd;
|
||||
struct scsipi_link *sc_link;
|
||||
@ -1424,7 +1471,7 @@ asc_end(asc, status, ss, ir)
|
||||
}
|
||||
|
||||
/* signal device driver that the command is done */
|
||||
scsicmd->flags |= ITSDONE;
|
||||
scsicmd->xs_status |= XS_STS_DONE;
|
||||
scsipi_done(scsicmd);
|
||||
|
||||
return (0);
|
||||
@ -1466,7 +1513,7 @@ asc_dma_in(asc, status, ss, ir)
|
||||
len = state->dmaBufSize;
|
||||
state->dmalen = len;
|
||||
DMA_START(asc->dma, (caddr_t)state->buf, len, DMA_FROM_DEV);
|
||||
ASC_TC_PUT(regs, len);
|
||||
ASC_TC_PUT(regs, len, asc->is24bit);
|
||||
#ifdef DEBUG
|
||||
if (asc_debug > 2)
|
||||
printf("asc_dma_in: buflen %d, len %d\n", state->buflen, len);
|
||||
@ -1541,7 +1588,7 @@ asc_resume_in(asc, status, ss, ir)
|
||||
asc_logp[-1].resid = len;
|
||||
#endif
|
||||
DMA_START(asc->dma, (caddr_t)state->buf, len, DMA_FROM_DEV);
|
||||
ASC_TC_PUT(regs, len);
|
||||
ASC_TC_PUT(regs, len, asc->is24bit);
|
||||
#ifdef DEBUG
|
||||
if (asc_debug > 2)
|
||||
printf("asc_resume_in: buflen %d, len %d\n", state->buflen,
|
||||
@ -1579,7 +1626,7 @@ asc_resume_dma_in(asc, status, ss, ir)
|
||||
/*XXX Need to flush cache ? */
|
||||
}
|
||||
DMA_START(asc->dma, (caddr_t)state->buf + off, len, DMA_FROM_DEV);
|
||||
ASC_TC_PUT(regs, len);
|
||||
ASC_TC_PUT(regs, len, asc->is24bit);
|
||||
#ifdef DEBUG
|
||||
if (asc_debug > 2)
|
||||
printf("asc_resume_dma_in: buflen %d dmalen %d len %d off %d\n",
|
||||
@ -1632,7 +1679,7 @@ asc_dma_out(asc, status, ss, ir)
|
||||
len = state->dmaBufSize;
|
||||
state->dmalen = len;
|
||||
DMA_START(asc->dma, (caddr_t)state->buf, len, DMA_TO_DEV);
|
||||
ASC_TC_PUT(regs, len);
|
||||
ASC_TC_PUT(regs, len, asc->is24bit);
|
||||
#ifdef DEBUG
|
||||
if (asc_debug > 2)
|
||||
printf("asc_dma_out: buflen %d, len %d\n", state->buflen, len);
|
||||
@ -1705,7 +1752,7 @@ asc_resume_out(asc, status, ss, ir)
|
||||
asc_logp[-1].resid = len;
|
||||
#endif
|
||||
DMA_START(asc->dma, (caddr_t)state->buf, len, DMA_TO_DEV);
|
||||
ASC_TC_PUT(regs, len);
|
||||
ASC_TC_PUT(regs, len, asc->is24bit);
|
||||
#ifdef DEBUG
|
||||
if (asc_debug > 2)
|
||||
printf("asc_resume_out: buflen %d, len %d\n", state->buflen,
|
||||
@ -1745,7 +1792,7 @@ asc_resume_dma_out(asc, status, ss, ir)
|
||||
len--;
|
||||
}
|
||||
DMA_START(asc->dma, (caddr_t)state->buf + off, len, DMA_TO_DEV);
|
||||
ASC_TC_PUT(regs, len);
|
||||
ASC_TC_PUT(regs, len, asc->is24bit);
|
||||
#ifdef DEBUG
|
||||
if (asc_debug > 2)
|
||||
printf("asc_resume_dma_out: buflen %d dmalen %d len %d off %d\n",
|
||||
@ -2017,10 +2064,10 @@ done:
|
||||
/* ARGSUSED */
|
||||
static int
|
||||
asc_disconnect(asc, status, ss, ir)
|
||||
register asc_softc_t asc;
|
||||
register int status, ss, ir;
|
||||
asc_softc_t asc;
|
||||
int status, ss, ir;
|
||||
{
|
||||
register State *state = &asc->st[asc->target];
|
||||
State *state = &asc->st[asc->target];
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
if (!(state->flags & DISCONN)) {
|
||||
@ -2037,6 +2084,7 @@ asc_disconnect(asc, status, ss, ir)
|
||||
/*
|
||||
* Dump the log buffer.
|
||||
*/
|
||||
static void
|
||||
asc_DumpLog(str)
|
||||
char *str;
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
/* $NetBSD: ascreg.h,v 1.5 2000/01/23 20:08:07 soda Exp $ */
|
||||
/* $NetBSD: ascreg.h,v 1.6 2000/01/23 21:01:53 soda Exp $ */
|
||||
/* $OpenBSD: ascreg.h,v 1.1.1.1 1996/06/24 09:07:19 pefo Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -136,6 +137,9 @@ typedef volatile struct {
|
||||
u_char asc_cnfg2; /* rw: Configuration 2 */
|
||||
u_char asc_cnfg3; /* rw: Configuration 3 */
|
||||
u_char asc_res_fifo; /* w: Reserve FIFO byte */
|
||||
#define asc_cnfg4 asc_res_fifo /* rw: Configuration 4 (53CF94) */
|
||||
u_char asc_tc_high; /* w: Transfer Counter High: 24bit (53CF94) */
|
||||
#define asc_id asc_tc_high /* r: ID Register */
|
||||
} asc_regmap_t;
|
||||
|
||||
/*
|
||||
@ -148,9 +152,10 @@ typedef volatile struct {
|
||||
|
||||
#define ASC_TC_GET(ptr, val) \
|
||||
val = (ptr)->asc_tc_lsb | ((ptr)->asc_tc_msb << 8)
|
||||
#define ASC_TC_PUT(ptr, val) \
|
||||
#define ASC_TC_PUT(ptr, val, is24bit) \
|
||||
(ptr)->asc_tc_lsb = (val); \
|
||||
(ptr)->asc_tc_msb = (val) >> 8; \
|
||||
if (is24bit) (ptr)->asc_tc_high = 0; \
|
||||
(ptr)->asc_cmd = ASC_CMD_NOP | ASC_CMD_DMA;
|
||||
|
||||
/*
|
||||
@ -286,7 +291,7 @@ typedef volatile struct {
|
||||
* CCF register
|
||||
*/
|
||||
|
||||
#define ASC_CCF(clk) ((((clk) - 1) / 5) + 1)
|
||||
#define ASC_CCF(clk) (((((clk) - 1) / 5) + 1) & 0x7)
|
||||
|
||||
/*
|
||||
* Test register
|
||||
@ -303,6 +308,7 @@ typedef volatile struct {
|
||||
|
||||
#define ASC_CNFG2_RFB 0x80
|
||||
#define ASC_CNFG2_EPL 0x40
|
||||
#define ASC_CNFG2_FE 0x40 /* 53CF94: Features Enable */
|
||||
#define ASC_CNFG2_EBC 0x20
|
||||
#define ASC_CNFG2_DREQ_HIZ 0x10
|
||||
#define ASC_CNFG2_SCSI2 0x08
|
||||
@ -314,9 +320,19 @@ typedef volatile struct {
|
||||
* Configuration 3
|
||||
*/
|
||||
|
||||
#define ASC_CNFG3_RESERVED 0xf8
|
||||
#define ASC_CNFG3_RESERVED 0xf8 /* 53C94 */
|
||||
#define ASC_CNFG3_IMRC 0x40 /* 53CF94: ID Message Reserved Check */
|
||||
#define ASC_CNFG3_QTE 0x40 /* 53CF94: Queue Tag Enable */
|
||||
#define ASC_CNFG3_CDB10 0x20 /* 53CF94: 10byte Group2 CDB */
|
||||
#define ASC_CNFG3_FSCSI 0x10 /* 53CF94: Fast SCSI */
|
||||
#define ASC_CNFG3_FCLK 0x08 /* 53CF94: Fast CLK (clock > 25MHz) */
|
||||
#define ASC_CNFG3_SRB 0x04
|
||||
#define ASC_CNFG3_ALT_DMA 0x02
|
||||
#define ASC_CNFG3_T8 0x01
|
||||
|
||||
/*
|
||||
* chip identifier
|
||||
*/
|
||||
#define ASC_ID_53CF94 0xa2 /* 53CF94-2 or 53CF96-2 */
|
||||
|
||||
#define ST_MASK 0x3e
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,5 @@
|
||||
/* $NetBSD: dma.c,v 1.10 2000/01/23 20:08:08 soda Exp $ */
|
||||
/* $NetBSD: dma.c,v 1.11 2000/01/23 21:01:53 soda Exp $ */
|
||||
/* $OpenBSD: dma.c,v 1.4 1997/04/19 17:19:51 pefo Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -52,27 +53,33 @@
|
||||
#include <vm/vm_kern.h>
|
||||
#include <vm/vm_page.h>
|
||||
|
||||
#include <mips/locore.h>
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/cpuregs.h>
|
||||
#include <machine/autoconf.h>
|
||||
#include <machine/bus.h>
|
||||
#include <machine/pte.h>
|
||||
#include <machine/pio.h>
|
||||
|
||||
#include <dev/scsipi/scsi_all.h>
|
||||
#include <dev/scsipi/scsipi_all.h>
|
||||
#include <dev/scsipi/scsiconf.h>
|
||||
|
||||
#include <pica/pica/pica.h>
|
||||
#include <pica/dev/dma.h>
|
||||
#include <arc/pica/pica.h>
|
||||
#include <arc/dev/dma.h>
|
||||
|
||||
void picaDmaReset __P((dma_softc_t *sc));
|
||||
void picaDmaEnd __P((dma_softc_t *sc));
|
||||
void picaDmaNull __P((dma_softc_t *sc));
|
||||
|
||||
|
||||
extern vm_map_t phys_map;
|
||||
|
||||
#define dma_pte_to_pa(x) (((x) - first_dma_pte) * PICA_DMA_PAGE_SIZE)
|
||||
#define dma_pte_to_pa(x) (((x) - first_dma_pte) * R4030_DMA_PAGE_SIZE)
|
||||
|
||||
dma_pte_t *free_dma_pte; /* Pointer to free dma pte list */
|
||||
dma_pte_t *first_dma_pte; /* Pointer to first dma pte */
|
||||
|
||||
|
||||
/*
|
||||
* Initialize the dma mapping register area and pool.
|
||||
*/
|
||||
@ -81,7 +88,7 @@ picaDmaInit()
|
||||
{
|
||||
int map = PICA_TL_BASE;
|
||||
|
||||
MachFlushCache(); /* Make shure no map entries are cached */
|
||||
mips3_FlushCache(); /* Make shure no map entries are cached */
|
||||
|
||||
bzero((char *)map, PICA_TL_SIZE);
|
||||
free_dma_pte = (dma_pte_t *)map;
|
||||
@ -89,9 +96,9 @@ picaDmaInit()
|
||||
free_dma_pte->queue.next = NULL;
|
||||
free_dma_pte->queue.size = PICA_TL_SIZE / sizeof(dma_pte_t);
|
||||
|
||||
out32(PICA_SYS_TL_BASE, MIPS_KSEG1_TO_PHYS(map));
|
||||
out32(PICA_SYS_TL_LIMIT, PICA_TL_SIZE);
|
||||
out32(PICA_SYS_TL_IVALID, 0);
|
||||
out32(R4030_SYS_TL_BASE, MIPS_KSEG1_TO_PHYS(map));
|
||||
out32(R4030_SYS_TL_LIMIT, PICA_TL_SIZE);
|
||||
out32(R4030_SYS_TL_IVALID, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -193,7 +200,7 @@ picaDmaTLBMap(dma_softc_t *sc)
|
||||
int nbytes;
|
||||
|
||||
va = sc->next_va - sc->dma_va;
|
||||
dma_pte = sc->pte_base + (va / PICA_DMA_PAGE_SIZE);
|
||||
dma_pte = sc->pte_base + (va / R4030_DMA_PAGE_SIZE);
|
||||
nbytes = dma_page_round(sc->next_size + dma_page_offs(va));
|
||||
va = sc->req_va;
|
||||
while(nbytes > 0) {
|
||||
@ -201,16 +208,17 @@ picaDmaTLBMap(dma_softc_t *sc)
|
||||
pa = MIPS_KSEG0_TO_PHYS(va);
|
||||
}
|
||||
else {
|
||||
pa = pmap_extract(vm_map_pmap(phys_map), va);
|
||||
if (!pmap_extract(vm_map_pmap(phys_map), va, &pa))
|
||||
panic("picaDmaTLBMap: pmap_extract %p", va);
|
||||
}
|
||||
pa &= PICA_DMA_PAGE_NUM;
|
||||
pa &= R4030_DMA_PAGE_NUM;
|
||||
if(pa == 0)
|
||||
panic("picaDmaTLBMap: null page frame");
|
||||
dma_pte->entry.lo_addr = pa;
|
||||
dma_pte->entry.hi_addr = 0;
|
||||
dma_pte++;
|
||||
va += PICA_DMA_PAGE_SIZE;
|
||||
nbytes -= PICA_DMA_PAGE_SIZE;
|
||||
va += R4030_DMA_PAGE_SIZE;
|
||||
nbytes -= R4030_DMA_PAGE_SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -238,21 +246,21 @@ picaDmaStart(sc, addr, size, datain)
|
||||
|
||||
/* Map up the request viritual dma space */
|
||||
picaDmaTLBMap(sc);
|
||||
out32(PICA_SYS_TL_IVALID, 0); /* Flush dma map cache */
|
||||
out32(R4030_SYS_TL_IVALID, 0); /* Flush dma map cache */
|
||||
|
||||
/* Load new transfer parameters */
|
||||
regs->dma_addr = sc->next_va;
|
||||
regs->dma_count = sc->next_size;
|
||||
regs->dma_mode = sc->mode & PICA_DMA_MODE;
|
||||
regs->dma_mode = sc->mode & R4030_DMA_MODE;
|
||||
|
||||
sc->sc_active = 1;
|
||||
if(datain == DMA_FROM_DEV) {
|
||||
sc->mode &= ~DMA_DIR_WRITE;
|
||||
regs->dma_enab = PICA_DMA_ENAB_RUN | PICA_DMA_ENAB_READ;
|
||||
regs->dma_enab = R4030_DMA_ENAB_RUN | R4030_DMA_ENAB_READ;
|
||||
}
|
||||
else {
|
||||
sc->mode |= DMA_DIR_WRITE;
|
||||
regs->dma_enab = PICA_DMA_ENAB_RUN | PICA_DMA_ENAB_WRITE;
|
||||
regs->dma_enab = R4030_DMA_ENAB_RUN | R4030_DMA_ENAB_WRITE;
|
||||
}
|
||||
wbflush();
|
||||
}
|
||||
@ -288,7 +296,7 @@ picaDmaFlush(sc, addr, size, datain)
|
||||
size_t size;
|
||||
int datain;
|
||||
{
|
||||
out32(PICA_SYS_TL_IVALID, 0); /* Flush dma map cache */
|
||||
out32(R4030_SYS_TL_IVALID, 0); /* Flush dma map cache */
|
||||
}
|
||||
|
||||
/*
|
||||
@ -308,7 +316,7 @@ picaDmaReset(dma_softc_t *sc)
|
||||
/*
|
||||
* End dma operation, return byte count left.
|
||||
*/
|
||||
int
|
||||
void
|
||||
picaDmaEnd(dma_softc_t *sc)
|
||||
{
|
||||
pDmaReg regs = sc->dma_reg;
|
||||
@ -320,51 +328,36 @@ picaDmaEnd(dma_softc_t *sc)
|
||||
regs->dma_enab = 0;
|
||||
regs->dma_mode = 0;
|
||||
sc->sc_active = 0;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
* Null call rathole!
|
||||
*/
|
||||
int /* XXX*/
|
||||
void
|
||||
picaDmaNull(dma_softc_t *sc)
|
||||
{
|
||||
pDmaReg regs = sc->dma_reg;
|
||||
|
||||
printf("picaDmaNull called\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* Null enable-interrupt rathole!
|
||||
*/
|
||||
void /* XXX*/
|
||||
picaEnIntrNull(dma_softc_t *sc)
|
||||
{
|
||||
pDmaReg regs = sc->dma_reg;
|
||||
|
||||
printf("picaEnIntrNull called\n");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* dma_init..
|
||||
* Called from asc to set up dma
|
||||
*/
|
||||
void
|
||||
asc_dma_init(dma_softc_t *sc)
|
||||
asc_dma_init(sc)
|
||||
dma_softc_t *sc;
|
||||
{
|
||||
sc->reset = picaDmaReset;
|
||||
sc->enintr = picaEnIntrNull;
|
||||
sc->enintr = picaDmaNull;
|
||||
sc->start = picaDmaStart;
|
||||
sc->map = picaDmaMap;
|
||||
sc->isintr = picaDmaNull;
|
||||
sc->intr = picaDmaNull;
|
||||
sc->isintr = (int(*)(struct dma_softc *))picaDmaNull;
|
||||
sc->intr = (int(*)(struct dma_softc *))picaDmaNull;
|
||||
sc->end = picaDmaEnd;
|
||||
|
||||
sc->dma_reg = (pDmaReg)PICA_SYS_DMA0_REGS;
|
||||
sc->dma_reg = (pDmaReg)R4030_SYS_DMA0_REGS;
|
||||
sc->pte_size = 32;
|
||||
sc->mode = PICA_DMA_MODE_160NS | PICA_DMA_MODE_16;
|
||||
sc->mode = R4030_DMA_MODE_160NS | R4030_DMA_MODE_16;
|
||||
picaDmaTLBAlloc(sc);
|
||||
}
|
||||
/*
|
||||
@ -375,16 +368,16 @@ void
|
||||
fdc_dma_init(dma_softc_t *sc)
|
||||
{
|
||||
sc->reset = picaDmaReset;
|
||||
sc->enintr = picaEnIntrNull;
|
||||
sc->enintr = picaDmaNull;
|
||||
sc->start = picaDmaStart;
|
||||
sc->map = picaDmaMap;
|
||||
sc->isintr = picaDmaNull;
|
||||
sc->intr = picaDmaNull;
|
||||
sc->isintr = (int(*)(struct dma_softc *))picaDmaNull;
|
||||
sc->intr = (int(*)(struct dma_softc *))picaDmaNull;
|
||||
sc->end = picaDmaEnd;
|
||||
|
||||
sc->dma_reg = (pDmaReg)PICA_SYS_DMA1_REGS;
|
||||
sc->dma_reg = (pDmaReg)R4030_SYS_DMA1_REGS;
|
||||
sc->pte_size = 32;
|
||||
sc->mode = PICA_DMA_MODE_160NS | PICA_DMA_MODE_8;
|
||||
sc->mode = R4030_DMA_MODE_160NS | R4030_DMA_MODE_8;
|
||||
picaDmaTLBAlloc(sc);
|
||||
}
|
||||
/*
|
||||
@ -394,12 +387,12 @@ fdc_dma_init(dma_softc_t *sc)
|
||||
void
|
||||
sn_dma_init(dma_softc_t *sc, int pages)
|
||||
{
|
||||
sc->reset = picaEnIntrNull; /* XXX*/
|
||||
sc->enintr = picaEnIntrNull;
|
||||
sc->reset = picaDmaNull;
|
||||
sc->enintr = picaDmaNull;
|
||||
sc->start = picaDmaFlush;
|
||||
sc->map = picaDmaMap;
|
||||
sc->isintr = picaDmaNull;
|
||||
sc->intr = picaDmaNull;
|
||||
sc->isintr = (int(*)(struct dma_softc *))picaDmaNull;
|
||||
sc->intr = (int(*)(struct dma_softc *))picaDmaNull;
|
||||
sc->end = picaDmaNull;
|
||||
|
||||
sc->dma_reg = (pDmaReg)NULL;
|
||||
|
@ -1,8 +1,9 @@
|
||||
/* $NetBSD: dma.h,v 1.4 2000/01/23 20:08:09 soda Exp $ */
|
||||
/* $NetBSD: dma.h,v 1.5 2000/01/23 21:01:53 soda Exp $ */
|
||||
/* $OpenBSD: dma.h,v 1.3 1997/04/19 17:19:51 pefo Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
/*
|
||||
* Copyright (c) 1996 Per Fogelstrom
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@ -14,29 +15,24 @@
|
||||
* 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 product includes software developed by Per Fogelstrom.
|
||||
* 4. 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 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: @(#)dma.h 8.1 (Berkeley) 6/10/93
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The PICA system has four dma channels capable of scatter/gather
|
||||
* The R4030 system has four dma channels capable of scatter/gather
|
||||
* and full memory addressing. The maximum transfer length is 1Mb.
|
||||
* Dma snopes the L2 cache so no precaution is required. However
|
||||
* if L1 cache is cached 'write back' the processor is responible
|
||||
@ -62,35 +58,35 @@ typedef volatile struct {
|
||||
int pad4;
|
||||
} DmaReg, *pDmaReg;
|
||||
|
||||
#define PICA_DMA_MODE_40NS 0x00 /* Device dma timing */
|
||||
#define PICA_DMA_MODE_80NS 0x01 /* Device dma timing */
|
||||
#define PICA_DMA_MODE_120NS 0x02 /* Device dma timing */
|
||||
#define PICA_DMA_MODE_160NS 0x03 /* Device dma timing */
|
||||
#define PICA_DMA_MODE_200NS 0x04 /* Device dma timing */
|
||||
#define PICA_DMA_MODE_240NS 0x05 /* Device dma timing */
|
||||
#define PICA_DMA_MODE_280NS 0x06 /* Device dma timing */
|
||||
#define PICA_DMA_MODE_320NS 0x07 /* Device dma timing */
|
||||
#define PICA_DMA_MODE_8 0x08 /* Device 8 bit */
|
||||
#define PICA_DMA_MODE_16 0x10 /* Device 16 bit */
|
||||
#define PICA_DMA_MODE_32 0x18 /* Device 32 bit */
|
||||
#define PICA_DMA_MODE_INT 0x20 /* Interrupt when done */
|
||||
#define PICA_DMA_MODE_BURST 0x40 /* Burst mode (Rev 2 only) */
|
||||
#define PICA_DMA_MODE_FAST 0x80 /* Fast dma cycle (Rev 2 only) */
|
||||
#define PICA_DMA_MODE 0xff /* Mode register bits */
|
||||
#define R4030_DMA_MODE_40NS 0x00 /* Device dma timing */
|
||||
#define R4030_DMA_MODE_80NS 0x01 /* Device dma timing */
|
||||
#define R4030_DMA_MODE_120NS 0x02 /* Device dma timing */
|
||||
#define R4030_DMA_MODE_160NS 0x03 /* Device dma timing */
|
||||
#define R4030_DMA_MODE_200NS 0x04 /* Device dma timing */
|
||||
#define R4030_DMA_MODE_240NS 0x05 /* Device dma timing */
|
||||
#define R4030_DMA_MODE_280NS 0x06 /* Device dma timing */
|
||||
#define R4030_DMA_MODE_320NS 0x07 /* Device dma timing */
|
||||
#define R4030_DMA_MODE_8 0x08 /* Device 8 bit */
|
||||
#define R4030_DMA_MODE_16 0x10 /* Device 16 bit */
|
||||
#define R4030_DMA_MODE_32 0x18 /* Device 32 bit */
|
||||
#define R4030_DMA_MODE_INT 0x20 /* Interrupt when done */
|
||||
#define R4030_DMA_MODE_BURST 0x40 /* Burst mode (Rev 2 only) */
|
||||
#define R4030_DMA_MODE_FAST 0x80 /* Fast dma cycle (Rev 2 only) */
|
||||
#define R4030_DMA_MODE 0xff /* Mode register bits */
|
||||
#define DMA_DIR_WRITE 0x100 /* Software direction status */
|
||||
#define DMA_DIR_READ 0x000 /* Software direction status */
|
||||
|
||||
#define PICA_DMA_ENAB_RUN 0x01 /* Enable dma */
|
||||
#define PICA_DMA_ENAB_READ 0x00 /* Read from device */
|
||||
#define PICA_DMA_ENAB_WRITE 0x02 /* Write to device */
|
||||
#define PICA_DMA_ENAB_TC_IE 0x100 /* Terminal count int enable */
|
||||
#define PICA_DMA_ENAB_ME_IE 0x200 /* Memory error int enable */
|
||||
#define PICA_DMA_ENAB_TL_IE 0x400 /* Translation limit int enable */
|
||||
#define R4030_DMA_ENAB_RUN 0x01 /* Enable dma */
|
||||
#define R4030_DMA_ENAB_READ 0x00 /* Read from device */
|
||||
#define R4030_DMA_ENAB_WRITE 0x02 /* Write to device */
|
||||
#define R4030_DMA_ENAB_TC_IE 0x100 /* Terminal count int enable */
|
||||
#define R4030_DMA_ENAB_ME_IE 0x200 /* Memory error int enable */
|
||||
#define R4030_DMA_ENAB_TL_IE 0x400 /* Translation limit int enable */
|
||||
|
||||
#define PICA_DMA_COUNT_MASK 0x00fffff /* Byte count mask */
|
||||
#define PICA_DMA_PAGE_NUM 0xffff000 /* Address page number */
|
||||
#define PICA_DMA_PAGE_OFFS 0x0000fff /* Address page offset */
|
||||
#define PICA_DMA_PAGE_SIZE 0x0001000 /* Address page size */
|
||||
#define R4030_DMA_COUNT_MASK 0x00fffff /* Byte count mask */
|
||||
#define R4030_DMA_PAGE_NUM 0xffff000 /* Address page number */
|
||||
#define R4030_DMA_PAGE_OFFS 0x0000fff /* Address page offset */
|
||||
#define R4030_DMA_PAGE_SIZE 0x0001000 /* Address page size */
|
||||
|
||||
|
||||
/*
|
||||
@ -128,20 +124,20 @@ typedef struct dma_softc {
|
||||
int *sc_dmalen; /* Pointer to len counter in dev */
|
||||
void (*reset)(struct dma_softc *); /* Reset routine pointer */
|
||||
void (*enintr)(struct dma_softc *); /* Int enab routine pointer */
|
||||
void (*map)(struct dma_softc *, caddr_t, size_t, int);
|
||||
void (*map)(struct dma_softc *, char *, size_t, int);
|
||||
/* Map a dma viritual area */
|
||||
void (*start)(struct dma_softc *, caddr_t, size_t, int);
|
||||
/* Start routine pointer */
|
||||
int (*isintr)(struct dma_softc *); /* Int check routine pointer */
|
||||
int (*intr)(struct dma_softc *); /* Interrupt routine pointer */
|
||||
int (*end)(struct dma_softc *); /* Interrupt routine pointer */
|
||||
void (*end)(struct dma_softc *); /* Interrupt routine pointer */
|
||||
} dma_softc_t;
|
||||
|
||||
#define DMA_TO_DEV 0
|
||||
#define DMA_FROM_DEV 1
|
||||
|
||||
#define dma_page_offs(x) ((int)(x) & PICA_DMA_PAGE_OFFS)
|
||||
#define dma_page_round(x) (((int)(x) + PICA_DMA_PAGE_OFFS) & PICA_DMA_PAGE_NUM)
|
||||
#define dma_page_offs(x) ((int)(x) & R4030_DMA_PAGE_OFFS)
|
||||
#define dma_page_round(x) (((int)(x) + R4030_DMA_PAGE_OFFS) & R4030_DMA_PAGE_NUM)
|
||||
|
||||
#define DMA_RESET(r) ((r->reset)(r))
|
||||
#define DMA_START(a, b, c, d) ((a->start)(a, b, c, d))
|
||||
@ -150,8 +146,14 @@ typedef struct dma_softc {
|
||||
#define DMA_DRAIN(r)
|
||||
#define DMA_END(r) ((r->end)(r))
|
||||
|
||||
/*
|
||||
* declarations of device-specific motherboard DMA hooks.
|
||||
*/
|
||||
void fdc_dma_init __P((dma_softc_t *sc));
|
||||
void sn_dma_init __P((dma_softc_t *sc, int pages));
|
||||
void picaDmaInit __P((void));
|
||||
void picaDmaTLBAlloc __P((dma_softc_t *));
|
||||
void picaDmaTLBFree __P((dma_softc_t *));
|
||||
void picaDmaTLBMap __P((dma_softc_t *));
|
||||
void picaDmaMap __P((struct dma_softc *, char *, size_t, int));
|
||||
void picaDmaStart __P((struct dma_softc *, char *, size_t, int));
|
||||
void picaDmaFlush __P((struct dma_softc *, char *, size_t, int));
|
||||
void asc_dma_init __P((struct dma_softc *));
|
||||
void fdc_dma_init __P((struct dma_softc *));
|
||||
void sn_dma_init __P((struct dma_softc *, int));
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
/* $NetBSD: fd.c,v 1.14 2000/01/23 20:08:10 soda Exp $ */
|
||||
/* $NetBSD: fd.c,v 1.15 2000/01/23 21:01:54 soda Exp $ */
|
||||
/* $OpenBSD: fd.c,v 1.5 1997/04/19 17:19:52 pefo Exp $ */
|
||||
/* NetBSD: fd.c,v 1.78 1995/07/04 07:23:09 mycroft Exp */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -88,20 +90,22 @@
|
||||
#include <sys/uio.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/queue.h>
|
||||
#include <vm/vm.h>
|
||||
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/pio.h>
|
||||
#include <machine/autoconf.h>
|
||||
|
||||
#include <mips/locore.h>
|
||||
#include <pica/dev/fdreg.h>
|
||||
#include <pica/dev/dma.h>
|
||||
#include <mips/locore.h> /* for mips3_HitFlushDCache() */
|
||||
#include <arc/dev/fdreg.h>
|
||||
#include <arc/dev/dma.h>
|
||||
|
||||
#include "locators.h"
|
||||
|
||||
|
||||
#define FDUNIT(dev) (minor(dev) / 8)
|
||||
#define FDTYPE(dev) (minor(dev) % 8)
|
||||
#define FDUNIT(dev) ((dev & 0x080) >> 7)
|
||||
#define FDTYPE(dev) ((minor(dev) & 0x70) >> 4)
|
||||
#define FDPART(dev) (minor(dev) & 0x0f)
|
||||
|
||||
enum fdc_state {
|
||||
DEVIDLE = 0,
|
||||
@ -139,7 +143,7 @@ struct fdc_softc {
|
||||
};
|
||||
|
||||
/* controller driver configuration */
|
||||
int fdcprobe __P((struct device *, void *, void *));
|
||||
int fdcprobe __P((struct device *, struct cfdata *, void *));
|
||||
void fdcattach __P((struct device *, struct device *, void *));
|
||||
|
||||
struct cfattach fdc_ca = {
|
||||
@ -207,22 +211,29 @@ struct fd_softc {
|
||||
};
|
||||
|
||||
/* floppy driver configuration */
|
||||
int fdprobe __P((struct device *, void *, void *));
|
||||
int fdprobe __P((struct device *, struct cfdata *, void *));
|
||||
void fdattach __P((struct device *, struct device *, void *));
|
||||
|
||||
struct cfattach fd_ca = {
|
||||
sizeof(struct fd_softc), fdprobe, fdattach
|
||||
};
|
||||
|
||||
extern struct cfdriver fd_cd;
|
||||
|
||||
void fdgetdisklabel __P((struct fd_softc *));
|
||||
int fd_get_parms __P((struct fd_softc *));
|
||||
void fdstrategy __P((struct buf *));
|
||||
void fdstart __P((struct fd_softc *));
|
||||
int fdioctl __P((dev_t, u_long, caddr_t, int));
|
||||
int fddump __P((dev_t, daddr_t, caddr_t, size_t));
|
||||
int fdsize __P((dev_t));
|
||||
int fdopen __P((dev_t, int));
|
||||
int fdclose __P((dev_t, int));
|
||||
int fdwrite __P((dev_t, struct uio *));
|
||||
int fdread __P((dev_t, struct uio *));
|
||||
|
||||
struct dkdriver fddkdriver = { fdstrategy };
|
||||
|
||||
int fdprint __P((void *, const char *));
|
||||
struct fd_type *fd_nvtotype __P((char *, int, int));
|
||||
void fd_set_motor __P((struct fdc_softc *fdc, int reset));
|
||||
void fd_motor_off __P((void *arg));
|
||||
@ -240,7 +251,8 @@ void fdfinish __P((struct fd_softc *fd, struct buf *bp));
|
||||
int
|
||||
fdcprobe(parent, match, aux)
|
||||
struct device *parent;
|
||||
void *match, *aux;
|
||||
struct cfdata *match;
|
||||
void *aux;
|
||||
{
|
||||
register struct confargs *ca = aux;
|
||||
int iobase = (long)BUS_CVTADDR(ca);
|
||||
@ -330,17 +342,17 @@ fdcattach(parent, self, aux)
|
||||
int
|
||||
fdprobe(parent, match, aux)
|
||||
struct device *parent;
|
||||
void *match, *aux;
|
||||
struct cfdata *match;
|
||||
void *aux;
|
||||
{
|
||||
struct fdc_softc *fdc = (void *)parent;
|
||||
struct cfdata *cf = match;
|
||||
struct fdc_attach_args *fa = aux;
|
||||
int drive = fa->fa_drive;
|
||||
int iobase = fdc->sc_iobase;
|
||||
int n;
|
||||
|
||||
if (cf->cf_loc[FDCCF_DRIVE] != FDCCF_DRIVE_DEFAULT &&
|
||||
cf->cf_loc[FDCCF_DRIVE] != drive)
|
||||
if (match->cf_loc[FDCCF_DRIVE] != FDCCF_DRIVE_DEFAULT &&
|
||||
match->cf_loc[FDCCF_DRIVE] != drive)
|
||||
return 0;
|
||||
|
||||
/* select drive and turn on motor */
|
||||
@ -443,18 +455,6 @@ fd_nvtotype(fdc, nvraminfo, drive)
|
||||
#endif
|
||||
}
|
||||
|
||||
inline struct fd_type *
|
||||
fd_dev_to_type(fd, dev)
|
||||
struct fd_softc *fd;
|
||||
dev_t dev;
|
||||
{
|
||||
int type = FDTYPE(dev);
|
||||
|
||||
if (type > (sizeof(fd_types) / sizeof(fd_types[0])))
|
||||
return NULL;
|
||||
return type ? &fd_types[type - 1] : fd->sc_deftype;
|
||||
}
|
||||
|
||||
void
|
||||
fdstrategy(bp)
|
||||
register struct buf *bp; /* IO operation to perform */
|
||||
@ -600,7 +600,7 @@ fd_set_motor(fdc, reset)
|
||||
u_char status;
|
||||
int n;
|
||||
|
||||
if (fd = fdc->sc_drives.tqh_first)
|
||||
if ((fd = fdc->sc_drives.tqh_first) != NULL)
|
||||
status = fd->sc_drive;
|
||||
else
|
||||
status = 0;
|
||||
@ -684,7 +684,7 @@ out_fdc(iobase, x)
|
||||
}
|
||||
|
||||
int
|
||||
Fdopen(dev, flags)
|
||||
fdopen(dev, flags)
|
||||
dev_t dev;
|
||||
int flags;
|
||||
{
|
||||
@ -698,7 +698,14 @@ Fdopen(dev, flags)
|
||||
fd = fd_cd.cd_devs[unit];
|
||||
if (fd == 0)
|
||||
return ENXIO;
|
||||
type = fd_dev_to_type(fd, dev);
|
||||
|
||||
if (FDTYPE(dev) > (sizeof(fd_types) / sizeof(fd_types[0])))
|
||||
type = NULL;
|
||||
else if(FDTYPE(dev))
|
||||
type = &fd_types[FDTYPE(dev) - 1];
|
||||
else
|
||||
type = fd->sc_deftype;
|
||||
|
||||
if (type == NULL)
|
||||
return ENXIO;
|
||||
|
||||
@ -747,7 +754,6 @@ fdcstatus(dv, n, s)
|
||||
char *s;
|
||||
{
|
||||
struct fdc_softc *fdc = (void *)dv->dv_parent;
|
||||
int iobase = fdc->sc_iobase;
|
||||
char bits[64];
|
||||
|
||||
if (n == 0) {
|
||||
@ -827,7 +833,7 @@ fdcintr(arg)
|
||||
struct fd_softc *fd;
|
||||
struct buf *bp;
|
||||
int iobase = fdc->sc_iobase;
|
||||
int read, head, trac, sec, i, s, nblks;
|
||||
int read, head, sec, i, nblks;
|
||||
struct fd_type *type;
|
||||
|
||||
loop:
|
||||
@ -915,7 +921,7 @@ loop:
|
||||
#endif
|
||||
}}
|
||||
#endif
|
||||
MachFlushDCache((vm_offset_t) (bp->b_data + fd->sc_skip),
|
||||
mips3_FlushDCache((vm_offset_t) (bp->b_data + fd->sc_skip),
|
||||
(vm_offset_t) fd->sc_nbytes);
|
||||
read = bp->b_flags & B_READ ? DMA_FROM_DEV : DMA_TO_DEV;
|
||||
DMA_START(fdc->dma, bp->b_data + fd->sc_skip, fd->sc_nbytes, read);
|
||||
@ -1067,9 +1073,9 @@ void
|
||||
fdcretry(fdc)
|
||||
struct fdc_softc *fdc;
|
||||
{
|
||||
char bits[64];
|
||||
struct fd_softc *fd;
|
||||
struct buf *bp;
|
||||
char bits[64];
|
||||
|
||||
fd = fdc->sc_drives.tqh_first;
|
||||
bp = BUFQ_FIRST(&fd->sc_q);
|
||||
|
@ -1,5 +1,6 @@
|
||||
/* $NetBSD: fdreg.h,v 1.2 2000/01/23 21:01:54 soda Exp $ */
|
||||
/* $OpenBSD: fdreg.h,v 1.1.1.1 1996/06/24 09:07:19 pefo Exp $ */
|
||||
/* $NetBSD: fdreg.h,v 1.1.1.3 2000/01/23 20:24:27 soda Exp $ */
|
||||
/* NetBSD: fdreg.h,v 1.8 1995/06/28 04:30:57 cgd Exp */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991 The Regents of the University of California.
|
||||
|
@ -1,4 +1,5 @@
|
||||
/* $NetBSD: if_sn.c,v 1.14 2000/01/23 20:08:12 soda Exp $ */
|
||||
/* $NetBSD: if_sn.c,v 1.15 2000/01/23 21:01:54 soda Exp $ */
|
||||
/* $OpenBSD: if_sn.c,v 1.9 1997/04/19 17:19:52 pefo Exp $ */
|
||||
|
||||
/*
|
||||
* National Semiconductor SONIC Driver
|
||||
@ -13,8 +14,12 @@
|
||||
#include "sn.h"
|
||||
#include "opt_inet.h"
|
||||
#include "opt_ns.h"
|
||||
#include "bpfilter.h"
|
||||
#include "rnd.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/user.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/buf.h>
|
||||
@ -24,8 +29,12 @@
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/device.h>
|
||||
#include <vm/vm.h>
|
||||
#include <machine/autoconf.h>
|
||||
|
||||
#include <arc/arc/arctype.h> /* XXX - cputype */
|
||||
extern int cputype;
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_dl.h>
|
||||
#include <net/if_ether.h>
|
||||
@ -39,37 +48,30 @@
|
||||
#include <netinet/if_inarp.h>
|
||||
#endif
|
||||
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/bus.h>
|
||||
|
||||
#ifdef NS
|
||||
#include <netns/ns.h>
|
||||
#include <netns/ns_if.h>
|
||||
#endif
|
||||
|
||||
#ifdef RMP
|
||||
#include <netrmp/rmp.h>
|
||||
#include <netrmp/rmp_var.h>
|
||||
#endif
|
||||
|
||||
#include <vm/vm.h>
|
||||
|
||||
#include "bpfilter.h"
|
||||
#if NBPFILTER > 0
|
||||
#include <net/bpf.h>
|
||||
#include <net/bpfdesc.h>
|
||||
#endif
|
||||
|
||||
#include <machine/bus.h>
|
||||
#if NRND > 0
|
||||
#include <sys/rnd.h>
|
||||
#endif
|
||||
|
||||
#include <arc/dev/dma.h>
|
||||
|
||||
#define SONICDW 32
|
||||
typedef unsigned char uchar;
|
||||
|
||||
#include <mips/cpuregs.h> /* XXX */
|
||||
#include <pica/dev/if_sn.h>
|
||||
#include <arc/dev/if_snreg.h>
|
||||
#define SWR(a, x) (a) = (x)
|
||||
#define SRD(a) ((a) & 0xffff)
|
||||
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/bus.h>
|
||||
#include <mips/locore.h> /* for mips3_HitFlushDCache() */
|
||||
|
||||
/*
|
||||
* Statistics collected over time
|
||||
@ -117,54 +119,33 @@ struct sn_softc {
|
||||
struct RXpkt *sc_lrxp; /* last RDA available to chip */
|
||||
struct sn_stats sc_sum;
|
||||
short sc_iflags;
|
||||
|
||||
#if NRND > 0
|
||||
rndsource_element_t rnd_source; /* random source */
|
||||
#endif
|
||||
} sn_softc;
|
||||
|
||||
int snmatch __P((struct device *, void *, void *));
|
||||
int snmatch __P((struct device *, struct cfdata *, void *));
|
||||
void snattach __P((struct device *, struct device *, void *));
|
||||
|
||||
struct cfattach sn_ca = {
|
||||
sizeof(struct sn_softc), snmatch, snattach
|
||||
};
|
||||
|
||||
#undef assert
|
||||
#undef _assert
|
||||
|
||||
|
||||
void m_check __P((struct mbuf *m));
|
||||
void m_checkm __P((struct mbuf *m));
|
||||
|
||||
void
|
||||
m_check(m)
|
||||
struct mbuf *m;
|
||||
{
|
||||
if (m->m_flags & M_EXT) {
|
||||
assert(m->m_len >= 0);
|
||||
assert(m->m_len <= m->m_ext.ext_size);
|
||||
assert(m->m_data >= &m->m_ext.ext_buf[0]);
|
||||
assert(m->m_data <= &m->m_ext.ext_buf[m->m_ext.ext_size]);
|
||||
assert(m->m_data + m->m_len <= &m->m_ext.ext_buf[m->m_ext.ext_size]);
|
||||
} else if (m->m_flags & M_PKTHDR) {
|
||||
assert(m->m_len >= 0);
|
||||
assert(m->m_len <= MHLEN);
|
||||
assert(m->m_data >= m->m_pktdat);
|
||||
assert(m->m_data <= &m->m_pktdat[MHLEN]);
|
||||
assert(m->m_data + m->m_len <= &m->m_pktdat[MHLEN]);
|
||||
} else {
|
||||
assert(m->m_len >= 0);
|
||||
assert(m->m_len <= MLEN);
|
||||
assert(m->m_data >= m->m_dat);
|
||||
assert(m->m_data <= &m->m_dat[MLEN]);
|
||||
assert(m->m_data + m->m_len <= &m->m_dat[MLEN]);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
m_checkm(m)
|
||||
struct mbuf *m;
|
||||
{
|
||||
while (m) {
|
||||
m_check(m);
|
||||
m = m->m_next;
|
||||
}
|
||||
}
|
||||
#ifdef NDEBUG
|
||||
#define assert(e) ((void)0)
|
||||
#define _assert(e) ((void)0)
|
||||
#else
|
||||
#define _assert(e) assert(e)
|
||||
#ifdef __STDC__
|
||||
#define assert(e) ((e) ? (void)0 : __assert("sn ", __FILE__, __LINE__, #e))
|
||||
#else /* PCC */
|
||||
#define assert(e) ((e) ? (void)0 : __assert("sn "__FILE__, __LINE__, "e"))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
int ethdebug = 0;
|
||||
|
||||
@ -261,9 +242,9 @@ void camdump __P((struct sn_softc *sc));
|
||||
int
|
||||
snmatch(parent, match, aux)
|
||||
struct device *parent;
|
||||
void *match, *aux;
|
||||
struct cfdata *match;
|
||||
void *aux;
|
||||
{
|
||||
/*struct cfdata *cf = match;*/
|
||||
struct confargs *ca = aux;
|
||||
|
||||
/* XXX CHECK BUS */
|
||||
@ -287,7 +268,6 @@ snattach(parent, self, aux)
|
||||
struct sn_softc *sc = (void *)self;
|
||||
struct confargs *ca = aux;
|
||||
struct ifnet *ifp = &sc->sc_if;
|
||||
/*struct cfdata *cf = sc->sc_dev.dv_cfdata;*/
|
||||
int p, pp;
|
||||
uchar myaddr[ETHER_ADDR_LEN];
|
||||
|
||||
@ -295,8 +275,8 @@ snattach(parent, self, aux)
|
||||
|
||||
sc->dma = &sc->__dma;
|
||||
sn_dma_init(sc->dma, FRAGMAX * NTDA
|
||||
+ (NRBA * RBASIZE / PICA_DMA_PAGE_SIZE) + 1
|
||||
+ (DESC_SIZE * 2 / PICA_DMA_PAGE_SIZE) + 1);
|
||||
+ (NRBA * RBASIZE / R4030_DMA_PAGE_SIZE) + 1
|
||||
+ (DESC_SIZE * 2 / R4030_DMA_PAGE_SIZE) + 1);
|
||||
|
||||
/*
|
||||
* because the sonic is basicly 16bit device it 'concatenates'
|
||||
@ -304,7 +284,7 @@ snattach(parent, self, aux)
|
||||
* around problems near the end of 64k !!
|
||||
*/
|
||||
p = SONICBUF;
|
||||
pp = SONICBUF - (FRAGMAX * NTDA * PICA_DMA_PAGE_SIZE);
|
||||
pp = SONICBUF - (FRAGMAX * NTDA * R4030_DMA_PAGE_SIZE);
|
||||
|
||||
if ((p ^ (p + TDASIZE)) & 0x10000)
|
||||
p = (p + 0x10000) & ~0xffff;
|
||||
@ -328,12 +308,13 @@ snattach(parent, self, aux)
|
||||
v_cda = (struct CDA *)(p - pp + sc->dma->dma_va);
|
||||
p += CDASIZE;
|
||||
|
||||
p += PICA_DMA_PAGE_SIZE - (p & (PICA_DMA_PAGE_SIZE -1));
|
||||
p += R4030_DMA_PAGE_SIZE - (p & (R4030_DMA_PAGE_SIZE -1));
|
||||
p_rba = (char *)p;
|
||||
v_rba = (char *)(p - pp + sc->dma->dma_va);
|
||||
p += NRBA * RBASIZE;
|
||||
|
||||
DMA_MAP(sc->dma, (caddr_t)SONICBUF, p - SONICBUF, SONICBUF - pp);
|
||||
printf(": bufsize %d",p - SONICBUF);
|
||||
|
||||
#if 0
|
||||
camdump(sc);
|
||||
@ -357,11 +338,15 @@ printf("mapped to offset 0x%x size 0x%x\n", SONICBUF - pp, p - SONICBUF);
|
||||
ifp->if_start = snstart;
|
||||
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
|
||||
ifp->if_watchdog = snwatchdog;
|
||||
if_attach(ifp);
|
||||
ether_ifattach(ifp, myaddr);
|
||||
#if NBPFILTER > 0
|
||||
bpfattach(&ifp->if_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header));
|
||||
#endif
|
||||
if_attach(ifp);
|
||||
ether_ifattach(ifp, myaddr);
|
||||
#if NRND > 0
|
||||
rnd_attach_source(&sc->rnd_source, sc->sc_dev.dv_xname,
|
||||
RND_TYPE_NET, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
@ -387,23 +372,6 @@ snioctl(ifp, cmd, data)
|
||||
arp_ifinit(&sc->sc_ec.ec_if, ifa);
|
||||
break;
|
||||
#endif
|
||||
#ifdef NS
|
||||
case AF_NS:
|
||||
{
|
||||
struct ns_addr *ina = &(IA_SNS(ifa)->sns_addr);
|
||||
|
||||
if (ns_nullhost(*ina)) {
|
||||
ina->x_host = *(union ns_host *)(sc->sc_addr);
|
||||
} else {
|
||||
/* XXX
|
||||
* add an extra i/f address to
|
||||
* sonic filter
|
||||
*/
|
||||
}
|
||||
}
|
||||
(void)sninit(sc);
|
||||
break;
|
||||
#endif /* NS */
|
||||
default:
|
||||
(void)sninit(sc);
|
||||
break;
|
||||
@ -515,7 +483,6 @@ void
|
||||
snreset(sc)
|
||||
struct sn_softc *sc;
|
||||
{
|
||||
printf("snreset\n");
|
||||
snstop(sc);
|
||||
sninit(sc);
|
||||
}
|
||||
@ -536,8 +503,8 @@ sninit(sc)
|
||||
csr->s_cr = CR_RST; /* s_dcr only accessable reset mode! */
|
||||
|
||||
/* config it */
|
||||
csr->s_dcr = DCR_LBR | DCR_SYNC | DCR_WAIT0 | DCR_DW32 | DCR_DMABLOCK |
|
||||
DCR_RFT16 | DCR_TFT16;
|
||||
csr->s_dcr = DCR_LBR | DCR_SYNC | DCR_WAIT0 | DCR_DW32 |
|
||||
DCR_RFT4 | DCR_TFT28; /*XXX RFT & TFT according to MIPS manual */
|
||||
csr->s_rcr = RCR_BRD | RCR_LBNONE;
|
||||
csr->s_imr = IMR_PRXEN | IMR_PTXEN | IMR_TXEREN | IMR_HBLEN | IMR_LCDEN;
|
||||
|
||||
@ -559,7 +526,7 @@ sninit(sc)
|
||||
|
||||
/* program the CAM with our address */
|
||||
caminitialise();
|
||||
camentry(0, LLADDR(sc->sc_if.if_sadl));
|
||||
camentry(0, (u_char *)LLADDR(sc->sc_if.if_sadl));
|
||||
camprogram(sc);
|
||||
|
||||
/* get it to read resource descriptors */
|
||||
@ -577,12 +544,6 @@ sninit(sc)
|
||||
|
||||
splx(s);
|
||||
return (0);
|
||||
|
||||
#if 0
|
||||
bad:
|
||||
snstop(sc);
|
||||
return (error);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@ -604,7 +565,7 @@ snstop(sc)
|
||||
/* free all receive buffers (currently static so nothing to do) */
|
||||
|
||||
/* free all pending transmit mbufs */
|
||||
while ((mtd = mtdhead) != 0) {
|
||||
while ((mtd = mtdhead)) {
|
||||
mtdhead = mtdhead->mtd_link;
|
||||
if (mtd->mtd_mbuf)
|
||||
m_freem(mtd->mtd_mbuf);
|
||||
@ -636,10 +597,10 @@ snwatchdog(ifp)
|
||||
/* something still pending for transmit */
|
||||
if (mtdhead->mtd_txp->status == 0)
|
||||
log(LOG_ERR, "%s: Tx - timeout\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
sc->sc_if.if_xname);
|
||||
else
|
||||
log(LOG_ERR, "%s: Tx - lost interrupt\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
sc->sc_if.if_xname);
|
||||
temp = sc->sc_if.if_flags & IFF_UP;
|
||||
snreset(sc);
|
||||
sc->sc_if.if_flags |= temp;
|
||||
@ -668,7 +629,7 @@ sonicput(sc, m0)
|
||||
mtdnext->mtd_mbuf = m0;
|
||||
txp = mtdnext->mtd_txp;
|
||||
SWR(txp->config, 0);
|
||||
fragoffset = (txp - p_tda) * FRAGMAX * PICA_DMA_PAGE_SIZE;
|
||||
fragoffset = (txp - p_tda) * FRAGMAX * R4030_DMA_PAGE_SIZE;
|
||||
|
||||
/*
|
||||
* Now fill in the fragments. Each fragment maps to it's
|
||||
@ -704,7 +665,7 @@ sonicput(sc, m0)
|
||||
fr++;
|
||||
va += n;
|
||||
resid -= n;
|
||||
fragoffset += PICA_DMA_PAGE_SIZE;
|
||||
fragoffset += R4030_DMA_PAGE_SIZE;
|
||||
}
|
||||
}
|
||||
/*
|
||||
@ -730,7 +691,7 @@ sonicput(sc, m0)
|
||||
mtd_free(mtdnew);
|
||||
m_freem(m0);
|
||||
log(LOG_ERR, "%s: tx too many fragments %d\n",
|
||||
sc->sc_dev.dv_xname, fr);
|
||||
sc->sc_if.if_xname, fr);
|
||||
sc->sc_if.if_oerrors++;
|
||||
return (len);
|
||||
}
|
||||
@ -776,8 +737,9 @@ sngetaddr(sc, ap)
|
||||
struct sn_softc *sc;
|
||||
uchar *ap;
|
||||
{
|
||||
unsigned i;
|
||||
#if 1
|
||||
#if 0
|
||||
int i;
|
||||
|
||||
sc->sc_csr->s_cr = CR_RST;
|
||||
wbflush();
|
||||
sc->sc_csr->s_cep = 0;
|
||||
@ -797,6 +759,13 @@ sngetaddr(sc, ap)
|
||||
sc->sc_csr->s_cr = 0;
|
||||
wbflush();
|
||||
#else
|
||||
if (cputype == MAGNUM) { /* XXX */
|
||||
extern char prodid[];
|
||||
|
||||
bcopy(prodid, ap, ETHER_ADDR_LEN);
|
||||
return (0);
|
||||
}
|
||||
|
||||
ap[0] = 0x08;
|
||||
ap[1] = 0x00;
|
||||
ap[2] = 0x20;
|
||||
@ -811,7 +780,7 @@ void sonictxint __P((struct sn_softc *));
|
||||
void sonicrxint __P((struct sn_softc *));
|
||||
|
||||
int sonic_read __P((struct sn_softc *, struct RXpkt *));
|
||||
struct mbuf *sonic_get __P((struct sn_softc *, struct ether_header *, int));
|
||||
struct mbuf *sonic_get __P((struct sn_softc *, caddr_t, int));
|
||||
|
||||
void
|
||||
mtd_free(mtd)
|
||||
@ -1000,8 +969,11 @@ snintr(sc)
|
||||
{
|
||||
struct sonic_reg *csr = sc->sc_csr;
|
||||
int isr;
|
||||
#if NRND > 0
|
||||
it isr_save = 0;
|
||||
#endif
|
||||
|
||||
while ((isr = (csr->s_isr & ISR_ALL)) != 0) {
|
||||
while ((isr = (csr->s_isr & ISR_ALL))) {
|
||||
/* scrub the interrupts that we are going to service */
|
||||
csr->s_isr = isr;
|
||||
wbflush();
|
||||
@ -1037,7 +1009,14 @@ snintr(sc)
|
||||
sc->sc_mptally++;
|
||||
#endif
|
||||
}
|
||||
#if NRND > 0
|
||||
isr_save = isr;
|
||||
#endif
|
||||
}
|
||||
#if NRND > 0
|
||||
if (isr_save)
|
||||
rnd_add_uint32(&sc->rnd_source, isr_save);
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
@ -1057,7 +1036,7 @@ sonictxint(sc)
|
||||
|
||||
csr = sc->sc_csr;
|
||||
|
||||
while ((mtd = mtdhead) != 0) {
|
||||
while ((mtd = mtdhead)) {
|
||||
struct mbuf *m = mtd->mtd_mbuf;
|
||||
|
||||
if (m == 0)
|
||||
@ -1088,7 +1067,7 @@ sonictxint(sc)
|
||||
|
||||
if (mtdhead != mtdnext) {
|
||||
printf("resubmitting remaining packets\n");
|
||||
csr->s_ctda = LOWER(mtdhead->mtd_txp);
|
||||
csr->s_ctda = LOWER(v_tda + (mtdhead->mtd_txp - p_tda));
|
||||
csr->s_cr = CR_TXP;
|
||||
wbflush();
|
||||
return;
|
||||
@ -1209,7 +1188,7 @@ sonic_read(sc, rxp)
|
||||
* Remember that type was trailer by setting off.
|
||||
*/
|
||||
|
||||
len = SRD(rxp->byte_count) - sizeof(struct ether_header) - FCSSIZE;
|
||||
len = SRD(rxp->byte_count) - FCSSIZE;
|
||||
pkt = (caddr_t)((SRD(rxp->pkt_ptrhi) << 16) | SRD(rxp->pkt_ptrlo));
|
||||
pkt = pkt - v_rba + p_rba;
|
||||
et = (struct ether_header *)pkt;
|
||||
@ -1220,7 +1199,8 @@ sonic_read(sc, rxp)
|
||||
ether_sprintf(et->ether_shost));
|
||||
printf(" (to %s)\n", ether_sprintf(et->ether_dhost));
|
||||
}
|
||||
if (len < ETHERMIN || len > ETHERMTU) {
|
||||
if (len < (ETHER_MIN_LEN - ETHER_CRC_LEN) ||
|
||||
len > (ETHER_MAX_LEN - ETHER_CRC_LEN)) {
|
||||
printf("sonic: invalid packet length %d bytes\n", len);
|
||||
return (0);
|
||||
}
|
||||
@ -1232,8 +1212,7 @@ sonic_read(sc, rxp)
|
||||
* not destined for us (but be sure to keep broadcast/multicast).
|
||||
*/
|
||||
if (ifp->if_bpf) {
|
||||
bpf_tap(sc->sc_if.if_bpf, pkt,
|
||||
len + sizeof(struct ether_header));
|
||||
bpf_tap(sc->sc_if.if_bpf, pkt, len);
|
||||
/*
|
||||
* Note that the interface cannot be in promiscuous mode if
|
||||
* there are no BPF listeners. And if we are in promiscuous
|
||||
@ -1241,45 +1220,42 @@ sonic_read(sc, rxp)
|
||||
*/
|
||||
if ((ifp->if_flags & IFF_PROMISC) != 0 &&
|
||||
(et->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */
|
||||
bcmp(et->ether_dhost, LLADDR(ifp->if_sadl),
|
||||
bcmp(et->ether_dhost, (void *)LLADDR(ifp->if_sadl),
|
||||
sizeof(et->ether_dhost)) != 0)
|
||||
return (1);
|
||||
return(1); /* XXX - count this ? */
|
||||
}
|
||||
#endif
|
||||
m = sonic_get(sc, et, len);
|
||||
m = sonic_get(sc, pkt, len);
|
||||
if (m == NULL)
|
||||
return (0);
|
||||
ether_input(ifp, et, m);
|
||||
(*ifp->if_input)(ifp, m);
|
||||
return(1);
|
||||
}
|
||||
|
||||
#define sonicdataaddr(eh, off, type) ((type)(((caddr_t)((eh)+1)+(off))))
|
||||
|
||||
/*
|
||||
* munge the recieved packet into an mbuf chain
|
||||
* because we are using stupif buffer management this
|
||||
* munge the received packet into a mbuf chain
|
||||
* because we are using stupid buffer management this
|
||||
* is slow.
|
||||
*/
|
||||
struct mbuf *
|
||||
sonic_get(sc, eh, datalen)
|
||||
sonic_get(sc, pkt, datalen)
|
||||
struct sn_softc *sc;
|
||||
struct ether_header *eh;
|
||||
caddr_t pkt;
|
||||
int datalen;
|
||||
{
|
||||
struct mbuf *m;
|
||||
struct mbuf *top = 0, **mp = ⊤
|
||||
struct mbuf *m, *top, **mp;
|
||||
int len;
|
||||
char *spkt = sonicdataaddr(eh, 0, caddr_t);
|
||||
char *epkt = spkt + datalen;
|
||||
char *cp = spkt;
|
||||
|
||||
epkt = cp + datalen;
|
||||
MGETHDR(m, M_DONTWAIT, MT_DATA);
|
||||
if (m == 0)
|
||||
return (0);
|
||||
m->m_pkthdr.rcvif = &sc->sc_if;
|
||||
m->m_pkthdr.len = datalen;
|
||||
m->m_len = MHLEN;
|
||||
len = MHLEN;
|
||||
top = 0;
|
||||
mp = ⊤
|
||||
|
||||
while (datalen > 0) {
|
||||
if (top) {
|
||||
@ -1288,33 +1264,33 @@ sonic_get(sc, eh, datalen)
|
||||
m_freem(top);
|
||||
return (0);
|
||||
}
|
||||
m->m_len = MLEN;
|
||||
len = MLEN;
|
||||
}
|
||||
len = min(datalen, epkt - cp);
|
||||
if (len >= MINCLSIZE) {
|
||||
if (datalen >= MINCLSIZE) {
|
||||
MCLGET(m, M_DONTWAIT);
|
||||
if (m->m_flags & M_EXT)
|
||||
m->m_len = len = min(len, MCLBYTES);
|
||||
else
|
||||
len = m->m_len;
|
||||
} else {
|
||||
/*
|
||||
* Place initial small packet/header at end of mbuf.
|
||||
*/
|
||||
if (len < m->m_len) {
|
||||
if (top == 0 && len + max_linkhdr <= m->m_len)
|
||||
m->m_data += max_linkhdr;
|
||||
m->m_len = len;
|
||||
} else
|
||||
len = m->m_len;
|
||||
if ((m->m_flags & M_EXT) == 0) {
|
||||
if (top) m_freem(top);
|
||||
return (0);
|
||||
}
|
||||
len = MCLBYTES;
|
||||
}
|
||||
bcopy(cp, mtod(m, caddr_t), (unsigned) len);
|
||||
cp += len;
|
||||
|
||||
if (mp == &top) {
|
||||
caddr_t newdata = (caddr_t)
|
||||
ALIGN(m->m_data + sizeof(struct ether_header)) -
|
||||
sizeof(struct ether_header);
|
||||
len -= newdata - m->m_data;
|
||||
m->m_data = newdata;
|
||||
}
|
||||
|
||||
m->m_len = len = min(datalen, len);
|
||||
|
||||
bcopy(pkt, mtod(m, caddr_t), (unsigned) len);
|
||||
pkt += len;
|
||||
datalen -= len;
|
||||
*mp = m;
|
||||
mp = &m->m_next;
|
||||
datalen -= len;
|
||||
if (cp == epkt)
|
||||
cp = spkt;
|
||||
}
|
||||
|
||||
return (top);
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
/* $NetBSD: if_snreg.h,v 1.4 2000/01/23 20:43:35 soda Exp $ */
|
||||
/* $NetBSD: if_snreg.h,v 1.5 2000/01/23 21:01:54 soda Exp $ */
|
||||
/* $OpenBSD: if_sn.h,v 1.1.1.1 1996/06/24 09:07:19 pefo Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991 Algorithmics Ltd (http://www.algor.co.uk)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lpt_lbus.c,v 1.7 2000/01/23 20:08:58 soda Exp $ */
|
||||
/* $OpenBSD: lpt_lbus.c,v 1.3 1997/04/10 16:29:17 pefo Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1993, 1994 Charles M. Hannum.
|
||||
@ -55,430 +55,133 @@
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/user.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/syslog.h>
|
||||
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/pio.h>
|
||||
#include <machine/autoconf.h>
|
||||
#include <machine/bus.h>
|
||||
#include <machine/intr.h>
|
||||
|
||||
#include <dev/isa/lptreg.h>
|
||||
#include <dev/ic/lptreg.h>
|
||||
#include <dev/ic/lptvar.h>
|
||||
|
||||
#define TIMEOUT hz*16 /* wait up to 16 seconds for a ready */
|
||||
#define STEP hz/4
|
||||
int lpt_localbus_probe __P((struct device *, struct cfdata *, void *));
|
||||
void lpt_localbus_attach __P((struct device *, struct device *, void *));
|
||||
|
||||
#define LPTPRI (PZERO+8)
|
||||
#define LPT_BSIZE 1024
|
||||
|
||||
#if !defined(DEBUG) || !defined(notdef)
|
||||
#define lprintf
|
||||
#else
|
||||
#define lprintf if (lptdebug) printf
|
||||
int lptdebug = 1;
|
||||
#endif
|
||||
|
||||
struct lpt_softc {
|
||||
struct device sc_dev;
|
||||
void *sc_ih;
|
||||
|
||||
size_t sc_count;
|
||||
struct buf *sc_inbuf;
|
||||
u_char *sc_cp;
|
||||
int sc_spinmax;
|
||||
int sc_iobase;
|
||||
u_char sc_state;
|
||||
#define LPT_OPEN 0x01 /* device is open */
|
||||
#define LPT_OBUSY 0x02 /* printer is busy doing output */
|
||||
#define LPT_INIT 0x04 /* waiting to initialize for open */
|
||||
u_char sc_flags;
|
||||
#define LPT_AUTOLF 0x20 /* automatic LF on CR */
|
||||
#define LPT_NOPRIME 0x40 /* don't prime on open */
|
||||
u_char sc_control;
|
||||
u_char sc_laststatus;
|
||||
struct cfattach lpt_pica_ca = {
|
||||
sizeof(struct lpt_softc), lpt_localbus_probe, lpt_localbus_attach
|
||||
};
|
||||
|
||||
int lptprobe __P((struct device *, void *, void *));
|
||||
void lptattach __P((struct device *, struct device *, void *));
|
||||
int lptintr __P((void *));
|
||||
|
||||
struct cfattach lpt_ca = {
|
||||
sizeof(struct lpt_softc), lptprobe, lptattach
|
||||
struct cfattach lpt_algor_ca = {
|
||||
sizeof(struct lpt_softc), lpt_localbus_probe, lpt_localbus_attach
|
||||
};
|
||||
|
||||
extern struct cfdriver lpt_cd;
|
||||
|
||||
#define LPTUNIT(s) (minor(s) & 0x1f)
|
||||
#define LPTFLAGS(s) (minor(s) & 0xe0)
|
||||
|
||||
#define LPS_INVERT (LPS_SELECT|LPS_NERR|LPS_NBSY|LPS_NACK)
|
||||
#define LPS_MASK (LPS_SELECT|LPS_NERR|LPS_NBSY|LPS_NACK|LPS_NOPAPER)
|
||||
#define NOT_READY() ((inb(iobase + lpt_status) ^ LPS_INVERT) & LPS_MASK)
|
||||
#define NOT_READY_ERR() not_ready(inb(iobase + lpt_status), sc)
|
||||
static int not_ready __P((u_char, struct lpt_softc *));
|
||||
|
||||
static void lptwakeup __P((void *arg));
|
||||
static int pushbytes __P((struct lpt_softc *));
|
||||
|
||||
/*
|
||||
* XXX - copied from lpt_isa.c
|
||||
* sys/arch/arm32/mainbus/lpt_pioc.c also copies this.
|
||||
* sys/arch/amiga/dev/lpt_supio.c doesn't.
|
||||
*/
|
||||
static int lpt_port_test __P((bus_space_tag_t, bus_space_handle_t, bus_addr_t,
|
||||
bus_size_t, u_char, u_char));
|
||||
/*
|
||||
* Internal routine to lptprobe to do port tests of one byte value.
|
||||
*/
|
||||
int
|
||||
lpt_port_test(port, data, mask)
|
||||
int port;
|
||||
static int
|
||||
lpt_port_test(iot, ioh, base, off, data, mask)
|
||||
bus_space_tag_t iot;
|
||||
bus_space_handle_t ioh;
|
||||
bus_addr_t base;
|
||||
bus_size_t off;
|
||||
u_char data, mask;
|
||||
{
|
||||
int timeout;
|
||||
u_char temp;
|
||||
|
||||
data &= mask;
|
||||
outb(port, data);
|
||||
bus_space_write_1(iot, ioh, off, data);
|
||||
timeout = 1000;
|
||||
do {
|
||||
delay(20);
|
||||
temp = inb(port) & mask;
|
||||
delay(10);
|
||||
temp = bus_space_read_1(iot, ioh, off) & mask;
|
||||
} while (temp != data && --timeout);
|
||||
lprintf("lpt: port=0x%x out=0x%x in=0x%x timeout=%d\n", port, data,
|
||||
temp, timeout);
|
||||
return (temp == data);
|
||||
}
|
||||
|
||||
/*
|
||||
* Logic:
|
||||
* 1) You should be able to write to and read back the same value
|
||||
* to the data port. Do an alternating zeros, alternating ones,
|
||||
* walking zero, and walking one test to check for stuck bits.
|
||||
*
|
||||
* 2) You should be able to write to and read back the same value
|
||||
* to the control port lower 5 bits, the upper 3 bits are reserved
|
||||
* per the IBM PC technical reference manauls and different boards
|
||||
* do different things with them. Do an alternating zeros, alternating
|
||||
* ones, walking zero, and walking one test to check for stuck bits.
|
||||
*
|
||||
* Some printers drag the strobe line down when the are powered off
|
||||
* so this bit has been masked out of the control port test.
|
||||
*
|
||||
* XXX Some printers may not like a fast pulse on init or strobe, I
|
||||
* don't know at this point, if that becomes a problem these bits
|
||||
* should be turned off in the mask byte for the control port test.
|
||||
*
|
||||
* 3) Set the data and control ports to a value of 0
|
||||
*/
|
||||
int
|
||||
lptprobe(parent, match, aux)
|
||||
lpt_localbus_probe(parent, match, aux)
|
||||
struct device *parent;
|
||||
void *match, *aux;
|
||||
struct cfdata *match;
|
||||
void *aux;
|
||||
{
|
||||
struct confargs *ca = aux;
|
||||
int iobase = (int)BUS_CVTADDR(ca);
|
||||
int port;
|
||||
u_char mask, data;
|
||||
bus_space_tag_t iot;
|
||||
bus_space_handle_t ioh;
|
||||
bus_addr_t base;
|
||||
u_int8_t mask, data;
|
||||
int i;
|
||||
|
||||
if (!BUS_MATCHNAME(ca, "lpt"))
|
||||
return (0);
|
||||
|
||||
#ifdef DEBUG
|
||||
#define ABORT do {printf("lptprobe: mask %x data %x failed\n", mask, data); \
|
||||
return 0;} while (0)
|
||||
#define ABORT \
|
||||
do { \
|
||||
printf("lpt_localbus_probe: mask %x data %x failed\n", mask, \
|
||||
data); \
|
||||
return 0; \
|
||||
} while (0)
|
||||
#else
|
||||
#define ABORT return 0
|
||||
#endif
|
||||
|
||||
port = iobase + lpt_data;
|
||||
if(!BUS_MATCHNAME(ca, "lpt"))
|
||||
return(0);
|
||||
|
||||
iot = &arc_bus_io;
|
||||
base = (bus_addr_t)BUS_CVTADDR(ca);
|
||||
ioh = (bus_space_handle_t)base;
|
||||
|
||||
mask = 0xff;
|
||||
|
||||
data = 0x55; /* Alternating zeros */
|
||||
if (!lpt_port_test(port, data, mask))
|
||||
if (!lpt_port_test(iot, ioh, base, lpt_data, data, mask))
|
||||
ABORT;
|
||||
|
||||
data = 0xaa; /* Alternating ones */
|
||||
if (!lpt_port_test(port, data, mask))
|
||||
if (!lpt_port_test(iot, ioh, base, lpt_data, data, mask))
|
||||
ABORT;
|
||||
|
||||
for (i = 0; i < CHAR_BIT; i++) { /* Walking zero */
|
||||
data = ~(1 << i);
|
||||
if (!lpt_port_test(port, data, mask))
|
||||
if (!lpt_port_test(iot, ioh, base, lpt_data, data, mask))
|
||||
ABORT;
|
||||
}
|
||||
|
||||
for (i = 0; i < CHAR_BIT; i++) { /* Walking one */
|
||||
data = (1 << i);
|
||||
if (!lpt_port_test(port, data, mask))
|
||||
if (!lpt_port_test(iot, ioh, base, lpt_data, data, mask))
|
||||
ABORT;
|
||||
}
|
||||
|
||||
outb(iobase + lpt_data, 0);
|
||||
outb(iobase + lpt_control, 0);
|
||||
bus_space_write_1(iot, ioh, lpt_data, 0);
|
||||
bus_space_write_1(iot, ioh, lpt_control, 0);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
lptattach(parent, self, aux)
|
||||
lpt_localbus_attach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
{
|
||||
struct lpt_softc *sc = (void *)self;
|
||||
struct confargs *ca = aux;
|
||||
int iobase = (int)BUS_CVTADDR(ca);
|
||||
bus_space_tag_t iot;
|
||||
bus_space_handle_t ioh;
|
||||
|
||||
printf("\n");
|
||||
|
||||
sc->sc_iobase = iobase;
|
||||
sc->sc_state = 0;
|
||||
outb(iobase + lpt_control, LPC_NINIT);
|
||||
iot = sc->sc_iot = &arc_bus_io;
|
||||
ioh = sc->sc_ioh = (bus_space_handle_t)BUS_CVTADDR(ca);
|
||||
|
||||
bus_space_write_1(iot, ioh, lpt_control, LPC_NINIT);
|
||||
|
||||
BUS_INTR_ESTABLISH(ca, lptintr, sc);
|
||||
}
|
||||
|
||||
/*
|
||||
* Reset the printer, then wait until it's selected and not busy.
|
||||
*/
|
||||
int
|
||||
lptopen(dev, flag)
|
||||
dev_t dev;
|
||||
int flag;
|
||||
{
|
||||
int unit = LPTUNIT(dev);
|
||||
u_char flags = LPTFLAGS(dev);
|
||||
struct lpt_softc *sc;
|
||||
int iobase;
|
||||
u_char control;
|
||||
int error;
|
||||
int spin;
|
||||
|
||||
if (unit >= lpt_cd.cd_ndevs)
|
||||
return ENXIO;
|
||||
sc = lpt_cd.cd_devs[unit];
|
||||
if (!sc)
|
||||
return ENXIO;
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
if (sc->sc_state)
|
||||
printf("%s: stat=0x%x not zero\n", sc->sc_dev.dv_xname,
|
||||
sc->sc_state);
|
||||
#endif
|
||||
|
||||
if (sc->sc_state)
|
||||
return EBUSY;
|
||||
|
||||
sc->sc_state = LPT_INIT;
|
||||
sc->sc_flags = flags;
|
||||
lprintf("%s: open: flags=0x%x\n", sc->sc_dev.dv_xname, flags);
|
||||
iobase = sc->sc_iobase;
|
||||
|
||||
if ((flags & LPT_NOPRIME) == 0) {
|
||||
/* assert INIT for 100 usec to start up printer */
|
||||
outb(iobase + lpt_control, LPC_SELECT);
|
||||
delay(100);
|
||||
}
|
||||
|
||||
control = LPC_SELECT | LPC_NINIT;
|
||||
outb(iobase + lpt_control, control);
|
||||
|
||||
/* wait till ready (printer running diagnostics) */
|
||||
for (spin = 0; NOT_READY_ERR(); spin += STEP) {
|
||||
if (spin >= TIMEOUT) {
|
||||
sc->sc_state = 0;
|
||||
return EBUSY;
|
||||
}
|
||||
|
||||
/* wait 1/4 second, give up if we get a signal */
|
||||
if (error = tsleep((caddr_t)sc, LPTPRI | PCATCH, "lptopen",
|
||||
STEP) != EWOULDBLOCK) {
|
||||
sc->sc_state = 0;
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
control |= LPC_IENABLE;
|
||||
if (flags & LPT_AUTOLF)
|
||||
control |= LPC_AUTOLF;
|
||||
sc->sc_control = control;
|
||||
outb(iobase + lpt_control, control);
|
||||
|
||||
sc->sc_inbuf = geteblk(LPT_BSIZE);
|
||||
sc->sc_count = 0;
|
||||
sc->sc_state = LPT_OPEN;
|
||||
|
||||
lptwakeup(sc);
|
||||
|
||||
lprintf("%s: opened\n", sc->sc_dev.dv_xname);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
not_ready(status, sc)
|
||||
u_char status;
|
||||
struct lpt_softc *sc;
|
||||
{
|
||||
u_char new;
|
||||
|
||||
status = (status ^ LPS_INVERT) & LPS_MASK;
|
||||
new = status & ~sc->sc_laststatus;
|
||||
sc->sc_laststatus = status;
|
||||
|
||||
if (new & LPS_SELECT)
|
||||
log(LOG_NOTICE, "%s: offline\n", sc->sc_dev.dv_xname);
|
||||
else if (new & LPS_NOPAPER)
|
||||
log(LOG_NOTICE, "%s: out of paper\n", sc->sc_dev.dv_xname);
|
||||
else if (new & LPS_NERR)
|
||||
log(LOG_NOTICE, "%s: output error\n", sc->sc_dev.dv_xname);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
void
|
||||
lptwakeup(arg)
|
||||
void *arg;
|
||||
{
|
||||
struct lpt_softc *sc = arg;
|
||||
int s;
|
||||
|
||||
s = spltty();
|
||||
lptintr(sc);
|
||||
splx(s);
|
||||
|
||||
timeout(lptwakeup, sc, STEP);
|
||||
}
|
||||
|
||||
/*
|
||||
* Close the device, and free the local line buffer.
|
||||
*/
|
||||
lptclose(dev, flag)
|
||||
dev_t dev;
|
||||
int flag;
|
||||
{
|
||||
int unit = LPTUNIT(dev);
|
||||
struct lpt_softc *sc = lpt_cd.cd_devs[unit];
|
||||
int iobase = sc->sc_iobase;
|
||||
|
||||
if (sc->sc_count)
|
||||
(void) pushbytes(sc);
|
||||
|
||||
untimeout(lptwakeup, sc);
|
||||
|
||||
outb(iobase + lpt_control, LPC_NINIT);
|
||||
sc->sc_state = 0;
|
||||
outb(iobase + lpt_control, LPC_NINIT);
|
||||
brelse(sc->sc_inbuf);
|
||||
|
||||
lprintf("%s: closed\n", sc->sc_dev.dv_xname);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
pushbytes(sc)
|
||||
struct lpt_softc *sc;
|
||||
{
|
||||
int iobase = sc->sc_iobase;
|
||||
int error;
|
||||
|
||||
int s;
|
||||
|
||||
while (sc->sc_count > 0) {
|
||||
/* if the printer is ready for a char, give it one */
|
||||
if ((sc->sc_state & LPT_OBUSY) == 0) {
|
||||
lprintf("%s: write %d\n", sc->sc_dev.dv_xname,
|
||||
sc->sc_count);
|
||||
s = spltty();
|
||||
(void) lptintr(sc);
|
||||
splx(s);
|
||||
}
|
||||
if (error = tsleep((caddr_t)sc, LPTPRI | PCATCH,
|
||||
"lptwrite2", 0))
|
||||
return error;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy a line from user space to a local buffer, then call putc to get the
|
||||
* chars moved to the output queue.
|
||||
*/
|
||||
lptwrite(dev, uio)
|
||||
dev_t dev;
|
||||
struct uio *uio;
|
||||
{
|
||||
struct lpt_softc *sc = lpt_cd.cd_devs[LPTUNIT(dev)];
|
||||
size_t n;
|
||||
int error = 0;
|
||||
|
||||
while (n = min(LPT_BSIZE, uio->uio_resid)) {
|
||||
uiomove(sc->sc_cp = sc->sc_inbuf->b_data, n, uio);
|
||||
sc->sc_count = n;
|
||||
error = pushbytes(sc);
|
||||
if (error) {
|
||||
/*
|
||||
* Return accurate residual if interrupted or timed
|
||||
* out.
|
||||
*/
|
||||
uio->uio_resid += sc->sc_count;
|
||||
sc->sc_count = 0;
|
||||
return error;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle printer interrupts which occur when the printer is ready to accept
|
||||
* another char.
|
||||
*/
|
||||
int
|
||||
lptintr(arg)
|
||||
void *arg;
|
||||
{
|
||||
struct lpt_softc *sc = arg;
|
||||
int iobase = sc->sc_iobase;
|
||||
|
||||
#if 0
|
||||
if ((sc->sc_state & LPT_OPEN) == 0)
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
/* is printer online and ready for output */
|
||||
if (NOT_READY() && NOT_READY_ERR())
|
||||
return 0;
|
||||
|
||||
if (sc->sc_count) {
|
||||
u_char control = sc->sc_control;
|
||||
/* send char */
|
||||
outb(iobase + lpt_data, *sc->sc_cp++);
|
||||
outb(iobase + lpt_control, control | LPC_STROBE);
|
||||
sc->sc_count--;
|
||||
outb(iobase + lpt_control, control);
|
||||
sc->sc_state |= LPT_OBUSY;
|
||||
} else
|
||||
sc->sc_state &= ~LPT_OBUSY;
|
||||
|
||||
if (sc->sc_count == 0) {
|
||||
/* none, wake up the top half to get more */
|
||||
wakeup((caddr_t)sc);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
lptioctl(dev, cmd, data, flag)
|
||||
dev_t dev;
|
||||
u_long cmd;
|
||||
caddr_t data;
|
||||
int flag;
|
||||
{
|
||||
int error = 0;
|
||||
|
||||
switch (cmd) {
|
||||
default:
|
||||
error = ENODEV;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: rd_root.c,v 1.1.1.1 2000/01/23 20:24:27 soda Exp $ */
|
||||
/* $NetBSD: rd_root.c,v 1.2 2000/01/23 21:01:54 soda Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Gordon W. Ross
|
||||
|
@ -1,4 +1,5 @@
|
||||
/* $NetBSD: scsi.h,v 1.3 2000/01/23 20:08:14 soda Exp $ */
|
||||
/* $NetBSD: scsi.h,v 1.4 2000/01/23 21:01:54 soda Exp $ */
|
||||
/* $OpenBSD: scsi.h,v 1.2 1997/04/19 17:19:54 pefo Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -547,12 +548,4 @@ struct scsi_fmt_sense {
|
||||
#define SDIOCSCSICOMMAND _IOW('S', 0x3, struct scsi_fmt_cdb)
|
||||
#define SDIOCSENSE _IOR('S', 0x4, struct scsi_fmt_sense)
|
||||
|
||||
#ifdef _KERNEL
|
||||
/*
|
||||
* Routines.
|
||||
*/
|
||||
extern void scsiGroup0Cmd();
|
||||
extern void scsiGroup1Cmd();
|
||||
#endif /* _KERNEL */
|
||||
|
||||
#endif /* _SCSI_H */
|
||||
|
@ -1,8 +1,10 @@
|
||||
/* $NetBSD: btl.c,v 1.1.1.1 2000/01/23 20:24:28 soda Exp $ */
|
||||
/* $NetBSD: btl.c,v 1.2 2000/01/23 21:01:55 soda Exp $ */
|
||||
|
||||
#undef BTDIAG
|
||||
#define integrate
|
||||
|
||||
#define notyet /* XXX - #undef this, if this driver does actually work */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1996 Charles M. Hannum. All rights reserved.
|
||||
*
|
||||
@ -64,8 +66,9 @@
|
||||
|
||||
#include <arc/dti/desktech.h>
|
||||
|
||||
#include <scsi/scsi_all.h>
|
||||
#include <scsi/scsiconf.h>
|
||||
#include <dev/scsipi/scsi_all.h>
|
||||
#include <dev/scsipi/scsipi_all.h>
|
||||
#include <dev/scsipi/scsiconf.h>
|
||||
|
||||
#include <dev/isa/isavar.h>
|
||||
#include <arc/dti/btlreg.h>
|
||||
@ -107,16 +110,8 @@ extern int cputype; /* XXX */
|
||||
#define PHYSTOKV(x) ((cputype == DESKSTATION_TYNE) ? \
|
||||
(((int)(x) & 0x7fffff) | TYNE_V_BOUNCE) : ((int)(x)))
|
||||
|
||||
#include "aha.h"
|
||||
#include "btl.h"
|
||||
#if NAHA > 0
|
||||
int btports[NBT];
|
||||
int nbtports;
|
||||
#endif
|
||||
|
||||
struct bt_softc {
|
||||
struct device sc_dev;
|
||||
struct isadev sc_id;
|
||||
void *sc_ih;
|
||||
|
||||
int sc_iobase;
|
||||
@ -133,7 +128,8 @@ struct bt_softc {
|
||||
int sc_numccbs, sc_mbofull;
|
||||
int sc_numbufs;
|
||||
int sc_scsi_dev; /* adapters scsi id */
|
||||
struct scsi_link sc_link; /* prototype for devs */
|
||||
struct scsipi_link sc_link; /* prototype for devs */
|
||||
struct scsipi_adapter sc_adapter;
|
||||
};
|
||||
|
||||
#ifdef BTDEBUG
|
||||
@ -156,32 +152,25 @@ int bt_find __P((struct isa_attach_args *, struct bt_softc *));
|
||||
void bt_init __P((struct bt_softc *));
|
||||
void bt_inquire_setup_information __P((struct bt_softc *));
|
||||
void btminphys __P((struct buf *));
|
||||
int bt_scsi_cmd __P((struct scsi_xfer *));
|
||||
int bt_poll __P((struct bt_softc *, struct scsi_xfer *, int));
|
||||
int bt_scsi_cmd __P((struct scsipi_xfer *));
|
||||
int bt_poll __P((struct bt_softc *, struct scsipi_xfer *, int));
|
||||
void bt_timeout __P((void *arg));
|
||||
void bt_free_buf __P((struct bt_softc *, struct bt_buf *));
|
||||
struct bt_buf * bt_get_buf __P((struct bt_softc *, int));
|
||||
|
||||
struct scsi_adapter bt_switch = {
|
||||
bt_scsi_cmd,
|
||||
btminphys,
|
||||
0,
|
||||
0,
|
||||
};
|
||||
|
||||
/* XXX static buffer as a kludge. DMA isn't cache coherent on the rpc44, so
|
||||
* we always use uncached buffers for DMA. */
|
||||
static char rpc44_buffer[ TYNE_S_BOUNCE ];
|
||||
|
||||
/* the below structure is so we have a default dev struct for out link struct */
|
||||
struct scsi_device bt_dev = {
|
||||
struct scsipi_device bt_dev = {
|
||||
NULL, /* Use default error handler */
|
||||
NULL, /* have a queue, served by this */
|
||||
NULL, /* have no async handler */
|
||||
NULL, /* Use default 'done' routine */
|
||||
};
|
||||
|
||||
int btprobe __P((struct device *, void *, void *));
|
||||
int btprobe __P((struct device *, struct cfdata *, void *));
|
||||
void btattach __P((struct device *, struct device *, void *));
|
||||
int btprint __P((void *, const char *));
|
||||
|
||||
@ -189,10 +178,6 @@ struct cfattach btl_ca = {
|
||||
sizeof(struct bt_softc), btprobe, btattach
|
||||
};
|
||||
|
||||
struct cfdriver btl_cd = {
|
||||
NULL, "bt", DV_DULL
|
||||
};
|
||||
|
||||
#define BT_RESET_TIMEOUT 2000 /* time to wait for reset (mSec) */
|
||||
#define BT_ABORT_TIMEOUT 2000 /* time to wait for abort (mSec) */
|
||||
|
||||
@ -338,7 +323,8 @@ bt_cmd(iobase, sc, icnt, ibuf, ocnt, obuf)
|
||||
int
|
||||
btprobe(parent, match, aux)
|
||||
struct device *parent;
|
||||
void *match, *aux;
|
||||
struct cfdata *match;
|
||||
void *aux;
|
||||
{
|
||||
register struct isa_attach_args *ia = aux;
|
||||
|
||||
@ -357,17 +343,6 @@ btprobe(parent, match, aux)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
btprint(aux, name)
|
||||
void *aux;
|
||||
const char *name;
|
||||
{
|
||||
|
||||
if (name != NULL)
|
||||
printf("%s: scsibus ", name);
|
||||
return UNCONF;
|
||||
}
|
||||
|
||||
/*
|
||||
* Attach all the sub-devices we can find
|
||||
*/
|
||||
@ -428,24 +403,30 @@ btattach(parent, self, aux)
|
||||
sc->sc_numbufs++;
|
||||
}
|
||||
/*
|
||||
* fill in the prototype scsi_link.
|
||||
* Fill in the adapter.
|
||||
*/
|
||||
sc->sc_adapter.scsipi_cmd = bt_scsi_cmd;
|
||||
sc->sc_adapter.scsipi_minphys = btminphys;
|
||||
/*
|
||||
* fill in the prototype scsipi_link.
|
||||
*/
|
||||
sc->sc_link.scsipi_scsi.channel = SCSI_CHANNEL_ONLY_ONE;
|
||||
sc->sc_link.adapter_softc = sc;
|
||||
sc->sc_link.adapter_target = sc->sc_scsi_dev;
|
||||
sc->sc_link.adapter = &bt_switch;
|
||||
sc->sc_link.scsipi_scsi.adapter_target = sc->sc_scsi_dev;
|
||||
sc->sc_link.adapter = &sc->sc_adapter;
|
||||
sc->sc_link.device = &bt_dev;
|
||||
sc->sc_link.openings = 1;
|
||||
sc->sc_link.scsipi_scsi.max_target = 7;
|
||||
sc->sc_link.scsipi_scsi.max_lun = 7;
|
||||
sc->sc_link.type = BUS_SCSI;
|
||||
|
||||
#ifdef NEWCONFIG
|
||||
isa_establish(&sc->sc_id, &sc->sc_dev);
|
||||
#endif
|
||||
sc->sc_ih = isa_intr_establish(ia->ia_ic, sc->sc_irq, IST_EDGE,
|
||||
IPL_BIO, btintr, sc, sc->sc_dev.dv_xname);
|
||||
IPL_BIO, btintr, sc);
|
||||
|
||||
/*
|
||||
* ask the adapter what subunits are present
|
||||
*/
|
||||
config_found(self, &sc->sc_link, btprint);
|
||||
config_found(self, &sc->sc_link, scsiprint);
|
||||
}
|
||||
|
||||
integrate void
|
||||
@ -666,9 +647,9 @@ bt_init_ccb(sc, ccb)
|
||||
* If there are none, either return an error or sleep.
|
||||
*/
|
||||
struct bt_ccb *
|
||||
bt_get_ccb(sc, flags)
|
||||
bt_get_ccb(sc, nosleep)
|
||||
struct bt_softc *sc;
|
||||
int flags;
|
||||
int nosleep;
|
||||
{
|
||||
struct bt_ccb *ccb;
|
||||
int s;
|
||||
@ -684,7 +665,7 @@ bt_get_ccb(sc, flags)
|
||||
TAILQ_REMOVE(&sc->sc_free_ccb, ccb, chain);
|
||||
break;
|
||||
}
|
||||
if ((flags & SCSI_NOSLEEP) != 0)
|
||||
if (nosleep)
|
||||
goto out;
|
||||
tsleep(&sc->sc_free_ccb, PRIBIO, "btccb", 0);
|
||||
}
|
||||
@ -702,9 +683,9 @@ out:
|
||||
* If there are none, either return an error or sleep.
|
||||
*/
|
||||
struct bt_buf *
|
||||
bt_get_buf(sc, flags)
|
||||
bt_get_buf(sc, nosleep)
|
||||
struct bt_softc *sc;
|
||||
int flags;
|
||||
int nosleep;
|
||||
{
|
||||
struct bt_buf *buf;
|
||||
int s;
|
||||
@ -721,7 +702,7 @@ bt_get_buf(sc, flags)
|
||||
sc->sc_numbufs--;
|
||||
break;
|
||||
}
|
||||
if ((flags & SCSI_NOSLEEP) != 0)
|
||||
if (nosleep)
|
||||
goto out;
|
||||
tsleep(&sc->sc_free_buf, PRIBIO, "btbuf", 0);
|
||||
}
|
||||
@ -832,7 +813,7 @@ bt_start_ccbs(sc)
|
||||
/* Tell the card to poll immediately. */
|
||||
isa_outb(iobase + BT_CMD_PORT, BT_START_SCSI);
|
||||
|
||||
if ((ccb->xs->flags & SCSI_POLL) == 0)
|
||||
if ((ccb->xs->xs_control & XS_CTL_POLL) == 0)
|
||||
timeout(bt_timeout, ccb, (ccb->timeout * hz) / 1000);
|
||||
|
||||
++sc->sc_mbofull;
|
||||
@ -852,8 +833,8 @@ bt_done(sc, ccb)
|
||||
struct bt_softc *sc;
|
||||
struct bt_ccb *ccb;
|
||||
{
|
||||
struct scsi_sense_data *s1, *s2;
|
||||
struct scsi_xfer *xs = ccb->xs;
|
||||
struct scsipi_sense_data *s1, *s2;
|
||||
struct scsipi_xfer *xs = ccb->xs;
|
||||
|
||||
u_long thiskv, thisbounce;
|
||||
int bytes_this_page, datalen;
|
||||
@ -893,7 +874,7 @@ bt_done(sc, ccb)
|
||||
switch (ccb->target_stat) {
|
||||
case SCSI_CHECK:
|
||||
s1 = &ccb->scsi_sense;
|
||||
s2 = &xs->sense;
|
||||
s2 = &xs->sense.scsi_sense;
|
||||
*s2 = *s1;
|
||||
xs->error = XS_SENSE;
|
||||
break;
|
||||
@ -918,7 +899,7 @@ bt_done(sc, ccb)
|
||||
while (seg) {
|
||||
thisbounce = PHYSTOKV(phystol(sg->seg_addr));
|
||||
bytes_this_page = phystol(sg->seg_len);
|
||||
if(xs->flags & SCSI_DATA_IN) {
|
||||
if(xs->xs_control & XS_CTL_DATA_IN) {
|
||||
bcopy((void *)thisbounce, (void *)thiskv, bytes_this_page);
|
||||
}
|
||||
bt_free_buf(sc, (struct bt_buf *)thisbounce);
|
||||
@ -931,8 +912,8 @@ bt_done(sc, ccb)
|
||||
}
|
||||
|
||||
bt_free_ccb(sc, ccb);
|
||||
xs->flags |= ITSDONE;
|
||||
scsi_done(xs);
|
||||
xs->xs_status |= XS_STS_DONE;
|
||||
scsipi_done(xs);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -950,6 +931,13 @@ bt_find(ia, sc)
|
||||
struct bt_config config;
|
||||
int irq, drq;
|
||||
|
||||
#ifndef notyet
|
||||
/* Check something is at the ports we need to access */
|
||||
sts = isa_inb(iobase + BHA_STAT_PORT);
|
||||
if (sts == 0xFF)
|
||||
return (0);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* reset board, If it doesn't respond, assume
|
||||
* that it's not there.. good for the probe
|
||||
@ -972,6 +960,26 @@ bt_find(ia, sc)
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifndef notyet
|
||||
/*
|
||||
* The BusLogic cards implement an Adaptec 1542 (aha)-compatible
|
||||
* interface. The native bha interface is not compatible with
|
||||
* an aha. 1542. We need to ensure that we never match an
|
||||
* Adaptec 1542. We must also avoid sending Adaptec-compatible
|
||||
* commands to a real bha, lest it go into 1542 emulation mode.
|
||||
* (On an indirect bus like ISA, we should always probe for BusLogic
|
||||
* interfaces before Adaptec interfaces).
|
||||
*/
|
||||
|
||||
/*
|
||||
* Make sure we don't match an AHA-1542A or AHA-1542B, by checking
|
||||
* for an extended-geometry register. The 1542[AB] don't have one.
|
||||
*/
|
||||
sts = isa_inb(iobase + BT_EXTGEOM_PORT);
|
||||
if (sts == 0xFF)
|
||||
return (0);
|
||||
#endif /* notyet */
|
||||
|
||||
/*
|
||||
* Check that we actually know how to use this board.
|
||||
*/
|
||||
@ -979,8 +987,27 @@ bt_find(ia, sc)
|
||||
bzero(&inquire, sizeof inquire);
|
||||
inquire.cmd.opcode = BT_INQUIRE_EXTENDED;
|
||||
inquire.cmd.len = sizeof(inquire.reply);
|
||||
bt_cmd(iobase, sc, sizeof(inquire.cmd), (u_char *)&inquire.cmd,
|
||||
i = bt_cmd(iobase, sc, sizeof(inquire.cmd), (u_char *)&inquire.cmd,
|
||||
sizeof(inquire.reply), (u_char *)&inquire.reply);
|
||||
|
||||
#ifndef notyet
|
||||
/*
|
||||
* Some 1542Cs (CP, perhaps not CF, may depend on firmware rev)
|
||||
* have the extended-geometry register and also respond to
|
||||
* BHA_INQUIRE_EXTENDED. Make sure we never match such cards,
|
||||
* by checking the size of the reply is what a BusLogic card returns.
|
||||
*/
|
||||
if (i) { /* XXX - this doesn't really check the size. ??? see bha.c */
|
||||
#ifdef BTDEBUG
|
||||
printf("bt_find: board returned %d instead of %d to %s\n",
|
||||
i, sizeof(inquire.reply), "INQUIRE_EXTENDED");
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* OK, we know we've found a buslogic adaptor. */
|
||||
#endif /* notyet */
|
||||
|
||||
switch (inquire.reply.bus_type) {
|
||||
case BT_BUS_TYPE_24BIT:
|
||||
case BT_BUS_TYPE_32BIT:
|
||||
@ -993,16 +1020,6 @@ bt_find(ia, sc)
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if NAHA > 0
|
||||
/* Adaptec 1542 cards do not support this */
|
||||
digit.reply.digit = '@';
|
||||
digit.cmd.opcode = BT_INQUIRE_REVISION_3;
|
||||
bt_cmd(iobase, sc, sizeof(digit.cmd), (u_char *)&digit.cmd,
|
||||
sizeof(digit.reply), (u_char *)&digit.reply);
|
||||
if (digit.reply.digit == '@')
|
||||
return 1;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Assume we have a board at this stage setup dma channel from
|
||||
* jumpers and save int level
|
||||
@ -1074,10 +1091,6 @@ bt_find(ia, sc)
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if NAHA > 0
|
||||
/* XXXX To avoid conflicting with the aha1542 probe */
|
||||
btports[nbtports++] = iobase;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1236,15 +1249,15 @@ btminphys(bp)
|
||||
*/
|
||||
int
|
||||
bt_scsi_cmd(xs)
|
||||
struct scsi_xfer *xs;
|
||||
struct scsipi_xfer *xs;
|
||||
{
|
||||
struct scsi_link *sc_link = xs->sc_link;
|
||||
struct scsipi_link *sc_link = xs->sc_link;
|
||||
struct bt_softc *sc = sc_link->adapter_softc;
|
||||
struct bt_ccb *ccb;
|
||||
struct bt_scat_gath *sg;
|
||||
int seg; /* scatter gather seg being worked on */
|
||||
u_long thiskv, thisbounce;
|
||||
int bytes_this_page, datalen, flags;
|
||||
int bytes_this_page, datalen, control;
|
||||
int s;
|
||||
|
||||
SC_DEBUG(sc_link, SDEV_DB2, ("bt_scsi_cmd\n"));
|
||||
@ -1253,8 +1266,8 @@ bt_scsi_cmd(xs)
|
||||
* is from a buf (possibly from interrupt time)
|
||||
* then we can't allow it to sleep
|
||||
*/
|
||||
flags = xs->flags;
|
||||
if ((ccb = bt_get_ccb(sc, flags)) == NULL) {
|
||||
control = xs->xs_control;
|
||||
if ((ccb = bt_get_ccb(sc, control & XS_CTL_NOSLEEP)) == NULL) {
|
||||
xs->error = XS_DRIVER_STUFFUP;
|
||||
return TRY_AGAIN_LATER;
|
||||
}
|
||||
@ -1264,7 +1277,7 @@ bt_scsi_cmd(xs)
|
||||
/*
|
||||
* Put all the arguments for the xfer in the ccb
|
||||
*/
|
||||
if (flags & SCSI_RESET) {
|
||||
if (control & XS_CTL_RESET) {
|
||||
ccb->opcode = BT_RESET_CCB;
|
||||
ccb->scsi_cmd_length = 0;
|
||||
} else {
|
||||
@ -1290,12 +1303,13 @@ bt_scsi_cmd(xs)
|
||||
while (datalen && seg < BT_NSEG) {
|
||||
|
||||
/* put in the base address of a buf */
|
||||
thisbounce = (u_long)bt_get_buf(sc, flags);
|
||||
thisbounce = (u_long)
|
||||
bt_get_buf(sc, control & XS_CTL_NOSLEEP);
|
||||
if(thisbounce == 0)
|
||||
break;
|
||||
ltophys(KVTOPHYS(thisbounce), sg->seg_addr);
|
||||
bytes_this_page = min(sizeof(struct bt_buf), datalen);
|
||||
if(flags & SCSI_DATA_OUT) {
|
||||
if (control & XS_CTL_DATA_OUT) {
|
||||
bcopy((void *)thiskv, (void *)thisbounce, bytes_this_page);
|
||||
}
|
||||
thiskv += bytes_this_page;
|
||||
@ -1320,8 +1334,8 @@ bt_scsi_cmd(xs)
|
||||
|
||||
ccb->data_out = 0;
|
||||
ccb->data_in = 0;
|
||||
ccb->target = sc_link->target;
|
||||
ccb->lun = sc_link->lun;
|
||||
ccb->target = sc_link->scsipi_scsi.target;
|
||||
ccb->lun = sc_link->scsipi_scsi.lun;
|
||||
ltophys(KVTOPHYS(&ccb->scsi_sense), ccb->sense_ptr);
|
||||
ccb->req_sense_length = sizeof(ccb->scsi_sense);
|
||||
ccb->host_stat = 0x00;
|
||||
@ -1337,7 +1351,7 @@ bt_scsi_cmd(xs)
|
||||
* Usually return SUCCESSFULLY QUEUED
|
||||
*/
|
||||
SC_DEBUG(sc_link, SDEV_DB3, ("cmd_sent\n"));
|
||||
if ((flags & SCSI_POLL) == 0)
|
||||
if ((control & XS_CTL_POLL) == 0)
|
||||
return SUCCESSFULLY_QUEUED;
|
||||
|
||||
/*
|
||||
@ -1369,7 +1383,7 @@ badbuf:
|
||||
int
|
||||
bt_poll(sc, xs, count)
|
||||
struct bt_softc *sc;
|
||||
struct scsi_xfer *xs;
|
||||
struct scsipi_xfer *xs;
|
||||
int count;
|
||||
{
|
||||
int iobase = sc->sc_iobase;
|
||||
@ -1382,7 +1396,7 @@ bt_poll(sc, xs, count)
|
||||
*/
|
||||
if (isa_inb(iobase + BT_INTR_PORT) & BT_INTR_ANYINTR)
|
||||
btintr(sc);
|
||||
if (xs->flags & ITSDONE)
|
||||
if (xs->xs_status & XS_STS_DONE)
|
||||
return 0;
|
||||
delay(1000); /* only happens in boot so ok */
|
||||
count--;
|
||||
@ -1395,12 +1409,12 @@ bt_timeout(arg)
|
||||
void *arg;
|
||||
{
|
||||
struct bt_ccb *ccb = arg;
|
||||
struct scsi_xfer *xs = ccb->xs;
|
||||
struct scsi_link *sc_link = xs->sc_link;
|
||||
struct scsipi_xfer *xs = ccb->xs;
|
||||
struct scsipi_link *sc_link = xs->sc_link;
|
||||
struct bt_softc *sc = sc_link->adapter_softc;
|
||||
int s;
|
||||
|
||||
sc_print_addr(sc_link);
|
||||
scsi_print_addr(sc_link);
|
||||
printf("timed out");
|
||||
|
||||
s = splbio();
|
||||
|
@ -131,14 +131,14 @@ struct bt_ccb {
|
||||
/*------------------------------------longword boundary */
|
||||
physaddr sense_ptr;
|
||||
/*-----end of HW fields-----------------------longword boundary */
|
||||
struct scsi_sense_data scsi_sense;
|
||||
struct scsipi_sense_data scsi_sense;
|
||||
/*------------------------------------longword boundary */
|
||||
struct bt_scat_gath scat_gath[BT_NSEG];
|
||||
/*------------------------------------longword boundary */
|
||||
TAILQ_ENTRY(bt_ccb) chain;
|
||||
struct bt_ccb *nexthash;
|
||||
long hashkey;
|
||||
struct scsi_xfer *xs; /* the scsi_xfer for this cmd */
|
||||
struct scsipi_xfer *xs; /* the scsi_xfer for this cmd */
|
||||
int flags;
|
||||
#define CCB_ALLOC 0x01
|
||||
#define CCB_ABORT 0x02
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* $NetBSD: desktech.h,v 1.2 2000/01/23 21:01:55 soda Exp $ */
|
||||
/* $OpenBSD: desktech.h,v 1.4 1996/10/01 20:50:12 pefo Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -1,7 +1,7 @@
|
||||
# $NetBSD: Makefile,v 1.8 2000/01/23 20:08:45 soda Exp $
|
||||
# $NetBSD: Makefile,v 1.9 2000/01/23 21:01:55 soda Exp $
|
||||
|
||||
KDIR= /sys/arch/pica/include
|
||||
INCSDIR= /usr/include/pica
|
||||
KDIR= /sys/arch/arc/include
|
||||
INCSDIR= /usr/include/arc
|
||||
|
||||
INCS= ansi.h aout_machdep.h asm.h autoconf.h bswap.h bsd-aout.h bus.h \
|
||||
cdefs.h cpu.h disklabel.h display.h ecoff_machdep.h \
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* $NetBSD: ansi.h,v 1.4 2000/01/23 20:08:15 soda Exp $ */
|
||||
/* $NetBSD: ansi.h,v 1.5 2000/01/23 21:01:55 soda Exp $ */
|
||||
/* $OpenBSD: ansi.h,v 1.2 1997/04/20 20:46:40 tholo Exp $ */
|
||||
/* NetBSD: ansi.h,v 1.5 1994/10/26 21:09:33 cgd Exp */
|
||||
|
||||
#include <mips/ansi.h>
|
||||
|
@ -1,3 +1,3 @@
|
||||
/* $NetBSD: aout_machdep.h,v 1.4 2000/01/23 20:08:46 soda Exp $ */
|
||||
/* $NetBSD: aout_machdep.h,v 1.5 2000/01/23 21:01:55 soda Exp $ */
|
||||
|
||||
#include <mips/aout_machdep.h>
|
||||
|
@ -1,3 +1,3 @@
|
||||
/* $NetBSD: asm.h,v 1.7 2000/01/23 20:08:17 soda Exp $ */
|
||||
/* $NetBSD: asm.h,v 1.8 2000/01/23 21:01:55 soda Exp $ */
|
||||
|
||||
#include <mips/asm.h>
|
||||
|
@ -1,4 +1,6 @@
|
||||
/* $NetBSD: autoconf.h,v 1.5 2000/01/23 20:08:17 soda Exp $ */
|
||||
/* $NetBSD: autoconf.h,v 1.6 2000/01/23 21:01:55 soda Exp $ */
|
||||
/* $OpenBSD: autoconf.h,v 1.2 1997/03/12 19:16:54 pefo Exp $ */
|
||||
/* NetBSD: autoconf.h,v 1.1 1995/02/13 23:07:31 cgd Exp */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
|
||||
@ -31,6 +33,9 @@
|
||||
* Machine-dependent structures of autoconfiguration
|
||||
*/
|
||||
|
||||
#ifndef _ARC_AUTOCONF_H_
|
||||
#define _ARC_AUTOCONF_H_
|
||||
|
||||
struct confargs;
|
||||
|
||||
typedef int (*intr_handler_t) __P((void *));
|
||||
@ -50,8 +55,9 @@ struct abus {
|
||||
|
||||
#define BUS_MAIN 1 /* mainbus */
|
||||
#define BUS_PICA 2 /* PICA Bus */
|
||||
#define BUS_ASIC 3 /* IOCTL ASIC; under TurboChannel */
|
||||
#define BUS_TCDS 4 /* TCDS ASIC; under TurboChannel */
|
||||
#define BUS_ISABR 3 /* ISA Bridge Bus */
|
||||
#define BUS_ALGOR 4 /* Algorithmics local bus */
|
||||
#define BUS_PCIBR 5 /* Algorithmics PCI bridge */
|
||||
|
||||
#define BUS_INTR_ESTABLISH(ca, handler, val) \
|
||||
(*(ca)->ca_bus->ab_intr_establish)((ca), (handler), (val))
|
||||
@ -71,7 +77,7 @@ struct confargs {
|
||||
|
||||
void set_clockintr __P((void (*)(struct clockframe *)));
|
||||
void set_iointr __P((void (*)(void *, int)));
|
||||
int badaddr __P((void *, u_int64_t));
|
||||
|
||||
int initcpu __P((void));
|
||||
void initcpu __P((void));
|
||||
void makebootdev __P((char *cp));
|
||||
#endif /* _ARC_AUTOCONF_H_ */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: bsd-aout.h,v 1.3 2000/01/23 20:08:46 soda Exp $ */
|
||||
/* $NetBSD: bsd-aout.h,v 1.4 2000/01/23 21:01:55 soda Exp $ */
|
||||
|
||||
/* bsd-aout.h
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
/* from $NetBSD: bswap.h,v 1.2 2000/01/23 20:08:47 soda Exp $ */
|
||||
/* $NetBSD: bswap.h,v 1.3 2000/01/23 21:01:56 soda Exp $ */
|
||||
|
||||
#include <mips/bswap.h>
|
||||
|
@ -1,8 +1,9 @@
|
||||
/* $NetBSD: bus.h,v 1.4 2000/01/23 20:08:18 soda Exp $ */
|
||||
/* $NetBSD: bus.h,v 1.5 2000/01/23 21:01:56 soda Exp $ */
|
||||
/* $OpenBSD: bus.h,v 1.13 1997/04/19 17:19:56 pefo Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Jonathan Stone (hereinafter referred to as the author)
|
||||
* All rights reserved.
|
||||
* Copyright (c) 1997 Per Fogelstrom. All rights reserved.
|
||||
* Copyright (c) 1996 Niklas Hallqvist. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@ -14,49 +15,172 @@
|
||||
* 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 Jonathan Stone for
|
||||
* the NetBSD Project.
|
||||
* This product includes software developed by Christopher G. Demetriou
|
||||
* for the NetBSD Project.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PICA_BUS_H_
|
||||
#define _PICA_BUS_H_
|
||||
#ifndef _ARC_BUS_H_
|
||||
#define _ARC_BUS_H_
|
||||
|
||||
/*
|
||||
* ISA "I/O space" macros
|
||||
*/
|
||||
#include <mips/locore.h>
|
||||
#include <machine/pio.h>
|
||||
|
||||
/*
|
||||
* I/O addresses (in bus space)
|
||||
*/
|
||||
typedef u_int32_t bus_io_addr_t;
|
||||
typedef u_int32_t bus_io_size_t;
|
||||
#ifdef __STDC__
|
||||
#define CAT(a,b) a##b
|
||||
#define CAT3(a,b,c) a##b##c
|
||||
#else
|
||||
#define CAT(a,b) a/**/b
|
||||
#define CAT3(a,b,c) a/**/b/**/c
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Memory addresses (in bus space)
|
||||
* Bus access types.
|
||||
*/
|
||||
typedef u_int32_t bus_mem_addr_t;
|
||||
typedef u_int32_t bus_mem_size_t;
|
||||
typedef u_int32_t bus_addr_t;
|
||||
typedef u_int32_t bus_size_t;
|
||||
typedef u_int32_t bus_space_handle_t;
|
||||
typedef struct arc_bus_space *bus_space_tag_t;
|
||||
#if 1 /* XXX - <dev/isa/isavar.h> requires these types, not actually defined */
|
||||
typedef int bus_dma_tag_t;
|
||||
typedef int bus_dmamap_t;
|
||||
#endif
|
||||
|
||||
struct arc_bus_space {
|
||||
u_int32_t bus_base;
|
||||
u_int8_t bus_sparse1; /* Sparse addressing shift count */
|
||||
u_int8_t bus_sparse2; /* Sparse addressing shift count */
|
||||
u_int8_t bus_sparse4; /* Sparse addressing shift count */
|
||||
u_int8_t bus_sparse8; /* Sparse addressing shift count */
|
||||
};
|
||||
|
||||
#define BUS_SPACE_ALIGNED_POINTER(p, t) ALIGNED_POINTER(p, t)
|
||||
|
||||
extern struct arc_bus_space arc_bus_io, arc_bus_mem;
|
||||
|
||||
/*
|
||||
* Access methods for bus resources, I/O space, and memory space.
|
||||
* Access methods for bus resources
|
||||
*/
|
||||
typedef void *bus_chipset_tag_t;
|
||||
typedef u_int32_t bus_io_handle_t;
|
||||
typedef caddr_t bus_mem_handle_t;
|
||||
#define bus_space_map(t, addr, size, cacheable, bshp) \
|
||||
((*(bshp) = (t)->bus_base + (addr)), 0)
|
||||
#define bus_space_subregion(t, bsh, offset, size, nbshp) \
|
||||
((*(nbshp) = (bsh) + (offset)), 0)
|
||||
|
||||
#endif /* _PICA_BUS_H_ */
|
||||
#define bus_space_unmap(t, bsh, size)
|
||||
|
||||
#define bus_space_read(n,m) \
|
||||
static __inline CAT3(u_int,m,_t) \
|
||||
CAT(bus_space_read_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \
|
||||
bus_addr_t ba) \
|
||||
{ \
|
||||
return *(volatile CAT3(u_int,m,_t) *)(bsh + ((ba) << CAT(bst->bus_sparse,n))); \
|
||||
}
|
||||
|
||||
bus_space_read(1,8)
|
||||
bus_space_read(2,16)
|
||||
bus_space_read(4,32)
|
||||
|
||||
#define bus_space_read_8 !!! bus_space_read_8 unimplemented !!!
|
||||
|
||||
#define bus_space_read_multi_1(t, h, o, a, c) do { \
|
||||
insb((u_int8_t *)((h) + (o)), (a), (c)); \
|
||||
} while(0)
|
||||
|
||||
#define bus_space_read_multi_2(t, h, o, a, c) do { \
|
||||
insw((u_int16_t *)((h) + (o)), (a), (c)); \
|
||||
} while(0)
|
||||
|
||||
#define bus_space_read_multi_4(t, h, o, a, c) do { \
|
||||
insl((u_int32_t *)((h) + (o)), (a), (c)); \
|
||||
} while(0)
|
||||
|
||||
#define bus_space_read_multi_8 !!! bus_space_read_multi_8 not implemented !!!
|
||||
|
||||
#define bus_space_write(n,m) \
|
||||
static __inline void \
|
||||
CAT(bus_space_write_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \
|
||||
bus_addr_t ba, CAT3(u_int,m,_t) x) \
|
||||
{ \
|
||||
*(volatile CAT3(u_int,m,_t) *)(bsh + ((ba) << CAT(bst->bus_sparse,n))) = x; \
|
||||
}
|
||||
|
||||
bus_space_write(1,8)
|
||||
bus_space_write(2,16)
|
||||
bus_space_write(4,32)
|
||||
|
||||
#define bus_space_write_8 !!! bus_space_write_8 unimplemented !!!
|
||||
|
||||
|
||||
#define bus_space_write_multi_1(t, h, o, a, c) do { \
|
||||
outsb((u_int8_t *)((h) + (o)), (a), (c)); \
|
||||
} while(0)
|
||||
|
||||
#define bus_space_write_multi_2(t, h, o, a, c) do { \
|
||||
outsw((u_int16_t *)((h) + (o)), (a), (c)); \
|
||||
} while(0)
|
||||
|
||||
#define bus_space_write_multi_4(t, h, o, a, c) do { \
|
||||
outsl((u_int32_t *)((h) + (o)), (a), (c)); \
|
||||
} while(0)
|
||||
|
||||
#define bus_space_write_multi_8 !!! bus_space_write_multi_8 not implemented !!!
|
||||
|
||||
/* These are OpenBSD extensions to the general NetBSD bus interface. */
|
||||
#define bus_space_read_raw_multi(n,m,l) \
|
||||
static __inline void \
|
||||
CAT(bus_space_read_raw_multi_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \
|
||||
bus_addr_t ba, u_int8_t *buf, bus_size_t cnt) \
|
||||
{ \
|
||||
CAT(bus_space_read_multi_,n)(bst, bsh, ba, (CAT3(u_int,m,_t) *)buf, \
|
||||
cnt >> l); \
|
||||
}
|
||||
|
||||
bus_space_read_raw_multi(2,16,1)
|
||||
bus_space_read_raw_multi(4,32,2)
|
||||
|
||||
#define bus_space_read_raw_multi_8 \
|
||||
!!! bus_space_read_raw_multi_8 not implemented !!!
|
||||
|
||||
#define bus_space_write_raw_multi(n,m,l) \
|
||||
static __inline void \
|
||||
CAT(bus_space_write_raw_multi_,n)(bus_space_tag_t bst, bus_space_handle_t bsh,\
|
||||
bus_addr_t ba, const u_int8_t *buf, bus_size_t cnt) \
|
||||
{ \
|
||||
CAT(bus_space_write_multi_,n)(bst, bsh, ba, \
|
||||
(const CAT3(u_int,m,_t) *)buf, cnt >> l); \
|
||||
}
|
||||
|
||||
bus_space_write_raw_multi(2,16,1)
|
||||
bus_space_write_raw_multi(4,32,2)
|
||||
|
||||
#define bus_space_write_raw_multi_8 \
|
||||
!!! bus_space_write_raw_multi_8 not implemented !!!
|
||||
|
||||
/*
|
||||
* Bus read/write barrier methods.
|
||||
*
|
||||
* void bus_space_barrier __P((bus_space_tag_t tag,
|
||||
* bus_space_handle_t bsh, bus_size_t offset,
|
||||
* bus_size_t len, int flags));
|
||||
*
|
||||
* On the MIPS, we just flush the write buffer.
|
||||
*/
|
||||
#define bus_space_barrier(t, h, o, l, f) \
|
||||
((void)((void)(t), (void)(h), (void)(o), (void)(l), (void)(f)), \
|
||||
wbflush())
|
||||
#define BUS_SPACE_BARRIER_READ 0x01 /* force read barrier */
|
||||
#define BUS_SPACE_BARRIER_WRITE 0x02 /* force write barrier */
|
||||
|
||||
#endif /* _ARC_BUS_H_ */
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* $NetBSD: cdefs.h,v 1.3 2000/01/23 20:08:19 soda Exp $ */
|
||||
/* $NetBSD: cdefs.h,v 1.4 2000/01/23 21:01:56 soda Exp $ */
|
||||
/* $OpenBSD: cdefs.h,v 1.1.1.1 1996/06/24 09:07:17 pefo Exp $ */
|
||||
/* NetBSD: cdefs.h,v 1.3 1995/05/03 06:04:54 mellon Exp */
|
||||
|
||||
#include <mips/cdefs.h>
|
||||
|
@ -1,10 +1,29 @@
|
||||
/* $NetBSD: cpu.h,v 1.6 2000/01/23 20:08:19 soda Exp $ */
|
||||
/* $NetBSD: cpu.h,v 1.7 2000/01/23 21:01:56 soda Exp $ */
|
||||
/* $OpenBSD: cpu.h,v 1.8 1997/04/19 17:19:56 pefo Exp $ */
|
||||
|
||||
#ifndef _ARC_CPU_H_
|
||||
#define _ARC_CPU_H_
|
||||
|
||||
/*
|
||||
* Internal timer causes hard interrupt 5.
|
||||
*/
|
||||
#define MIPS3_INTERNAL_TIMER_INTERRUPT
|
||||
#define MIPS_INT_MASK_CLOCK MIPS_INT_MASK_5
|
||||
|
||||
#include <mips/cpu.h>
|
||||
#include <mips/cpuregs.h>
|
||||
#include <machine/cpuregs.h>
|
||||
|
||||
/*
|
||||
* definitions of cpu-dependent requirements
|
||||
* referenced in generic code
|
||||
*/
|
||||
#define COPY_SIGCODE /* copy sigcode above user stack in exec */
|
||||
|
||||
#define INT_MASK_REAL_DEV MIPS3_HARD_INT_MASK /* XXX */
|
||||
|
||||
#ifndef _LOCORE
|
||||
struct tlb;
|
||||
extern void mips3_TLBWriteIndexedVPS __P((u_int index, struct tlb *tlb));
|
||||
#endif /* ! _LOCORE */
|
||||
|
||||
#endif /* _ARC_CPU_H_ */
|
||||
|
4
sys/arch/arc/include/cpuregs.h
Normal file
4
sys/arch/arc/include/cpuregs.h
Normal file
@ -0,0 +1,4 @@
|
||||
/* $NetBSD: cpuregs.h,v 1.1 2000/01/23 21:01:56 soda Exp $ */
|
||||
/* $OpenBSD: cpu.h,v 1.3 1996/08/26 11:12:02 pefo Exp $ */
|
||||
|
||||
#include <mips/cpuregs.h>
|
@ -1,4 +1,6 @@
|
||||
/* $NetBSD: disklabel.h,v 1.3 2000/01/23 20:08:20 soda Exp $ */
|
||||
/* $NetBSD: disklabel.h,v 1.4 2000/01/23 21:01:56 soda Exp $ */
|
||||
/* $OpenBSD: disklabel.h,v 1.6 1997/04/10 13:06:25 deraadt Exp $ */
|
||||
/* NetBSD: disklabel.h,v 1.3 1996/03/09 20:52:54 ghudson Exp */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Christopher G. Demetriou
|
||||
@ -33,45 +35,25 @@
|
||||
#ifndef _MACHINE_DISKLABEL_H_
|
||||
#define _MACHINE_DISKLABEL_H_
|
||||
|
||||
#define LABELSECTOR 0 /* sector containing label */
|
||||
#define LABELOFFSET 64 /* offset of label in sector */
|
||||
#define MAXPARTITIONS 8 /* number of partitions */
|
||||
#define RAW_PART 2 /* raw partition: xx?c */
|
||||
#define LABELSECTOR 1 /* sector containing label */
|
||||
#define LABELOFFSET 0 /* offset of label in sector */
|
||||
#define MAXPARTITIONS 16 /* number of partitions */
|
||||
#define RAW_PART 3 /* raw partition: ie. XX?d (XXX) */
|
||||
|
||||
/* DOS partition table -- used when the system is booted from a dos
|
||||
* partition. This is the case on NT systems.
|
||||
*/
|
||||
#define DOSBBSECTOR 0 /* DOS boot block relative sector # */
|
||||
#define DOSPARTOFF 446
|
||||
#define NDOSPART 4
|
||||
#define OPENBSD_RAW_PART 2 /* raw partition: XX?c */
|
||||
|
||||
struct dos_partition {
|
||||
u_int8_t dp_flag; /* bootstrap flags */
|
||||
u_int8_t dp_shd; /* starting head */
|
||||
u_int8_t dp_ssect; /* starting sector */
|
||||
u_int8_t dp_scyl; /* starting cylinder */
|
||||
u_int8_t dp_typ; /* partition type (see below) */
|
||||
u_int8_t dp_ehd; /* end head */
|
||||
u_int8_t dp_esect; /* end sector */
|
||||
u_int8_t dp_ecyl; /* end cylinder */
|
||||
u_int32_t dp_start; /* absolute starting sector number */
|
||||
u_int32_t dp_size; /* partition size in sectors */
|
||||
} dos_partitions[NDOSPART];
|
||||
|
||||
/* Known DOS partition types. */
|
||||
#define DOSPTYP_386BSD 0xa5 /* 386BSD partition type */
|
||||
#define DOSPTYP_NETBSD DOSPTYP_386BSD /* NetBSD partition type (XXX) */
|
||||
/* Pull in MBR partition definitions. */
|
||||
#include <sys/disklabel_mbr.h>
|
||||
/* XXX - should move to <sys/disklabel_mbr.h> */
|
||||
#define MBR_PTYPE_OPENBSD 0xa6 /* OpenBSD partition type */
|
||||
#define MBR_PTYPE_ONTRACK 0x54
|
||||
|
||||
#include <sys/dkbad.h>
|
||||
struct cpu_disklabel {
|
||||
struct dos_partition dosparts[NDOSPART];
|
||||
struct mbr_partition dosparts[NMBRPART];
|
||||
struct dkbad bad;
|
||||
};
|
||||
|
||||
/* Isolate the relevant bits to get sector and cylinder. */
|
||||
#define DPSECT(s) ((s) & 0x3f)
|
||||
#define DPCYL(c, s) ((c) + (((s) & 0xc0) << 2))
|
||||
|
||||
#ifdef _KERNEL
|
||||
struct disklabel;
|
||||
int bounds_check_with_label __P((struct buf *, struct disklabel *, int));
|
||||
|
@ -1,7 +1,9 @@
|
||||
/* $NetBSD: display.h,v 1.3 2000/01/23 20:08:21 soda Exp $ */
|
||||
/* $NetBSD: display.h,v 1.4 2000/01/23 21:01:56 soda Exp $ */
|
||||
/* $OpenBSD: display.h,v 1.1.1.1 1996/06/24 09:07:17 pefo Exp $ */
|
||||
|
||||
/*
|
||||
* IBM PC display definitions
|
||||
*
|
||||
*/
|
||||
|
||||
/* Color attributes for foreground text */
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* $NetBSD: ecoff_machdep.h,v 1.4 2000/01/23 20:08:48 soda Exp $ */
|
||||
/* $NetBSD: ecoff_machdep.h,v 1.5 2000/01/23 21:01:56 soda Exp $ */
|
||||
/* $OpenBSD: ecoff.h,v 1.3 1996/10/02 21:47:53 pefo Exp $ */
|
||||
|
||||
#include <mips/ecoff_machdep.h>
|
||||
|
@ -1,3 +1,3 @@
|
||||
/* $NetBSD: elf_machdep.h,v 1.2 2000/01/23 20:08:48 soda Exp $ */
|
||||
/* $NetBSD: elf_machdep.h,v 1.3 2000/01/23 21:01:56 soda Exp $ */
|
||||
|
||||
#include <mips/elf_machdep.h>
|
||||
|
@ -1,4 +1,5 @@
|
||||
/* $NetBSD: endian.h,v 1.6 2000/01/23 20:08:21 soda Exp $ */
|
||||
/* $NetBSD: endian.h,v 1.7 2000/01/23 21:01:56 soda Exp $ */
|
||||
/* $OpenBSD: endian.h,v 1.3 1997/04/04 03:05:29 millert Exp $ */
|
||||
|
||||
#define _BYTE_ORDER _LITTLE_ENDIAN
|
||||
#include <mips/endian.h>
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* $NetBSD: float.h,v 1.3 2000/01/23 20:08:22 soda Exp $ */
|
||||
/* $NetBSD: float.h,v 1.4 2000/01/23 21:01:56 soda Exp $ */
|
||||
/* $OpenBSD: float.h,v 1.2 1996/07/30 20:24:25 pefo Exp $ */
|
||||
/* NetBSD: float.h,v 1.7 1995/06/20 20:45:50 jtc Exp */
|
||||
|
||||
#include <mips/float.h>
|
||||
|
@ -1,8 +1,4 @@
|
||||
/* $NetBSD: ieeefp.h,v 1.4 2000/01/23 20:08:23 soda Exp $ */
|
||||
|
||||
/*
|
||||
* Written by J.T. Conklin, Apr 11, 1995
|
||||
* Public domain.
|
||||
*/
|
||||
/* $NetBSD: ieeefp.h,v 1.5 2000/01/23 21:01:56 soda Exp $ */
|
||||
/* $OpenBSD: ieeefp.h,v 1.1.1.1 1996/06/24 09:07:17 pefo Exp $ */
|
||||
|
||||
#include <mips/ieeefp.h>
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: intr.h,v 1.1.1.1 2000/01/23 20:24:28 soda Exp $ */
|
||||
/* $NetBSD: intr.h,v 1.2 2000/01/23 21:01:56 soda Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Charles M. Hannum. All rights reserved.
|
||||
* Copyright (c) 1998 Jonathan Stone. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@ -13,7 +13,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 Charles M. Hannum.
|
||||
* This product includes software developed by Jonathan Stone for
|
||||
* the NetBSD Project.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
@ -32,14 +33,18 @@
|
||||
#ifndef _ARC_INTR_H_
|
||||
#define _ARC_INTR_H_
|
||||
|
||||
/* Interrupt priority `levels'; not mutually exclusive. */
|
||||
#define IPL_BIO 0 /* block I/O */
|
||||
#define IPL_NET 1 /* network */
|
||||
#define IPL_TTY 2 /* terminal */
|
||||
#define IPL_CLOCK 3 /* clock */
|
||||
#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_IMP 4 /* memory allocation */
|
||||
#define IPL_NONE 5 /* nothing */
|
||||
#define IPL_HIGH 6 /* everything */
|
||||
#define IPL_CLOCK 5 /* disable clock interrupts */
|
||||
#define IPL_STATCLOCK 6 /* disable profiling interrupts */
|
||||
#if 0 /* XXX */
|
||||
#define IPL_SERIAL 7 /* disable serial hardware interrupts */
|
||||
#endif
|
||||
#define IPL_HIGH 8 /* disable all interrupts */
|
||||
#define NIPL 9
|
||||
|
||||
/* Interrupt sharing types. */
|
||||
#define IST_NONE 0 /* none */
|
||||
@ -48,127 +53,87 @@
|
||||
#define IST_LEVEL 3 /* level-triggered */
|
||||
|
||||
/* Soft interrupt masks. */
|
||||
/* XXX - revisit here */
|
||||
#define SIR_CLOCK 31
|
||||
#define SIR_CLOCKMASK ((1 << SIR_CLOCK))
|
||||
#define SIR_NET 30
|
||||
#define SIR_CLOCKMASK ((1 << SIR_CLOCK))
|
||||
#define SIR_NETMASK ((1 << SIR_NET) | SIR_CLOCKMASK)
|
||||
#define SIR_TTY 29
|
||||
#define SIR_TTYMASK ((1 << SIR_TTY) | SIR_CLOCKMASK)
|
||||
#define SIR_ALLMASK (SIR_CLOCKMASK | SIR_NETMASK | SIR_TTYMASK)
|
||||
#define SIR_ALLMASK (SIR_CLOCKMASK | SIR_NETMASK)
|
||||
|
||||
#ifdef _KERNEL
|
||||
#ifndef _LOCORE
|
||||
|
||||
void setsoftclock __P((void));
|
||||
void clearsoftclock __P((void));
|
||||
int splsoftclock __P((void));
|
||||
void setsoftnet __P((void));
|
||||
void clearsoftnet __P((void));
|
||||
int splsoftnet __P((void));
|
||||
#include <mips/cpuregs.h>
|
||||
|
||||
extern int _splraise __P((int));
|
||||
extern int _spllower __P((int));
|
||||
extern int _splset __P((int));
|
||||
extern int _splget __P((void));
|
||||
extern void _splnone __P((void));
|
||||
extern void _setsoftintr __P((int));
|
||||
extern void _clrsoftintr __P((int));
|
||||
|
||||
#define setsoftclock() _setsoftintr(MIPS_SOFT_INT_MASK_0)
|
||||
#define setsoftnet() _setsoftintr(MIPS_SOFT_INT_MASK_1)
|
||||
#define clearsoftclock() _clrsoftintr(MIPS_SOFT_INT_MASK_0)
|
||||
#define clearsoftnet() _clrsoftintr(MIPS_SOFT_INT_MASK_1)
|
||||
|
||||
#define splhigh() _splraise(MIPS_INT_MASK)
|
||||
#define spl0() (void)_spllower(0)
|
||||
#define splx(s) (void)_splset(s)
|
||||
#define splbio() (_splraise(splvec.splbio))
|
||||
#define splnet() (_splraise(splvec.splnet))
|
||||
#define spltty() (_splraise(splvec.spltty))
|
||||
#define splimp() (_splraise(splvec.splimp))
|
||||
#define splpmap() (_splraise(splvec.splimp))
|
||||
#define splclock() (_splraise(splvec.splclock))
|
||||
#define splstatclock() (_splraise(splvec.splstatclock))
|
||||
#define spllowersoftclock() _spllower(MIPS_SOFT_INT_MASK_0)
|
||||
#define splsoftclock() _splraise(MIPS_SOFT_INT_MASK_0)
|
||||
#define splsoftnet() _splraise(MIPS_SOFT_INT_MASK_1)
|
||||
|
||||
#define spllpt() spltty() /* lpt driver */
|
||||
|
||||
struct splvec {
|
||||
int splbio;
|
||||
int splnet;
|
||||
int spltty;
|
||||
int splimp;
|
||||
int splclock;
|
||||
int splstatclock;
|
||||
};
|
||||
extern struct splvec splvec;
|
||||
|
||||
/* Conventionals ... */
|
||||
|
||||
#define MIPS_SPLHIGH (MIPS_INT_MASK)
|
||||
#define MIPS_SOFT_INT_MASK (MIPS_SOFT_INT_MASK_0|MIPS_SOFT_INT_MASK_1)
|
||||
#define MIPS_INTMASK_0 (MIPS_INT_MASK_0|MIPS_SOFT_INT_MASK)
|
||||
#define MIPS_INTMASK_0_to_1 (MIPS_INT_MASK_1|MIPS_INTMASK_0)
|
||||
#define MIPS_INTMASK_0_to_2 (MIPS_INT_MASK_2|MIPS_INTMASK_0_to_1)
|
||||
#define MIPS_INTMASK_0_to_3 (MIPS_INT_MASK_3|MIPS_INTMASK_0_to_2)
|
||||
#define MIPS_INTMASK_0_to_4 (MIPS_INT_MASK_4|MIPS_INTMASK_0_to_3)
|
||||
#define MIPS_INTMASK_0_to_5 (MIPS_INT_MASK_5|MIPS_INTMASK_0_to_4)
|
||||
|
||||
/*
|
||||
* Index into intrcnt[], which is defined in locore
|
||||
*/
|
||||
#define SOFTCLOCK_INTR 0
|
||||
#define SOFTNET_INTR 1
|
||||
#define FPU_INTR 2
|
||||
extern u_long intrcnt[];
|
||||
|
||||
/* handle i/o device interrupts */
|
||||
extern int (*mips_hardware_intr) __P((unsigned, unsigned, unsigned, unsigned));
|
||||
int arc_hardware_intr __P((unsigned, unsigned, unsigned, unsigned));
|
||||
|
||||
struct clockframe;
|
||||
void set_intr __P((int, int(*)(u_int, struct clockframe *), int));
|
||||
|
||||
volatile int cpl, ipending, astpending;
|
||||
int imask[7];
|
||||
/* XXX - revisit here */
|
||||
int imask[NIPL];
|
||||
|
||||
#if 0
|
||||
extern void Xspllower __P((void));
|
||||
|
||||
static __inline int splraise __P((int));
|
||||
static __inline int spllower __P((int));
|
||||
static __inline void splx __P((int));
|
||||
static __inline void softintr __P((int));
|
||||
|
||||
/*
|
||||
* Add a mask to cpl, and return the old value of cpl.
|
||||
*/
|
||||
static __inline int
|
||||
splraise(ncpl)
|
||||
register int ncpl;
|
||||
{
|
||||
register int ocpl = cpl;
|
||||
|
||||
cpl = ocpl | ncpl;
|
||||
return (ocpl);
|
||||
}
|
||||
|
||||
/*
|
||||
* Restore a value to cpl (unmasking interrupts). If any unmasked
|
||||
* interrupts are pending, call Xspllower() to process them.
|
||||
*/
|
||||
static __inline void
|
||||
splx(ncpl)
|
||||
register int ncpl;
|
||||
{
|
||||
|
||||
cpl = ncpl;
|
||||
if (ipending & ~ncpl)
|
||||
Xspllower();
|
||||
}
|
||||
|
||||
/*
|
||||
* Same as splx(), but we return the old value of spl, for the
|
||||
* benefit of some splsoftclock() callers.
|
||||
*/
|
||||
static __inline int
|
||||
spllower(ncpl)
|
||||
register int ncpl;
|
||||
{
|
||||
register int ocpl = cpl;
|
||||
|
||||
cpl = ncpl;
|
||||
if (ipending & ~ncpl)
|
||||
Xspllower();
|
||||
return (ocpl);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Hardware interrupt masks
|
||||
*/
|
||||
#if 0
|
||||
#define splbio() splraise(imask[IPL_BIO])
|
||||
#define splnet() splraise(imask[IPL_NET])
|
||||
#define spltty() splraise(imask[IPL_TTY])
|
||||
#define splclock() splraise(imask[IPL_CLOCK])
|
||||
#define splimp() splraise(imask[IPL_IMP])
|
||||
#define splstatclock() splclock()
|
||||
|
||||
/*
|
||||
* Software interrupt masks
|
||||
*
|
||||
* NOTE: splsoftclock() is used by hardclock() to lower the priority from
|
||||
* clock to softclock before it calls softclock().
|
||||
*/
|
||||
#define splsoftclock() spllower(SIR_CLOCKMASK)
|
||||
#define splsoftnet() splraise(SIR_NETMASK)
|
||||
#define splsofttty() splraise(SIR_TTYMASK)
|
||||
|
||||
/*
|
||||
* Miscellaneous
|
||||
*/
|
||||
#define splhigh() splraise(-1)
|
||||
#define spl0() spllower(0)
|
||||
|
||||
/*
|
||||
* Software interrupt registration
|
||||
*
|
||||
* We hand-code this to ensure that it's atomic.
|
||||
*/
|
||||
static __inline void
|
||||
softintr(mask)
|
||||
register int mask;
|
||||
{
|
||||
|
||||
__asm __volatile("orl %0,_ipending" : : "ir" (mask));
|
||||
}
|
||||
|
||||
#define setsoftast() (astpending = 1)
|
||||
#define setsoftclock() softintr(1 << SIR_CLOCK)
|
||||
#define setsoftnet() softintr(1 << SIR_NET)
|
||||
#define setsofttty() softintr(1 << SIR_TTY)
|
||||
#endif
|
||||
|
||||
#endif /* _LOCORE */
|
||||
#endif /* !_LOCORE */
|
||||
#endif /* _KERNEL */
|
||||
|
||||
#endif /* _ARC_INTR_H_ */
|
||||
|
86
sys/arch/arc/include/isa_machdep.h
Normal file
86
sys/arch/arc/include/isa_machdep.h
Normal file
@ -0,0 +1,86 @@
|
||||
/* $NetBSD: isa_machdep.h,v 1.2 2000/01/23 21:01:56 soda Exp $ */
|
||||
/* $OpenBSD: isa_machdep.h,v 1.5 1997/04/19 17:20:00 pefo Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Per Fogelstrom
|
||||
* 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 Per Fogelstrom
|
||||
* 4. 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.
|
||||
*/
|
||||
#ifndef _ISA_MACHDEP_H_
|
||||
#define _ISA_MACHDEP_H_
|
||||
|
||||
typedef struct arc_isa_bus *isa_chipset_tag_t;
|
||||
|
||||
/*
|
||||
* I/O macros to access isa bus ports/memory.
|
||||
* At the first glance theese macros may seem inefficient.
|
||||
* However, the cpu executes an instruction every 7.5ns
|
||||
* so the bus is much slower so it doesn't matter, really.
|
||||
*/
|
||||
#define isa_outb(x,y) outb(arc_bus_io.bus_base + (x), y)
|
||||
#define isa_inb(x) inb(arc_bus_io.bus_base + (x))
|
||||
|
||||
struct arc_isa_bus {
|
||||
void *ic_data;
|
||||
|
||||
void (*ic_attach_hook) __P((struct device *, struct device *,
|
||||
struct isabus_attach_args *));
|
||||
void *(*ic_intr_establish) __P((isa_chipset_tag_t, int, int, int,
|
||||
int (*)(void *), void *));
|
||||
void (*ic_intr_disestablish) __P((isa_chipset_tag_t, 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_data, (i), (t), (l), (f), (a))
|
||||
#define isa_intr_disestablish(c, h) \
|
||||
(*(c)->ic_intr_disestablish)((c)->ic_data, (h))
|
||||
|
||||
void sysbeepstop __P((void *));
|
||||
void sysbeep __P((int, int));
|
||||
|
||||
|
||||
/*
|
||||
* Interrupt control struct used to control the ICU setup.
|
||||
*/
|
||||
|
||||
struct intrhand {
|
||||
struct intrhand *ih_next;
|
||||
int (*ih_fun) __P((void *));
|
||||
void *ih_arg;
|
||||
u_long ih_count;
|
||||
int ih_level;
|
||||
int ih_irq;
|
||||
char *ih_what;
|
||||
};
|
||||
|
||||
#endif /* _ISA_MACHDEP_H_ */
|
47
sys/arch/arc/include/isapnp_machdep.h
Normal file
47
sys/arch/arc/include/isapnp_machdep.h
Normal file
@ -0,0 +1,47 @@
|
||||
/* $NetBSD: isapnp_machdep.h,v 1.1 2000/01/23 21:01:57 soda Exp $ */
|
||||
/* NetBSD: isapnp_machdep.h,v 1.3 1998/09/05 15:28:05 christos Exp */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
|
||||
* NASA Ames Research Center and by Christos Zoulas.
|
||||
*
|
||||
* 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 NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Functions provided to machine-independent ISA PnP code.
|
||||
*/
|
||||
int isapnp_map __P((struct isapnp_softc *));
|
||||
void isapnp_unmap __P((struct isapnp_softc *));
|
||||
int isapnp_map_readport __P((struct isapnp_softc *));
|
||||
void isapnp_unmap_readport __P((struct isapnp_softc *));
|
@ -1,10 +1,41 @@
|
||||
/* $NetBSD: kbdreg.h,v 1.3 2000/01/23 20:08:23 soda Exp $ */
|
||||
/* $NetBSD: kbdreg.h,v 1.4 2000/01/23 21:01:57 soda Exp $ */
|
||||
/* $OpenBSD: kbdreg.h,v 1.3 1996/09/04 21:18:24 pefo Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Per Fogelstrom
|
||||
* 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 Per Fogelstrom.
|
||||
* 4. 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.
|
||||
*/
|
||||
/*
|
||||
* Keyboard definitions
|
||||
*
|
||||
*/
|
||||
|
||||
#define KBSTATP (PICA_SYS_KBD + 0x61) /* controller status port (I) */
|
||||
#define KBSTATP (0x61) /* controller status port (I) */
|
||||
#define KBS_DIB 0x01 /* data in buffer */
|
||||
#define KBS_IBF 0x02 /* input buffer low */
|
||||
#define KBS_WARM 0x04 /* input buffer low */
|
||||
@ -14,9 +45,9 @@
|
||||
#define KBS_RERR 0x40 /* receive error */
|
||||
#define KBS_PERR 0x80 /* parity error */
|
||||
|
||||
#define KBCMDP (PICA_SYS_KBD + 0x61) /* controller port (O) */
|
||||
#define KBDATAP (PICA_SYS_KBD + 0x60) /* data port (I) */
|
||||
#define KBOUTP (PICA_SYS_KBD + 0x60) /* data port (O) */
|
||||
#define KBCMDP (0x61) /* controller port (O) */
|
||||
#define KBDATAP (0x60) /* data port (I) */
|
||||
#define KBOUTP (0x60) /* data port (O) */
|
||||
|
||||
#define K_RDCMDBYTE 0x20
|
||||
#define K_LDCMDBYTE 0x60
|
||||
|
@ -1,3 +1,3 @@
|
||||
/* $NetBSD: kcore.h,v 1.2 2000/01/23 20:08:24 soda Exp $ */
|
||||
/* $NetBSD: kcore.h,v 1.3 2000/01/23 21:01:57 soda Exp $ */
|
||||
|
||||
#include <mips/kcore.h>
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* $NetBSD: kdbparam.h,v 1.3 2000/01/23 20:08:25 soda Exp $ */
|
||||
/* $NetBSD: kdbparam.h,v 1.4 2000/01/23 21:01:57 soda Exp $ */
|
||||
/* $OpenBSD: kdbparam.h,v 1.1.1.1 1996/06/24 09:07:17 pefo Exp $ */
|
||||
/* NetBSD: kdbparam.h,v 1.4 1994/10/26 21:09:42 cgd Exp */
|
||||
|
||||
#include <mips/kdbparam.h>
|
||||
|
@ -1,4 +1,6 @@
|
||||
/* $NetBSD: limits.h,v 1.4 2000/01/23 20:08:25 soda Exp $ */
|
||||
/* $NetBSD: limits.h,v 1.5 2000/01/23 21:01:57 soda Exp $ */
|
||||
/* $OpenBSD: limits.h,v 1.1.1.1 1996/06/24 09:07:17 pefo Exp $ */
|
||||
/* NetBSD: limits.h,v 1.8 1995/03/28 18:19:16 jtc Exp */
|
||||
|
||||
#ifndef _MACHINE_LIMITS_H_
|
||||
#define _MACHINE_LIMITS_H_
|
||||
|
@ -1,260 +1,4 @@
|
||||
/* $NetBSD: mips_opcode.h,v 1.3 2000/01/23 20:08:26 soda Exp $ */
|
||||
/* $NetBSD: mips_opcode.h,v 1.4 2000/01/23 21:01:57 soda Exp $ */
|
||||
/* $OpenBSD: mips_opcode.h,v 1.1.1.1 1996/06/24 09:07:17 pefo Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* 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: @(#)mips_opcode.h 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
/*
|
||||
* Define the instruction formats and opcode values for the
|
||||
* MIPS instruction set.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Define the instruction formats.
|
||||
*/
|
||||
typedef union {
|
||||
unsigned word;
|
||||
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
struct {
|
||||
unsigned imm: 16;
|
||||
unsigned rt: 5;
|
||||
unsigned rs: 5;
|
||||
unsigned op: 6;
|
||||
} IType;
|
||||
|
||||
struct {
|
||||
unsigned target: 26;
|
||||
unsigned op: 6;
|
||||
} JType;
|
||||
|
||||
struct {
|
||||
unsigned func: 6;
|
||||
unsigned shamt: 5;
|
||||
unsigned rd: 5;
|
||||
unsigned rt: 5;
|
||||
unsigned rs: 5;
|
||||
unsigned op: 6;
|
||||
} RType;
|
||||
|
||||
struct {
|
||||
unsigned func: 6;
|
||||
unsigned fd: 5;
|
||||
unsigned fs: 5;
|
||||
unsigned ft: 5;
|
||||
unsigned fmt: 4;
|
||||
unsigned : 1; /* always '1' */
|
||||
unsigned op: 6; /* always '0x11' */
|
||||
} FRType;
|
||||
#endif
|
||||
} InstFmt;
|
||||
|
||||
/*
|
||||
* Values for the 'op' field.
|
||||
*/
|
||||
#define OP_SPECIAL 000
|
||||
#define OP_BCOND 001
|
||||
#define OP_J 002
|
||||
#define OP_JAL 003
|
||||
#define OP_BEQ 004
|
||||
#define OP_BNE 005
|
||||
#define OP_BLEZ 006
|
||||
#define OP_BGTZ 007
|
||||
|
||||
#define OP_ADDI 010
|
||||
#define OP_ADDIU 011
|
||||
#define OP_SLTI 012
|
||||
#define OP_SLTIU 013
|
||||
#define OP_ANDI 014
|
||||
#define OP_ORI 015
|
||||
#define OP_XORI 016
|
||||
#define OP_LUI 017
|
||||
|
||||
#define OP_COP0 020
|
||||
#define OP_COP1 021
|
||||
#define OP_COP2 022
|
||||
#define OP_COP3 023
|
||||
#define OP_BEQL 024
|
||||
#define OP_BNEL 025
|
||||
#define OP_BLEZL 026
|
||||
#define OP_BGTZL 027
|
||||
|
||||
#define OP_DADDI 030
|
||||
#define OP_DADDIU 031
|
||||
#define OP_LDL 032
|
||||
#define OP_LDR 033
|
||||
|
||||
#define OP_LB 040
|
||||
#define OP_LH 041
|
||||
#define OP_LWL 042
|
||||
#define OP_LW 043
|
||||
#define OP_LBU 044
|
||||
#define OP_LHU 045
|
||||
#define OP_LWR 046
|
||||
#define OP_LHU 045
|
||||
#define OP_LWR 046
|
||||
#define OP_LWU 047
|
||||
|
||||
#define OP_SB 050
|
||||
#define OP_SH 051
|
||||
#define OP_SWL 052
|
||||
#define OP_SW 053
|
||||
#define OP_SDL 054
|
||||
#define OP_SDR 055
|
||||
#define OP_SWR 056
|
||||
#define OP_CACHE 057
|
||||
|
||||
#define OP_LL 060
|
||||
#define OP_LWC1 061
|
||||
#define OP_LWC2 062
|
||||
#define OP_LWC3 063
|
||||
#define OP_LLD 064
|
||||
#define OP_LD 067
|
||||
|
||||
#define OP_SC 070
|
||||
#define OP_SWC1 071
|
||||
#define OP_SWC2 072
|
||||
#define OP_SWC3 073
|
||||
#define OP_SCD 074
|
||||
#define OP_SD 077
|
||||
|
||||
/*
|
||||
* Values for the 'func' field when 'op' == OP_SPECIAL.
|
||||
*/
|
||||
#define OP_SLL 000
|
||||
#define OP_SRL 002
|
||||
#define OP_SRA 003
|
||||
#define OP_SLLV 004
|
||||
#define OP_SRLV 006
|
||||
#define OP_SRAV 007
|
||||
|
||||
#define OP_JR 010
|
||||
#define OP_JALR 011
|
||||
#define OP_SYSCALL 014
|
||||
#define OP_BREAK 015
|
||||
#define OP_SYNC 017
|
||||
|
||||
#define OP_MFHI 020
|
||||
#define OP_MTHI 021
|
||||
#define OP_MFLO 022
|
||||
#define OP_MTLO 023
|
||||
#define OP_DSLLV 024
|
||||
#define OP_DSRLV 026
|
||||
#define OP_DSRAV 027
|
||||
|
||||
#define OP_MULT 030
|
||||
#define OP_MULTU 031
|
||||
#define OP_DIV 032
|
||||
#define OP_DIVU 033
|
||||
#define OP_DMULT 034
|
||||
#define OP_DMULTU 035
|
||||
#define OP_DDIV 036
|
||||
#define OP_DDIVU 037
|
||||
|
||||
|
||||
#define OP_ADD 040
|
||||
#define OP_ADDU 041
|
||||
#define OP_SUB 042
|
||||
#define OP_SUBU 043
|
||||
#define OP_AND 044
|
||||
#define OP_OR 045
|
||||
#define OP_XOR 046
|
||||
#define OP_NOR 047
|
||||
|
||||
#define OP_SLT 052
|
||||
#define OP_SLTU 053
|
||||
#define OP_DADD 054
|
||||
#define OP_DADDU 055
|
||||
#define OP_DSUB 056
|
||||
#define OP_DSUBU 057
|
||||
|
||||
#define OP_TGE 060
|
||||
#define OP_TGEU 061
|
||||
#define OP_TLT 062
|
||||
#define OP_TLTU 063
|
||||
#define OP_TEQ 064
|
||||
#define OP_TNE 066
|
||||
|
||||
#define OP_DSLL 070
|
||||
#define OP_DSRL 072
|
||||
#define OP_DSRA 073
|
||||
#define OP_DSLL32 074
|
||||
#define OP_DSRL32 076
|
||||
#define OP_DSRA32 077
|
||||
|
||||
/*
|
||||
* Values for the 'func' field when 'op' == OP_BCOND.
|
||||
*/
|
||||
#define OP_BLTZ 000
|
||||
#define OP_BGEZ 001
|
||||
#define OP_BLTZL 002
|
||||
#define OP_BGEZL 003
|
||||
|
||||
#define OP_TGEI 010
|
||||
#define OP_TGEIU 011
|
||||
#define OP_TLTI 012
|
||||
#define OP_TLTIU 013
|
||||
#define OP_TEQI 014
|
||||
#define OP_TNEI 016
|
||||
|
||||
#define OP_BLTZAL 020
|
||||
#define OP_BLTZAL 020
|
||||
#define OP_BGEZAL 021
|
||||
#define OP_BLTZALL 022
|
||||
#define OP_BGEZALL 023
|
||||
|
||||
/*
|
||||
* Values for the 'rs' field when 'op' == OP_COPz.
|
||||
*/
|
||||
#define OP_MF 000
|
||||
#define OP_DMF 001
|
||||
#define OP_MT 004
|
||||
#define OP_DMT 005
|
||||
#define OP_BCx 010
|
||||
#define OP_BCy 014
|
||||
#define OP_CF 002
|
||||
#define OP_CT 006
|
||||
|
||||
/*
|
||||
* Values for the 'rt' field when 'op' == OP_COPz.
|
||||
*/
|
||||
#define COPz_BC_TF_MASK 0x01
|
||||
#define COPz_BC_TRUE 0x01
|
||||
#define COPz_BC_FALSE 0x00
|
||||
#define COPz_BCL_TF_MASK 0x02
|
||||
#define COPz_BCL_TRUE 0x02
|
||||
#define COPz_BCL_FALSE 0x00
|
||||
#include <mips/include/mips_opcode.h>
|
||||
|
@ -1,5 +1,6 @@
|
||||
/* $OpenBSD: mouse.h,v 1.2 1997/01/19 09:58:45 pefo Exp $ */
|
||||
/* $NetBSD: mouse.h,v 1.1.1.3 2000/01/23 20:24:28 soda Exp $ */
|
||||
/* $NetBSD: mouse.h,v 1.2 2000/01/23 21:01:57 soda Exp $ */
|
||||
/* $OpenBSD: mouse.h,v 1.2 1996/06/06 23:06:52 deraadt Exp $ */
|
||||
/* NetBSD: mouse.h,v 1.4 1994/10/27 04:16:10 cgd Exp */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993 Erik Forsberg.
|
||||
@ -46,7 +47,5 @@ struct mouseinfo {
|
||||
|
||||
#define MOUSEIOC ('M'<<8)
|
||||
#define MOUSEIOCREAD (MOUSEIOC|60)
|
||||
#define MOUSEIOCSRAW (MOUSEIOC|61)
|
||||
#define MOUSEIOCSCOOKED (MOUSEIOC|62)
|
||||
|
||||
#endif /* !_MOUSE_H_ */
|
||||
|
@ -1,4 +1,5 @@
|
||||
/* $NetBSD: param.h,v 1.10 2000/01/23 20:08:28 soda Exp $ */
|
||||
/* $NetBSD: param.h,v 1.11 2000/01/23 21:01:57 soda Exp $ */
|
||||
/* $OpenBSD: param.h,v 1.9 1997/04/30 09:54:15 niklas Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
@ -37,63 +38,48 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: Utah Hdr: machparam.h 1.11 89/08/14
|
||||
*
|
||||
*
|
||||
* from: Utah Hdr: machparam.h 1.11 89/08/14
|
||||
* from: @(#)param.h 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
#ifndef _ARC_PARAM_H_
|
||||
#define _ARC_PARAM_H_
|
||||
|
||||
/*
|
||||
* Machine-dependent constants (VM, etc) common across MIPS cpus
|
||||
*/
|
||||
#include <mips/mips_param.h>
|
||||
|
||||
/*
|
||||
* Machine dependent constants for Acer Labs PICA_61.
|
||||
* Machine dependent constants for ARC BIOS MIPS machines:
|
||||
* Acer Labs PICA_61
|
||||
* Deskstation rPC44
|
||||
* Deskstation Tyne
|
||||
* Etc
|
||||
*/
|
||||
#define MACHINE "pica"
|
||||
#define MACHINE_ARCH "mips"
|
||||
#define MID_PICA MID_PMAX /* For the moment */
|
||||
#define MID_MACHINE MID_PICA
|
||||
|
||||
/*
|
||||
* Round p (pointer or byte index) up to a correctly-aligned value for all
|
||||
* data types (int, long, ...). The result is u_int and must be cast to
|
||||
* any desired pointer type.
|
||||
*
|
||||
* ALIGNED_POINTER is a boolean macro that checks whether an address
|
||||
* is valid to fetch data elements of type t from on this architecture.
|
||||
* This does not reflect the optimal alignment, just the possibility
|
||||
* (within reasonable limits).
|
||||
*
|
||||
*/
|
||||
#define ALIGNBYTES 7
|
||||
#define ALIGN(p) (((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES)
|
||||
#define ALIGNED_POINTER(p,t) ((((u_long)(p)) & (sizeof(t)-1)) == 0)
|
||||
|
||||
#define NBPG 4096 /* bytes/page */
|
||||
#define PGOFSET (NBPG-1) /* byte offset into page */
|
||||
#define PGSHIFT 12 /* LOG2(NBPG) */
|
||||
#define NPTEPG (NBPG/4)
|
||||
|
||||
#define NBSEG 0x400000 /* bytes/segment */
|
||||
#define SEGOFSET (NBSEG-1) /* byte offset into segment */
|
||||
#define SEGSHIFT 22 /* LOG2(NBSEG) */
|
||||
#define _MACHINE arc
|
||||
#define MACHINE "arc"
|
||||
#define MACHINE_ARCH "mips"
|
||||
#define MID_MACHINE MID_PMAX /* XXX Bogus, but needed for now... */
|
||||
|
||||
#define KERNBASE 0x80000000 /* start of kernel virtual */
|
||||
#define KERNTEXTOFF 0x80080000 /* start of kernel text for kvm_mkdb */
|
||||
#define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT)
|
||||
|
||||
#define DEV_BSIZE 512
|
||||
#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
|
||||
#define BLKDEV_IOSIZE 2048
|
||||
#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */
|
||||
/* XXX Maxphys temporary changed to 32K while SCSI driver is fixed. */
|
||||
#define MAXPHYS (32 * 1024) /* max raw I/O transfer size */
|
||||
|
||||
#define SSIZE 1 /* initial stack size/NBPG */
|
||||
#define SINCR 1 /* increment of stack/NBPG */
|
||||
|
||||
#define UPAGES 2 /* pages of u-area */
|
||||
#if defined(_LOCORE) && defined(notyet)
|
||||
#define UADDR 0xffffffffffffc000 /* address of u */
|
||||
#else
|
||||
#define UADDR 0xffffc000 /* address of u */
|
||||
#endif
|
||||
#define USPACE (UPAGES*NBPG) /* size of u-area in bytes */
|
||||
#define UVPN (UADDR>>PGSHIFT)/* virtual page number of u */
|
||||
#define KERNELSTACK (UADDR+UPAGES*NBPG) /* top of kernel stack */
|
||||
@ -106,8 +92,8 @@
|
||||
* of the hardware page size.
|
||||
*/
|
||||
#define MSIZE 128 /* size of an mbuf */
|
||||
#define MCLBYTES 2048 /* enough for whole Ethernet packet */
|
||||
#define MCLSHIFT 10
|
||||
#define MCLSHIFT 11
|
||||
#define MCLBYTES (1 << MCLSHIFT) /* enough for whole Ethernet packet */
|
||||
#define MCLOFSET (MCLBYTES - 1)
|
||||
#ifndef NMBCLUSTERS
|
||||
|
||||
@ -124,49 +110,35 @@
|
||||
|
||||
/*
|
||||
* Size of kernel malloc arena in NBPG-sized logical pages
|
||||
*/
|
||||
* XXX - different from <mips/include/mips_param.h>
|
||||
*/
|
||||
#ifndef NKMEMCLUSTERS
|
||||
#define NKMEMCLUSTERS (512*1024/NBPG)
|
||||
#define NKMEMCLUSTERS (4096*1024/NBPG)
|
||||
#endif
|
||||
|
||||
/* pages ("clicks") (4096 bytes) to disk blocks */
|
||||
#define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT))
|
||||
#define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT))
|
||||
|
||||
/* pages to bytes */
|
||||
#define ctob(x) ((x) << PGSHIFT)
|
||||
#define btoc(x) (((x) + PGOFSET) >> PGSHIFT)
|
||||
|
||||
/* bytes to disk blocks */
|
||||
#define btodb(x) ((x) >> DEV_BSHIFT)
|
||||
#define dbtob(x) ((x) << DEV_BSHIFT)
|
||||
|
||||
/*
|
||||
* Map a ``block device block'' to a file system block.
|
||||
* This should be device dependent, and should use the bsize
|
||||
* field from the disk label.
|
||||
* For now though just use DEV_BSIZE.
|
||||
*/
|
||||
#define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
|
||||
|
||||
/*
|
||||
* Mach derived conversion macros
|
||||
*/
|
||||
#define pica_round_page(x) ((((unsigned)(x)) + NBPG - 1) & ~(NBPG-1))
|
||||
#define pica_trunc_page(x) ((unsigned)(x) & ~(NBPG-1))
|
||||
#define pica_btop(x) ((unsigned)(x) >> PGSHIFT)
|
||||
#define pica_ptob(x) ((unsigned)(x) << PGSHIFT)
|
||||
#include <machine/intr.h>
|
||||
|
||||
#ifdef _KERNEL
|
||||
#ifndef _LOCORE
|
||||
|
||||
extern int cpuspeed;
|
||||
extern void delay __P((int n));
|
||||
|
||||
#if 0 /* XXX: should use mips_mcclock.c */
|
||||
#define DELAY(n) { register int N = cpuspeed * (n); while (--N > 0); }
|
||||
#else
|
||||
/*
|
||||
* Delay is based on an assumtion that each time in the loop
|
||||
* takes 3 clocks. Three is for branch and subtract in the delay slot.
|
||||
*/
|
||||
extern int cpuspeed;
|
||||
#define DELAY(n) { register int N = cpuspeed * (n); while ((N -= 3) > 0); }
|
||||
#endif /*!_LOCORE */
|
||||
#endif
|
||||
|
||||
#else /* !_KERNEL */
|
||||
#define DELAY(n) { register int N = (n); while (--N > 0); }
|
||||
#endif /* !_KERNEL */
|
||||
#endif /* _LOCORE */
|
||||
#endif /* _KERNEL */
|
||||
|
||||
#endif /* _ARC_PARAM_H_ */
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* $NetBSD: pcb.h,v 1.3 2000/01/23 20:08:29 soda Exp $ */
|
||||
/* $NetBSD: pcb.h,v 1.4 2000/01/23 21:01:57 soda Exp $ */
|
||||
/* $OpenBSD: pcb.h,v 1.2 1996/07/30 20:24:26 pefo Exp $ */
|
||||
|
||||
#include <mips/pcb.h>
|
||||
|
@ -1,4 +1,6 @@
|
||||
/* $NetBSD: pccons.h,v 1.3 2000/01/23 20:08:29 soda Exp $ */
|
||||
/* $NetBSD: pccons.h,v 1.4 2000/01/23 21:01:57 soda Exp $ */
|
||||
/* $OpenBSD: pccons.h,v 1.2 1996/09/01 16:50:12 deraadt Exp $ */
|
||||
/* NetBSD: pccons.h,v 1.4 1996/02/02 18:06:06 mycroft Exp */
|
||||
|
||||
/*
|
||||
* pccons.h -- pccons ioctl definitions
|
||||
@ -9,10 +11,36 @@
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
/* key types -- warning: pccons.c depends on most values */
|
||||
|
||||
#define KB_SCROLL 0x0001 /* stop output */
|
||||
#define KB_NUM 0x0002 /* numeric shift cursors vs. numeric */
|
||||
#define KB_CAPS 0x0004 /* caps shift -- swaps case of letter */
|
||||
#define KB_SHIFT 0x0008 /* keyboard shift */
|
||||
#define KB_CTL 0x0010 /* control shift -- allows ctl function */
|
||||
#define KB_ASCII 0x0020 /* ascii code for this key */
|
||||
#define KB_ALTGR 0x0040 /* alternate graphics shift */
|
||||
#define KB_ALT 0x0080 /* alternate shift -- alternate chars */
|
||||
#define KB_FUNC 0x0100 /* function key */
|
||||
#define KB_KP 0x0200 /* Keypad keys */
|
||||
#define KB_NONE 0x0400 /* no function */
|
||||
|
||||
#define KB_CODE_SIZE 4 /* Use a max of 4 for now... */
|
||||
#define KB_NUM_KEYS 128 /* Number of scan codes */
|
||||
typedef struct {
|
||||
u_short type;
|
||||
char unshift[KB_CODE_SIZE];
|
||||
char shift[KB_CODE_SIZE];
|
||||
char ctl[KB_CODE_SIZE];
|
||||
char altgr[KB_CODE_SIZE];
|
||||
char shift_altgr[KB_CODE_SIZE];
|
||||
} pccons_keymap_t;
|
||||
|
||||
#define CONSOLE_X_MODE_ON _IO('t',121)
|
||||
#define CONSOLE_X_MODE_OFF _IO('t',122)
|
||||
#define CONSOLE_X_BELL _IOW('t',123,int[2])
|
||||
#define CONSOLE_SET_TYPEMATIC_RATE _IOW('t',124,u_char)
|
||||
#define CONSOLE_GET_KEYMAP _IOR('t',128,pccons_keymap_t[KB_NUM_KEYS])
|
||||
#define CONSOLE_SET_KEYMAP _IOW('t',129,pccons_keymap_t[KB_NUM_KEYS])
|
||||
|
||||
#endif /* _PCCONS_H_ */
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* $NetBSD: pio.h,v 1.2 2000/01/23 21:01:57 soda Exp $ */
|
||||
/* $OpenBSD: pio.h,v 1.3 1997/04/19 17:19:58 pefo Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -1,6 +1,7 @@
|
||||
/* $NetBSD: pmap.h,v 1.3 2000/01/23 20:08:31 soda Exp $ */
|
||||
/* $NetBSD: pmap.h,v 1.4 2000/01/23 21:01:58 soda Exp $ */
|
||||
/* $OpenBSD: pmap.h,v 1.3 1997/04/19 17:19:58 pefo Exp $ */
|
||||
|
||||
#include <mips/pmap.h>
|
||||
#include <mips/include/pmap.h>
|
||||
|
||||
#define pica_trunc_seg(a) mips_trunc_seg(a)
|
||||
#define pica_round_seg(a) mips_round_seg(a)
|
||||
#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count)
|
||||
#define PMAP_PREFER(pa, va) pmap_prefer((pa), (va))
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* $NetBSD: proc.h,v 1.3 2000/01/23 20:08:31 soda Exp $ */
|
||||
/* $NetBSD: proc.h,v 1.4 2000/01/23 21:01:58 soda Exp $ */
|
||||
/* $OpenBSD: proc.h,v 1.2 1996/07/30 20:24:27 pefo Exp $ */
|
||||
/* NetBSD: proc.h,v 1.4 1994/10/26 21:09:52 cgd Exp */
|
||||
|
||||
#include <mips/proc.h>
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* $NetBSD: profile.h,v 1.3 2000/01/23 20:08:32 soda Exp $ */
|
||||
/* $NetBSD: profile.h,v 1.4 2000/01/23 21:01:58 soda Exp $ */
|
||||
/* $OpenBSD: profile.h,v 1.1.1.1 1996/06/24 09:07:18 pefo Exp $ */
|
||||
|
||||
#include <mips/profile.h>
|
||||
|
@ -1,3 +1,3 @@
|
||||
/* $NetBSD: psl.h,v 1.4 2000/01/23 20:08:33 soda Exp $ */
|
||||
/* $NetBSD: psl.h,v 1.5 2000/01/23 21:01:58 soda Exp $ */
|
||||
|
||||
#include <mips/psl.h>
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* $NetBSD: pte.h,v 1.5 2000/01/23 20:08:34 soda Exp $ */
|
||||
/* $NetBSD: pte.h,v 1.6 2000/01/23 21:01:58 soda Exp $ */
|
||||
/* $OpenBSD: pte.h,v 1.3 1997/01/22 22:41:15 pefo Exp $ */
|
||||
|
||||
#include <mips/pte.h>
|
||||
|
@ -1,3 +1,6 @@
|
||||
/* $NetBSD: ptrace.h,v 1.3 2000/01/23 20:08:34 soda Exp $ */
|
||||
/* $NetBSD: ptrace.h,v 1.4 2000/01/23 21:01:58 soda Exp $ */
|
||||
/* $OpenBSD: ptrace.h,v 1.1.1.1 1996/06/24 09:07:18 pefo Exp $ */
|
||||
|
||||
#include <mips/ptrace.h>
|
||||
|
||||
#define PT_STEP (PT_FIRSTMACH + 0)
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* $NetBSD: reg.h,v 1.3 2000/01/23 20:08:35 soda Exp $ */
|
||||
/* $NetBSD: reg.h,v 1.4 2000/01/23 21:01:58 soda Exp $ */
|
||||
/* $OpenBSD: reg.h,v 1.1.1.1 1996/06/24 09:07:18 pefo Exp $ */
|
||||
/* NetBSD: reg.h,v 1.6 1995/12/20 02:00:27 jonathan Exp */
|
||||
|
||||
#include <mips/reg.h>
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* $NetBSD: regdef.h,v 1.5 2000/01/23 20:08:36 soda Exp $ */
|
||||
/* $NetBSD: regdef.h,v 1.6 2000/01/23 21:01:58 soda Exp $ */
|
||||
/* $OpenBSD: regdef.h,v 1.1.1.1 1996/06/24 09:07:18 pefo Exp $ */
|
||||
/* NetBSD: regdef.h,v 1.4 1994/10/26 21:09:58 cgd Exp */
|
||||
|
||||
#include <mips/regdef.h>
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* $NetBSD: regnum.h,v 1.3 2000/01/23 20:08:36 soda Exp $ */
|
||||
/* $NetBSD: regnum.h,v 1.4 2000/01/23 21:01:58 soda Exp $ */
|
||||
/* $OpenBSD: regnum.h,v 1.1.1.1 1996/06/24 09:07:18 pefo Exp $ */
|
||||
/* NetBSD: reg.h,v 1.5 1995/01/18 06:40:12 mellon Exp */
|
||||
|
||||
#include <mips/regnum.h>
|
||||
|
@ -1,5 +1,39 @@
|
||||
/* $NetBSD: reloc.h,v 1.3 2000/01/23 20:08:37 soda Exp $ */
|
||||
/* $NetBSD: reloc.h,v 1.4 2000/01/23 21:01:58 soda Exp $ */
|
||||
/* $OpenBSD: reloc.h,v 1.2 1996/07/30 20:24:28 pefo Exp $ */
|
||||
|
||||
#include <mips/reloc.h>
|
||||
/*-
|
||||
* Copyright (c) 1992, 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.
|
||||
*
|
||||
* from: @(#)reloc.h 8.1 (Berkeley) 6/10/93
|
||||
* from: Header: reloc.h,v 1.6 92/06/20 09:59:37 torek Exp
|
||||
*/
|
||||
|
||||
#define relocation_info_pica reloc_info_mips
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* $NetBSD: setjmp.h,v 1.3 2000/01/23 20:08:37 soda Exp $ */
|
||||
/* $NetBSD: setjmp.h,v 1.4 2000/01/23 21:01:58 soda Exp $ */
|
||||
/* $OpenBSD: setjmp.h,v 1.1.1.1 1996/06/24 09:07:18 pefo Exp $ */
|
||||
/* NetBSD: setjmp.h,v 1.1 1994/12/20 10:37:05 cgd Exp */
|
||||
|
||||
#include <mips/setjmp.h>
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* $NetBSD: signal.h,v 1.3 2000/01/23 20:08:38 soda Exp $ */
|
||||
/* $NetBSD: signal.h,v 1.4 2000/01/23 21:01:58 soda Exp $ */
|
||||
/* $OpenBSD: signal.h,v 1.1.1.1 1996/06/24 09:07:18 pefo Exp $ */
|
||||
/* NetBSD: signal.h,v 1.6 1995/01/18 06:42:01 mellon Exp */
|
||||
|
||||
#include <mips/signal.h>
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* $NetBSD: stdarg.h,v 1.3 2000/01/23 20:08:39 soda Exp $ */
|
||||
/* $NetBSD: stdarg.h,v 1.4 2000/01/23 21:01:58 soda Exp $ */
|
||||
/* $OpenBSD: stdarg.h,v 1.2 1996/07/30 20:24:29 pefo Exp $ */
|
||||
/* NetBSD: stdarg.h,v 1.7 1995/03/28 18:19:28 jtc Exp */
|
||||
|
||||
#include <mips/stdarg.h>
|
||||
|
@ -1,3 +1,9 @@
|
||||
/* $NetBSD: trap.h,v 1.3 2000/01/23 20:08:40 soda Exp $ */
|
||||
/* $NetBSD: trap.h,v 1.4 2000/01/23 21:01:59 soda Exp $ */
|
||||
/* $OpenBSD: trap.h,v 1.1.1.1 1996/06/24 09:07:18 pefo Exp $ */
|
||||
|
||||
#include <mips/trap.h>
|
||||
|
||||
#ifdef _KERNEL
|
||||
extern int arc_hardware_intr __P((unsigned mask, unsigned pc,
|
||||
unsigned statusReg, unsigned causeReg));
|
||||
#endif /* _KERNEL */
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* $NetBSD: types.h,v 1.5 2000/01/23 20:08:40 soda Exp $ */
|
||||
/* $NetBSD: types.h,v 1.6 2000/01/23 21:01:59 soda Exp $ */
|
||||
/* $OpenBSD: types.h,v 1.2 1997/04/19 17:19:59 pefo Exp $ */
|
||||
/* NetBSD: types.h,v 1.10 1995/07/06 03:39:43 cgd Exp */
|
||||
|
||||
#include <mips/types.h>
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* $NetBSD: varargs.h,v 1.3 2000/01/23 20:08:41 soda Exp $ */
|
||||
/* $NetBSD: varargs.h,v 1.4 2000/01/23 21:01:59 soda Exp $ */
|
||||
/* $OpenBSD: varargs.h,v 1.2 1996/07/30 20:24:29 pefo Exp $ */
|
||||
/* NetBSD: varargs.h,v 1.8 1995/03/28 18:19:30 jtc Exp */
|
||||
|
||||
#include <mips/varargs.h>
|
||||
|
@ -1,11 +1,29 @@
|
||||
/* $NetBSD: vmparam.h,v 1.4 2000/01/23 20:08:42 soda Exp $ */
|
||||
/* $NetBSD: vmparam.h,v 1.5 2000/01/23 21:01:59 soda Exp $ */
|
||||
/* $OpenBSD: vmparam.h,v 1.3 1997/04/19 17:19:59 pefo Exp $ */
|
||||
/* NetBSD: vmparam.h,v 1.5 1994/10/26 21:10:10 cgd Exp */
|
||||
|
||||
#include <mips/vmparam.h>
|
||||
|
||||
/*
|
||||
* PICA has one physical memory segment.
|
||||
* Maximum number of contigous physical memory segment.
|
||||
*/
|
||||
#define VM_PHYSSEG_MAX 1
|
||||
#define VM_PHYSSEG_MAX 16
|
||||
|
||||
#define VM_NFREELIST 1
|
||||
#define VM_FREELIST_DEFAULT 0
|
||||
|
||||
#if 0 /* changed in OpenBSD */
|
||||
#define USRTEXT 0x00400000
|
||||
#endif
|
||||
|
||||
#if 0 /* defined in <mips/vmparam.h> in NetBSD, but not defined in OpenBSD */
|
||||
#define BTOPUSRSTACK 0x80000 /* btop(USRSTACK) */
|
||||
#define LOWPAGES 0x00001
|
||||
#define HIGHPAGES 0
|
||||
|
||||
#define mapin(pte, v, pfnum, prot) \
|
||||
(*(int *)(pte) = ((pfnum) << PG_SHIFT) | (prot), MachTLBFlushAddr(v))
|
||||
#endif
|
||||
|
||||
/* pcb base */
|
||||
/*#define pcbb(p) ((u_int)(p)->p_addr) */
|
||||
|
@ -1,4 +1,6 @@
|
||||
/* $NetBSD: isabus.c,v 1.4 2000/01/23 20:08:59 soda Exp $ */
|
||||
/* $NetBSD: isabus.c,v 1.5 2000/01/23 21:01:59 soda Exp $ */
|
||||
/* $OpenBSD: isabus.c,v 1.11 1997/04/19 17:20:01 pefo Exp $ */
|
||||
/* NetBSD: isa.c,v 1.33 1995/06/28 04:30:51 cgd Exp */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1995 Per Fogelstrom
|
||||
@ -87,32 +89,412 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/user.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <vm/vm.h>
|
||||
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/pio.h>
|
||||
#include <machine/autoconf.h>
|
||||
#include <machine/intr.h>
|
||||
|
||||
#include <pica/pica/pica.h>
|
||||
#include <arc/arc/arctype.h>
|
||||
#include <arc/pica/pica.h>
|
||||
|
||||
#include <dev/isa/isareg.h>
|
||||
#ifdef notyet
|
||||
#include <dev/isa/isavar.h>
|
||||
#endif
|
||||
#include <pica/isa/timerreg.h>
|
||||
#include <pica/isa/spkrreg.h>
|
||||
|
||||
extern int isa_io_base;
|
||||
extern int isa_mem_base;
|
||||
#include <arc/isa/timerreg.h>
|
||||
#include <arc/isa/spkrreg.h>
|
||||
#include <machine/isa_machdep.h>
|
||||
|
||||
static int beeping;
|
||||
|
||||
#define isa_outb(x,y) outb(isa_io_base + (x), y)
|
||||
#define isa_inb(x) inb(isa_io_base + (x))
|
||||
#define IRQ_SLAVE 2
|
||||
#define ICU_LEN 16
|
||||
|
||||
struct isabr_softc {
|
||||
struct device sc_dv;
|
||||
struct arc_isa_bus arc_isa_cs;
|
||||
struct abus sc_bus;
|
||||
};
|
||||
|
||||
/* Definition of the driver for autoconfig. */
|
||||
int isabrmatch(struct device *, struct cfdata *, void *);
|
||||
void isabrattach(struct device *, struct device *, void *);
|
||||
int isabrprint(void *, const char *);
|
||||
|
||||
struct cfattach isabr_ca = {
|
||||
sizeof(struct isabr_softc), isabrmatch, isabrattach
|
||||
};
|
||||
extern struct cfdriver isabr_cd;
|
||||
|
||||
void *isabr_intr_establish __P((isa_chipset_tag_t, int, int, int,
|
||||
int (*)(void *), void *));
|
||||
void isabr_intr_disestablish __P((isa_chipset_tag_t, void*));
|
||||
int isabr_iointr __P((unsigned int, struct clockframe *));
|
||||
void isabr_initicu __P((void));
|
||||
void intr_calculatemasks __P((void));
|
||||
int fakeintr __P((void *a));
|
||||
|
||||
extern int cputype;
|
||||
|
||||
|
||||
int
|
||||
isabrmatch(parent, match, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *match;
|
||||
void *aux;
|
||||
{
|
||||
struct confargs *ca = aux;
|
||||
|
||||
/* Make sure that we're looking for a ISABR. */
|
||||
if (strcmp(ca->ca_name, isabr_cd.cd_name) != 0)
|
||||
return (0);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
isabrattach(parent, self, aux)
|
||||
struct device *parent;
|
||||
struct device *self;
|
||||
void *aux;
|
||||
{
|
||||
struct isabr_softc *sc = (struct isabr_softc *)self;
|
||||
struct isabus_attach_args iba;
|
||||
|
||||
printf("\n");
|
||||
|
||||
/* Initialize interrupt controller */
|
||||
isabr_initicu();
|
||||
|
||||
/* set up interrupt handlers */
|
||||
switch(cputype) {
|
||||
case ACER_PICA_61:
|
||||
case MAGNUM:
|
||||
set_intr(MIPS_INT_MASK_2, isabr_iointr, 3);
|
||||
break;
|
||||
case DESKSTATION_TYNE:
|
||||
set_intr(MIPS_INT_MASK_2, isabr_iointr, 2);
|
||||
break;
|
||||
case DESKSTATION_RPC44:
|
||||
set_intr(MIPS_INT_MASK_2, isabr_iointr, 2);
|
||||
break;
|
||||
default:
|
||||
panic("isabrattach: unkown cputype!");
|
||||
}
|
||||
|
||||
/*XXX we may remove the abus part of the softc struct... */
|
||||
sc->sc_bus.ab_dv = (struct device *)sc;
|
||||
sc->sc_bus.ab_type = BUS_ISABR;
|
||||
|
||||
sc->arc_isa_cs.ic_intr_establish = isabr_intr_establish;
|
||||
sc->arc_isa_cs.ic_intr_disestablish = isabr_intr_disestablish;
|
||||
|
||||
iba.iba_busname = "isa";
|
||||
iba.iba_iot = (bus_space_tag_t)&arc_bus_io;
|
||||
iba.iba_memt = (bus_space_tag_t)&arc_bus_mem;
|
||||
iba.iba_ic = &sc->arc_isa_cs;
|
||||
config_found(self, &iba, isabrprint);
|
||||
}
|
||||
|
||||
int
|
||||
isabrprint(aux, pnp)
|
||||
void *aux;
|
||||
const char *pnp;
|
||||
{
|
||||
struct confargs *ca = aux;
|
||||
|
||||
if (pnp)
|
||||
printf("%s at %s", ca->ca_name, pnp);
|
||||
printf(" isa_io_base 0x%x isa_mem_base 0x%x",
|
||||
arc_bus_io.bus_base, arc_bus_mem.bus_base);
|
||||
return (UNCONF);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Interrupt system driver code
|
||||
* ============================
|
||||
*/
|
||||
#define LEGAL_IRQ(x) ((x) >= 0 && (x) < ICU_LEN && (x) != 2)
|
||||
|
||||
int imen;
|
||||
int intrtype[ICU_LEN], intrmask[ICU_LEN], intrlevel[ICU_LEN];
|
||||
struct intrhand *intrhand[ICU_LEN];
|
||||
|
||||
int fakeintr(a)
|
||||
void *a;
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Recalculate the interrupt masks from scratch.
|
||||
* We could code special registry and deregistry versions of this function that
|
||||
* would be faster, but the code would be nastier, and we don't expect this to
|
||||
* happen very much anyway.
|
||||
*/
|
||||
void
|
||||
intr_calculatemasks()
|
||||
{
|
||||
int irq, level;
|
||||
struct intrhand *q;
|
||||
|
||||
/* First, figure out which levels each IRQ uses. */
|
||||
for (irq = 0; irq < ICU_LEN; irq++) {
|
||||
register int levels = 0;
|
||||
for (q = intrhand[irq]; q; q = q->ih_next)
|
||||
levels |= 1 << q->ih_level;
|
||||
intrlevel[irq] = levels;
|
||||
}
|
||||
|
||||
/* Then figure out which IRQs use each level. */
|
||||
for (level = 0; level < 5; level++) {
|
||||
register int irqs = 0;
|
||||
for (irq = 0; irq < ICU_LEN; irq++)
|
||||
if (intrlevel[irq] & (1 << level))
|
||||
irqs |= 1 << irq;
|
||||
imask[level] = irqs | SIR_ALLMASK;
|
||||
}
|
||||
|
||||
/*
|
||||
* There are tty, network and disk drivers that use free() at interrupt
|
||||
* time, so imp > (tty | net | bio).
|
||||
*/
|
||||
imask[IPL_IMP] |= imask[IPL_TTY] | imask[IPL_NET] | imask[IPL_BIO];
|
||||
|
||||
/*
|
||||
* Enforce a hierarchy that gives slow devices a better chance at not
|
||||
* dropping data.
|
||||
*/
|
||||
imask[IPL_TTY] |= imask[IPL_NET] | imask[IPL_BIO];
|
||||
imask[IPL_NET] |= imask[IPL_BIO];
|
||||
|
||||
/*
|
||||
* These are pseudo-levels.
|
||||
*/
|
||||
imask[IPL_NONE] = 0x00000000;
|
||||
imask[IPL_HIGH] = 0xffffffff;
|
||||
|
||||
/* And eventually calculate the complete masks. */
|
||||
for (irq = 0; irq < ICU_LEN; irq++) {
|
||||
register int irqs = 1 << irq;
|
||||
for (q = intrhand[irq]; q; q = q->ih_next)
|
||||
irqs |= imask[q->ih_level];
|
||||
intrmask[irq] = irqs | SIR_ALLMASK;
|
||||
}
|
||||
|
||||
/* Lastly, determine which IRQs are actually in use. */
|
||||
{
|
||||
register int irqs = 0;
|
||||
for (irq = 0; irq < ICU_LEN; irq++)
|
||||
if (intrhand[irq])
|
||||
irqs |= 1 << irq;
|
||||
if (irqs >= 0x100) /* any IRQs >= 8 in use */
|
||||
irqs |= 1 << IRQ_SLAVE;
|
||||
imen = ~irqs;
|
||||
isa_outb(IO_ICU1 + 1, imen);
|
||||
isa_outb(IO_ICU2 + 1, imen >> 8);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Establish a ISA bus interrupt.
|
||||
*/
|
||||
void *
|
||||
isabr_intr_establish(ic, irq, type, level, ih_fun, ih_arg)
|
||||
isa_chipset_tag_t ic;
|
||||
int irq;
|
||||
int type;
|
||||
int level;
|
||||
int (*ih_fun) __P((void *));
|
||||
void *ih_arg;
|
||||
{
|
||||
struct intrhand **p, *q, *ih;
|
||||
static struct intrhand fakehand = {NULL, fakeintr};
|
||||
extern int cold;
|
||||
|
||||
/* no point in sleeping unless someone can free memory. */
|
||||
ih = malloc(sizeof *ih, M_DEVBUF, cold ? M_NOWAIT : M_WAITOK);
|
||||
if (ih == NULL)
|
||||
panic("isa_intr_establish: can't malloc handler info");
|
||||
|
||||
if (!LEGAL_IRQ(irq) || type == IST_NONE)
|
||||
panic("intr_establish: bogus irq or type");
|
||||
|
||||
switch (intrtype[irq]) {
|
||||
case IST_EDGE:
|
||||
case IST_LEVEL:
|
||||
if (type == intrtype[irq])
|
||||
break;
|
||||
case IST_PULSE:
|
||||
if (type != IST_NONE)
|
||||
panic("intr_establish: can't share %s with %s",
|
||||
isa_intr_typename(intrtype[irq]),
|
||||
isa_intr_typename(type));
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Figure out where to put the handler.
|
||||
* This is O(N^2), but we want to preserve the order, and N is
|
||||
* generally small.
|
||||
*/
|
||||
for (p = &intrhand[irq]; (q = *p) != NULL; p = &q->ih_next)
|
||||
;
|
||||
|
||||
/*
|
||||
* Actually install a fake handler momentarily, since we might be doing
|
||||
* this with interrupts enabled and don't want the real routine called
|
||||
* until masking is set up.
|
||||
*/
|
||||
fakehand.ih_level = level;
|
||||
*p = &fakehand;
|
||||
|
||||
intr_calculatemasks();
|
||||
|
||||
/*
|
||||
* Poke the real handler in now.
|
||||
*/
|
||||
ih->ih_fun = ih_fun;
|
||||
ih->ih_arg = ih_arg;
|
||||
ih->ih_count = 0;
|
||||
ih->ih_next = NULL;
|
||||
ih->ih_level = level;
|
||||
ih->ih_irq = irq;
|
||||
ih->ih_what = ""; /* XXX - should be eliminated */
|
||||
*p = ih;
|
||||
|
||||
return (ih);
|
||||
}
|
||||
|
||||
void
|
||||
isabr_intr_disestablish(ic, arg)
|
||||
isa_chipset_tag_t ic;
|
||||
void *arg;
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Process an interrupt from the ISA bus.
|
||||
*/
|
||||
int
|
||||
isabr_iointr(mask, cf)
|
||||
unsigned mask;
|
||||
struct clockframe *cf;
|
||||
{
|
||||
struct intrhand *ih;
|
||||
int isa_vector;
|
||||
int o_imen;
|
||||
char vector;
|
||||
|
||||
(void) &isa_vector; /* shut off gcc unused-variable warnings */
|
||||
|
||||
switch(cputype) {
|
||||
case ACER_PICA_61:
|
||||
case MAGNUM:
|
||||
isa_vector = in32(R4030_SYS_ISA_VECTOR) & (ICU_LEN - 1);
|
||||
break;
|
||||
|
||||
case DESKSTATION_TYNE:
|
||||
isa_outb(IO_ICU1, 0x0f); /* Poll */
|
||||
vector = isa_inb(IO_ICU1);
|
||||
if(vector > 0 || (isa_vector = vector & 7) == 2) {
|
||||
isa_outb(IO_ICU2, 0x0f);
|
||||
vector = isa_inb(IO_ICU2);
|
||||
if(vector > 0) {
|
||||
printf("isa: spurious interrupt.\n");
|
||||
return(~0);
|
||||
}
|
||||
isa_vector = (vector & 7) | 8;
|
||||
}
|
||||
break;
|
||||
|
||||
case DESKSTATION_RPC44:
|
||||
isa_outb(IO_ICU1, 0x0f); /* Poll */
|
||||
vector = isa_inb(IO_ICU1);
|
||||
if(vector > 0 || (isa_vector = vector & 7) == 2) {
|
||||
isa_outb(IO_ICU2, 0x0f);
|
||||
vector = isa_inb(IO_ICU2);
|
||||
if(vector > 0) {
|
||||
printf("isa: spurious interrupt.\n");
|
||||
return(~0);
|
||||
}
|
||||
isa_vector = (vector & 7) | 8;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
o_imen = imen;
|
||||
imen |= 1 << (isa_vector & (ICU_LEN - 1));
|
||||
if(isa_vector & 0x08) {
|
||||
isa_inb(IO_ICU2 + 1);
|
||||
isa_outb(IO_ICU2 + 1, imen >> 8);
|
||||
isa_outb(IO_ICU2, 0x60 + (isa_vector & 7));
|
||||
isa_outb(IO_ICU1, 0x60 + IRQ_SLAVE);
|
||||
}
|
||||
else {
|
||||
isa_inb(IO_ICU1 + 1);
|
||||
isa_outb(IO_ICU1 + 1, imen);
|
||||
isa_outb(IO_ICU1, 0x60 + isa_vector);
|
||||
}
|
||||
ih = intrhand[isa_vector];
|
||||
if(isa_vector == 0) { /* Clock */ /*XXX*/
|
||||
(*ih->ih_fun)(cf);
|
||||
ih = ih->ih_next;
|
||||
}
|
||||
while(ih) {
|
||||
(*ih->ih_fun)(ih->ih_arg);
|
||||
ih = ih->ih_next;
|
||||
}
|
||||
imen = o_imen;
|
||||
isa_inb(IO_ICU1 + 1);
|
||||
isa_inb(IO_ICU2 + 1);
|
||||
isa_outb(IO_ICU1 + 1, imen);
|
||||
isa_outb(IO_ICU2 + 1, imen >> 8);
|
||||
|
||||
return(~0); /* Dont reenable */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Initialize the Interrupt controller logic.
|
||||
*/
|
||||
void
|
||||
isabr_initicu()
|
||||
{
|
||||
|
||||
isa_outb(IO_ICU1, 0x11); /* reset; program device, four bytes */
|
||||
isa_outb(IO_ICU1+1, 0); /* starting at this vector index */
|
||||
isa_outb(IO_ICU1+1, 1 << IRQ_SLAVE); /* slave on line 2 */
|
||||
isa_outb(IO_ICU1+1, 1); /* 8086 mode */
|
||||
isa_outb(IO_ICU1+1, 0xff); /* leave interrupts masked */
|
||||
isa_outb(IO_ICU1, 0x68); /* special mask mode (if available) */
|
||||
isa_outb(IO_ICU1, 0x0a); /* Read IRR by default. */
|
||||
#ifdef REORDER_IRQ
|
||||
isa_outb(IO_ICU1, 0xc0 | (3 - 1)); /* pri order 3-7, 0-2 (com2 first) */
|
||||
#endif
|
||||
|
||||
isa_outb(IO_ICU2, 0x11); /* reset; program device, four bytes */
|
||||
isa_outb(IO_ICU2+1, 8); /* staring at this vector index */
|
||||
isa_outb(IO_ICU2+1, IRQ_SLAVE);
|
||||
isa_outb(IO_ICU2+1, 1); /* 8086 mode */
|
||||
isa_outb(IO_ICU2+1, 0xff); /* leave interrupts masked */
|
||||
isa_outb(IO_ICU2, 0x68); /* special mask mode (if available) */
|
||||
isa_outb(IO_ICU2, 0x0a); /* Read IRR by default. */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* SPEAKER BEEPER...
|
||||
*/
|
||||
void
|
||||
sysbeepstop(arg)
|
||||
void *arg;
|
||||
@ -132,14 +514,19 @@ sysbeep(pitch, period)
|
||||
{
|
||||
static int last_pitch, last_period;
|
||||
int s;
|
||||
extern int cold;
|
||||
|
||||
if (cold)
|
||||
return; /* Can't beep yet. */
|
||||
|
||||
if (beeping)
|
||||
untimeout(sysbeepstop, 0);
|
||||
if (!beeping || last_pitch != pitch) {
|
||||
s = splhigh();
|
||||
isa_outb(TIMER_MODE, TIMER_SEL2 | TIMER_16BIT | TIMER_SQWAVE);
|
||||
isa_outb(TIMER_CNTR2, TIMER_DIV(pitch) % 256);
|
||||
isa_outb(TIMER_CNTR2, TIMER_DIV(pitch) / 256);
|
||||
isa_outb(IO_TIMER1 + TIMER_MODE,
|
||||
TIMER_SEL2 | TIMER_16BIT | TIMER_SQWAVE);
|
||||
isa_outb(IO_TIMER1 + TIMER_CNTR2, TIMER_DIV(pitch) % 256);
|
||||
isa_outb(IO_TIMER1 + TIMER_CNTR2, TIMER_DIV(pitch) / 256);
|
||||
isa_outb(PITAUX_PORT, isa_inb(PITAUX_PORT) | PIT_SPKR);
|
||||
splx(s);
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
/* $NetBSD: isadma.c,v 1.2 2000/01/23 21:01:59 soda Exp $ */
|
||||
/* $OpenBSD: isadma.c,v 1.2 1996/11/23 21:45:34 kstailey Exp $ */
|
||||
/* $NetBSD: isadma.c,v 1.1.1.1 2000/01/23 20:24:29 soda Exp $ */
|
||||
/* NetBSD: isadma.c,v 1.19 1996/04/29 20:03:26 christos Exp */
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -44,15 +45,15 @@ static u_int8_t dmamode[4] = {
|
||||
DMA37MD_WRITE | DMA37MD_LOOP
|
||||
};
|
||||
|
||||
int isadmamatch __P((struct device *, void *, void *));
|
||||
int isadmamatch __P((struct device *, struct cfdata *, void *));
|
||||
void isadmaattach __P((struct device *, struct device *, void *));
|
||||
int isadmaprint __P((void *, const char *));
|
||||
|
||||
struct isadma_softc {
|
||||
struct device sc_dev;
|
||||
bus_chipset_tag_t sc_bc;
|
||||
bus_io_handle_t sc_ioh1;
|
||||
bus_io_handle_t sc_ioh2;
|
||||
bus_space_tag_t sc_iot;
|
||||
bus_space_handle_t sc_ioh1;
|
||||
bus_space_handle_t sc_ioh2;
|
||||
}
|
||||
|
||||
struct cfattach isadma_ca = {
|
||||
@ -65,7 +66,8 @@ struct cfdriver isadma_cd = {
|
||||
|
||||
isadmamatch(parent, match, aux)
|
||||
struct device *parent;
|
||||
void *match, *aux;
|
||||
struct cfdata *match;
|
||||
void *aux;
|
||||
{
|
||||
struct isa_attach_args *ia = aux;
|
||||
|
||||
@ -81,16 +83,16 @@ isadmaattach(parent, self, aux)
|
||||
{
|
||||
struct isadma_softc *sc = (void *)self;
|
||||
struct isa_attach_args *ia = aux;
|
||||
bus_chipset_tag_t bc;
|
||||
bus_io_handle_t ioh;
|
||||
bus_space_tag_t iot;
|
||||
bus_space_handle_t ioh;
|
||||
|
||||
printf("\n");
|
||||
|
||||
bc = sc->sc_bc = ia->ia_bc;
|
||||
if (bus_io_map(bc, IO_DMA1, DMA_NREGS, &ioh))
|
||||
iot = sc->sc_iot = ia->ia_iot;
|
||||
if (bus_space_map(iot, IO_DMA1, DMA_NREGS, 0, &ioh))
|
||||
panic("isadmaattach: couldn't map I/O ports");
|
||||
sc->sc_ioh1 = ioh;
|
||||
if (bus_io_map(bc, IO_DMA2, DMA_NREGS*2, &ioh))
|
||||
if (bus_space_map(iot, IO_DMA2, DMA_NREGS*2, 0, &ioh))
|
||||
panic("isadmaattach: couldn't map I/O ports");
|
||||
sc->sc_ioh2 = ioh;
|
||||
isadma_sc = sc;
|
||||
@ -105,7 +107,7 @@ isadma_cascade(chan)
|
||||
int chan;
|
||||
{
|
||||
struct isadma_softc *sc = isadma_sc;
|
||||
bus_chipset_tag_t bc = sc->sc_bc;
|
||||
bus_space_tag_t iot = sc->sc_iot;
|
||||
|
||||
#ifdef ISADMA_DEBUG
|
||||
if (chan < 0 || chan > 7)
|
||||
@ -114,13 +116,13 @@ isadma_cascade(chan)
|
||||
|
||||
/* set dma channel mode, and set dma channel mode */
|
||||
if ((chan & 4) == 0) {
|
||||
bus_io_write_1(bc, sc->sc_ioh1, DMA1_MODE, chan | DMA37MD_CASCADE);
|
||||
bus_io_write_1(bc, sc->sc_ioh1, DMA1_SMSK, chan);
|
||||
bus_space_write_1(iot, sc->sc_ioh1, DMA1_MODE, chan | DMA37MD_CASCADE);
|
||||
bus_space_write_1(iot, sc->sc_ioh1, DMA1_SMSK, chan);
|
||||
} else {
|
||||
chan &= 3;
|
||||
|
||||
bus_io_write_1(bc, sc->sc_ioh2, DMA2_MODE, chan | DMA37MD_CASCADE);
|
||||
bus_io_write_1(bc, sc->sc_ioh2, DMA2_SMSK, chan);
|
||||
bus_space_write_1(iot, sc->sc_ioh2, DMA2_MODE, chan | DMA37MD_CASCADE);
|
||||
bus_space_write_1(iot, sc->sc_ioh2, DMA2_SMSK, chan);
|
||||
}
|
||||
}
|
||||
|
||||
@ -140,8 +142,8 @@ isadma_start(addr, nbytes, chan, flags)
|
||||
int mflags;
|
||||
vm_size_t size;
|
||||
struct isadma_softc *sc = isadma_sc;
|
||||
bus_chipset_tag_t bc = sc->sc_bc;
|
||||
bus_io_handle_t ioh;
|
||||
bus_space_tag_t iot = sc->sc_iot;
|
||||
bus_space_handle_t ioh;
|
||||
|
||||
#ifdef ISADMA_DEBUG
|
||||
if (chan < 0 || chan > 7 ||
|
||||
@ -182,8 +184,8 @@ isadma_start(addr, nbytes, chan, flags)
|
||||
* byte mode channels.
|
||||
*/
|
||||
/* set dma channel mode, and reset address ff */
|
||||
bus_io_write_1(bc, ioh, DMA1_MODE, chan | dmamode[flags]);
|
||||
bus_io_write_1(bc, ioh, DMA1_FFC, 0);
|
||||
bus_space_write_1(iot, ioh, DMA1_MODE, chan | dmamode[flags]);
|
||||
bus_space_write_1(iot, ioh, DMA1_FFC, 0);
|
||||
|
||||
/* send start address */
|
||||
waport = DMA1_CHN(chan);
|
||||
@ -196,7 +198,7 @@ isadma_start(addr, nbytes, chan, flags)
|
||||
outb(waport + 1, nbytes>>8);
|
||||
|
||||
/* unmask channel */
|
||||
bus_io_write_1(bc, ioh, DMA1_SMSK, chan | DMA37SM_CLEAR);
|
||||
bus_space_write_1(iot, ioh, DMA1_SMSK, chan | DMA37SM_CLEAR);
|
||||
} else {
|
||||
ioh = sc->sc_ioh2;
|
||||
/*
|
||||
@ -204,8 +206,8 @@ isadma_start(addr, nbytes, chan, flags)
|
||||
* word mode channels.
|
||||
*/
|
||||
/* set dma channel mode, and reset address ff */
|
||||
bus_io_write_1(bc, ioh, DMA2_MODE, (chan & 3) | dmamode[flags]);
|
||||
bus_io_write_1(bc, ioh, DMA2_FFC, 0);
|
||||
bus_space_write_1(iot, ioh, DMA2_MODE, (chan & 3) | dmamode[flags]);
|
||||
bus_space_write_1(iot, ioh, DMA2_FFC, 0);
|
||||
|
||||
/* send start address */
|
||||
waport = DMA2_CHN(chan & 3);
|
||||
@ -219,7 +221,7 @@ isadma_start(addr, nbytes, chan, flags)
|
||||
outb(waport + 2, nbytes>>8);
|
||||
|
||||
/* unmask channel */
|
||||
bus_io_write_1(bc, ioh, DMA2_SMSK, (chan & 3) | DMA37SM_CLEAR);
|
||||
bus_space_write_1(iot, ioh, DMA2_SMSK, (chan & 3) | DMA37SM_CLEAR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -229,7 +231,7 @@ isadma_abort(chan)
|
||||
{
|
||||
struct dma_info *di;
|
||||
struct isadma_softc *sc = isadma_sc;
|
||||
bus_chipset_tag_t bc = sc->sc_bc;
|
||||
bus_space_tag_t iot = sc->sc_iot;
|
||||
|
||||
#ifdef ISADMA_DEBUG
|
||||
if (chan < 0 || chan > 7)
|
||||
@ -244,9 +246,9 @@ isadma_abort(chan)
|
||||
|
||||
/* mask channel */
|
||||
if ((chan & 4) == 0)
|
||||
bus_io_write_1(bc, sc->sc_ioh1, DMA1_SMSK, DMA37SM_SET | chan);
|
||||
bus_space_write_1(iot, sc->sc_ioh1, DMA1_SMSK, DMA37SM_SET | chan);
|
||||
else
|
||||
bus_io_write_1(bc, sc->sc_ioh2, DMA2_SMSK, DMA37SM_SET | (chan & 3));
|
||||
bus_space_write_1(iot, sc->sc_ioh2, DMA2_SMSK, DMA37SM_SET | (chan & 3));
|
||||
|
||||
isadma_unmap(di->addr, di->nbytes, 1, di->phys);
|
||||
di->active = 0;
|
||||
@ -257,7 +259,7 @@ isadma_finished(chan)
|
||||
int chan;
|
||||
{
|
||||
struct isadma_softc *sc = isadma_sc;
|
||||
bus_chipset_tag_t bc = sc->sc_bc;
|
||||
bus_space_tag_t iot = sc->sc_iot;
|
||||
|
||||
#ifdef ISADMA_DEBUG
|
||||
if (chan < 0 || chan > 7)
|
||||
@ -266,9 +268,9 @@ isadma_finished(chan)
|
||||
|
||||
/* check that the terminal count was reached */
|
||||
if ((chan & 4) == 0)
|
||||
dma_finished |= bus_io_read_1(bc, sc->sc_ioh1, DMA1_SR) & 0x0f;
|
||||
dma_finished |= bus_space_read_1(iot, sc->sc_ioh1, DMA1_SR) & 0x0f;
|
||||
else
|
||||
dma_finished |= (bus_io_read_1(bc, sc->sc_ioh2, DMA2_SR) & 0x0f) << 4;
|
||||
dma_finished |= (bus_space_read_1(iot, sc->sc_ioh2, DMA2_SR) & 0x0f) << 4;
|
||||
|
||||
return ((dma_finished & (1 << chan)) != 0);
|
||||
}
|
||||
@ -280,7 +282,7 @@ isadma_done(chan)
|
||||
struct dma_info *di;
|
||||
u_char tc;
|
||||
struct isadma_softc *sc = isadma_sc;
|
||||
bus_chipset_tag_t bc = sc->sc_bc;
|
||||
bus_space_tag_t iot = sc->sc_iot;
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
if (chan < 0 || chan > 7)
|
||||
@ -295,18 +297,18 @@ isadma_done(chan)
|
||||
|
||||
/* check that the terminal count was reached */
|
||||
if ((chan & 4) == 0)
|
||||
tc = bus_io_read_1(bc, sc->sc_ioh1, DMA1_SR) & (1 << chan);
|
||||
tc = bus_space_read_1(iot, sc->sc_ioh1, DMA1_SR) & (1 << chan);
|
||||
else
|
||||
tc = bus_io_read_1(bc, sc->sc_ioh2, DMA2_SR) & (1 << (chan & 3));
|
||||
tc = bus_space_read_1(iot, sc->sc_ioh2, DMA2_SR) & (1 << (chan & 3));
|
||||
if (tc == 0)
|
||||
/* XXX probably should panic or something */
|
||||
log(LOG_ERR, "dma channel %d not finished\n", chan);
|
||||
|
||||
/* mask channel */
|
||||
if ((chan & 4) == 0)
|
||||
bus_io_write_1(bc, sc->sc_ioh1, DMA1_SMSK, DMA37SM_SET | chan);
|
||||
bus_space_write_1(iot, sc->sc_ioh1, DMA1_SMSK, DMA37SM_SET | chan);
|
||||
else
|
||||
bus_io_write_1(bc, sc->sc_ioh2, DMA2_SMSK, DMA37SM_SET | (chan & 3));
|
||||
bus_space_write_1(iot, sc->sc_ioh2, DMA2_SMSK, DMA37SM_SET | (chan & 3));
|
||||
|
||||
/* XXX Will this do what we want with DMAMODE_LOOP? */
|
||||
if (di->flags & DMAMODE_READ)
|
||||
|
@ -1,4 +1,5 @@
|
||||
/* $NetBSD: isadmareg.h,v 1.1.1.1 2000/01/23 20:24:29 soda Exp $ */
|
||||
/* $NetBSD: isadmareg.h,v 1.2 2000/01/23 21:01:59 soda Exp $ */
|
||||
/* NetBSD: isadmareg.h,v 1.4 1995/06/28 04:31:48 cgd Exp */
|
||||
|
||||
#include <dev/ic/i8237reg.h>
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
/* $NetBSD: spkrreg.h,v 1.1.1.2 2000/01/23 20:08:43 soda Exp $ */
|
||||
/* $NetBSD: spkrreg.h,v 1.2 2000/01/23 21:01:59 soda Exp $ */
|
||||
/* NetBSD: spkrreg.h,v 1.2 1994/10/27 04:18:16 cgd Exp */
|
||||
|
||||
/*
|
||||
* PIT port addresses and speaker control values
|
||||
|
@ -1,4 +1,5 @@
|
||||
/* $NetBSD: timerreg.h,v 1.1.1.2 2000/01/23 20:08:43 soda Exp $ */
|
||||
/* $NetBSD: timerreg.h,v 1.2 2000/01/23 21:01:59 soda Exp $ */
|
||||
/* NetBSD: timerreg.h,v 1.4 1994/10/27 04:18:17 cgd Exp */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993 The Regents of the University of California.
|
||||
@ -79,10 +80,10 @@
|
||||
/*
|
||||
* Macros for specifying values to be written into a mode register.
|
||||
*/
|
||||
#define TIMER_CNTR0 (IO_TIMER1 + 0) /* timer 0 counter port */
|
||||
#define TIMER_CNTR1 (IO_TIMER1 + 1) /* timer 1 counter port */
|
||||
#define TIMER_CNTR2 (IO_TIMER1 + 2) /* timer 2 counter port */
|
||||
#define TIMER_MODE (IO_TIMER1 + 3) /* timer mode port */
|
||||
#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 */
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* $NetBSD: pbcpcibus.c,v 1.2 2000/01/23 21:01:59 soda Exp $ */
|
||||
/* $OpenBSD: pbcpcibus.c,v 1.4 1997/04/19 17:20:02 pefo Exp $ */
|
||||
|
||||
/*
|
||||
@ -45,7 +46,6 @@
|
||||
#include <vm/vm.h>
|
||||
|
||||
#include <machine/autoconf.h>
|
||||
#include <machine/pte.h>
|
||||
#include <machine/cpu.h>
|
||||
|
||||
#include <dev/pci/pcireg.h>
|
||||
@ -60,7 +60,7 @@ extern vm_map_t phys_map;
|
||||
extern int cputype;
|
||||
extern char eth_hw_addr[]; /* Hardware ethernet address stored elsewhere */
|
||||
|
||||
int pbcpcibrmatch __P((struct device *, void *, void *));
|
||||
int pbcpcibrmatch __P((struct device *, struct cfdata *, void *));
|
||||
void pbcpcibrattach __P((struct device *, struct device *, void *));
|
||||
|
||||
void pbc_attach_hook __P((struct device *, struct device *,
|
||||
@ -93,7 +93,8 @@ struct pcibr_config pbc_config;
|
||||
int
|
||||
pbcpcibrmatch(parent, match, aux)
|
||||
struct device *parent;
|
||||
void *match, *aux;
|
||||
struct cfdata *match;
|
||||
void *aux;
|
||||
{
|
||||
struct confargs *ca = aux;
|
||||
|
||||
@ -182,7 +183,7 @@ vtophys(p)
|
||||
va = (vm_offset_t)curproc->p_addr + (va & ~UADDR);
|
||||
}
|
||||
if((vm_offset_t)va < VM_MIN_KERNEL_ADDRESS) {
|
||||
pa = CACHED_TO_PHYS(va);
|
||||
pa = MIPS_CACHED_TO_PHYS(va);
|
||||
}
|
||||
else {
|
||||
pa = pmap_extract(vm_map_pmap(phys_map), va);
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* $NetBSD: pci_machdep.h,v 1.2 2000/01/23 21:01:59 soda Exp $ */
|
||||
/* $OpenBSD: pci_machdep.h,v 1.2 1997/04/19 17:20:02 pefo Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* $NetBSD: pcibrvar.h,v 1.2 2000/01/23 21:02:00 soda Exp $ */
|
||||
/* $OpenBSD: pcibrvar.h,v 1.2 1997/04/10 16:29:32 pefo Exp $ */
|
||||
|
||||
/*
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user