diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-01-31 06:38:17 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-01-31 06:38:17 +0000 |
commit | 54703eca864c32c19283e9932bac38557752ff59 (patch) | |
tree | d8c87e2f2b8e6986e2a1691d5aec891792e3387c /sys/arch/pc532 | |
parent | 06635430a8456d19390703a682dff5f1b3c8c93f (diff) |
sync with netbsd
Diffstat (limited to 'sys/arch/pc532')
-rw-r--r-- | sys/arch/pc532/conf/KLONDIKE | 5 | ||||
-rw-r--r-- | sys/arch/pc532/conf/STEELHEAD | 8 | ||||
-rw-r--r-- | sys/arch/pc532/dev/ncr5380.c | 78 | ||||
-rw-r--r-- | sys/arch/pc532/dev/scn.c | 14 | ||||
-rw-r--r-- | sys/arch/pc532/include/cpufunc.h | 103 | ||||
-rw-r--r-- | sys/arch/pc532/include/pte.h | 97 |
6 files changed, 276 insertions, 29 deletions
diff --git a/sys/arch/pc532/conf/KLONDIKE b/sys/arch/pc532/conf/KLONDIKE index 4bbf1a1998d..d55a6c1dc0e 100644 --- a/sys/arch/pc532/conf/KLONDIKE +++ b/sys/arch/pc532/conf/KLONDIKE @@ -1,4 +1,4 @@ -# $NetBSD: KLONDIKE,v 1.2 1995/09/26 20:16:01 phil Exp $ +# $NetBSD: KLONDIKE,v 1.3 1996/01/26 05:12:58 phil Exp $ # # KLONDIKE: Matthias Pfaller's pc532 # @@ -50,6 +50,7 @@ options INET # IP + ICMP + TCP + UDP # pc532 specific options options COMDEF_SPEED=B19200 # default baud on the scn chips +options CON_BRK_PANIC # 3 breaks on tty0 -> panic? y/n options PLIP # PLIP driver in dev/lpt.c options DEV_RTC # RTC driver in pc532/mem.c @@ -79,6 +80,6 @@ pseudo-device pty 16 # pseudo-terminals pseudo-device loop 1 # loopback network pseudo-device vnd 2 # vnode devices #pseudo-device bpfilter 4 # packet filter -#pseudo-device sl 1 # compressed SLIP +pseudo-device sl 1 # compressed SLIP #pseudo-device ppp 1 # Point-to-Point Protocol #pseudo-device tun 1 # ip tunneling diff --git a/sys/arch/pc532/conf/STEELHEAD b/sys/arch/pc532/conf/STEELHEAD index b78d97c35e5..eed3d578977 100644 --- a/sys/arch/pc532/conf/STEELHEAD +++ b/sys/arch/pc532/conf/STEELHEAD @@ -1,4 +1,4 @@ -# $NetBSD: STEELHEAD,v 1.10 1995/11/30 00:58:40 jtc Exp $ +# $NetBSD: STEELHEAD,v 1.11 1996/01/25 19:36:36 phil Exp $ # # STEELHEAD: Phil Nelson's pc532 # @@ -46,7 +46,7 @@ options INET # IP #options EON # ? # pc532 specific options -options "COMDEF_SPEED=B19200" # default baud on the scn chips +options "CONSOLE_SPEED=B19200" # default baud on the console (tty00) #options "RAMD_SIZE=1536000" # Size of the "boot strap ram disk" #options "RAMD_ADR=0x400000" # Adr of the "boot strap ram disk" options "CONFIG_NEW" # Use config.new stuff @@ -80,7 +80,7 @@ scn7 at membus? pseudo-device pty 16 # pseudo-terminals pseudo-device loop 1 # loopback network pseudo-device bpfilter 4 # packet filter -pseudo-device sl 1 # compressed SLIP -pseudo-device ppp 1 # Point-to-Point Protocol +pseudo-device sl 3 # compressed SLIP +pseudo-device ppp 2 # Point-to-Point Protocol pseudo-device vnd 4 # Vnode devices #pseudo-device ether # diff --git a/sys/arch/pc532/dev/ncr5380.c b/sys/arch/pc532/dev/ncr5380.c index 068161e7c55..51f3ad04ce8 100644 --- a/sys/arch/pc532/dev/ncr5380.c +++ b/sys/arch/pc532/dev/ncr5380.c @@ -1,4 +1,4 @@ -/* $NetBSD: ncr5380.c,v 1.6 1995/11/30 00:58:50 jtc Exp $ */ +/* $NetBSD: ncr5380.c,v 1.7 1996/01/26 05:04:12 phil Exp $ */ /* * Copyright (c) 1995 Leo Weppelman. @@ -392,7 +392,7 @@ ncr5380_scsi_cmd(struct scsi_xfer *xs) #ifdef AUTO_SENSE if (link) { link->link = reqp; - link->xcmd.bytes[link->xs->cmdlen-1] |= 1; + link->xcmd.bytes[link->xs->cmdlen - 2] |= 1; } #endif } @@ -406,8 +406,8 @@ ncr5380_scsi_cmd(struct scsi_xfer *xs) run_main(xs->sc_link->adapter_softc); - if (xs->flags & SCSI_POLL) - return (COMPLETE); /* We're booting */ + if (xs->flags & (SCSI_POLL|ITSDONE)) + return (COMPLETE); /* We're booting or run_main has completed */ return (SUCCESSFULLY_QUEUED); } @@ -561,7 +561,8 @@ connected: goto main_exit; } splx(sps); -#endif +#endif /* REAL_DMA */ + /* * Let the target guide us through the bus-phases */ @@ -871,8 +872,14 @@ SC_REQ *reqp; * Here we prepare to send an 'IDENTIFY' message. * Allow disconnect only when interrups are allowed. */ +#if 1 + /* def YES_DISCONNECT_RECONNECT_IS_WORKING */ tmp[0] = MSG_IDENTIFY(reqp->targ_lun, (reqp->dr_flag & DRIVER_NOINT) ? 0 : 1); +#else + tmp[0] = MSG_IDENTIFY(reqp->targ_lun, + (reqp->dr_flag & DRIVER_NOINT) ? 0 : 0); +#endif cnt = 1; phase = PH_MSGOUT; @@ -1067,6 +1074,7 @@ handle_message(reqp, msg) SC_REQ *reqp; u_int msg; { + SC_REQ *prev, *req; int sps; PID("hmessage1"); @@ -1087,10 +1095,14 @@ u_int msg; return (-1); } ack_message(); - reqp->xs->error = 0; + + if (!(reqp->dr_flag & DRIVER_AUTOSEN)) { + reqp->xs->resid = reqp->xdata_len; + reqp->xs->error = 0; + } #ifdef AUTO_SENSE - if (check_autosense(reqp, 0) == -1) + if (check_autosense(reqp, 1) == -1) return (-1); #endif /* AUTO_SENSE */ @@ -1098,14 +1110,32 @@ u_int msg; if (dbg_target_mask & (1 << reqp->targ_id)) show_request(reqp->link, "LINK"); #endif + /* + * Unlink the 'linked' request from the issue_q + */ + sps = splbio(); + prev = NULL; + req = issue_q; + for (; req != NULL; prev = req, req = req->next) { + if (req == reqp->link) + break; + } + if (req == NULL) + panic("Inconsistent issue_q"); + if (prev == NULL) + issue_q = req->next; + else prev->next = req->next; + req->next = NULL; connected = reqp->link; + splx(sps); + finish_req(reqp); PID("hmessage3"); return (-1); case MSG_ABORT: case MSG_CMDCOMPLETE: ack_message(); - connected = NULL; + connected = NULL; busy &= ~(1 << reqp->targ_id); if (!(reqp->dr_flag & DRIVER_AUTOSEN)) { reqp->xs->resid = reqp->xdata_len; @@ -1188,17 +1218,8 @@ struct ncr_softc *sc; * choose something long enough to suit all targets. */ SET_5380_REG(NCR5380_ICOM, SC_A_BSY); - len = 1000; + len = 250000; while ((GET_5380_REG(NCR5380_IDSTAT) & SC_S_SEL) && (len > 0)) { -#if 0 - if (!GET_5380_REG(NCR5380_DATA)) { - /* - * We stepped into the reselection timeout.... - */ - SET_5380_REG(NCR5380_ICOM, 0); - return; - } -#endif delay(1); len--; } @@ -1211,6 +1232,18 @@ struct ncr_softc *sc; SET_5380_REG(NCR5380_ICOM, 0); /* + * Check if the reselection is still valid. Check twice because + * of possible line glitches - cheaper than delay(1) and we need + * only a few nanoseconds. + */ + if (!(GET_5380_REG(NCR5380_IDSTAT) & SC_S_BSY)) { + if (!(GET_5380_REG(NCR5380_IDSTAT) & SC_S_BSY)) { + ncr_aprint(sc, "Stepped into the reselection timeout\n"); + return; + } + } + + /* * Get the expected identify message. */ phase = PH_MSGIN; @@ -1513,7 +1546,8 @@ int linked; */ PID("cautos1"); if (!(reqp->dr_flag & DRIVER_AUTOSEN)) { - if (reqp->status == SCSCHKC) { + switch (reqp->status & SCSMASK) { + case SCSCHKC: bcopy(sense_cmd, &reqp->xcmd, sizeof(sense_cmd)); reqp->xdata_ptr = (u_char *)&reqp->xs->sense; reqp->xdata_len = sizeof(reqp->xs->sense); @@ -1534,6 +1568,10 @@ int linked; #endif PID("cautos2"); return (-1); + + case SCSBUSY: + reqp->xs->error = XS_BUSY; + return (0); } } else { @@ -1850,7 +1888,7 @@ char *qtxt; qtxt, reqp->targ_id, reqp->xdata_ptr, reqp->xdata_len, reqp->xcmd.opcode, reqp->status, reqp->message, reqp->xs->error, reqp->xs->resid, reqp->link ? "L":""); - if (reqp->status == SCSCHKC) + if ((reqp->status & SCSMASK) == SCSCHKC) show_data_sense(reqp->xs); } diff --git a/sys/arch/pc532/dev/scn.c b/sys/arch/pc532/dev/scn.c index 1b391b8c022..b1d6cf6b1c1 100644 --- a/sys/arch/pc532/dev/scn.c +++ b/sys/arch/pc532/dev/scn.c @@ -1,4 +1,4 @@ -/* $NetBSD: scn.c,v 1.22 1995/09/26 20:16:17 phil Exp $ */ +/* $NetBSD: scn.c,v 1.23 1996/01/25 19:50:39 phil Exp $ */ /* * Copyright (c) 1991 The Regents of the University of California. @@ -392,8 +392,16 @@ scnattach(parent, self, aux) #endif WR_ADR (u_char, rs->acr_port, (rs->uart->speed_grp << 7) | rs->uart->acr_int_bits); - scn_config(unit, scndefaultrate, scndefaultrate, - LC_NONE, LC_STOP1, LC_BITS8); +#ifdef CONSOLE_SPEED + if (unit == 0) +{ printf ("scn_config on unit 0\n"); + scn_config(unit, CONSOLE_SPEED, CONSOLE_SPEED, + LC_NONE, LC_STOP1, LC_BITS8); +} + else +#endif + scn_config(unit, scndefaultrate, scndefaultrate, + LC_NONE, LC_STOP1, LC_BITS8); /* Turn on the Rx and Tx. */ WR_ADR (u_char, rs->cmd_port, CMD_ENA_RX | CMD_ENA_TX); diff --git a/sys/arch/pc532/include/cpufunc.h b/sys/arch/pc532/include/cpufunc.h new file mode 100644 index 00000000000..4d9e46b824a --- /dev/null +++ b/sys/arch/pc532/include/cpufunc.h @@ -0,0 +1,103 @@ +/* $NetBSD: cpufunc.h,v 1.1 1996/01/26 05:37:16 phil Exp $ */ + +/* + * Copyright (c) 1996 Matthias Pfaller. + * 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 Matthias Pfaller. + * 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 _NS532_CPUFUNC_H_ +#define _NS532_CPUFUNC_H_ + +/* + * Load a mmu register. + */ +#define lmr(reg, src) __asm __volatile("lmr " #reg ",%0" : : "g" (src)) + +/* + * Store a mmu register. + */ +#define smr(reg, dst) __asm __volatile("smr " #reg ",%0" : "=g" (dst) :) + +/* + * Load the FPU status register. + */ +#define lfsr(src) __asm __volatile("lfsr %0" : : "g" (src)) + +/* + * Store the FPU status register. + */ +#define sfsr(src) __asm __volatile("sfsr %0" : "=g" (src) :) + +/* + * Load a processor register. + */ +#define lprd(reg, src) __asm __volatile("lprd " #reg ",%0" : : "g" (src)) +#define lprw(reg, src) __asm __volatile("lprw " #reg ",%0" : : "g" (src)) +#define lprb(reg, src) __asm __volatile("lprb " #reg ",%0" : : "g" (src)) + +/* + * Store a processor register. + */ +#define sprd(reg, dst) __asm __volatile("sprd " #reg ",%0" : "=g" (dst) :) +#define sprw(reg, dst) __asm __volatile("sprw " #reg ",%0" : "=g" ((short) (dst)) :) +#define sprb(reg, dst) __asm __volatile("sprb " #reg ",%0" : "=g" ((char) (dst)) :) + +/* + * Move data. This can be used to force + * gcc to load a register variable. + */ +#define movd(src, dst) __asm __volatile("movd %1,%0" : "=g" (dst) : "g" (src)) + +/* + * Load the ptb. This loads ptb0 and ptb1 to + * avoid a cpu-bug when using dual address + * space instructions. + */ +#define load_ptb(src) __asm __volatile("lmr ptb0,%0; lmr ptb1,%0" : : "g" (src)) + +/* + * Flush tlb. Just to be save this flushes + * kernelmode and usermode translations. + */ +#define tlbflush() __asm __volatile("smr ptb0,r0; lmr ptb0,r0; lmr ptb1,r0" : : : "r0") + +/* + * Bits in the cfg register. + */ +#define CFG_I 0x0001 /* Enable vectored interrupts */ +#define CFG_F 0x0002 /* Enable floating-point instruction set */ +#define CFG_M 0x0004 /* Enable memory management instruction set */ +#define CFG_ONE 0x00f0 /* Must be one */ +#define CFG_DE 0x0100 /* Enable direct exception mode */ +#define CFG_DC 0x0200 /* Enable data cache */ +#define CFG_LDC 0x0400 /* Lock data cache */ +#define CFG_IC 0x0800 /* Enable instruction cache */ +#define CFG_LIC 0x1000 /* Lock instruction cache */ +#define CFG_PF 0x2000 /* Enable pipelined floating-point execution */ + +#endif /* !_NS532_CPUFUNC_H_ */ diff --git a/sys/arch/pc532/include/pte.h b/sys/arch/pc532/include/pte.h new file mode 100644 index 00000000000..1479088f900 --- /dev/null +++ b/sys/arch/pc532/include/pte.h @@ -0,0 +1,97 @@ +/* $NetBSD: pte.h,v 1.1 1996/01/26 08:06:40 phil Exp $ */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * 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. + * + * @(#)pte.h 5.5 (Berkeley) 5/9/91 + */ + +/* + * NS532 page table entry and page table directory + * (derived from 386 page table entry by W.Jolitz, 8/89) + * + * There are two major kinds of pte's: those which have ever existed (and are + * thus either now in core or on the swap device), and those which have + * never existed, but which will be filled on demand at first reference. + * There is a structure describing each. There is also an ancillary + * structure used in page clustering. + */ + +#ifndef _NS532_PTE_H_ +#define _NS532_PTE_H_ + +#define PDSHIFT 22 /* LOG2(NBPDR) */ +#define NBPD (1 << PDSHIFT) /* bytes/page dir */ +#define PDOFSET (NBPD-1) /* byte offset into page dir */ +#define NPTEPD (NBPD / NBPG) + +#ifndef LOCORE +typedef int pd_entry_t; /* page directory entry */ +typedef int pt_entry_t; /* Mach page table entry */ +#endif + +#define PD_MASK 0xffc00000 /* page directory address bits */ +#define PT_MASK 0x003ff000 /* page table address bits */ + +#define PG_V 0x00000001 /* present */ +#define PG_RO 0x00000000 /* read-only by user and kernel */ +#define PG_RW 0x00000002 /* read-write by user */ +#define PG_u 0x00000004 /* accessible by user */ +#define PG_PROT 0x00000006 /* all protection bits */ +#define PG_N 0x00000040 /* non-cacheable */ +#define PG_U 0x00000080 /* has been used */ +#define PG_M 0x00000100 /* has been modified */ +#define PG_W 0x00000200 /* page is wired */ +#define PG_FRAME 0xfffff000 /* page frame mask */ + +#define PG_FZERO 0 +#define PG_FTEXT 1 +#define PG_FMAX (PG_FTEXT) + +#define PG_NOACC 0 +#define PG_KR 0x00000000 +#define PG_KW 0x00000002 +#define PG_URKR 0x00000004 +#define PG_URKW 0x00000004 +#define PG_UW 0x00000006 + +#ifndef LOCORE +#ifdef _KERNEL +/* utilities defined in pmap.c */ +extern pt_entry_t *Sysmap; +#endif +#endif + +#endif /* _NS532_PTE_H_ */ |