From: mickey Date: Sat, 4 May 1996 16:47:17 +0000 (+0000) Subject: add files missed from 0418 sync. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=d2701632e52aedd26136dfb0940ead3b6a80f340;p=openbsd add files missed from 0418 sync. --- diff --git a/sys/arch/hp300/hp300/isr.c b/sys/arch/hp300/hp300/isr.c new file mode 100644 index 00000000000..5b284c86c53 --- /dev/null +++ b/sys/arch/hp300/hp300/isr.c @@ -0,0 +1,228 @@ +/* $NetBSD: isr.c,v 1.1 1996/02/14 02:56:48 thorpej Exp $ */ + +/* + * Copyright (c) 1995, 1996 Jason R. Thorpe. + * All rights reserved. + * + * Portions: + * Copyright (c) 1994 Gordon W. Ross. + * Copyright (c) 1993 Adam Glass. + * 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 acknowledgements: + * This product includes software developed by Adam Glass. + * This product includes software developed for the NetBSD Project + * by Jason R. Thorpe. + * 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 AUTHORS ``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. + */ + +/* + * Link and dispatch interrupts. + */ + +#include +#include +#include +#include +#include +#include + +#include + +typedef LIST_HEAD(, isr) isr_list_t; +isr_list_t isr_list[NISR]; + +extern int intrcnt[]; /* from locore.s */ + +void +isrinit() +{ + int i; + + /* Initialize the ISR lists. */ + for (i = 0; i < NISR; ++i) { + LIST_INIT(&isr_list[i]); + } +} + +/* + * Establish an interrupt handler. + * Called by driver attach functions. + */ +void +isrlink(func, arg, ipl, priority) + int (*func) __P((void *)); + void *arg; + int ipl; + int priority; +{ + struct isr *newisr, *curisr; + isr_list_t *list; + + if ((ipl < 0) || (ipl >= NISR)) + panic("isrlink: bad ipl %d", ipl); + + newisr = (struct isr *)malloc(sizeof(struct isr), M_DEVBUF, M_NOWAIT); + if (newisr == NULL) + panic("isrlink: can't allocate space for isr"); + + /* Fill in the new entry. */ + newisr->isr_func = func; + newisr->isr_arg = arg; + newisr->isr_ipl = ipl; + newisr->isr_priority = priority; + + /* + * Some devices are particularly sensitive to interrupt + * handling latency. The DCA, for example, can lose many + * characters if its interrupt isn't handled with reasonable + * speed. + * + * To work around this problem, each device can give itself a + * "priority". An unbuffered DCA would give itself a higher + * priority than a SCSI device, for example. + * + * This is necessary because of the flat spl scheme employed by + * the hp300. Each device can be set from ipl 3 to ipl 5, which + * in turn means that splbio, splnet, and spltty must all be at + * spl5. + * + * Don't blame me...I just work here. + */ + + /* + * Get the appropriate ISR list. If the list is empty, no + * additional work is necessary; we simply insert ourselves + * at the head of the list. + */ + list = &isr_list[ipl]; + if (list->lh_first == NULL) { + LIST_INSERT_HEAD(list, newisr, isr_link); + return; + } + + /* + * A little extra work is required. We traverse the list + * and place ourselves after any ISRs with our current (or + * higher) priority. + */ + for (curisr = list->lh_first; curisr->isr_link.le_next != NULL; + curisr = curisr->isr_link.le_next) { + if (newisr->isr_priority > curisr->isr_priority) { + LIST_INSERT_BEFORE(curisr, newisr, isr_link); + return; + } + } + + /* + * We're the least important entry, it seems. We just go + * on the end. + */ + LIST_INSERT_AFTER(curisr, newisr, isr_link); +} + +/* + * This is the dispatcher called by the low-level + * assembly language interrupt routine. + */ +void +isrdispatch(evec) + int evec; /* format | vector offset */ +{ + struct isr *isr; + isr_list_t *list; + int handled, ipl, vec; + static int straycount, unexpected; + + vec = (evec & 0xfff) >> 2; + if ((vec < ISRLOC) || (vec >= (ISRLOC + NISR))) + panic("isrdispatch: bad vec 0x%x\n"); + ipl = vec - ISRLOC; + + intrcnt[ipl]++; + cnt.v_intr++; + + list = &isr_list[ipl]; + if (list->lh_first == NULL) { + printf("intrhand: ipl %d unexpected\n", ipl); + if (++unexpected > 10) + panic("isrdispatch: too many unexpected interrupts"); + return; + } + + /* Give all the handlers a chance. */ + for (isr = list->lh_first ; isr != NULL; isr = isr->isr_link.le_next) + handled |= (*isr->isr_func)(isr->isr_arg); + + if (handled) + straycount = 0; + else if (++straycount > 50) + panic("isrdispatch: too many stray interrupts"); + else + printf("isrdispatch: stray level %d interrupt\n", ipl); +} + +/* + * XXX Why on earth isn't this in a common file?! + */ +void +netintr() +{ +#ifdef INET + if (netisr & (1 << NETISR_ARP)) { + netisr &= ~(1 << NETISR_ARP); + arpintr(); + } + if (netisr & (1 << NETISR_IP)) { + netisr &= ~(1 << NETISR_IP); + ipintr(); + } +#endif +#ifdef NS + if (netisr & (1 << NETISR_NS)) { + netisr &= ~(1 << NETISR_NS); + nsintr(); + } +#endif +#ifdef ISO + if (netisr & (1 << NETISR_ISO)) { + netisr &= ~(1 << NETISR_ISO); + clnlintr(); + } +#endif +#ifdef CCITT + if (netisr & (1 << NETISR_CCITT)) { + netisr &= ~(1 << NETISR_CCITT); + ccittintr(); + } +#endif +#include "ppp.h" +#if NPPP > 0 + if (netisr & (1 << NETISR_PPP)) { + netisr &= ~(1 << NETISR_PPP); + pppintr(); + } +#endif +} diff --git a/sys/arch/hp300/include/autoconf.h b/sys/arch/hp300/include/autoconf.h new file mode 100644 index 00000000000..01f3daf9125 --- /dev/null +++ b/sys/arch/hp300/include/autoconf.h @@ -0,0 +1,50 @@ +/* $NetBSD: autoconf.h,v 1.3 1996/03/03 16:49:17 thorpej Exp $ */ + +/*- + * Copyright (c) 1996 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Jason R. Thorpe. + * + * 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 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. + */ + +#ifdef _KERNEL +extern int conscode; /* select code of console device */ +extern int consinit_active; /* hint for drivers */ +extern caddr_t conaddr; /* KVA of console device */ +extern int convasize; /* size of mapping at conaddr */ +extern int conforced; /* console has been forced */ + +void hp300_cninit __P((void)); +void console_scan __P((int (*)(int, caddr_t, void *), void *)); +caddr_t iomap __P((caddr_t, int)); +void iounmap __P((caddr_t, int)); +#endif /* _KERNEL */ diff --git a/sys/arch/hp300/stand/itevar.h b/sys/arch/hp300/stand/itevar.h new file mode 100644 index 00000000000..cebbb2ec6cd --- /dev/null +++ b/sys/arch/hp300/stand/itevar.h @@ -0,0 +1,231 @@ +/* $NetBSD: itevar.h,v 1.1 1996/03/03 04:23:42 thorpej Exp $ */ + +/* + * Copyright (c) 1988 University of Utah. + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department. + * + * 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: Utah $Hdr: itevar.h 1.15 92/12/20$ + * + * @(#)itevar.h 8.1 (Berkeley) 6/10/93 + */ + +/* + * Standalone version of hp300 ITE. + */ + +#define ITEUNIT(dev) minor(dev) + +#define getbyte(ip, offset) \ + ((*(ip)->isw->ite_readbyte)(ip, offset)) + +#define getword(ip, offset) \ + ((getbyte(ip, offset) << 8) | getbyte(ip, (offset) + 2)) + +#define writeglyph(ip, offset, fontbuf) \ + ((*(ip)->isw->ite_writeglyph)((ip), (offset), (fontbuf))) + +struct ite_data { + int flags; + struct tty *tty; + struct itesw *isw; + struct grf_data *grf; + caddr_t regbase, fbbase; + short curx, cury; + short cursorx, cursory; + short cblankx, cblanky; + short rows, cols; + short cpl; + short dheight, dwidth; + short fbheight, fbwidth; + short ftheight, ftwidth; + short fontx, fonty; + short attribute; + u_char *attrbuf; + short planemask; + short pos; + char imode, escape, fpd, hold; + caddr_t devdata; /* display dependent data */ +}; + +struct itesw { + int ite_hwid; + void (*ite_init) __P((struct ite_data *)); + void (*ite_deinit) __P((struct ite_data *)); + void (*ite_clear) __P((struct ite_data *, int, int, int, int)); + void (*ite_putc) __P((struct ite_data *, int, int, int, int)); + void (*ite_cursor) __P((struct ite_data *, int)); + void (*ite_scroll) __P((struct ite_data *, int, int, int, int)); + u_char (*ite_readbyte) __P((struct ite_data *, int)); + void (*ite_writeglyph) __P((struct ite_data *, u_char *, u_char *)); +}; + +/* Flags */ +#define ITE_ALIVE 0x01 /* hardware exists */ +#define ITE_INITED 0x02 /* device has been initialized */ +#define ITE_CONSOLE 0x04 /* device can be console */ +#define ITE_ISCONS 0x08 /* device is console */ +#define ITE_ACTIVE 0x10 /* device is being used as ITE */ +#define ITE_INGRF 0x20 /* device in use as non-ITE */ +#define ITE_CURSORON 0x40 /* cursor being tracked */ + +#define attrloc(ip, y, x) \ + (ip->attrbuf + ((y) * ip->cols) + (x)) + +#define attrclr(ip, sy, sx, h, w) \ + bzero(ip->attrbuf + ((sy) * ip->cols) + (sx), (h) * (w)) + +#define attrmov(ip, sy, sx, dy, dx, h, w) \ + bcopy(ip->attrbuf + ((sy) * ip->cols) + (sx), \ + ip->attrbuf + ((dy) * ip->cols) + (dx), \ + (h) * (w)) + +#define attrtest(ip, attr) \ + ((* (u_char *) attrloc(ip, ip->cury, ip->curx)) & attr) + +#define attrset(ip, attr) \ + ((* (u_char *) attrloc(ip, ip->cury, ip->curx)) = attr) + +/* + * X and Y location of character 'c' in the framebuffer, in pixels. + */ +#define charX(ip,c) \ + (((c) % (ip)->cpl) * (ip)->ftwidth + (ip)->fontx) + +#define charY(ip,c) \ + (((c) / (ip)->cpl) * (ip)->ftheight + (ip)->fonty) + +/* + * The cursor is just an inverted space. + */ +#define draw_cursor(ip) { \ + WINDOWMOVER(ip, ip->cblanky, ip->cblankx, \ + ip->cury * ip->ftheight, \ + ip->curx * ip->ftwidth, \ + ip->ftheight, ip->ftwidth, RR_XOR); \ + ip->cursorx = ip->curx; \ + ip->cursory = ip->cury; } + +#define erase_cursor(ip) \ + WINDOWMOVER(ip, ip->cblanky, ip->cblankx, \ + ip->cursory * ip->ftheight, \ + ip->cursorx * ip->ftwidth, \ + ip->ftheight, ip->ftwidth, RR_XOR); + +/* Character attributes */ +#define ATTR_NOR 0x0 /* normal */ +#define ATTR_INV 0x1 /* inverse */ +#define ATTR_UL 0x2 /* underline */ +#define ATTR_ALL (ATTR_INV | ATTR_UL) + +/* Keyboard attributes */ +#define ATTR_KPAD 0x4 /* keypad transmit */ + +/* Replacement Rules */ +#define RR_CLEAR 0x0 +#define RR_COPY 0x3 +#define RR_XOR 0x6 +#define RR_COPYINVERTED 0xc + +#define SCROLL_UP 0x01 +#define SCROLL_DOWN 0x02 +#define SCROLL_LEFT 0x03 +#define SCROLL_RIGHT 0x04 +#define DRAW_CURSOR 0x05 +#define ERASE_CURSOR 0x06 +#define MOVE_CURSOR 0x07 + +#define KBD_SSHIFT 4 /* bits to shift status */ +#define KBD_CHARMASK 0x7F + +/* keyboard status */ +#define KBD_SMASK 0xF /* service request status mask */ +#define KBD_CTRLSHIFT 0x8 /* key + CTRL + SHIFT */ +#define KBD_CTRL 0x9 /* key + CTRL */ +#define KBD_SHIFT 0xA /* key + SHIFT */ +#define KBD_KEY 0xB /* key only */ + +#define KBD_CAPSLOCK 0x18 + +#define KBD_EXT_LEFT_DOWN 0x12 +#define KBD_EXT_LEFT_UP 0x92 +#define KBD_EXT_RIGHT_DOWN 0x13 +#define KBD_EXT_RIGHT_UP 0x93 + +#define TABSIZE 8 +#define TABEND(ip) ((ip)->tty->t_winsize.ws_col - TABSIZE) + +extern struct ite_data ite_data[]; +extern struct itesw itesw[]; +extern int nitesw; + +/* + * Prototypes. + */ +u_char ite_readbyte __P((struct ite_data *, int)); +void ite_writeglyph __P((struct ite_data *, u_char *, u_char *)); + +/* + * Framebuffer-specific ITE prototypes. + */ +void topcat_init __P((struct ite_data *)); +void topcat_clear __P((struct ite_data *, int, int, int, int)); +void topcat_putc __P((struct ite_data *, int, int, int, int)); +void topcat_cursor __P((struct ite_data *, int)); +void topcat_scroll __P((struct ite_data *, int, int, int, int)); + +void gbox_init __P((struct ite_data *)); +void gbox_clear __P((struct ite_data *, int, int, int, int)); +void gbox_putc __P((struct ite_data *, int, int, int, int)); +void gbox_cursor __P((struct ite_data *, int)); +void gbox_scroll __P((struct ite_data *, int, int, int, int)); + +void rbox_init __P((struct ite_data *)); +void rbox_clear __P((struct ite_data *, int, int, int, int)); +void rbox_putc __P((struct ite_data *, int, int, int, int)); +void rbox_cursor __P((struct ite_data *, int)); +void rbox_scroll __P((struct ite_data *, int, int, int, int)); + +void dvbox_clear __P((struct ite_data *, int, int, int, int)); +void dvbox_putc __P((struct ite_data *, int, int, int, int)); +void dvbox_cursor __P((struct ite_data *, int)); +void dvbox_scroll __P((struct ite_data *, int, int, int, int)); + +void hyper_init __P((struct ite_data *)); +void hyper_clear __P((struct ite_data *, int, int, int, int)); +void hyper_putc __P((struct ite_data *, int, int, int, int)); +void hyper_cursor __P((struct ite_data *, int)); +void hyper_scroll __P((struct ite_data *, int, int, int, int)); +