diff options
Diffstat (limited to 'sys/arch')
105 files changed, 2361 insertions, 1080 deletions
diff --git a/sys/arch/amiga/amiga/amiga_init.c b/sys/arch/amiga/amiga/amiga_init.c index 74298382da4..d05074ca9a8 100644 --- a/sys/arch/amiga/amiga/amiga_init.c +++ b/sys/arch/amiga/amiga/amiga_init.c @@ -1,5 +1,5 @@ -/* $OpenBSD: amiga_init.c,v 1.6 1996/03/24 15:59:41 niklas Exp $ */ -/* $NetBSD: amiga_init.c,v 1.35 1996/02/24 07:43:14 chopps Exp $ */ +/* $OpenBSD: amiga_init.c,v 1.7 1996/04/21 22:14:47 deraadt Exp $ */ +/* $NetBSD: amiga_init.c,v 1.36 1996/03/19 11:12:10 is Exp $ */ /* * Copyright (c) 1994 Michael L. Hitch diff --git a/sys/arch/amiga/amiga/autoconf.c b/sys/arch/amiga/amiga/autoconf.c index 2c07e53f5ad..c7955a02819 100644 --- a/sys/arch/amiga/amiga/autoconf.c +++ b/sys/arch/amiga/amiga/autoconf.c @@ -1,4 +1,5 @@ -/* $NetBSD: autoconf.c,v 1.29 1995/10/05 12:40:54 chopps Exp $ */ +/* $OpenBSD: autoconf.c,v 1.2 1996/04/21 22:14:49 deraadt Exp $ */ +/* $NetBSD: autoconf.c,v 1.31 1996/04/04 06:25:07 cgd Exp $ */ /* * Copyright (c) 1994 Christian E. Hopps @@ -45,7 +46,7 @@ void setroot __P((void)); void swapconf __P((void)); void mbattach __P((struct device *, struct device *, void *)); int mbprint __P((void *, char *)); -int mbmatch __P((struct device *, struct cfdata *, void *)); +int mbmatch __P((struct device *, void *, void *)); int cold; /* 1 if still booting */ #include <sys/kernel.h> @@ -61,7 +62,7 @@ configure() amiga_realconfig = 1; custom.intena = INTF_INTEN; - if (config_rootfound("mainbus", "mainbus") == 0) + if (config_rootfound("mainbus", "mainbus") == NULL) panic("no mainbus found"); custom.intena = INTF_SETCLR | INTF_INTEN; @@ -120,14 +121,14 @@ amiga_config_found(pcfp, pdp, auxp, pfn) struct cfdata *cf; if (amiga_realconfig) - return(config_found(pdp, auxp, pfn)); + return(config_found(pdp, auxp, pfn) != NULL); if (pdp == NULL) pdp = &temp; pdp->dv_cfdata = pcfp; if ((cf = config_search((cfmatch_t)NULL, pdp, auxp)) != NULL) { - cf->cf_driver->cd_attach(pdp, NULL, auxp); + cf->cf_attach->ca_attach(pdp, NULL, auxp); pdp->dv_cfdata = NULL; return(1); } @@ -165,17 +166,21 @@ config_console() /* * mainbus driver */ -struct cfdriver mainbuscd = { - NULL, "mainbus", (cfmatch_t)mbmatch, mbattach, - DV_DULL, sizeof(struct device), NULL, 0 +struct cfattach mainbus_ca = { + sizeof(struct device), mbmatch, mbattach +}; + +struct cfdriver mainbus_cd = { + NULL, "mainbus", DV_DULL, NULL, 0 }; int -mbmatch(pdp, cfp, auxp) +mbmatch(pdp, match, auxp) struct device *pdp; - struct cfdata *cfp; - void *auxp; + void *match, *auxp; { + struct cfdata *cfp = match; + if (cfp->cf_unit > 0) return(0); /* diff --git a/sys/arch/amiga/amiga/disksubr.c b/sys/arch/amiga/amiga/disksubr.c index 157132dcef4..95030a86692 100644 --- a/sys/arch/amiga/amiga/disksubr.c +++ b/sys/arch/amiga/amiga/disksubr.c @@ -1,4 +1,5 @@ -/* $NetBSD: disksubr.c,v 1.21 1996/01/07 22:01:44 thorpej Exp $ */ +/* $OpenBSD: disksubr.c,v 1.3 1996/04/21 22:14:50 deraadt Exp $ */ +/* $NetBSD: disksubr.c,v 1.22 1996/04/05 04:50:26 mhitch Exp $ */ /* * Copyright (c) 1994 Christian E. Hopps @@ -311,13 +312,30 @@ readdisklabel(dev, strat, lp, clp) pp = &lp->d_partitions[lp->d_npartitions]; break; } + if (lp->d_npartitions <= (pp - lp->d_partitions)) + lp->d_npartitions = (pp - lp->d_partitions) + 1; + +#ifdef DIAGNOSTIC + if (lp->d_secpercyl != (pbp->e.secpertrk * pbp->e.numheads)) { + if (pbp->partname[0] < sizeof(pbp->partname)) + pbp->partname[pbp->partname[0] + 1] = 0; + else + pbp->partname[sizeof(pbp->partname) - 1] = 0; + printf("Partition '%s' geometry %d/%d differs", + pbp->partname + 1, pbp->e.numheads, + pbp->e.secpertrk); + printf(" from RDB %d/%d\n", lp->d_ntracks, + lp->d_nsectors); + } +#endif /* * insert sort in increasing offset order */ while ((pp - lp->d_partitions) > RAW_PART + 1) { daddr_t boff; - boff = pbp->e.lowcyl * lp->d_secpercyl; + boff = pbp->e.lowcyl * pbp->e.secpertrk + * pbp->e.numheads; if (boff > (pp - 1)->p_offset) break; *pp = *(pp - 1); /* struct copy */ @@ -344,29 +362,28 @@ readdisklabel(dev, strat, lp, clp) nopname = 0; } - if (lp->d_npartitions <= i) - lp->d_npartitions = i + 1; - pp->p_size = (pbp->e.highcyl - pbp->e.lowcyl + 1) - * lp->d_secpercyl; - pp->p_offset = pbp->e.lowcyl * lp->d_secpercyl; + * pbp->e.secpertrk * pbp->e.numheads; + pp->p_offset = pbp->e.lowcyl * pbp->e.secpertrk + * pbp->e.numheads; pp->p_fstype = adt.fstype; - if (pbp->e.tabsize > 22 && ISFSARCH_NETBSD(adt)) { - pp->p_fsize = pbp->e.fsize; - pp->p_frag = pbp->e.frag; - pp->p_cpg = pbp->e.cpg; - } else { - pp->p_fsize = 1024; - pp->p_frag = 8; - pp->p_cpg = 0; - } if (adt.archtype == ADT_AMIGADOS) { /* * Save reserved blocks at begin in cpg and * adjust size by reserved blocks at end */ + pp->p_fsize = 512; + pp->p_frag = pbp->e.secperblk; pp->p_cpg = pbp->e.resvblocks; pp->p_size -= pbp->e.prefac; + } else if (pbp->e.tabsize > 22 && ISFSARCH_NETBSD(adt)) { + pp->p_fsize = pbp->e.fsize; + pp->p_frag = pbp->e.frag; + pp->p_cpg = pbp->e.cpg; + } else { + pp->p_fsize = 1024; + pp->p_frag = 8; + pp->p_cpg = 0; } /* @@ -543,10 +560,16 @@ getadostype(dostype) return(adt); case DOST_MUFS: /* check for 'muFS'? */ - case DOST_DOS: adt.archtype = ADT_AMIGADOS; adt.fstype = FS_ADOS; return(adt); + case DOST_DOS: + adt.archtype = ADT_AMIGADOS; + if (b1 > 5) + adt.fstype = FS_UNUSED; + else + adt.fstype = FS_ADOS; + return(adt); case DOST_AMIX: adt.archtype = ADT_AMIX; if (b1 == 2) diff --git a/sys/arch/amiga/amiga/swapgeneric.c b/sys/arch/amiga/amiga/swapgeneric.c index 3cb570e0f75..b619de64638 100644 --- a/sys/arch/amiga/amiga/swapgeneric.c +++ b/sys/arch/amiga/amiga/swapgeneric.c @@ -1,4 +1,5 @@ -/* $NetBSD: swapgeneric.c,v 1.20 1996/01/07 22:01:46 thorpej Exp $ */ +/* $OpenBSD: swapgeneric.c,v 1.3 1996/04/21 22:14:51 deraadt Exp $ */ +/* $NetBSD: swapgeneric.c,v 1.21 1996/03/17 05:54:41 mhitch Exp $ */ /* * Copyright (c) 1982, 1986 Regents of the University of California. @@ -68,13 +69,13 @@ struct swdevt swdevt[] = { }; #if NFD > 0 -extern struct cfdriver fdcd; +extern struct cfdriver fd_cd; #endif #if NSD > 0 -extern struct cfdriver sdcd; +extern struct cfdriver sd_cd; #endif #if NCD > 0 -extern struct cfdriver cdcd; +extern struct cfdriver cd_cd; #endif struct genericconf { @@ -91,13 +92,13 @@ struct genericconf { */ struct genericconf genericconf[] = { #if NFD > 0 - {&fdcd, makedev(2, 0)}, + {&fd_cd, makedev(2, 0)}, #endif #if NSD > 0 - {&sdcd, makedev(4, 0)}, + {&sd_cd, makedev(4, 0)}, #endif #if NCD > 0 - {&cdcd, makedev(7, 0)}, + {&cd_cd, makedev(7, 0)}, #endif { 0 }, }; diff --git a/sys/arch/amiga/conf/files.amiga b/sys/arch/amiga/conf/files.amiga index e41c0d53964..90ba56bc492 100644 --- a/sys/arch/amiga/conf/files.amiga +++ b/sys/arch/amiga/conf/files.amiga @@ -1,54 +1,65 @@ -# $OpenBSD: files.amiga,v 1.8 1996/03/30 22:18:10 niklas Exp $ -# $NetBSD: files.amiga,v 1.36 1996/03/02 14:00:32 veego Exp $ +# $OpenBSD: files.amiga,v 1.9 1996/04/21 22:14:53 deraadt Exp $ +# $NetBSD: files.amiga,v 1.41 1996/03/28 18:41:55 is Exp $ # maxpartitions must be first item in files.${ARCH} maxpartitions 16 # NOTE THAT AMIGA IS SPECIAL! maxusers 2 8 64 -device mainbus at root {} +device mainbus {} +attach mainbus at root -device cpu at mainbus +device cpu +attach cpu at mainbus # zorro II expansion bus. -device zbus at mainbus {} +device zbus {} +attach zbus at mainbus file arch/amiga/dev/zbus.c zbus define event {} file arch/amiga/dev/event.c event -device clock at mainbus +device clock +attach clock at mainbus file arch/amiga/dev/clock.c # keyboard -device kbd at mainbus: event +device kbd: event +attach kbd at mainbus file arch/amiga/dev/kbd.c kbd needs-flag # serial port -device ser at mainbus: tty +device ser: tty +attach ser at mainbus file arch/amiga/dev/ser.c ser needs-count # parellel port -device par at mainbus +device par +attach par at mainbus file arch/amiga/dev/par.c par needs-count # mouse pseudo-device mouse file arch/amiga/dev/ms.c mouse needs-count -device fdc at mainbus { unit = -1 } +device fdc { unit = -1 } +attach fdc at mainbus -device fd at fdc +device fd +attach fd at fdc file arch/amiga/dev/fd.c fd needs-flag major {fd = 2} # graphic devices define grfbus {} -device grf at grfbus {} +device grf {} +attach grf at grfbus file arch/amiga/dev/grf.c grf needs-count -device ite at grf +device ite +attach ite at grf file arch/amiga/dev/ite.c ite needs-flag file arch/amiga/dev/kbdmap.c ite file arch/amiga/dev/kf_8x8.c ite @@ -56,75 +67,92 @@ file arch/amiga/dev/kf_8x11.c kfont_8x11 file arch/amiga/dev/kf_custom.c kfont_custom # custom chips grf -device grfcc at mainbus: grfbus +device grfcc: grfbus +attach grfcc at mainbus file arch/amiga/dev/grf_cc.c grfcc needs-flag -file arch/amiga/dev/ite_cc.c grfcc ite +file arch/amiga/dev/ite_cc.c grfcc & ite pseudo-device view -file arch/amiga/dev/view.c view grfcc needs-count -file arch/amiga/dev/grfabs.c grfcc view -file arch/amiga/dev/grfabs_cc.c grfcc view -file arch/amiga/dev/grfabs_ccglb.c grfcc view +file arch/amiga/dev/view.c view | grfcc needs-count +file arch/amiga/dev/grfabs.c grfcc | view +file arch/amiga/dev/grfabs_cc.c grfcc | view +file arch/amiga/dev/grfabs_ccglb.c grfcc | view # retina grf -device grfrt at zbus: grfbus +device grfrt: grfbus +attach grfrt at zbus file arch/amiga/dev/grf_rt.c grfrt needs-flag -file arch/amiga/dev/ite_rt.c grfrt ite +file arch/amiga/dev/ite_rt.c grfrt & ite # cirrus grf -device grfcl at zbus: grfbus +device grfcl: grfbus +attach grfcl at zbus file arch/amiga/dev/grf_cl.c grfcl needs-flag -file arch/amiga/dev/ite_cl.c grfcl ite +file arch/amiga/dev/ite_cl.c grfcl & ite # CyberVison 64 grf -device grfcv at zbus: grfbus +device grfcv: grfbus +attach grfcv at zbus file arch/amiga/dev/grf_cv.c grfcv needs-flag -file arch/amiga/dev/ite_cv.c grfcv ite +file arch/amiga/dev/ite_cv.c grfcv & ite # A2410 grf -device grful at zbus: grfbus +device grful: grfbus +attach grful at zbus file arch/amiga/dev/grf_ul.c grful needs-flag -file arch/amiga/dev/ite_ul.c grful ite -file arch/amiga/dev/grf_ultms.g grful +file arch/amiga/dev/ite_ul.c grful & ite +file arch/amiga/dev/grf_ultms.g grful # retina ZIII grf -device grfrh at zbus: grfbus +device grfrh: grfbus +attach grfrh at zbus file arch/amiga/dev/grf_rh.c grfrh needs-flag -file arch/amiga/dev/ite_rh.c grfrh ite +file arch/amiga/dev/ite_rh.c grfrh & ite # handle gvp's odd autoconf info.. -device gvpbus at zbus {} +device gvpbus {} +attach gvpbus at zbus file arch/amiga/dev/gvpbus.c gvpbus -device le at zbus: ifnet, ether -file arch/amiga/dev/if_le.c le needs-flag +device le: ifnet, ether +attach le at zbus with le_zbus +file arch/amiga/dev/if_le.c le_zbus needs-flag -device ed at zbus: ifnet, ether -file arch/amiga/dev/if_ed.c ed needs-flag +device ed: ifnet, ether +attach ed at zbus with ed_zbus +file arch/amiga/dev/if_ed.c ed_zbus needs-flag # C=/Ameristar A2060 / 560 -device bah at zbus: ifnet, arc -file arch/amiga/dev/if_bah.c bah needs-flag +device bah: ifnet, arc +attach bah at zbus with bah_zbus +file arch/amiga/dev/if_bah.c bah_zbus needs-flag -device es at zbus: ifnet, ether +device es: ifnet, ether +attach es at zbus file arch/amiga/dev/if_es.c es needs-flag -device qn at zbus: ifnet, ether +device qn: ifnet, ether +attach qn at zbus file arch/amiga/dev/if_qn.c qn needs-flag -device ae at zbus: ifnet, ether +device ae: ifnet, ether +attach ae at zbus file arch/amiga/dev/if_ae.c ae needs-count # A2232 msc serial ports -device msc at zbus: tty +device msc: tty +attach msc at zbus file arch/amiga/dev/msc.c msc needs-count # bsc/Alf Data MultiFaceCard -device mfc at zbus { unit = -1 } +device mfc { unit = -1 } +attach mfc at zbus -device mfcs at mfc -device mfcp at mfc -file arch/amiga/dev/mfc.c mfcs mfcp needs-count +device mfcs +attach mfcs at mfc +device mfcp +attach mfcp at mfc +file arch/amiga/dev/mfc.c mfcs | mfcp needs-count include "../../../scsi/files.scsi" @@ -133,15 +161,18 @@ define sbic file arch/amiga/dev/sbic.c sbic # C= A2091 -device atzsc at zbus: scsi, sbic +device atzsc: scsi, sbic +attach atzsc at zbus file arch/amiga/dev/atzsc.c atzsc needs-flag # GVP series II -device gtsc at gvpbus: scsi, sbic +device gtsc: scsi, sbic +attach gtsc at gvpbus file arch/amiga/dev/gtsc.c gtsc needs-flag # Amiga 3000 internal -device ahsc at mainbus: scsi, sbic +device ahsc: scsi, sbic +attach ahsc at mainbus file arch/amiga/dev/ahsc.c ahsc needs-flag # ncr 57c710 controllers @@ -149,56 +180,73 @@ define siop file arch/amiga/dev/siop.c siop # PPI Zeus -device zssc at zbus: scsi, siop +device zssc: scsi, siop +attach zssc at zbus file arch/amiga/dev/zssc.c zssc needs-flag # CSA Magnum -device mgnsc at zbus: scsi, siop +device mgnsc: scsi, siop +attach mgnsc at zbus file arch/amiga/dev/mgnsc.c mgnsc needs-flag # MacroSystems Warp Engine -device wesc at zbus: scsi, siop +device wesc: scsi, siop +attach wesc at zbus file arch/amiga/dev/wesc.c wesc needs-flag # C= A4091 -device afsc at zbus: scsi, siop -device aftsc at mainbus: scsi, siop -file arch/amiga/dev/afsc.c afsc aftsc needs-flag +device afsc: scsi, siop +attach afsc at zbus +device aftsc: scsi, siop +attach aftsc at mainbus +file arch/amiga/dev/afsc.c afsc | aftsc needs-flag # ncr 5380 controllers define sci file arch/amiga/dev/sci.c sci # Supra Wordsync II -device wstsc at zbus: scsi, sci +device wstsc: scsi, sci +attach wstsc at zbus file arch/amiga/dev/wstsc.c wstsc needs-flag # IVS -device ivsc at zbus: scsi, sci +device ivsc: scsi, sci +attach ivsc at zbus file arch/amiga/dev/ivsc.c ivsc needs-flag # CSA twelve gauge. -device otgsc at zbus: scsi, sci +device otgsc: scsi, sci +attach otgsc at zbus file arch/amiga/dev/otgsc.c otgsc needs-flag # MLH -device mlhsc at zbus: scsi, sci +device mlhsc: scsi, sci +attach mlhsc at zbus file arch/amiga/dev/mlhsc.c mlhsc needs-flag +# Emplant +device empsc: scsi, sci +attach empsc at zbus +file arch/amiga/dev/empsc.c empsc needs-flag + # Emulex ESP216 & FAS216 controllers define sfas file arch/amiga/dev/sfas.c sfas # FastlaneZ3 -device flsc at zbus: scsi, sfas +device flsc: scsi, sfas +attach flsc at zbus file arch/amiga/dev/flsc.c flsc needs-flag # Blizzard1230 -device bzsc at zbus: scsi, sfas +device bzsc: scsi, sfas +attach bzsc at zbus file arch/amiga/dev/bzsc.c bzsc needs-flag # Amiga 4000/1200 IDE masquerading as SCSI -device idesc at mainbus: scsi +device idesc: scsi +attach idesc at mainbus file arch/amiga/dev/idesc.c idesc needs-flag # @@ -233,8 +281,8 @@ device isaed at isa: ifnet, ether file arch/amiga/isa/if_isaed.c isaed # list of standard files... -file dev/cons.c ite ser -file dev/cninit.c ite ser +file dev/cons.c ite | ser +file dev/cninit.c ite | ser file arch/amiga/amiga/amiga_init.c file arch/amiga/amiga/autoconf.c file arch/amiga/amiga/cia.c diff --git a/sys/arch/amiga/dev/afsc.c b/sys/arch/amiga/dev/afsc.c index 0f0aa0f04c7..39faa7e19be 100644 --- a/sys/arch/amiga/dev/afsc.c +++ b/sys/arch/amiga/dev/afsc.c @@ -1,5 +1,5 @@ -/* $OpenBSD: afsc.c,v 1.3 1996/03/30 22:18:12 niklas Exp $ */ -/* $NetBSD: afsc.c,v 1.11 1996/03/15 22:11:09 mhitch Exp $ */ +/* $OpenBSD: afsc.c,v 1.4 1996/04/21 22:14:56 deraadt Exp $ */ +/* $NetBSD: afsc.c,v 1.13 1996/03/18 04:58:36 mhitch Exp $ */ /* * Copyright (c) 1994 Michael L. Hitch @@ -53,7 +53,7 @@ int afscprint __P((void *auxp, char *)); void afscattach __P((struct device *, struct device *, void *)); -int afscmatch __P((struct device *, struct cfdata *, void *)); +int afscmatch __P((struct device *, void *, void *)); int siopintr __P((struct siop_softc *)); int afsc_dmaintr __P((struct siop_softc *)); @@ -75,22 +75,31 @@ struct scsi_device afsc_scsidev = { #ifdef DEBUG #endif -struct cfdriver afsccd = { - NULL, "afsc", (cfmatch_t)afscmatch, afscattach, - DV_DULL, sizeof(struct siop_softc), NULL, 0 }; -struct cfdriver aftsccd = { - NULL, "aftsc", (cfmatch_t)afscmatch, afscattach, - DV_DULL, sizeof(struct siop_softc), NULL, 0 }; +struct cfattach afsc_ca = { + sizeof(struct siop_softc), afscmatch, afscattach +}; + +struct cfdriver afsc_cd = { + NULL, "afsc", DV_DULL, NULL, 0 +}; + +struct cfattach aftsc_ca = { + sizeof(struct siop_softc), afscmatch, afscattach +}; + +struct cfdriver aftsc_cd = { + NULL, "aftsc", DV_DULL, NULL, 0 +}; /* * if we are a Commodore Amiga A4091 or possibly an A4000T */ int -afscmatch(pdp, cdp, auxp) +afscmatch(pdp, match, auxp) struct device *pdp; - struct cfdata *cdp; - void *auxp; + void *match, *auxp; { + struct cfdata *cdp = match; struct zbus_args *zap; siop_regmap_p rp; u_long temp, scratch; @@ -205,8 +214,8 @@ afsc_dump() { int i; - for (i = 0; i < afsccd.cd_ndevs; ++i) - if (afsccd.cd_devs[i]) - siop_dump(afsccd.cd_devs[i]); + for (i = 0; i < afsc_cd.cd_ndevs; ++i) + if (afsc_cd.cd_devs[i]) + siop_dump(afsc_cd.cd_devs[i]); } #endif diff --git a/sys/arch/amiga/dev/ahsc.c b/sys/arch/amiga/dev/ahsc.c index baca99e6475..45c698e8755 100644 --- a/sys/arch/amiga/dev/ahsc.c +++ b/sys/arch/amiga/dev/ahsc.c @@ -1,4 +1,5 @@ -/* $NetBSD: ahsc.c,v 1.10 1995/09/04 13:04:40 chopps Exp $ */ +/* $OpenBSD: ahsc.c,v 1.2 1996/04/21 22:14:57 deraadt Exp $ */ +/* $NetBSD: ahsc.c,v 1.11 1996/03/17 01:17:00 thorpej Exp $ */ /* * Copyright (c) 1994 Christian E. Hopps @@ -53,7 +54,7 @@ int ahscprint __P((void *auxp, char *)); void ahscattach __P((struct device *, struct device *, void *)); -int ahscmatch __P((struct device *, struct cfdata *, void *)); +int ahscmatch __P((struct device *, void *, void *)); void ahsc_enintr __P((struct sbic_softc *)); void ahsc_dmastop __P((struct sbic_softc *)); @@ -80,19 +81,23 @@ struct scsi_device ahsc_scsidev = { int ahsc_dmadebug = 0; #endif -struct cfdriver ahsccd = { - NULL, "ahsc", (cfmatch_t)ahscmatch, ahscattach, - DV_DULL, sizeof(struct sbic_softc), NULL, 0 }; +struct cfattach ahsc_ca = { + sizeof(struct sbic_softc), ahscmatch, ahscattach +}; + +struct cfdriver ahsc_cd = { + NULL, "ahsc", DV_DULL, NULL, 0 +}; /* * if we are an A3000 we are here. */ int -ahscmatch(pdp, cdp, auxp) +ahscmatch(pdp, match, auxp) struct device *pdp; - struct cfdata *cdp; - void *auxp; + void *match, *auxp; { + struct cfdata *cdp = match; char *mbusstr; mbusstr = auxp; @@ -322,8 +327,8 @@ ahsc_dump() { int i; - for (i = 0; i < ahsccd.cd_ndevs; ++i) - if (ahsccd.cd_devs[i]) - sbic_dump(ahsccd.cd_devs[i]); + for (i = 0; i < ahsc_cd.cd_ndevs; ++i) + if (ahsc_cd.cd_devs[i]) + sbic_dump(ahsc_cd.cd_devs[i]); } #endif diff --git a/sys/arch/amiga/dev/atzsc.c b/sys/arch/amiga/dev/atzsc.c index 55d69a25e42..2073fda49a5 100644 --- a/sys/arch/amiga/dev/atzsc.c +++ b/sys/arch/amiga/dev/atzsc.c @@ -1,4 +1,5 @@ -/* $NetBSD: atzsc.c,v 1.13 1995/09/04 13:04:42 chopps Exp $ */ +/* $OpenBSD: atzsc.c,v 1.2 1996/04/21 22:14:59 deraadt Exp $ */ +/* $NetBSD: atzsc.c,v 1.15 1996/03/18 04:58:37 mhitch Exp $ */ /* * Copyright (c) 1994 Christian E. Hopps @@ -53,7 +54,7 @@ int atzscprint __P((void *auxp, char *)); void atzscattach __P((struct device *, struct device *, void *)); -int atzscmatch __P((struct device *, struct cfdata *, void *)); +int atzscmatch __P((struct device *, void *, void *)); void atzsc_enintr __P((struct sbic_softc *)); void atzsc_dmastop __P((struct sbic_softc *)); @@ -80,19 +81,23 @@ struct scsi_device atzsc_scsidev = { int atzsc_dmadebug = 0; #endif -struct cfdriver atzsccd = { - NULL, "atzsc", (cfmatch_t)atzscmatch, atzscattach, - DV_DULL, sizeof(struct sbic_softc), NULL, 0 }; +struct cfattach atzsc_ca = { + sizeof(struct sbic_softc), atzscmatch, atzscattach +}; + +struct cfdriver atzsc_cd = { + NULL, "atzsc", DV_DULL, NULL, 0 +}; /* * if we are an A3000 we are here. */ int -atzscmatch(pdp, cdp, auxp) +atzscmatch(pdp, match, auxp) struct device *pdp; - struct cfdata *cdp; - void *auxp; + void *match, *auxp; { + struct cfdata *cdp = match; struct zbus_args *zap; zap = auxp; @@ -346,8 +351,8 @@ atzsc_dump() { int i; - for (i = 0; i < atzsccd.cd_ndevs; ++i) - if (atzsccd.cd_devs[i]) - sbic_dump(atzsccd.cd_devs[i]); + for (i = 0; i < atzsc_cd.cd_ndevs; ++i) + if (atzsc_cd.cd_devs[i]) + sbic_dump(atzsc_cd.cd_devs[i]); } #endif diff --git a/sys/arch/amiga/dev/bzsc.c b/sys/arch/amiga/dev/bzsc.c index a3adf7ea4a5..1cd4456ab1f 100644 --- a/sys/arch/amiga/dev/bzsc.c +++ b/sys/arch/amiga/dev/bzsc.c @@ -1,3 +1,5 @@ +/* $OpenBSD: bzsc.c,v 1.2 1996/04/21 22:15:00 deraadt Exp $ */ + /* * Copyright (c) 1995 Daniel Widenfalk * Copyright (c) 1994 Christian E. Hopps @@ -57,7 +59,7 @@ int bzscprint __P((void *auxp, char *)); void bzscattach __P((struct device *, struct device *, void *)); -int bzscmatch __P((struct device *, struct cfdata *, void *)); +int bzscmatch __P((struct device *, void *, void *)); struct scsi_adapter bzsc_scsiswitch = { sfas_scsicmd, @@ -73,10 +75,13 @@ struct scsi_device bzsc_scsidev = { NULL, /* Use default done routine */ }; +struct cfattach bzsc_ca = { + sizeof(struct bzsc_softc), bzscmatch, bzscattach +}; -struct cfdriver bzsccd = { - NULL, "bzsc", (cfmatch_t)bzscmatch, bzscattach, - DV_DULL, sizeof(struct bzsc_softc), NULL, 0 }; +struct cfdriver bzsc_cd = { + NULL, "bzsc", DV_DULL, NULL, 0 +}; int bzsc_intr __P((struct sfas_softc *dev)); int bzsc_setup_dma __P((struct sfas_softc *sc, void *ptr, int len, @@ -89,7 +94,7 @@ void bzsc_led_dummy __P((struct sfas_softc *sc)); /* * if we are an Advanced Systems & Software FastlaneZ3 */ -int bzscmatch(struct device *pdp, struct cfdata *cdp, void *auxp) +int bzscmatch(struct device *pdp, void *match, void *auxp) { struct zbus_args *zap; diff --git a/sys/arch/amiga/dev/clock.c b/sys/arch/amiga/dev/clock.c index 481841c958f..00d38bb3133 100644 --- a/sys/arch/amiga/dev/clock.c +++ b/sys/arch/amiga/dev/clock.c @@ -1,4 +1,5 @@ -/* $NetBSD: clock.c,v 1.10 1995/02/20 00:53:42 chopps Exp $ */ +/* $OpenBSD: clock.c,v 1.4 1996/04/21 22:15:01 deraadt Exp $ */ +/* $NetBSD: clock.c,v 1.12 1996/03/17 05:58:30 mhitch Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -93,19 +94,23 @@ struct clockframe hardclock_frame; * periods where N is the value loaded into the counter. */ -int clockmatch __P((struct device *, struct cfdata *, void *)); +int clockmatch __P((struct device *, void *, void *)); void clockattach __P((struct device *, struct device *, void *)); -struct cfdriver clockcd = { - NULL, "clock", (cfmatch_t)clockmatch, clockattach, - DV_DULL, sizeof(struct device), NULL, 0 }; +struct cfattach clock_ca = { + sizeof(struct device), clockmatch, clockattach +}; + +struct cfdriver clock_cd = { + NULL, "clock", DV_DULL, NULL, 0 }; int -clockmatch(pdp, cfp, auxp) +clockmatch(pdp, match, auxp) struct device *pdp; - struct cfdata *cfp; - void *auxp; + void *match, *auxp; { + struct cfdata *cfp = match; + if (matchname("clock", auxp)) return(1); return(0); diff --git a/sys/arch/amiga/dev/empsc.c b/sys/arch/amiga/dev/empsc.c new file mode 100644 index 00000000000..9618c00b696 --- /dev/null +++ b/sys/arch/amiga/dev/empsc.c @@ -0,0 +1,182 @@ +/* $OpenBSD: empsc.c,v 1.1 1996/04/21 22:15:02 deraadt Exp $ */ +/* $NetBSD: empsc.c,v 1.4 1996/04/05 15:53:41 is Exp $ */ + +/* + + * Copyright (c) 1995 Sean Riddle, Bo Najdrovsky + * Copyright (c) 1994 Michael L. Hitch + * Copyright (c) 1982, 1990 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. + * + */ +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/kernel.h> +#include <sys/device.h> +#include <scsi/scsi_all.h> +#include <scsi/scsiconf.h> +#include <amiga/amiga/custom.h> +#include <amiga/amiga/device.h> +#include <amiga/amiga/isr.h> +#include <amiga/dev/scireg.h> +#include <amiga/dev/scivar.h> +#include <amiga/dev/zbusvar.h> + +int empscprint __P((void *auxp, char *)); +void empscattach __P((struct device *, struct device *, void *)); +int empscmatch __P((struct device *, struct cfdata *, void *)); +int empsc_intr __P((struct sci_softc *)); + +struct scsi_adapter empsc_scsiswitch = { + sci_scsicmd, + sci_minphys, + 0, /* no lun support */ + 0, /* no lun support */ +}; + +struct scsi_device empsc_scsidev = { + NULL, /* use default error handler */ + NULL, /* do not have a start functio */ + NULL, /* have no async handler */ + NULL, /* Use default done routine */ +}; + +#define QPRINTF + +#ifdef DEBUG +extern int sci_debug; +#endif + +extern int sci_data_wait; + +struct cfattach empsc_ca = { + sizeof(struct sci_softc), empscmatch, empscattach +}; + +struct cfdriver empsc_cd = { + NULL, "empsc", DV_DULL, NULL, 0 +}; + +/* + * if this is an EMPLANT board + */ +int +empscmatch(pdp, match, auxp) + struct device *pdp; + void *match, *auxp; +{ + struct zbus_args *zap; + + zap = auxp; + + /* + * Check manufacturer and product id. + */ + if (zap->manid == 2171 && ((zap->prodid == 21)||(zap->prodid==32))) + return(1); + else + return(0); +} + +void +empscattach(pdp, dp, auxp) + struct device *pdp, *dp; + void *auxp; +{ + volatile u_char *rp; + struct sci_softc *sc; + struct zbus_args *zap; + + printf("\n"); + + zap = auxp; + + sc = (struct sci_softc *)dp; + rp = zap->va + 0x5000; + + sc->sci_data = rp; + sc->sci_odata = rp; + sc->sci_icmd = rp + 0x10; + sc->sci_mode = rp + 0x20; + sc->sci_tcmd = rp + 0x30; + sc->sci_bus_csr = rp + 0x40; + sc->sci_sel_enb = rp + 0x40; + sc->sci_csr = rp + 0x50; + sc->sci_dma_send = rp + 0x50; + sc->sci_idata = rp + 0x60; + sc->sci_trecv = rp + 0x60; + sc->sci_iack = rp + 0x70; + sc->sci_irecv = rp + 0x70; + sc->sc_isr.isr_intr = empsc_intr; + sc->sc_isr.isr_arg = sc; + sc->sc_isr.isr_ipl = 2; + add_isr(&sc->sc_isr); + + scireset(sc); + + sc->sc_link.adapter_softc = sc; + sc->sc_link.adapter_target = 7; + sc->sc_link.adapter = &empsc_scsiswitch; + sc->sc_link.device = &empsc_scsidev; + sc->sc_link.openings = 1; + TAILQ_INIT(&sc->sc_xslist); + + /* + * attach all scsi units on us + */ + config_found(dp, &sc->sc_link, empscprint); +} + +/* + * print diag if pnp is NULL else just extra + */ +int +empscprint(auxp, pnp) + void *auxp; + char *pnp; +{ + if (pnp == NULL) + return(UNCONF); + return(QUIET); +} + +int +empsc_intr(dev) + struct sci_softc *dev; +{ + u_char stat; + + if ((*dev->sci_csr & SCI_CSR_INT) == 0) + return(0); + stat = *dev->sci_iack; + /* XXXX is: something is missing here, at least a: */ + return(1); +} diff --git a/sys/arch/amiga/dev/fd.c b/sys/arch/amiga/dev/fd.c index 699b917edce..86c76049a14 100644 --- a/sys/arch/amiga/dev/fd.c +++ b/sys/arch/amiga/dev/fd.c @@ -1,4 +1,5 @@ -/* $NetBSD: fd.c,v 1.25 1996/01/28 19:48:39 chopps Exp $ */ +/* $OpenBSD: fd.c,v 1.5 1996/04/21 22:15:04 deraadt Exp $ */ +/* $NetBSD: fd.c,v 1.28 1996/04/05 05:08:07 mhitch Exp $ */ /* * Copyright (c) 1994 Christian E. Hopps @@ -149,8 +150,8 @@ struct fdcargs { int unit; }; -int fdmatch __P((struct device *, struct cfdata *, void *)); -int fdcmatch __P((struct device *, struct cfdata *, void *)); +int fdmatch __P((struct device *, void *, void *)); +int fdcmatch __P((struct device *, void *, void *)); int fdcprint __P((void *, char *)); void fdcattach __P((struct device *, struct device *, void *)); void fdattach __P((struct device *, struct device *, void *)); @@ -190,13 +191,21 @@ struct fdtype fdtype[] = { }; int nfdtype = sizeof(fdtype) / sizeof(*fdtype); -struct cfdriver fdcd = { - NULL, "fd", (cfmatch_t)fdmatch, fdattach, DV_DISK, - sizeof(struct fd_softc), NULL, 0 }; +struct cfattach fd_ca = { + sizeof(struct fd_softc), fdmatch, fdattach +}; + +struct cfdriver fd_cd = { + NULL, "fd", DV_DISK, NULL, 0 +}; + +struct cfattach fdc_ca = { + sizeof(struct device), fdcmatch, fdcattach +}; -struct cfdriver fdccd = { - NULL, "fdc", (cfmatch_t)fdcmatch, fdcattach, DV_DULL, - sizeof(struct device), NULL, 0 }; +struct cfdriver fdc_cd = { + NULL, "fdc", DV_DULL, NULL, 0 +}; /* * all hw access through macros, this helps to hide the active low @@ -256,11 +265,12 @@ struct cfdriver fdccd = { int -fdcmatch(pdp, cfp, auxp) +fdcmatch(pdp, match, auxp) struct device *pdp; - struct cfdata *cfp; - void *auxp; + void *match, *auxp; { + struct cfdata *cfp = match; + if (matchname("fdc", auxp) == 0 || cfp->cf_unit != 0) return(0); if ((fdc_dmap = alloc_chipmem(DMABUFSZ)) == NULL) { @@ -305,11 +315,12 @@ fdcprint(auxp, pnp) /*ARGSUSED*/ int -fdmatch(pdp, cfp, auxp) +fdmatch(pdp, match, auxp) struct device *pdp; - struct cfdata *cfp; - void *auxp; + void *match, *auxp; { + struct cfdata *cfp = match; + #define cf_unit cf_loc[0] struct fdcargs *fdap; @@ -381,7 +392,7 @@ Fdopen(dev, flags, devtype, p) if (FDPART(dev) >= FDMAXPARTS) return(ENXIO); - if ((sc = getsoftc(fdcd, FDUNIT(dev))) == NULL) + if ((sc = getsoftc(fd_cd, FDUNIT(dev))) == NULL) return(ENXIO); if (sc->flags & FDF_NOTRACK0) return(ENXIO); @@ -457,7 +468,7 @@ fdclose(dev, flags, devtype, p) #ifdef FDDEBUG printf("fdclose()\n"); #endif - sc = getsoftc(fdcd, FDUNIT(dev)); + sc = getsoftc(fd_cd, FDUNIT(dev)); s = splbio(); if (sc->flags & FDF_MOTORON) { sc->flags |= FDF_WMOTOROFF; @@ -482,7 +493,7 @@ fdioctl(dev, cmd, addr, flag, p) void *data; int error, wlab; - sc = getsoftc(fdcd, FDUNIT(dev)); + sc = getsoftc(fd_cd, FDUNIT(dev)); if ((sc->flags & FDF_HAVELABEL) == 0) return(EBADF); @@ -581,7 +592,7 @@ fdstrategy(bp) unit = FDUNIT(bp->b_dev); part = FDPART(bp->b_dev); - sc = getsoftc(fdcd, unit); + sc = getsoftc(fd_cd, unit); #ifdef FDDEBUG printf("fdstrategy: 0x%x\n", bp); @@ -690,6 +701,7 @@ fdgetdisklabel(sc, dev) lp->d_partitions[part].p_fstype = FS_UNUSED; lp->d_partitions[part].p_fsize = 1024; lp->d_partitions[part].p_frag = 8; + lp->d_partitions[part].p_cpg = 2; /* for adosfs: reserved blks */ sc->flags |= FDF_HAVELABEL; @@ -731,6 +743,7 @@ nolabel: lp->d_partitions[part].p_fstype = FS_UNUSED; lp->d_partitions[part].p_fsize = 1024; lp->d_partitions[part].p_frag = 8; + lp->d_partitions[part].p_cpg = 2; /* adosfs: reserved blocks */ lp->d_npartitions = part + 1; lp->d_magic = lp->d_magic2 = DISKMAGIC; lp->d_checksum = dkcksum(lp); @@ -1530,11 +1543,11 @@ fdfindwork(unit) for (i = unit + 1; last == 0; i++) { if (i == unit) last = 1; - if (i >= fdcd.cd_ndevs) { + if (i >= fd_cd.cd_ndevs) { i = -1; continue; } - if ((sc = fdcd.cd_devs[i]) == NULL) + if ((sc = fd_cd.cd_devs[i]) == NULL) continue; /* @@ -1579,7 +1592,7 @@ fdminphys(bp) struct fd_softc *sc; int trk, sec, toff, tsz; - if ((sc = getsoftc(fdcd, FDUNIT(bp->b_dev))) == NULL) + if ((sc = getsoftc(fd_cd, FDUNIT(bp->b_dev))) == NULL) panic("fdminphys: couldn't get softc"); trk = bp->b_blkno / sc->nsectors; diff --git a/sys/arch/amiga/dev/flsc.c b/sys/arch/amiga/dev/flsc.c index 6411c79eeda..9da31524678 100644 --- a/sys/arch/amiga/dev/flsc.c +++ b/sys/arch/amiga/dev/flsc.c @@ -1,3 +1,5 @@ +/* $OpenBSD: flsc.c,v 1.2 1996/04/21 22:15:05 deraadt Exp $ */ + /* * Copyright (c) 1995 Daniel Widenfalk * Copyright (c) 1994 Christian E. Hopps @@ -57,7 +59,7 @@ int flscprint __P((void *auxp, char *)); void flscattach __P((struct device *, struct device *, void *)); -int flscmatch __P((struct device *, struct cfdata *, void *)); +int flscmatch __P((struct device *, void *, void *)); struct scsi_adapter flsc_scsiswitch = { sfas_scsicmd, @@ -73,10 +75,13 @@ struct scsi_device flsc_scsidev = { NULL, /* Use default done routine */ }; +struct cfattach flsc_ca = { + sizeof(struct flsc_softc), flscmatch, flscattach +}; -struct cfdriver flsccd = { - NULL, "flsc", (cfmatch_t)flscmatch, flscattach, - DV_DULL, sizeof(struct flsc_softc), NULL, 0 }; +struct cfdriver flsc_cd = { + NULL, "flsc", DV_DULL, NULL, 0 +}; int flsc_intr __P((struct sfas_softc *dev)); int flsc_setup_dma __P((struct sfas_softc *sc, void *ptr, int len, @@ -90,10 +95,9 @@ void flsc_led __P((struct sfas_softc *sc, int mode)); * if we are an Advanced Systems & Software FastlaneZ3 */ int -flscmatch(pdp, cdp, auxp) +flscmatch(pdp, match, auxp) struct device *pdp; - struct cfdata *cdp; - void *auxp; + void *match, *auxp; { struct zbus_args *zap; diff --git a/sys/arch/amiga/dev/grf.c b/sys/arch/amiga/dev/grf.c index ac6c11e24c7..7979bd4de62 100644 --- a/sys/arch/amiga/dev/grf.c +++ b/sys/arch/amiga/dev/grf.c @@ -1,4 +1,5 @@ -/* $NetBSD: grf.c,v 1.23.2.1 1995/10/20 11:01:06 chopps Exp $ */ +/* $OpenBSD: grf.c,v 1.3 1996/04/21 22:15:08 deraadt Exp $ */ +/* $NetBSD: grf.c,v 1.25 1996/03/17 01:17:09 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -97,17 +98,20 @@ int grfbanked_set __P((dev_t, int)); #endif void grfattach __P((struct device *, struct device *, void *)); -int grfmatch __P((struct device *, struct cfdata *, void *)); +int grfmatch __P((struct device *, void *, void *)); int grfprint __P((void *, char *)); /* * pointers to grf drivers device structs */ struct grf_softc *grfsp[NGRF]; +struct cfattach grf_ca = { + sizeof(struct device), grfmatch, grfattach +}; -struct cfdriver grfcd = { - NULL, "grf", (cfmatch_t)grfmatch, grfattach, DV_DULL, - sizeof(struct device), NULL, 0 }; +struct cfdriver grf_cd = { + NULL, "grf", DV_DULL, NULL, 0 +}; /* * only used in console init. @@ -119,11 +123,12 @@ static struct cfdata *cfdata; * low level board driver. */ int -grfmatch(pdp, cfp, auxp) +grfmatch(pdp, match, auxp) struct device *pdp; - struct cfdata *cfp; - void *auxp; + void *match, *auxp; { + struct cfdata *cfp = match; + if (cfp->cf_unit != ((struct grf_softc *)pdp)->g_unit) return(0); cfdata = cfp; diff --git a/sys/arch/amiga/dev/grf_cc.c b/sys/arch/amiga/dev/grf_cc.c index 52ec52d4236..fbf57ad92e3 100644 --- a/sys/arch/amiga/dev/grf_cc.c +++ b/sys/arch/amiga/dev/grf_cc.c @@ -1,4 +1,5 @@ -/* $NetBSD: grf_cc.c,v 1.17 1995/02/16 21:57:34 chopps Exp $ */ +/* $OpenBSD: grf_cc.c,v 1.2 1996/04/21 22:15:09 deraadt Exp $ */ +/* $NetBSD: grf_cc.c,v 1.18 1996/03/17 01:17:10 thorpej Exp $ */ /* * Copyright (c) 1994 Christian E. Hopps @@ -54,14 +55,18 @@ #include <amiga/dev/viewioctl.h> -int grfccmatch __P((struct device *, struct cfdata *, void *)); +int grfccmatch __P((struct device *, void *, void *)); int grfccprint __P((void *, char *)); void grfccattach __P((struct device *, struct device *, void *)); void grf_cc_on __P((struct grf_softc *)); -struct cfdriver grfcccd = { - NULL, "grfcc", (cfmatch_t)grfccmatch, grfccattach, - DV_DULL, sizeof(struct grf_softc), NULL, 0 }; +struct cfattach grfcc_ca = { + sizeof(struct grf_softc), grfccmatch, grfccattach +}; + +struct cfdriver grfcc_cd = { + NULL, "grfcc", DV_DULL, NULL, 0 +}; /* * only used in console init @@ -73,11 +78,11 @@ static struct cfdata *cfdata; * tricky regarding the console. */ int -grfccmatch(pdp, cfp, auxp) +grfccmatch(pdp, match, auxp) struct device *pdp; - struct cfdata *cfp; - void *auxp; + void *match, *auxp; { + struct cfdata *cfp = match; static int ccconunit = -1; char *mainbus_name = auxp; diff --git a/sys/arch/amiga/dev/grf_cl.c b/sys/arch/amiga/dev/grf_cl.c index c1e2910ce3d..16fec232a85 100644 --- a/sys/arch/amiga/dev/grf_cl.c +++ b/sys/arch/amiga/dev/grf_cl.c @@ -1,5 +1,5 @@ -/* $OpenBSD: grf_cl.c,v 1.2 1996/03/30 22:18:13 niklas Exp $ */ -/* $NetBSD: grf_cl.c,v 1.6 1996/03/05 18:08:33 is Exp $ */ +/* $OpenBSD: grf_cl.c,v 1.3 1996/04/21 22:15:10 deraadt Exp $ */ +/* $NetBSD: grf_cl.c,v 1.8 1996/03/17 05:58:35 mhitch Exp $ */ /* * Copyright (c) 1995 Ezra Story @@ -98,7 +98,7 @@ static int cl_blank __P((struct grf_softc * gp, int * on)); void grfclattach __P((struct device *, struct device *, void *)); int grfclprint __P((void *, char *)); -int grfclmatch __P((struct device *, struct cfdata *, void *)); +int grfclmatch __P((struct device *, void *, void *)); void cl_memset __P((unsigned char *d, unsigned char c, int l)); /* Graphics display definitions. @@ -163,18 +163,21 @@ static unsigned char cl_imageptr[8 * 64], cl_maskptr[8 * 64]; static unsigned char cl_sprred[2], cl_sprgreen[2], cl_sprblue[2]; /* standard driver stuff */ -struct cfdriver grfclcd = { - NULL, "grfcl", (cfmatch_t) grfclmatch, grfclattach, - DV_DULL, sizeof(struct grf_softc), NULL, 0 +struct cfattach grfcl_ca = { + sizeof(struct grf_softc), grfclmatch, grfclattach +}; + +struct cfdriver grfcl_cd = { + NULL, "grfcl", DV_DULL, NULL, 0 }; static struct cfdata *cfdata; int -grfclmatch(pdp, cfp, auxp) +grfclmatch(pdp, match, auxp) struct device *pdp; - struct cfdata *cfp; - void *auxp; + void *match, *auxp; { + struct cfdata *cfp = match; struct zbus_args *zap; static int regprod, fbprod; diff --git a/sys/arch/amiga/dev/grf_cv.c b/sys/arch/amiga/dev/grf_cv.c index 685db9513e5..f1114344dc6 100644 --- a/sys/arch/amiga/dev/grf_cv.c +++ b/sys/arch/amiga/dev/grf_cv.c @@ -1,5 +1,5 @@ -/* $OpenBSD: grf_cv.c,v 1.6 1996/03/30 22:18:15 niklas Exp $ */ -/* $NetBSD: grf_cv.c,v 1.9 1996/03/06 16:40:16 is Exp $ */ +/* $OpenBSD: grf_cv.c,v 1.7 1996/04/21 22:15:11 deraadt Exp $ */ +/* $NetBSD: grf_cv.c,v 1.11 1996/03/17 05:58:36 mhitch Exp $ */ /* * Copyright (c) 1995 Michael Teske @@ -64,7 +64,7 @@ #include <amiga/dev/grf_cvreg.h> #include <amiga/dev/zbusvar.h> -int grfcvmatch __P((struct device *, struct cfdata *, void *)); +int grfcvmatch __P((struct device *, void *, void *)); void grfcvattach __P((struct device *, struct device *, void *)); int grfcvprint __P((void *, char *)); @@ -228,9 +228,12 @@ long cv_memclk = 45000000; #endif /* standard driver stuff */ -struct cfdriver grfcvcd = { - NULL, "grfcv", (cfmatch_t)grfcvmatch, grfcvattach, - DV_DULL, sizeof(struct grf_softc), NULL, 0 +struct cfattach grfcv_ca = { + sizeof(struct grf_softc), grfcvmatch, grfcvattach +}; + +struct cfdriver grfcv_cd = { + NULL, "grfcv", DV_DULL, NULL, 0 }; static struct cfdata *cfdata; @@ -270,11 +273,11 @@ cv_has_4mb(fb) } int -grfcvmatch(pdp, cfp, auxp) +grfcvmatch(pdp, match, auxp) struct device *pdp; - struct cfdata *cfp; - void *auxp; + void *match, *auxp; { + struct cfdata *cfp = match; struct zbus_args *zap; static int cvcons_unit = -1; diff --git a/sys/arch/amiga/dev/grf_rh.c b/sys/arch/amiga/dev/grf_rh.c index 3eff16d0a52..0ce33cc0238 100644 --- a/sys/arch/amiga/dev/grf_rh.c +++ b/sys/arch/amiga/dev/grf_rh.c @@ -1,5 +1,5 @@ -/* $OpenBSD: grf_rh.c,v 1.3 1996/03/30 22:18:18 niklas Exp $ */ -/* $NetBSD: grf_rh.c,v 1.11 1996/03/06 20:13:28 is Exp $ */ +/* $OpenBSD: grf_rh.c,v 1.4 1996/04/21 22:15:13 deraadt Exp $ */ +/* $NetBSD: grf_rh.c,v 1.13 1996/03/17 05:58:39 mhitch Exp $ */ /* * Copyright (c) 1994 Markus Wild @@ -1418,21 +1418,24 @@ static struct MonDef *current_mon; int rh_mode __P((struct grf_softc *, int, void *, int, int)); void grfrhattach __P((struct device *, struct device *, void *)); int grfrhprint __P((void *, char *)); -int grfrhmatch __P((struct device *, struct cfdata *, void *)); +int grfrhmatch __P((struct device *, void *, void *)); -struct cfdriver grfrhcd = { - NULL, "grfrh", (cfmatch_t)grfrhmatch, grfrhattach, - DV_DULL, sizeof(struct grf_softc), NULL, 0 +struct cfattach grfrh_ca = { + sizeof(struct grf_softc), grfrhmatch, grfrhattach +}; + +struct cfdriver grfrh_cd = { + NULL, "grfrh", DV_DULL, NULL, 0 }; static struct cfdata *cfdata; int -grfrhmatch(pdp, cfp, auxp) +grfrhmatch(pdp, match, auxp) struct device *pdp; - struct cfdata *cfp; - void *auxp; + void *match, *auxp; { + struct cfdata *cfp = match; #ifdef RETINACONSOLE static int rhconunit = -1; #endif diff --git a/sys/arch/amiga/dev/grf_rt.c b/sys/arch/amiga/dev/grf_rt.c index 4103c6238d8..3fc46f63b83 100644 --- a/sys/arch/amiga/dev/grf_rt.c +++ b/sys/arch/amiga/dev/grf_rt.c @@ -1,4 +1,5 @@ -/* $NetBSD: grf_rt.c,v 1.23 1996/01/28 19:19:12 chopps Exp $ */ +/* $OpenBSD: grf_rt.c,v 1.3 1996/04/21 22:15:15 deraadt Exp $ */ +/* $NetBSD: grf_rt.c,v 1.24 1996/03/17 01:17:18 thorpej Exp $ */ /* * Copyright (c) 1993 Markus Wild @@ -763,11 +764,15 @@ int rt_mode __P((struct grf_softc *, int, void *, int , int)); void grfrtattach __P((struct device *, struct device *, void *)); int grfrtprint __P((void *, char *)); -int grfrtmatch __P((struct device *, struct cfdata *, void *)); +int grfrtmatch __P((struct device *, void *, void *)); + +struct cfattach grfrt_ca = { + sizeof(struct grf_softc), grfrtmatch, grfrtattach +}; -struct cfdriver grfrtcd = { - NULL, "grfrt", (cfmatch_t)grfrtmatch, grfrtattach, - DV_DULL, sizeof(struct grf_softc), NULL, 0 }; +struct cfdriver grfrt_cd = { + NULL, "grfrt", DV_DULL, NULL, 0 +}; /* * only used in console init @@ -779,11 +784,11 @@ static struct cfdata *cfdata; * tricky regarding the console. */ int -grfrtmatch(pdp, cfp, auxp) +grfrtmatch(pdp, match, auxp) struct device *pdp; - struct cfdata *cfp; - void *auxp; + void *match, *auxp; { + struct cfdata *cfp = match; #ifdef RETINACONSOLE static int rtconunit = -1; #endif diff --git a/sys/arch/amiga/dev/grf_ul.c b/sys/arch/amiga/dev/grf_ul.c index 192013fab43..43ddbf1e3fb 100644 --- a/sys/arch/amiga/dev/grf_ul.c +++ b/sys/arch/amiga/dev/grf_ul.c @@ -1,5 +1,5 @@ -/* $OpenBSD: grf_ul.c,v 1.5 1996/03/30 22:18:19 niklas Exp $ */ -/* $NetBSD: grf_ul.c,v 1.12 1996/03/04 19:49:11 is Exp $ */ +/* $OpenBSD: grf_ul.c,v 1.6 1996/04/21 22:15:16 deraadt Exp $ */ +/* $NetBSD: grf_ul.c,v 1.14 1996/03/17 05:58:41 mhitch Exp $ */ #define UL_DEBUG @@ -430,11 +430,15 @@ int ul_mode __P((struct grf_softc *, int, void *, int , int)); void grfulattach __P((struct device *, struct device *, void *)); int grfulprint __P((void *, char *)); -int grfulmatch __P((struct device *, struct cfdata *, void *)); +int grfulmatch __P((struct device *, void *, void *)); -struct cfdriver grfulcd = { - NULL, "grful", (cfmatch_t)grfulmatch, grfulattach, - DV_DULL, sizeof(struct grf_ul_softc), NULL, 0 }; +struct cfattach grful_ca = { + sizeof(struct grf_ul_softc), grfulmatch, grfulattach +}; + +struct cfdriver grful_cd = { + NULL, "grful", DV_DULL, NULL, 0 +}; /* * only used in console init @@ -446,11 +450,11 @@ static struct cfdata *cfdata; * tricky regarding the console. */ int -grfulmatch(pdp, cfp, auxp) +grfulmatch(pdp, match, auxp) struct device *pdp; - struct cfdata *cfp; - void *auxp; + void *match, *auxp; { + struct cfdata *cfp = match; #ifdef ULOWELLCONSOLE static int ulconunit = -1; #endif diff --git a/sys/arch/amiga/dev/gtsc.c b/sys/arch/amiga/dev/gtsc.c index b21d3ad8995..55a3de1b297 100644 --- a/sys/arch/amiga/dev/gtsc.c +++ b/sys/arch/amiga/dev/gtsc.c @@ -1,4 +1,5 @@ -/* $NetBSD: gtsc.c,v 1.13 1995/09/04 13:04:43 chopps Exp $ */ +/* $OpenBSD: gtsc.c,v 1.2 1996/04/21 22:15:17 deraadt Exp $ */ +/* $NetBSD: gtsc.c,v 1.14 1996/03/17 01:17:22 thorpej Exp $ */ /* * Copyright (c) 1994 Christian E. Hopps @@ -53,7 +54,7 @@ #include <amiga/dev/gvpbusvar.h> void gtscattach __P((struct device *, struct device *, void *)); -int gtscmatch __P((struct device *, struct cfdata *, void *)); +int gtscmatch __P((struct device *, void *, void *)); int gtscprint __P((void *auxp, char *)); void gtsc_enintr __P((struct sbic_softc *)); @@ -85,16 +86,20 @@ int gtsc_clock_override = 0; int gtsc_debug = 0; #endif -struct cfdriver gtsccd = { - NULL, "gtsc", (cfmatch_t)gtscmatch, gtscattach, - DV_DULL, sizeof(struct sbic_softc), NULL, 0 }; +struct cfattach gtsc_ca = { + sizeof(struct sbic_softc), gtscmatch, gtscattach +}; + +struct cfdriver gtsc_cd = { + NULL, "gtsc", DV_DULL, NULL, 0 +}; int -gtscmatch(pdp, cdp, auxp) +gtscmatch(pdp, match, auxp) struct device *pdp; - struct cfdata *cdp; - void *auxp; + void *match, *auxp; { + struct cfdata *cdp = match; struct gvpbus_args *gap; gap = auxp; @@ -364,8 +369,8 @@ gtsc_dump() { int i; - for (i = 0; i < gtsccd.cd_ndevs; ++i) - if (gtsccd.cd_devs[i]) - sbic_dump(gtsccd.cd_devs[i]); + for (i = 0; i < gtsc_cd.cd_ndevs; ++i) + if (gtsc_cd.cd_devs[i]) + sbic_dump(gtsc_cd.cd_devs[i]); } #endif diff --git a/sys/arch/amiga/dev/gvpbus.c b/sys/arch/amiga/dev/gvpbus.c index a8105d10899..fded8d442b2 100644 --- a/sys/arch/amiga/dev/gvpbus.c +++ b/sys/arch/amiga/dev/gvpbus.c @@ -1,4 +1,5 @@ -/* $NetBSD: gvpbus.c,v 1.9 1995/08/18 15:27:54 chopps Exp $ */ +/* $OpenBSD: gvpbus.c,v 1.2 1996/04/21 22:15:18 deraadt Exp $ */ +/* $NetBSD: gvpbus.c,v 1.10 1996/03/17 01:17:23 thorpej Exp $ */ /* * Copyright (c) 1994 Christian E. Hopps @@ -36,21 +37,25 @@ #include <amiga/dev/gvpbusvar.h> void gvpbusattach __P((struct device *, struct device *, void *)); -int gvpbusmatch __P((struct device *, struct cfdata *, void *)); +int gvpbusmatch __P((struct device *, void *, void *)); int gvpbusprint __P((void *auxp, char *)); extern int sbic_no_dma; /* Kludge for A1291 - mlh */ -struct cfdriver gvpbuscd = { - NULL, "gvpbus", (cfmatch_t)gvpbusmatch, gvpbusattach, - DV_DULL, sizeof(struct device), NULL, 0 }; +struct cfattach gvpbus_ca = { + sizeof(struct device), gvpbusmatch, gvpbusattach +}; + +struct cfdriver gvpbus_cd = { + NULL, "gvpbus", DV_DULL, NULL, 0 +}; int -gvpbusmatch(pdp, cdp, auxp) +gvpbusmatch(pdp, match, auxp) struct device *pdp; - struct cfdata *cdp; - void *auxp; + void *match, *auxp; { + struct cfdata *cdp = match; struct zbus_args *zap; zap = auxp; diff --git a/sys/arch/amiga/dev/idesc.c b/sys/arch/amiga/dev/idesc.c index d27d5c25043..0d83dd598b6 100644 --- a/sys/arch/amiga/dev/idesc.c +++ b/sys/arch/amiga/dev/idesc.c @@ -1,4 +1,5 @@ -/* $NetBSD: idesc.c,v 1.15 1996/01/07 22:01:53 thorpej Exp $ */ +/* $OpenBSD: idesc.c,v 1.3 1996/04/21 22:15:20 deraadt Exp $ */ +/* $NetBSD: idesc.c,v 1.18 1996/03/24 04:12:27 mhitch Exp $ */ /* * Copyright (c) 1994 Michael L. Hitch @@ -238,7 +239,7 @@ int ide_scsicmd __P((struct scsi_xfer *)); int idescprint __P((void *auxp, char *)); void idescattach __P((struct device *, struct device *, void *)); -int idescmatch __P((struct device *, struct cfdata *, void *)); +int idescmatch __P((struct device *, void *, void *)); int ideicmd __P((struct idec_softc *, int, void *, int, void *, int)); int idego __P((struct idec_softc *, struct scsi_xfer *)); @@ -266,9 +267,13 @@ struct scsi_device idesc_scsidev = { NULL, /* Use default done routine */ }; -struct cfdriver idesccd = { - NULL, "idesc", (cfmatch_t)idescmatch, idescattach, - DV_DULL, sizeof(struct idec_softc), NULL, 0 }; +struct cfattach idesc_ca = { + sizeof(struct idec_softc), idescmatch, idescattach +}; + +struct cfdriver idesc_cd = { + NULL, "idesc", DV_DULL, NULL, 0 +}; struct { short ide_err; @@ -319,10 +324,9 @@ int ide_debug = 0; * if we are an A4000 we are here. */ int -idescmatch(pdp, cdp, auxp) +idescmatch(pdp, match, auxp) struct device *pdp; - struct cfdata *cdp; - void *auxp; + void *match, *auxp; { char *mbusstr; @@ -923,12 +927,8 @@ ideicmd(dev, target, cbuf, clen, buf, len) mdsnbuf->blk_desc.blklen[1] = 512 >> 8; mdsnbuf->pages.rigid_geometry.pg_code = 4; mdsnbuf->pages.rigid_geometry.pg_length = 16; - mdsnbuf->pages.rigid_geometry.ncyl_2 = - ide->sc_params.idep_fixedcyl >> 16; - mdsnbuf->pages.rigid_geometry.ncyl_1 = - ide->sc_params.idep_fixedcyl >> 8; - mdsnbuf->pages.rigid_geometry.ncyl_0 = - ide->sc_params.idep_fixedcyl; + _lto3b(ide->sc_params.idep_fixedcyl, + mdsnbuf->pages.rigid_geometry.ncyl); mdsnbuf->pages.rigid_geometry.nheads = ide->sc_params.idep_heads; dev->sc_stat[0] = 0; @@ -1090,7 +1090,7 @@ idesc_intr(dev) int i; #if 0 - if (idesccd.cd_ndevs == 0 || (dev = idesccd.cd_devs[0]) == NULL) + if (idesc_cd.cd_ndevs == 0 || (dev = idesc_cd.cd_devs[0]) == NULL) return (0); #endif regs = dev->sc_cregs; diff --git a/sys/arch/amiga/dev/if_ae.c b/sys/arch/amiga/dev/if_ae.c index 8fbbddcf533..e9f98cf8503 100644 --- a/sys/arch/amiga/dev/if_ae.c +++ b/sys/arch/amiga/dev/if_ae.c @@ -1,5 +1,5 @@ -/* $OpenBSD: if_ae.c,v 1.3 1996/02/26 21:11:40 niklas Exp $ */ -/* $NetBSD: if_ae.c,v 1.5 1996/02/24 07:47:36 chopps Exp $ */ +/* $OpenBSD: if_ae.c,v 1.4 1996/04/21 22:15:21 deraadt Exp $ */ +/* $NetBSD: if_ae.c,v 1.6 1996/03/17 01:17:28 thorpej Exp $ */ /* * Copyright (c) 1995 Bernd Ernesti and Klaus Burkert. All rights reserved. @@ -150,8 +150,12 @@ struct mbuf *aeget __P((struct ae_softc *,u_char *, int)); int aeioctl __P((struct ifnet *, u_long, caddr_t)); void aesetladrf __P((struct arpcom *, u_int16_t *)); -struct cfdriver aecd = { - NULL, "ae", aematch, aeattach, DV_IFNET, sizeof(struct ae_softc) +struct cfattach ae_ca = { + sizeof(struct ae_softc), aematch, aeattach +}; + +struct cfdriver ae_cd = { + NULL, "ae", DV_IFNET }; int @@ -229,7 +233,7 @@ aeattach(parent, self, aux) splx (s); ifp->if_unit = sc->sc_dev.dv_unit; - ifp->if_name = aecd.cd_name; + ifp->if_name = ae_cd.cd_name; ifp->if_ioctl = aeioctl; ifp->if_watchdog = aewatchdog; ifp->if_output = ether_output; @@ -254,7 +258,7 @@ void aewatchdog(unit) short unit; { - struct ae_softc *sc = aecd.cd_devs[unit]; + struct ae_softc *sc = ae_cd.cd_devs[unit]; log(LOG_ERR, "%s: device timeout\n", sc->sc_dev.dv_xname); ++sc->sc_arpcom.ac_if.if_oerrors; @@ -439,7 +443,7 @@ void aestart(ifp) struct ifnet *ifp; { - register struct ae_softc *sc = aecd.cd_devs[ifp->if_unit]; + register struct ae_softc *sc = ae_cd.cd_devs[ifp->if_unit]; register int bix; register struct aetmd *tmd; register struct mbuf *m; @@ -949,7 +953,7 @@ aeioctl(ifp, cmd, data) u_long cmd; caddr_t data; { - struct ae_softc *sc = aecd.cd_devs[ifp->if_unit]; + struct ae_softc *sc = ae_cd.cd_devs[ifp->if_unit]; struct ifaddr *ifa = (struct ifaddr *)data; struct ifreq *ifr = (struct ifreq *)data; int s, error = 0; diff --git a/sys/arch/amiga/dev/if_bah.c b/sys/arch/amiga/dev/if_bah.c index 1bd0a3fbfda..b3e86d21518 100644 --- a/sys/arch/amiga/dev/if_bah.c +++ b/sys/arch/amiga/dev/if_bah.c @@ -1,4 +1,5 @@ -/* $NetBSD: if_bah.c,v 1.14 1995/12/27 07:51:40 chopps Exp $ */ +/* $OpenBSD: if_bah.c,v 1.4 1996/04/21 22:15:23 deraadt Exp $ */ +/* $NetBSD: if_bah.c,v 1.16 1996/03/20 13:28:50 is Exp $ */ /* * Copyright (c) 1994, 1995 Ignatios Souvatzis @@ -41,6 +42,12 @@ /* #define BAHTIMINGS */ /* #define BAH_DEBUG 3 */ +/* zeroth version of M68060 support */ + +#if defined(M68060) && defined(BAHASMCOPY) +#undef BAHASMCOPY +#endif + #include "bpfilter.h" #include <sys/param.h> @@ -169,8 +176,8 @@ struct bah_softc { #endif }; -int bahmatch __P((struct device *, void *, void *)); -void bahattach __P((struct device *, struct device *, void *)); +int bah_zbus_match __P((struct device *, void *, void *)); +void bah_zbus_attach __P((struct device *, struct device *, void *)); void bah_init __P((struct bah_softc *)); void bah_reset __P((struct bah_softc *)); void bah_stop __P((struct bah_softc *)); @@ -187,12 +194,16 @@ void callstart __P((void *vsc, void *dummy)); int clkread(); #endif -struct cfdriver bahcd = { - NULL, "bah", bahmatch, bahattach, DV_IFNET, sizeof(struct bah_softc) +struct cfattach bah_zbus_ca = { + sizeof(struct bah_softc), bah_zbus_match, bah_zbus_attach +}; + +struct cfdriver bah_cd = { + NULL, "bah", DV_IFNET }; int -bahmatch(parent, match, aux) +bah_zbus_match(parent, match, aux) struct device *parent; void *match, *aux; { @@ -205,7 +216,7 @@ bahmatch(parent, match, aux) } void -bahattach(parent, self, aux) +bah_zbus_attach(parent, self, aux) struct device *parent, *self; void *aux; { @@ -263,7 +274,7 @@ bahattach(parent, self, aux) bah_stop(sc); ifp->if_unit = sc->sc_dev.dv_unit; - ifp->if_name = bahcd.cd_name; + ifp->if_name = bah_cd.cd_name; ifp->if_output = arc_output; ifp->if_start = bah_start; ifp->if_ioctl = bah_ioctl; @@ -530,7 +541,7 @@ bah_start(ifp) u_long copystart, lencopy, perbyte; #endif - sc = bahcd.cd_devs[ifp->if_unit]; + sc = bah_cd.cd_devs[ifp->if_unit]; #if defined(BAH_DEBUG) && (BAH_DEBUG > 3) printf("%s: start(0x%x)\n", sc->sc_dev.dv_xname, ifp); @@ -878,6 +889,8 @@ cleanup: if (head != NULL) m_freem(head); + /* mark buffer as invalid by source id 0 */ + sc->sc_base->buffers[buffer*512*2] = 0; s = splnet(); if (--sc->sc_rx_fillcount == 2 - 1) { @@ -1070,13 +1083,23 @@ bahintr(sc) if (maskedisr & ARC_RI) { #if defined(BAH_DEBUG) && (BAH_DEBUG > 1) - printf("%s: intr: hard rint, act %ld 2:%ld 3:%ld\n", - sc->sc_dev.dv_xname, - sc->sc_rx_act, sc->sc_bufstat[2], sc->sc_bufstat[3]); + printf("%s: intr: hard rint, act %ld\n", + sc->sc_dev.dv_xname, sc->sc_rx_act); #endif buffer = sc->sc_rx_act; - if (++sc->sc_rx_fillcount > 1) { + /* look if buffer is marked invalid: */ + if (sc->sc_base->buffers[buffer*512*2] == 0) { + /* invalid marked buffer (or illegally configured sender) */ + log(LOG_WARNING, + "%s: spurious RX interrupt or sender 0 (ignored)\n", + sc->sc_dev.dv_xname); + /* + * restart receiver on same buffer. + */ + sc->sc_base->command = ARC_RXBC(buffer); + + } else if (++sc->sc_rx_fillcount > 1) { sc->sc_intmask &= ~ARC_RI; sc->sc_base->status = sc->sc_intmask; } else { @@ -1128,7 +1151,7 @@ bah_ioctl(ifp, command, data) int s, error; error = 0; - sc = bahcd.cd_devs[ifp->if_unit]; + sc = bah_cd.cd_devs[ifp->if_unit]; ifa = (struct ifaddr *)data; s = splnet(); @@ -1191,7 +1214,7 @@ bah_ioctl(ifp, command, data) * and the int handler will have to decide not to retransmit (in case * retransmission is implemented). * - * This one assumes being called inside splnet(), and that imp >= ipl2 + * This one assumes being called inside splnet(), and that net >= ipl2 */ void @@ -1201,7 +1224,7 @@ int unit; struct bah_softc *sc; struct ifnet *ifp; - sc = bahcd.cd_devs[unit]; + sc = bah_cd.cd_devs[unit]; ifp = &(sc->sc_arccom.ac_if); sc->sc_base->command = ARC_TXDIS; diff --git a/sys/arch/amiga/dev/if_ed.c b/sys/arch/amiga/dev/if_ed.c index 4052fced067..95ae95e7091 100644 --- a/sys/arch/amiga/dev/if_ed.c +++ b/sys/arch/amiga/dev/if_ed.c @@ -1,4 +1,5 @@ -/* $NetBSD: if_ed.c,v 1.17 1995/12/24 02:29:57 mycroft Exp $ */ +/* $OpenBSD: if_ed.c,v 1.3 1996/04/21 22:15:25 deraadt Exp $ */ +/* $NetBSD: if_ed.c,v 1.19 1996/03/21 21:00:21 is Exp $ */ /* * Device driver for National Semiconductor DS8390/WD83C690 based ethernet @@ -95,8 +96,8 @@ struct ed_softc { u_char next_packet; /* pointer to next unread RX packet */ }; -int edmatch __P((struct device *, void *, void *)); -void edattach __P((struct device *, struct device *, void *)); +int ed_zbus_match __P((struct device *, void *, void *)); +void ed_zbus_attach __P((struct device *, struct device *, void *)); int edintr __P((struct ed_softc *)); int ed_ioctl __P((struct ifnet *, u_long, caddr_t)); void ed_start __P((struct ifnet *)); @@ -115,8 +116,12 @@ static inline void ed_xmit __P((struct ed_softc *)); static inline caddr_t ed_ring_copy __P((/* struct ed_softc *, caddr_t, caddr_t, u_short */)); -struct cfdriver edcd = { - NULL, "ed", edmatch, edattach, DV_IFNET, sizeof(struct ed_softc) +struct cfattach ed_zbus_ca = { + sizeof(struct ed_softc), ed_zbus_match, ed_zbus_attach +}; + +struct cfdriver ed_cd = { + NULL, "ed", DV_IFNET }; #define ETHER_MIN_LEN 64 @@ -176,7 +181,7 @@ word_copy(a, b, len) } int -edmatch(parent, match, aux) +ed_zbus_match(parent, match, aux) struct device *parent; void *match, *aux; { @@ -190,7 +195,7 @@ edmatch(parent, match, aux) } void -edattach(parent, self, aux) +ed_zbus_attach(parent, self, aux) struct device *parent, *self; void *aux; { @@ -234,6 +239,14 @@ edattach(parent, self, aux) sc->mem_start + ((sc->txb_cnt * ED_TXBUF_SIZE) << ED_PAGE_SHIFT); /* + * Interupts must be inactive when reading the prom, as the interupt + * line is shared with one of its address lines. + */ + + NIC_PUT(sc, ED_P0_IMR, 0x00); /* disable ints */ + NIC_PUT(sc, ED_P0_ISR, 0xff); /* clear ints */ + + /* * read the ethernet address from the board */ for (i = 0; i < ETHER_ADDR_LEN; i++) @@ -244,7 +257,7 @@ edattach(parent, self, aux) /* Initialize ifnet structure. */ ifp->if_unit = sc->sc_dev.dv_unit; - ifp->if_name = edcd.cd_name; + ifp->if_name = ed_cd.cd_name; ifp->if_start = ed_start; ifp->if_ioctl = ed_ioctl; ifp->if_watchdog = ed_watchdog; @@ -312,7 +325,7 @@ void ed_watchdog(unit) short unit; { - struct ed_softc *sc = edcd.cd_devs[unit]; + struct ed_softc *sc = ed_cd.cd_devs[unit]; log(LOG_ERR, "%s: device timeout\n", sc->sc_dev.dv_xname); ++sc->sc_arpcom.ac_if.if_oerrors; @@ -486,7 +499,7 @@ void ed_start(ifp) struct ifnet *ifp; { - struct ed_softc *sc = edcd.cd_devs[ifp->if_unit]; + struct ed_softc *sc = ed_cd.cd_devs[ifp->if_unit]; struct mbuf *m0, *m; caddr_t buffer; int len; @@ -845,7 +858,7 @@ ed_ioctl(ifp, command, data) u_long command; caddr_t data; { - struct ed_softc *sc = edcd.cd_devs[ifp->if_unit]; + struct ed_softc *sc = ed_cd.cd_devs[ifp->if_unit]; register struct ifaddr *ifa = (struct ifaddr *)data; struct ifreq *ifr = (struct ifreq *)data; int s, error = 0; diff --git a/sys/arch/amiga/dev/if_es.c b/sys/arch/amiga/dev/if_es.c index a7ce3b227a8..078430b9f5c 100644 --- a/sys/arch/amiga/dev/if_es.c +++ b/sys/arch/amiga/dev/if_es.c @@ -1,4 +1,5 @@ -/* $NetBSD: if_es.c,v 1.8 1995/12/24 02:29:59 mycroft Exp $ */ +/* $OpenBSD: if_es.c,v 1.3 1996/04/21 22:15:26 deraadt Exp $ */ +/* $NetBSD: if_es.c,v 1.10 1996/03/17 05:58:45 mhitch Exp $ */ /* * Copyright (c) 1995 Michael L. Hitch @@ -124,8 +125,12 @@ void esreset __P((struct es_softc *)); int esmatch __P((struct device *, void *, void *)); void esattach __P((struct device *, struct device *, void *)); -struct cfdriver escd = { - NULL, "es", esmatch, esattach, DV_IFNET, sizeof(struct es_softc) +struct cfattach es_ca = { + sizeof(struct es_softc), esmatch, esattach +}; + +struct cfdriver es_cd = { + NULL, "es", DV_IFNET }; int @@ -187,7 +192,7 @@ esattach(parent, self, aux) /* Initialize ifnet structure. */ ifp->if_unit = sc->sc_dev.dv_unit; - ifp->if_name = escd.cd_name; + ifp->if_name = es_cd.cd_name; ifp->if_output = ether_output; ifp->if_ioctl = esioctl; ifp->if_start = esstart; @@ -750,7 +755,7 @@ void esstart(ifp) struct ifnet *ifp; { - struct es_softc *sc = escd.cd_devs[ifp->if_unit]; + struct es_softc *sc = es_cd.cd_devs[ifp->if_unit]; union smcregs *smc = sc->sc_base; struct mbuf *m0, *m; #ifdef USEPKTBUF @@ -929,7 +934,7 @@ esioctl(ifp, command, data) u_long command; caddr_t data; { - struct es_softc *sc = escd.cd_devs[ifp->if_unit]; + struct es_softc *sc = es_cd.cd_devs[ifp->if_unit]; register struct ifaddr *ifa = (struct ifaddr *)data; struct ifreq *ifr = (struct ifreq *)data; int s, error = 0; @@ -1045,7 +1050,7 @@ void eswatchdog(unit) int unit; { - struct es_softc *sc = escd.cd_devs[unit]; + struct es_softc *sc = es_cd.cd_devs[unit]; log(LOG_ERR, "%s: device timeout\n", sc->sc_dev.dv_xname); ++sc->sc_arpcom.ac_if.if_oerrors; diff --git a/sys/arch/amiga/dev/if_le.c b/sys/arch/amiga/dev/if_le.c index 4979dd60ddd..f4c4bf5fe8a 100644 --- a/sys/arch/amiga/dev/if_le.c +++ b/sys/arch/amiga/dev/if_le.c @@ -1,4 +1,5 @@ -/* $NetBSD: if_le.c,v 1.16 1995/12/27 07:09:37 chopps Exp $ */ +/* $OpenBSD: if_le.c,v 1.3 1996/04/21 22:15:28 deraadt Exp $ */ +/* $NetBSD: if_le.c,v 1.17 1996/03/17 01:17:35 thorpej Exp $ */ /*- * Copyright (c) 1995 Charles M. Hannum. All rights reserved. @@ -69,15 +70,19 @@ /* offsets for: ID, REGS, MEM */ int lestd[] = { 0, 0x4000, 0x8000 }; -#define LE_SOFTC(unit) lecd.cd_devs[unit] +#define LE_SOFTC(unit) le_cd.cd_devs[unit] #define LE_DELAY(x) DELAY(x) -int lematch __P((struct device *, void *, void *)); -void leattach __P((struct device *, struct device *, void *)); +int le_zbus_match __P((struct device *, void *, void *)); +void le_zbus_attach __P((struct device *, struct device *, void *)); int leintr __P((void *)); -struct cfdriver lecd = { - NULL, "le", lematch, leattach, DV_IFNET, sizeof(struct le_softc) +struct cfattach le_zbus_ca = { + sizeof(struct le_softc), le_zbus_match, le_zbus_attach +}; + +struct cfdriver le_cd = { + NULL, "le", DV_IFNET }; integrate void @@ -105,7 +110,7 @@ lerdcsr(sc, port) } int -lematch(parent, match, aux) +le_zbus_match(parent, match, aux) struct device *parent; void *match, *aux; { @@ -123,7 +128,7 @@ lematch(parent, match, aux) } void -leattach(parent, self, aux) +le_zbus_attach(parent, self, aux) struct device *parent, *self; void *aux; { @@ -177,7 +182,7 @@ leattach(parent, self, aux) sc->sc_arpcom.ac_enaddr[4] = (ser >> 8) & 0xff; sc->sc_arpcom.ac_enaddr[5] = (ser ) & 0xff; - sc->sc_arpcom.ac_if.if_name = lecd.cd_name; + sc->sc_arpcom.ac_if.if_name = le_cd.cd_name; leconfig(sc); sc->sc_isr.isr_intr = leintr; diff --git a/sys/arch/amiga/dev/if_le_zbus.c b/sys/arch/amiga/dev/if_le_zbus.c index 4979dd60ddd..75a0c5b694a 100644 --- a/sys/arch/amiga/dev/if_le_zbus.c +++ b/sys/arch/amiga/dev/if_le_zbus.c @@ -1,4 +1,5 @@ -/* $NetBSD: if_le.c,v 1.16 1995/12/27 07:09:37 chopps Exp $ */ +/* $OpenBSD: if_le_zbus.c,v 1.3 1996/04/21 22:15:28 deraadt Exp $ */ +/* $NetBSD: if_le.c,v 1.17 1996/03/17 01:17:35 thorpej Exp $ */ /*- * Copyright (c) 1995 Charles M. Hannum. All rights reserved. @@ -69,15 +70,19 @@ /* offsets for: ID, REGS, MEM */ int lestd[] = { 0, 0x4000, 0x8000 }; -#define LE_SOFTC(unit) lecd.cd_devs[unit] +#define LE_SOFTC(unit) le_cd.cd_devs[unit] #define LE_DELAY(x) DELAY(x) -int lematch __P((struct device *, void *, void *)); -void leattach __P((struct device *, struct device *, void *)); +int le_zbus_match __P((struct device *, void *, void *)); +void le_zbus_attach __P((struct device *, struct device *, void *)); int leintr __P((void *)); -struct cfdriver lecd = { - NULL, "le", lematch, leattach, DV_IFNET, sizeof(struct le_softc) +struct cfattach le_zbus_ca = { + sizeof(struct le_softc), le_zbus_match, le_zbus_attach +}; + +struct cfdriver le_cd = { + NULL, "le", DV_IFNET }; integrate void @@ -105,7 +110,7 @@ lerdcsr(sc, port) } int -lematch(parent, match, aux) +le_zbus_match(parent, match, aux) struct device *parent; void *match, *aux; { @@ -123,7 +128,7 @@ lematch(parent, match, aux) } void -leattach(parent, self, aux) +le_zbus_attach(parent, self, aux) struct device *parent, *self; void *aux; { @@ -177,7 +182,7 @@ leattach(parent, self, aux) sc->sc_arpcom.ac_enaddr[4] = (ser >> 8) & 0xff; sc->sc_arpcom.ac_enaddr[5] = (ser ) & 0xff; - sc->sc_arpcom.ac_if.if_name = lecd.cd_name; + sc->sc_arpcom.ac_if.if_name = le_cd.cd_name; leconfig(sc); sc->sc_isr.isr_intr = leintr; diff --git a/sys/arch/amiga/dev/if_qn.c b/sys/arch/amiga/dev/if_qn.c index 4a046032627..7f40c0fb277 100644 --- a/sys/arch/amiga/dev/if_qn.c +++ b/sys/arch/amiga/dev/if_qn.c @@ -1,4 +1,5 @@ -/* $NetBSD: if_qn.c,v 1.3 1995/12/24 02:30:02 mycroft Exp $ */ +/* $OpenBSD: if_qn.c,v 1.4 1996/04/21 22:15:29 deraadt Exp $ */ +/* $NetBSD: if_qn.c,v 1.4 1996/03/17 01:17:37 thorpej Exp $ */ /* * Copyright (c) 1995 Mika Kortelainen @@ -171,8 +172,12 @@ static void qn_flush __P((struct qn_softc *)); static void qn_dump __P((struct qn_softc *)); #endif -struct cfdriver qncd = { - NULL, "qn", qnmatch, qnattach, DV_IFNET, sizeof(struct qn_softc) +struct cfattach qn_ca = { + sizeof(struct qn_softc), qnmatch, qnattach +}; + +struct cfdriver qn_cd = { + NULL, "qn", DV_IFNET }; @@ -237,7 +242,7 @@ qnattach(parent, self, aux) qnstop(sc); ifp->if_unit = sc->sc_dev.dv_unit; - ifp->if_name = qncd.cd_name; + ifp->if_name = qn_cd.cd_name; ifp->if_ioctl = qnioctl; ifp->if_watchdog = qnwatchdog; ifp->if_output = ether_output; @@ -319,7 +324,7 @@ void qnwatchdog(unit) int unit; { - struct qn_softc *sc = qncd.cd_devs[unit]; + struct qn_softc *sc = qn_cd.cd_devs[unit]; log(LOG_INFO, "qn: device timeout (watchdog)\n"); ++sc->sc_arpcom.ac_if.if_oerrors; @@ -402,7 +407,7 @@ void qnstart(ifp) struct ifnet *ifp; { - struct qn_softc *sc = qncd.cd_devs[ifp->if_unit]; + struct qn_softc *sc = qn_cd.cd_devs[ifp->if_unit]; struct mbuf *m; u_short len; int timout = 60000; @@ -859,7 +864,7 @@ qnioctl(ifp, command, data) u_long command; caddr_t data; { - struct qn_softc *sc = qncd.cd_devs[ifp->if_unit]; + struct qn_softc *sc = qn_cd.cd_devs[ifp->if_unit]; register struct ifaddr *ifa = (struct ifaddr *)data; #if 0 struct ifreg *ifr = (struct ifreg *)data; diff --git a/sys/arch/amiga/dev/ite.c b/sys/arch/amiga/dev/ite.c index 6f4f812ea16..4293975c9b2 100644 --- a/sys/arch/amiga/dev/ite.c +++ b/sys/arch/amiga/dev/ite.c @@ -1,5 +1,5 @@ -/* $OpenBSD: ite.c,v 1.4 1996/03/30 22:18:20 niklas Exp $ */ -/* $NetBSD: ite.c,v 1.36 1996/03/16 08:19:43 mhitch Exp $ */ +/* $OpenBSD: ite.c,v 1.5 1996/04/21 22:15:30 deraadt Exp $ */ +/* $NetBSD: ite.c,v 1.38 1996/03/17 05:58:48 mhitch Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -115,21 +115,24 @@ static void ite_sifilter __P((void *, void *)); void iteputchar __P((int c, struct ite_softc *ip)); void ite_putstr __P((const char * s, int len, dev_t dev)); void iteattach __P((struct device *, struct device *, void *)); -int itematch __P((struct device *, struct cfdata *, void *)); +int itematch __P((struct device *, void *, void *)); static void iteprecheckwrap __P((struct ite_softc *)); static void itecheckwrap __P((struct ite_softc *)); +struct cfattach ite_ca = { + sizeof(struct ite_softc), itematch, iteattach +}; -struct cfdriver itecd = { - NULL, "ite", (cfmatch_t)itematch, iteattach, DV_DULL, - sizeof(struct ite_softc), NULL, 0 }; +struct cfdriver ite_cd = { + NULL, "ite", DV_DULL, NULL, 0 +}; int -itematch(pdp, cdp, auxp) +itematch(pdp, match, auxp) struct device *pdp; - struct cfdata *cdp; - void *auxp; + void *match, *auxp; { + struct cfdata *cdp = match; struct grf_softc *gp; int maj; @@ -212,7 +215,7 @@ getitesp(dev) dev_t dev; { if (amiga_realconfig && con_itesoftc.grf == NULL) - return(itecd.cd_devs[ITEUNIT(dev)]); + return(ite_cd.cd_devs[ITEUNIT(dev)]); if (con_itesoftc.grf == NULL) panic("no ite_softc for console"); diff --git a/sys/arch/amiga/dev/ivsc.c b/sys/arch/amiga/dev/ivsc.c index e447ce0e5ef..8e816465f9c 100644 --- a/sys/arch/amiga/dev/ivsc.c +++ b/sys/arch/amiga/dev/ivsc.c @@ -1,4 +1,5 @@ -/* $NetBSD: ivsc.c,v 1.12 1995/08/18 15:28:00 chopps Exp $ */ +/* $OpenBSD: ivsc.c,v 1.2 1996/04/21 22:15:32 deraadt Exp $ */ +/* $NetBSD: ivsc.c,v 1.14 1996/03/28 19:23:34 is Exp $ */ /* * Copyright (c) 1994 Michael L. Hitch @@ -50,7 +51,7 @@ int ivscprint __P((void *auxp, char *)); void ivscattach __P((struct device *, struct device *, void *)); -int ivscmatch __P((struct device *, struct cfdata *, void *)); +int ivscmatch __P((struct device *, void *, void *)); int ivsc_intr __P((struct sci_softc *)); int ivsc_dma_xfer_in __P((struct sci_softc *dev, int len, @@ -82,18 +83,21 @@ extern int sci_data_wait; int ivsdma_pseudo = 1; /* 0=off, 1=on */ -struct cfdriver ivsccd = { - NULL, "ivsc", (cfmatch_t)ivscmatch, ivscattach, - DV_DULL, sizeof(struct sci_softc), NULL, 0 }; +struct cfattach ivsc_ca = { + sizeof(struct sci_softc), ivscmatch, ivscattach +}; + +struct cfdriver ivsc_cd = { + NULL, "ivsc", DV_DULL, NULL, 0 +}; /* * if this is an IVS board */ int -ivscmatch(pdp, cdp, auxp) +ivscmatch(pdp, match, auxp) struct device *pdp; - struct cfdata *cdp; - void *auxp; + void *match, *auxp; { struct zbus_args *zap; @@ -324,4 +328,6 @@ ivsc_intr(dev) if ((*dev->sci_csr & SCI_CSR_INT) == 0) return(0); stat = *dev->sci_iack; + /* XXXX is: something is missing here, at least a: */ + return(1); } diff --git a/sys/arch/amiga/dev/kbd.c b/sys/arch/amiga/dev/kbd.c index 55d668baf9e..3d031f9f972 100644 --- a/sys/arch/amiga/dev/kbd.c +++ b/sys/arch/amiga/dev/kbd.c @@ -1,4 +1,5 @@ -/* $NetBSD: kbd.c,v 1.15 1995/05/07 15:37:11 chopps Exp $ */ +/* $OpenBSD: kbd.c,v 1.2 1996/04/21 22:15:33 deraadt Exp $ */ +/* $NetBSD: kbd.c,v 1.17 1996/03/17 05:58:50 mhitch Exp $ */ /* * Copyright (c) 1982, 1986, 1990 The Regents of the University of California. @@ -61,20 +62,25 @@ struct kbd_softc { }; struct kbd_softc kbd_softc; +int kbdmatch __P((struct device *, void *, void *)); void kbdattach __P((struct device *, struct device *, void *)); -int kbdmatch __P((struct device *, struct cfdata *, void *)); -struct cfdriver kbdcd = { - NULL, "kbd", (cfmatch_t)kbdmatch, kbdattach, DV_DULL, - sizeof(struct device), NULL, 0 }; +struct cfattach kbd_ca = { + sizeof(struct device), kbdmatch, kbdattach +}; + +struct cfdriver kbd_cd = { + NULL, "kbd", DV_DULL, NULL, 0 +}; /*ARGSUSED*/ int -kbdmatch(pdp, cfp, auxp) +kbdmatch(pdp, match, auxp) struct device *pdp; - struct cfdata *cfp; - void *auxp; + void *match, *auxp; { + struct cfdata *cfp = match; + if (matchname((char *)auxp, "kbd")) return(1); return(0); diff --git a/sys/arch/amiga/dev/mfc.c b/sys/arch/amiga/dev/mfc.c index f9f4a037e87..d519a9f0c1c 100644 --- a/sys/arch/amiga/dev/mfc.c +++ b/sys/arch/amiga/dev/mfc.c @@ -1,4 +1,5 @@ -/* $NetBSD: mfc.c,v 1.8.2.1 1995/10/20 11:01:12 chopps Exp $ */ +/* $OpenBSD: mfc.c,v 1.5 1996/04/21 22:15:34 deraadt Exp $ */ +/* $NetBSD: mfc.c,v 1.11 1996/03/17 05:58:52 mhitch Exp $ */ /* * Copyright (c) 1994 Michael L. Hitch @@ -180,32 +181,44 @@ struct mfc_args { int mfcprint __P((void *auxp, char *)); void mfcattach __P((struct device *, struct device *, void *)); -int mfcmatch __P((struct device *, struct cfdata *, void *)); +int mfcmatch __P((struct device *, void *, void *)); #if NMFCS > 0 void mfcsattach __P((struct device *, struct device *, void *)); -int mfcsmatch __P((struct device *, struct cfdata *, void *)); +int mfcsmatch __P((struct device *, void *, void *)); #endif #if NMFCP > 0 void mfcpattach __P((struct device *, struct device *, void *)); -int mfcpmatch __P((struct device *, struct cfdata *, void *)); +int mfcpmatch __P((struct device *, void *, void *)); #endif int mfcintr __P((struct mfc_softc *)); void mfcsmint __P((register int unit)); -struct cfdriver mfccd = { - NULL, "mfc", (cfmatch_t) mfcmatch, mfcattach, - DV_DULL, sizeof(struct mfc_softc), NULL, 0 }; +struct cfattach mfc_ca = { + sizeof(struct mfc_softc), mfcmatch, mfcattach +}; + +struct cfdriver mfc_cd = { + NULL, "mfc", DV_DULL, NULL, 0 +}; #if NMFCS > 0 -struct cfdriver mfcscd = { - NULL, "mfcs", (cfmatch_t) mfcsmatch, mfcsattach, - DV_TTY, sizeof(struct mfcs_softc), NULL, 0 }; +struct cfattach mfcs_ca = { + sizeof(struct mfcs_softc), mfcsmatch, mfcsattach +}; + +struct cfdriver mfcs_cd = { + NULL, "mfcs", DV_TTY, NULL, 0 +}; #endif #if NMFCP > 0 -struct cfdriver mfcpcd = { - NULL, "mfcp", (cfmatch_t) mfcpmatch, mfcpattach, - DV_DULL, sizeof(struct mfcp_softc), NULL, 0 }; +struct cfattach mfcp_ca = { + sizeof(struct mfcp_softc, mfcpmatch, mfcpattach +}; + +struct cfdriver mfcp_cd = { + NULL, "mfcp", DV_DULL, NULL, 0 +}; #endif int mfcsstart(), mfcsparam(), mfcshwiflow(); @@ -299,11 +312,11 @@ struct speedtab mfcs2speedtab2[] = { * if we are an bsc/Alf Data MultFaceCard (I, II, and III) */ int -mfcmatch(pdp, cdp, auxp) +mfcmatch(pdp, match, auxp) struct device *pdp; - struct cfdata *cdp; - void *auxp; + void *match, *auxp; { + struct cfdata *cdp = match; struct zbus_args *zap; zap = auxp; @@ -384,11 +397,11 @@ mfcattach(pdp, dp, auxp) * */ int -mfcsmatch(pdp, cdp, auxp) +mfcsmatch(pdp, match, auxp) struct device *pdp; - struct cfdata *cdp; - void *auxp; + void *match, *auxp; { + struct cfdata *cdp = match; struct mfc_args *ma; ma = auxp; @@ -459,9 +472,9 @@ mfcsopen(dev, flag, mode, p) error = 0; unit = dev & 0x1f; - if (unit >= mfcscd.cd_ndevs || (mfcs_active & (1 << unit)) == 0) + if (unit >= mfcs_cd.cd_ndevs || (mfcs_active & (1 << unit)) == 0) return (ENXIO); - sc = mfcscd.cd_devs[unit]; + sc = mfcs_cd.cd_devs[unit]; s = spltty(); @@ -554,7 +567,7 @@ mfcsclose(dev, flag, mode, p) { struct tty *tp; int unit; - struct mfcs_softc *sc = mfcscd.cd_devs[dev & 31]; + struct mfcs_softc *sc = mfcs_cd.cd_devs[dev & 31]; struct mfc_softc *scc= sc->sc_mfc; unit = dev & 31; @@ -596,7 +609,7 @@ mfcsread(dev, uio, flag) struct uio *uio; int flag; { - struct mfcs_softc *sc = mfcscd.cd_devs[dev & 31]; + struct mfcs_softc *sc = mfcs_cd.cd_devs[dev & 31]; struct tty *tp = sc->sc_tty; if (tp == NULL) return(ENXIO); @@ -609,7 +622,7 @@ mfcswrite(dev, uio, flag) struct uio *uio; int flag; { - struct mfcs_softc *sc = mfcscd.cd_devs[dev & 31]; + struct mfcs_softc *sc = mfcs_cd.cd_devs[dev & 31]; struct tty *tp = sc->sc_tty; if (tp == NULL) @@ -621,7 +634,7 @@ struct tty * mfcstty(dev) dev_t dev; { - struct mfcs_softc *sc = mfcscd.cd_devs[dev & 31]; + struct mfcs_softc *sc = mfcs_cd.cd_devs[dev & 31]; return (sc->sc_tty); } @@ -635,7 +648,7 @@ mfcsioctl(dev, cmd, data, flag, p) register struct tty *tp; register int unit = dev & 31; register int error; - struct mfcs_softc *sc = mfcscd.cd_devs[dev & 31]; + struct mfcs_softc *sc = mfcs_cd.cd_devs[dev & 31]; tp = sc->sc_tty; if (!tp) @@ -707,7 +720,7 @@ mfcsparam(tp, t) struct termios *t; { int cfcr, cflag, unit, ospeed; - struct mfcs_softc *sc = mfcscd.cd_devs[tp->t_dev & 31]; + struct mfcs_softc *sc = mfcs_cd.cd_devs[tp->t_dev & 31]; struct mfc_softc *scc= sc->sc_mfc; cflag = t->c_cflag; @@ -775,7 +788,7 @@ int mfcshwiflow(tp, flag) struct tty *tp; int flag; { - struct mfcs_softc *sc = mfcscd.cd_devs[tp->t_dev & 31]; + struct mfcs_softc *sc = mfcs_cd.cd_devs[tp->t_dev & 31]; int unit = tp->t_dev & 1; if (flag) @@ -790,7 +803,7 @@ mfcsstart(tp) struct tty *tp; { int cc, s, unit; - struct mfcs_softc *sc = mfcscd.cd_devs[tp->t_dev & 31]; + struct mfcs_softc *sc = mfcs_cd.cd_devs[tp->t_dev & 31]; struct mfc_softc *scc= sc->sc_mfc; if ((tp->t_state & TS_ISOPEN) == 0) @@ -871,7 +884,7 @@ mfcsmctl(dev, bits, how) { int unit, s; u_char ub; - struct mfcs_softc *sc = mfcscd.cd_devs[dev & 31]; + struct mfcs_softc *sc = mfcs_cd.cd_devs[dev & 31]; unit = dev & 1; @@ -947,7 +960,7 @@ mfcintr (scc) return (0); unit = scc->sc_dev.dv_unit * 2; if (istat & 0x02) { /* channel A receive interrupt */ - sc = mfcscd.cd_devs[unit]; + sc = mfcs_cd.cd_devs[unit]; while (1) { c = regs->du_sra << 8; if ((c & 0x0100) == 0) @@ -968,7 +981,7 @@ mfcintr (scc) } } if (istat & 0x20) { /* channel B receive interrupt */ - sc = mfcscd.cd_devs[unit + 1]; + sc = mfcs_cd.cd_devs[unit + 1]; while (1) { c = regs->du_srb << 8; if ((c & 0x0100) == 0) @@ -989,7 +1002,7 @@ mfcintr (scc) } } if (istat & 0x01) { /* channel A transmit interrupt */ - sc = mfcscd.cd_devs[unit]; + sc = mfcs_cd.cd_devs[unit]; tp = sc->sc_tty; if (sc->ptr == sc->end) { tp->t_state &= ~(TS_BUSY | TS_FLUSH); @@ -1010,7 +1023,7 @@ mfcintr (scc) regs->du_tba = *sc->ptr++; } if (istat & 0x10) { /* channel B transmit interrupt */ - sc = mfcscd.cd_devs[unit + 1]; + sc = mfcs_cd.cd_devs[unit + 1]; tp = sc->sc_tty; if (sc->ptr == sc->end) { tp->t_state &= ~(TS_BUSY | TS_FLUSH); @@ -1042,7 +1055,7 @@ mfcsxintr(unit) int unit; { int s1, s2, ovfl; - struct mfcs_softc *sc = mfcscd.cd_devs[unit]; + struct mfcs_softc *sc = mfcs_cd.cd_devs[unit]; struct tty *tp = sc->sc_tty; /* @@ -1086,7 +1099,7 @@ int mfcseint(unit, stat) int unit, stat; { - struct mfcs_softc *sc = mfcscd.cd_devs[unit]; + struct mfcs_softc *sc = mfcs_cd.cd_devs[unit]; struct tty *tp; u_char ch; int c; @@ -1114,7 +1127,7 @@ mfcseint(unit, stat) if (stat & 0x1000) log(LOG_WARNING, "%s: fifo overflow\n", - ((struct mfcs_softc *)mfcscd.cd_devs[unit])->sc_dev.dv_xname); + ((struct mfcs_softc *)mfcs_cd.cd_devs[unit])->sc_dev.dv_xname); (*linesw[tp->t_line].l_rint)(c, tp); } @@ -1130,7 +1143,7 @@ mfcsmint(unit) int unit; { struct tty *tp; - struct mfcs_softc *sc = mfcscd.cd_devs[unit]; + struct mfcs_softc *sc = mfcs_cd.cd_devs[unit]; u_char stat, last, istat; tp = sc->sc_tty; diff --git a/sys/arch/amiga/dev/mgnsc.c b/sys/arch/amiga/dev/mgnsc.c index e513d8f48d3..6342d2f0fef 100644 --- a/sys/arch/amiga/dev/mgnsc.c +++ b/sys/arch/amiga/dev/mgnsc.c @@ -1,5 +1,5 @@ -/* $OpenBSD: mgnsc.c,v 1.4 1996/03/30 22:18:22 niklas Exp $ */ -/* $NetBSD: mgnsc.c,v 1.16 1996/03/15 22:11:12 mhitch Exp $ */ +/* $OpenBSD: mgnsc.c,v 1.5 1996/04/21 22:15:36 deraadt Exp $ */ +/* $NetBSD: mgnsc.c,v 1.17 1996/03/17 01:17:45 thorpej Exp $ */ /* * Copyright (c) 1994 Michael L. Hitch @@ -54,7 +54,7 @@ int mgnscprint __P((void *auxp, char *)); void mgnscattach __P((struct device *, struct device *, void *)); -int mgnscmatch __P((struct device *, struct cfdata *, void *)); +int mgnscmatch __P((struct device *, void *, void *)); int siopintr __P((struct siop_softc *)); int mgnsc_dmaintr __P((struct siop_softc *)); @@ -76,19 +76,23 @@ struct scsi_device mgnsc_scsidev = { #ifdef DEBUG #endif -struct cfdriver mgnsccd = { - NULL, "mgnsc", (cfmatch_t)mgnscmatch, mgnscattach, - DV_DULL, sizeof(struct siop_softc), NULL, 0 }; +struct cfattach mgnsc_ca = { + sizeof(struct siop_softc), mgnscmatch, mgnscattach +}; + +struct cfdriver mgnsc_cd = { + NULL, "mgnsc", DV_DULL, NULL, 0 +}; /* * if we are a CSA Magnum 40 SCSI */ int -mgnscmatch(pdp, cdp, auxp) +mgnscmatch(pdp, match, auxp) struct device *pdp; - struct cfdata *cdp; - void *auxp; + void *match, *auxp; { + struct cfdata *cdp = match; struct zbus_args *zap; zap = auxp; @@ -204,8 +208,8 @@ mgnsc_dump() { int i; - for (i = 0; i < mgnsccd.cd_ndevs; ++i) - if (mgnsccd.cd_devs[i]) - siop_dump(mgnsccd.cd_devs[i]); + for (i = 0; i < mgnsc_cd.cd_ndevs; ++i) + if (mgnsc_cd.cd_devs[i]) + siop_dump(mgnsc_cd.cd_devs[i]); } #endif diff --git a/sys/arch/amiga/dev/mlhsc.c b/sys/arch/amiga/dev/mlhsc.c index 269d2e22dc6..a46a1c80669 100644 --- a/sys/arch/amiga/dev/mlhsc.c +++ b/sys/arch/amiga/dev/mlhsc.c @@ -1,4 +1,5 @@ -/* $NetBSD: mlhsc.c,v 1.8 1995/02/12 19:19:18 chopps Exp $ */ +/* $OpenBSD: mlhsc.c,v 1.2 1996/04/21 22:15:38 deraadt Exp $ */ +/* $NetBSD: mlhsc.c,v 1.9 1996/03/17 01:17:46 thorpej Exp $ */ /* * Copyright (c) 1994 Michael L. Hitch @@ -49,7 +50,7 @@ int mlhscprint __P((void *auxp, char *)); void mlhscattach __P((struct device *, struct device *, void *)); -int mlhscmatch __P((struct device *, struct cfdata *, void *)); +int mlhscmatch __P((struct device *, void *, void *)); int mlhsc_dma_xfer_in __P((struct sci_softc *dev, int len, register u_char *buf, int phase)); @@ -78,18 +79,21 @@ extern int sci_debug; extern int sci_data_wait; -struct cfdriver mlhsccd = { - NULL, "mlhsc", (cfmatch_t)mlhscmatch, mlhscattach, - DV_DULL, sizeof(struct sci_softc), NULL, 0 }; +struct cfattach mlhsc_ca = { + sizeof(struct sci_softc), mlhscmatch, mlhscattach +}; + +struct cfdriver mlhsc_cd = { + NULL, "mlhsc", DV_DULL, NULL, 0 +}; /* * if we are my Hacker's SCSI board we are here. */ int -mlhscmatch(pdp, cdp, auxp) +mlhscmatch(pdp, match, auxp) struct device *pdp; - struct cfdata *cdp; - void *auxp; + void *match, *auxp; { struct zbus_args *zap; diff --git a/sys/arch/amiga/dev/msc.c b/sys/arch/amiga/dev/msc.c index 0020893280d..fa93d077c83 100644 --- a/sys/arch/amiga/dev/msc.c +++ b/sys/arch/amiga/dev/msc.c @@ -1,4 +1,5 @@ -/* $NetBSD: msc.c,v 1.3 1996/02/02 18:05:44 mycroft Exp $ */ +/* $OpenBSD: msc.c,v 1.3 1996/04/21 22:15:39 deraadt Exp $ */ +/* $NetBSD: msc.c,v 1.5 1996/03/17 05:58:54 mhitch Exp $ */ /* * Copyright (c) 1993 Zik. @@ -162,16 +163,19 @@ struct speedtab *mscspeedtab; int mscmctl __P((dev_t dev, int bits, int howto)); void mscmint __P((register void *data)); -int mscmatch __P((struct device *, struct cfdata *, void *)); +int mscmatch __P((struct device *, void *, void *)); void mscattach __P((struct device *, struct device *, void *)); #define SWFLAGS(dev) (msc->openflags | (MSCDIALIN(dev) ? 0 : TIOCFLAG_SOFTCAR)) #define DEBUG_MSC 0 #define DEBUG_CD 0 -struct cfdriver msccd = { - NULL, "msc", (cfmatch_t) mscmatch, mscattach, DV_TTY, - sizeof(struct device), NULL, 0 +struct cfattach msc_ca = { + sizeof(struct device), mscmatch, mscattach +}; + +struct cfdriver msc_cd = { + NULL, "msc",DV_TTY, NULL, 0 }; #if DEBUG_MSC @@ -199,11 +203,11 @@ bugi(msc, string) #endif int -mscmatch(pdp, cdp, auxp) +mscmatch(pdp, match, auxp) struct device *pdp; - struct cfdata *cdp; - void *auxp; + void *match, *auxp; { + struct cfdata *cdp = match; struct zbus_args *zap; zap = auxp; diff --git a/sys/arch/amiga/dev/otgsc.c b/sys/arch/amiga/dev/otgsc.c index 53e1f533ea9..768dc520642 100644 --- a/sys/arch/amiga/dev/otgsc.c +++ b/sys/arch/amiga/dev/otgsc.c @@ -1,4 +1,5 @@ -/* $NetBSD: otgsc.c,v 1.9 1995/09/16 16:11:24 chopps Exp $ */ +/* $OpenBSD: otgsc.c,v 1.2 1996/04/21 22:15:40 deraadt Exp $ */ +/* $NetBSD: otgsc.c,v 1.10 1996/03/17 01:17:50 thorpej Exp $ */ /* * Copyright (c) 1994 Michael L. Hitch @@ -49,7 +50,7 @@ int otgscprint __P((void *auxp, char *)); void otgscattach __P((struct device *, struct device *, void *)); -int otgscmatch __P((struct device *, struct cfdata *, void *)); +int otgscmatch __P((struct device *, void *, void *)); int otgsc_dma_xfer_in __P((struct sci_softc *dev, int len, register u_char *buf, int phase)); @@ -79,18 +80,21 @@ extern int sci_debug; extern int sci_data_wait; -struct cfdriver otgsccd = { - NULL, "otgsc", (cfmatch_t)otgscmatch, otgscattach, - DV_DULL, sizeof(struct sci_softc), NULL, 0 }; +struct cfattach otgsc_ca = { + sizeof(struct sci_softc), otgscmatch, otgscattach +}; + +struct cfdriver otgsc_cd = { + NULL, "otgsc", DV_DULL, NULL, 0 +}; /* * if we are my Hacker's SCSI board we are here. */ int -otgscmatch(pdp, cdp, auxp) +otgscmatch(pdp, match, auxp) struct device *pdp; - struct cfdata *cdp; - void *auxp; + void *match, *auxp; { struct zbus_args *zap; diff --git a/sys/arch/amiga/dev/par.c b/sys/arch/amiga/dev/par.c index bcd5def57f6..2021f3617e9 100644 --- a/sys/arch/amiga/dev/par.c +++ b/sys/arch/amiga/dev/par.c @@ -1,4 +1,5 @@ -/* $NetBSD: par.c,v 1.11 1994/12/01 17:25:33 chopps Exp $ */ +/* $OpenBSD: par.c,v 1.2 1996/04/21 22:15:41 deraadt Exp $ */ +/* $NetBSD: par.c,v 1.12 1996/03/17 01:17:51 thorpej Exp $ */ /* * Copyright (c) 1982, 1990 The Regents of the University of California. @@ -89,19 +90,24 @@ void parstart __P((void *)); void parintr __P((void *)); void parattach __P((struct device *, struct device *, void *)); -int parmatch __P((struct device *, struct cfdata *, void *)); +int parmatch __P((struct device *, void *, void *)); -struct cfdriver parcd = { - NULL, "par", (cfmatch_t)parmatch, parattach, DV_DULL, - sizeof(struct device), NULL, 0 }; +struct cfattach par_ca = { + sizeof(struct device), parmatch, parattach +}; + +struct cfdriver par_cd = { + NULL, "par", DV_DULL, NULL, 0 +}; /*ARGSUSED*/ int -parmatch(pdp, cfp, auxp) +parmatch(pdp, match, auxp) struct device *pdp; - struct cfdata *cfp; - void *auxp; + void *match, *auxp; { + struct cfdata *cfp = match; + if (matchname((char *)auxp, "par") && cfp->cf_unit == 0) return(1); return(0); diff --git a/sys/arch/amiga/dev/sbic.c b/sys/arch/amiga/dev/sbic.c index dbf6c7ec3b9..8e40232e6ed 100644 --- a/sys/arch/amiga/dev/sbic.c +++ b/sys/arch/amiga/dev/sbic.c @@ -1,4 +1,5 @@ -/* $NetBSD: sbic.c,v 1.21 1996/01/07 22:01:54 thorpej Exp $ */ +/* $OpenBSD: sbic.c,v 1.4 1996/04/21 22:15:43 deraadt Exp $ */ +/* $NetBSD: sbic.c,v 1.22 1996/03/23 15:09:54 is Exp $ */ /* * Copyright (c) 1994 Christian E. Hopps @@ -618,8 +619,8 @@ sbic_scsidone(acb, stat) xs->error = XS_SENSE; #ifdef DEBUG if (report_sense) - printf(" => %02x %02x\n", xs->sense.extended_flags, - xs->sense.extended_extra_bytes[3]); + printf(" => %02x %02x\n", xs->sense.flags, + xs->sense.extra_bytes[3]); #endif } else { xs->resid = 0; /* XXXX */ diff --git a/sys/arch/amiga/dev/ser.c b/sys/arch/amiga/dev/ser.c index e9bcac294cd..9eaf8a5c653 100644 --- a/sys/arch/amiga/dev/ser.c +++ b/sys/arch/amiga/dev/ser.c @@ -1,4 +1,5 @@ -/* $NetBSD: ser.c,v 1.27.2.1 1995/10/20 11:01:14 chopps Exp $ */ +/* $OpenBSD: ser.c,v 1.3 1996/04/21 22:15:45 deraadt Exp $ */ +/* $NetBSD: ser.c,v 1.30 1996/03/17 05:58:58 mhitch Exp $ */ /* * Copyright (c) 1982, 1986, 1990 The Regents of the University of California. @@ -65,16 +66,20 @@ #if NSER > 0 void serattach __P((struct device *, struct device *, void *)); -int sermatch __P((struct device *, struct cfdata *, void *)); +int sermatch __P((struct device *, void *, void *)); struct ser_softc { struct device dev; struct tty *ser_tty; }; -struct cfdriver sercd = { - NULL, "ser", (cfmatch_t)sermatch, serattach, DV_TTY, - sizeof(struct ser_softc), NULL, 0 }; +struct cfattach ser_ca = { + sizeof(struct ser_softc), sermatch, serattach +}; + +struct cfdriver ser_cd = { + NULL, "ser", DV_TTY, NULL, 0 +}; #ifndef SEROBUF_SIZE #define SEROBUF_SIZE 32 @@ -174,11 +179,12 @@ long sermintcount[16]; void sermint __P((register int unit)); int -sermatch(pdp, cfp, auxp) +sermatch(pdp, match, auxp) struct device *pdp; - struct cfdata *cfp; - void *auxp; + void *match, *auxp; { + struct cfdata *cfp = match; + if (matchname("ser", (char *)auxp) == 0 || cfp->cf_unit != 0) return(0); if (serconsole != 0 && amiga_realconfig == 0) @@ -253,7 +259,7 @@ seropen(dev, flag, mode, p) if (ser_tty[unit]) tp = ser_tty[unit]; else - tp = ((struct ser_softc *)sercd.cd_devs[unit])->ser_tty = + tp = ((struct ser_softc *)ser_cd.cd_devs[unit])->ser_tty = ser_tty[unit] = ttymalloc(); tp->t_oproc = (void (*) (struct tty *)) serstart; diff --git a/sys/arch/amiga/dev/wesc.c b/sys/arch/amiga/dev/wesc.c index eaffbe8e548..f76ca1491fc 100644 --- a/sys/arch/amiga/dev/wesc.c +++ b/sys/arch/amiga/dev/wesc.c @@ -1,5 +1,5 @@ -/* $OpenBSD: wesc.c,v 1.2 1996/03/30 22:18:24 niklas Exp $ */ -/* $NetBSD: wesc.c,v 1.11 1996/03/15 22:11:19 mhitch Exp $ */ +/* $OpenBSD: wesc.c,v 1.3 1996/04/21 22:15:47 deraadt Exp $ */ +/* $NetBSD: wesc.c,v 1.12 1996/03/17 01:17:55 thorpej Exp $ */ /* * Copyright (c) 1994 Michael L. Hitch @@ -53,7 +53,7 @@ int wescprint __P((void *auxp, char *)); void wescattach __P((struct device *, struct device *, void *)); -int wescmatch __P((struct device *, struct cfdata *, void *)); +int wescmatch __P((struct device *, void *, void *)); int wesc_dmaintr __P((struct siop_softc *)); struct scsi_adapter wesc_scsiswitch = { @@ -74,19 +74,23 @@ struct scsi_device wesc_scsidev = { #ifdef DEBUG #endif -struct cfdriver wesccd = { - NULL, "wesc", (cfmatch_t)wescmatch, wescattach, - DV_DULL, sizeof(struct siop_softc), NULL, 0 }; +struct cfattach wesc_ca = { + sizeof(struct siop_softc), wescmatch, wescattach +}; + +struct cfdriver wesc_cd = { + NULL, "wesc", DV_DULL, NULL, 0 +}; /* * if we are an MacroSystemsUS Warp Engine */ int -wescmatch(pdp, cdp, auxp) +wescmatch(pdp, match, auxp) struct device *pdp; - struct cfdata *cdp; - void *auxp; + void *match, *auxp; { + struct cfdata *cdp = match; struct zbus_args *zap; zap = auxp; @@ -181,8 +185,8 @@ wesc_dump() { int i; - for (i = 0; i < wesccd.cd_ndevs; ++i) - if (wesccd.cd_devs[i]) - siop_dump(wesccd.cd_devs[i]); + for (i = 0; i < wesc_cd.cd_ndevs; ++i) + if (wesc_cd.cd_devs[i]) + siop_dump(wesc_cd.cd_devs[i]); } #endif diff --git a/sys/arch/amiga/dev/wstsc.c b/sys/arch/amiga/dev/wstsc.c index 0b129834227..760c4fb6613 100644 --- a/sys/arch/amiga/dev/wstsc.c +++ b/sys/arch/amiga/dev/wstsc.c @@ -1,4 +1,5 @@ -/* $NetBSD: wstsc.c,v 1.9 1995/08/18 15:28:17 chopps Exp $ */ +/* $OpenBSD: wstsc.c,v 1.2 1996/04/21 22:15:48 deraadt Exp $ */ +/* $NetBSD: wstsc.c,v 1.10 1996/03/17 01:17:56 thorpej Exp $ */ /* * Copyright (c) 1994 Michael L. Hitch @@ -49,7 +50,7 @@ int wstscprint __P((void *auxp, char *)); void wstscattach __P((struct device *, struct device *, void *)); -int wstscmatch __P((struct device *, struct cfdata *, void *)); +int wstscmatch __P((struct device *, void *, void *)); int wstsc_dma_xfer_in __P((struct sci_softc *dev, int len, register u_char *buf, int phase)); @@ -85,19 +86,23 @@ extern int sci_data_wait; int supradma_pseudo = 0; /* 0=none, 1=byte, 2=word */ -struct cfdriver wstsccd = { - NULL, "wstsc", (cfmatch_t)wstscmatch, wstscattach, - DV_DULL, sizeof(struct sci_softc), NULL, 0 }; +struct cfattach wstsc_ca = { + sizeof(struct sci_softc), wstscmatch, wstscattach +}; + +struct cfdriver wstsc_cd = { + NULL, "wstsc", DV_DULL, NULL, 0 +}; /* * if this a Supra WordSync board */ int -wstscmatch(pdp, cdp, auxp) +wstscmatch(pdp, match, auxp) struct device *pdp; - struct cfdata *cdp; - void *auxp; + void *match, *auxp; { + struct cfdata *cdp = match; struct zbus_args *zap; zap = auxp; diff --git a/sys/arch/amiga/dev/zbus.c b/sys/arch/amiga/dev/zbus.c index d71ae27bce2..95089df0010 100644 --- a/sys/arch/amiga/dev/zbus.c +++ b/sys/arch/amiga/dev/zbus.c @@ -1,5 +1,5 @@ -/* $OpenBSD: zbus.c,v 1.3 1996/03/30 22:18:25 niklas Exp $ */ -/* $NetBSD: zbus.c,v 1.15 1996/03/06 20:13:32 is Exp $ */ +/* $OpenBSD: zbus.c,v 1.4 1996/04/21 22:15:50 deraadt Exp $ */ +/* $NetBSD: zbus.c,v 1.17 1996/03/28 18:41:49 is Exp $ */ /* * Copyright (c) 1994 Christian E. Hopps @@ -126,7 +126,9 @@ static struct aconfdata aconftab[] = { /* Hacker Inc. */ { "mlhsc", 2011, 1 }, /* Resource Management Force */ - { "qn", 2011, 2 } /* QuickNet Ethernet */ + { "qn", 2011, 2 }, /* QuickNet Ethernet */ + /* ??? */ + { "empsc", 2171, 21 } /* Emplant SCSI */ }; static int naconfent = sizeof(aconftab) / sizeof(struct aconfdata); @@ -153,7 +155,7 @@ static int npreconfent = sizeof(preconftab) / sizeof(struct preconfdata); void zbusattach __P((struct device *, struct device *, void *)); int zbusprint __P((void *, char *)); -int zbusmatch __P((struct device *, struct cfdata *,void *)); +int zbusmatch __P((struct device *, void *, void *)); caddr_t zbusmap __P((caddr_t, u_int)); static char *aconflookup __P((int, int)); @@ -177,20 +179,25 @@ aconflookup(mid, pid) /* * mainbus driver */ -struct cfdriver zbuscd = { - NULL, "zbus", (cfmatch_t)zbusmatch, zbusattach, - DV_DULL, sizeof(struct device), NULL, 0 + +struct cfattach zbus_ca = { + sizeof(struct device), zbusmatch, zbusattach +}; + +struct cfdriver zbus_cd = { + NULL, "zbus", DV_DULL, NULL, 0 }; static struct cfdata *early_cfdata; /*ARGSUSED*/ int -zbusmatch(pdp, cfp, auxp) +zbusmatch(pdp, match, auxp) struct device *pdp; - struct cfdata *cfp; - void *auxp; + void *match, *auxp; { + struct cfdata *cfp = match; + if (matchname(auxp, "zbus") == 0) return(0); if (amiga_realconfig == 0) @@ -286,11 +293,11 @@ zbusprint(auxp, pnp) } /* - * this function is used to map Zorro physical I/O addresses into kernel virtual - * addresses. We don't keep track which address we map where, we don't NEED - * to know this. We made sure in amiga_init.c (by scanning all available Zorro - * devices) to have enough kva-space available, so there is no extra range - * check done here. + * this function is used to map Zorro physical I/O addresses into kernel + * virtual addresses. We don't keep track which address we map where, we don't + * NEED to know this. We made sure in amiga_init.c (by scanning all available + * Zorro devices) to have enough kva-space available, so there is no extra + * range check done here. */ caddr_t zbusmap (pa, size) diff --git a/sys/arch/amiga/dev/zssc.c b/sys/arch/amiga/dev/zssc.c index 9f9a889157e..26b734b26f0 100644 --- a/sys/arch/amiga/dev/zssc.c +++ b/sys/arch/amiga/dev/zssc.c @@ -1,5 +1,5 @@ -/* $OpenBSD: zssc.c,v 1.4 1996/03/30 22:18:25 niklas Exp $ */ -/* $NetBSD: zssc.c,v 1.14 1996/03/15 22:11:22 mhitch Exp $ */ +/* $OpenBSD: zssc.c,v 1.5 1996/04/21 22:15:51 deraadt Exp $ */ +/* $NetBSD: zssc.c,v 1.15 1996/03/17 01:18:00 thorpej Exp $ */ /* * Copyright (c) 1994 Michael L. Hitch @@ -52,7 +52,7 @@ int zsscprint __P((void *auxp, char *)); void zsscattach __P((struct device *, struct device *, void *)); -int zsscmatch __P((struct device *, struct cfdata *, void *)); +int zsscmatch __P((struct device *, void *, void *)); int siopintr __P((struct siop_softc *)); int zssc_dmaintr __P((struct siop_softc *)); @@ -74,19 +74,23 @@ struct scsi_device zssc_scsidev = { #ifdef DEBUG #endif -struct cfdriver zssccd = { - NULL, "zssc", (cfmatch_t)zsscmatch, zsscattach, - DV_DULL, sizeof(struct siop_softc), NULL, 0 }; +struct cfattach zssc_ca = { + sizeof(struct siop_softc), zsscmatch, zsscattach +}; + +struct cfdriver zssc_cd = { + NULL, "zssc", DV_DULL, NULL, 0 +}; /* * if we are a PPI Zeus */ int -zsscmatch(pdp, cdp, auxp) +zsscmatch(pdp, match, auxp) struct device *pdp; - struct cfdata *cdp; - void *auxp; + void *match, *auxp; { + struct cfdata *cdp = match; struct zbus_args *zap; zap = auxp; @@ -205,8 +209,8 @@ zssc_dump() { int i; - for (i = 0; i < zssccd.cd_ndevs; ++i) - if (zssccd.cd_devs[i]) - siop_dump(zssccd.cd_devs[i]); + for (i = 0; i < zssc_cd.cd_ndevs; ++i) + if (zssc_cd.cd_devs[i]) + siop_dump(zssc_cd.cd_devs[i]); } #endif diff --git a/sys/arch/amiga/include/cpu.h b/sys/arch/amiga/include/cpu.h index 35cfe4bfc1e..c500a5e565b 100644 --- a/sys/arch/amiga/include/cpu.h +++ b/sys/arch/amiga/include/cpu.h @@ -1,5 +1,5 @@ -/* $OpenBSD: cpu.h,v 1.4 1996/03/30 22:18:27 niklas Exp $ */ -/* $NetBSD: cpu.h,v 1.26 1996/03/15 19:47:48 is Exp $ */ +/* $OpenBSD: cpu.h,v 1.5 1996/04/21 22:15:55 deraadt Exp $ */ +/* $NetBSD: cpu.h,v 1.28 1996/03/30 16:22:55 is Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -175,6 +175,21 @@ int machineid, mmutype, fputype; #define IC40_ENABLE 0x00008000 /* enable instruction cache */ #define DC40_ENABLE 0x80000000 /* enable data cache */ +/* additional fields in the 68060 cache control register */ + +#define DC60_NAD 0x40000000 /* no allocate mode, data cache */ +#define DC60_ESB 0x20000000 /* enable store buffer */ +#define DC60_DPI 0x10000000 /* disable CPUSH invalidation */ +#define DC60_FOC 0x08000000 /* four kB data cache mode (else 8) */ + +#define IC60_EBC 0x00800000 /* enable branch cache */ +#define IC60_CABC 0x00400000 /* clear all branch cache entries */ +#define IC60_CUBC 0x00200000 /* clear user branch cache entries */ + +#define IC60_NAI 0x00004000 /* no allocate mode, instr. cache */ +#define IC60_FIC 0x00002000 /* four kB instr. cache (else 8) */ + + #define CACHE_ON (DC_WA|DC_BE|DC_CLR|DC_ENABLE|IC_BE|IC_CLR|IC_ENABLE) #define CACHE_OFF (DC_CLR|IC_CLR) #define CACHE_CLR (CACHE_ON) @@ -185,6 +200,9 @@ int machineid, mmutype, fputype; #define CACHE40_ON (IC40_ENABLE|DC40_ENABLE) #define CACHE40_OFF 0x00000000 +#define CACHE60_ON (CACHE40_ON |IC60_CABC|IC60_EBC|DC60_ESB) +#define CACHE60_OFF (CACHE40_OFF|IC60_CABC) + /* * CTL_MACHDEP definitions. */ diff --git a/sys/arch/i386/conf/DISKLESS b/sys/arch/i386/conf/DISKLESS index e33317a4a10..1c962680077 100644 --- a/sys/arch/i386/conf/DISKLESS +++ b/sys/arch/i386/conf/DISKLESS @@ -1,5 +1,5 @@ -# $OpenBSD: DISKLESS,v 1.3 1996/04/18 18:55:32 niklas Exp $ -# $NetBSD: DISKLESS,v 1.21 1996/03/16 06:09:02 thorpej Exp $ +# $OpenBSD: DISKLESS,v 1.4 1996/04/21 22:16:04 deraadt Exp $ +# $NetBSD: DISKLESS,v 1.23 1996/03/25 05:45:14 perry Exp $ # # DISKLESS -- Generic machine setup for diskless boot. # This kernel can be loaded from a bootable floppy (i.e. kernel-copy) @@ -42,6 +42,7 @@ options SYSVSHM # System V-like memory sharing options COMPAT_NOMID # compatibility with 386BSD, BSDI, NetBSD 0.8, options COMPAT_09 # NetBSD 0.9, options COMPAT_10 # NetBSD 1.0, +options COMPAT_11 # NetBSD 1.1, options COMPAT_43 # and 4.3BSD options TCP_COMPAT_42 # TCP bug compatibility with 4.2BSD @@ -160,7 +161,7 @@ ie0 at isa? port 0x360 iomem 0xd0000 irq 7 # StarLAN & 3C507 ethernet cards #le0 at isa? port 0x320 irq 10 drq 7 # IsoLan, NE2100, and DEPCA sb0 at isa? port 0x220 irq 7 drq 1 # SoundBlaster -#spkr0 at isa? port 0x61 +#spkr0 at pckbd? port 0x61 pseudo-device loop 1 # network loopback pseudo-device bpfilter 8 # packet filter diff --git a/sys/arch/i386/conf/GENERIC b/sys/arch/i386/conf/GENERIC index 1a6fcd88231..1f42d656732 100644 --- a/sys/arch/i386/conf/GENERIC +++ b/sys/arch/i386/conf/GENERIC @@ -1,5 +1,5 @@ -# $OpenBSD: GENERIC,v 1.7 1996/04/18 18:55:33 niklas Exp $ -# $NetBSD: GENERIC,v 1.36 1996/03/16 06:09:03 thorpej Exp $ +# $OpenBSD: GENERIC,v 1.8 1996/04/21 22:16:06 deraadt Exp $ +# $NetBSD: GENERIC,v 1.40 1996/03/30 23:57:09 perry Exp $ # # GENERIC -- everything that's currently supported # @@ -42,6 +42,7 @@ options SYSVSHM # System V-like memory sharing options COMPAT_NOMID # compatibility with 386BSD, BSDI, NetBSD 0.8, options COMPAT_09 # NetBSD 0.9, options COMPAT_10 # NetBSD 1.0, +options COMPAT_11 # NetBSD 1.1, options COMPAT_43 # and 4.3BSD options TCP_COMPAT_42 # TCP bug compatibility with 4.2BSD @@ -142,6 +143,9 @@ uha0 at isa? port 0x330 irq ? drq ? # UltraStor [13]4f SCSI controllers uha1 at isa? port 0x334 irq ? drq ? # UltraStor [13]4f SCSI controllers uha2 at isa? port ? irq ? # UltraStor 24f SCSI controllers scsibus* at uha? +wds0 at isa? port 0x350 irq 15 drq 6 # WD7000 and TMC-7000 controllers +wds1 at isa? port 0x358 irq 11 drq 5 +scsibus* at wds? sd* at scsibus? target ? lun ? # SCSI disk drives st* at scsibus? target ? lun ? # SCSI tape drives @@ -179,7 +183,10 @@ sb0 at isa? port 0x220 irq 7 drq 1 # SoundBlaster wss0 at isa? port 0x530 irq 10 drq 0 # Windows Sound System pas0 at isa? port 0x220 irq 7 drq 1 # ProAudio Spectrum gus0 at isa? port 0x220 irq 7 drq 1 flags 6 # Gravis Ultra Sound (flags is record drq for full-duplex) -#spkr0 at isa? port 0x61 +#spkr0 at pckbd? port 0x61 + +# Joystick driver. Probe is a little strange; add only if you have one. +#joy0 at isa? port 0x201 pseudo-device loop 1 # network loopback pseudo-device bpfilter 8 # packet filter diff --git a/sys/arch/i386/conf/GENERICADP b/sys/arch/i386/conf/GENERICADP index 2ccbebc4488..d8c61ab9ef8 100644 --- a/sys/arch/i386/conf/GENERICADP +++ b/sys/arch/i386/conf/GENERICADP @@ -1,5 +1,5 @@ -# $OpenBSD: GENERICADP,v 1.6 1996/04/18 18:55:34 niklas Exp $ -# $NetBSD: GENERICADP,v 1.3 1995/12/14 01:10:08 tls Exp $ +# $OpenBSD: GENERICADP,v 1.7 1996/04/21 22:16:09 deraadt Exp $ +# $NetBSD: GENERICADP,v 1.16 1996/03/30 23:57:16 perry Exp $ # # GENERICADP -- everything that's currently supported, except non- # Adaptec SCSI controllers. @@ -43,6 +43,7 @@ options SYSVSHM # System V-like memory sharing options COMPAT_NOMID # compatibility with 386BSD, BSDI, NetBSD 0.8, options COMPAT_09 # NetBSD 0.9, options COMPAT_10 # NetBSD 1.0, +options COMPAT_11 # NetBSD 1.1, options COMPAT_43 # and 4.3BSD options TCP_COMPAT_42 # TCP bug compatibility with 4.2BSD @@ -168,7 +169,10 @@ sb0 at isa? port 0x220 irq 7 drq 1 # SoundBlaster wss0 at isa? port 0x530 irq 10 drq 0 # Windows Sound System pas0 at isa? port 0x220 irq 7 drq 1 # ProAudio Spectrum gus0 at isa? port 0x220 irq 7 drq 1 flags 6 # Gravis Ultra Sound (flags is record drq for full-duplex) -#spkr0 at isa? port 0x61 +#spkr0 at pckbd? port 0x61 + +# Joystick driver. Probe is a little strange; add only if you have one. +#joy0 at isa? port 0x201 pseudo-device loop 1 # network loopback pseudo-device bpfilter 8 # packet filter diff --git a/sys/arch/i386/conf/GENERICOTHER b/sys/arch/i386/conf/GENERICOTHER index 23cdc09b36e..5fc6586b9d0 100644 --- a/sys/arch/i386/conf/GENERICOTHER +++ b/sys/arch/i386/conf/GENERICOTHER @@ -1,5 +1,5 @@ -# $OpenBSD: GENERICOTHER,v 1.5 1996/04/18 18:55:34 niklas Exp $ -# $NetBSD: GENERICOTHER,v 1.3 1995/12/14 01:10:10 tls Exp $ +# $OpenBSD: GENERICOTHER,v 1.6 1996/04/21 22:16:11 deraadt Exp $ +# $NetBSD: GENERICOTHER,v 1.16 1996/03/30 23:57:19 perry Exp $ # # GENERICOTHER -- everything that's currently supported, except # Adaptec SCSI controllers. @@ -43,6 +43,7 @@ options SYSVSHM # System V-like memory sharing options COMPAT_NOMID # compatibility with 386BSD, BSDI, NetBSD 0.8, options COMPAT_09 # NetBSD 0.9, options COMPAT_10 # NetBSD 1.0, +options COMPAT_11 # NetBSD 1.1, options COMPAT_43 # and 4.3BSD options TCP_COMPAT_42 # TCP bug compatibility with 4.2BSD @@ -132,6 +133,9 @@ uha0 at isa? port 0x330 irq ? drq ? # UltraStor [13]4f SCSI controllers uha1 at isa? port 0x334 irq ? drq ? # UltraStor [13]4f SCSI controllers uha2 at isa? port ? irq ? # UltraStor 24f SCSI controllers scsibus* at uha? +wds0 at isa? port 0x350 irq 15 drq 6 # WD7000 and TMC-7000 controllers +wds1 at isa? port 0x358 irq 11 drq 5 +scsibus* at wds? sd* at scsibus? target ? lun ? # SCSI disk drives st* at scsibus? target ? lun ? # SCSI tape drives @@ -169,7 +173,10 @@ sb0 at isa? port 0x220 irq 7 drq 1 # SoundBlaster wss0 at isa? port 0x530 irq 10 drq 0 # Windows Sound System pas0 at isa? port 0x220 irq 7 drq 1 # ProAudio Spectrum gus0 at isa? port 0x220 irq 7 drq 1 flags 6 # Gravis Ultra Sound (flags is record drq for full-duplex) -#spkr0 at isa? port 0x61 +#spkr0 at pckbd? port 0x61 + +# Joystick driver. Probe is a little strange; add only if you have one. +#joy0 at isa? port 0x201 pseudo-device loop 1 # network loopback pseudo-device bpfilter 8 # packet filter diff --git a/sys/arch/i386/conf/INSTADP b/sys/arch/i386/conf/INSTADP index 18c608e335d..45d7f76dc9b 100644 --- a/sys/arch/i386/conf/INSTADP +++ b/sys/arch/i386/conf/INSTADP @@ -1,5 +1,5 @@ -# $OpenBSD: INSTADP,v 1.5 1996/04/18 18:55:36 niklas Exp $ -# $NetBSD: INSTADP,v 1.3 1995/12/14 01:10:12 tls Exp $ +# $OpenBSD: INSTADP,v 1.6 1996/04/21 22:16:12 deraadt Exp $ +# $NetBSD: INSTADP,v 1.11 1996/03/25 05:45:28 perry Exp $ # # INSTADP -- like GENERICADP. This supports only Adaptec SCSI # adapters. This kernel is GENERICADP with lines @@ -34,6 +34,7 @@ options DEVPAGER # mmap() of devices #makeoptions DEBUG="-g" # compile full symbol table options COMPAT_10 # NetBSD 1.0, +options COMPAT_11 # NetBSD 1.1, options LKM # loadable kernel modules diff --git a/sys/arch/i386/conf/INSTOTHER b/sys/arch/i386/conf/INSTOTHER index 8790f156fdc..48c7d44477c 100644 --- a/sys/arch/i386/conf/INSTOTHER +++ b/sys/arch/i386/conf/INSTOTHER @@ -1,4 +1,5 @@ -# $NetBSD: INSTOTHER,v 1.3 1995/12/14 01:10:15 tls Exp $ +# $OpenBSD: INSTOTHER,v 1.4 1996/04/21 22:16:14 deraadt Exp $ +# $NetBSD: INSTOTHER,v 1.11 1996/03/30 05:42:59 mycroft Exp $ # # INSTOTHER -- like GENERICOTHER. This supports only non-Adaptec SCSI # adapters. This kernel is GENERICOTHER with lines @@ -30,6 +31,7 @@ options DIAGNOSTIC # internally consistency checks options KTRACE # system call tracing, a la ktrace(1) options COMPAT_10 # NetBSD 1.0, +options COMPAT_11 # NetBSD 1.1, options LKM # loadable kernel modules @@ -85,6 +87,9 @@ uha0 at isa? port 0x330 irq ? drq ? # UltraStor [13]4f SCSI controllers uha1 at isa? port 0x334 irq ? drq ? # UltraStor [13]4f SCSI controllers uha2 at isa? port ? irq ? # UltraStor 24f SCSI controllers scsibus* at uha? +wds0 at isa? port 0x350 irq 15 drq 6 # WD7000 and TMC-7000 controllers +wds1 at isa? port 0x358 irq 11 drq 5 +scsibus* at wds? sd* at scsibus? target ? lun ? # SCSI disk drives st* at scsibus? target ? lun ? # SCSI tape drives diff --git a/sys/arch/i386/conf/TDR b/sys/arch/i386/conf/TDR index 5669612bf6a..8f4d23c4243 100644 --- a/sys/arch/i386/conf/TDR +++ b/sys/arch/i386/conf/TDR @@ -1,5 +1,5 @@ -# $OpenBSD: TDR,v 1.5 1996/04/18 18:55:37 niklas Exp $ -# $NetBSD: TDR,v 1.62 1996/03/16 06:09:12 thorpej Exp $ +# $OpenBSD: TDR,v 1.6 1996/04/21 22:16:14 deraadt Exp $ +# $NetBSD: TDR,v 1.64 1996/03/25 05:45:49 perry Exp $ # # TDR -- Theo Deraadt's 486 # @@ -40,6 +40,7 @@ options KTRACE # system call tracing, a la ktrace(1) options COMPAT_NOMID # compatibility with 386BSD, BSDI, NetBSD 0.8, options COMPAT_09 # NetBSD 0.9, options COMPAT_10 # NetBSD 1.0, +options COMPAT_11 # NetBSD 1.1, options COMPAT_43 # and 4.3BSD options TCP_COMPAT_42 # TCP bug compatibility with 4.2BSD @@ -161,7 +162,7 @@ ep2 at isa? port ? irq ? #le0 at isa? port 0x320 irq 10 drq 7 # IsoLan, NE2100, and DEPCA #sb0 at isa? port 0x220 irq 7 drq 1 # SoundBlaster -#spkr0 at isa? port 0x61 +#spkr0 at pckbd? port 0x61 pseudo-device loop 1 # network loopback pseudo-device bpfilter 16 # packet filter diff --git a/sys/arch/i386/conf/files.i386 b/sys/arch/i386/conf/files.i386 index b0403ebf9bc..fc823632bfd 100644 --- a/sys/arch/i386/conf/files.i386 +++ b/sys/arch/i386/conf/files.i386 @@ -1,5 +1,5 @@ -# $OpenBSD: files.i386,v 1.10 1996/04/19 07:33:39 mickey Exp $ -# $NetBSD: files.i386,v 1.66 1996/03/16 06:09:16 thorpej Exp $ +# $OpenBSD: files.i386,v 1.11 1996/04/21 22:16:15 deraadt Exp $ +# $NetBSD: files.i386,v 1.72 1996/04/09 22:59:03 cgd Exp $ # # new style config file for i386 architecture # @@ -41,11 +41,18 @@ major {sd = 4} major {st = 5} major {cd = 6} +# RAM Disk for install floppy +pseudo-device rd +file dev/ramdisk.c rd needs-flag +file arch/i386/i386/rd_root.c ramdisk_hooks +major {rd = 17} + # # System bus types # -device mainbus at root: isabus, eisabus, pcibus +device mainbus: isabus, eisabus, pcibus +attach mainbus at root file arch/i386/i386/mainbus.c mainbus #device mca at root {...} @@ -58,6 +65,7 @@ file arch/i386/i386/mainbus.c mainbus include "../../../dev/pci/files.pci" file arch/i386/pci/pci_machdep.c pci +file arch/i386/pci/pci_compat.c pci # XXX compatibility # # ISA and mixed ISA+EISA or ISA+PCI or ISA+PCMCIA drivers @@ -79,19 +87,22 @@ file arch/i386/isa/isa_machdep.c isabus file arch/i386/isa/clock.c isabus # Numeric Processing Extension; Math Co-processor -device npx at isa +device npx +attach npx at isa file arch/i386/isa/npx.c npx needs-flag # attribute used to represent the "keyboard controller" # XXX should be a real device -define pckbd { [irq = -1], [port = -1] } +define pckbd { [irq = -1], [port = -1] } # PC console support a la "pccons" -device pc at isa: tty, pckbd +device pc: tty, pckbd +attach pc at isa file arch/i386/isa/pccons.c pc needs-flag # PC console support a la "pcvt" -device vt at isa: tty, pckbd +device vt: tty, pckbd +attach vt at isa file arch/i386/isa/pcvt/pcvt_drv.c vt needs-flag file arch/i386/isa/pcvt/pcvt_ext.c vt needs-flag file arch/i386/isa/pcvt/pcvt_kbd.c vt needs-flag @@ -100,44 +111,48 @@ file arch/i386/isa/pcvt/pcvt_sup.c vt needs-flag file arch/i386/isa/pcvt/pcvt_vtf.c vt needs-flag # PC Mice; Logitech-style, Microsoft-style, and PS/2-style -device lms at isa +device lms +attach lms at isa file arch/i386/isa/lms.c lms needs-flag -device mms at isa +device mms +attach mms at isa file arch/i386/isa/mms.c mms needs-flag -device pms at pckbd +device pms +attach pms at pckbd file arch/i386/isa/pms.c pms needs-flag # Floppy disk controller -device fdc at isa {drive = -1} -device fd at fdc: disk, isadma +device fdc {drive = -1} +attach fdc at isa +device fd: disk, isadma +attach fd at fdc file arch/i386/isa/fd.c fdc needs-flag major {fd = 2} # PC speaker -device spkr at pckbd: tty +device spkr: tty +attach spkr at pckbd file arch/i386/isa/spkr.c spkr needs-flag # AMD am7990 (Lance) -based boards # (BICC Isolan, NE2100, DEPCA) # XXX conflicts with other ports; can't be in files.isa -device le at isa, pci: ether, ifnet, isadma +device le: ether, ifnet +attach le at isa with le_isa: isadma +attach le at pci with le_pci file dev/isa/if_le.c le -# 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 -device ed at isa: ether, ifnet -file dev/isa/if_ed.c ed needs-flag - # Game adapter (joystick) -device joy at isa -file arch/i386/isa/joy.c joy needs-flag +device joy +attach joy at isa +file arch/i386/isa/joy.c joy needs-flag # # EISA-only drivers # include "../../../dev/eisa/files.eisa" +file arch/i386/eisa/eisa_machdep.c eisa # # Compatibility modules diff --git a/sys/arch/i386/eisa/eisa_machdep.c b/sys/arch/i386/eisa/eisa_machdep.c new file mode 100644 index 00000000000..fd1e28c11a3 --- /dev/null +++ b/sys/arch/i386/eisa/eisa_machdep.c @@ -0,0 +1,126 @@ +/* $NetBSD: eisa_machdep.c,v 1.2 1996/04/11 22:15:08 cgd Exp $ */ + +/* + * Copyright (c) 1996 Christopher G. Demetriou. 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 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 + * + * 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. + */ + +/* + * Machine-specific functions for EISA autoconfiguration. + */ + +#include <sys/types.h> +#include <sys/param.h> +#include <sys/time.h> +#include <sys/systm.h> +#include <sys/errno.h> +#include <sys/device.h> + +#include <i386/isa/icu.h> +#include <dev/isa/isavar.h> +#include <dev/eisa/eisavar.h> + +void +eisa_attach_hook(parent, self, eba) + struct device *parent, *self; + struct eisabus_attach_args *eba; +{ + + /* Nothing to do */ +} + +int +eisa_maxslots(ec) + eisa_chipset_tag_t ec; +{ + + /* + * Always try 16 slots. + */ + return (16); +} + +int +eisa_intr_map(ec, irq, ihp) + eisa_chipset_tag_t ec; + u_int irq; + eisa_intr_handle_t *ihp; +{ + + if (irq >= ICU_LEN) { + printf("eisa_intr_map: bad IRQ %d\n", irq); + *ihp = -1; + return 1; + } + if (irq == 2) { + printf("eisa_intr_map: changed IRQ 2 to IRQ 9\n"); + irq = 9; + } + + *ihp = irq; + return 0; +} + +const char * +eisa_intr_string(ec, ih) + eisa_chipset_tag_t ec; + eisa_intr_handle_t ih; +{ + static char irqstr[8]; /* 4 + 2 + NULL + sanity */ + + if (ih == 0 || ih >= ICU_LEN || ih == 2) + panic("eisa_intr_string: bogus handle 0x%x\n", ih); + + sprintf(irqstr, "irq %d", ih); + return (irqstr); + +} + +void * +eisa_intr_establish(ec, ih, type, level, func, arg, what) + eisa_chipset_tag_t ec; + eisa_intr_handle_t ih; + int type, level, (*func) __P((void *)); + void *arg; + char *what; +{ + + if (ih == 0 || ih >= ICU_LEN || ih == 2) + panic("eisa_intr_establish: bogus handle 0x%x\n", ih); + + return isa_intr_establish(NULL, ih, type, level, func, arg, what); +} + +void +eisa_intr_disestablish(ec, cookie) + eisa_chipset_tag_t ec; + void *cookie; +{ + + return isa_intr_disestablish(NULL, cookie); +} diff --git a/sys/arch/i386/eisa/eisa_machdep.h b/sys/arch/i386/eisa/eisa_machdep.h index e7ba6579fff..2e4f1019e2f 100644 --- a/sys/arch/i386/eisa/eisa_machdep.h +++ b/sys/arch/i386/eisa/eisa_machdep.h @@ -1,5 +1,5 @@ -/* $OpenBSD: eisa_machdep.h,v 1.1 1996/04/18 18:56:27 niklas Exp $ */ -/* $NetBSD: eisa_machdep.h,v 1.1 1996/03/04 03:26:14 cgd Exp $ */ +/* $OpenBSD: eisa_machdep.h,v 1.2 1996/04/21 22:16:19 deraadt Exp $ */ +/* $NetBSD: eisa_machdep.h,v 1.2 1996/04/09 23:00:27 cgd Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. @@ -32,9 +32,33 @@ */ /* - * The "EISA" signature is in the BIOS of EISA systems. We use it - * to determine whether or not we have an EISA bus. + * Machine-specific definitions for EISA autoconfiguration. + */ + +/* + * i386-specific EISA definitions. + * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE. */ #define EISA_ID "EISA" #define EISA_ID_LEN (sizeof(EISA_ID) - 1) #define EISA_ID_PADDR 0xfffd9 + +/* + * Types provided to machine-independent EISA code. + */ +typedef void *eisa_chipset_tag_t; +typedef int eisa_intr_handle_t; + +/* + * Functions provided to machine-independent EISA code. + */ +void eisa_attach_hook __P((struct device *, struct device *, + struct eisabus_attach_args *)); +int eisa_maxslots __P((eisa_chipset_tag_t)); +int eisa_intr_map __P((eisa_chipset_tag_t, u_int, + eisa_intr_handle_t *)); +const char *eisa_intr_string __P((eisa_chipset_tag_t, eisa_intr_handle_t)); +void *eisa_intr_establish __P((eisa_chipset_tag_t, + eisa_intr_handle_t, int, int, int (*)(void *), void *, + char *)); +void eisa_intr_disestablish __P((eisa_chipset_tag_t, void *)); diff --git a/sys/arch/i386/i386/autoconf.c b/sys/arch/i386/i386/autoconf.c index 75af163fe99..0358a729c9f 100644 --- a/sys/arch/i386/i386/autoconf.c +++ b/sys/arch/i386/i386/autoconf.c @@ -1,5 +1,5 @@ -/* $OpenBSD: autoconf.c,v 1.7 1996/04/18 19:18:05 niklas Exp $ */ -/* $NetBSD: autoconf.c,v 1.18 1996/03/04 03:26:18 cgd Exp $ */ +/* $OpenBSD: autoconf.c,v 1.8 1996/04/21 22:16:22 deraadt Exp $ */ +/* $NetBSD: autoconf.c,v 1.19 1996/03/29 01:15:04 mycroft Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -62,6 +62,10 @@ void swapconf __P((void)); void setroot __P((void)); +void setroot __P((void)); +void swapconf __P((void)); +void dumpconf __P((void)); + /* * The following several variables are related to * the configuration process, and are used in initializing diff --git a/sys/arch/i386/i386/conf.c b/sys/arch/i386/i386/conf.c index 6ddda4d7f19..c56ad7712fd 100644 --- a/sys/arch/i386/i386/conf.c +++ b/sys/arch/i386/i386/conf.c @@ -1,5 +1,5 @@ -/* $OpenBSD: conf.c,v 1.11 1996/04/18 19:18:06 niklas Exp $ */ -/* $NetBSD: conf.c,v 1.71 1996/03/14 21:27:33 christos Exp $ */ +/* $OpenBSD: conf.c,v 1.12 1996/04/21 22:16:23 deraadt Exp $ */ +/* $NetBSD: conf.c,v 1.74 1996/03/30 07:30:33 mycroft Exp $ */ /* * Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved. @@ -69,6 +69,9 @@ bdev_decl(vnd); bdev_decl(scd); #include "ccd.h" bdev_decl(ccd); +#include "rd.h" +bdev_decl(rd); +/* no cdev for rd */ struct bdevsw bdevsw[] = { @@ -91,6 +94,7 @@ struct bdevsw bdevsw[] = bdev_disk_init(NVND,vnd), /* 14: vnode disk driver */ bdev_disk_init(NSCD,scd), /* 15: Sony CD-ROM */ bdev_disk_init(NCCD,ccd), /* 16: concatenated disk driver */ + bdev_disk_init(NRD,rd), /* 17: ram disk driver */ }; int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]); @@ -112,25 +116,13 @@ int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]); dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \ 0, seltrue, (dev_type_mmap((*))) enodev } -/* open, close, ioctl, select -- XXX should be a generic device */ -#define cdev_ocis_init(c,n) { \ - dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \ - (dev_type_write((*))) enodev, dev_init(c,n,ioctl), \ - (dev_type_stop((*))) enodev, 0, dev_init(c,n,select), \ - (dev_type_mmap((*))) enodev, 0 } - -/* open, close, read, ioctl */ -#define cdev_joy_init(c,n) { \ - dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \ - (dev_type_write((*))) enodev, dev_init(c,n,ioctl), \ - (dev_type_stop((*))) enodev, 0, seltrue, (dev_type_mmap((*))) enodev } - /* open, close, read, ioctl */ #define cdev_ss_init(c,n) { \ dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \ (dev_type_write((*))) enodev, dev_init(c,n,ioctl), \ (dev_type_stop((*))) enodev, 0, seltrue, \ (dev_type_mmap((*))) enodev } +#define cdev_joy_init cdev_ss_init cdev_decl(cn); cdev_decl(ctty); @@ -169,8 +161,6 @@ cdev_decl(ch); dev_decl(filedesc,open); #include "bpfilter.h" cdev_decl(bpf); -#include "pcmciabus.h" -cdev_decl(pcmciabus); #include "spkr.h" cdev_decl(spkr); #ifdef LKM @@ -236,8 +226,8 @@ struct cdevsw cdevsw[] = cdev_fd_init(1,filedesc), /* 22: file descriptor pseudo-device */ cdev_bpftun_init(NBPFILTER,bpf),/* 23: Berkeley packet filter */ cdev_notdef(), /* 24 */ - cdev_joy_init(NJOY,joy), /* 25: Game adapter */ - cdev_ocis_init(NPCMCIABUS,pcmciabus), /* 26: PCMCIA Bus */ + cdev_notdef(), /* 25 */ + cdev_joy_init(NJOY,joy), /* 26: joystick */ cdev_spkr_init(NSPKR,spkr), /* 27: PC speaker */ cdev_lkm_init(NLKM,lkm), /* 28: loadable module driver */ cdev_lkm_dummy(), /* 29 */ @@ -280,6 +270,7 @@ dev_t swapdev = makedev(1, 0); /* * Returns true if dev is /dev/mem or /dev/kmem. */ +int iskmemdev(dev) dev_t dev; { @@ -290,6 +281,7 @@ iskmemdev(dev) /* * Returns true if dev is /dev/zero. */ +int iszerodev(dev) dev_t dev; { @@ -355,6 +347,7 @@ static int chrtoblktbl[] = { /* * Convert a character device number to a block device number. */ +dev_t chrtoblk(dev) dev_t dev; { diff --git a/sys/arch/i386/i386/db_interface.c b/sys/arch/i386/i386/db_interface.c index 237fcbceaec..e9d0896da94 100644 --- a/sys/arch/i386/i386/db_interface.c +++ b/sys/arch/i386/i386/db_interface.c @@ -1,5 +1,5 @@ -/* $OpenBSD: db_interface.c,v 1.4 1996/04/18 19:18:06 niklas Exp $ */ -/* $NetBSD: db_interface.c,v 1.20 1996/03/15 00:07:18 chuck Exp $ */ +/* $OpenBSD: db_interface.c,v 1.5 1996/04/21 22:16:24 deraadt Exp $ */ +/* $NetBSD: db_interface.c,v 1.21 1996/03/30 07:57:16 mycroft Exp $ */ /* * Mach Operating System @@ -42,12 +42,30 @@ #include <machine/db_machdep.h> extern label_t *db_recover; +extern char *trap_type[]; +extern int trap_types; int db_active = 0; /* + * Print trap reason. + */ +void +kdbprinttrap(type, code) + int type, code; +{ + db_printf("kernel: "); + if (type >= trap_types || type < 0) + db_printf("type %d", type); + else + db_printf("%s", trap_type[type]); + db_printf(" trap, code=%x\n", code); +} + +/* * kdb_trap - field a TRACE or BPT trap */ +int kdb_trap(type, code, regs) int type, code; register db_regs_t *regs; @@ -112,23 +130,6 @@ kdb_trap(type, code, regs) return (1); } -extern char *trap_type[]; -extern int trap_types; - -/* - * Print trap reason. - */ -kdbprinttrap(type, code) - int type, code; -{ - db_printf("kernel: "); - if (type >= trap_types || type < 0) - db_printf("type %d", type); - else - db_printf("%s", trap_type[type]); - db_printf(" trap, code=%x\n", code); -} - /* * Read bytes from kernel address space for debugger. */ diff --git a/sys/arch/i386/i386/disksubr.c b/sys/arch/i386/i386/disksubr.c index 93330cccc01..e8f8d1677c2 100644 --- a/sys/arch/i386/i386/disksubr.c +++ b/sys/arch/i386/i386/disksubr.c @@ -1,5 +1,5 @@ -/* $OpenBSD: disksubr.c,v 1.2 1996/04/18 19:18:07 niklas Exp $ */ -/* $NetBSD: disksubr.c,v 1.19 1996/03/09 20:52:59 ghudson Exp $ */ +/* $OpenBSD: disksubr.c,v 1.3 1996/04/21 22:16:25 deraadt Exp $ */ +/* $NetBSD: disksubr.c,v 1.20 1996/04/03 08:18:27 mycroft Exp $ */ /* * Copyright (c) 1982, 1986, 1988 Regents of the University of California. @@ -223,6 +223,7 @@ done: * Check new disk label for sensibility * before setting it. */ +int setdisklabel(olp, nlp, openmask, osdep) register struct disklabel *olp, *nlp; u_long openmask; @@ -279,6 +280,7 @@ setdisklabel(olp, nlp, openmask, osdep) /* * Write disk label back to device after modification. */ +int writedisklabel(dev, strat, lp, osdep) dev_t dev; void (*strat)(); diff --git a/sys/arch/i386/i386/freebsd_machdep.c b/sys/arch/i386/i386/freebsd_machdep.c index e70fa8e94eb..8ef49795fa9 100644 --- a/sys/arch/i386/i386/freebsd_machdep.c +++ b/sys/arch/i386/i386/freebsd_machdep.c @@ -1,5 +1,5 @@ -/* $OpenBSD: freebsd_machdep.c,v 1.3 1996/04/17 05:18:51 mickey Exp $ */ -/* $NetBSD: freebsd_machdep.c,v 1.7 1996/04/11 07:47:44 mycroft Exp $ */ +/* $OpenBSD: freebsd_machdep.c,v 1.4 1996/04/21 22:16:26 deraadt Exp $ */ +/* $NetBSD: freebsd_machdep.c,v 1.8 1996/04/12 08:44:35 mycroft Exp $ */ /*- * Copyright (c) 1993, 1994, 1995, 1996 Charles M. Hannum. All rights reserved. @@ -123,7 +123,6 @@ freebsd_sendsig(catcher, sig, mask, code) frame.sf_sc.sc_es = tf->tf_vm86_es; frame.sf_sc.sc_ds = tf->tf_vm86_ds; frame.sf_sc.sc_eflags = get_vflags(p); - tf->tf_eflags &= ~PSL_VM; } else #endif { @@ -161,6 +160,7 @@ freebsd_sendsig(catcher, sig, mask, code) tf->tf_eip = (int)(((char *)PS_STRINGS) - (freebsd_esigcode - freebsd_sigcode)); tf->tf_cs = GSEL(GUCODE_SEL, SEL_UPL); + tf->tf_eflags &= ~(PSL_T|PSL_VM); tf->tf_esp = (int)fp; tf->tf_ss = GSEL(GUDATA_SEL, SEL_UPL); } diff --git a/sys/arch/i386/i386/genassym.c b/sys/arch/i386/i386/genassym.c index b3248141382..d3e01c4094d 100644 --- a/sys/arch/i386/i386/genassym.c +++ b/sys/arch/i386/i386/genassym.c @@ -1,4 +1,4 @@ -/* $NetBSD: genassym.c,v 1.46 1996/02/02 19:42:43 mycroft Exp $ */ +/* $NetBSD: genassym.c,v 1.48 1996/03/28 23:44:04 mycroft Exp $ */ /*- * Copyright (c) 1995 Charles M. Hannum. All rights reserved. @@ -68,32 +68,15 @@ #include <i386/isa/isa_machdep.h> #endif +#include <stdio.h> +#include <stddef.h> + +int main() { - struct proc *p = 0; - struct vmmeter *vm = 0; - struct pcb *pcb = 0; - struct trapframe *tf = 0; - struct sigframe *sigf = 0; - struct sigcontext *sc = 0; - struct uprof *uprof = 0; -#if NISA > 0 - struct intrhand *ih = 0; -#endif -#ifdef COMPAT_SVR4 - struct svr4_sigframe *svr4_sigf = 0; - struct svr4_ucontext *svr4_uc = 0; -#endif -#ifdef COMPAT_LINUX - struct linux_sigframe *linux_sigf = 0; - struct linux_sigcontext *linux_sc = 0; -#endif -#ifdef COMPAT_FREEBSD - struct freebsd_sigframe *freebsd_sigf = 0; - struct freebsd_sigcontext *freebsd_sc = 0; -#endif #define def(N,V) printf("#define\t%s %d\n", N, V) +#define off(N,S,M) def(N, (int)offsetof(S, M)) def("SRUN", SRUN); @@ -102,70 +85,70 @@ main() def("NKPDE", NKPDE); def("APTDPTDI", APTDPTDI); - def("VM_MAXUSER_ADDRESS", VM_MAXUSER_ADDRESS); + def("VM_MAXUSER_ADDRESS", (int)VM_MAXUSER_ADDRESS); - def("P_ADDR", &p->p_addr); - def("P_BACK", &p->p_back); - def("P_FORW", &p->p_forw); - def("P_PRIORITY", &p->p_priority); - def("P_STAT", &p->p_stat); - def("P_WCHAN", &p->p_wchan); - def("P_VMSPACE", &p->p_vmspace); - def("P_FLAG", &p->p_flag); + off("P_ADDR", struct proc, p_addr); + off("P_BACK", struct proc, p_back); + off("P_FORW", struct proc, p_forw); + off("P_PRIORITY", struct proc, p_priority); + off("P_STAT", struct proc, p_stat); + off("P_WCHAN", struct proc, p_wchan); + off("P_VMSPACE", struct proc, p_vmspace); + off("P_FLAG", struct proc, p_flag); def("P_SYSTEM", P_SYSTEM); - def("V_TRAP", &vm->v_trap); - def("V_INTR", &vm->v_intr); + off("V_TRAP", struct vmmeter, v_trap); + off("V_INTR", struct vmmeter, v_intr); - def("PCB_CR3", &pcb->pcb_cr3); - def("PCB_EBP", &pcb->pcb_ebp); - def("PCB_ESP", &pcb->pcb_esp); - def("PCB_FS", &pcb->pcb_fs); - def("PCB_GS", &pcb->pcb_gs); - def("PCB_CR0", &pcb->pcb_cr0); - def("PCB_LDT_SEL", &pcb->pcb_ldt_sel); - def("PCB_TSS_SEL", &pcb->pcb_tss_sel); - def("PCB_ONFAULT", &pcb->pcb_onfault); + off("PCB_CR3", struct pcb, pcb_cr3); + off("PCB_EBP", struct pcb, pcb_ebp); + off("PCB_ESP", struct pcb, pcb_esp); + off("PCB_FS", struct pcb, pcb_fs); + off("PCB_GS", struct pcb, pcb_gs); + off("PCB_CR0", struct pcb, pcb_cr0); + off("PCB_LDT_SEL", struct pcb, pcb_ldt_sel); + off("PCB_TSS_SEL", struct pcb, pcb_tss_sel); + off("PCB_ONFAULT", struct pcb, pcb_onfault); - def("TF_CS", &tf->tf_cs); - def("TF_TRAPNO", &tf->tf_trapno); - def("TF_EFLAGS", &tf->tf_eflags); + off("TF_CS", struct trapframe, tf_cs); + off("TF_TRAPNO", struct trapframe, tf_trapno); + off("TF_EFLAGS", struct trapframe, tf_eflags); def("FRAMESIZE", sizeof(struct trapframe)); - def("SIGF_HANDLER", &sigf->sf_handler); - def("SIGF_SC", &sigf->sf_sc); - def("SC_FS", &sc->sc_fs); - def("SC_GS", &sc->sc_gs); - def("SC_EFLAGS", &sc->sc_eflags); + off("SIGF_HANDLER", struct sigframe, sf_handler); + off("SIGF_SC", struct sigframe, sf_sc); + off("SC_FS", struct sigcontext, sc_fs); + off("SC_GS", struct sigcontext, sc_gs); + off("SC_EFLAGS", struct sigcontext, sc_eflags); #ifdef COMPAT_SVR4 - def("SVR4_SIGF_HANDLER", &svr4_sigf->sf_handler); - def("SVR4_SIGF_UC", &svr4_sigf->sf_uc); - def("SVR4_UC_FS", &svr4_uc->uc_mcontext.greg[SVR4_X86_FS]); - def("SVR4_UC_GS", &svr4_uc->uc_mcontext.greg[SVR4_X86_GS]); - def("SVR4_UC_EFLAGS", &svr4_uc->uc_mcontext.greg[SVR4_X86_EFL]); + off("SVR4_SIGF_HANDLER", struct svr4_sigframe, sf_handler); + off("SVR4_SIGF_UC", struct svr4_sigframe, sf_uc); + off("SVR4_UC_FS", struct svr4_ucontext, uc_mcontext.greg[SVR4_X86_FS]); + off("SVR4_UC_GS", struct svr4_ucontext, uc_mcontext.greg[SVR4_X86_GS]); + off("SVR4_UC_EFLAGS", struct svr4_ucontext, uc_mcontext.greg[SVR4_X86_EFL]); #endif #ifdef COMPAT_LINUX - def("LINUX_SIGF_HANDLER", &linux_sigf->sf_handler); - def("LINUX_SIGF_SC", &linux_sigf->sf_sc); - def("LINUX_SC_FS", &linux_sc->sc_fs); - def("LINUX_SC_GS", &linux_sc->sc_gs); - def("LINUX_SC_EFLAGS", &linux_sc->sc_eflags); + off("LINUX_SIGF_HANDLER", struct linux_sigframe, sf_handler); + off("LINUX_SIGF_SC", struct linux_sigframe, sf_sc); + off("LINUX_SC_FS", struct linux_sigcontext, sc_fs); + off("LINUX_SC_GS", struct linux_sigcontext, sc_gs); + off("LINUX_SC_EFLAGS", struct linux_sigcontext, sc_eflags); #endif #ifdef COMPAT_FREEBSD - def("FREEBSD_SIGF_HANDLER", &freebsd_sigf->sf_handler); - def("FREEBSD_SIGF_SC", &freebsd_sigf->sf_sc); + off("FREEBSD_SIGF_HANDLER", struct freebsd_sigframe, sf_handler); + off("FREEBSD_SIGF_SC", struct freebsd_sigframe, sf_sc); #endif #if NISA > 0 - def("IH_FUN", &ih->ih_fun); - def("IH_ARG", &ih->ih_arg); - def("IH_COUNT", &ih->ih_count); - def("IH_NEXT", &ih->ih_next); + off("IH_FUN", struct intrhand, ih_fun); + off("IH_ARG", struct intrhand, ih_arg); + off("IH_COUNT", struct intrhand, ih_count); + off("IH_NEXT", struct intrhand, ih_next); #endif exit(0); diff --git a/sys/arch/i386/i386/linux_machdep.c b/sys/arch/i386/i386/linux_machdep.c index 77614ab9b46..67d22c8a819 100644 --- a/sys/arch/i386/i386/linux_machdep.c +++ b/sys/arch/i386/i386/linux_machdep.c @@ -1,5 +1,5 @@ -/* $OpenBSD: linux_machdep.c,v 1.5 1996/04/18 19:18:09 niklas Exp $ */ -/* $NetBSD: linux_machdep.c,v 1.26 1996/04/11 07:47:45 mycroft Exp $ */ +/* $OpenBSD: linux_machdep.c,v 1.6 1996/04/21 22:16:28 deraadt Exp $ */ +/* $NetBSD: linux_machdep.c,v 1.27 1996/04/12 08:44:37 mycroft Exp $ */ /* * Copyright (c) 1995 Frank van der Linden @@ -136,7 +136,6 @@ linux_sendsig(catcher, sig, mask, code) frame.sf_sc.sc_es = tf->tf_vm86_es; frame.sf_sc.sc_ds = tf->tf_vm86_ds; frame.sf_sc.sc_eflags = get_vflags(p); - tf->tf_eflags &= ~PSL_VM; } else #endif { @@ -177,6 +176,7 @@ linux_sendsig(catcher, sig, mask, code) tf->tf_eip = (int)(((char *)PS_STRINGS) - (linux_esigcode - linux_sigcode)); tf->tf_cs = GSEL(GUCODE_SEL, SEL_UPL); + tf->tf_eflags &= ~(PSL_T|PSL_VM); tf->tf_esp = (int)fp; tf->tf_ss = GSEL(GUDATA_SEL, SEL_UPL); } diff --git a/sys/arch/i386/i386/locore.s b/sys/arch/i386/i386/locore.s index d68944b52b9..e7af2889ce0 100644 --- a/sys/arch/i386/i386/locore.s +++ b/sys/arch/i386/i386/locore.s @@ -1,7 +1,5 @@ -/* $NetBSD: locore.s,v 1.143 1996/02/02 02:36:40 mycroft Exp $ */ +/* $NetBSD: locore.s,v 1.144 1996/04/03 05:48:35 mycroft Exp $ */ -#undef DIAGNOSTIC -#define DIAGNOSTIC /*- * Copyright (c) 1993, 1994, 1995 Charles M. Hannum. All rights reserved. * Copyright (c) 1990 The Regents of the University of California. diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index f0afbdc07e3..e3bdb4ad24b 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,8 +1,8 @@ -/* $OpenBSD: machdep.c,v 1.12 1996/04/18 19:18:11 niklas Exp $ */ -/* $NetBSD: machdep.c,v 1.194 1996/03/08 20:19:48 cgd Exp $ */ +/* $OpenBSD: machdep.c,v 1.13 1996/04/21 22:16:31 deraadt Exp $ */ +/* $NetBSD: machdep.c,v 1.197 1996/04/12 08:44:40 mycroft Exp $ */ /*- - * Copyright (c) 1993, 1994, 1995 Charles M. Hannum. All rights reserved. + * Copyright (c) 1993, 1994, 1995, 1996 Charles M. Hannum. All rights reserved. * Copyright (c) 1992 Terrence R. Lambert. * Copyright (c) 1982, 1987, 1990 The Regents of the University of California. * All rights reserved. @@ -136,6 +136,7 @@ extern vm_offset_t avail_start, avail_end; static vm_offset_t hole_start, hole_end; static vm_offset_t avail_next; +void identifycpu __P((void)); caddr_t allocsys __P((caddr_t)); void dumpsys __P((void)); void cpu_reset __P((void)); @@ -567,7 +568,6 @@ sendsig(catcher, sig, mask, code) frame.sf_sc.sc_es = tf->tf_vm86_es; frame.sf_sc.sc_ds = tf->tf_vm86_ds; frame.sf_sc.sc_eflags = get_vflags(p); - tf->tf_eflags &= ~PSL_VM; } else #endif { @@ -607,6 +607,7 @@ sendsig(catcher, sig, mask, code) tf->tf_ds = GSEL(GUDATA_SEL, SEL_UPL); tf->tf_eip = (int)(((char *)PS_STRINGS) - (esigcode - sigcode)); tf->tf_cs = GSEL(GUCODE_SEL, SEL_UPL); + tf->tf_eflags &= ~(PSL_T|PSL_VM); tf->tf_esp = (int)fp; tf->tf_ss = GSEL(GUDATA_SEL, SEL_UPL); } @@ -690,6 +691,12 @@ sys_sigreturn(p, v, retval) p->p_sigacts->ps_sigstk.ss_flags &= ~SS_ONSTACK; p->p_sigmask = context.sc_mask & ~sigcantmask; + if (context.sc_onstack & 01) + p->p_sigacts->ps_sigstk.ss_flags |= SS_ONSTACK; + else + p->p_sigacts->ps_sigstk.ss_flags &= ~SS_ONSTACK; + p->p_sigmask = context.sc_mask & ~sigcantmask; + return (EJUSTRETURN); } diff --git a/sys/arch/i386/i386/mainbus.c b/sys/arch/i386/i386/mainbus.c index e1a844230f4..5de4b476180 100644 --- a/sys/arch/i386/i386/mainbus.c +++ b/sys/arch/i386/i386/mainbus.c @@ -1,5 +1,5 @@ -/* $OpenBSD: mainbus.c,v 1.1 1996/04/18 19:18:11 niklas Exp $ */ -/* $NetBSD: mainbus.c,v 1.4 1996/03/14 02:37:28 cgd Exp $ */ +/* $OpenBSD: mainbus.c,v 1.2 1996/04/21 22:16:32 deraadt Exp $ */ +/* $NetBSD: mainbus.c,v 1.8 1996/04/11 22:13:37 cgd Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. @@ -37,24 +37,25 @@ #include <machine/bus.h> -#if 0 /* XXX eisavar.h includes isavar.h, which is not idempotent */ #include <dev/isa/isavar.h> -#endif #include <dev/eisa/eisavar.h> #include <dev/pci/pcivar.h> -#include <dev/isa/isareg.h> +#include <dev/isa/isareg.h> /* for ISA_HOLE_VADDR */ #include <i386/isa/isa_machdep.h> -#include <i386/eisa/eisa_machdep.h> #include "pci.h" int mainbus_match __P((struct device *, void *, void *)); void mainbus_attach __P((struct device *, struct device *, void *)); -struct cfdriver mainbuscd = - { NULL, "mainbus", mainbus_match, mainbus_attach, - DV_DULL, sizeof(struct device) }; +struct cfattach mainbus_ca = { + sizeof(struct device), mainbus_match, mainbus_attach +}; + +struct cfdriver mainbus_cd = { + NULL, "mainbus", DV_DULL +}; int mainbus_print __P((void *, char *)); @@ -89,6 +90,20 @@ mainbus_attach(parent, self, aux) printf("\n"); + if (1 /* XXX ISA NOT YET SEEN */) { + mba.mba_iba.iba_busname = "isa"; + mba.mba_iba.iba_bc = NULL; + mba.mba_iba.iba_ic = NULL; + config_found(self, &mba.mba_iba, mainbus_print); + } + + if (!bcmp(ISA_HOLE_VADDR(EISA_ID_PADDR), EISA_ID, EISA_ID_LEN)) { + mba.mba_eba.eba_busname = "eisa"; + mba.mba_eba.eba_bc = NULL; + mba.mba_eba.eba_ec = NULL; + config_found(self, &mba.mba_eba, mainbus_print); + } + /* * XXX Note also that the presence of a PCI bus should * XXX _always_ be checked, and if present the bus should be @@ -104,17 +119,6 @@ mainbus_attach(parent, self, aux) } #endif - if (!bcmp(ISA_HOLE_VADDR(EISA_ID_PADDR), EISA_ID, EISA_ID_LEN)) { - mba.mba_eba.eba_busname = "eisa"; - mba.mba_eba.eba_bc = NULL; - config_found(self, &mba.mba_eba, mainbus_print); - } - - if (1 /* XXX ISA NOT YET SEEN */) { - mba.mba_iba.iba_busname = "isa"; - mba.mba_iba.iba_bc = NULL; - config_found(self, &mba.mba_iba, mainbus_print); - } } int diff --git a/sys/arch/i386/i386/pmap.c b/sys/arch/i386/i386/pmap.c index f86282728de..fbc1e161d44 100644 --- a/sys/arch/i386/i386/pmap.c +++ b/sys/arch/i386/i386/pmap.c @@ -1,5 +1,5 @@ -/* $OpenBSD: pmap.c,v 1.7 1996/04/18 04:04:54 mickey Exp $ */ -/* $NetBSD: pmap.c,v 1.34 1995/12/09 07:39:02 mycroft Exp $ */ +/* $OpenBSD: pmap.c,v 1.8 1996/04/21 22:16:33 deraadt Exp $ */ +/* $NetBSD: pmap.c,v 1.35 1996/04/03 08:21:05 mycroft Exp $ */ /* * Copyright (c) 1993, 1994, 1995 Charles M. Hannum. All rights reserved. @@ -183,6 +183,7 @@ int pv_nfree; void i386_protection_init __P((void)); pt_entry_t *pmap_pte __P((pmap_t, vm_offset_t)); +void i386_protection_init __P((void)); #if BSDVM_COMPAT #include <sys/msgbuf.h> diff --git a/sys/arch/i386/i386/pmap.old.c b/sys/arch/i386/i386/pmap.old.c index d80d5e0781d..f9e2ecca669 100644 --- a/sys/arch/i386/i386/pmap.old.c +++ b/sys/arch/i386/i386/pmap.old.c @@ -1,5 +1,5 @@ -/* $OpenBSD: pmap.old.c,v 1.7 1996/04/18 04:04:54 mickey Exp $ */ -/* $NetBSD: pmap.c,v 1.34 1995/12/09 07:39:02 mycroft Exp $ */ +/* $OpenBSD: pmap.old.c,v 1.8 1996/04/21 22:16:33 deraadt Exp $ */ +/* $NetBSD: pmap.c,v 1.35 1996/04/03 08:21:05 mycroft Exp $ */ /* * Copyright (c) 1993, 1994, 1995 Charles M. Hannum. All rights reserved. @@ -183,6 +183,7 @@ int pv_nfree; void i386_protection_init __P((void)); pt_entry_t *pmap_pte __P((pmap_t, vm_offset_t)); +void i386_protection_init __P((void)); #if BSDVM_COMPAT #include <sys/msgbuf.h> diff --git a/sys/arch/i386/i386/process_machdep.c b/sys/arch/i386/i386/process_machdep.c index fa5859c60e0..77f72d55bc4 100644 --- a/sys/arch/i386/i386/process_machdep.c +++ b/sys/arch/i386/i386/process_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: process_machdep.c,v 1.3 1996/04/17 05:18:56 mickey Exp $ */ +/* $OpenBSD: process_machdep.c,v 1.4 1996/04/21 22:16:34 deraadt Exp $ */ /* $NetBSD: process_machdep.c,v 1.21 1996/04/11 07:47:48 mycroft Exp $ */ /* @@ -191,13 +191,6 @@ process_write_regs(p, regs) #define valid_sel(sel) (ISPL(sel) == SEL_UPL && verr(sel)) #define null_sel(sel) (!ISLDT(sel) && IDXSEL(sel) == 0) - /* - * Check for security violations. - */ - if (((regs->r_eflags ^ tf->tf_eflags) & PSL_USERSTATIC) != 0 || - !USERMODE(regs->r_cs, regs->r_eflags)) - return (EINVAL); - if ((regs->r_gs != pcb->pcb_gs && \ !valid_sel(regs->r_gs) && !null_sel(regs->r_gs)) || (regs->r_fs != pcb->pcb_fs && \ diff --git a/sys/arch/i386/i386/rd_root.c b/sys/arch/i386/i386/rd_root.c new file mode 100644 index 00000000000..4120f4641a6 --- /dev/null +++ b/sys/arch/i386/i386/rd_root.c @@ -0,0 +1,79 @@ +/* $NetBSD: rd_root.c,v 1.2 1996/03/27 16:38:33 perry Exp $ */ + +/* + * Copyright (c) 1995 Gordon W. Ross + * 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. 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. + */ + +#include <sys/param.h> +#include <sys/reboot.h> + +#include <dev/ramdisk.h> + +extern int boothowto; + +#ifndef MINIROOTSIZE +#define MINIROOTSIZE 512 +#endif + +#define ROOTBYTES (MINIROOTSIZE << DEV_BSHIFT) + +/* + * This array will be patched to contain a file-system image. + * See the program: src/distrib/sun3/common/rdsetroot.c + */ +int rd_root_size = ROOTBYTES; +char rd_root_image[ROOTBYTES] = "|This is the root ramdisk!\n"; + +/* + * This is called during autoconfig. + */ +void +rd_attach_hook(unit, rd) + int unit; + struct rd_conf *rd; +{ + if (unit == 0) { + /* Setup root ramdisk */ + rd->rd_addr = (caddr_t) rd_root_image; + rd->rd_size = (size_t) rd_root_size; + rd->rd_type = RD_KMEM_FIXED; + printf(" fixed, %d blocks", MINIROOTSIZE); + } +} + +/* + * This is called during open (i.e. mountroot) + */ +void +rd_open_hook(unit, rd) + int unit; + struct rd_conf *rd; +{ + if (unit == 0) { + /* The root ramdisk only works single-user. */ + boothowto |= RB_SINGLE; + } +} diff --git a/sys/arch/i386/i386/svr4_machdep.c b/sys/arch/i386/i386/svr4_machdep.c index 6d5851c4e34..479bf8d0fd1 100644 --- a/sys/arch/i386/i386/svr4_machdep.c +++ b/sys/arch/i386/i386/svr4_machdep.c @@ -1,5 +1,5 @@ -/* $OpenBSD: svr4_machdep.c,v 1.3 1996/04/17 05:18:57 mickey Exp $ */ -/* $NetBSD: svr4_machdep.c,v 1.21 1996/04/11 07:47:50 mycroft Exp $ */ +/* $OpenBSD: svr4_machdep.c,v 1.4 1996/04/21 22:16:38 deraadt Exp $ */ +/* $NetBSD: svr4_machdep.c,v 1.22 1996/04/12 08:44:42 mycroft Exp $ */ /* * Copyright (c) 1994 Christos Zoulas @@ -82,7 +82,6 @@ svr4_getcontext(p, uc, mask, oonstack) r[SVR4_X86_ES] = tf->tf_vm86_es; r[SVR4_X86_DS] = tf->tf_vm86_ds; r[SVR4_X86_EFL] = get_vflags(p); - tf->tf_eflags &= ~PSL_VM; } else #endif { @@ -376,15 +375,13 @@ svr4_sendsig(catcher, sig, mask, code) /* * Build context to run handler in. */ - tf->tf_esp = (int)fp; + tf->tf_es = GSEL(GUDATA_SEL, SEL_UPL); + tf->tf_ds = GSEL(GUDATA_SEL, SEL_UPL); tf->tf_eip = (int)(((char *)PS_STRINGS) - - (svr4_esigcode - svr4_sigcode)); -#ifdef VM86 - tf->tf_eflags &= ~PSL_VM; -#endif + (svr4_esigcode - svr4_sigcode)); tf->tf_cs = GSEL(GUCODE_SEL, SEL_UPL); - tf->tf_ds = GSEL(GUDATA_SEL, SEL_UPL); - tf->tf_es = GSEL(GUDATA_SEL, SEL_UPL); + tf->tf_eflags &= ~(PSL_T|PSL_VM); + tf->tf_esp = (int)fp; tf->tf_ss = GSEL(GUDATA_SEL, SEL_UPL); } diff --git a/sys/arch/i386/i386/swapgeneric.c b/sys/arch/i386/i386/swapgeneric.c index b67fcd7742a..cdacbffb6b0 100644 --- a/sys/arch/i386/i386/swapgeneric.c +++ b/sys/arch/i386/i386/swapgeneric.c @@ -1,5 +1,5 @@ -/* $OpenBSD: swapgeneric.c,v 1.3 1996/04/18 19:18:12 niklas Exp $ */ -/* $NetBSD: swapgeneric.c,v 1.9 1994/11/04 09:57:52 mycroft Exp $ */ +/* $OpenBSD: swapgeneric.c,v 1.4 1996/04/21 22:16:39 deraadt Exp $ */ +/* $NetBSD: swapgeneric.c,v 1.11 1996/04/03 09:15:26 mycroft Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -55,8 +55,6 @@ #include "cd.h" #include "mcd.h" -void gets __P((char *)); - /* * Generic configuration; all in one */ @@ -72,19 +70,19 @@ long dumplo; int dmmin, dmmax, dmtext; #if NWDC > 0 -extern struct cfdriver wdcd; +extern struct cfdriver wd_cd; #endif #if NFDC > 0 -extern struct cfdriver fdcd; +extern struct cfdriver fd_cd; #endif #if NSD > 0 -extern struct cfdriver sdcd; +extern struct cfdriver sd_cd; #endif #if NCD > 0 -extern struct cfdriver cdcd; +extern struct cfdriver cd_cd; #endif #if NMCD > 0 -extern struct cfdriver mcdcd; +extern struct cfdriver mcd_cd; #endif struct genericconf { @@ -93,19 +91,19 @@ struct genericconf { dev_t gc_major; } genericconf[] = { #if NWDC > 0 - { &wdcd, "wd", 0 }, + { &wd_cd, "wd", 0 }, #endif #if NSD > 0 - { &sdcd, "sd", 4 }, + { &sd_cd, "sd", 4 }, #endif #if NCD > 0 - { &cdcd, "cd", 6 }, + { &cd_cd, "cd", 6 }, #endif #if NMCD > 0 - { &mcdcd, "mcd", 7 }, + { &mcd_cd, "mcd", 7 }, #endif #if NFDC > 0 - { &fdcd, "fd", 2 }, + { &fd_cd, "fd", 2 }, #endif { 0 } }; @@ -113,6 +111,8 @@ struct genericconf { extern int ffs_mountroot(); int (*mountroot)() = ffs_mountroot; +void gets __P((char *)); + void setconf() { diff --git a/sys/arch/i386/i386/trap.c b/sys/arch/i386/i386/trap.c index 098d277d154..b9a43121e5d 100644 --- a/sys/arch/i386/i386/trap.c +++ b/sys/arch/i386/i386/trap.c @@ -1,5 +1,5 @@ -/* $OpenBSD: trap.c,v 1.6 1996/03/19 21:09:23 mickey Exp $ */ -/* $NetBSD: trap.c,v 1.92 1996/01/08 13:51:38 mycroft Exp $ */ +/* $OpenBSD: trap.c,v 1.7 1996/04/21 22:16:40 deraadt Exp $ */ +/* $NetBSD: trap.c,v 1.93 1996/04/15 00:20:32 mycroft Exp $ */ #undef DEBUG #define DEBUG @@ -413,8 +413,11 @@ trap(frame) map, va, ftype, rv); goto we_re_toast; } - trapsignal(p, (rv == KERN_PROTECTION_FAILURE) - ? SIGBUS : SIGSEGV, T_PAGEFLT); + trapsignal(p, (rv == KERN_PROTECTION_FAILURE +#ifdef COMPAT_LINUX + && p->p_emul != &emul_linux_aout && p->p_emul != &emul_linux_elf +#endif + ) ? SIGBUS : SIGSEGV, T_PAGEFLT); break; } @@ -428,7 +431,6 @@ trap(frame) case T_BPTFLT|T_USER: /* bpt instruction fault */ case T_TRCTRAP|T_USER: /* trace trap */ trace: - frame.tf_eflags &= ~PSL_T; trapsignal(p, SIGTRAP, type &~ T_USER); break; diff --git a/sys/arch/i386/i386/vm86.c b/sys/arch/i386/i386/vm86.c index 5e254490af6..9ce1c9db6da 100644 --- a/sys/arch/i386/i386/vm86.c +++ b/sys/arch/i386/i386/vm86.c @@ -1,5 +1,5 @@ -/* $OpenBSD: vm86.c,v 1.3 1996/04/18 19:18:13 niklas Exp $ */ -/* $NetBSD: vm86.c,v 1.8 1996/04/11 10:07:17 mycroft Exp $ */ +/* $OpenBSD: vm86.c,v 1.4 1996/04/21 22:16:42 deraadt Exp $ */ +/* $NetBSD: vm86.c,v 1.9 1996/04/12 05:57:43 mycroft Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -74,9 +74,10 @@ static void fast_intxx __P((struct proc *, int)); -#define CS(tf) (*(u_short *)&tf->tf_cs) +#define SETDIRECT ((~(PSL_USERSTATIC|PSL_NT)) & 0xffff) +#define GETDIRECT (SETDIRECT|0x02a) /* add in two MBZ bits */ + #define IP(tf) (*(u_short *)&tf->tf_eip) -#define SS(tf) (*(u_short *)&tf->tf_ss) #define SP(tf) (*(u_short *)&tf->tf_esp) @@ -383,10 +384,11 @@ i386_vm86(p, args, retval) struct trapframe *tf = p->p_md.md_regs; struct pcb *pcb = &p->p_addr->u_pcb; struct vm86_kern vm86s; - int err; + int error; - if (err = copyin(args, &vm86s, sizeof(vm86s))) - return err; + error = copyin(args, &vm86s, sizeof(vm86s)); + if (error) + return (error); pcb->vm86_userp = (void *)args; @@ -398,18 +400,19 @@ i386_vm86(p, args, retval) case VCPU_086: case VCPU_186: case VCPU_286: - pcb->vm86_flagmask = 0; + pcb->vm86_flagmask = PSL_ID|PSL_AC|PSL_NT|PSL_IOPL; break; case VCPU_386: - pcb->vm86_flagmask = PSL_NT|PSL_IOPL; + pcb->vm86_flagmask = PSL_ID|PSL_AC; break; case VCPU_486: - pcb->vm86_flagmask = PSL_AC|PSL_NT|PSL_IOPL; + pcb->vm86_flagmask = PSL_ID; break; case VCPU_586: - default: - pcb->vm86_flagmask = PSL_ID|PSL_AC|PSL_NT|PSL_IOPL; + pcb->vm86_flagmask = 0; break; + default: + return (EINVAL); } #define DOVREG(reg) tf->tf_vm86_##reg = (u_short) vm86s.regs.vmsc.sc_##reg diff --git a/sys/arch/i386/i386/vm_machdep.c b/sys/arch/i386/i386/vm_machdep.c index f333c02f46c..2a58bd72ec2 100644 --- a/sys/arch/i386/i386/vm_machdep.c +++ b/sys/arch/i386/i386/vm_machdep.c @@ -1,5 +1,5 @@ -/* $OpenBSD: vm_machdep.c,v 1.8 1996/04/17 05:19:00 mickey Exp $ */ -/* $NetBSD: vm_machdep.c,v 1.58 1996/02/05 02:00:35 christos Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.9 1996/04/21 22:16:43 deraadt Exp $ */ +/* $NetBSD: vm_machdep.c,v 1.59 1996/04/03 08:24:17 mycroft Exp $ */ /*- * Copyright (c) 1995 Charles M. Hannum. All rights reserved. @@ -259,6 +259,7 @@ cpu_coredump(p, vp, cred, chdr) return 0; } +#if 0 /* * Set a red zone in the kernel stack after the u. area. */ @@ -276,6 +277,7 @@ setredzone(pte, vaddr) used by sched (that has physical memory mapped 1:1 at bottom) and take the dump while still in mapped mode */ } +#endif /* * Move pages from one kernel virtual address to another. diff --git a/sys/arch/i386/include/bus.h b/sys/arch/i386/include/bus.h index fcf4e90771b..09947ebf54e 100644 --- a/sys/arch/i386/include/bus.h +++ b/sys/arch/i386/include/bus.h @@ -1,5 +1,5 @@ -/* $OpenBSD: bus.h,v 1.1 1996/04/18 19:21:33 niklas Exp $ */ -/* $NetBSD: bus.h,v 1.1 1996/03/08 20:11:23 cgd Exp $ */ +/* $OpenBSD: bus.h,v 1.2 1996/04/21 22:16:46 deraadt Exp $ */ +/* $NetBSD: bus.h,v 1.2 1996/04/05 23:59:37 thorpej Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. @@ -66,6 +66,17 @@ typedef caddr_t bus_mem_handle_t; #define bus_io_read_8(t, h, o) !!! bus_io_read_8 unimplemented !!! #endif +#define bus_io_read_multi_1(t, h, o, a, c) \ + insb((h) + (o), (a), (c)) +#define bus_io_read_multi_2(t, h, o, a, c) \ + insw((h) + (o), (a), (c)) +#define bus_io_read_multi_4(t, h, o, a, c) \ + insl((h) + (o), (a), (c)) +#if 0 /* Cause a link error for bus_io_read_multi_8 */ +#define bus_io_read_multi_8(t, h, o, a, c) \ + !!! bus_io_read_multi_8 unimplemented !!! +#endif + #define bus_io_write_1(t, h, o, v) outb((h) + (o), (v)) #define bus_io_write_2(t, h, o, v) outw((h) + (o), (v)) #define bus_io_write_4(t, h, o, v) outl((h) + (o), (v)) @@ -73,6 +84,17 @@ typedef caddr_t bus_mem_handle_t; #define bus_io_write_8(t, h, o, v) !!! bus_io_write_8 unimplemented !!! #endif +#define bus_io_write_multi_1(t, h, o, a, c) \ + outsb((h) + (o), (a), (c)) +#define bus_io_write_multi_2(t, h, o, a, c) \ + outsw((h) + (o), (a), (c)) +#define bus_io_write_multi_4(t, h, o, a, c) \ + outsl((h) + (o), (a), (c)) +#if 0 /* Cause a link error for bus_io_write_multi_8 */ +#define bus_io_write_multi_8(t, h, o, a, c) \ + !!! bus_io_write_multi_8 unimplimented !!! +#endif + int bus_mem_map __P((bus_chipset_tag_t t, bus_mem_addr_t bpa, bus_mem_size_t size, int cacheable, bus_mem_handle_t *mhp)); void bus_mem_unmap __P((bus_chipset_tag_t t, bus_mem_handle_t memh, diff --git a/sys/arch/i386/include/cpu.h b/sys/arch/i386/include/cpu.h index 00e3ed0de3c..373fc86995a 100644 --- a/sys/arch/i386/include/cpu.h +++ b/sys/arch/i386/include/cpu.h @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.32 1995/12/24 01:08:02 mycroft Exp $ */ +/* $NetBSD: cpu.h,v 1.33 1996/03/29 00:23:28 mycroft Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -93,6 +93,7 @@ int want_resched; /* resched() was called */ * We need a machine-independent name for this. */ #define DELAY(x) delay(x) +void delay __P((int)); #ifdef I586_CPU /* diff --git a/sys/arch/i386/include/joystick.h b/sys/arch/i386/include/joystick.h index b73fa5c91d7..464777c97eb 100644 --- a/sys/arch/i386/include/joystick.h +++ b/sys/arch/i386/include/joystick.h @@ -1,3 +1,26 @@ +/* $NetBSD: joystick.h,v 1.1 1996/03/27 19:18:56 perry Exp $ */ + +#ifndef _JOY_IOCTL_H_ +#define _JOY_IOCTL_H_ + +#include <sys/types.h> +#include <sys/ioctl.h> + +struct joystick { + int x; + int y; + int b1; + int b2; +}; + +#define JOY_SETTIMEOUT _IOW('J', 1, int) /* set timeout */ +#define JOY_GETTIMEOUT _IOR('J', 2, int) /* get timeout */ +#define JOY_SET_X_OFFSET _IOW('J', 3, int) /* set offset on X-axis */ +#define JOY_SET_Y_OFFSET _IOW('J', 4, int) /* set offset on X-axis */ +#define JOY_GET_X_OFFSET _IOR('J', 5, int) /* get offset on X-axis */ +#define JOY_GET_Y_OFFSET _IOR('J', 6, int) /* get offset on Y-axis */ + +#endif /* _JOY_IOCTL_H_ */ #ifndef _JOY_IOCTL_H_ #define _JOY_IOCTL_H_ diff --git a/sys/arch/i386/include/vm86.h b/sys/arch/i386/include/vm86.h index 67a584be27e..6adc36548a0 100644 --- a/sys/arch/i386/include/vm86.h +++ b/sys/arch/i386/include/vm86.h @@ -1,5 +1,5 @@ -/* $OpenBSD: vm86.h,v 1.3 1996/04/18 19:21:42 niklas Exp $ */ -/* $NetBSD: vm86.h,v 1.4 1996/04/11 10:07:25 mycroft Exp $ */ +/* $OpenBSD: vm86.h,v 1.4 1996/04/21 22:16:48 deraadt Exp $ */ +/* $NetBSD: vm86.h,v 1.5 1996/04/12 05:57:45 mycroft Exp $ */ #define VM86_USE_VIF @@ -52,6 +52,9 @@ #define VM86_SETDIRECT (~PSL_USERSTATIC) #define VM86_GETDIRECT (VM86_SETDIRECT|PSL_MBO|PSL_MBZ) +#define VM86_SETDIRECT (~PSL_USERSTATIC) +#define VM86_GETDIRECT (VM86_SETDIRECT|PSL_MBO|PSL_MBZ) + struct vm86_regs { struct sigcontext vmsc; }; @@ -124,7 +127,8 @@ set_vflags(p, flags) struct trapframe *tf = p->p_md.md_regs; struct pcb *pcb = &p->p_addr->u_pcb; - SETFLAGS(pcb->vm86_eflags, flags, pcb->vm86_flagmask | ~VM86_GETDIRECT); + flags &= ~pcb->vm86_flagmask; + SETFLAGS(pcb->vm86_eflags, flags, ~VM86_GETDIRECT); SETFLAGS(tf->tf_eflags, flags, VM86_SETDIRECT); #ifndef VM86_USE_VIF if ((pcb->vm86_eflags & (PSL_I|PSL_VIP)) == (PSL_I|PSL_VIP)) @@ -142,7 +146,7 @@ get_vflags(p) struct pcb *pcb = &p->p_addr->u_pcb; int flags = 0; - SETFLAGS(flags, pcb->vm86_eflags, pcb->vm86_flagmask | ~VM86_GETDIRECT); + SETFLAGS(flags, pcb->vm86_eflags, ~VM86_GETDIRECT); SETFLAGS(flags, tf->tf_eflags, VM86_GETDIRECT); return (flags); } @@ -155,7 +159,8 @@ set_vflags_short(p, flags) struct trapframe *tf = p->p_md.md_regs; struct pcb *pcb = &p->p_addr->u_pcb; - SETFLAGS(pcb->vm86_eflags, flags, (pcb->vm86_flagmask | ~VM86_GETDIRECT) & 0xffff); + flags &= ~pcb->vm86_flagmask; + SETFLAGS(pcb->vm86_eflags, flags, ~VM86_GETDIRECT & 0xffff); SETFLAGS(tf->tf_eflags, flags, VM86_SETDIRECT & 0xffff); #ifndef VM86_USE_VIF if ((pcb->vm86_eflags & (PSL_I|PSL_VIP)) == (PSL_I|PSL_VIP)) @@ -171,7 +176,7 @@ get_vflags_short(p) struct pcb *pcb = &p->p_addr->u_pcb; int flags = 0; - SETFLAGS(flags, pcb->vm86_eflags, (pcb->vm86_flagmask | ~VM86_GETDIRECT) & 0xffff); + SETFLAGS(flags, pcb->vm86_eflags, ~VM86_GETDIRECT & 0xffff); SETFLAGS(flags, tf->tf_eflags, VM86_GETDIRECT & 0xffff); return (flags); } diff --git a/sys/arch/i386/isa/clock.c b/sys/arch/i386/isa/clock.c index 4c170d56137..8d099499732 100644 --- a/sys/arch/i386/isa/clock.c +++ b/sys/arch/i386/isa/clock.c @@ -1,4 +1,4 @@ -/* $NetBSD: clock.c,v 1.35 1995/12/24 02:30:07 mycroft Exp $ */ +/* $NetBSD: clock.c,v 1.37 1996/04/11 22:15:13 cgd Exp $ */ /*- * Copyright (c) 1993, 1994 Charles Hannum. @@ -106,6 +106,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <i386/isa/spkrreg.h> void spinwait __P((int)); +void findcpuspeed __P((void)); #ifdef I586_CPU int pentium_mhz; @@ -287,6 +288,8 @@ sysbeep(pitch, period) unsigned int delaycount; /* calibrated loop variable (1 millisecond) */ #define FIRST_GUESS 0x2000 + +void findcpuspeed() { int i; @@ -328,7 +331,8 @@ cpu_initclocks() * XXX If you're doing strange things with multiple clocks, you might * want to keep track of clock handlers. */ - (void)isa_intr_establish(0, IST_PULSE, IPL_CLOCK, clockintr, 0, "clock"); + (void)isa_intr_establish(NULL, 0, IST_PULSE, IPL_CLOCK, clockintr, + 0, "clock"); } void diff --git a/sys/arch/i386/isa/fd.c b/sys/arch/i386/isa/fd.c index 45564bd20b9..a7b07df07c7 100644 --- a/sys/arch/i386/isa/fd.c +++ b/sys/arch/i386/isa/fd.c @@ -1,5 +1,5 @@ -/* $OpenBSD: fd.c,v 1.12 1996/04/18 17:12:13 niklas Exp $ */ -/* $NetBSD: fd.c,v 1.85 1996/03/04 04:01:03 mycroft Exp $ */ +/* $OpenBSD: fd.c,v 1.13 1996/04/21 22:16:52 deraadt Exp $ */ +/* $NetBSD: fd.c,v 1.87 1996/04/11 22:15:16 cgd Exp $ */ /*- * Copyright (c) 1993, 1994, 1995 Charles Hannum. @@ -112,8 +112,12 @@ void fdcforceintr __P((void *)); #endif void fdcattach __P((struct device *, struct device *, void *)); -struct cfdriver fdccd = { - NULL, "fdc", fdcprobe, fdcattach, DV_DULL, sizeof(struct fdc_softc) +struct cfattach fdc_ca = { + sizeof(struct fdc_softc), fdcprobe, fdcattach +}; + +struct cfdriver fdc_cd = { + NULL, "fdc", DV_DULL }; /* @@ -179,8 +183,12 @@ struct fd_softc { int fdprobe __P((struct device *, void *, void *)); void fdattach __P((struct device *, struct device *, void *)); -struct cfdriver fdcd = { - NULL, "fd", fdprobe, fdattach, DV_DISK, sizeof(struct fd_softc) +struct cfattach fd_ca = { + sizeof(struct fd_softc), fdprobe, fdattach +}; + +struct cfdriver fd_cd = { + NULL, "fd", DV_DISK }; void fdgetdisklabel __P((struct fd_softc *)); @@ -308,8 +316,8 @@ fdcattach(parent, self, aux) at_setup_dmachan(fdc->sc_drq, FDC_MAXIOSIZE); isa_establish(&fdc->sc_id, &fdc->sc_dev); #endif - fdc->sc_ih = isa_intr_establish(ia->ia_irq, IST_EDGE, IPL_BIO, fdcintr, - fdc, fdc->sc_dev.dv_xname); + fdc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, + IPL_BIO, fdcintr, fdc, fdc->sc_dev.dv_xname); /* * The NVRAM info only tells us about the first two disks on the @@ -477,8 +485,8 @@ fdstrategy(bp) int s; /* Valid unit, controller, and request? */ - if (unit >= fdcd.cd_ndevs || - (fd = fdcd.cd_devs[unit]) == 0 || + if (unit >= fd_cd.cd_ndevs || + (fd = fd_cd.cd_devs[unit]) == 0 || bp->b_blkno < 0 || (bp->b_bcount % FDC_BSIZE) != 0) { bp->b_error = EINVAL; @@ -705,9 +713,9 @@ Fdopen(dev, flags) struct fd_type *type; unit = FDUNIT(dev); - if (unit >= fdcd.cd_ndevs) + if (unit >= fd_cd.cd_ndevs) return ENXIO; - fd = fdcd.cd_devs[unit]; + fd = fd_cd.cd_devs[unit]; if (fd == 0) return ENXIO; type = fd_dev_to_type(fd, dev); @@ -730,7 +738,7 @@ fdclose(dev, flags) dev_t dev; int flags; { - struct fd_softc *fd = fdcd.cd_devs[FDUNIT(dev)]; + struct fd_softc *fd = fd_cd.cd_devs[FDUNIT(dev)]; fd->sc_flags &= ~FD_OPEN; return 0; @@ -1169,7 +1177,7 @@ fdioctl(dev, cmd, addr, flag) caddr_t addr; int flag; { - struct fd_softc *fd = fdcd.cd_devs[FDUNIT(dev)]; + struct fd_softc *fd = fd_cd.cd_devs[FDUNIT(dev)]; struct disklabel buffer; int error; diff --git a/sys/arch/i386/isa/isa_machdep.c b/sys/arch/i386/isa/isa_machdep.c index f37de38ba63..e430e4e87a6 100644 --- a/sys/arch/i386/isa/isa_machdep.c +++ b/sys/arch/i386/isa/isa_machdep.c @@ -1,5 +1,5 @@ -/* $OpenBSD: isa_machdep.c,v 1.11 1996/04/19 05:41:52 mickey Exp $ */ -/* $NetBSD: isa_machdep.c,v 1.11 1996/02/28 01:49:35 cgd Exp $ */ +/* $OpenBSD: isa_machdep.c,v 1.12 1996/04/21 22:16:54 deraadt Exp $ */ +/* $NetBSD: isa_machdep.c,v 1.12 1996/04/11 22:11:32 cgd Exp $ */ /*- * Copyright (c) 1993, 1994 Charles Hannum. @@ -220,7 +220,8 @@ fakeintr(arg) * XXX PRONE TO RACE CONDITIONS, UGLY, 'INTERESTING' INSERTION ALGORITHM. */ void * -isa_intr_establish(irq, type, level, ih_fun, ih_arg, ih_what) +isa_intr_establish(ic, irq, type, level, ih_fun, ih_arg, ih_what) + isa_chipset_tag_t ic; int irq; int type; int level; @@ -290,7 +291,8 @@ isa_intr_establish(irq, type, level, ih_fun, ih_arg, ih_what) * Deregister an interrupt handler. */ void -isa_intr_disestablish(arg) +isa_intr_disestablish(ic, arg) + isa_chipset_tag_t ic; void *arg; { struct intrhand *ih = arg; @@ -318,6 +320,15 @@ isa_intr_disestablish(arg) intrtype[irq] = IST_NONE; } +void +isa_attach_hook(parent, self, iba) + struct device *parent, *self; + struct isabus_attach_args *iba; +{ + + /* Nothing to do. */ +} + /* * ISA DMA and bounce buffer management */ diff --git a/sys/arch/i386/isa/isa_machdep.h b/sys/arch/i386/isa/isa_machdep.h index 76d4f7770fa..756221c630b 100644 --- a/sys/arch/i386/isa/isa_machdep.h +++ b/sys/arch/i386/isa/isa_machdep.h @@ -1,4 +1,4 @@ -/* $NetBSD: isa_machdep.h,v 1.4 1995/05/04 19:39:46 cgd Exp $ */ +/* $NetBSD: isa_machdep.h,v 1.5 1996/04/11 22:10:11 cgd Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -39,6 +39,14 @@ */ /* + * Various pieces of the i386 port want to include this file without + * or in spite of using isavar.h, and should be fixed. + */ + +#ifndef _I386_ISA_MACHDEP_H_ /* XXX */ +#define _I386_ISA_MACHDEP_H_ /* XXX */ + +/* * XXX THIS FILE IS A MESS. copyright: berkeley's probably. * contents from isavar.h and isareg.h, mostly the latter. * perhaps charles's? @@ -46,8 +54,28 @@ * copyright from berkeley's isa.h which is now dev/isa/isareg.h. */ +/* + * Types provided to machine-independent ISA code. + */ +typedef void *isa_chipset_tag_t; + +struct device; /* XXX */ +struct isabus_attach_args; /* XXX */ /* + * Functions provided to machine-independent ISA code. + */ +void isa_attach_hook __P((struct device *, struct device *, + struct isabus_attach_args *)); +void *isa_intr_establish __P((isa_chipset_tag_t ic, int irq, int type, + int level, int (*ih_fun)(void *), void *ih_arg, char *ih_what)); +void isa_intr_disestablish __P((isa_chipset_tag_t ic, void *handler)); + +/* + * ALL OF THE FOLLOWING ARE MACHINE-DEPENDENT, AND SHOULD NOT BE USED + * BY PORTABLE CODE. + */ +/* * XXX Various seemingly PC-specific constants, some of which may be * unnecessary anyway. */ @@ -142,3 +170,5 @@ extern u_long atdevbase; /* kernel virtual address of "hole" */ * Miscellanous functions. */ void sysbeep __P((int, int)); /* beep with the system speaker */ + +#endif /* _I386_ISA_MACHDEP_H_ XXX */ diff --git a/sys/arch/i386/isa/joy.c b/sys/arch/i386/isa/joy.c index 00d89838155..57c45480f62 100644 --- a/sys/arch/i386/isa/joy.c +++ b/sys/arch/i386/isa/joy.c @@ -1,3 +1,268 @@ +/* $NetBSD: joy.c,v 1.2 1996/04/01 06:39:17 scottr Exp $ */ + +/*- + * Copyright (c) 1995 Jean-Marc Zucconi + * All rights reserved. + * + * Ported to NetBSD by Matthieu Herrb <matthieu@laas.fr> + * + * 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 + * in this position and unchanged. + * 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. The name of the author may not be used to endorse or promote products + * derived from this software withough 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. + * + */ + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/kernel.h> +#include <sys/device.h> +#include <sys/errno.h> + +#include <machine/cpu.h> +#include <machine/pio.h> +#include <machine/cpufunc.h> +#include <machine/joystick.h> + +#include <dev/isa/isavar.h> +#include <dev/isa/isareg.h> +#include <i386/isa/timerreg.h> + + +/* + * The game port can manage 4 buttons and 4 variable resistors (usually 2 + * joysticks, each with 2 buttons and 2 pots.) via the port at address 0x201. + * Getting the state of the buttons is done by reading the game port; + * buttons 1-4 correspond to bits 4-7 and resistors 1-4 (X1, Y1, X2, Y2) + * to bits 0-3. If button 1 (resp 2, 3, 4) is pressed, the bit 4 (resp 5, + * 6, 7) is set to 0 to get the value of a resistor, write the value 0xff + * at port and wait until the corresponding bit returns to 0. + */ + +/* + * The formulae below only work if u is ``not too large''. See also + * the discussion in microtime.s + */ +#define USEC2TICKS(u) (((u) * 19549) >> 14) +#define TICKS2USEC(u) (((u) * 3433) >> 12) + + +#define JOYPART(d) minor(d) & 1 +#define JOYUNIT(d) minor(d) >> 1 & 3 + +#ifndef JOY_TIMEOUT +#define JOY_TIMEOUT 2000 /* 2 milliseconds */ +#endif + +#define JOY_NPORTS 1 + +struct joy_softc { + struct device sc_dev; + int port; + int x_off[2], y_off[2]; + int timeout[2]; +}; + +int joyprobe __P((struct device *, void *, void *)); +void joyattach __P((struct device *, struct device *, void *)); +int joyopen __P((dev_t, int, int, struct proc *)); +int joyclose __P((dev_t, int, int, struct proc *)); +static int get_tick __P((void)); + +struct cfattach joy_ca = { + sizeof(struct joy_softc), joyprobe, joyattach +}; + +struct cfdriver joy_cd = { + NULL, "joy", DV_DULL +}; + + +int +joyprobe(parent, match, aux) + struct device *parent; + void *match, *aux; +{ + struct isa_attach_args *ia = aux; + int iobase = ia->ia_iobase; + +#ifdef WANT_JOYSTICK_CONNECTED + outb(iobase, 0xff); + DELAY(10000); /* 10 ms delay */ + return (inb(iobase) & 0x0f) != 0x0f; +#else + ia->ia_iosize = JOY_NPORTS; + ia->ia_msize = 0; + return 1; +#endif +} + +void +joyattach(parent, self, aux) + struct device *parent, *self; + void *aux; +{ + struct joy_softc *sc = (void *) self; + struct isa_attach_args *ia = aux; + int unit = sc->sc_dev.dv_unit; + int iobase = ia->ia_iobase; + + sc->port = iobase; + sc->timeout[0] = sc->timeout[1] = 0; + outb(iobase, 0xff); + DELAY(10000); /* 10 ms delay */ + printf(": joystick%sconnected\n", + (inb(iobase) & 0x0f) == 0x0f ? " not " : " "); +} + +int +joyopen(dev, flag, mode, p) + dev_t dev; + int flag, mode; + struct proc *p; +{ + int unit = JOYUNIT(dev); + int i = JOYPART(dev); + struct joy_softc *sc; + + if (unit >= joy_cd.cd_ndevs) + return (ENXIO); + + sc = joy_cd.cd_devs[unit]; + + if (sc->timeout[i]) + return EBUSY; + + sc->x_off[i] = sc->y_off[i] = 0; + sc->timeout[i] = JOY_TIMEOUT; + return 0; +} + +int +joyclose(dev, flag, mode, p) + dev_t dev; + int flag, mode; + struct proc *p; +{ + int unit = JOYUNIT(dev); + int i = JOYPART(dev); + struct joy_softc *sc = joy_cd.cd_devs[unit]; + + sc->timeout[i] = 0; + return 0; +} + +int +joyread(dev, uio, flag) + dev_t dev; + struct uio *uio; + int flag; +{ + int unit = JOYUNIT(dev); + struct joy_softc *sc = joy_cd.cd_devs[unit]; + struct joystick c; + int port = sc->port; + int i, t0, t1; + int state = 0, x = 0, y = 0; + + disable_intr(); + outb(port, 0xff); + t0 = get_tick(); + t1 = t0; + i = USEC2TICKS(sc->timeout[JOYPART(dev)]); + while (t0 - t1 < i) { + state = inb(port); + if (JOYPART(dev) == 1) + state >>= 2; + t1 = get_tick(); + if (t1 > t0) + t1 -= TIMER_FREQ / hz; + if (!x && !(state & 0x01)) + x = t1; + if (!y && !(state & 0x02)) + y = t1; + if (x && y) + break; + } + enable_intr(); + c.x = x ? sc->x_off[JOYPART(dev)] + TICKS2USEC(t0 - x) : 0x80000000; + c.y = y ? sc->y_off[JOYPART(dev)] + TICKS2USEC(t0 - y) : 0x80000000; + state >>= 4; + c.b1 = ~state & 1; + c.b2 = ~(state >> 1) & 1; + return uiomove((caddr_t) & c, sizeof(struct joystick), uio); +} + +int +joyioctl(dev, cmd, data, flag, p) + dev_t dev; + u_long cmd; + caddr_t data; + int flag; + struct proc *p; +{ + int unit = JOYUNIT(dev); + struct joy_softc *sc = joy_cd.cd_devs[unit]; + int i = JOYPART(dev); + int x; + + switch (cmd) { + case JOY_SETTIMEOUT: + x = *(int *) data; + if (x < 1 || x > 10000) /* 10ms maximum! */ + return EINVAL; + sc->timeout[i] = x; + break; + case JOY_GETTIMEOUT: + *(int *) data = sc->timeout[i]; + break; + case JOY_SET_X_OFFSET: + sc->x_off[i] = *(int *) data; + break; + case JOY_SET_Y_OFFSET: + sc->y_off[i] = *(int *) data; + break; + case JOY_GET_X_OFFSET: + *(int *) data = sc->x_off[i]; + break; + case JOY_GET_Y_OFFSET: + *(int *) data = sc->y_off[i]; + break; + default: + return ENXIO; + } + return 0; +} + +static int +get_tick() +{ + int low, high; + + outb(TIMER_MODE, TIMER_SEL0); + low = inb(TIMER_CNTR0); + high = inb(TIMER_CNTR0); + + return (high << 8) | low; +} /*- * Copyright (c) 1995 Jean-Marc Zucconi * All rights reserved. diff --git a/sys/arch/i386/isa/lms.c b/sys/arch/i386/isa/lms.c index 64fade8f35b..efd24305e52 100644 --- a/sys/arch/i386/isa/lms.c +++ b/sys/arch/i386/isa/lms.c @@ -1,4 +1,4 @@ -/* $NetBSD: lms.c,v 1.21 1995/12/24 02:30:17 mycroft Exp $ */ +/* $NetBSD: lms.c,v 1.24 1996/04/11 22:15:18 cgd Exp $ */ /*- * Copyright (c) 1993, 1994 Charles Hannum. @@ -37,7 +37,7 @@ #include <sys/device.h> #include <machine/cpu.h> -#include <machine/pio.h> +#include <machine/bus.h> #include <machine/mouse.h> #include <dev/isa/isavar.h> @@ -56,9 +56,11 @@ struct lms_softc { /* driver status information */ struct device sc_dev; void *sc_ih; + bus_chipset_tag_t sc_bc; /* bus chipset identifier */ + bus_io_handle_t sc_ioh; /* bus i/o handle */ + struct clist sc_q; struct selinfo sc_rsel; - int sc_iobase; /* I/O port base */ u_char sc_state; /* mouse driver state */ #define LMS_OPEN 0x01 /* device is open */ #define LMS_ASLP 0x02 /* waiting for mouse data */ @@ -70,8 +72,12 @@ int lmsprobe __P((struct device *, void *, void *)); void lmsattach __P((struct device *, struct device *, void *)); int lmsintr __P((void *)); -struct cfdriver lmscd = { - NULL, "lms", lmsprobe, lmsattach, DV_TTY, sizeof(struct lms_softc) +struct cfattach lms_ca = { + sizeof(struct lms_softc), lmsprobe, lmsattach +}; + +struct cfdriver lms_cd = { + NULL, "lms", DV_TTY }; #define LMSUNIT(dev) (minor(dev)) @@ -82,26 +88,38 @@ lmsprobe(parent, match, aux) void *match, *aux; { struct isa_attach_args *ia = aux; - int iobase = ia->ia_iobase; + bus_chipset_tag_t bc = ia->ia_bc; + bus_io_handle_t ioh; + int rv; + + /* Map the i/o space. */ + if (bus_io_map(bc, ia->ia_iobase, LMS_NPORTS, &ioh)) + return 0; + + rv = 0; /* Configure and check for port present. */ - outb(iobase + LMS_CONFIG, 0x91); + bus_io_write_1(bc, ioh, LMS_CONFIG, 0x91); delay(10); - outb(iobase + LMS_SIGN, 0x0c); + bus_io_write_1(bc, ioh, LMS_SIGN, 0x0c); delay(10); - if (inb(iobase + LMS_SIGN) != 0x0c) - return 0; - outb(iobase + LMS_SIGN, 0x50); + if (bus_io_read_1(bc, ioh, LMS_SIGN) != 0x0c) + goto out; + bus_io_write_1(bc, ioh, LMS_SIGN, 0x50); delay(10); - if (inb(iobase + LMS_SIGN) != 0x50) - return 0; + if (bus_io_read_1(bc, ioh, LMS_SIGN) != 0x50) + goto out; /* Disable interrupts. */ - outb(iobase + LMS_CNTRL, 0x10); + bus_io_write_1(bc, ioh, LMS_CNTRL, 0x10); + rv = 1; ia->ia_iosize = LMS_NPORTS; ia->ia_msize = 0; - return 1; + +out: + bus_io_unmap(bc, ioh, LMS_NPORTS); + return rv; } void @@ -116,11 +134,12 @@ lmsattach(parent, self, aux) printf("\n"); /* Other initialization was done by lmsprobe. */ - sc->sc_iobase = iobase; - sc->sc_state = 0; + sc->sc_bc = ia->ia_bc; + if (bus_io_map(sc->sc_bc, ia->ia_iobase, LMS_NPORTS, &sc->sc_ioh)) + panic("lmsattach: couldn't map I/O ports"); - sc->sc_ih = isa_intr_establish(ia->ia_irq, IST_PULSE, IPL_TTY, lmsintr, - sc, sc->sc_dev.dv_xname); + sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_PULSE, + IPL_TTY, lmsintr, sc, sc->sc_dev.dv_xname); } int @@ -131,9 +150,9 @@ lmsopen(dev, flag) int unit = LMSUNIT(dev); struct lms_softc *sc; - if (unit >= lmscd.cd_ndevs) + if (unit >= lms_cd.cd_ndevs) return ENXIO; - sc = lmscd.cd_devs[unit]; + sc = lms_cd.cd_devs[unit]; if (!sc) return ENXIO; @@ -148,7 +167,7 @@ lmsopen(dev, flag) sc->sc_x = sc->sc_y = 0; /* Enable interrupts. */ - outb(sc->sc_iobase + LMS_CNTRL, 0); + bus_io_write_1(sc->sc_bc, sc->sc_ioh, LMS_CNTRL, 0); return 0; } @@ -158,10 +177,10 @@ lmsclose(dev, flag) dev_t dev; int flag; { - struct lms_softc *sc = lmscd.cd_devs[LMSUNIT(dev)]; + struct lms_softc *sc = lms_cd.cd_devs[LMSUNIT(dev)]; /* Disable interrupts. */ - outb(sc->sc_iobase + LMS_CNTRL, 0x10); + bus_io_write_1(sc->sc_bc, sc->sc_ioh, LMS_CNTRL, 0x10); sc->sc_state &= ~LMS_OPEN; @@ -176,7 +195,7 @@ lmsread(dev, uio, flag) struct uio *uio; int flag; { - struct lms_softc *sc = lmscd.cd_devs[LMSUNIT(dev)]; + struct lms_softc *sc = lms_cd.cd_devs[LMSUNIT(dev)]; int s; int error; size_t length; @@ -224,7 +243,7 @@ lmsioctl(dev, cmd, addr, flag) caddr_t addr; int flag; { - struct lms_softc *sc = lmscd.cd_devs[LMSUNIT(dev)]; + struct lms_softc *sc = lms_cd.cd_devs[LMSUNIT(dev)]; struct mouseinfo info; int s; int error; @@ -274,7 +293,8 @@ lmsintr(arg) void *arg; { struct lms_softc *sc = arg; - int iobase = sc->sc_iobase; + bus_chipset_tag_t bc = sc->sc_bc; + bus_io_handle_t ioh = sc->sc_ioh; u_char hi, lo, buttons, changed; char dx, dy; u_char buffer[5]; @@ -283,22 +303,22 @@ lmsintr(arg) /* Interrupts are not expected. */ return 0; - outb(iobase + LMS_CNTRL, 0xab); - hi = inb(iobase + LMS_DATA); - outb(iobase + LMS_CNTRL, 0x90); - lo = inb(iobase + LMS_DATA); + bus_io_write_1(bc, ioh, LMS_CNTRL, 0xab); + hi = bus_io_read_1(bc, ioh, LMS_DATA); + bus_io_write_1(bc, ioh, LMS_CNTRL, 0x90); + lo = bus_io_read_1(bc, ioh, LMS_DATA); dx = ((hi & 0x0f) << 4) | (lo & 0x0f); /* Bounding at -127 avoids a bug in XFree86. */ dx = (dx == -128) ? -127 : dx; - outb(iobase + LMS_CNTRL, 0xf0); - hi = inb(iobase + LMS_DATA); - outb(iobase + LMS_CNTRL, 0xd0); - lo = inb(iobase + LMS_DATA); + bus_io_write_1(bc, ioh, LMS_CNTRL, 0xf0); + hi = bus_io_read_1(bc, ioh, LMS_DATA); + bus_io_write_1(bc, ioh, LMS_CNTRL, 0xd0); + lo = bus_io_read_1(bc, ioh, LMS_DATA); dy = ((hi & 0x0f) << 4) | (lo & 0x0f); dy = (dy == -128) ? 127 : -dy; - outb(iobase + LMS_CNTRL, 0); + bus_io_write_1(bc, ioh, LMS_CNTRL, 0); buttons = (~hi >> 5) & 0x07; changed = ((buttons ^ sc->sc_status) & 0x07) << 3; @@ -332,7 +352,7 @@ lmsselect(dev, rw, p) int rw; struct proc *p; { - struct lms_softc *sc = lmscd.cd_devs[LMSUNIT(dev)]; + struct lms_softc *sc = lms_cd.cd_devs[LMSUNIT(dev)]; int s; int ret; diff --git a/sys/arch/i386/isa/mms.c b/sys/arch/i386/isa/mms.c index aa32db40e1c..6dc4a533fc8 100644 --- a/sys/arch/i386/isa/mms.c +++ b/sys/arch/i386/isa/mms.c @@ -1,4 +1,4 @@ -/* $NetBSD: mms.c,v 1.20 1995/12/24 02:30:19 mycroft Exp $ */ +/* $NetBSD: mms.c,v 1.22 1996/04/11 22:15:20 cgd Exp $ */ /*- * Copyright (c) 1993, 1994 Charles Hannum. @@ -68,8 +68,12 @@ int mmsprobe __P((struct device *, void *, void *)); void mmsattach __P((struct device *, struct device *, void *)); int mmsintr __P((void *)); -struct cfdriver mmscd = { - NULL, "mms", mmsprobe, mmsattach, DV_TTY, sizeof(struct mms_softc) +struct cfattach mms_ca = { + sizeof(struct mms_softc), mmsprobe, mmsattach +}; + +struct cfdriver mms_cd = { + NULL, "mms", DV_TTY }; #define MMSUNIT(dev) (minor(dev)) @@ -109,8 +113,8 @@ mmsattach(parent, self, aux) sc->sc_iobase = iobase; sc->sc_state = 0; - sc->sc_ih = isa_intr_establish(ia->ia_irq, IST_PULSE, IPL_TTY, mmsintr, - sc, sc->sc_dev.dv_xname); + sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_PULSE, + IPL_TTY, mmsintr, sc, sc->sc_dev.dv_xname); } int @@ -121,9 +125,9 @@ mmsopen(dev, flag) int unit = MMSUNIT(dev); struct mms_softc *sc; - if (unit >= mmscd.cd_ndevs) + if (unit >= mms_cd.cd_ndevs) return ENXIO; - sc = mmscd.cd_devs[unit]; + sc = mms_cd.cd_devs[unit]; if (!sc) return ENXIO; @@ -149,7 +153,7 @@ mmsclose(dev, flag) dev_t dev; int flag; { - struct mms_softc *sc = mmscd.cd_devs[MMSUNIT(dev)]; + struct mms_softc *sc = mms_cd.cd_devs[MMSUNIT(dev)]; /* Disable interrupts. */ outb(sc->sc_iobase + MMS_ADDR, 0x87); @@ -167,7 +171,7 @@ mmsread(dev, uio, flag) struct uio *uio; int flag; { - struct mms_softc *sc = mmscd.cd_devs[MMSUNIT(dev)]; + struct mms_softc *sc = mms_cd.cd_devs[MMSUNIT(dev)]; int s; int error; size_t length; @@ -215,7 +219,7 @@ mmsioctl(dev, cmd, addr, flag) caddr_t addr; int flag; { - struct mms_softc *sc = mmscd.cd_devs[MMSUNIT(dev)]; + struct mms_softc *sc = mms_cd.cd_devs[MMSUNIT(dev)]; struct mouseinfo info; int s; int error; @@ -327,7 +331,7 @@ mmsselect(dev, rw, p) int rw; struct proc *p; { - struct mms_softc *sc = mmscd.cd_devs[MMSUNIT(dev)]; + struct mms_softc *sc = mms_cd.cd_devs[MMSUNIT(dev)]; int s; int ret; diff --git a/sys/arch/i386/isa/npx.c b/sys/arch/i386/isa/npx.c index 46d7f3476f8..1eac3fca162 100644 --- a/sys/arch/i386/isa/npx.c +++ b/sys/arch/i386/isa/npx.c @@ -1,4 +1,4 @@ -/* $NetBSD: npx.c,v 1.53 1996/01/07 02:00:31 mycroft Exp $ */ +/* $NetBSD: npx.c,v 1.55 1996/04/11 22:15:22 cgd Exp $ */ #if 0 #define iprintf(x) printf x @@ -115,8 +115,12 @@ struct npx_softc { int npxprobe __P((struct device *, void *, void *)); void npxattach __P((struct device *, struct device *, void *)); -struct cfdriver npxcd = { - NULL, "npx", npxprobe, npxattach, DV_DULL, sizeof(struct npx_softc) +struct cfattach npx_ca = { + sizeof(struct npx_softc), npxprobe, npxattach +}; + +struct cfdriver npx_cd = { + NULL, "npx", DV_DULL }; enum npx_type { @@ -325,8 +329,8 @@ npxattach(parent, self, aux) case NPX_INTERRUPT: printf("\n"); lcr0(rcr0() & ~CR0_NE); - sc->sc_ih = isa_intr_establish(ia->ia_irq, IST_EDGE, IPL_NONE, - npxintr, 0, sc->sc_dev.dv_xname); + sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, + IST_EDGE, IPL_NONE, npxintr, 0, sc->sc_dev.dv_xname); break; case NPX_EXCEPTION: printf(": using exception 16\n"); diff --git a/sys/arch/i386/isa/pccons.c b/sys/arch/i386/isa/pccons.c index 8ce645e44e8..82ea0e8eb70 100644 --- a/sys/arch/i386/isa/pccons.c +++ b/sys/arch/i386/isa/pccons.c @@ -1,5 +1,5 @@ -/* $OpenBSD: pccons.c,v 1.7 1996/04/18 17:12:18 niklas Exp $ */ -/* $NetBSD: pccons.c,v 1.92 1996/03/16 06:08:46 thorpej Exp $ */ +/* $OpenBSD: pccons.c,v 1.8 1996/04/21 22:17:01 deraadt Exp $ */ +/* $NetBSD: pccons.c,v 1.96 1996/04/11 22:15:25 cgd Exp $ */ /*- * Copyright (c) 1993, 1994, 1995 Charles Hannum. All rights reserved. @@ -124,8 +124,12 @@ int pcprobe __P((struct device *, void *, void *)); void pcattach __P((struct device *, struct device *, void *)); int pcintr __P((void *)); -struct cfdriver pccd = { - NULL, "pc", pcprobe, pcattach, DV_TTY, sizeof(struct pc_softc) +struct cfattach pc_ca = { + sizeof(struct pc_softc), pcprobe, pcattach +}; + +struct cfdriver pc_cd = { + NULL, "pc", DV_TTY }; #define COL 80 @@ -151,6 +155,8 @@ static unsigned int addr_6845 = MONO_BASE; char *sget __P((void)); void sput __P((u_char *, int)); +void pc_xmode_on __P((void)); +void pc_xmode_off __P((void)); void pcstart(); int pcparam(); @@ -476,15 +482,15 @@ pcattach(parent, self, aux) printf(": %s\n", vs.color ? "color" : "mono"); do_async_update(1); - sc->sc_ih = isa_intr_establish(ia->ia_irq, IST_EDGE, IPL_TTY, pcintr, - sc, sc->sc_dev.dv_xname); + sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, + IPL_TTY, pcintr, sc, sc->sc_dev.dv_xname); /* * Look for children of the keyboard controller. * XXX Really should decouple keyboard controller * from the console code. */ - while (config_found(self, NULL, NULL)) + while (config_found(self, ia->ia_ic, NULL) != NULL) /* XXX */ /* will break when no more children */ ; } @@ -498,9 +504,9 @@ pcopen(dev, flag, mode, p) int unit = PCUNIT(dev); struct tty *tp; - if (unit >= pccd.cd_ndevs) + if (unit >= pc_cd.cd_ndevs) return ENXIO; - sc = pccd.cd_devs[unit]; + sc = pc_cd.cd_devs[unit]; if (sc == 0) return ENXIO; @@ -535,7 +541,7 @@ pcclose(dev, flag, mode, p) int flag, mode; struct proc *p; { - struct pc_softc *sc = pccd.cd_devs[PCUNIT(dev)]; + struct pc_softc *sc = pc_cd.cd_devs[PCUNIT(dev)]; struct tty *tp = sc->sc_tty; (*linesw[tp->t_line].l_close)(tp, flag); @@ -552,7 +558,7 @@ pcread(dev, uio, flag) struct uio *uio; int flag; { - struct pc_softc *sc = pccd.cd_devs[PCUNIT(dev)]; + struct pc_softc *sc = pc_cd.cd_devs[PCUNIT(dev)]; struct tty *tp = sc->sc_tty; return ((*linesw[tp->t_line].l_read)(tp, uio, flag)); @@ -564,7 +570,7 @@ pcwrite(dev, uio, flag) struct uio *uio; int flag; { - struct pc_softc *sc = pccd.cd_devs[PCUNIT(dev)]; + struct pc_softc *sc = pc_cd.cd_devs[PCUNIT(dev)]; struct tty *tp = sc->sc_tty; return ((*linesw[tp->t_line].l_write)(tp, uio, flag)); @@ -574,7 +580,7 @@ struct tty * pctty(dev) dev_t dev; { - struct pc_softc *sc = pccd.cd_devs[PCUNIT(dev)]; + struct pc_softc *sc = pc_cd.cd_devs[PCUNIT(dev)]; struct tty *tp = sc->sc_tty; return (tp); @@ -617,7 +623,7 @@ pcioctl(dev, cmd, data, flag, p) int flag; struct proc *p; { - struct pc_softc *sc = pccd.cd_devs[PCUNIT(dev)]; + struct pc_softc *sc = pc_cd.cd_devs[PCUNIT(dev)]; struct tty *tp = sc->sc_tty; int error; @@ -762,6 +768,7 @@ pccnputc(dev, c) } /* ARGSUSED */ +int pccngetc(dev) dev_t dev; { @@ -800,8 +807,8 @@ pccnpollc(dev, on) * interrupts. */ unit = PCUNIT(dev); - if (pccd.cd_ndevs > unit) { - sc = pccd.cd_devs[unit]; + if (pc_cd.cd_ndevs > unit) { + sc = pc_cd.cd_devs[unit]; if (sc != 0) { s = spltty(); pcintr(sc); @@ -1640,6 +1647,7 @@ pcmmap(dev, offset, nprot) return i386_btop(0xa0000 + offset); } +void pc_xmode_on() { struct trapframe *fp; @@ -1661,6 +1669,7 @@ pc_xmode_on() #endif } +void pc_xmode_off() { struct trapframe *fp; diff --git a/sys/arch/i386/isa/pcvt/Etc/ttys.pcvt.netbsd b/sys/arch/i386/isa/pcvt/Etc/ttys.pcvt.netbsd index 12524af0ec5..114232c65b4 100644 --- a/sys/arch/i386/isa/pcvt/Etc/ttys.pcvt.netbsd +++ b/sys/arch/i386/isa/pcvt/Etc/ttys.pcvt.netbsd @@ -1,6 +1,6 @@ #--------------------------------------------------------------------------- # -# sample /etc/ttys file for pcvt driver and pcvt25h terminal emulation +# sample /etc/ttys file for pcvt driver and pcvt25 terminal emulation # # last edit-date: [Sun Feb 26 12:30:09 1995] # @@ -11,18 +11,18 @@ # # name getty type status comments # -console "/usr/libexec/getty Pcvt" pcvt25h off secure +console "/usr/libexec/getty Pcvt" pcvt25 off secure # # the following lines are for the pcvt driver # -ttyv0 "/usr/libexec/getty Pcvt" pcvt25h on secure -ttyv1 "/usr/libexec/getty Pcvt" pcvt25h on secure -ttyv2 "/usr/libexec/getty Pcvt" pcvt25h on secure -ttyv3 "/usr/libexec/getty Pcvt" pcvt25h on secure -ttyv4 "/usr/libexec/getty Pcvt" pcvt25h on secure -ttyv5 "/usr/libexec/getty Pcvt" pcvt25h on secure -ttyv6 "/usr/libexec/getty Pcvt" pcvt25h off secure # X11 :1 -ttyv7 "/usr/libexec/getty Pcvt" pcvt25h off secure # X11 :0 +ttyv0 "/usr/libexec/getty Pcvt" pcvt25 on secure +ttyv1 "/usr/libexec/getty Pcvt" pcvt25 on secure +ttyv2 "/usr/libexec/getty Pcvt" pcvt25 on secure +ttyv3 "/usr/libexec/getty Pcvt" pcvt25 on secure +ttyv4 "/usr/libexec/getty Pcvt" pcvt25 on secure +ttyv5 "/usr/libexec/getty Pcvt" pcvt25 on secure +ttyv6 "/usr/libexec/getty Pcvt" pcvt25 off secure # X11 :1 +ttyv7 "/usr/libexec/getty Pcvt" pcvt25 off secure # X11 :0 # # Hardwired lines are marked off, by default, so getty(8) # is quiet when they don't exist. diff --git a/sys/arch/i386/isa/pcvt/Util/ispcvt/ispcvt.c b/sys/arch/i386/isa/pcvt/Util/ispcvt/ispcvt.c index cac5b485a16..99bf4028fa5 100644 --- a/sys/arch/i386/isa/pcvt/Util/ispcvt/ispcvt.c +++ b/sys/arch/i386/isa/pcvt/Util/ispcvt/ispcvt.c @@ -189,8 +189,6 @@ char *argv[]; fprintf(stderr,"Operating System = %s\t", p); fprintf(stderr,"OS Release Id = %u\n", pcvtinfo.opsysrel); fprintf(stderr,"PCVT_NSCREENS = %u\t\t", pcvtinfo.nscreens); - fprintf(stderr,"PCVT_UPDATEFAST = %u\n", pcvtinfo.updatefast); - fprintf(stderr,"PCVT_UPDATESLOW = %u\t\t", pcvtinfo.updateslow); fprintf(stderr,"PCVT_SYSBEEPF = %u\n", pcvtinfo.sysbeepf); fprintf(stderr,"PCVT_PCBURST = %u\t\t", pcvtinfo.pcburst); fprintf(stderr,"PCVT_KBD_FIFO_SZ = %u\n\n", pcvtinfo.kbd_fifo_sz); @@ -281,8 +279,6 @@ char *argv[]; { fprintf(stderr,"BSD Version = %u\n", pcvtinfo.opsys); fprintf(stderr,"PCVT_NSCREENS = %u\n", pcvtinfo.nscreens); - fprintf(stderr,"PCVT_UPDATEFAST = %u\n", pcvtinfo.updatefast); - fprintf(stderr,"PCVT_UPDATESLOW = %u\n", pcvtinfo.updateslow); fprintf(stderr,"PCVT_SYSBEEPF = %u\n", pcvtinfo.sysbeepf); fprintf(stderr,"Compile options = 0x%08X\n", pcvtinfo.compile_opts); } diff --git a/sys/arch/i386/isa/pcvt/Util/kbdio/Makefile b/sys/arch/i386/isa/pcvt/Util/kbdio/Makefile index daebe80d967..5138a0cceb8 100644 --- a/sys/arch/i386/isa/pcvt/Util/kbdio/Makefile +++ b/sys/arch/i386/isa/pcvt/Util/kbdio/Makefile @@ -8,6 +8,7 @@ YFLAGS+= -v # verbose LFLAGS+= -I LDADD= -lm -ly -ll +DPADD= ${LIBM} ${LIBY} ${LIBL} NOMAN= NOSHARED= no shared linkage diff --git a/sys/arch/i386/isa/pcvt/Util/pcvtdoc/pcvt.4 b/sys/arch/i386/isa/pcvt/Util/pcvtdoc/pcvt.4 index d3bef826d6c..e3ac67b7c14 100644 --- a/sys/arch/i386/isa/pcvt/Util/pcvtdoc/pcvt.4 +++ b/sys/arch/i386/isa/pcvt/Util/pcvtdoc/pcvt.4 @@ -764,8 +764,6 @@ struct pcvtinfo { u_int opsysrel; /* Release for NetBSD/FreeBSD */ u_int nscreens; /* PCVT_NSCREENS */ u_int scanset; /* PCVT_SCANSET */ - u_int updatefast; /* PCVT_UPDATEFAST */ - u_int updateslow; /* PCVT_UPDATESLOW */ u_int sysbeepf; /* PCVT_SYSBEEPF */ /* config booleans */ diff --git a/sys/arch/i386/isa/pcvt/Util/vgaio/Makefile b/sys/arch/i386/isa/pcvt/Util/vgaio/Makefile index 253d5ec18e1..911f2f96b32 100644 --- a/sys/arch/i386/isa/pcvt/Util/vgaio/Makefile +++ b/sys/arch/i386/isa/pcvt/Util/vgaio/Makefile @@ -9,6 +9,7 @@ YACC= yacc LFLAGS+= -I LDADD= -lm -ly -ll +DPADD= ${LIBM} ${LIBY} ${LIBL} CFLAGS+= -I ${.CURDIR}/obj -I ${.CURDIR} -g diff --git a/sys/arch/i386/isa/pcvt/pcvt_drv.c b/sys/arch/i386/isa/pcvt/pcvt_drv.c index 671749e0ed3..a7eafd4d635 100644 --- a/sys/arch/i386/isa/pcvt/pcvt_drv.c +++ b/sys/arch/i386/isa/pcvt/pcvt_drv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pcvt_drv.c,v 1.9 1996/04/18 17:48:28 niklas Exp $ */ +/* $OpenBSD: pcvt_drv.c,v 1.10 1996/04/21 22:17:07 deraadt Exp $ */ /* * Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch. @@ -341,8 +341,8 @@ pcattach(struct isa_device *dev) #if PCVT_NETBSD > 9 #if PCVT_NETBSD > 101 - sc->sc_ih = isa_intr_establish(ia->ia_irq, IST_EDGE, IPL_TTY, pcintr, - (void *)0, sc->sc_dev.dv_xname); + sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, + IPL_TTY, pcintr, (void *)0, sc->sc_dev.dv_xname); #if PCVT_NETBSD > 110 /* @@ -350,9 +350,9 @@ pcattach(struct isa_device *dev) * XXX Really should decouple keyboard controller * from the console code. */ - while (config_found(self, NULL, NULL)) + while (config_found(self, ia->ia_ic, NULL) != NULL) /* will break when no more children */ ; -#endif /* PVCT_NETBSD > 110 */ +#endif /* PCVT_NETBSD > 110 */ #else /* PCVT_NETBSD > 100 */ vthand.ih_fun = pcrint; vthand.ih_arg = 0; @@ -1235,9 +1235,13 @@ pccncheckc(Dev_t dev) void pccnpollc(Dev_t dev, int on) { +#if PCVT_NETBSD > 110 + struct vt_softc *sc = NULL; /* XXX not used */ +#else #if PCVT_NETBSD > 101 struct vt_softc *sc = vtcd.cd_devs[0]; /* XXX */ #endif +#endif kbd_polling = on; if (!on) { diff --git a/sys/arch/i386/isa/pcvt/pcvt_hdr.h b/sys/arch/i386/isa/pcvt/pcvt_hdr.h index 0427ebabefd..222d09e839e 100644 --- a/sys/arch/i386/isa/pcvt/pcvt_hdr.h +++ b/sys/arch/i386/isa/pcvt/pcvt_hdr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pcvt_hdr.h,v 1.6 1996/04/18 17:48:31 niklas Exp $ */ +/* $OpenBSD: pcvt_hdr.h,v 1.7 1996/04/21 22:17:09 deraadt Exp $ */ /* * Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch. @@ -907,6 +907,15 @@ struct vt_softc { int pcprobe (); void pcattach (); +#if PCVT_NETBSD > 110 +struct cfattach vt_ca = { + sizeof(struct vt_softc), pcprobe, pcattach +}; + +struct cfdriver vt_cd = { + NULL, "vt", DV_TTY +}; +#else /* !PCVT_NETBSD > 110 */ #if PCVT_NETBSD > 101 struct cfdriver vtcd = { NULL, "vt", pcprobe, pcattach, DV_TTY, sizeof(struct vt_softc) @@ -916,6 +925,7 @@ struct cfdriver vtcd = { NULL, "vt", pcprobe, pcattach, DV_TTY, sizeof(struct device) }; #endif /* PCVT_NETBSD > 101 */ +#endif /* PCVT_NETBSD > 110 */ #else /* !PCVT_NETBSD > 9 */ diff --git a/sys/arch/i386/isa/pms.c b/sys/arch/i386/isa/pms.c index 12bb0e81548..e3ba04481b0 100644 --- a/sys/arch/i386/isa/pms.c +++ b/sys/arch/i386/isa/pms.c @@ -1,5 +1,5 @@ -/* $OpenBSD: pms.c,v 1.6 1996/04/18 17:12:20 niklas Exp $ */ -/* $NetBSD: pms.c,v 1.25 1996/03/16 06:08:50 thorpej Exp $ */ +/* $OpenBSD: pms.c,v 1.7 1996/04/21 22:17:02 deraadt Exp $ */ +/* $NetBSD: pms.c,v 1.27 1996/04/11 22:15:27 cgd Exp $ */ /*- * Copyright (c) 1994 Charles Hannum. @@ -105,8 +105,12 @@ int pmsprobe __P((struct device *, void *, void *)); void pmsattach __P((struct device *, struct device *, void *)); int pmsintr __P((void *)); -struct cfdriver pmscd = { - NULL, "pms", pmsprobe, pmsattach, DV_TTY, sizeof(struct pms_softc) +struct cfattach pms_ca = { + sizeof(struct pms_softc), pmsprobe, pmsattach, +}; + +struct cfdriver pms_cd = { + NULL, "pms", DV_TTY }; #define PMSUNIT(dev) (minor(dev)) @@ -200,14 +204,15 @@ pmsattach(parent, self, aux) { struct pms_softc *sc = (void *)self; int irq = self->dv_cfdata->cf_loc[0]; + isa_chipset_tag_t ic = aux; /* XXX */ printf(" irq %d\n", irq); /* Other initialization was done by pmsprobe. */ sc->sc_state = 0; - sc->sc_ih = isa_intr_establish(irq, IST_EDGE, IPL_TTY, pmsintr, - sc, sc->sc_dev.dv_xname); + sc->sc_ih = isa_intr_establish(ic, irq, IST_EDGE, IPL_TTY, + pmsintr, sc, sc->sc_dev.dv_xname); } int @@ -218,9 +223,9 @@ pmsopen(dev, flag) int unit = PMSUNIT(dev); struct pms_softc *sc; - if (unit >= pmscd.cd_ndevs) + if (unit >= pms_cd.cd_ndevs) return ENXIO; - sc = pmscd.cd_devs[unit]; + sc = pms_cd.cd_devs[unit]; if (!sc) return ENXIO; @@ -255,7 +260,7 @@ pmsclose(dev, flag) dev_t dev; int flag; { - struct pms_softc *sc = pmscd.cd_devs[PMSUNIT(dev)]; + struct pms_softc *sc = pms_cd.cd_devs[PMSUNIT(dev)]; /* Disable interrupts. */ pms_dev_cmd(PMS_DEV_DISABLE); @@ -275,7 +280,7 @@ pmsread(dev, uio, flag) struct uio *uio; int flag; { - struct pms_softc *sc = pmscd.cd_devs[PMSUNIT(dev)]; + struct pms_softc *sc = pms_cd.cd_devs[PMSUNIT(dev)]; int s; int error; size_t length; @@ -323,7 +328,7 @@ pmsioctl(dev, cmd, addr, flag) caddr_t addr; int flag; { - struct pms_softc *sc = pmscd.cd_devs[PMSUNIT(dev)]; + struct pms_softc *sc = pms_cd.cd_devs[PMSUNIT(dev)]; struct mouseinfo info; int s; int error; @@ -446,7 +451,7 @@ pmsselect(dev, rw, p) int rw; struct proc *p; { - struct pms_softc *sc = pmscd.cd_devs[PMSUNIT(dev)]; + struct pms_softc *sc = pms_cd.cd_devs[PMSUNIT(dev)]; int s; int ret; diff --git a/sys/arch/i386/isa/spkr.c b/sys/arch/i386/isa/spkr.c index 7db0a7b962c..bb427dd0f18 100644 --- a/sys/arch/i386/isa/spkr.c +++ b/sys/arch/i386/isa/spkr.c @@ -1,3 +1,4 @@ +/* $OpenBSD: spkr.c,v 1.6 1996/04/21 22:17:04 deraadt Exp $ */ /* $NetBSD: spkr.c,v 1.22 1996/03/18 01:26:12 jtk Exp $ */ /* @@ -38,8 +39,12 @@ struct spkr_softc { struct device sc_dev; }; -struct cfdriver spkrcd = { - NULL, "spkr", spkrprobe, spkrattach, DV_TTY, sizeof(struct spkr_softc) +struct cfattach spkr_ca = { + sizeof(struct spkr_softc), spkrprobe, spkrattach +}; + +struct cfdriver spkr_cd = { + NULL, "spkr", DV_TTY }; /**************** MACHINE DEPENDENT PART STARTS HERE ************************* @@ -433,6 +438,7 @@ int spkrprobe (parent, match, aux) if (cf->cf_loc[1] != PITAUX_PORT) return (0); + ia->ia_iosize = 1; return (1); } @@ -480,7 +486,7 @@ struct uio *uio; dev, uio->uio_resid); #endif /* DEBUG */ - if (minor(dev) != 0) + if (minor(dev) != 0 || !spkr_attached) return(ENXIO); else { diff --git a/sys/arch/i386/pci/pci_compat.c b/sys/arch/i386/pci/pci_compat.c new file mode 100644 index 00000000000..6ef68db2637 --- /dev/null +++ b/sys/arch/i386/pci/pci_compat.c @@ -0,0 +1,128 @@ +/* $NetBSD: pci_compat.c,v 1.1 1996/03/27 04:01:13 cgd Exp $ */ + +/* + * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. + * Copyright (c) 1994 Charles Hannum. 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 Charles Hannum. + * 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. + */ + +/* + * Compatibility functions, for use with old NetBSD/i386 PCI code. + * + * These should go away when all drivers are converted to the new + * interfaces. + */ + +#include <sys/types.h> +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/device.h> + +#include <vm/vm.h> + +#include <dev/pci/pcivar.h> +#include <dev/pci/pcireg.h> + +__warn_references(pci_map_int, + "uses pci_map_int() compatibility interface"); + +void * +pci_map_int(tag, level, func, arg) + pcitag_t tag; + int level; + int (*func) __P((void *)); + void *arg; +{ + pci_intr_handle_t ih; + pcireg_t data; + int pin, line; + const char *intrstr; + void *rv; + + data = pci_conf_read(NULL, tag, PCI_INTERRUPT_REG); + + pin = PCI_INTERRUPT_PIN(data); + line = PCI_INTERRUPT_LINE(data); + + if (pci_intr_map(NULL, tag, pin, line, &ih)) + return NULL; + intrstr = pci_intr_string(NULL, ih); + rv = pci_intr_establish(NULL, ih, level, func, arg, NULL); + if (rv == NULL) + printf("pci_map_int: failed to map interrupt\n"); + else if (intrstr != NULL) + printf("pci_map_int: interrupting at %s\n", intrstr); + return (rv); +} + +__warn_references(pci_map_io, + "uses pci_map_io() compatibility interface"); + +int +pci_map_io(tag, reg, iobasep) + pcitag_t tag; + int reg; + int *iobasep; +{ + bus_io_addr_t ioaddr; + bus_io_size_t iosize; + bus_io_handle_t ioh; + + if (pci_io_find(NULL, tag, reg, &ioaddr, &iosize)) + return (1); + if (bus_io_map(NULL, ioaddr, iosize, &ioh)) + return (1); + + *iobasep = ioh; + + return 0; +} + +__warn_references(pci_map_mem, + "uses pci_map_mem() compatibility interface"); + +int +pci_map_mem(tag, reg, vap, pap) + pcitag_t tag; + int reg; + vm_offset_t *vap, *pap; +{ + bus_mem_addr_t memaddr; + bus_mem_size_t memsize; + bus_mem_handle_t memh; + int cacheable; + + if (pci_mem_find(NULL, tag, reg, &memaddr, &memsize, &cacheable)) + return (1); + if (bus_mem_map(NULL, memaddr, memsize, cacheable, &memh)) + return (1); + + *vap = (vm_offset_t)memh; + *pap = memaddr; + + return 0; +} diff --git a/sys/arch/i386/pci/pci_machdep.c b/sys/arch/i386/pci/pci_machdep.c index b05b5be8385..9f27116fbae 100644 --- a/sys/arch/i386/pci/pci_machdep.c +++ b/sys/arch/i386/pci/pci_machdep.c @@ -1,6 +1,7 @@ -/* $NetBSD: pci_machdep.c,v 1.20 1996/03/04 19:39:31 cgd Exp $ */ +/* $NetBSD: pci_machdep.c,v 1.23 1996/04/11 22:15:33 cgd Exp $ */ /* + * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. * Copyright (c) 1994 Charles Hannum. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -67,8 +68,37 @@ int pci_mode = -1; #define PCI_MODE2_ENABLE_REG 0x0cf8 #define PCI_MODE2_FORWARD_REG 0x0cfa +void +pci_attach_hook(parent, self, pba) + struct device *parent, *self; + struct pcibus_attach_args *pba; +{ + + if (pba->pba_bus == 0) + printf(": configuration mode %d", pci_mode); +} + +int +pci_bus_maxdevs(pc, busno) + pci_chipset_tag_t pc; + int busno; +{ + + /* + * Bus number is irrelevant. If Configuration Mechanism 2 is in + * use, can only have devices 0-15 on any bus. If Configuration + * Mechanism 1 is in use, can have devices 0-32 (i.e. the `normal' + * range). + */ + if (pci_mode == 2) + return (16); + else + return (32); +} + pcitag_t -pci_make_tag(bus, device, function) +pci_make_tag(pc, bus, device, function) + pci_chipset_tag_t pc; int bus, device, function; { pcitag_t tag; @@ -107,7 +137,8 @@ mode2: } pcireg_t -pci_conf_read(tag, reg) +pci_conf_read(pc, tag, reg) + pci_chipset_tag_t pc; pcitag_t tag; int reg; { @@ -143,7 +174,8 @@ mode2: } void -pci_conf_write(tag, reg, data) +pci_conf_write(pc, tag, reg, data) + pci_chipset_tag_t pc; pcitag_t tag; int reg; pcireg_t data; @@ -221,138 +253,21 @@ not1: } int -pci_map_io(tag, reg, iobasep) - pcitag_t tag; - int reg; - int *iobasep; -{ - pcireg_t address; - int iobase; - - if (reg < PCI_MAPREG_START || reg >= PCI_MAPREG_END || (reg & 3)) - panic("pci_map_io: bad request"); - - address = pci_conf_read(tag, reg); - - if (PCI_MAPREG_TYPE(address) != PCI_MAPREG_TYPE_IO) - panic("pci_map_io: not an I/O mapping register"); - - iobase = PCI_MAPREG_IO_ADDR(address); - *iobasep = iobase; - - return 0; -} - -int -pci_map_mem(tag, reg, vap, pap) - pcitag_t tag; - int reg; - vm_offset_t *vap, *pap; -{ - pcireg_t address, mask; - int cachable; - vm_size_t size; - vm_offset_t va, pa; - - if (reg < PCI_MAPREG_START || reg >= PCI_MAPREG_END || (reg & 3)) - panic("pci_map_mem: bad request"); - - /* - * Section 6.2.5.1, `Address Maps', tells us that: - * - * 1) The builtin software should have already mapped the device in a - * reasonable way. - * - * 2) A device which wants 2^n bytes of memory will hardwire the bottom - * n bits of the address to 0. As recommended, we write all 1s and see - * what we get back. - */ - address = pci_conf_read(tag, reg); - pci_conf_write(tag, reg, 0xffffffff); - mask = pci_conf_read(tag, reg); - pci_conf_write(tag, reg, address); - - if (PCI_MAPREG_TYPE(address) == PCI_MAPREG_TYPE_IO) - panic("pci_map_mem: I/O mapping register"); - - switch (address & PCI_MAPREG_MEM_TYPE_MASK) { - case PCI_MAPREG_MEM_TYPE_32BIT: - case PCI_MAPREG_MEM_TYPE_32BIT_1M: - break; - case PCI_MAPREG_MEM_TYPE_64BIT: - printf("pci_map_mem: 64-bit memory mapping register\n"); - return EOPNOTSUPP; - default: - printf("pci_map_mem: reserved mapping register type\n"); - return EINVAL; - } - - pa = PCI_MAPREG_MEM_ADDR(address); - size = ~PCI_MAPREG_MEM_ADDR(mask) + 1; - if (size < NBPG) - size = NBPG; - - va = kmem_alloc_pageable(kernel_map, size); - if (va == 0) { - printf("pci_map_mem: not enough memory\n"); - return ENOMEM; - } - - /* - * Tell the driver where we mapped it. - * - * If the region is smaller than one page, adjust the virtual address - * to the same page offset as the physical address. - */ - *vap = va + (pa & PGOFSET); - *pap = pa; - -#if 1 - printf("pci_map_mem: mapping memory at virtual %08x, physical %08x\n", *vap, *pap); -#endif - - /* Map the space into the kernel page table. */ - cachable = PCI_MAPREG_MEM_CACHEABLE(address); - pa &= ~PGOFSET; - while (size) { - pmap_enter(pmap_kernel(), va, pa, VM_PROT_READ | VM_PROT_WRITE, - TRUE); - if (!cachable) - pmap_changebit(pa, PG_N, ~0); - else - pmap_changebit(pa, 0, ~PG_N); - va += NBPG; - pa += NBPG; - size -= NBPG; - } - - return 0; -} - -void * -pci_map_int(tag, level, func, arg, what) - pcitag_t tag; - int level; - int (*func) __P((void *)); - void *arg; - char *what; -{ - pcireg_t data; +pci_intr_map(pc, intrtag, pin, line, ihp) + pci_chipset_tag_t pc; + pcitag_t intrtag; int pin, line; - - data = pci_conf_read(tag, PCI_INTERRUPT_REG); - - pin = PCI_INTERRUPT_PIN(data); - line = PCI_INTERRUPT_LINE(data); + pci_intr_handle_t *ihp; +{ if (pin == 0) { /* No IRQ used. */ - return 0; + goto bad; } if (pin > 4) { - printf("pci_map_int: bad interrupt pin %d\n", pin); - return NULL; + printf("pci_intr_map: bad interrupt pin %d\n", pin); + goto bad; } /* @@ -370,22 +285,62 @@ pci_map_int(tag, level, func, arg, what) * the BIOS has not configured the device. */ if (line == 0 || line == 255) { - printf("pci_map_int: no mapping for pin %c\n", '@' + pin); - return NULL; + printf("pci_intr_map: no mapping for pin %c\n", '@' + pin); + goto bad; } else { if (line >= ICU_LEN) { - printf("pci_map_int: bad interrupt line %d\n", line); - return NULL; + printf("pci_intr_map: bad interrupt line %d\n", line); + goto bad; } if (line == 2) { - printf("pci_map_int: changed line 2 to line 9\n"); + printf("pci_intr_map: changed line 2 to line 9\n"); line = 9; } } -#if 1 - printf("pci_map_int: pin %c mapped to line %d\n", '@' + pin, line); -#endif + *ihp = line; + return 0; + +bad: + *ihp = -1; + return 1; +} + +const char * +pci_intr_string(pc, ih) + pci_chipset_tag_t pc; + pci_intr_handle_t ih; +{ + static char irqstr[8]; /* 4 + 2 + NULL + sanity */ + + if (ih == 0 || ih >= ICU_LEN || ih == 2) + panic("pci_intr_string: bogus handle 0x%x\n", ih); + + sprintf(irqstr, "irq %d", ih); + return (irqstr); + +} + +void * +pci_intr_establish(pc, ih, level, func, arg, what) + pci_chipset_tag_t pc; + pci_intr_handle_t ih; + int level, (*func) __P((void *)); + void *arg; + char *what; +{ + + if (ih == 0 || ih >= ICU_LEN || ih == 2) + panic("pci_intr_establish: bogus handle 0x%x\n", ih); + + return isa_intr_establish(NULL, ih, IST_LEVEL, level, func, arg, what); +} + +void +pci_intr_disestablish(pc, cookie) + pci_chipset_tag_t pc; + void *cookie; +{ - return isa_intr_establish(line, IST_LEVEL, level, func, arg, what); + return isa_intr_disestablish(NULL, cookie); } diff --git a/sys/arch/i386/pci/pci_machdep.h b/sys/arch/i386/pci/pci_machdep.h index 43adfb2dfcb..e4c21cb3399 100644 --- a/sys/arch/i386/pci/pci_machdep.h +++ b/sys/arch/i386/pci/pci_machdep.h @@ -1,7 +1,8 @@ -/* $OpenBSD: pci_machdep.h,v 1.2 1996/04/18 19:22:23 niklas Exp $ */ -/* $NetBSD: pci_machdep.h,v 1.4 1996/03/14 02:37:59 cgd Exp $ */ +/* $OpenBSD: pci_machdep.h,v 1.3 1996/04/21 22:17:34 deraadt Exp $ */ +/* $NetBSD: pci_machdep.h,v 1.5 1996/03/27 04:01:16 cgd Exp $ */ /* + * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. * Copyright (c) 1994 Charles Hannum. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,54 +33,63 @@ /* * Machine-specific definitions for PCI autoconfiguration. - * - * See the comments in pci_machdep.c for more explanation. */ /* + * i386-specific PCI structure and type definitions. + * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE. + * * Configuration tag; created from a {bus,device,function} triplet by * pci_make_tag(), and passed to pci_conf_read() and pci_conf_write(). * We could instead always pass the {bus,device,function} triplet to * the read and write routines, but this would cause extra overhead. * - * Machines other than PCs are likely to use the equivalent of mode 1 - * tags always. Mode 2 is historical and deprecated by the Revision - * 2.0 specification. + * Mode 2 is historical and deprecated by the Revision 2.0 specification. */ -typedef union { - u_long mode1; +union i386_pci_tag_u { + u_int32_t mode1; struct { - u_short port; - u_char enable; - u_char forward; + u_int16_t port; + u_int8_t enable; + u_int8_t forward; } mode2; -} pcitag_t; +}; /* - * Type of a value read from or written to a configuration register. - * Always 32 bits. + * Types provided to machine-independent PCI code */ -typedef u_int32_t pcireg_t; +typedef void *pci_chipset_tag_t; +typedef union i386_pci_tag_u pcitag_t; +typedef int pci_intr_handle_t; /* - * PCs which use Configuration Mechanism #2 are limited to 16 - * devices per bus. + * i386-specific PCI variables and functions. + * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE. */ -#define PCI_MAX_DEVICE_NUMBER (pci_mode == 2 ? 16 : 32) +extern int pci_mode; +int pci_mode_detect __P((void)); /* - * Hook for PCI bus attach function to do any necessary machine-specific - * operations. + * Functions provided to machine-independent PCI code. */ - -#define pci_md_attach_hook(parent, sc, pba) \ - do { \ - if (pba->pba_bus == 0) \ - printf(": configuration mode %d", pci_mode); \ - } while (0); +void pci_attach_hook __P((struct device *, struct device *, + struct pcibus_attach_args *)); +int pci_bus_maxdevs __P((pci_chipset_tag_t, int)); +pcitag_t pci_make_tag __P((pci_chipset_tag_t, int, int, int)); +pcireg_t pci_conf_read __P((pci_chipset_tag_t, pcitag_t, int)); +void pci_conf_write __P((pci_chipset_tag_t, pcitag_t, int, + pcireg_t)); +int pci_intr_map __P((pci_chipset_tag_t, pcitag_t, int, int, + pci_intr_handle_t *)); +const char *pci_intr_string __P((pci_chipset_tag_t, pci_intr_handle_t)); +void *pci_intr_establish __P((pci_chipset_tag_t, pci_intr_handle_t, + int, int (*)(void *), void *, char *)); +void pci_intr_disestablish __P((pci_chipset_tag_t, void *)); /* - * Miscellaneous variables and functions. + * Compatibility functions, to map the old i386 PCI functions to the new ones. + * NOT TO BE USED BY NEW CODE. */ -extern int pci_mode; -extern int pci_mode_detect __P((void)); +void *pci_map_int __P((pcitag_t, int, int (*)(void *), void *)); +int pci_map_io __P((pcitag_t, int, int *)); +int pci_map_mem __P((pcitag_t, int, vm_offset_t *, vm_offset_t *)); diff --git a/sys/arch/m68k/include/endian.h b/sys/arch/m68k/include/endian.h index 4422c1906c1..90ae3d5190e 100644 --- a/sys/arch/m68k/include/endian.h +++ b/sys/arch/m68k/include/endian.h @@ -1,4 +1,5 @@ -/* $NetBSD: endian.h,v 1.6 1994/10/26 07:50:45 cgd Exp $ */ +/* $OpenBSD: endian.h,v 1.2 1996/04/21 22:17:40 deraadt Exp $ */ +/* $NetBSD: endian.h,v 1.7 1996/03/29 01:40:31 briggs Exp $ */ /* * Copyright (c) 1987, 1991 Regents of the University of California. @@ -73,10 +74,10 @@ __END_DECLS #define htonl(x) (x) #define htons(x) (x) -#define NTOHL(x) (x) -#define NTOHS(x) (x) -#define HTONL(x) (x) -#define HTONS(x) (x) +#define NTOHL(x) (void) (x) +#define NTOHS(x) (void) (x) +#define HTONL(x) (void) (x) +#define HTONS(x) (void) (x) #else diff --git a/sys/arch/m68k/m68k/db_disasm.c b/sys/arch/m68k/m68k/db_disasm.c index 6abada013ed..b4c157e8a3f 100644 --- a/sys/arch/m68k/m68k/db_disasm.c +++ b/sys/arch/m68k/m68k/db_disasm.c @@ -1,4 +1,5 @@ -/* $NetBSD: db_disasm.c,v 1.12 1994/11/14 20:53:52 gwr Exp $ */ +/* $OpenBSD: db_disasm.c,v 1.2 1996/04/21 22:17:44 deraadt Exp $ */ +/* $NetBSD: db_disasm.c,v 1.13 1996/04/01 01:38:01 briggs Exp $ */ /* * Copyright (c) 1994 Christian E. Hopps @@ -67,6 +68,7 @@ #include <machine/db_machdep.h> #include <ddb/db_sym.h> +#include <ddb/db_output.h> #include <m68k/m68k/db_disasm.h> void get_modregstr __P((dis_buffer_t *, int, int, int, int)); @@ -170,10 +172,6 @@ db_disasm(loc, moto_syntax) u_short opc; dis_func_t *func; dis_buffer_t dbuf; - char *symname = NULL; - db_expr_t diff; - db_sym_t sym; - struct nlist *nl; dbuf.casm = dbuf.dasm = asm_buffer; dbuf.cinfo = dbuf.info = info_buffer; @@ -553,7 +551,6 @@ opcode_misc(dbuf, opc) { char *tmp; int sz; - u_short ext; tmp = NULL; @@ -1369,7 +1366,7 @@ opcode_fpu(dbuf, opc) u_short opc; { u_short ext; - int sz, type, opmode; + int type, opmode; type = BITFIELD(opc,8,6); switch (type) { @@ -1581,7 +1578,7 @@ opcode_fmove_ext(dbuf, opc, ext) u_short opc, ext; { int sz; - + if (BITFIELD(ext,15,13) == 3) { /* fmove r ==> m */ addstr(dbuf, "fmov"); @@ -1684,7 +1681,7 @@ opcode_mmu(dbuf, opc) u_short opc; { u_short ext; - int sz, type, opmode; + int type; type = BITFIELD(opc,8,6); switch (type) { @@ -1968,9 +1965,6 @@ opcode_mmu040(dbuf, opc) dis_buffer_t *dbuf; u_short opc; { - u_short ext; - int sz, type; - if (ISBITSET(opc, 6)) { addstr(dbuf, "ptest"); if (ISBITSET(opc, 5)) @@ -2269,7 +2263,7 @@ addstr(dbuf, s) dis_buffer_t *dbuf; const char *s; { - while (*dbuf->casm++ = *s++) + while ((*dbuf->casm++ = *s++)) ; dbuf->casm--; } @@ -2282,7 +2276,7 @@ iaddstr(dbuf, s) dis_buffer_t *dbuf; const char *s; { - while (*dbuf->cinfo++ = *s++) + while ((*dbuf->cinfo++ = *s++)) ; dbuf->cinfo--; } @@ -3067,7 +3061,7 @@ printu_wb(dbuf, val, sz, base) *++p = "0123456789abcdef"[val % base]; } while (val /= base); - while (ch = *p--) + while ((ch = *p--)) addchar(ch); *dbuf->casm = 0; @@ -3108,7 +3102,7 @@ iprintu_wb(dbuf, val, sz, base) *++p = "0123456789abcdef"[val % base]; } while (val /= base); - while (ch = *p--) + while ((ch = *p--)) iaddchar(ch); *dbuf->cinfo = 0; diff --git a/sys/arch/m68k/m68k/db_disasm.h b/sys/arch/m68k/m68k/db_disasm.h index 0ed599960a8..7dcd41158e7 100644 --- a/sys/arch/m68k/m68k/db_disasm.h +++ b/sys/arch/m68k/m68k/db_disasm.h @@ -1,4 +1,5 @@ -/* $NetBSD: db_disasm.h,v 1.3 1994/10/26 07:51:05 cgd Exp $ */ +/* $OpenBSD: db_disasm.h,v 1.2 1996/04/21 22:17:47 deraadt Exp $ */ +/* $NetBSD: db_disasm.h,v 1.4 1996/04/01 01:38:12 briggs Exp $ */ /* * Copyright (c) 1994 Christian E. Hopps @@ -425,3 +426,7 @@ typedef struct dis_buffer dis_buffer_t; #define PRINT_DREG(dbuf, reg) addstr(dbuf, dregs[reg]) #define PRINT_AREG(dbuf, reg) addstr(dbuf, aregs[reg]) +vm_offset_t db_disasm __P((vm_offset_t loc, boolean_t moto_syntax)); +void get_modregstr_moto __P((dis_buffer_t *dbuf, int bit, int mod, int sz, int dd)); +void get_modregstr_mit __P((dis_buffer_t *dbuf, int bit, int mod, int sz, int dd)); +u_long get_areg_val __P((int reg)); diff --git a/sys/arch/m68k/m68k/db_interface.c b/sys/arch/m68k/m68k/db_interface.c index e28fa329341..411ab3673da 100644 --- a/sys/arch/m68k/m68k/db_interface.c +++ b/sys/arch/m68k/m68k/db_interface.c @@ -1,5 +1,5 @@ -/* $OpenBSD: db_interface.c,v 1.3 1996/04/19 06:18:15 niklas Exp $ */ -/* $NetBSD: db_interface.c,v 1.18 1996/02/22 23:23:23 gwr Exp $ */ +/* $OpenBSD: db_interface.c,v 1.4 1996/04/21 22:17:49 deraadt Exp $ */ +/* $NetBSD: db_interface.c,v 1.19 1996/03/16 18:45:44 mhitch Exp $ */ /* * Mach Operating System @@ -135,7 +135,7 @@ kdbprinttrap(type, code) printf(" trap\n"); } -int +void Debugger() { asm ("trap #15"); diff --git a/sys/arch/m68k/m68k/ns_cksum.c b/sys/arch/m68k/m68k/ns_cksum.c index 96d5303d53b..bafbe4c64fc 100644 --- a/sys/arch/m68k/m68k/ns_cksum.c +++ b/sys/arch/m68k/m68k/ns_cksum.c @@ -1,4 +1,5 @@ -/* $NetBSD: ns_cksum.c,v 1.4 1994/10/26 07:51:12 cgd Exp $ */ +/* $OpenBSD: ns_cksum.c,v 1.2 1996/04/21 22:17:51 deraadt Exp $ */ +/* $NetBSD: ns_cksum.c,v 1.5 1996/04/01 01:38:15 briggs Exp $ */ /* * Copyright (c) 1982, 1988 Regents of the University of California. @@ -37,6 +38,7 @@ #include <sys/param.h> #include <sys/mbuf.h> +#include <netns/ns_var.h> /* * Checksum routine for Network Systems Protocol Packets (Big-Endian). |