diff options
author | Per Fogelstrom <pefo@cvs.openbsd.org> | 1997-03-23 11:34:37 +0000 |
---|---|---|
committer | Per Fogelstrom <pefo@cvs.openbsd.org> | 1997-03-23 11:34:37 +0000 |
commit | b9f2610c72d09d03f8059e9a1625b5795e0ef589 (patch) | |
tree | a3fa1a523261931a9011a24de3a0ed94668b000b /sys | |
parent | 58fd4c6b54959c8c0202ef0f39470fb046627bcd (diff) |
Adding more arches require more structuring and cleanup. More to come...
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/arc/algor/algor.h | 7 | ||||
-rw-r--r-- | sys/arch/arc/algor/algorbus.c | 9 | ||||
-rw-r--r-- | sys/arch/arc/arc/arcbios.c | 3 | ||||
-rw-r--r-- | sys/arch/arc/arc/clock_mc.c | 17 | ||||
-rw-r--r-- | sys/arch/arc/arc/conf.c | 6 | ||||
-rw-r--r-- | sys/arch/arc/arc/cpu.c | 49 | ||||
-rw-r--r-- | sys/arch/arc/arc/cpu_exec.c | 2 | ||||
-rw-r--r-- | sys/arch/arc/arc/locore.S | 7 | ||||
-rw-r--r-- | sys/arch/arc/arc/machdep.c | 216 | ||||
-rw-r--r-- | sys/arch/arc/arc/mem.c | 4 | ||||
-rw-r--r-- | sys/arch/arc/arc/sys_machdep.c | 3 | ||||
-rw-r--r-- | sys/arch/arc/arc/vm_machdep.c | 7 | ||||
-rw-r--r-- | sys/arch/arc/conf/GENERIC | 3 | ||||
-rw-r--r-- | sys/arch/arc/conf/files.arc | 12 | ||||
-rw-r--r-- | sys/arch/arc/dev/com_lbus.c | 8 | ||||
-rw-r--r-- | sys/arch/arc/dev/lpt_lbus.c | 8 | ||||
-rw-r--r-- | sys/arch/arc/include/cpu.h | 6 | ||||
-rw-r--r-- | sys/arch/arc/pci/pbcpcibus.c | 10 | ||||
-rw-r--r-- | sys/arch/arc/pica/com_pica.c | 196 | ||||
-rw-r--r-- | sys/arch/arc/pica/lpt_pica.c | 151 |
20 files changed, 233 insertions, 491 deletions
diff --git a/sys/arch/arc/algor/algor.h b/sys/arch/arc/algor/algor.h index bfe02f65104..c1c68d51f1e 100644 --- a/sys/arch/arc/algor/algor.h +++ b/sys/arch/arc/algor/algor.h @@ -1,4 +1,4 @@ -/* $OpenBSD: algor.h,v 1.1 1997/03/12 19:16:33 pefo Exp $ */ +/* $OpenBSD: algor.h,v 1.2 1997/03/23 11:34:25 pefo Exp $ */ /* * Copyright (c) 1996 Per Fogelstrom @@ -62,8 +62,9 @@ #define P4032_GPIO 0xbff40000 /* General purpose I/O */ #define P4032_GPIO_IACK 0xbff50000 /* General purpose I/O Iack */ #define P4032_FPY 0xbff807c0 /* Floppy controller */ -#define P4032_COM1 0xbff80fe0 -#define P4032_COM2 0xbff80be0 +#define P4032_COM1 0xbff80fe0 /* Serial port com1 */ +#define P4032_COM2 0xbff80be0 /* Serial port com2 */ +#define P4032_CENTR 0xbff80de0 /* Centronics paralell port */ #define P4032_IMR 0xbff90000 /* Int mask reg (wr) */ #define P4032_IRR 0xbff90000 /* Int request reg (rd) */ #define P4032_EIRR 0xbff90004 /* Error int request reg (rd) */ diff --git a/sys/arch/arc/algor/algorbus.c b/sys/arch/arc/algor/algorbus.c index b6fc840471a..d4da9705fb1 100644 --- a/sys/arch/arc/algor/algorbus.c +++ b/sys/arch/arc/algor/algorbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: algorbus.c,v 1.1 1997/03/12 19:16:35 pefo Exp $ */ +/* $OpenBSD: algorbus.c,v 1.2 1997/03/23 11:34:26 pefo Exp $ */ /* * Copyright (c) 1996 Per Fogelstrom @@ -111,9 +111,11 @@ struct algor_dev algor_4032_cpu[] = { {{ "dallas_rtc", 0, 0, }, P4032_IM_RTC, IPL_CLOCK, 0xc000, algor_intrnull, (void *)P4032_CLOCK, }, {{ "com", 1, 0, }, - P4032_IM_COM1, IPL_TTY, 0x00c0, algor_intrnull, (void *)P4032_COM1, }, + P4032_IM_COM1, IPL_TTY, 0x00c0, algor_intrnull, (void *)P4032_COM1, }, {{ "com", 2, 0, }, - P4032_IM_COM2, IPL_TTY, 0x0300, algor_intrnull, (void *)P4032_COM2, }, + P4032_IM_COM2, IPL_TTY, 0x0300, algor_intrnull, (void *)P4032_COM2, }, + {{ "lpt", 3, 0, }, + P4032_IM_CENTR,IPL_TTY, 0x0c00, algor_intrnull, (void *)P4032_CENTR, }, {{ NULL, -1, NULL, }, 0, 0x0000, NULL, (void *)NULL, }, }; @@ -381,6 +383,7 @@ algor_iointr(mask, cf) if(pend & int_table[i].int_mask) (*int_table[i].int_hand)(int_table[i].param); } + outb(P4032_ICR, pend & P4032_IM_CENTR); /* Ack any centronics int */ return(~0); /* Dont reenable */ } diff --git a/sys/arch/arc/arc/arcbios.c b/sys/arch/arc/arc/arcbios.c index 2badfd07b05..17a755731ab 100644 --- a/sys/arch/arc/arc/arcbios.c +++ b/sys/arch/arc/arc/arcbios.c @@ -1,6 +1,7 @@ -/* $OpenBSD: arcbios.c,v 1.5 1997/03/12 19:16:36 pefo Exp $ */ +/* $OpenBSD: arcbios.c,v 1.6 1997/03/23 11:34:26 pefo Exp $ */ /*- * Copyright (c) 1996 M. Warner Losh. 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 diff --git a/sys/arch/arc/arc/clock_mc.c b/sys/arch/arc/arc/clock_mc.c index c22338f9789..e9ceed3d18c 100644 --- a/sys/arch/arc/arc/clock_mc.c +++ b/sys/arch/arc/arc/clock_mc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock_mc.c,v 1.5 1997/03/12 19:16:39 pefo Exp $ */ +/* $OpenBSD: clock_mc.c,v 1.6 1997/03/23 11:34:27 pefo Exp $ */ /* $NetBSD: clock_mc.c,v 1.2 1995/06/28 04:30:30 cgd Exp $ */ /* @@ -79,7 +79,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) \ @@ -87,19 +86,19 @@ struct mcclockdata { #define mc146818_read(sc, reg) \ (*((struct mcclockdata *)sc->sc_data)->mc_read)(sc, reg) -/* Acer pica clock read code */ +/* 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 }; -/* Deskstation clock read code */ +/* 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 read code */ +/* 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)); @@ -124,13 +123,8 @@ mcclock_attach(parent, self, aux) switch (cputype) { case ACER_PICA_61: - /* - * XXX should really allocate a new one and copy, or - * something. unlikely we'll have more than one... - */ csc->sc_init = mcclock_init_pica; csc->sc_data = &mcclockdata_pica; - mcclockdata_tyne.mc_addr = BUS_CVTADDR(ca); mc146818_write(csc, MC_REGB, MC_REGB_BINARY | MC_REGB_24HR); break; @@ -228,6 +222,7 @@ mcclock_set(csc, ct) s = splclock(); 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]); regs[MC_SEC] = ct->sec; regs[MC_MIN] = ct->min; @@ -241,6 +236,8 @@ mcclock_set(csc, ct) regs[MC_YEAR] = ct->year; 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); } diff --git a/sys/arch/arc/arc/conf.c b/sys/arch/arc/arc/conf.c index 4fad2e73b98..f9a99023e3f 100644 --- a/sys/arch/arc/arc/conf.c +++ b/sys/arch/arc/arc/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.12 1997/03/12 19:16:40 pefo Exp $ */ +/* $OpenBSD: conf.c,v 1.13 1997/03/23 11:34:27 pefo Exp $ */ /* * Copyright (c) 1992, 1993 @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)conf.c 8.2 (Berkeley) 11/14/93 - * $Id: conf.c,v 1.12 1997/03/12 19:16:40 pefo Exp $ + * $Id: conf.c,v 1.13 1997/03/23 11:34:27 pefo Exp $ */ #include <sys/param.h> @@ -175,7 +175,7 @@ struct cdevsw cdevsw[] = cdev_bpftun_init(NBPFILTER,bpf),/* 12: berkeley packet filter */ cdev_disk_init(NFDC,fd), /* 13: Floppy disk */ cdev_pc_init(NPC,pc), /* 14: builtin pc style console dev */ - cdev_mouse_init(1,pms), /* 15: builtin PS2 style mouse */ + cdev_mouse_init(NPC,pms), /* 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(NWDC,wd), /* 18: ST506/ESDI/IDE disk */ diff --git a/sys/arch/arc/arc/cpu.c b/sys/arch/arc/arc/cpu.c index 3fb364613b8..1e5ae44f8a8 100644 --- a/sys/arch/arc/arc/cpu.c +++ b/sys/arch/arc/arc/cpu.c @@ -1,30 +1,35 @@ -/* $OpenBSD: cpu.c,v 1.5 1997/03/12 19:16:41 pefo Exp $ */ +/* $OpenBSD: cpu.c,v 1.6 1997/03/23 11:34:28 pefo Exp $ */ /* - * Copyright (c) 1994, 1995 Carnegie-Mellon University. - * All rights reserved. - * - * Author: 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. + * Copyright (c) 1997 Per Fogelstrom * - * 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> diff --git a/sys/arch/arc/arc/cpu_exec.c b/sys/arch/arc/arc/cpu_exec.c index 5a57459e139..0b12677528f 100644 --- a/sys/arch/arc/arc/cpu_exec.c +++ b/sys/arch/arc/arc/cpu_exec.c @@ -1,4 +1,4 @@ -/* $NetBSD: cpu_exec.c,v 1.4 1995/04/25 19:16:46 mellon Exp $ */ +/* $OpenBSD: cpu_exec.c,v 1.3 1997/03/23 11:34:28 pefo Exp $ */ /* * Copyright (c) 1992, 1993 diff --git a/sys/arch/arc/arc/locore.S b/sys/arch/arc/arc/locore.S index 6d4ea2ca6fc..aba3e0f0050 100644 --- a/sys/arch/arc/arc/locore.S +++ b/sys/arch/arc/arc/locore.S @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.S,v 1.9 1997/03/12 19:16:42 pefo Exp $ */ +/* $OpenBSD: locore.S,v 1.10 1997/03/23 11:34:29 pefo Exp $ */ /* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -50,7 +50,7 @@ * v 1.1 89/07/10 14:27:41 nelson Exp SPRITE (DECWRL) * * from: @(#)locore.s 8.5 (Berkeley) 1/4/94 - * $Id: locore.S,v 1.9 1997/03/12 19:16:42 pefo Exp $ + * $Id: locore.S,v 1.10 1997/03/23 11:34:29 pefo Exp $ */ /* @@ -1372,8 +1372,7 @@ NNON_LEAF(MachUserIntr, STAND_FRAME_SIZE, ra) .mask 0x80000000, (STAND_RA_OFFSET - STAND_FRAME_SIZE) /* * Save the relevant user registers into the u.u_pcb struct. - * We don't need to save s0 - s8 because - * the compiler does it for us. + * We don't need to save s0 - s8 because the compiler does it for us. */ sw AT, UADDR+U_PCB_REGS+(AST * 4) sw v0, UADDR+U_PCB_REGS+(V0 * 4) diff --git a/sys/arch/arc/arc/machdep.c b/sys/arch/arc/arc/machdep.c index 4615d24396f..dd29ad4029b 100644 --- a/sys/arch/arc/arc/machdep.c +++ b/sys/arch/arc/arc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.22 1997/03/17 08:11:12 pefo Exp $ */ +/* $OpenBSD: machdep.c,v 1.23 1997/03/23 11:34:30 pefo Exp $ */ /* * Copyright (c) 1988 University of Utah. * Copyright (c) 1992, 1993 @@ -38,7 +38,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 8.3 (Berkeley) 1/12/94 - * $Id: machdep.c,v 1.22 1997/03/17 08:11:12 pefo Exp $ + * $Id: machdep.c,v 1.23 1997/03/23 11:34:30 pefo Exp $ */ /* from: Utah Hdr: machdep.c 1.63 91/04/24 */ @@ -96,14 +96,6 @@ #include <arc/dti/desktech.h> #include <arc/algor/algor.h> -#if 0 -#include <asc.h> - -#if NASC > 0 -#include <arc/dev/ascreg.h> -#endif -#endif - extern struct consdev *cn_tab; extern char kernel_start[]; @@ -134,7 +126,9 @@ int cputype; /* Mother board type */ int num_tlbentries = 48; /* Size of the CPU tlb */ int ncpu = 1; /* At least one cpu in the system */ int CONADDR; /* Well, ain't it just plain stupid... */ -struct arc_bus_space arc_bus; +struct arc_bus_space arc_bus; /* Bus tag for bus.h macros */ +char **environment; /* On some arches, pointer to environment */ +char eth_hw_addr[6]; /* HW ether addr not stored elsewhere */ struct mem_descriptor mem_layout[MAXMEMSEGS]; @@ -150,6 +144,9 @@ int (*Mach_splstatclock)() = splhigh; static void tlb_init_pica(); static void tlb_init_tyne(); static int get_simm_size(int *fadr, int max); +static char *getenv(char *env); +static void get_eth_hw_addr(char *); +static int atoi(char *s, int b); /* @@ -167,15 +164,15 @@ struct proc nullproc; /* for use by swtch_exit() */ * Reset mapping and set up mapping to hardware and init "wired" reg. * Return the first page address following the system. */ -mips_init(argc, argv, code) +mips_init(argc, argv, envv) int argc; char *argv[]; - u_int code; + char *envv[]; /* Not on all arches... */ { - register char *cp; - register int i; - register unsigned firstaddr; - register caddr_t sysend; + char *cp; + int i; + unsigned firstaddr; + caddr_t sysend; caddr_t start; struct tlb tlb; extern char edata[], end[]; @@ -186,6 +183,8 @@ mips_init(argc, argv, code) sysend = (caddr_t)mips_round_page(end); bzero(edata, sysend - edata); + environment = &argv[1]; + /* Initialize the CPU type */ bios_ident(); @@ -199,6 +198,7 @@ mips_init(argc, argv, code) arc_bus.isa_io_sparse2 = 0; arc_bus.isa_io_sparse4 = 0; arc_bus.isa_io_sparse8 = 0; + switch (cputype) { case ACER_PICA_61: /* ALI PICA 61 and MAGNUM is almost the */ case MAGNUM: /* Same kind of hardware. NEC goes here too */ @@ -259,15 +259,21 @@ mips_init(argc, argv, code) i = get_simm_size((int *)0, 128*1024*1024); mem_layout[1].mem_size = i - (int)(CACHED_TO_PHYS(sysend)); physmem = i; -#if 0 - mem_layout[2].mem_start = 0x800000; - mem_layout[2].mem_size = 0x1000000; - physmem += 8192 * 1024; -#endif +/*XXX Ouch!!! */ + mem_layout[2].mem_start = i; + mem_layout[2].mem_size = get_simm_size((int *)(i), 0); + physmem += mem_layout[2].mem_size; + mem_layout[3].mem_start = i+i/2; + mem_layout[3].mem_size = get_simm_size((int *)(i+i/2), 0); + physmem += mem_layout[3].mem_size; +/*XXX*/ + environment = envv; + argv[0] = getenv("bootdev"); + break; - default: + default: /* This is probably the best we can do... */ bios_putstring("kernel not configured for this system\n"); boot(RB_HALT | RB_NOSYNC); } @@ -284,34 +290,32 @@ mips_init(argc, argv, code) #ifdef KADB boothowto |= RB_KDB; #endif - if (argc > 1) { - for (i = 1; i < argc; i++) { - if(strncasecmp("osloadoptions=",argv[i],14) == 0) { - for (cp = argv[i]+14; *cp; cp++) { - switch (*cp) { - case 'a': /* autoboot */ - boothowto &= ~RB_SINGLE; - break; - - case 'd': /* use compiled in default root */ - boothowto |= RB_DFLTROOT; - break; - - case 'm': /* mini root present in memory */ - boothowto |= RB_MINIROOT; - break; - - case 'n': /* ask for names */ - boothowto |= RB_ASKNAME; - break; - - case 'N': /* don't ask for names */ - boothowto &= ~RB_ASKNAME; - break; - } - - } + get_eth_hw_addr(getenv("ethaddr")); + cp = getenv("osloadoptions"); + if(cp) { + while(*cp) { + switch (*cp++) { + case 'a': /* autoboot */ + boothowto &= ~RB_SINGLE; + break; + + case 'd': /* use compiled in default root */ + boothowto |= RB_DFLTROOT; + break; + + case 'm': /* mini root present in memory */ + boothowto |= RB_MINIROOT; + break; + + case 'n': /* ask for names */ + boothowto |= RB_ASKNAME; + break; + + case 'N': /* don't ask for names */ + boothowto &= ~RB_ASKNAME; + break; } + } } @@ -574,6 +578,7 @@ tlb_init_tyne() /* * Simple routine to figure out SIMM module size. + * This code is a real hack and can surely be improved on... :-) */ static int get_simm_size(fadr, max) @@ -582,29 +587,94 @@ get_simm_size(fadr, max) { int msave; int msize; - + int ssize; + static int a1 = 0, a2 = 0; + static int s1 = 0, s2 = 0; + + if(!max) { + if(a1 == (int)fadr) + return(s1); + else if(a2 == (int)fadr) + return(s2); + else + return(0); + } fadr = (int *)PHYS_TO_UNCACHED(CACHED_TO_PHYS((int)fadr)); - msize = 1024*1024; + msize = max - 0x400000; + ssize = msize - 0x400000; - while(max >= msize) { - msave = fadr[0]; - fadr[0] = 0xC0DEB00F; - if(fadr[msize/4] == 0xC0DEB00F) { - fadr[0] = msave; + /* Find bank size of last module */ + while(ssize >= 0) { + msave = fadr[ssize / 4]; + fadr[ssize / 4] = 0xC0DEB00F; + if(fadr[msize /4 ] == 0xC0DEB00F) { + fadr[ssize / 4] = msave; if(fadr[msize/4] == msave) { break; /* Wrap around */ } } + fadr[ssize / 4] = msave; + ssize -= 0x400000; + } + msize = msize - ssize; + if(msize == max) + return(msize); /* well it never wrapped... */ + + msave = fadr[0]; + fadr[0] = 0xC0DEB00F; + if(fadr[msize / 4] == 0xC0DEB00F) { fadr[0] = msave; - msize += msize; + if(fadr[msize / 4] == msave) + return(msize); /* First module wrap = size */ } - if(msize <= max) { - return(msize); + + /* Ooops! Two not equal modules. Find size of first + second */ + s1 = s2 = msize; + ssize = 0; + while(ssize < max) { + msave = fadr[ssize / 4]; + fadr[ssize / 4] = 0xC0DEB00F; + if(fadr[msize /4 ] == 0xC0DEB00F) { + fadr[ssize / 4] = msave; + if(fadr[msize/4] == msave) { + break; /* Found end of module 1 */ + } + } + fadr[ssize / 4] = msave; + ssize += s2; + msize += s2; } - else { - return(-1); + + /* Is second bank dual sided? */ + fadr[(ssize+ssize/2)/4] = ~fadr[ssize]; + if(fadr[(ssize+ssize/2)/4] != fadr[ssize]) { + a2 = ssize+ssize/2; } + a1 = ssize; + + return(ssize); +} + +/* + * Return a pointer to the given environment variable. + */ +static char * +getenv(envname) + char *envname; +{ + char **env = environment; + int i; + + i = strlen(envname); + + while(*env) { + if(strncasecmp(envname, *env, i) == 0 && (*env)[i] == '=') { + return(&(*env)[i+1]); + } + env++; + } + return(NULL); } /* @@ -1170,16 +1240,32 @@ initcpu() break; } } +/* + * Convert "xx:xx:xx:xx:xx:xx" string to ethernet hardware address. + */ +static void +get_eth_hw_addr(s) + char *s; +{ + int i; + if(s != NULL) { + for(i = 0; i < 6; i++) { + eth_hw_addr[i] = atoi(s, 16); + s += 3; /* Don't get to fancy here :-) */ + } + } +} /* * Convert an ASCII string into an integer. */ -int -atoi(s) +static int +atoi(s, b) char *s; + int b; { int c; - unsigned base = 10, d; + unsigned base = b, d; int neg = 0, val = 0; if (s == 0 || (c = *s++) == 0) diff --git a/sys/arch/arc/arc/mem.c b/sys/arch/arc/arc/mem.c index 061291fa8bc..d03d98b8bb6 100644 --- a/sys/arch/arc/arc/mem.c +++ b/sys/arch/arc/arc/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.1 1996/06/24 09:07:21 pefo Exp $ */ +/* $OpenBSD: mem.c,v 1.2 1997/03/23 11:34:30 pefo Exp $ */ /* $NetBSD: mem.c,v 1.6 1995/04/10 11:55:03 mycroft Exp $ */ /* @@ -120,7 +120,7 @@ mmrw(dev, uio, flags) if (v < CACHED_MEMORY_ADDR) return (EFAULT); if (v + c > PHYS_TO_CACHED(avail_end + - sizeof (struct msgbuf)) && + sizeof (struct msgbuf)) && (v < KSEG2_ADDR || !kernacc((caddr_t)v, c, uio->uio_rw == UIO_READ ? B_READ : B_WRITE))) diff --git a/sys/arch/arc/arc/sys_machdep.c b/sys/arch/arc/arc/sys_machdep.c index 54a5ef1b15a..f3700f1580c 100644 --- a/sys/arch/arc/arc/sys_machdep.c +++ b/sys/arch/arc/arc/sys_machdep.c @@ -1,5 +1,4 @@ -/* $OpenBSD: sys_machdep.c,v 1.1 1996/06/24 09:07:21 pefo Exp $ */ -/* $NetBSD: sys_machdep.c,v 1.6 1994/10/26 21:10:42 cgd Exp $ */ +/* $OpenBSD: sys_machdep.c,v 1.2 1997/03/23 11:34:31 pefo Exp $ */ /* * Copyright (c) 1992, 1993 diff --git a/sys/arch/arc/arc/vm_machdep.c b/sys/arch/arc/arc/vm_machdep.c index 4fc85e4e914..de2a2aa0d22 100644 --- a/sys/arch/arc/arc/vm_machdep.c +++ b/sys/arch/arc/arc/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.3 1996/12/09 00:13:49 imp Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.4 1997/03/23 11:34:31 pefo Exp $ */ /* * Copyright (c) 1988 University of Utah. * Copyright (c) 1992, 1993 @@ -39,7 +39,7 @@ * from: Utah Hdr: vm_machdep.c 1.21 91/04/06 * * from: @(#)vm_machdep.c 8.3 (Berkeley) 1/4/94 - * $Id: vm_machdep.c,v 1.3 1996/12/09 00:13:49 imp Exp $ + * $Id: vm_machdep.c,v 1.4 1997/03/23 11:34:31 pefo Exp $ */ #include <sys/param.h> @@ -55,9 +55,6 @@ #include <vm/vm.h> #include <vm/vm_kern.h> #include <vm/vm_page.h> -#if 0 -#include <vm/vm_object.h> -#endif #include <machine/pte.h> #include <machine/cpu.h> diff --git a/sys/arch/arc/conf/GENERIC b/sys/arch/arc/conf/GENERIC index 1101d7bea88..1695789a275 100644 --- a/sys/arch/arc/conf/GENERIC +++ b/sys/arch/arc/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.12 1997/03/12 19:16:48 pefo Exp $ +# $OpenBSD: GENERIC,v 1.13 1997/03/23 11:34:32 pefo Exp $ # # Generic configuration file for MIPS R4x00 ARC Systems # @@ -99,6 +99,7 @@ scsibus* at asc? clock0 at algor? com0 at algor? com1 at algor? +lpt0 at algor? #### PCI Bus diff --git a/sys/arch/arc/conf/files.arc b/sys/arch/arc/conf/files.arc index 8f67b9d94ff..f76e00a4cfc 100644 --- a/sys/arch/arc/conf/files.arc +++ b/sys/arch/arc/conf/files.arc @@ -1,4 +1,4 @@ -# $OpenBSD: files.arc,v 1.12 1997/03/12 19:16:49 pefo Exp $ +# $OpenBSD: files.arc,v 1.13 1997/03/23 11:34:32 pefo Exp $ # # maxpartitions must be first item in files.${ARCH} # @@ -109,7 +109,7 @@ attach clock at pica with clock_pica attach clock at isa with clock_isa attach clock at algor with clock_algor file arch/arc/arc/clock.c clock & (clock_isa | clock_pica | clock_algor) needs-flag -file arch/arc/arc/clock_mc.c clock & (clock_isa | clock_pica) needs-flag +file arch/arc/arc/clock_mc.c clock & (clock_isa | clock_pica | clock_algor) needs-flag # Console driver on PC-style graphics device pc: tty @@ -122,12 +122,12 @@ 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 +file arch/arc/dti/btl.c btl needs-count # 8250/16[45]50-based "com" ports attach com at pica with com_pica attach com at algor with com_algor -file arch/arc/pica/com_pica.c com_pica +file arch/arc/dev/com_lbus.c com & (com_pica | com_algor) # National Semiconductor DS8390/WD83C690-based boards @@ -140,9 +140,9 @@ file dev/isa/if_ed.c ed & (ed_isa | ed_pcmcia) needs-flag # PC parallel ports (XXX what chip?) attach lpt at pica with lpt_pica -file arch/arc/pica/lpt_pica.c lpt_pica +attach lpt at algor with lpt_algor +file arch/arc/dev/lpt_lbus.c lpt & (lpt_pica | lpt_algor) -# # # PCI Bus support diff --git a/sys/arch/arc/dev/com_lbus.c b/sys/arch/arc/dev/com_lbus.c index 171c940266b..e837b650481 100644 --- a/sys/arch/arc/dev/com_lbus.c +++ b/sys/arch/arc/dev/com_lbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: com_lbus.c,v 1.1 1997/03/23 10:14:58 pefo Exp $ */ +/* $OpenBSD: com_lbus.c,v 1.2 1997/03/23 11:34:33 pefo Exp $ */ /* * Copyright (c) 1993, 1994 Charles Hannum. @@ -77,7 +77,11 @@ int com_localbus_probe __P((struct device *, void *, void *)); void com_localbus_attach __P((struct device *, struct device *, void *)); -struct cfattach com_localbus_ca = { +struct cfattach com_pica_ca = { + sizeof(struct com_softc), com_localbus_probe, com_localbus_attach +}; + +struct cfattach com_algor_ca = { sizeof(struct com_softc), com_localbus_probe, com_localbus_attach }; diff --git a/sys/arch/arc/dev/lpt_lbus.c b/sys/arch/arc/dev/lpt_lbus.c index c8ea86c2c35..51c82aa5242 100644 --- a/sys/arch/arc/dev/lpt_lbus.c +++ b/sys/arch/arc/dev/lpt_lbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lpt_lbus.c,v 1.1 1997/03/23 10:14:58 pefo Exp $ */ +/* $OpenBSD: lpt_lbus.c,v 1.2 1997/03/23 11:34:34 pefo Exp $ */ /* * Copyright (c) 1993, 1994 Charles Hannum. @@ -67,7 +67,11 @@ int lpt_localbus_probe __P((struct device *, void *, void *)); void lpt_localbus_attach __P((struct device *, struct device *, void *)); -struct cfattach lpt_localbus_ca = { +struct cfattach lpt_pica_ca = { + sizeof(struct lpt_softc), lpt_localbus_probe, lpt_localbus_attach +}; + +struct cfattach lpt_algor_ca = { sizeof(struct lpt_softc), lpt_localbus_probe, lpt_localbus_attach }; diff --git a/sys/arch/arc/include/cpu.h b/sys/arch/arc/include/cpu.h index c81694ce88f..9109b6cd0b1 100644 --- a/sys/arch/arc/include/cpu.h +++ b/sys/arch/arc/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.5 1997/03/12 19:16:56 pefo Exp $ */ +/* $OpenBSD: cpu.h,v 1.6 1997/03/23 11:34:34 pefo Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -62,10 +62,6 @@ #define PHYS_TO_UNCACHED(x) ((unsigned)(x) | UNCACHED_MEMORY_ADDR) #define VA_TO_CINDEX(x) ((unsigned)(x) & 0xffffff | CACHED_MEMORY_ADDR) -#if 0 -#define CODE_START 0x80080000 -#endif - #ifdef _KERNEL /* * The bits in the cause register. diff --git a/sys/arch/arc/pci/pbcpcibus.c b/sys/arch/arc/pci/pbcpcibus.c index 0bc374b8d39..61a48bc0368 100644 --- a/sys/arch/arc/pci/pbcpcibus.c +++ b/sys/arch/arc/pci/pbcpcibus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pbcpcibus.c,v 1.1 1997/03/12 19:17:00 pefo Exp $ */ +/* $OpenBSD: pbcpcibus.c,v 1.2 1997/03/23 11:34:35 pefo Exp $ */ /* * Copyright (c) 1997 Per Fogelstrom @@ -57,6 +57,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 *)); void pbcpcibrattach __P((struct device *, struct device *, void *)); @@ -327,12 +328,7 @@ pbc_ether_hw_addr(cp) u_int8_t *cp; { if(cputype == ALGOR_P4032) { - cp[0] = 0x00; - cp[1] = 0x40; - cp[2] = 0xbc; - cp[3] = 0x03; - cp[4] = 0x00; - cp[5] = 0x33; + bcopy(eth_hw_addr, cp, 6); return(0); } return(-1); diff --git a/sys/arch/arc/pica/com_pica.c b/sys/arch/arc/pica/com_pica.c deleted file mode 100644 index 044c1ad9118..00000000000 --- a/sys/arch/arc/pica/com_pica.c +++ /dev/null @@ -1,196 +0,0 @@ -/* $OpenBSD: com_pica.c,v 1.2 1997/03/12 19:17:03 pefo Exp $ */ - -/* - * Copyright (c) 1993, 1994 Charles Hannum. - * Copyright (c) 1990 William F. Jolitz, TeleMuse - * 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 software is a component of "386BSD" developed by - * William F. Jolitz, TeleMuse. - * 4. Neither the name of the developer nor the name "386BSD" - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS A COMPONENT OF 386BSD DEVELOPED BY WILLIAM F. JOLITZ - * AND IS INTENDED FOR RESEARCH AND EDUCATIONAL PURPOSES ONLY. THIS - * SOFTWARE SHOULD NOT BE CONSIDERED TO BE A COMMERCIAL PRODUCT. - * THE DEVELOPER URGES THAT USERS WHO REQUIRE A COMMERCIAL PRODUCT - * NOT MAKE USE OF THIS WORK. - * - * FOR USERS WHO WISH TO UNDERSTAND THE 386BSD SYSTEM DEVELOPED - * BY WILLIAM F. JOLITZ, WE RECOMMEND THE USER STUDY WRITTEN - * REFERENCES SUCH AS THE "PORTING UNIX TO THE 386" SERIES - * (BEGINNING JANUARY 1991 "DR. DOBBS JOURNAL", USA AND BEGINNING - * JUNE 1991 "UNIX MAGAZIN", GERMANY) BY WILLIAM F. JOLITZ AND - * LYNNE GREER JOLITZ, AS WELL AS OTHER BOOKS ON UNIX AND THE - * ON-LINE 386BSD USER MANUAL BEFORE USE. A BOOK DISCUSSING THE INTERNALS - * OF 386BSD ENTITLED "386BSD FROM THE INSIDE OUT" WILL BE AVAILABLE LATE 1992. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER ``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 DEVELOPER 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. - */ - -/* - * Device Driver for AT parallel printer port - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/device.h> -#include <sys/tty.h> - -#include <machine/autoconf.h> -#include <machine/bus.h> -#include <machine/intr.h> - -#include <dev/isa/isavar.h> /* XXX for isa_chipset_tag_t in com_softc */ - -#include <dev/ic/comreg.h> -#include <dev/ic/comvar.h> -#include <dev/ic/ns16550reg.h> - -/* Macros to clear/set/test flags. */ -#define SET(t, f) (t) |= (f) -#define CLR(t, f) (t) &= ~(f) -#define ISSET(t, f) ((t) & (f)) - -int com_pica_probe __P((struct device *, void *, void *)); -void com_pica_attach __P((struct device *, struct device *, void *)); - -struct cfattach com_pica_ca = { - sizeof(struct com_softc), com_pica_probe, com_pica_attach -}; - -struct cfattach com_algor_ca = { - sizeof(struct com_softc), com_pica_probe, com_pica_attach -}; - -int -com_pica_probe(parent, match, aux) - struct device *parent; - void *match, *aux; -{ - bus_space_tag_t iot; - bus_space_handle_t ioh; - int iobase, needioh; - int rv = 1; - struct confargs *ca = aux; - - if(!BUS_MATCHNAME(ca, "com")) - return(0); - iobase = (long)BUS_CVTADDR(ca); - iot = &arc_bus; - needioh = 1; - - /* if it's in use as console, it's there. */ - if (iobase == comconsaddr && !comconsattached) - goto out; - - if (needioh && bus_space_map(iot, iobase, COM_NPORTS, 0, &ioh)) { - rv = 0; - goto out; - } - rv = comprobe1(iot, ioh, iobase); - if (needioh) - bus_space_unmap(iot, ioh, COM_NPORTS); - -out: - return (rv); -} - -void -com_pica_attach(parent, self, aux) - struct device *parent, *self; - void *aux; -{ - struct com_softc *sc = (void *)self; - int iobase; - bus_space_tag_t iot; - bus_space_handle_t ioh; - struct confargs *ca = aux; - - sc->sc_hwflags = 0; - sc->sc_swflags = 0; - sc->sc_iobase = iobase = (bus_addr_t)BUS_CVTADDR(ca); - sc->sc_ioh = ioh = (bus_space_handle_t)iobase; - sc->sc_iot = iot = &arc_bus; - - if (iobase == comconsaddr) { - comconsattached = 1; - - /* - * Need to reset baud rate, etc. of next print so reset - * comconsinit. Also make sure console is always "hardwired". - */ - delay(1000); /* wait for output to finish */ - comconsinit = 0; - SET(sc->sc_hwflags, COM_HW_CONSOLE); - SET(sc->sc_swflags, COM_SW_SOFTCAR); - } - - - /* look for a NS 16550AF UART with FIFOs */ - bus_space_write_1(iot, ioh, com_fifo, - FIFO_ENABLE | FIFO_RCV_RST | FIFO_XMT_RST | FIFO_TRIGGER_14); - delay(100); - if (ISSET(bus_space_read_1(iot, ioh, com_iir), IIR_FIFO_MASK) == - IIR_FIFO_MASK) - if (ISSET(bus_space_read_1(iot, ioh, com_fifo), - FIFO_TRIGGER_14) == FIFO_TRIGGER_14) { - SET(sc->sc_hwflags, COM_HW_FIFO); - printf(": ns16550a, working fifo\n"); - } else - printf(": ns16550, broken fifo\n"); - else - printf(": ns8250 or ns16450, no fifo\n"); - bus_space_write_1(iot, ioh, com_fifo, 0); - - /* disable interrupts */ - bus_space_write_1(iot, ioh, com_ier, 0); - bus_space_write_1(iot, ioh, com_mcr, 0); - - BUS_INTR_ESTABLISH(ca, comintr, (void *)(long)sc); - -#ifdef KGDB - if (kgdb_dev == makedev(commajor, unit)) { - if (ISSET(sc->sc_hwflags, COM_HW_CONSOLE)) - kgdb_dev = -1; /* can't debug over console port */ - else { - cominit(iot, ioh, kgdb_rate); - if (kgdb_debug_init) { - /* - * Print prefix of device name, - * let kgdb_connect print the rest. - */ - printf("%s: ", sc->sc_dev.dv_xname); - kgdb_connect(1); - } else - printf("%s: kgdb enabled\n", - sc->sc_dev.dv_xname); - } - } -#endif - - /* XXX maybe move up some? */ - if (ISSET(sc->sc_hwflags, COM_HW_CONSOLE)) - printf("%s: console\n", sc->sc_dev.dv_xname); -} diff --git a/sys/arch/arc/pica/lpt_pica.c b/sys/arch/arc/pica/lpt_pica.c deleted file mode 100644 index e8edff1e2d8..00000000000 --- a/sys/arch/arc/pica/lpt_pica.c +++ /dev/null @@ -1,151 +0,0 @@ -/* $OpenBSD: lpt_pica.c,v 1.2 1996/11/30 00:53:39 niklas Exp $ */ - -/* - * Copyright (c) 1993, 1994 Charles Hannum. - * Copyright (c) 1990 William F. Jolitz, TeleMuse - * 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 software is a component of "386BSD" developed by - * William F. Jolitz, TeleMuse. - * 4. Neither the name of the developer nor the name "386BSD" - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS A COMPONENT OF 386BSD DEVELOPED BY WILLIAM F. JOLITZ - * AND IS INTENDED FOR RESEARCH AND EDUCATIONAL PURPOSES ONLY. THIS - * SOFTWARE SHOULD NOT BE CONSIDERED TO BE A COMMERCIAL PRODUCT. - * THE DEVELOPER URGES THAT USERS WHO REQUIRE A COMMERCIAL PRODUCT - * NOT MAKE USE OF THIS WORK. - * - * FOR USERS WHO WISH TO UNDERSTAND THE 386BSD SYSTEM DEVELOPED - * BY WILLIAM F. JOLITZ, WE RECOMMEND THE USER STUDY WRITTEN - * REFERENCES SUCH AS THE "PORTING UNIX TO THE 386" SERIES - * (BEGINNING JANUARY 1991 "DR. DOBBS JOURNAL", USA AND BEGINNING - * JUNE 1991 "UNIX MAGAZIN", GERMANY) BY WILLIAM F. JOLITZ AND - * LYNNE GREER JOLITZ, AS WELL AS OTHER BOOKS ON UNIX AND THE - * ON-LINE 386BSD USER MANUAL BEFORE USE. A BOOK DISCUSSING THE INTERNALS - * OF 386BSD ENTITLED "386BSD FROM THE INSIDE OUT" WILL BE AVAILABLE LATE 1992. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER ``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 DEVELOPER 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. - */ - -/* - * Device Driver for AT parallel printer port - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/device.h> - -#include <machine/autoconf.h> -#include <machine/bus.h> -#include <machine/intr.h> - -#include <dev/ic/lptreg.h> -#include <dev/ic/lptvar.h> - -int lpt_pica_probe __P((struct device *, void *, void *)); -void lpt_pica_attach __P((struct device *, struct device *, void *)); - -struct cfattach lpt_pica_ca = { - sizeof(struct lpt_softc), lpt_pica_probe, lpt_pica_attach -}; - -int -lpt_pica_probe(parent, match, aux) - struct device *parent; - void *match, *aux; -{ - struct confargs *ca = aux; - bus_space_tag_t iot; - bus_space_handle_t ioh; - bus_addr_t base; - u_int8_t mask, data; - int i; - -#ifdef DEBUG -#define ABORT \ - do { \ - printf("lpt_pica_probe: mask %x data %x failed\n", mask, \ - data); \ - return 0; \ - } while (0) -#else -#define ABORT return 0 -#endif - - if(!BUS_MATCHNAME(ca, "lpt")) - return(0); - - iot = 0; - base = (bus_addr_t)BUS_CVTADDR(ca); - ioh = (bus_space_handle_t)base; - - mask = 0xff; - - data = 0x55; /* Alternating zeros */ - if (!lpt_port_test(iot, ioh, base, lpt_data, data, mask)) - ABORT; - - data = 0xaa; /* Alternating ones */ - 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(iot, ioh, base, lpt_data, data, mask)) - ABORT; - } - - for (i = 0; i < CHAR_BIT; i++) { /* Walking one */ - data = (1 << i); - if (!lpt_port_test(iot, ioh, base, lpt_data, data, mask)) - ABORT; - } - - bus_space_write_1(iot, ioh, lpt_data, 0); - bus_space_write_1(iot, ioh, lpt_control, 0); - - return 1; -} - -void -lpt_pica_attach(parent, self, aux) - struct device *parent, *self; - void *aux; -{ - struct lpt_softc *sc = (void *)self; - struct confargs *ca = aux; - bus_space_tag_t iot; - bus_space_handle_t ioh; - - printf("\n"); - - sc->sc_state = 0; - iot = sc->sc_iot = 0; - 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); -} |