1996-12-08 03:22:08 +03:00
|
|
|
/* $NetBSD: apecs.c,v 1.17 1996/12/08 00:22:14 cgd Exp $ */
|
1995-06-28 05:24:50 +04:00
|
|
|
|
|
|
|
/*
|
1996-04-12 10:07:05 +04:00
|
|
|
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
|
1995-06-28 05:24:50 +04:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Author: Chris G. Demetriou
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify and distribute this software and
|
|
|
|
* its documentation is hereby granted, provided that both the copyright
|
|
|
|
* notice and this permission notice appear in all copies of the
|
|
|
|
* software, derivative works or modified versions, and any portions
|
|
|
|
* thereof, and that both notices appear in supporting documentation.
|
|
|
|
*
|
|
|
|
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
|
|
|
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
|
|
|
|
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
|
|
|
*
|
|
|
|
* Carnegie Mellon requests users of this software to return to
|
|
|
|
*
|
|
|
|
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
|
|
|
* School of Computer Science
|
|
|
|
* Carnegie Mellon University
|
|
|
|
* Pittsburgh PA 15213-3890
|
|
|
|
*
|
|
|
|
* any improvements or extensions that they make and grant Carnegie the
|
|
|
|
* rights to redistribute these changes.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/kernel.h>
|
|
|
|
#include <sys/malloc.h>
|
|
|
|
#include <sys/device.h>
|
|
|
|
#include <vm/vm.h>
|
|
|
|
|
|
|
|
#include <machine/autoconf.h>
|
|
|
|
#include <machine/rpb.h>
|
|
|
|
|
|
|
|
#include <dev/isa/isareg.h>
|
|
|
|
#include <dev/isa/isavar.h>
|
|
|
|
|
|
|
|
#include <dev/pci/pcireg.h>
|
|
|
|
#include <dev/pci/pcivar.h>
|
|
|
|
#include <alpha/pci/apecsreg.h>
|
1995-11-23 05:33:17 +03:00
|
|
|
#include <alpha/pci/apecsvar.h>
|
1996-07-11 07:30:11 +04:00
|
|
|
#if defined(DEC_2100_A50)
|
1996-04-12 08:38:33 +04:00
|
|
|
#include <alpha/pci/pci_2100_a50.h>
|
1996-07-11 07:30:11 +04:00
|
|
|
#endif
|
1995-06-28 05:24:50 +04:00
|
|
|
|
1996-12-05 04:39:27 +03:00
|
|
|
int apecsmatch __P((struct device *, struct cfdata *, void *));
|
1995-06-28 05:24:50 +04:00
|
|
|
void apecsattach __P((struct device *, struct device *, void *));
|
|
|
|
|
1996-03-17 04:03:02 +03:00
|
|
|
struct cfattach apecs_ca = {
|
1996-04-12 08:38:33 +04:00
|
|
|
sizeof(struct apecs_softc), apecsmatch, apecsattach,
|
1996-03-17 04:03:02 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
struct cfdriver apecs_cd = {
|
1996-04-12 08:38:33 +04:00
|
|
|
NULL, "apecs", DV_DULL,
|
1995-06-28 05:24:50 +04:00
|
|
|
};
|
|
|
|
|
1996-08-28 01:53:46 +04:00
|
|
|
static int apecsprint __P((void *, const char *pnp));
|
1995-06-28 05:24:50 +04:00
|
|
|
|
1995-11-23 05:33:17 +03:00
|
|
|
/* There can be only one. */
|
|
|
|
int apecsfound;
|
|
|
|
struct apecs_config apecs_configuration;
|
1995-06-28 05:24:50 +04:00
|
|
|
|
|
|
|
int
|
|
|
|
apecsmatch(parent, match, aux)
|
|
|
|
struct device *parent;
|
1996-12-05 04:39:27 +03:00
|
|
|
struct cfdata *match;
|
|
|
|
void *aux;
|
1995-06-28 05:24:50 +04:00
|
|
|
{
|
1995-11-23 05:33:17 +03:00
|
|
|
struct confargs *ca = aux;
|
1995-06-28 05:24:50 +04:00
|
|
|
|
1995-11-23 05:33:17 +03:00
|
|
|
/* Make sure that we're looking for an APECS. */
|
1996-03-17 04:03:02 +03:00
|
|
|
if (strcmp(ca->ca_name, apecs_cd.cd_name) != 0)
|
1995-11-23 05:33:17 +03:00
|
|
|
return (0);
|
|
|
|
|
|
|
|
if (apecsfound)
|
|
|
|
return (0);
|
1995-06-28 05:24:50 +04:00
|
|
|
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
|
1995-08-03 04:44:57 +04:00
|
|
|
/*
|
|
|
|
* Set up the chipset's function pointers.
|
|
|
|
*/
|
|
|
|
void
|
1996-11-25 06:56:48 +03:00
|
|
|
apecs_init(acp, mallocsafe)
|
1995-11-23 05:33:17 +03:00
|
|
|
struct apecs_config *acp;
|
1996-11-25 06:56:48 +03:00
|
|
|
int mallocsafe;
|
1995-08-03 04:44:57 +04:00
|
|
|
{
|
1995-11-23 05:33:17 +03:00
|
|
|
acp->ac_comanche_pass2 =
|
|
|
|
(REGVAL(COMANCHE_ED) & COMANCHE_ED_PASS2) != 0;
|
|
|
|
acp->ac_memwidth =
|
|
|
|
(REGVAL(COMANCHE_GCR) & COMANCHE_GCR_WIDEMEM) != 0 ? 128 : 64;
|
|
|
|
acp->ac_epic_pass2 =
|
|
|
|
(REGVAL(EPIC_DCSR) & EPIC_DCSR_PASS2) != 0;
|
|
|
|
|
1996-11-25 06:56:48 +03:00
|
|
|
acp->ac_haxr1 = REGVAL(EPIC_HAXR1);
|
|
|
|
acp->ac_haxr2 = REGVAL(EPIC_HAXR2);
|
|
|
|
|
1995-11-23 05:33:17 +03:00
|
|
|
/*
|
|
|
|
* Can't set up SGMAP data here; can be called before malloc().
|
1996-11-25 06:56:48 +03:00
|
|
|
* XXX THIS COMMENT NO LONGER MAKES SENSE.
|
1995-11-23 05:33:17 +03:00
|
|
|
*/
|
|
|
|
|
1996-11-25 06:56:48 +03:00
|
|
|
if (!acp->ac_initted) {
|
|
|
|
/* don't do these twice since they set up extents */
|
|
|
|
acp->ac_iot = apecs_bus_io_init(acp);
|
|
|
|
acp->ac_memt = apecs_bus_mem_init(acp);
|
|
|
|
}
|
|
|
|
acp->ac_mallocsafe = mallocsafe;
|
|
|
|
|
1996-04-12 08:38:33 +04:00
|
|
|
apecs_pci_init(&acp->ac_pc, acp);
|
1995-11-23 05:33:17 +03:00
|
|
|
|
|
|
|
/* Turn off DMA window enables in PCI Base Reg 1. */
|
|
|
|
REGVAL(EPIC_PCI_BASE_1) = 0;
|
1996-07-09 04:53:48 +04:00
|
|
|
alpha_mb();
|
1995-11-23 05:33:17 +03:00
|
|
|
|
|
|
|
/* XXX SGMAP? */
|
1996-10-23 08:12:13 +04:00
|
|
|
|
|
|
|
/* XXX XXX BEGIN XXX XXX */
|
|
|
|
{ /* XXX */
|
|
|
|
extern vm_offset_t alpha_XXX_dmamap_or; /* XXX */
|
|
|
|
alpha_XXX_dmamap_or = 0x40000000; /* XXX */
|
|
|
|
} /* XXX */
|
|
|
|
/* XXX XXX END XXX XXX */
|
1996-11-25 06:56:48 +03:00
|
|
|
|
|
|
|
acp->ac_initted = 1;
|
1995-08-03 04:44:57 +04:00
|
|
|
}
|
|
|
|
|
1995-06-28 05:24:50 +04:00
|
|
|
void
|
|
|
|
apecsattach(parent, self, aux)
|
|
|
|
struct device *parent, *self;
|
|
|
|
void *aux;
|
|
|
|
{
|
1995-11-23 05:33:17 +03:00
|
|
|
struct apecs_softc *sc = (struct apecs_softc *)self;
|
|
|
|
struct apecs_config *acp;
|
1996-04-12 08:38:33 +04:00
|
|
|
struct pcibus_attach_args pba;
|
1995-06-28 05:24:50 +04:00
|
|
|
|
1995-11-23 05:33:17 +03:00
|
|
|
/* note that we've attached the chipset; can't have 2 APECSes. */
|
|
|
|
apecsfound = 1;
|
1995-06-28 05:24:50 +04:00
|
|
|
|
1995-11-23 05:33:17 +03:00
|
|
|
/*
|
|
|
|
* set up the chipset's info; done once at console init time
|
|
|
|
* (maybe), but doesn't hurt to do twice.
|
|
|
|
*/
|
|
|
|
acp = sc->sc_acp = &apecs_configuration;
|
1996-11-25 06:56:48 +03:00
|
|
|
apecs_init(acp, 1);
|
1995-11-23 05:33:17 +03:00
|
|
|
|
|
|
|
/* XXX SGMAP FOO */
|
1995-06-28 05:24:50 +04:00
|
|
|
|
1996-10-13 06:59:55 +04:00
|
|
|
printf(": DECchip %s Core Logic chipset\n",
|
1995-11-23 05:33:17 +03:00
|
|
|
acp->ac_memwidth == 128 ? "21072" : "21071");
|
1996-10-13 06:59:55 +04:00
|
|
|
printf("%s: DC21071-CA pass %d, %d-bit memory bus\n",
|
1995-11-23 05:33:17 +03:00
|
|
|
self->dv_xname, acp->ac_comanche_pass2 ? 2 : 1, acp->ac_memwidth);
|
1996-10-13 06:59:55 +04:00
|
|
|
printf("%s: DC21071-DA pass %d\n", self->dv_xname,
|
1995-11-23 05:33:17 +03:00
|
|
|
acp->ac_epic_pass2 ? 2 : 1);
|
1995-06-28 05:24:50 +04:00
|
|
|
/* XXX print bcache size */
|
|
|
|
|
1995-11-23 05:33:17 +03:00
|
|
|
if (!acp->ac_epic_pass2)
|
1996-10-13 06:59:55 +04:00
|
|
|
printf("WARNING: 21071-DA NOT PASS2... NO BETS...\n");
|
1995-06-28 05:24:50 +04:00
|
|
|
|
|
|
|
switch (hwrpb->rpb_type) {
|
|
|
|
#if defined(DEC_2100_A50)
|
|
|
|
case ST_DEC_2100_A50:
|
1996-04-12 08:38:33 +04:00
|
|
|
pci_2100_a50_pickintr(acp);
|
1995-06-28 05:24:50 +04:00
|
|
|
break;
|
|
|
|
#endif
|
1996-11-12 00:02:32 +03:00
|
|
|
|
1995-06-28 05:24:50 +04:00
|
|
|
default:
|
|
|
|
panic("apecsattach: shouldn't be here, really...");
|
|
|
|
}
|
|
|
|
|
1996-04-12 08:38:33 +04:00
|
|
|
pba.pba_busname = "pci";
|
1996-10-23 08:12:13 +04:00
|
|
|
pba.pba_iot = acp->ac_iot;
|
|
|
|
pba.pba_memt = acp->ac_memt;
|
1996-04-12 08:38:33 +04:00
|
|
|
pba.pba_pc = &acp->ac_pc;
|
|
|
|
pba.pba_bus = 0;
|
|
|
|
config_found(self, &pba, apecsprint);
|
1995-06-28 05:24:50 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
apecsprint(aux, pnp)
|
|
|
|
void *aux;
|
1996-08-28 01:53:46 +04:00
|
|
|
const char *pnp;
|
1995-06-28 05:24:50 +04:00
|
|
|
{
|
1996-11-25 06:56:48 +03:00
|
|
|
register struct pcibus_attach_args *pba = aux;
|
1995-06-28 05:24:50 +04:00
|
|
|
|
1995-11-23 05:33:17 +03:00
|
|
|
/* only PCIs can attach to APECSes; easy. */
|
|
|
|
if (pnp)
|
1996-10-13 06:59:55 +04:00
|
|
|
printf("%s at %s", pba->pba_busname, pnp);
|
|
|
|
printf(" bus %d", pba->pba_bus);
|
1995-11-23 05:33:17 +03:00
|
|
|
return (UNCONF);
|
1995-06-28 05:24:50 +04:00
|
|
|
}
|