Module Name: src
Committed By: thorpej
Date: Sun Mar 9 01:06:42 UTC 2025
Modified Files:
src/sys/arch/alpha/alpha: api_up1000.c autoconf.c dec_1000a.c
dec_2000_300.c dec_2100_a50.c dec_2100_a500.c dec_3000_300.c
dec_3000_500.c dec_550.c dec_6600.c dec_alphabook1.c
dec_axppci_33.c dec_eb164.c dec_eb64plus.c dec_eb66.c dec_kn20aa.c
dec_kn300.c dec_kn8ae.c
src/sys/arch/alpha/conf: files.alpha
src/sys/arch/alpha/include: autoconf.h pci_machdep.h tc_machdep.h
Added Files:
src/sys/arch/alpha/pci: pci_bootdev.c pci_consinit.c
src/sys/arch/alpha/tc: tc_bootdev.c
Log Message:
Re-factor the boot device and consinit routines into common functions
per platform type (PCI vs TC), eliminating a bunch of copy-pasta.
To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/alpha/alpha/api_up1000.c
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/alpha/alpha/autoconf.c
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/alpha/alpha/dec_1000a.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/alpha/alpha/dec_2000_300.c
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/alpha/alpha/dec_2100_a50.c \
src/sys/arch/alpha/alpha/dec_axppci_33.c
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/alpha/alpha/dec_2100_a500.c
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/alpha/alpha/dec_3000_300.c
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/alpha/alpha/dec_3000_500.c
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/alpha/alpha/dec_550.c \
src/sys/arch/alpha/alpha/dec_6600.c
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/alpha/alpha/dec_alphabook1.c
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/alpha/alpha/dec_eb164.c
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/alpha/alpha/dec_eb64plus.c
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/alpha/alpha/dec_eb66.c
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/alpha/alpha/dec_kn20aa.c
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/alpha/alpha/dec_kn300.c \
src/sys/arch/alpha/alpha/dec_kn8ae.c
cvs rdiff -u -r1.198 -r1.199 src/sys/arch/alpha/conf/files.alpha
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/alpha/include/autoconf.h
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/alpha/include/pci_machdep.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/alpha/include/tc_machdep.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/alpha/pci/pci_bootdev.c \
src/sys/arch/alpha/pci/pci_consinit.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/alpha/tc/tc_bootdev.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/alpha/alpha/api_up1000.c
diff -u src/sys/arch/alpha/alpha/api_up1000.c:1.33 src/sys/arch/alpha/alpha/api_up1000.c:1.34
--- src/sys/arch/alpha/alpha/api_up1000.c:1.33 Sun Mar 31 19:06:30 2024
+++ src/sys/arch/alpha/alpha/api_up1000.c Sun Mar 9 01:06:41 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: api_up1000.c,v 1.33 2024/03/31 19:06:30 thorpej Exp $ */
+/* $NetBSD: api_up1000.c,v 1.34 2025/03/09 01:06:41 thorpej Exp $ */
/*
* Copyright (c) 1995, 1996, 1997 Carnegie-Mellon University.
@@ -30,65 +30,28 @@
* Additional Copyright (c) 1997 by Matthew Jacob for NASA/Ames Research Center
*/
-#include "opt_kgdb.h"
-
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: api_up1000.c,v 1.33 2024/03/31 19:06:30 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: api_up1000.c,v 1.34 2025/03/09 01:06:41 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
-#include <sys/termios.h>
-#include <sys/conf.h>
-#include <dev/cons.h>
#include <machine/alpha.h>
#include <machine/rpb.h>
#include <machine/autoconf.h>
#include <machine/cpuconf.h>
-#include <sys/bus.h>
-
-#include <dev/ic/comreg.h>
-#include <dev/ic/comvar.h>
-#include <dev/isa/isareg.h>
-#include <dev/isa/isavar.h>
-#include <dev/ic/i8042reg.h>
-#include <dev/ic/pckbcvar.h>
-#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
#include <alpha/pci/irongatereg.h>
#include <alpha/pci/irongatevar.h>
-#include <dev/scsipi/scsi_all.h>
-#include <dev/scsipi/scsipi_all.h>
-#include <dev/scsipi/scsiconf.h>
-#include <dev/ata/atavar.h>
-
-#include "pckbd.h"
-
-#ifndef CONSPEED
-#define CONSPEED TTYDEF_SPEED
-#endif
-static int comcnrate = CONSPEED;
-
-#define DPRINTF(x) if (bootdev_debug) printf x
-
void api_up1000_init(void);
static void api_up1000_cons_init(void);
static void api_up1000_device_register(device_t, void *);
-#ifdef KGDB
-#include <machine/db_machdep.h>
-
-static const char *kgdb_devlist[] = {
- "com",
- NULL,
-};
-#endif /* KGDB */
-
void
api_up1000_init(void)
{
@@ -109,174 +72,18 @@ api_up1000_init(void)
static void
api_up1000_cons_init(void)
{
- struct ctb *ctb;
struct irongate_config *icp;
extern struct irongate_config irongate_configuration;
icp = &irongate_configuration;
irongate_init(icp);
- ctb = (struct ctb *)(((char *)hwrpb) + hwrpb->rpb_ctb_off);
-
- switch (ctb->ctb_term_type) {
- case CTB_PRINTERPORT:
- /* serial console ... */
- /* XXX */
- {
- /*
- * Delay to allow PROM putchars to complete.
- * FIFO depth * character time,
- * character time = (1000000 / (defaultrate / 10))
- */
- DELAY(160000000 / comcnrate);
-
- if(comcnattach(&icp->ic_iot, 0x3f8, comcnrate,
- COM_FREQ, COM_TYPE_NORMAL,
- (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8))
- panic("can't init serial console");
-
- break;
- }
-
- case CTB_GRAPHICS:
-#if NPCKBD > 0
- /* display console ... */
- /* XXX */
- (void) pckbc_cnattach(&icp->ic_iot, IO_KBD, KBCMDP,
- PCKBC_KBD_SLOT, 0);
-
- if (CTB_TURBOSLOT_TYPE(ctb->ctb_turboslot) ==
- CTB_TURBOSLOT_TYPE_ISA)
- isa_display_console(&icp->ic_iot, &icp->ic_memt);
- else
- pci_display_console(&icp->ic_iot, &icp->ic_memt,
- &icp->ic_pc, CTB_TURBOSLOT_BUS(ctb->ctb_turboslot),
- CTB_TURBOSLOT_SLOT(ctb->ctb_turboslot), 0);
-#else
- panic("not configured to use display && keyboard console");
-#endif
- break;
-
- default:
- printf("ctb->ctb_term_type = 0x%lx\n", ctb->ctb_term_type);
- printf("ctb->ctb_turboslot = 0x%lx\n", ctb->ctb_turboslot);
-
- panic("consinit: unknown console type %ld",
- ctb->ctb_term_type);
- }
-#ifdef KGDB
- /* Attach the KGDB device. */
- alpha_kgdb_init(kgdb_devlist, &icp->ic_iot);
-#endif /* KGDB */
+ pci_consinit(&icp->ic_pc, &icp->ic_iot, &icp->ic_memt,
+ &icp->ic_iot, &icp->ic_memt);
}
static void
api_up1000_device_register(device_t dev, void *aux)
{
- static int found, initted, diskboot, netboot;
- static device_t pcidev, ctrlrdev;
- struct bootdev_data *b = bootdev_data;
- device_t parent = device_parent(dev);
-
- if (b == NULL || found)
- return;
-
- if (!initted) {
- diskboot = (strcasecmp(b->protocol, "SCSI") == 0) ||
- (strcasecmp(b->protocol, "IDE") == 0);
- netboot = (strcasecmp(b->protocol, "BOOTP") == 0) ||
- (strcasecmp(b->protocol, "MOP") == 0);
- DPRINTF(("\ndiskboot = %d, netboot = %d\n", diskboot, netboot));
- initted = 1;
- }
-
- if (pcidev == NULL) {
- if (!device_is_a(dev, "pci"))
- return;
- else {
- struct pcibus_attach_args *pba = aux;
-
- if ((b->slot / 1000) != pba->pba_bus)
- return;
-
- pcidev = dev;
- DPRINTF(("\npcidev = %s\n", device_xname(dev)));
- return;
- }
- }
-
- if (ctrlrdev == NULL) {
- if (parent != pcidev)
- return;
- else {
- struct pci_attach_args *pa = aux;
- int slot;
-
- slot = pa->pa_bus * 1000 + pa->pa_function * 100 +
- pa->pa_device;
- if (b->slot != slot)
- return;
-
- if (netboot) {
- booted_device = dev;
- DPRINTF(("\nbooted_device = %s\n",
- device_xname(dev)));
- found = 1;
- } else {
- ctrlrdev = dev;
- DPRINTF(("\nctrlrdev = %s\n", device_xname(dev)));
- }
- return;
- }
- }
-
- if (!diskboot)
- return;
-
- if (device_is_a(dev, "sd") ||
- device_is_a(dev, "st") ||
- device_is_a(dev, "cd")) {
- struct scsipibus_attach_args *sa = aux;
- struct scsipi_periph *periph = sa->sa_periph;
- int unit;
-
- if (device_parent(parent) != ctrlrdev)
- return;
-
- unit = periph->periph_target * 100 + periph->periph_lun;
- if (b->unit != unit)
- return;
- if (b->channel != periph->periph_channel->chan_channel)
- return;
-
- /* we've found it! */
- booted_device = dev;
- DPRINTF(("\nbooted_device = %s\n", device_xname(dev)));
- found = 1;
- }
-
- /*
- * Support to boot from IDE drives.
- */
- if (device_is_a(dev, "wd")) {
- struct ata_device *adev = aux;
-
- if (!device_is_a(parent, "atabus"))
- return;
- if (device_parent(parent) != ctrlrdev)
- return;
-
- DPRINTF(("\natapi info: drive %d, channel %d\n",
- adev->adev_drv_data->drive, adev->adev_channel));
- DPRINTF(("bootdev info: unit: %d, channel: %d\n",
- b->unit, b->channel));
- if (b->unit != adev->adev_drv_data->drive ||
- b->channel != adev->adev_channel)
- return;
-
- /* we've found it! */
- booted_device = dev;
- DPRINTF(("booted_device = %s\n", device_xname(dev)));
- found = 1;
- }
+ pci_find_bootdev(NULL, dev, aux);
}
Index: src/sys/arch/alpha/alpha/autoconf.c
diff -u src/sys/arch/alpha/alpha/autoconf.c:1.59 src/sys/arch/alpha/alpha/autoconf.c:1.60
--- src/sys/arch/alpha/alpha/autoconf.c:1.59 Sun Mar 31 19:06:30 2024
+++ src/sys/arch/alpha/alpha/autoconf.c Sun Mar 9 01:06:41 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: autoconf.c,v 1.59 2024/03/31 19:06:30 thorpej Exp $ */
+/* $NetBSD: autoconf.c,v 1.60 2025/03/09 01:06:41 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -42,7 +42,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.59 2024/03/31 19:06:30 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.60 2025/03/09 01:06:41 thorpej Exp $");
#include "pci.h"
@@ -68,6 +68,8 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v
#include <machine/intr.h>
struct bootdev_data *bootdev_data;
+bool bootdev_is_disk;
+bool bootdev_is_net;
static void parse_prom_bootdev(void);
@@ -186,8 +188,7 @@ netboot_find_rootdev_planb(void)
char ifname[IFNAMSIZ];
int i;
- if (strncasecmp(bootinfo.booted_dev, "BOOTP ", 6) != 0 &&
- strncasecmp(bootinfo.booted_dev, "MOP ", 4) != 0) {
+ if (!bootdev_is_net) {
/* We weren't netbooted. */
return;
}
@@ -313,6 +314,18 @@ parse_prom_bootdev(void)
#endif
bootdev_data = &bd;
+
+ bootdev_is_disk = (strcasecmp(bd.protocol, "SCSI") == 0) ||
+ (strcasecmp(bd.protocol, "RAID") == 0) ||
+ (strcasecmp(bd.protocol, "I2O") == 0) ||
+ (strcasecmp(bd.protocol, "IDE") == 0);
+
+ bootdev_is_net = (strcasecmp(bd.protocol, "BOOTP") == 0) ||
+ (strcasecmp(bd.protocol, "MOP") == 0);
+#if 0
+ printf("bootdev_is_disk = %d, bootdev_is_net = %d\n",
+ bootdev_is_disk, bootdev_is_net);
+#endif
}
void
Index: src/sys/arch/alpha/alpha/dec_1000a.c
diff -u src/sys/arch/alpha/alpha/dec_1000a.c:1.35 src/sys/arch/alpha/alpha/dec_1000a.c:1.36
--- src/sys/arch/alpha/alpha/dec_1000a.c:1.35 Sun Mar 31 19:06:30 2024
+++ src/sys/arch/alpha/alpha/dec_1000a.c Sun Mar 9 01:06:41 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: dec_1000a.c,v 1.35 2024/03/31 19:06:30 thorpej Exp $ */
+/* $NetBSD: dec_1000a.c,v 1.36 2025/03/09 01:06:41 thorpej Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -61,32 +61,18 @@
* Additional Copyright (c) 1997 by Matthew Jacob for NASA/Ames Research Center
*/
-#include "opt_kgdb.h"
-
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: dec_1000a.c,v 1.35 2024/03/31 19:06:30 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dec_1000a.c,v 1.36 2025/03/09 01:06:41 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
-#include <sys/termios.h>
-#include <sys/conf.h>
-#include <dev/cons.h>
#include <machine/rpb.h>
#include <machine/autoconf.h>
#include <machine/cpuconf.h>
-#include <sys/bus.h>
-
-#include <dev/ic/comreg.h>
-#include <dev/ic/comvar.h>
-#include <dev/isa/isareg.h>
-#include <dev/isa/isavar.h>
-#include <dev/ic/i8042reg.h>
-#include <dev/ic/pckbcvar.h>
-#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
#include <alpha/pci/apecsreg.h>
@@ -94,33 +80,10 @@ __KERNEL_RCSID(0, "$NetBSD: dec_1000a.c,
#include <alpha/pci/ciareg.h>
#include <alpha/pci/ciavar.h>
-#include <dev/scsipi/scsi_all.h>
-#include <dev/scsipi/scsipi_all.h>
-#include <dev/scsipi/scsiconf.h>
-
-#include <dev/ic/mlxio.h>
-#include <dev/ic/mlxvar.h>
-
-#include "pckbd.h"
-
-#ifndef CONSPEED
-#define CONSPEED TTYDEF_SPEED
-#endif
-static int comcnrate = CONSPEED;
-
void _dec_1000a_init(void);
static void dec_1000a_cons_init(void);
static void dec_1000a_device_register(device_t, void *);
-#ifdef KGDB
-#include <machine/db_machdep.h>
-
-static const char *kgdb_devlist[] = {
- "com",
- NULL,
-};
-#endif /* KGDB */
-
static const struct alpha_variation_table dec_1000_variations[] = {
{ 0, "AlphaServer 1000" },
{ 0, NULL },
@@ -169,8 +132,9 @@ dec_1000a_cons_init(void)
extern struct apecs_config apecs_configuration;
bus_space_tag_t iot, memt;
struct alpha_pci_chipset *pcichipset;
+ uint64_t saveslot;
- if(strcmp(platform.iobus, "cia") == 0) {
+ if (strcmp(platform.iobus, "cia") == 0) {
ccp = &cia_configuration;
cia_init(ccp);
iot = &ccp->cc_iot;
@@ -186,178 +150,26 @@ dec_1000a_cons_init(void)
ctb = (struct ctb *)(((char *)hwrpb) + hwrpb->rpb_ctb_off);
- switch (ctb->ctb_term_type) {
- case CTB_PRINTERPORT:
- /* serial console ... */
- /* XXX */
- {
- /*
- * Delay to allow PROM putchars to complete.
- * FIFO depth * character time,
- * character time = (1000000 / (defaultrate / 10))
- */
- DELAY(160000000 / comcnrate);
-
- if(comcnattach(iot, 0x3f8, comcnrate,
- COM_FREQ, COM_TYPE_NORMAL,
- (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8))
- panic("can't init serial console");
-
- break;
- }
-
- case CTB_GRAPHICS:
-#if NPCKBD > 0
- /* display console ... */
- /* XXX */
- (void) pckbc_cnattach(iot, IO_KBD, KBCMDP, PCKBC_KBD_SLOT, 0);
+ saveslot = ctb->ctb_turboslot;
+ if (ctb->ctb_term_type == CTB_GRAPHICS &&
+ CTB_TURBOSLOT_TYPE(ctb->ctb_turboslot) != CTB_TURBOSLOT_TYPE_PCI) {
/*
* AlphaServer 1000s have a firmware bug whereby the
* built-in ISA VGA is reported incorrectly -- ctb_turboslot
- * is mostly 0.
+ * is mostly 0. Patch it up to what the common code expects.
+ * We'll restore it at the end in case the firmware is picky.
*/
- switch (CTB_TURBOSLOT_TYPE(ctb->ctb_turboslot)) {
- case CTB_TURBOSLOT_TYPE_PCI:
- pci_display_console(iot, memt, pcichipset,
- CTB_TURBOSLOT_BUS(ctb->ctb_turboslot),
- CTB_TURBOSLOT_SLOT(ctb->ctb_turboslot), 0);
- break;
-
- default:
- isa_display_console(iot, memt);
- break;
- }
-#else
- panic("not configured to use display && keyboard console");
-#endif
- break;
+ ctb->ctb_turboslot = CTB_TURBOSLOT_TYPE_ISA << 16;
+ }
- default:
- printf("ctb->ctb_term_type = 0x%lx\n", ctb->ctb_term_type);
- printf("ctb->ctb_turboslot = 0x%lx\n", ctb->ctb_turboslot);
+ pci_consinit(pcichipset, iot, memt, iot, memt);
- panic("consinit: unknown console type %ld",
- ctb->ctb_term_type);
- }
-#ifdef KGDB
- /* Attach the KGDB device. */
- alpha_kgdb_init(kgdb_devlist, iot);
-#endif /* KGDB */
+ ctb->ctb_turboslot = saveslot;
}
static void
dec_1000a_device_register(device_t dev, void *aux)
{
- static int found, initted, diskboot, netboot;
- static device_t pcidev, ctrlrdev;
- struct bootdev_data *b = bootdev_data;
- device_t parent = device_parent(dev);
-
- if (b == NULL || found)
- return;
-
- if (!initted) {
- diskboot = (strcasecmp(b->protocol, "SCSI") == 0) ||
- (strcasecmp(b->protocol, "RAID") == 0);
- netboot = (strcasecmp(b->protocol, "BOOTP") == 0) ||
- (strcasecmp(b->protocol, "MOP") == 0);
-#if 0
- printf("diskboot = %d, netboot = %d\n", diskboot, netboot);
-#endif
- initted =1;
- }
-
- if (pcidev == NULL) {
- if (!device_is_a(dev, "pci"))
- return;
- else {
- struct pcibus_attach_args *pba = aux;
-
- if ((b->slot / 1000) != pba->pba_bus)
- return;
-
- pcidev = dev;
-#if 0
- printf("\npcidev = %s\n", device_xname(dev));
-#endif
- return;
- }
- }
-
- if (ctrlrdev == NULL) {
- if (parent != pcidev)
- return;
- else {
- struct pci_attach_args *pa = aux;
- int slot;
-
- slot = pa->pa_bus * 1000 + pa->pa_function * 100 +
- pa->pa_device;
- if (b->slot != slot)
- return;
-
- if (netboot) {
- booted_device = dev;
-#if 0
- printf("\nbooted_device = %s\n", device_xname(dev));
-#endif
- found = 1;
- } else {
- ctrlrdev = dev;
-#if 0
- printf("\nctrlrdev = %s\n", device_xname(dev));
-#endif
- }
- return;
- }
- }
-
- if (!diskboot)
- return;
-
- if (device_is_a(dev, "sd") ||
- device_is_a(dev, "st") ||
- device_is_a(dev, "cd")) {
- struct scsipibus_attach_args *sa = aux;
- struct scsipi_periph *periph = sa->sa_periph;
- int unit;
-
- if (device_parent(parent) != ctrlrdev)
- return;
-
- unit = periph->periph_target * 100 + periph->periph_lun;
- if (b->unit != unit)
- return;
- if (b->channel != periph->periph_channel->chan_channel)
- return;
-
- /* we've found it! */
- booted_device = dev;
-#if 0
- printf("\nbooted_device = %s\n", device_xname(dev));
-#endif
- found = 1;
- }
-
- if (device_is_a(dev, "ld") && device_is_a(parent, "mlx")) {
- /*
- * Argh! The attach arguments for ld devices is not
- * consistent, so each supported raid controller requires
- * different checks.
- */
- struct mlx_attach_args *mlxa = aux;
-
- if (parent != ctrlrdev)
- return;
-
- if (b->unit != mlxa->mlxa_unit)
- return;
- /* we've found it! */
- booted_device = dev;
-#if 0
- printf("\nbooted_device = %s\n", device_xname(dev));
-#endif
- found = 1;
- }
+ pci_find_bootdev(NULL, dev, aux);
}
Index: src/sys/arch/alpha/alpha/dec_2000_300.c
diff -u src/sys/arch/alpha/alpha/dec_2000_300.c:1.22 src/sys/arch/alpha/alpha/dec_2000_300.c:1.23
--- src/sys/arch/alpha/alpha/dec_2000_300.c:1.22 Sun Mar 31 19:06:30 2024
+++ src/sys/arch/alpha/alpha/dec_2000_300.c Sun Mar 9 01:06:41 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: dec_2000_300.c,v 1.22 2024/03/31 19:06:30 thorpej Exp $ */
+/* $NetBSD: dec_2000_300.c,v 1.23 2025/03/09 01:06:41 thorpej Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: dec_2000_300.c,v 1.22 2024/03/31 19:06:30 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dec_2000_300.c,v 1.23 2025/03/09 01:06:41 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -199,47 +199,38 @@ dec_2000_300_cons_init(void)
static void
dec_2000_300_device_register(device_t dev, void *aux)
{
- static int found, initted, scsiboot, netboot;
static device_t eisadev, isadev, scsidev;
struct bootdev_data *b = bootdev_data;
device_t parent = device_parent(dev);
- if (b == NULL || found)
+ if (booted_device != NULL || b == NULL) {
return;
-
- if (!initted) {
- scsiboot = (strcmp(b->protocol, "SCSI") == 0);
- netboot = (strcmp(b->protocol, "BOOTP") == 0);
-#if 0
- printf("scsiboot = %d, netboot = %d\n", scsiboot, netboot);
-#endif
- initted = 1;
}
- if (eisadev == NULL && device_is_a(dev, "eisa"))
+ if (eisadev == NULL && device_is_a(dev, "eisa")) {
eisadev = dev;
+ }
- if (isadev == NULL && device_is_a(dev, "isa"))
+ if (isadev == NULL && device_is_a(dev, "isa")) {
isadev = dev;
+ }
- if (scsiboot && (scsidev == NULL)) {
- if (eisadev == NULL || parent != eisadev)
- return;
- else {
+ if (bootdev_is_disk && scsidev == NULL) {
+ if (eisadev != NULL && parent == eisadev) {
struct eisa_attach_args *ea = aux;
- if (b->slot != ea->ea_slot)
- return;
-
- scsidev = dev;
+ if (b->slot == ea->ea_slot) {
+ scsidev = dev;
#if 0
- printf("\nscsidev = %s\n", device_xname(scsidev));
+ printf("\nscsidev = %s\n",
+ device_xname(scsidev));
#endif
- return;
+ }
}
+ return;
}
- if (scsiboot &&
+ if (bootdev_is_disk &&
(device_is_a(dev, "sd") ||
device_is_a(dev, "st") ||
device_is_a(dev, "cd"))) {
@@ -267,33 +258,27 @@ dec_2000_300_device_register(device_t de
return;
}
- /* we've found it! */
- booted_device = dev;
-#if 0
- printf("\nbooted_device = %s\n", device_xname(booted_device));
-#endif
- found = 1;
- return;
+ goto foundit;
}
- if (netboot) {
+ if (bootdev_is_net) {
/*
* XXX WHAT ABOUT ISA NETWORK CARDS?
*/
- if (eisadev == NULL || parent != eisadev)
- return;
- else {
+ if (eisadev != NULL && parent == eisadev) {
struct eisa_attach_args *ea = aux;
- if (b->slot != ea->ea_slot)
- return;
+ if (b->slot == ea->ea_slot) {
+ goto foundit;
+ }
+ }
+ }
- booted_device = dev;
+ return;
+
+ foundit:
+ booted_device = dev;
#if 0
- printf("\nbooted_device = %s\n", device_xname(booted_device));
+ printf("\nbooted_device = %s\n", device_xname(booted_device));
#endif
- found = 1;
- return;
- }
- }
}
Index: src/sys/arch/alpha/alpha/dec_2100_a50.c
diff -u src/sys/arch/alpha/alpha/dec_2100_a50.c:1.70 src/sys/arch/alpha/alpha/dec_2100_a50.c:1.71
--- src/sys/arch/alpha/alpha/dec_2100_a50.c:1.70 Sun Mar 31 19:06:30 2024
+++ src/sys/arch/alpha/alpha/dec_2100_a50.c Sun Mar 9 01:06:41 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: dec_2100_a50.c,v 1.70 2024/03/31 19:06:30 thorpej Exp $ */
+/* $NetBSD: dec_2100_a50.c,v 1.71 2025/03/09 01:06:41 thorpej Exp $ */
/*
* Copyright (c) 1995, 1996, 1997 Carnegie-Mellon University.
@@ -30,51 +30,25 @@
* Additional Copyright (c) 1997 by Matthew Jacob for NASA/Ames Research Center
*/
-#include "opt_kgdb.h"
-
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: dec_2100_a50.c,v 1.70 2024/03/31 19:06:30 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dec_2100_a50.c,v 1.71 2025/03/09 01:06:41 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <sys/lwp.h>
-#include <sys/termios.h>
-
-#include <sys/conf.h>
-#include <dev/cons.h>
#include <machine/rpb.h>
#include <machine/alpha.h>
#include <machine/autoconf.h>
#include <machine/cpuconf.h>
-#include <sys/bus.h>
-
-#include <dev/ic/comreg.h>
-#include <dev/ic/comvar.h>
+#include <machine/logout.h>
-#include <dev/isa/isareg.h>
-#include <dev/isa/isavar.h>
-#include <dev/ic/i8042reg.h>
-#include <dev/ic/pckbcvar.h>
-#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
#include <alpha/pci/apecsreg.h>
#include <alpha/pci/apecsvar.h>
-#include <machine/logout.h>
-
-#include <dev/scsipi/scsi_all.h>
-#include <dev/scsipi/scsipi_all.h>
-#include <dev/scsipi/scsiconf.h>
-
-#include "pckbd.h"
-
-#ifndef CONSPEED
-#define CONSPEED TTYDEF_SPEED
-#endif
-static int comcnrate = CONSPEED;
void dec_2100_a50_init(void);
static void dec_2100_a50_cons_init(void);
@@ -87,15 +61,6 @@ static void dec_2100_a50_mcheck(unsigned
unsigned long, struct trapframe *);
-#ifdef KGDB
-#include <machine/db_machdep.h>
-
-static const char *kgdb_devlist[] = {
- "com",
- NULL,
-};
-#endif /* KGDB */
-
const struct alpha_variation_table dec_2100_a50_variations[] = {
{ SV_ST_AVANTI, "AlphaStation 400 4/233 (\"Avanti\")" },
{ SV_ST_MUSTANG2_4_166, "AlphaStation 200 4/166 (\"Mustang II\")" },
@@ -134,162 +99,22 @@ dec_2100_a50_init(void)
static void
dec_2100_a50_cons_init(void)
{
- struct ctb *ctb;
struct apecs_config *acp;
extern struct apecs_config apecs_configuration;
acp = &apecs_configuration;
apecs_init(acp);
- ctb = (struct ctb *)(((char *)hwrpb) + hwrpb->rpb_ctb_off);
-
- switch (ctb->ctb_term_type) {
- case CTB_PRINTERPORT:
- /* serial console ... */
- /* XXX */
- {
- /*
- * Delay to allow PROM putchars to complete.
- * FIFO depth * character time,
- * character time = (1000000 / (defaultrate / 10))
- */
- DELAY(160000000 / comcnrate);
-
- if(comcnattach(&acp->ac_iot, 0x3f8, comcnrate,
- COM_FREQ, COM_TYPE_NORMAL,
- (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8))
- panic("can't init serial console");
-
- break;
- }
-
- case CTB_GRAPHICS:
-#if NPCKBD > 0
- /* display console ... */
- /* XXX */
- (void) pckbc_cnattach(&acp->ac_iot, IO_KBD, KBCMDP,
- PCKBC_KBD_SLOT, 0);
-
- if (CTB_TURBOSLOT_TYPE(ctb->ctb_turboslot) ==
- CTB_TURBOSLOT_TYPE_ISA)
- isa_display_console(&acp->ac_iot, &acp->ac_memt);
- else
- pci_display_console(&acp->ac_iot, &acp->ac_memt,
- &acp->ac_pc, CTB_TURBOSLOT_BUS(ctb->ctb_turboslot),
- CTB_TURBOSLOT_SLOT(ctb->ctb_turboslot), 0);
-#else
- panic("not configured to use display && keyboard console");
-#endif
- break;
-
- default:
- printf("ctb->ctb_term_type = 0x%lx\n", ctb->ctb_term_type);
- printf("ctb->ctb_turboslot = 0x%lx\n", ctb->ctb_turboslot);
-
- panic("consinit: unknown console type %ld",
- ctb->ctb_term_type);
- }
-#ifdef KGDB
- /* Attach the KGDB device. */
- alpha_kgdb_init(kgdb_devlist, &acp->ac_iot);
-#endif /* KGDB */
+ pci_consinit(&acp->ac_pc, &acp->ac_iot, &acp->ac_memt,
+ &acp->ac_iot, &acp->ac_memt);
}
static void
dec_2100_a50_device_register(device_t dev, void *aux)
{
- static int found, initted, diskboot, netboot;
- static device_t pcidev, ctrlrdev;
- struct bootdev_data *b = bootdev_data;
- device_t parent = device_parent(dev);
-
- if (b == NULL || found)
- return;
-
- if (!initted) {
- diskboot = (strcasecmp(b->protocol, "SCSI") == 0);
- netboot = (strcasecmp(b->protocol, "BOOTP") == 0) ||
- (strcasecmp(b->protocol, "MOP") == 0);
-#if 0
- printf("diskboot = %d, netboot = %d\n", diskboot, netboot);
-#endif
- initted =1;
- }
-
- if (pcidev == NULL) {
- if (!device_is_a(dev, "pci"))
- return;
- else {
- struct pcibus_attach_args *pba = aux;
-
- if ((b->slot / 1000) != pba->pba_bus)
- return;
-
- pcidev = dev;
-#if 0
- printf("\npcidev = %s\n", device_xname(dev));
-#endif
- return;
- }
- }
-
- if (ctrlrdev == NULL) {
- if (parent != pcidev)
- return;
- else {
- struct pci_attach_args *pa = aux;
- int slot;
-
- slot = pa->pa_bus * 1000 + pa->pa_function * 100 +
- pa->pa_device;
- if (b->slot != slot)
- return;
-
- if (netboot) {
- booted_device = dev;
-#if 0
- printf("\nbooted_device = %s\n", device_xname(dev));
-#endif
- found = 1;
- } else {
- ctrlrdev = dev;
-#if 0
- printf("\nctrlrdev = %s\n", device_xname(dev));
-#endif
- }
- return;
- }
- }
-
- if (!diskboot)
- return;
-
- if (device_is_a(dev, "sd") ||
- device_is_a(dev, "st") ||
- device_is_a(dev, "cd")) {
- struct scsipibus_attach_args *sa = aux;
- struct scsipi_periph *periph = sa->sa_periph;
- int unit;
-
- if (device_parent(parent) != ctrlrdev)
- return;
-
- unit = periph->periph_target * 100 + periph->periph_lun;
- if (b->unit != unit)
- return;
- if (b->channel != periph->periph_channel->chan_channel)
- return;
-
- /* we've found it! */
- booted_device = dev;
-#if 0
- printf("\nbooted_device = %s\n", device_xname(dev));
-#endif
- found = 1;
- }
+ pci_find_bootdev(NULL, dev, aux);
}
-
static void
dec_2100_a50_mcheck(unsigned long mces, unsigned long type, unsigned long logout, struct trapframe *framep)
{
Index: src/sys/arch/alpha/alpha/dec_axppci_33.c
diff -u src/sys/arch/alpha/alpha/dec_axppci_33.c:1.70 src/sys/arch/alpha/alpha/dec_axppci_33.c:1.71
--- src/sys/arch/alpha/alpha/dec_axppci_33.c:1.70 Sun Mar 31 19:06:30 2024
+++ src/sys/arch/alpha/alpha/dec_axppci_33.c Sun Mar 9 01:06:41 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: dec_axppci_33.c,v 1.70 2024/03/31 19:06:30 thorpej Exp $ */
+/* $NetBSD: dec_axppci_33.c,v 1.71 2025/03/09 01:06:41 thorpej Exp $ */
/*
* Copyright (c) 1995, 1996, 1997 Carnegie-Mellon University.
@@ -30,61 +30,27 @@
* Additional Copyright (c) 1997 by Matthew Jacob for NASA/Ames Research Center
*/
-#include "opt_kgdb.h"
-
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: dec_axppci_33.c,v 1.70 2024/03/31 19:06:30 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dec_axppci_33.c,v 1.71 2025/03/09 01:06:41 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
-#include <sys/termios.h>
-#include <sys/conf.h>
-#include <dev/cons.h>
#include <machine/rpb.h>
-#include <machine/alpha.h>
#include <machine/autoconf.h>
#include <machine/cpuconf.h>
-#include <dev/ic/comreg.h>
-#include <dev/ic/comvar.h>
-
-#include <dev/isa/isareg.h>
-#include <dev/isa/isavar.h>
-#include <dev/ic/i8042reg.h>
-#include <dev/ic/pckbcvar.h>
-#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
#include <alpha/pci/lcareg.h>
#include <alpha/pci/lcavar.h>
-#include <dev/scsipi/scsi_all.h>
-#include <dev/scsipi/scsipi_all.h>
-#include <dev/scsipi/scsiconf.h>
-
-#include "pckbd.h"
-
-#ifndef CONSPEED
-#define CONSPEED TTYDEF_SPEED
-#endif
-static int comcnrate = CONSPEED;
-
void dec_axppci_33_init(void);
static void dec_axppci_33_cons_init(void);
static void dec_axppci_33_device_register(device_t, void *);
-#ifdef KGDB
-#include <machine/db_machdep.h>
-
-static const char *kgdb_devlist[] = {
- "com",
- NULL,
-};
-#endif /* KGDB */
-
const struct alpha_variation_table dec_axppci_33_variations[] = {
{ 0, "Alpha PC AXPpci33 (\"NoName\")" },
{ 0, NULL },
@@ -160,155 +126,16 @@ dec_axppci_33_init(void)
static void
dec_axppci_33_cons_init(void)
{
- struct ctb *ctb;
struct lca_config *lcp;
lcp = lca_preinit();
- ctb = (struct ctb *)(((char *)hwrpb) + hwrpb->rpb_ctb_off);
-
- switch (ctb->ctb_term_type) {
- case CTB_PRINTERPORT:
- /* serial console ... */
- /* XXX */
- {
- /*
- * Delay to allow PROM putchars to complete.
- * FIFO depth * character time,
- * character time = (1000000 / (defaultrate / 10))
- */
- DELAY(160000000 / comcnrate);
-
- if(comcnattach(&lcp->lc_iot, 0x3f8, comcnrate,
- COM_FREQ, COM_TYPE_NORMAL,
- (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8))
- panic("can't init serial console");
-
- break;
- }
-
- case CTB_GRAPHICS:
-#if NPCKBD > 0
- /* display console ... */
- /* XXX */
- (void) pckbc_cnattach(&lcp->lc_iot, IO_KBD, KBCMDP,
- PCKBC_KBD_SLOT, 0);
-
- if (CTB_TURBOSLOT_TYPE(ctb->ctb_turboslot) ==
- CTB_TURBOSLOT_TYPE_ISA)
- isa_display_console(&lcp->lc_iot, &lcp->lc_memt);
- else
- pci_display_console(&lcp->lc_iot, &lcp->lc_memt,
- &lcp->lc_pc, CTB_TURBOSLOT_BUS(ctb->ctb_turboslot),
- CTB_TURBOSLOT_SLOT(ctb->ctb_turboslot), 0);
-#else
- panic("not configured to use display && keyboard console");
-#endif
- break;
-
- default:
- printf("ctb->ctb_term_type = 0x%lx\n", ctb->ctb_term_type);
- printf("ctb->ctb_turboslot = 0x%lx\n", ctb->ctb_turboslot);
-
- panic("consinit: unknown console type %ld",
- ctb->ctb_term_type);
- }
-#ifdef KGDB
- /* Attach the KGDB device. */
- alpha_kgdb_init(kgdb_devlist, &lcp->lc_iot);
-#endif /* KGDB */
+ pci_consinit(&lcp->lc_pc, &lcp->lc_iot, &lcp->lc_memt,
+ &lcp->lc_iot, &lcp->lc_memt);
}
static void
dec_axppci_33_device_register(device_t dev, void *aux)
{
- static int found, initted, diskboot, netboot;
- static device_t pcidev, ctrlrdev;
- struct bootdev_data *b = bootdev_data;
- device_t parent = device_parent(dev);
-
- if (b == NULL || found)
- return;
-
- if (!initted) {
- diskboot = (strcasecmp(b->protocol, "SCSI") == 0);
- netboot = (strcasecmp(b->protocol, "BOOTP") == 0) ||
- (strcasecmp(b->protocol, "MOP") == 0);
-#if 0
- printf("diskboot = %d, netboot = %d\n", diskboot, netboot);
-#endif
- initted =1;
- }
-
- if (pcidev == NULL) {
- if (!device_is_a(dev, "pci"))
- return;
- else {
- struct pcibus_attach_args *pba = aux;
-
- if ((b->slot / 1000) != pba->pba_bus)
- return;
-
- pcidev = dev;
-#if 0
- printf("\npcidev = %s\n", device_xname(dev));
-#endif
- return;
- }
- }
-
- if (ctrlrdev == NULL) {
- if (parent != pcidev)
- return;
- else {
- struct pci_attach_args *pa = aux;
- int slot;
-
- slot = pa->pa_bus * 1000 + pa->pa_function * 100 +
- pa->pa_device;
- if (b->slot != slot)
- return;
-
- if (netboot) {
- booted_device = dev;
-#if 0
- printf("\nbooted_device = %s\n", device_xname(dev));
-#endif
- found = 1;
- } else {
- ctrlrdev = dev;
-#if 0
- printf("\nctrlrdev = %s\n", device_xname(dev));
-#endif
- }
- return;
- }
- }
-
- if (!diskboot)
- return;
-
- if (device_is_a(dev, "sd") ||
- device_is_a(dev, "st") ||
- device_is_a(dev, "cd")) {
- struct scsipibus_attach_args *sa = aux;
- struct scsipi_periph *periph = sa->sa_periph;
- int unit;
-
- if (device_parent(parent) != ctrlrdev)
- return;
-
- unit = periph->periph_target * 100 + periph->periph_lun;
- if (b->unit != unit)
- return;
- if (b->channel != periph->periph_channel->chan_channel)
- return;
-
- /* we've found it! */
- booted_device = dev;
-#if 0
- printf("\nbooted_device = %s\n", device_xname(dev));
-#endif
- found = 1;
- }
+ pci_find_bootdev(NULL, dev, aux);
}
Index: src/sys/arch/alpha/alpha/dec_2100_a500.c
diff -u src/sys/arch/alpha/alpha/dec_2100_a500.c:1.26 src/sys/arch/alpha/alpha/dec_2100_a500.c:1.27
--- src/sys/arch/alpha/alpha/dec_2100_a500.c:1.26 Sun Mar 31 19:06:30 2024
+++ src/sys/arch/alpha/alpha/dec_2100_a500.c Sun Mar 9 01:06:41 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: dec_2100_a500.c,v 1.26 2024/03/31 19:06:30 thorpej Exp $ */
+/* $NetBSD: dec_2100_a500.c,v 1.27 2025/03/09 01:06:41 thorpej Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -56,53 +56,26 @@
* rights to redistribute these changes.
*/
-#include "opt_kgdb.h"
-
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: dec_2100_a500.c,v 1.26 2024/03/31 19:06:30 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dec_2100_a500.c,v 1.27 2025/03/09 01:06:41 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <sys/lwp.h>
-#include <sys/termios.h>
-
-#include <sys/conf.h>
-#include <dev/cons.h>
#include <machine/rpb.h>
#include <machine/autoconf.h>
#include <machine/cpuconf.h>
-#include <sys/bus.h>
#include <machine/alpha.h>
-#include <dev/ic/comreg.h>
-#include <dev/ic/comvar.h>
-
-#include <dev/isa/isareg.h>
-#include <dev/isa/isavar.h>
-#include <dev/ic/i8042reg.h>
-#include <dev/ic/pckbcvar.h>
-#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
#include <alpha/pci/ttwogareg.h>
#include <alpha/pci/ttwogavar.h>
-#include <dev/scsipi/scsi_all.h>
-#include <dev/scsipi/scsipi_all.h>
-#include <dev/scsipi/scsiconf.h>
-
-#include <dev/ic/mlxio.h>
-#include <dev/ic/mlxvar.h>
-
-#include "pckbd.h"
-
-#ifndef CONSPEED
-#define CONSPEED TTYDEF_SPEED
-#endif
-static int comcnrate = CONSPEED;
+#define DR_VERBOSE(f) while (0)
void _dec_2100_a500_init(void);
static void dec_2100_a500_cons_init(void);
@@ -110,15 +83,6 @@ static void dec_2100_a500_device_registe
static void dec_2100_a500_machine_check(unsigned long, struct trapframe *,
unsigned long, unsigned long);
-#ifdef KGDB
-#include <machine/db_machdep.h>
-
-static const char *kgdb_devlist[] = {
- "com",
- NULL,
-};
-#endif /* KGDB */
-
void
_dec_2100_a500_init(void)
{
@@ -156,200 +120,62 @@ dec_2100_a500_cons_init(void)
struct ctb *ctb;
uint64_t ctbslot;
struct ttwoga_config *tcp;
+ bus_space_tag_t isa_iot, isa_memt;
ctb = (struct ctb *)(((char *)hwrpb) + hwrpb->rpb_ctb_off);
ctbslot = ctb->ctb_turboslot;
tcp = ttwoga_init(0);
+ isa_iot = &tcp->tc_iot;
+ isa_memt = &tcp->tc_memt;
+
switch (ctb->ctb_term_type) {
case CTB_PRINTERPORT:
/* serial console ... */
assert(CTB_TURBOSLOT_HOSE(ctbslot) == 0);
- /* XXX */
- {
- /*
- * Delay to allow PROM putchars to complete.
- * FIFO depth * character time,
- * character time = (1000000 / (defaultrate / 10))
- */
- DELAY(160000000 / comcnrate);
-
- if(comcnattach(&tcp->tc_iot, 0x3f8, comcnrate,
- COM_FREQ, COM_TYPE_NORMAL,
- (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8))
- panic("can't init serial console");
-
- break;
- }
+ break;
case CTB_GRAPHICS:
-#if NPCKBD > 0
- /* display console ... */
- /* XXX */
- (void) pckbc_cnattach(&tcp->tc_iot, IO_KBD, KBCMDP,
- PCKBC_KBD_SLOT, 0);
-
- switch (CTB_TURBOSLOT_TYPE(ctbslot)) {
- case CTB_TURBOSLOT_TYPE_ISA:
- /*
- * XXX The following is apparently necessary for an
- * XXX ISA VGA card, but what happens with real EISA
- * XXX VGA cards?
- */
- case CTB_TURBOSLOT_TYPE_EISA:
- isa_display_console(&tcp->tc_iot, &tcp->tc_memt);
- break;
-
- case CTB_TURBOSLOT_TYPE_PCI:
- /* The display PCI might be different */
+ /* PCI display might be on a different hose. */
+ if (CTB_TURBOSLOT_TYPE(ctbslot) == CTB_TURBOSLOT_TYPE_PCI) {
tcp = ttwoga_init(CTB_TURBOSLOT_HOSE(ctbslot));
- pci_display_console(&tcp->tc_iot, &tcp->tc_memt,
- &tcp->tc_pc, CTB_TURBOSLOT_BUS(ctbslot),
- CTB_TURBOSLOT_SLOT(ctbslot), 0);
- break;
-
- default:
- printf("type = 0x%lx, hose = 0x%lx, bus = 0x%lx, "
- "slot = 0x%lx\n",
- CTB_TURBOSLOT_TYPE(ctbslot),
- CTB_TURBOSLOT_HOSE(ctbslot),
- CTB_TURBOSLOT_BUS(ctbslot),
- CTB_TURBOSLOT_SLOT(ctbslot));
- panic("unknown display console type");
}
-#else
- panic("not configured to use display && keyboard console");
-#endif
break;
default:
- printf("ctb->ctb_term_type = 0x%lx\n", ctb->ctb_term_type);
- printf("ctb->ctb_turboslot = 0x%lx\n", ctb->ctb_turboslot);
-
- panic("consinit: unknown console type %ld",
- ctb->ctb_term_type);
+ /* Let pci_consinit() handle it. */
+ break;
}
-#ifdef KGDB
- /* Attach the KGDB device. */
- alpha_kgdb_init(kgdb_devlist, &tcp->tc_iot);
-#endif /* KGDB */
+
+ pci_consinit(&tcp->tc_pc, &tcp->tc_iot, &tcp->tc_memt,
+ isa_iot, isa_memt);
}
static void
dec_2100_a500_device_register(device_t dev, void *aux)
{
- static int found, initted, diskboot, netboot;
- static device_t pcidev, ctrlrdev;
+ static device_t primarydev;
struct bootdev_data *b = bootdev_data;
- device_t parent = device_parent(dev);
- if (b == NULL || found)
+ if (booted_device != NULL || b == NULL) {
return;
-
- if (!initted) {
- diskboot = (strcasecmp(b->protocol, "SCSI") == 0) ||
- (strcasecmp(b->protocol, "RAID") == 0);
- netboot = (strcasecmp(b->protocol, "BOOTP") == 0) ||
- (strcasecmp(b->protocol, "MOP") == 0);
-#if 0
- printf("diskboot = %d, netboot = %d\n", diskboot, netboot);
-#endif
- initted =1;
}
- if (pcidev == NULL) {
- if (!device_is_a(dev, "pci"))
- return;
- else {
+ if (primarydev == NULL) {
+ if (device_is_a(dev, "ttwopci")) {
struct pcibus_attach_args *pba = aux;
- if ((b->slot / 1000) != pba->pba_bus)
- return;
-
- pcidev = dev;
-#if 0
- printf("\npcidev = %s\n", device_xname(dev));
-#endif
- return;
- }
- }
-
- if (ctrlrdev == NULL) {
- if (parent != pcidev)
- return;
- else {
- struct pci_attach_args *pa = aux;
- int slot;
-
- slot = pa->pa_bus * 1000 + pa->pa_function * 100 +
- pa->pa_device;
- if (b->slot != slot)
- return;
-
- if (netboot) {
- booted_device = dev;
-#if 0
- printf("\nbooted_device = %s\n", device_xname(dev));
-#endif
- found = 1;
- } else {
- ctrlrdev = dev;
-#if 0
- printf("\nctrlrdev = %s\n", device_xname(dev));
-#endif
+ if (b->bus == pba->pba_bus) {
+ primarydev = dev;
+ DR_VERBOSE(printf("\nprimarydev = %s\n",
+ device_xname(dev)));
}
- return;
}
- }
-
- if (!diskboot)
return;
-
- if (device_is_a(dev, "sd") ||
- device_is_a(dev, "st") ||
- device_is_a(dev, "cd")) {
- struct scsipibus_attach_args *sa = aux;
- struct scsipi_periph *periph = sa->sa_periph;
- int unit;
-
- if (device_parent(parent) != ctrlrdev)
- return;
-
- unit = periph->periph_target * 100 + periph->periph_lun;
- if (b->unit != unit)
- return;
- if (b->channel != periph->periph_channel->chan_channel)
- return;
-
- /* we've found it! */
- booted_device = dev;
-#if 0
- printf("\nbooted_device = %s\n", device_xname(dev));
-#endif
- found = 1;
}
- if (device_is_a(dev, "ld") && device_is_a(parent, "mlx")) {
- /*
- * Argh! The attach arguments for ld devices is not
- * consistent, so each supported raid controller requires
- * different checks.
- */
- struct mlx_attach_args *mlxa = aux;
-
- if (parent != ctrlrdev)
- return;
-
- if (b->unit != mlxa->mlxa_unit)
- return;
- /* we've found it! */
- booted_device = dev;
-#if 0
- printf("\nbooted_device = %s\n", device_xname(dev));
-#endif
- found = 1;
- }
+ pci_find_bootdev(primarydev, dev, aux);
}
/*
Index: src/sys/arch/alpha/alpha/dec_3000_300.c
diff -u src/sys/arch/alpha/alpha/dec_3000_300.c:1.49 src/sys/arch/alpha/alpha/dec_3000_300.c:1.50
--- src/sys/arch/alpha/alpha/dec_3000_300.c:1.49 Sun Mar 31 19:06:30 2024
+++ src/sys/arch/alpha/alpha/dec_3000_300.c Sun Mar 9 01:06:41 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: dec_3000_300.c,v 1.49 2024/03/31 19:06:30 thorpej Exp $ */
+/* $NetBSD: dec_3000_300.c,v 1.50 2025/03/09 01:06:41 thorpej Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
@@ -33,7 +33,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: dec_3000_300.c,v 1.49 2024/03/31 19:06:30 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dec_3000_300.c,v 1.50 2025/03/09 01:06:41 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -52,10 +52,6 @@ __KERNEL_RCSID(0, "$NetBSD: dec_3000_300
#include <machine/z8530var.h>
#include <dev/tc/zs_ioasicvar.h>
-#include <dev/scsipi/scsi_all.h>
-#include <dev/scsipi/scsipi_all.h>
-#include <dev/scsipi/scsiconf.h>
-
#include "wsdisplay.h"
void dec_3000_300_init(void);
@@ -145,112 +141,5 @@ dec_3000_300_cons_init(void)
static void
dec_3000_300_device_register(device_t dev, void *aux)
{
- static int found, initted, scsiboot, netboot;
- static device_t scsidev;
- static device_t tcdsdev;
- struct bootdev_data *b = bootdev_data;
- device_t parent = device_parent(dev);
-
- if (b == NULL || found)
- return;
-
- if (!initted) {
- scsiboot = (strcmp(b->protocol, "SCSI") == 0);
- netboot = (strcmp(b->protocol, "BOOTP") == 0) ||
- (strcmp(b->protocol, "MOP") == 0);
-#if 0
- printf("scsiboot = %d, netboot = %d\n", scsiboot, netboot);
-#endif
- initted = 1;
- }
-
- /*
- * for scsi boot, we look for "tcds", make sure it has the
- * right slot number, then find the "asc" on this tcds that
- * as the right channel. then we find the actual scsi
- * device we came from. note: no SCSI LUN support (yet).
- */
- if (scsiboot && device_is_a(dev, "tcds")) {
- struct tc_attach_args *tcargs = aux;
-
- if (b->slot != tcargs->ta_slot)
- return;
-
- tcdsdev = dev;
-#if 0
- printf("\ntcdsdev = %s\n", device_xname(dev));
-#endif
- }
- if (scsiboot && tcdsdev &&
- device_is_a(dev, "asc")) {
- struct tcdsdev_attach_args *ta = aux;
-
- if (parent != tcdsdev)
- return;
-
- if (ta->tcdsda_chip != b->channel)
- return;
-
- scsidev = dev;
-#if 0
- printf("\nscsidev = %s\n", device_xname(dev));
-#endif
- }
-
- if (scsiboot && scsidev &&
- (device_is_a(dev, "sd") ||
- device_is_a(dev, "st") ||
- device_is_a(dev, "cd"))) {
- struct scsipibus_attach_args *sa = aux;
-
- if (device_parent(parent) != scsidev)
- return;
-
- if (b->unit / 100 != sa->sa_periph->periph_target)
- return;
-
- /* XXX LUN! */
-
- switch (b->boot_dev_type) {
- case 0:
- if (!device_is_a(dev, "sd") &&
- !device_is_a(dev, "cd"))
- return;
- break;
- case 1:
- if (!device_is_a(dev, "st"))
- return;
- break;
- default:
- return;
- }
-
- /* we've found it! */
- booted_device = dev;
-#if 0
- printf("\nbooted_device = %s\n", device_xname(booted_device));
-#endif
- found = 1;
- }
-
- if (netboot) {
- if (b->slot == 5 && device_is_a(dev, "le") &&
- device_is_a(parent, "ioasic")) {
- /*
- * no need to check ioasic_attach_args, since only
- * one le on ioasic.
- */
-
- booted_device = dev;
-#if 0
- printf("\nbooted_device = %s\n", device_xname(booted_device));
-#endif
- found = 1;
- return;
- }
-
- /*
- * XXX GENERIC SUPPORT FOR TC NETWORK BOARDS
- */
- }
+ tc_find_bootdev(dev, aux);
}
Index: src/sys/arch/alpha/alpha/dec_3000_500.c
diff -u src/sys/arch/alpha/alpha/dec_3000_500.c:1.48 src/sys/arch/alpha/alpha/dec_3000_500.c:1.49
--- src/sys/arch/alpha/alpha/dec_3000_500.c:1.48 Sun Mar 31 19:06:30 2024
+++ src/sys/arch/alpha/alpha/dec_3000_500.c Sun Mar 9 01:06:41 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: dec_3000_500.c,v 1.48 2024/03/31 19:06:30 thorpej Exp $ */
+/* $NetBSD: dec_3000_500.c,v 1.49 2025/03/09 01:06:41 thorpej Exp $ */
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -32,7 +32,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: dec_3000_500.c,v 1.48 2024/03/31 19:06:30 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dec_3000_500.c,v 1.49 2025/03/09 01:06:41 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -52,10 +52,6 @@ __KERNEL_RCSID(0, "$NetBSD: dec_3000_500
#include <machine/z8530var.h>
#include <dev/tc/zs_ioasicvar.h>
-#include <dev/scsipi/scsi_all.h>
-#include <dev/scsipi/scsipi_all.h>
-#include <dev/scsipi/scsiconf.h>
-
#include "wsdisplay.h"
void dec_3000_500_init(void);
@@ -165,112 +161,5 @@ dec_3000_500_cons_init(void)
static void
dec_3000_500_device_register(device_t dev, void *aux)
{
- static int found, initted, scsiboot, netboot;
- static device_t scsidev;
- static device_t tcdsdev;
- struct bootdev_data *b = bootdev_data;
- device_t parent = device_parent(dev);
-
- if (b == NULL || found)
- return;
-
- if (!initted) {
- scsiboot = (strcmp(b->protocol, "SCSI") == 0);
- netboot = (strcmp(b->protocol, "BOOTP") == 0) ||
- (strcmp(b->protocol, "MOP") == 0);
-#if 0
- printf("scsiboot = %d, netboot = %d\n", scsiboot, netboot);
-#endif
- initted = 1;
- }
-
- /*
- * for scsi boot, we look for "tcds", make sure it has the
- * right slot number, then find the "asc" on this tcds that
- * as the right channel. then we find the actual scsi
- * device we came from. note: no SCSI LUN support (yet).
- */
- if (scsiboot && device_is_a(dev, "tcds")) {
- struct tc_attach_args *tcargs = aux;
-
- if (b->slot != tcargs->ta_slot)
- return;
-
- tcdsdev = dev;
-#if 0
- printf("\ntcdsdev = %s\n", device_xname(dev));
-#endif
- }
- if (scsiboot && tcdsdev &&
- device_is_a(dev, "asc")) {
- struct tcdsdev_attach_args *ta = aux;
-
- if (parent != tcdsdev)
- return;
-
- if (ta->tcdsda_chip != b->channel)
- return;
-
- scsidev = dev;
-#if 0
- printf("\nscsidev = %s\n", device_xname(dev));
-#endif
- }
-
- if (scsiboot && scsidev &&
- (device_is_a(dev, "sd") ||
- device_is_a(dev, "st") ||
- device_is_a(dev, "cd"))) {
- struct scsipibus_attach_args *sa = aux;
-
- if (device_parent(parent) != scsidev)
- return;
-
- if (b->unit / 100 != sa->sa_periph->periph_target)
- return;
-
- /* XXX LUN! */
-
- switch (b->boot_dev_type) {
- case 0:
- if (!device_is_a(dev, "sd") &&
- !device_is_a(dev, "cd"))
- return;
- break;
- case 1:
- if (!device_is_a(dev, "st"))
- return;
- break;
- default:
- return;
- }
-
- /* we've found it! */
- booted_device = dev;
-#if 0
- printf("\nbooted_device = %s\n", device_xname(booted_device));
-#endif
- found = 1;
- }
-
- if (netboot) {
- if (b->slot == 7 && device_is_a(dev, "le") &&
- device_is_a(parent, "ioasic")) {
- /*
- * no need to check ioasic_attach_args, since only
- * one le on ioasic.
- */
-
- booted_device = dev;
-#if 0
- printf("\nbooted_device = %s\n", device_xname(booted_device));
-#endif
- found = 1;
- return;
- }
-
- /*
- * XXX GENERIC SUPPORT FOR TC NETWORK BOARDS
- */
- }
+ tc_find_bootdev(dev, aux);
}
Index: src/sys/arch/alpha/alpha/dec_550.c
diff -u src/sys/arch/alpha/alpha/dec_550.c:1.38 src/sys/arch/alpha/alpha/dec_550.c:1.39
--- src/sys/arch/alpha/alpha/dec_550.c:1.38 Sun Mar 31 19:06:30 2024
+++ src/sys/arch/alpha/alpha/dec_550.c Sun Mar 9 01:06:41 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: dec_550.c,v 1.38 2024/03/31 19:06:30 thorpej Exp $ */
+/* $NetBSD: dec_550.c,v 1.39 2025/03/09 01:06:41 thorpej Exp $ */
/*
* Copyright (c) 1995, 1996, 1997 Carnegie-Mellon University.
@@ -30,70 +30,33 @@
* Additional Copyright (c) 1997 by Matthew Jacob for NASA/Ames Research Center
*/
-#include "opt_kgdb.h"
-
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: dec_550.c,v 1.38 2024/03/31 19:06:30 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dec_550.c,v 1.39 2025/03/09 01:06:41 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
-#include <sys/termios.h>
-#include <sys/conf.h>
-#include <dev/cons.h>
#include <uvm/uvm_extern.h>
#include <machine/rpb.h>
#include <machine/autoconf.h>
#include <machine/cpuconf.h>
-#include <sys/bus.h>
-
-#include <dev/ic/comreg.h>
-#include <dev/ic/comvar.h>
-#include <dev/isa/isareg.h>
-#include <dev/isa/isavar.h>
-#include <dev/ic/i8042reg.h>
-#include <dev/ic/pckbcvar.h>
-#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
#include <alpha/pci/ciareg.h>
#include <alpha/pci/ciavar.h>
-#include <dev/scsipi/scsi_all.h>
-#include <dev/scsipi/scsipi_all.h>
-#include <dev/scsipi/scsiconf.h>
-#include <dev/ata/atavar.h>
-
/* Write this to Pyxis General Purpose Output to turn off the power. */
#define DEC_550_PYXIS_GPO_POWERDOWN 0x00000400
-#include "pckbd.h"
-
-#ifndef CONSPEED
-#define CONSPEED TTYDEF_SPEED
-#endif
-static int comcnrate = CONSPEED;
-
-#define DR_VERBOSE(f) while (0)
-
void dec_550_init(void);
static void dec_550_cons_init(void);
static void dec_550_device_register(device_t, void *);
static void dec_550_powerdown(void);
-#ifdef KGDB
-#include <machine/db_machdep.h>
-
-static const char *kgdb_devlist[] = {
- "com",
- NULL,
-};
-#endif /* KGDB */
-
void
dec_550_init(void)
{
@@ -119,178 +82,20 @@ dec_550_init(void)
static void
dec_550_cons_init(void)
{
- struct ctb *ctb;
struct cia_config *ccp;
extern struct cia_config cia_configuration;
ccp = &cia_configuration;
cia_init(ccp);
- ctb = (struct ctb *)(((char *)hwrpb) + hwrpb->rpb_ctb_off);
-
- switch (ctb->ctb_term_type) {
- case CTB_PRINTERPORT:
- /* serial console ... */
- /* XXX */
- {
- /*
- * Delay to allow PROM putchars to complete.
- * FIFO depth * character time,
- * character time = (1000000 / (defaultrate / 10))
- */
- DELAY(160000000 / comcnrate);
-
- if(comcnattach(&ccp->cc_iot, 0x3f8, comcnrate,
- COM_FREQ, COM_TYPE_NORMAL,
- (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8))
- panic("can't init serial console");
-
- break;
- }
-
- case CTB_GRAPHICS:
-#if NPCKBD > 0
- /* display console ... */
- /* XXX */
- (void) pckbc_cnattach(&ccp->cc_iot, IO_KBD, KBCMDP,
- PCKBC_KBD_SLOT, 0);
-
- if (CTB_TURBOSLOT_TYPE(ctb->ctb_turboslot) ==
- CTB_TURBOSLOT_TYPE_ISA)
- isa_display_console(&ccp->cc_iot, &ccp->cc_memt);
- else
- pci_display_console(&ccp->cc_iot, &ccp->cc_memt,
- &ccp->cc_pc, CTB_TURBOSLOT_BUS(ctb->ctb_turboslot),
- CTB_TURBOSLOT_SLOT(ctb->ctb_turboslot), 0);
-#else
- panic("not configured to use display && keyboard console");
-#endif
- break;
-
- default:
- printf("ctb->ctb_term_type = 0x%lx\n", ctb->ctb_term_type);
- printf("ctb->ctb_turboslot = 0x%lx\n", ctb->ctb_turboslot);
-
- panic("consinit: unknown console type %ld",
- ctb->ctb_term_type);
- }
-#ifdef KGDB
- /* Attach the KGDB device. */
- alpha_kgdb_init(kgdb_devlist, &ccp->cc_iot);
-#endif /* KGDB */
+ pci_consinit(&ccp->cc_pc, &ccp->cc_iot, &ccp->cc_memt,
+ &ccp->cc_iot, &ccp->cc_memt);
}
static void
dec_550_device_register(device_t dev, void *aux)
{
- static int found, initted, diskboot, netboot;
- static device_t pcidev, ctrlrdev;
- struct bootdev_data *b = bootdev_data;
- device_t parent = device_parent(dev);
-
- if (b == NULL || found)
- return;
-
- if (!initted) {
- diskboot = (strcasecmp(b->protocol, "SCSI") == 0) ||
- (strcasecmp(b->protocol, "IDE") == 0);
- netboot = (strcasecmp(b->protocol, "BOOTP") == 0) ||
- (strcasecmp(b->protocol, "MOP") == 0);
- DR_VERBOSE(printf("diskboot = %d, netboot = %d\n", diskboot,
- netboot));
- initted = 1;
- }
-
- if (pcidev == NULL) {
- if (!device_is_a(dev, "pci"))
- return;
- else {
- struct pcibus_attach_args *pba = aux;
-
- if ((b->slot / 1000) != pba->pba_bus)
- return;
-
- pcidev = dev;
- DR_VERBOSE(printf("\npcidev = %s\n", device_xname(dev)));
- return;
- }
- }
-
- if (ctrlrdev == NULL) {
- if (parent != pcidev)
- return;
- else {
- struct pci_attach_args *pa = aux;
- int slot;
-
- slot = pa->pa_bus * 1000 + pa->pa_function * 100 +
- pa->pa_device;
- if (b->slot != slot)
- return;
-
- if (netboot) {
- booted_device = dev;
- DR_VERBOSE(printf("\nbooted_device = %s\n",
- device_xname(dev)));
- found = 1;
- } else {
- ctrlrdev = dev;
- DR_VERBOSE(printf("\nctrlrdev = %s\n",
- device_xname(dev)));
- }
- return;
- }
- }
-
- if (!diskboot)
- return;
-
- if (device_is_a(dev, "sd") ||
- device_is_a(dev, "st") ||
- device_is_a(dev, "cd")) {
- struct scsipibus_attach_args *sa = aux;
- struct scsipi_periph *periph = sa->sa_periph;
- int unit;
-
- if (device_parent(parent) != ctrlrdev)
- return;
-
- unit = periph->periph_target * 100 + periph->periph_lun;
- if (b->unit != unit)
- return;
- if (b->channel != periph->periph_channel->chan_channel)
- return;
-
- /* we've found it! */
- booted_device = dev;
- DR_VERBOSE(printf("\nbooted_device = %s\n", device_xname(dev)));
- found = 1;
- }
-
- /*
- * Support to boot from IDE drives.
- */
- if (device_is_a(dev, "wd")) {
- struct ata_device *adev = aux;
-
- if (!device_is_a(parent, "atabus"))
- return;
- if (device_parent(parent) != ctrlrdev)
- return;
-
- DR_VERBOSE(printf("\nAtapi info: drive: %d, channel %d\n",
- adev->adev_drv_data->drive, adev->adev_channel));
- DR_VERBOSE(printf("Bootdev info: unit: %d, channel: %d\n",
- b->unit, b->channel));
- if (b->unit != adev->adev_drv_data->drive ||
- b->channel != adev->adev_channel)
- return;
-
- /* we've found it! */
- booted_device = dev;
- DR_VERBOSE(printf("booted_device = %s\n", device_xname(dev)));
- found = 1;
- }
+ pci_find_bootdev(NULL, dev, aux);
}
static void
Index: src/sys/arch/alpha/alpha/dec_6600.c
diff -u src/sys/arch/alpha/alpha/dec_6600.c:1.38 src/sys/arch/alpha/alpha/dec_6600.c:1.39
--- src/sys/arch/alpha/alpha/dec_6600.c:1.38 Sun Mar 31 19:11:21 2024
+++ src/sys/arch/alpha/alpha/dec_6600.c Sun Mar 9 01:06:41 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: dec_6600.c,v 1.38 2024/03/31 19:11:21 thorpej Exp $ */
+/* $NetBSD: dec_6600.c,v 1.39 2025/03/09 01:06:41 thorpej Exp $ */
/*
* Copyright (c) 1995, 1996, 1997 Carnegie-Mellon University.
@@ -27,63 +27,28 @@
* rights to redistribute these changes.
*/
-#include "opt_kgdb.h"
-
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: dec_6600.c,v 1.38 2024/03/31 19:11:21 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dec_6600.c,v 1.39 2025/03/09 01:06:41 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <sys/lwp.h>
-#include <sys/termios.h>
-
-#include <sys/conf.h>
-#include <dev/cons.h>
#include <machine/rpb.h>
#include <machine/autoconf.h>
#include <machine/cpuconf.h>
-#include <sys/bus.h>
#include <machine/alpha.h>
#include <machine/logout.h>
-#include <dev/ic/comreg.h>
-#include <dev/ic/comvar.h>
-
-#include <dev/isa/isareg.h>
-#include <dev/isa/isavar.h>
-#include <dev/ic/i8042reg.h>
-#include <dev/ic/pckbcvar.h>
-#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
#include <alpha/pci/tsreg.h>
#include <alpha/pci/tsvar.h>
-#include <dev/scsipi/scsi_all.h>
-#include <dev/scsipi/scsipi_all.h>
-#include <dev/scsipi/scsiconf.h>
-#include <dev/ata/atavar.h>
-
-#include <dev/ic/mlxio.h>
-#include <dev/ic/mlxvar.h>
-
-#include <dev/i2o/i2o.h>
-#include <dev/i2o/iopio.h>
-#include <dev/i2o/iopvar.h>
-
-#include "pckbd.h"
-
-#ifndef CONSPEED
-#define CONSPEED TTYDEF_SPEED
-#endif
-
#define DR_VERBOSE(f) while (0)
-static int comcnrate __attribute__((unused)) = CONSPEED;
-
void dec_6600_init(void);
static void dec_6600_cons_init(void);
static void dec_6600_device_register(device_t, void *);
@@ -92,15 +57,6 @@ static void dec_6600_mcheck_sys(unsigned
static void dec_6600_mcheck_handler(unsigned long, struct trapframe *,
unsigned long, unsigned long);
-#ifdef KGDB
-#include <machine/db_machdep.h>
-
-static const char *kgdb_devlist[] = {
- "com",
- NULL,
-};
-#endif /* KGDB */
-
static const struct alpha_variation_table dec_6600_variations[] = {
{ SV_ST_DP264, "AlphaPC DP264" },
{ SV_ST_CLIPPER, "AlphaServer ES40 (\"Clipper\")" },
@@ -149,6 +105,7 @@ dec_6600_cons_init(void)
struct ctb *ctb;
uint64_t ctbslot;
struct tsp_config *tsp;
+ bus_space_tag_t isa_iot, isa_memt;
ctb = (struct ctb *)(((char *)hwrpb) + hwrpb->rpb_ctb_off);
ctbslot = ctb->ctb_turboslot;
@@ -158,69 +115,36 @@ dec_6600_cons_init(void)
tsp = tsp_init(tsp_console_hose);
+ isa_iot = &tsp->pc_iot;
+ isa_memt = &tsp->pc_memt;
+
switch (ctb->ctb_term_type) {
case CTB_PRINTERPORT:
/* serial console ... */
assert(CTB_TURBOSLOT_HOSE(ctbslot) == 0);
- /* XXX */
- {
- /*
- * Delay to allow PROM putchars to complete.
- * FIFO depth * character time,
- * character time = (1000000 / (defaultrate / 10))
- */
- DELAY(160000000 / comcnrate);
-
- if(comcnattach(&tsp->pc_iot, 0x3f8, comcnrate,
- COM_FREQ, COM_TYPE_NORMAL,
- (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8))
- panic("can't init serial console");
-
- break;
- }
+ break;
case CTB_GRAPHICS:
-#if NPCKBD > 0
- /* display console ... */
- /* XXX */
- (void) pckbc_cnattach(&tsp->pc_iot, IO_KBD, KBCMDP,
- PCKBC_KBD_SLOT, 0);
-
- if (CTB_TURBOSLOT_TYPE(ctbslot) ==
- CTB_TURBOSLOT_TYPE_ISA)
- isa_display_console(&tsp->pc_iot, &tsp->pc_memt);
- else {
- /* The display PCI might be different */
+ /* PCI display might be on a different hose. */
+ if (CTB_TURBOSLOT_TYPE(ctbslot) != CTB_TURBOSLOT_TYPE_ISA) {
tsp_console_hose = CTB_TURBOSLOT_HOSE(ctbslot);
tsp = tsp_init(tsp_console_hose);
- pci_display_console(&tsp->pc_iot, &tsp->pc_memt,
- &tsp->pc_pc, CTB_TURBOSLOT_BUS(ctbslot),
- CTB_TURBOSLOT_SLOT(ctbslot), 0);
}
-#else
- panic("not configured to use display && keyboard console");
-#endif
break;
default:
- printf("ctb_term_type = 0x%lx ctb_turboslot = 0x%lx"
- " hose = %ld\n", ctb->ctb_term_type, ctbslot,
- CTB_TURBOSLOT_HOSE(ctbslot));
-
- panic("consinit: unknown console type %ld",
- ctb->ctb_term_type);
+ /* Let pci_consinit() handle it. */
+ break;
}
-#ifdef KGDB
- /* Attach the KGDB device. */
- alpha_kgdb_init(kgdb_devlist, &tsp->pc_iot);
-#endif /* KGDB */
+
+ pci_consinit(&tsp->pc_pc, &tsp->pc_iot, &tsp->pc_memt,
+ isa_iot, isa_memt);
}
static void
dec_6600_device_register(device_t dev, void *aux)
{
- static int found, initted, diskboot, netboot;
- static device_t primarydev, pcidev, ctrlrdev;
+ static device_t primarydev;
struct bootdev_data *b = bootdev_data;
device_t parent = device_parent(dev);
@@ -255,178 +179,26 @@ dec_6600_device_register(device_t dev, v
* Second section: Boot device detection.
*/
- if (b == NULL || found)
+ if (booted_device != NULL || b == NULL) {
return;
-
- if (!initted) {
- diskboot = (strcasecmp(b->protocol, "SCSI") == 0) ||
- (strcasecmp(b->protocol, "RAID") == 0) ||
- (strcasecmp(b->protocol, "I2O") == 0) ||
- (strcasecmp(b->protocol, "IDE") == 0);
- netboot = (strcasecmp(b->protocol, "BOOTP") == 0) ||
- (strcasecmp(b->protocol, "MOP") == 0);
- DR_VERBOSE(printf("diskboot = %d, netboot = %d\n", diskboot,
- netboot));
- initted = 1;
}
if (primarydev == NULL) {
- if (!device_is_a(dev, "tsp"))
- return;
- else {
+ if (device_is_a(dev, "tsp")) {
struct tsp_attach_args *tsp = aux;
- if (b->bus != tsp->tsp_slot)
- return;
- primarydev = dev;
- DR_VERBOSE(printf("\nprimarydev = %s\n",
- device_xname(dev)));
- return;
- }
- }
-
- if (pcidev == NULL) {
- if (!device_is_a(dev, "pci"))
- return;
- /*
- * Try to find primarydev anywhere in the ancestry. This is
- * necessary if the PCI bus is hidden behind a bridge.
- */
- while (parent) {
- if (parent == primarydev)
- break;
- parent = device_parent(parent);
- }
- if (!parent)
- return;
- else {
- struct pcibus_attach_args *pba = aux;
-
- if ((b->slot / 1000) != pba->pba_bus)
- return;
-
- pcidev = dev;
- DR_VERBOSE(printf("\npcidev = %s\n", device_xname(dev)));
- return;
- }
- }
-
- if (ctrlrdev == NULL) {
- if (parent != pcidev)
- return;
- else {
- struct pci_attach_args *pa = aux;
- int slot;
-
- slot = pa->pa_bus * 1000 + pa->pa_function * 100 +
- pa->pa_device;
- if (b->slot != slot)
- return;
-
- if (netboot) {
- booted_device = dev;
- DR_VERBOSE(printf("\nbooted_device = %s\n",
- device_xname(dev)));
- found = 1;
- } else {
- ctrlrdev = dev;
- DR_VERBOSE(printf("\nctrlrdev = %s\n",
+ if (b->bus == tsp->tsp_slot) {
+ primarydev = dev;
+ DR_VERBOSE(printf("\nprimarydev = %s\n",
device_xname(dev)));
}
- return;
}
- }
-
- if (!diskboot)
return;
-
- if (device_is_a(dev, "sd") ||
- device_is_a(dev, "st") ||
- device_is_a(dev, "cd")) {
- struct scsipibus_attach_args *sa = aux;
- struct scsipi_periph *periph = sa->sa_periph;
- int unit;
-
- if (device_parent(parent) != ctrlrdev)
- return;
-
- unit = periph->periph_target * 100 + periph->periph_lun;
- if (b->unit != unit)
- return;
- if (b->channel != periph->periph_channel->chan_channel)
- return;
-
- /* we've found it! */
- booted_device = dev;
- DR_VERBOSE(printf("\nbooted_device = %s\n", device_xname(dev)));
- found = 1;
- }
-
- if (device_is_a(dev, "ld") && device_is_a(parent, "iop")) {
- /*
- * Argh! The attach arguments for ld devices is not
- * consistent, so each supported raid controller requires
- * different checks.
- */
- struct iop_attach_args *iopa = aux;
-
- if (parent != ctrlrdev)
- return;
-
- if (b->unit != iopa->ia_tid)
- return;
- /* we've found it! */
- booted_device = dev;
- DR_VERBOSE(printf("\nbooted_device = %s\n", device_xname(dev)));
- found = 1;
- }
-
- if (device_is_a(dev, "ld") && device_is_a(parent, "mlx")) {
- /*
- * Argh! The attach arguments for ld devices is not
- * consistent, so each supported raid controller requires
- * different checks.
- */
- struct mlx_attach_args *mlxa = aux;
-
- if (parent != ctrlrdev)
- return;
-
- if (b->unit != mlxa->mlxa_unit)
- return;
- /* we've found it! */
- booted_device = dev;
- DR_VERBOSE(printf("\nbooted_device = %s\n", device_xname(dev)));
- found = 1;
}
- /*
- * Support to boot from IDE drives.
- */
- if (device_is_a(dev, "wd")) {
- struct ata_device *adev = aux;
-
- if (!device_is_a(parent, "atabus"))
- return;
- if (device_parent(parent) != ctrlrdev)
- return;
-
- DR_VERBOSE(printf("\nAtapi info: drive: %d, channel %d\n",
- adev->adev_drv_data->drive, adev->adev_channel));
- DR_VERBOSE(printf("Bootdev info: unit: %d, channel: %d\n",
- b->unit, b->channel));
- if (b->unit != adev->adev_drv_data->drive ||
- b->channel != adev->adev_channel)
- return;
-
- /* we've found it! */
- booted_device = dev;
- DR_VERBOSE(printf("booted_device = %s\n", device_xname(dev)));
- found = 1;
- }
+ pci_find_bootdev(primarydev, dev, aux);
}
-
static void
dec_6600_mcheck(unsigned long vector, struct ev6_logout_area *la)
{
Index: src/sys/arch/alpha/alpha/dec_alphabook1.c
diff -u src/sys/arch/alpha/alpha/dec_alphabook1.c:1.30 src/sys/arch/alpha/alpha/dec_alphabook1.c:1.31
--- src/sys/arch/alpha/alpha/dec_alphabook1.c:1.30 Sun Mar 31 19:06:30 2024
+++ src/sys/arch/alpha/alpha/dec_alphabook1.c Sun Mar 9 01:06:41 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: dec_alphabook1.c,v 1.30 2024/03/31 19:06:30 thorpej Exp $ */
+/* $NetBSD: dec_alphabook1.c,v 1.31 2025/03/09 01:06:41 thorpej Exp $ */
/*
* Copyright (c) 1995, 1996, 1997 Carnegie-Mellon University.
@@ -30,61 +30,27 @@
* Additional Copyright (c) 1997 by Matthew Jacob for NASA/Ames Research Center
*/
-#include "opt_kgdb.h"
-
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: dec_alphabook1.c,v 1.30 2024/03/31 19:06:30 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dec_alphabook1.c,v 1.31 2025/03/09 01:06:41 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
-#include <sys/termios.h>
-#include <sys/conf.h>
-#include <dev/cons.h>
#include <machine/rpb.h>
#include <machine/autoconf.h>
#include <machine/cpuconf.h>
-#include <sys/bus.h>
-
-#include <dev/ic/comreg.h>
-#include <dev/ic/comvar.h>
-#include <dev/isa/isareg.h>
-#include <dev/isa/isavar.h>
-#include <dev/ic/i8042reg.h>
-#include <dev/ic/pckbcvar.h>
-#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
#include <alpha/pci/lcareg.h>
#include <alpha/pci/lcavar.h>
-#include <dev/scsipi/scsi_all.h>
-#include <dev/scsipi/scsipi_all.h>
-#include <dev/scsipi/scsiconf.h>
-
-#include "pckbd.h"
-
-#ifndef CONSPEED
-#define CONSPEED TTYDEF_SPEED
-#endif
-static int comcnrate = CONSPEED;
-
void dec_alphabook1_init(void);
static void dec_alphabook1_cons_init(void);
static void dec_alphabook1_device_register(device_t, void *);
-#ifdef KGDB
-#include <machine/db_machdep.h>
-
-static const char *kgdb_devlist[] = {
- "com",
- NULL,
-};
-#endif /* KGDB */
-
const struct alpha_variation_table dec_alphabook1_variations[] = {
{ 0, "AlphaBook" },
{ 0, NULL },
@@ -114,157 +80,18 @@ dec_alphabook1_init(void)
static void
dec_alphabook1_cons_init(void)
{
- struct ctb *ctb;
struct lca_config *lcp;
extern struct lca_config lca_configuration;
lcp = &lca_configuration;
lca_init(lcp);
- ctb = (struct ctb *)(((char *)hwrpb) + hwrpb->rpb_ctb_off);
-
- switch (ctb->ctb_term_type) {
- case CTB_PRINTERPORT:
- /* serial console ... */
- /* XXX */
- {
- /*
- * Delay to allow PROM putchars to complete.
- * FIFO depth * character time,
- * character time = (1000000 / (defaultrate / 10))
- */
- DELAY(160000000 / comcnrate);
-
- if(comcnattach(&lcp->lc_iot, 0x3f8, comcnrate,
- COM_FREQ, COM_TYPE_NORMAL,
- (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8))
- panic("can't init serial console");
-
- break;
- }
-
- case CTB_GRAPHICS:
-#if NPCKBD > 0
- /* display console ... */
- /* XXX */
- (void) pckbc_cnattach(&lcp->lc_iot, IO_KBD, KBCMDP,
- PCKBC_KBD_SLOT, 0);
-
- if (CTB_TURBOSLOT_TYPE(ctb->ctb_turboslot) ==
- CTB_TURBOSLOT_TYPE_ISA)
- isa_display_console(&lcp->lc_iot, &lcp->lc_memt);
- else
- pci_display_console(&lcp->lc_iot, &lcp->lc_memt,
- &lcp->lc_pc, CTB_TURBOSLOT_BUS(ctb->ctb_turboslot),
- CTB_TURBOSLOT_SLOT(ctb->ctb_turboslot), 0);
-#else
- panic("not configured to use display && keyboard console");
-#endif
- break;
-
- default:
- printf("ctb->ctb_term_type = 0x%lx\n", ctb->ctb_term_type);
- printf("ctb->ctb_turboslot = 0x%lx\n", ctb->ctb_turboslot);
-
- panic("consinit: unknown console type %ld",
- ctb->ctb_term_type);
- }
-#ifdef KGDB
- /* Attach the KGDB device. */
- alpha_kgdb_init(kgdb_devlist, &lcp->lc_iot);
-#endif /* KGDB */
+ pci_consinit(&lcp->lc_pc, &lcp->lc_iot, &lcp->lc_memt,
+ &lcp->lc_iot, &lcp->lc_memt);
}
static void
dec_alphabook1_device_register(device_t dev, void *aux)
{
- static int found, initted, diskboot, netboot;
- static device_t pcidev, ctrlrdev;
- struct bootdev_data *b = bootdev_data;
- device_t parent = device_parent(dev);
-
- if (b == NULL || found)
- return;
-
- if (!initted) {
- diskboot = (strcasecmp(b->protocol, "SCSI") == 0);
- netboot = (strcasecmp(b->protocol, "BOOTP") == 0) ||
- (strcasecmp(b->protocol, "MOP") == 0);
-#if 0
- printf("diskboot = %d, netboot = %d\n", diskboot, netboot);
-#endif
- initted =1;
- }
-
- if (pcidev == NULL) {
- if (!device_is_a(dev, "pci"))
- return;
- else {
- struct pcibus_attach_args *pba = aux;
-
- if ((b->slot / 1000) != pba->pba_bus)
- return;
-
- pcidev = dev;
-#if 0
- printf("\npcidev = %s\n", device_xname(dev));
-#endif
- return;
- }
- }
-
- if (ctrlrdev == NULL) {
- if (parent != pcidev)
- return;
- else {
- struct pci_attach_args *pa = aux;
- int slot;
-
- slot = pa->pa_bus * 1000 + pa->pa_function * 100 +
- pa->pa_device;
- if (b->slot != slot)
- return;
-
- if (netboot) {
- booted_device = dev;
-#if 0
- printf("\nbooted_device = %s\n", device_xname(dev));
-#endif
- found = 1;
- } else {
- ctrlrdev = dev;
-#if 0
- printf("\nctrlrdev = %s\n", device_xname(dev));
-#endif
- }
- return;
- }
- }
-
- if (!diskboot)
- return;
-
- if (device_is_a(dev, "sd") ||
- device_is_a(dev, "st") ||
- device_is_a(dev, "cd")) {
- struct scsipibus_attach_args *sa = aux;
- struct scsipi_periph *periph = sa->sa_periph;
- int unit;
-
- if (device_parent(parent) != ctrlrdev)
- return;
-
- unit = periph->periph_target * 100 + periph->periph_lun;
- if (b->unit != unit)
- return;
- if (b->channel != periph->periph_channel->chan_channel)
- return;
-
- /* we've found it! */
- booted_device = dev;
-#if 0
- printf("\nbooted_device = %s\n", device_xname(dev));
-#endif
- found = 1;
- }
+ pci_find_bootdev(NULL, dev, aux);
}
Index: src/sys/arch/alpha/alpha/dec_eb164.c
diff -u src/sys/arch/alpha/alpha/dec_eb164.c:1.64 src/sys/arch/alpha/alpha/dec_eb164.c:1.65
--- src/sys/arch/alpha/alpha/dec_eb164.c:1.64 Sun Mar 31 19:06:30 2024
+++ src/sys/arch/alpha/alpha/dec_eb164.c Sun Mar 9 01:06:41 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: dec_eb164.c,v 1.64 2024/03/31 19:06:30 thorpej Exp $ */
+/* $NetBSD: dec_eb164.c,v 1.65 2025/03/09 01:06:41 thorpej Exp $ */
/*
* Copyright (c) 1995, 1996, 1997 Carnegie-Mellon University.
@@ -30,66 +30,29 @@
* Additional Copyright (c) 1997 by Matthew Jacob for NASA/Ames Research Center
*/
-#include "opt_kgdb.h"
-
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: dec_eb164.c,v 1.64 2024/03/31 19:06:30 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dec_eb164.c,v 1.65 2025/03/09 01:06:41 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
-#include <sys/termios.h>
-#include <sys/conf.h>
-#include <dev/cons.h>
#include <uvm/uvm_extern.h>
#include <machine/rpb.h>
#include <machine/autoconf.h>
#include <machine/cpuconf.h>
-#include <sys/bus.h>
-
-#include <dev/ic/comreg.h>
-#include <dev/ic/comvar.h>
-#include <dev/isa/isareg.h>
-#include <dev/isa/isavar.h>
-#include <dev/ic/i8042reg.h>
-#include <dev/ic/pckbcvar.h>
-#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
#include <alpha/pci/ciareg.h>
#include <alpha/pci/ciavar.h>
-#include <dev/scsipi/scsi_all.h>
-#include <dev/scsipi/scsipi_all.h>
-#include <dev/scsipi/scsiconf.h>
-#include <dev/ata/atavar.h>
-
-#include "pckbd.h"
-
-#ifndef CONSPEED
-#define CONSPEED TTYDEF_SPEED
-#endif
-static int comcnrate = CONSPEED;
-
-#define DR_VERBOSE(f) while (0)
-
void dec_eb164_init(void);
static void dec_eb164_cons_init(void);
static void dec_eb164_device_register(device_t, void *);
-#ifdef KGDB
-#include <machine/db_machdep.h>
-
-static const char *kgdb_devlist[] = {
- "com",
- NULL,
-};
-#endif /* KGDB */
-
void
dec_eb164_init(void)
{
@@ -114,176 +77,18 @@ dec_eb164_init(void)
static void
dec_eb164_cons_init(void)
{
- struct ctb *ctb;
struct cia_config *ccp;
extern struct cia_config cia_configuration;
ccp = &cia_configuration;
cia_init(ccp);
- ctb = (struct ctb *)(((char *)hwrpb) + hwrpb->rpb_ctb_off);
-
- switch (ctb->ctb_term_type) {
- case CTB_PRINTERPORT:
- /* serial console ... */
- /* XXX */
- {
- /*
- * Delay to allow PROM putchars to complete.
- * FIFO depth * character time,
- * character time = (1000000 / (defaultrate / 10))
- */
- DELAY(160000000 / comcnrate);
-
- if(comcnattach(&ccp->cc_iot, 0x3f8, comcnrate,
- COM_FREQ, COM_TYPE_NORMAL,
- (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8))
- panic("can't init serial console");
-
- break;
- }
-
- case CTB_GRAPHICS:
-#if NPCKBD > 0
- /* display console ... */
- /* XXX */
- (void) pckbc_cnattach(&ccp->cc_iot, IO_KBD, KBCMDP,
- PCKBC_KBD_SLOT, 0);
-
- if (CTB_TURBOSLOT_TYPE(ctb->ctb_turboslot) ==
- CTB_TURBOSLOT_TYPE_ISA)
- isa_display_console(&ccp->cc_iot, &ccp->cc_memt);
- else
- pci_display_console(&ccp->cc_iot, &ccp->cc_memt,
- &ccp->cc_pc, CTB_TURBOSLOT_BUS(ctb->ctb_turboslot),
- CTB_TURBOSLOT_SLOT(ctb->ctb_turboslot), 0);
-#else
- panic("not configured to use display && keyboard console");
-#endif
- break;
-
- default:
- printf("ctb->ctb_term_type = 0x%lx\n", ctb->ctb_term_type);
- printf("ctb->ctb_turboslot = 0x%lx\n", ctb->ctb_turboslot);
-
- panic("consinit: unknown console type %ld",
- ctb->ctb_term_type);
- }
-#ifdef KGDB
- /* Attach the KGDB device. */
- alpha_kgdb_init(kgdb_devlist, &ccp->cc_iot);
-#endif /* KGDB */
+ pci_consinit(&ccp->cc_pc, &ccp->cc_iot, &ccp->cc_memt,
+ &ccp->cc_iot, &ccp->cc_memt);
}
static void
dec_eb164_device_register(device_t dev, void *aux)
{
- static int found, initted, diskboot, netboot;
- static device_t pcidev, ctrlrdev;
- struct bootdev_data *b = bootdev_data;
- device_t parent = device_parent(dev);
-
- if (b == NULL || found)
- return;
-
- if (!initted) {
- diskboot = (strcasecmp(b->protocol, "SCSI") == 0) ||
- (strcasecmp(b->protocol, "IDE") == 0);
- netboot = (strcasecmp(b->protocol, "BOOTP") == 0) ||
- (strcasecmp(b->protocol, "MOP") == 0);
- DR_VERBOSE(printf("diskboot = %d, netboot = %d\n", diskboot,
- netboot));
- initted = 1;
- }
-
- if (pcidev == NULL) {
- if (!device_is_a(dev, "pci"))
- return;
- else {
- struct pcibus_attach_args *pba = aux;
-
- if ((b->slot / 1000) != pba->pba_bus)
- return;
-
- pcidev = dev;
- DR_VERBOSE(printf("\npcidev = %s\n", device_xname(dev)));
- return;
- }
- }
-
- if (ctrlrdev == NULL) {
- if (parent != pcidev)
- return;
- else {
- struct pci_attach_args *pa = aux;
- int slot;
-
- slot = pa->pa_bus * 1000 + pa->pa_function * 100 +
- pa->pa_device;
- if (b->slot != slot)
- return;
-
- if (netboot) {
- booted_device = dev;
- DR_VERBOSE(printf("\nbooted_device = %s\n",
- device_xname(dev)));
- found = 1;
- } else {
- ctrlrdev = dev;
- DR_VERBOSE(printf("\nctrlrdev = %s\n",
- device_xname(dev)));
- }
- return;
- }
- }
-
- if (!diskboot)
- return;
-
- if (device_is_a(dev, "sd") ||
- device_is_a(dev, "st") ||
- device_is_a(dev, "cd")) {
- struct scsipibus_attach_args *sa = aux;
- struct scsipi_periph *periph = sa->sa_periph;
- int unit;
-
- if (device_parent(parent) != ctrlrdev)
- return;
-
- unit = periph->periph_target * 100 + periph->periph_lun;
- if (b->unit != unit)
- return;
- if (b->channel != periph->periph_channel->chan_channel)
- return;
-
- /* we've found it! */
- booted_device = dev;
- DR_VERBOSE(printf("\nbooted_device = %s\n", device_xname(dev)));
- found = 1;
- }
-
- /*
- * Support to boot from IDE drives.
- */
- if (device_is_a(dev, "wd")) {
- struct ata_device *adev = aux;
-
- if (!device_is_a(parent, "atabus"))
- return;
- if (device_parent(parent) != ctrlrdev)
- return;
-
- DR_VERBOSE(printf("\nAtapi info: drive: %d, channel %d\n",
- adev->adev_drv_data->drive, adev->adev_channel));
- DR_VERBOSE(printf("Bootdev info: unit: %d, channel: %d\n",
- b->unit, b->channel));
- if (b->unit != adev->adev_drv_data->drive ||
- b->channel != adev->adev_channel)
- return;
-
- /* we've found it! */
- booted_device = dev;
- DR_VERBOSE(printf("booted_device = %s\n", device_xname(dev)));
- found = 1;
- }
+ pci_find_bootdev(NULL, dev, aux);
}
Index: src/sys/arch/alpha/alpha/dec_eb64plus.c
diff -u src/sys/arch/alpha/alpha/dec_eb64plus.c:1.43 src/sys/arch/alpha/alpha/dec_eb64plus.c:1.44
--- src/sys/arch/alpha/alpha/dec_eb64plus.c:1.43 Sun Mar 31 19:06:31 2024
+++ src/sys/arch/alpha/alpha/dec_eb64plus.c Sun Mar 9 01:06:41 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: dec_eb64plus.c,v 1.43 2024/03/31 19:06:31 thorpej Exp $ */
+/* $NetBSD: dec_eb64plus.c,v 1.44 2025/03/09 01:06:41 thorpej Exp $ */
/*
* Copyright (c) 1995, 1996, 1997 Carnegie-Mellon University.
@@ -30,63 +30,29 @@
* Additional Copyright (c) 1997 by Matthew Jacob for NASA/Ames Research Center
*/
-#include "opt_kgdb.h"
-
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: dec_eb64plus.c,v 1.43 2024/03/31 19:06:31 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dec_eb64plus.c,v 1.44 2025/03/09 01:06:41 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
-#include <sys/termios.h>
-#include <sys/conf.h>
-#include <dev/cons.h>
#include <uvm/uvm_extern.h>
#include <machine/rpb.h>
-#include <machine/alpha.h>
#include <machine/autoconf.h>
#include <machine/cpuconf.h>
-#include <dev/ic/comreg.h>
-#include <dev/ic/comvar.h>
-
-#include <dev/isa/isareg.h>
-#include <dev/isa/isavar.h>
-#include <dev/ic/i8042reg.h>
-#include <dev/ic/pckbcvar.h>
-#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
#include <alpha/pci/apecsreg.h>
#include <alpha/pci/apecsvar.h>
-#include <dev/scsipi/scsi_all.h>
-#include <dev/scsipi/scsipi_all.h>
-#include <dev/scsipi/scsiconf.h>
-
-#include "pckbd.h"
-
-#ifndef CONSPEED
-#define CONSPEED TTYDEF_SPEED
-#endif
-static int comcnrate = CONSPEED;
-
void dec_eb64plus_init(void);
static void dec_eb64plus_cons_init(void);
static void dec_eb64plus_device_register(device_t, void *);
-#ifdef KGDB
-#include <machine/db_machdep.h>
-
-static const char *kgdb_devlist[] = {
- "com",
- NULL,
-};
-#endif /* KGDB */
-
const struct alpha_variation_table dec_eb64plus_variations[] = {
{ 0, "DEC EB64+" },
{ 0, NULL },
@@ -122,157 +88,18 @@ dec_eb64plus_init(void)
static void
dec_eb64plus_cons_init(void)
{
- struct ctb *ctb;
struct apecs_config *acp;
extern struct apecs_config apecs_configuration;
acp = &apecs_configuration;
apecs_init(acp);
- ctb = (struct ctb *)(((char *)hwrpb) + hwrpb->rpb_ctb_off);
-
- switch (ctb->ctb_term_type) {
- case CTB_PRINTERPORT:
- /* serial console ... */
- /* XXX */
- {
- /*
- * Delay to allow PROM putchars to complete.
- * FIFO depth * character time,
- * character time = (1000000 / (defaultrate / 10))
- */
- DELAY(160000000 / comcnrate);
-
- if(comcnattach(&acp->ac_iot, 0x3f8, comcnrate,
- COM_FREQ, COM_TYPE_NORMAL,
- (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8))
- panic("can't init serial console");
-
- break;
- }
-
- case CTB_GRAPHICS:
-#if NPCKBD > 0
- /* display console ... */
- /* XXX */
- (void) pckbc_cnattach(&acp->ac_iot, IO_KBD, KBCMDP,
- PCKBC_KBD_SLOT, 0);
-
- if (CTB_TURBOSLOT_TYPE(ctb->ctb_turboslot) ==
- CTB_TURBOSLOT_TYPE_ISA)
- isa_display_console(&acp->ac_iot, &acp->ac_memt);
- else
- pci_display_console(&acp->ac_iot, &acp->ac_memt,
- &acp->ac_pc, CTB_TURBOSLOT_BUS(ctb->ctb_turboslot),
- CTB_TURBOSLOT_SLOT(ctb->ctb_turboslot), 0);
-#else
- panic("not configured to use display && keyboard console");
-#endif
- break;
-
- default:
- printf("ctb->ctb_term_type = 0x%lx\n", ctb->ctb_term_type);
- printf("ctb->ctb_turboslot = 0x%lx\n", ctb->ctb_turboslot);
-
- panic("consinit: unknown console type %ld",
- ctb->ctb_term_type);
- }
-#ifdef KGDB
- /* Attach the KGDB device. */
- alpha_kgdb_init(kgdb_devlist, &acp->ac_iot);
-#endif /* KGDB */
+ pci_consinit(&acp->ac_pc, &acp->ac_iot, &acp->ac_memt,
+ &acp->ac_iot, &acp->ac_memt);
}
static void
dec_eb64plus_device_register(device_t dev, void *aux)
{
- static int found, initted, diskboot, netboot;
- static device_t pcidev, ctrlrdev;
- struct bootdev_data *b = bootdev_data;
- device_t parent = device_parent(dev);
-
- if (b == NULL || found)
- return;
-
- if (!initted) {
- diskboot = (strcasecmp(b->protocol, "SCSI") == 0);
- netboot = (strcasecmp(b->protocol, "BOOTP") == 0) ||
- (strcasecmp(b->protocol, "MOP") == 0);
-#if 0
- printf("diskboot = %d, netboot = %d\n", diskboot, netboot);
-#endif
- initted =1;
- }
-
- if (pcidev == NULL) {
- if (!device_is_a(dev, "pci"))
- return;
- else {
- struct pcibus_attach_args *pba = aux;
-
- if ((b->slot / 1000) != pba->pba_bus)
- return;
-
- pcidev = dev;
-#if 0
- printf("\npcidev = %s\n", device_xname(dev));
-#endif
- return;
- }
- }
-
- if (ctrlrdev == NULL) {
- if (parent != pcidev)
- return;
- else {
- struct pci_attach_args *pa = aux;
- int slot;
-
- slot = pa->pa_bus * 1000 + pa->pa_function * 100 +
- pa->pa_device;
- if (b->slot != slot)
- return;
-
- if (netboot) {
- booted_device = dev;
-#if 0
- printf("\nbooted_device = %s\n", device_xname(dev));
-#endif
- found = 1;
- } else {
- ctrlrdev = dev;
-#if 0
- printf("\nctrlrdev = %s\n", device_xname(dev));
-#endif
- }
- return;
- }
- }
-
- if (!diskboot)
- return;
-
- if (device_is_a(dev, "sd") ||
- device_is_a(dev, "st") ||
- device_is_a(dev, "cd")) {
- struct scsipibus_attach_args *sa = aux;
- struct scsipi_periph *periph = sa->sa_periph;
- int unit;
-
- if (device_parent(parent) != ctrlrdev)
- return;
-
- unit = periph->periph_target * 100 + periph->periph_lun;
- if (b->unit != unit)
- return;
- if (b->channel != periph->periph_channel->chan_channel)
- return;
-
- /* we've found it! */
- booted_device = dev;
-#if 0
- printf("\nbooted_device = %s\n", device_xname(dev));
-#endif
- found = 1;
- }
+ pci_find_bootdev(NULL, dev, aux);
}
Index: src/sys/arch/alpha/alpha/dec_eb66.c
diff -u src/sys/arch/alpha/alpha/dec_eb66.c:1.31 src/sys/arch/alpha/alpha/dec_eb66.c:1.32
--- src/sys/arch/alpha/alpha/dec_eb66.c:1.31 Sun Mar 31 19:06:31 2024
+++ src/sys/arch/alpha/alpha/dec_eb66.c Sun Mar 9 01:06:41 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: dec_eb66.c,v 1.31 2024/03/31 19:06:31 thorpej Exp $ */
+/* $NetBSD: dec_eb66.c,v 1.32 2025/03/09 01:06:41 thorpej Exp $ */
/*
* Copyright (c) 1995, 1996, 1997 Carnegie-Mellon University.
@@ -30,61 +30,27 @@
* Additional Copyright (c) 1997 by Matthew Jacob for NASA/Ames Research Center
*/
-#include "opt_kgdb.h"
-
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: dec_eb66.c,v 1.31 2024/03/31 19:06:31 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dec_eb66.c,v 1.32 2025/03/09 01:06:41 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
-#include <sys/termios.h>
-#include <sys/conf.h>
-#include <dev/cons.h>
#include <machine/rpb.h>
#include <machine/autoconf.h>
#include <machine/cpuconf.h>
-#include <sys/bus.h>
-
-#include <dev/ic/comreg.h>
-#include <dev/ic/comvar.h>
-#include <dev/isa/isareg.h>
-#include <dev/isa/isavar.h>
-#include <dev/ic/i8042reg.h>
-#include <dev/ic/pckbcvar.h>
-#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
#include <alpha/pci/lcareg.h>
#include <alpha/pci/lcavar.h>
-#include <dev/scsipi/scsi_all.h>
-#include <dev/scsipi/scsipi_all.h>
-#include <dev/scsipi/scsiconf.h>
-
-#include "pckbd.h"
-
-#ifndef CONSPEED
-#define CONSPEED TTYDEF_SPEED
-#endif
-static int comcnrate = CONSPEED;
-
void dec_eb66_init(void);
static void dec_eb66_cons_init(void);
static void dec_eb66_device_register(device_t, void *);
-#ifdef KGDB
-#include <machine/db_machdep.h>
-
-static const char *kgdb_devlist[] = {
- "com",
- NULL,
-};
-#endif /* KGDB */
-
const struct alpha_variation_table dec_eb66_variations[] = {
{ 0, "DEC EB66" },
{ 0, NULL },
@@ -114,157 +80,18 @@ dec_eb66_init(void)
static void
dec_eb66_cons_init(void)
{
- struct ctb *ctb;
struct lca_config *lcp;
extern struct lca_config lca_configuration;
lcp = &lca_configuration;
lca_init(lcp);
- ctb = (struct ctb *)(((char *)hwrpb) + hwrpb->rpb_ctb_off);
-
- switch (ctb->ctb_term_type) {
- case CTB_PRINTERPORT:
- /* serial console ... */
- /* XXX */
- {
- /*
- * Delay to allow PROM putchars to complete.
- * FIFO depth * character time,
- * character time = (1000000 / (defaultrate / 10))
- */
- DELAY(160000000 / comcnrate);
-
- if(comcnattach(&lcp->lc_iot, 0x3f8, comcnrate,
- COM_FREQ, COM_TYPE_NORMAL,
- (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8))
- panic("can't init serial console");
-
- break;
- }
-
- case CTB_GRAPHICS:
-#if NPCKBD > 0
- /* display console ... */
- /* XXX */
- (void) pckbc_cnattach(&lcp->lc_iot, IO_KBD, KBCMDP,
- PCKBC_KBD_SLOT, 0);
-
- if (CTB_TURBOSLOT_TYPE(ctb->ctb_turboslot) ==
- CTB_TURBOSLOT_TYPE_ISA)
- isa_display_console(&lcp->lc_iot, &lcp->lc_memt);
- else
- pci_display_console(&lcp->lc_iot, &lcp->lc_memt,
- &lcp->lc_pc, CTB_TURBOSLOT_BUS(ctb->ctb_turboslot),
- CTB_TURBOSLOT_SLOT(ctb->ctb_turboslot), 0);
-#else
- panic("not configured to use display && keyboard console");
-#endif
- break;
-
- default:
- printf("ctb->ctb_term_type = 0x%lx\n", ctb->ctb_term_type);
- printf("ctb->ctb_turboslot = 0x%lx\n", ctb->ctb_turboslot);
-
- panic("consinit: unknown console type %ld",
- ctb->ctb_term_type);
- }
-#ifdef KGDB
- /* Attach the KGDB device. */
- alpha_kgdb_init(kgdb_devlist, &lcp->lc_iot);
-#endif /* KGDB */
+ pci_consinit(&lcp->lc_pc, &lcp->lc_iot, &lcp->lc_memt,
+ &lcp->lc_iot, &lcp->lc_memt);
}
static void
dec_eb66_device_register(device_t dev, void *aux)
{
- static int found, initted, diskboot, netboot;
- static device_t pcidev, ctrlrdev;
- struct bootdev_data *b = bootdev_data;
- device_t parent = device_parent(dev);
-
- if (b == NULL || found)
- return;
-
- if (!initted) {
- diskboot = (strcasecmp(b->protocol, "SCSI") == 0);
- netboot = (strcasecmp(b->protocol, "BOOTP") == 0) ||
- (strcasecmp(b->protocol, "MOP") == 0);
-#if 0
- printf("diskboot = %d, netboot = %d\n", diskboot, netboot);
-#endif
- initted =1;
- }
-
- if (pcidev == NULL) {
- if (!device_is_a(dev, "pci"))
- return;
- else {
- struct pcibus_attach_args *pba = aux;
-
- if ((b->slot / 1000) != pba->pba_bus)
- return;
-
- pcidev = dev;
-#if 0
- printf("\npcidev = %s\n", device_xname(dev));
-#endif
- return;
- }
- }
-
- if (ctrlrdev == NULL) {
- if (parent != pcidev)
- return;
- else {
- struct pci_attach_args *pa = aux;
- int slot;
-
- slot = pa->pa_bus * 1000 + pa->pa_function * 100 +
- pa->pa_device;
- if (b->slot != slot)
- return;
-
- if (netboot) {
- booted_device = dev;
-#if 0
- printf("\nbooted_device = %s\n", device_xname(dev));
-#endif
- found = 1;
- } else {
- ctrlrdev = dev;
-#if 0
- printf("\nctrlrdev = %s\n", device_xname(dev));
-#endif
- }
- return;
- }
- }
-
- if (!diskboot)
- return;
-
- if (device_is_a(dev, "sd") ||
- device_is_a(dev, "st") ||
- device_is_a(dev, "cd")) {
- struct scsipibus_attach_args *sa = aux;
- struct scsipi_periph *periph = sa->sa_periph;
- int unit;
-
- if (device_parent(parent) != ctrlrdev)
- return;
-
- unit = periph->periph_target * 100 + periph->periph_lun;
- if (b->unit != unit)
- return;
- if (b->channel != periph->periph_channel->chan_channel)
- return;
-
- /* we've found it! */
- booted_device = dev;
-#if 0
- printf("\nbooted_device = %s\n", device_xname(dev));
-#endif
- found = 1;
- }
+ pci_find_bootdev(NULL, dev, aux);
}
Index: src/sys/arch/alpha/alpha/dec_kn20aa.c
diff -u src/sys/arch/alpha/alpha/dec_kn20aa.c:1.68 src/sys/arch/alpha/alpha/dec_kn20aa.c:1.69
--- src/sys/arch/alpha/alpha/dec_kn20aa.c:1.68 Sun Mar 31 19:06:31 2024
+++ src/sys/arch/alpha/alpha/dec_kn20aa.c Sun Mar 9 01:06:42 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: dec_kn20aa.c,v 1.68 2024/03/31 19:06:31 thorpej Exp $ */
+/* $NetBSD: dec_kn20aa.c,v 1.69 2025/03/09 01:06:42 thorpej Exp $ */
/*
* Copyright (c) 1995, 1996, 1997 Carnegie-Mellon University.
@@ -30,52 +30,26 @@
* Additional Copyright (c) 1997 by Matthew Jacob for NASA/Ames Research Center
*/
-#include "opt_kgdb.h"
-
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: dec_kn20aa.c,v 1.68 2024/03/31 19:06:31 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dec_kn20aa.c,v 1.69 2025/03/09 01:06:42 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <sys/lwp.h>
-#include <sys/termios.h>
-
-#include <sys/conf.h>
-#include <dev/cons.h>
#include <machine/rpb.h>
#include <machine/autoconf.h>
#include <machine/cpuconf.h>
-#include <sys/bus.h>
#include <machine/alpha.h>
#include <machine/logout.h>
-#include <dev/ic/comreg.h>
-#include <dev/ic/comvar.h>
-
-#include <dev/isa/isareg.h>
-#include <dev/isa/isavar.h>
-#include <dev/ic/i8042reg.h>
-#include <dev/ic/pckbcvar.h>
-#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
#include <alpha/pci/ciareg.h>
#include <alpha/pci/ciavar.h>
-#include <dev/scsipi/scsi_all.h>
-#include <dev/scsipi/scsipi_all.h>
-#include <dev/scsipi/scsiconf.h>
-
-#include "pckbd.h"
-
-#ifndef CONSPEED
-#define CONSPEED TTYDEF_SPEED
-#endif
-static int comcnrate = CONSPEED;
-
void dec_kn20aa_init(void);
static void dec_kn20aa_cons_init(void);
static void dec_kn20aa_device_register(device_t, void *);
@@ -86,15 +60,6 @@ static void dec_kn20aa_mcheck_handler
static void dec_kn20aa_mcheck(unsigned long, unsigned long,
unsigned long, struct trapframe *);
-#ifdef KGDB
-#include <machine/db_machdep.h>
-
-static const char *kgdb_devlist[] = {
- "com",
- NULL,
-};
-#endif /* KGDB */
-
const struct alpha_variation_table dec_kn20aa_variations[] = {
{ 0, "AlphaStation 500 or 600 (KN20AA)" },
{ 0, NULL },
@@ -123,159 +88,20 @@ dec_kn20aa_init(void)
static void
dec_kn20aa_cons_init(void)
{
- struct ctb *ctb;
struct cia_config *ccp;
extern struct cia_config cia_configuration;
ccp = &cia_configuration;
cia_init(ccp);
- ctb = (struct ctb *)(((char *)hwrpb) + hwrpb->rpb_ctb_off);
-
- switch (ctb->ctb_term_type) {
- case CTB_PRINTERPORT:
- /* serial console ... */
- /* XXX */
- {
- /*
- * Delay to allow PROM putchars to complete.
- * FIFO depth * character time,
- * character time = (1000000 / (defaultrate / 10))
- */
- DELAY(160000000 / comcnrate);
-
- if(comcnattach(&ccp->cc_iot, 0x3f8, comcnrate,
- COM_FREQ, COM_TYPE_NORMAL,
- (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8))
- panic("can't init serial console");
-
- break;
- }
-
- case CTB_GRAPHICS:
-#if NPCKBD > 0
- /* display console ... */
- /* XXX */
- (void) pckbc_cnattach(&ccp->cc_iot, IO_KBD, KBCMDP,
- PCKBC_KBD_SLOT, 0);
-
- if (CTB_TURBOSLOT_TYPE(ctb->ctb_turboslot) ==
- CTB_TURBOSLOT_TYPE_ISA)
- isa_display_console(&ccp->cc_iot, &ccp->cc_memt);
- else
- pci_display_console(&ccp->cc_iot, &ccp->cc_memt,
- &ccp->cc_pc, CTB_TURBOSLOT_BUS(ctb->ctb_turboslot),
- CTB_TURBOSLOT_SLOT(ctb->ctb_turboslot), 0);
-#else
- panic("not configured to use display && keyboard console");
-#endif
- break;
-
- default:
- printf("ctb->ctb_term_type = 0x%lx\n", ctb->ctb_term_type);
- printf("ctb->ctb_turboslot = 0x%lx\n", ctb->ctb_turboslot);
-
- panic("consinit: unknown console type %ld",
- ctb->ctb_term_type);
- }
-#ifdef KGDB
- /* Attach the KGDB device. */
- alpha_kgdb_init(kgdb_devlist, &ccp->cc_iot);
-#endif /* KGDB */
+ pci_consinit(&ccp->cc_pc, &ccp->cc_iot, &ccp->cc_memt,
+ &ccp->cc_iot, &ccp->cc_memt);
}
static void
dec_kn20aa_device_register(device_t dev, void *aux)
{
- static int found, initted, diskboot, netboot;
- static device_t pcidev, ctrlrdev;
- struct bootdev_data *b = bootdev_data;
- device_t parent = device_parent(dev);
-
- if (b == NULL || found)
- return;
-
- if (!initted) {
- diskboot = (strcasecmp(b->protocol, "SCSI") == 0);
- netboot = (strcasecmp(b->protocol, "BOOTP") == 0) ||
- (strcasecmp(b->protocol, "MOP") == 0);
-#if 0
- printf("diskboot = %d, netboot = %d\n", diskboot, netboot);
-#endif
- initted =1;
- }
-
- if (pcidev == NULL) {
- if (!device_is_a(dev, "pci"))
- return;
- else {
- struct pcibus_attach_args *pba = aux;
-
- if ((b->slot / 1000) != pba->pba_bus)
- return;
-
- pcidev = dev;
-#if 0
- printf("\npcidev = %s\n", device_xname(dev));
-#endif
- return;
- }
- }
-
- if (ctrlrdev == NULL) {
- if (parent != pcidev)
- return;
- else {
- struct pci_attach_args *pa = aux;
- int slot;
-
- slot = pa->pa_bus * 1000 + pa->pa_function * 100 +
- pa->pa_device;
- if (b->slot != slot)
- return;
-
- if (netboot) {
- booted_device = dev;
-#if 0
- printf("\nbooted_device = %s\n", device_xname(dev));
-#endif
- found = 1;
- } else {
- ctrlrdev = dev;
-#if 0
- printf("\nctrlrdev = %s\n", device_xname(dev));
-#endif
- }
- return;
- }
- }
-
- if (!diskboot)
- return;
-
- if (device_is_a(dev, "sd") ||
- device_is_a(dev, "st") ||
- device_is_a(dev, "cd")) {
- struct scsipibus_attach_args *sa = aux;
- struct scsipi_periph *periph = sa->sa_periph;
- int unit;
-
- if (device_parent(parent) != ctrlrdev)
- return;
-
- unit = periph->periph_target * 100 + periph->periph_lun;
- if (b->unit != unit)
- return;
- if (b->channel != periph->periph_channel->chan_channel)
- return;
-
- /* we've found it! */
- booted_device = dev;
-#if 0
- printf("\nbooted_device = %s\n", device_xname(dev));
-#endif
- found = 1;
- }
+ pci_find_bootdev(NULL, dev, aux);
}
static void
Index: src/sys/arch/alpha/alpha/dec_kn300.c
diff -u src/sys/arch/alpha/alpha/dec_kn300.c:1.44 src/sys/arch/alpha/alpha/dec_kn300.c:1.45
--- src/sys/arch/alpha/alpha/dec_kn300.c:1.44 Sun Mar 31 19:06:31 2024
+++ src/sys/arch/alpha/alpha/dec_kn300.c Sun Mar 9 01:06:42 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: dec_kn300.c,v 1.44 2024/03/31 19:06:31 thorpej Exp $ */
+/* $NetBSD: dec_kn300.c,v 1.45 2025/03/09 01:06:42 thorpej Exp $ */
/*
* Copyright (c) 1998 by Matthew Jacob
@@ -30,33 +30,21 @@
* SUCH DAMAGE.
*/
-#include "opt_kgdb.h"
-
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: dec_kn300.c,v 1.44 2024/03/31 19:06:31 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dec_kn300.c,v 1.45 2025/03/09 01:06:42 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
-#include <sys/termios.h>
-#include <sys/conf.h>
-#include <dev/cons.h>
#include <machine/rpb.h>
#include <machine/alpha.h>
#include <machine/autoconf.h>
#include <machine/frame.h>
#include <machine/cpuconf.h>
+#include <machine/logout.h>
-#include <dev/ic/comreg.h>
-#include <dev/ic/comvar.h>
-
-#include <dev/isa/isareg.h>
-#include <dev/isa/isavar.h>
-#include <dev/ic/i8042reg.h>
-#include <dev/ic/pckbcvar.h>
-#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
#include <uvm/uvm_extern.h>
@@ -65,22 +53,6 @@ __KERNEL_RCSID(0, "$NetBSD: dec_kn300.c,
#include <alpha/mcbus/mcbusvar.h>
#include <alpha/pci/mcpciareg.h>
#include <alpha/pci/mcpciavar.h>
-#include <machine/logout.h>
-
-#include <dev/scsipi/scsi_all.h>
-#include <dev/scsipi/scsipi_all.h>
-#include <dev/scsipi/scsiconf.h>
-
-#include <dev/ic/mlxio.h>
-#include <dev/ic/mlxvar.h>
-
-
-#include "pckbd.h"
-
-#ifndef CONSPEED
-#define CONSPEED TTYDEF_SPEED
-#endif
-static int comcnrate = CONSPEED;
void dec_kn300_init(void);
void dec_kn300_cons_init(void);
@@ -88,15 +60,6 @@ static void dec_kn300_device_register(de
static void dec_kn300_mcheck_handler
(unsigned long, struct trapframe *, unsigned long, unsigned long);
-#ifdef KGDB
-#include <machine/db_machdep.h>
-
-static const char *kgdb_devlist[] = {
- "com",
- NULL,
-};
-#endif /* KGDB */
-
#define ALPHASERVER_4100 "AlphaServer 4100"
const struct alpha_variation_table dec_kn300_variations[] = {
@@ -160,215 +123,43 @@ dec_kn300_init(void)
void
dec_kn300_cons_init(void)
{
- struct ctb *ctb;
struct mcpcia_config *ccp;
extern struct mcpcia_config mcpcia_console_configuration;
ccp = &mcpcia_console_configuration;
/* It's already initialized. */
- ctb = (struct ctb *)(((char *)hwrpb) + hwrpb->rpb_ctb_off);
-
- switch (ctb->ctb_term_type) {
- case CTB_PRINTERPORT:
- /* serial console ... */
- /*
- * Delay to allow PROM putchars to complete.
- * FIFO depth * character time,
- * character time = (1000000 / (defaultrate / 10))
- */
- DELAY(160000000 / comcnrate);
- if (comcnattach(&ccp->cc_iot, 0x3f8, comcnrate,
- COM_FREQ, COM_TYPE_NORMAL,
- (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8)) {
- panic("can't init serial console");
-
- }
- break;
-
- case CTB_GRAPHICS:
-#if NPCKBD > 0
- /* display console ... */
- /* XXX */
- (void) pckbc_cnattach(&ccp->cc_iot, IO_KBD, KBCMDP,
- PCKBC_KBD_SLOT, 0);
-
- if (CTB_TURBOSLOT_TYPE(ctb->ctb_turboslot) ==
- CTB_TURBOSLOT_TYPE_ISA)
- isa_display_console(&ccp->cc_iot, &ccp->cc_memt);
- else
- pci_display_console(&ccp->cc_iot, &ccp->cc_memt,
- &ccp->cc_pc, CTB_TURBOSLOT_BUS(ctb->ctb_turboslot),
- CTB_TURBOSLOT_SLOT(ctb->ctb_turboslot), 0);
-#else
- panic("not configured to use display && keyboard console");
-#endif
- break;
-
- default:
- printf("ctb->ctb_term_type = 0x%lx\n", ctb->ctb_term_type);
- printf("ctb->ctb_turboslot = 0x%lx\n", ctb->ctb_turboslot);
-
- panic("consinit: unknown console type %ld",
- ctb->ctb_term_type);
- }
-#ifdef KGDB
- /* Attach the KGDB device. */
- alpha_kgdb_init(kgdb_devlist, &ccp->cc_iot);
-#endif /* KGDB */
+ pci_consinit(&ccp->cc_pc, &ccp->cc_iot, &ccp->cc_memt,
+ &ccp->cc_iot, &ccp->cc_memt);
}
/* #define BDEBUG 1 */
static void
dec_kn300_device_register(device_t dev, void *aux)
{
- static int found, initted, diskboot, netboot;
- static device_t primarydev, pcidev, ctrlrdev;
+ static device_t primarydev;
struct bootdev_data *b = bootdev_data;
- device_t parent = device_parent(dev);
- if (b == NULL || found)
+ if (booted_device != NULL || b == NULL) {
return;
-
- if (!initted) {
- diskboot = (strcasecmp(b->protocol, "SCSI") == 0) ||
- (strcasecmp(b->protocol, "RAID") == 0);
- netboot = (strcasecmp(b->protocol, "BOOTP") == 0) ||
- (strcasecmp(b->protocol, "MOP") == 0);
-#ifdef BDEBUG
- printf("proto:%s bus:%d slot:%d chan:%d", b->protocol,
- b->bus, b->slot, b->channel);
- if (b->remote_address)
- printf(" remote_addr:%s", b->remote_address);
- printf(" un:%d bdt:%d", b->unit, b->boot_dev_type);
- if (b->ctrl_dev_type)
- printf(" cdt:%s\n", b->ctrl_dev_type);
- else
- printf("\n");
- printf("diskboot = %d, netboot = %d\n", diskboot, netboot);
-#endif
- initted = 1;
}
if (primarydev == NULL) {
- if (!device_is_a(dev, "mcpcia"))
- return;
- else {
+ if (device_is_a(dev, "mcpcia")) {
struct mcbus_dev_attach_args *ma = aux;
- if (b->bus != ma->ma_mid - 4)
- return;
- primarydev = dev;
-#ifdef BDEBUG
- printf("\nprimarydev = %s\n", device_xname(dev));
-#endif
- return;
- }
- }
-
- if (pcidev == NULL) {
- if (!device_is_a(dev, "pci"))
- return;
- /*
- * Try to find primarydev anywhere in the ancestry. This is
- * necessary if the PCI bus is hidden behind a bridge.
- */
- while (parent) {
- if (parent == primarydev)
- break;
- parent = device_parent(parent);
- }
- if (!parent)
- return;
- else {
- struct pcibus_attach_args *pba = aux;
-
- if ((b->slot / 1000) != pba->pba_bus)
- return;
-
- pcidev = dev;
-#ifdef BDEBUG
- printf("\npcidev = %s\n", device_xname(dev));
-#endif
- return;
- }
- }
-
- if (ctrlrdev == NULL) {
- if (parent != pcidev)
- return;
- else {
- struct pci_attach_args *pa = aux;
- int slot;
-
- slot = pa->pa_bus * 1000 + pa->pa_function * 100 +
- pa->pa_device;
- if (b->slot != slot)
- return;
-
- if (netboot) {
- booted_device = dev;
-#ifdef BDEBUG
- printf("\nbooted_device = %s\n", device_xname(dev));
-#endif
- found = 1;
- } else {
- ctrlrdev = dev;
+ if (b->bus == ma->ma_mid - 4) {
+ primarydev = dev;
#ifdef BDEBUG
- printf("\nctrlrdev = %s\n", device_xname(dev));
+ printf("\nprimarydev = %s\n",
+ device_xname(dev));
#endif
}
- return;
}
- }
-
- if (!diskboot)
return;
-
- if (device_is_a(dev, "sd") ||
- device_is_a(dev, "st") ||
- device_is_a(dev, "cd")) {
- struct scsipibus_attach_args *sa = aux;
- struct scsipi_periph *periph = sa->sa_periph;
- int unit;
-
- if (device_parent(parent) != ctrlrdev)
- return;
-
- unit = periph->periph_target * 100 + periph->periph_lun;
- if (b->unit != unit)
- return;
- if (b->channel != periph->periph_channel->chan_channel)
- return;
-
- /* we've found it! */
- booted_device = dev;
-#ifdef BDEBUG
- printf("\nbooted_device = %s\n", device_xname(dev));
-#endif
- found = 1;
}
- if (device_is_a(dev, "ld") && device_is_a(parent, "mlx")) {
- /*
- * Argh! The attach arguments for ld devices is not
- * consistent, so each supported raid controller requires
- * different checks.
- */
- struct mlx_attach_args *mlxa = aux;
-
- if (parent != ctrlrdev)
- return;
-
- if (b->unit != mlxa->mlxa_unit)
- return;
- /* we've found it! */
- booted_device = dev;
-#if 0
- printf("\nbooted_device = %s\n", device_xname(dev));
-#endif
- found = 1;
- }
+ pci_find_bootdev(primarydev, dev, aux);
}
Index: src/sys/arch/alpha/alpha/dec_kn8ae.c
diff -u src/sys/arch/alpha/alpha/dec_kn8ae.c:1.44 src/sys/arch/alpha/alpha/dec_kn8ae.c:1.45
--- src/sys/arch/alpha/alpha/dec_kn8ae.c:1.44 Sun Mar 31 19:06:31 2024
+++ src/sys/arch/alpha/alpha/dec_kn8ae.c Sun Mar 9 01:06:42 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: dec_kn8ae.c,v 1.44 2024/03/31 19:06:31 thorpej Exp $ */
+/* $NetBSD: dec_kn8ae.c,v 1.45 2025/03/09 01:06:42 thorpej Exp $ */
/*
* Copyright (c) 1997 by Matthew Jacob
@@ -32,16 +32,12 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: dec_kn8ae.c,v 1.44 2024/03/31 19:06:31 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dec_kn8ae.c,v 1.45 2025/03/09 01:06:42 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <sys/lwp.h>
-#include <sys/termios.h>
-#include <sys/conf.h>
-
-#include <dev/cons.h>
#include <machine/rpb.h>
#include <machine/autoconf.h>
@@ -50,23 +46,14 @@ __KERNEL_RCSID(0, "$NetBSD: dec_kn8ae.c,
#include <machine/alpha.h>
#include <machine/logout.h>
-#include <dev/ic/comreg.h>
-#include <dev/ic/comvar.h>
-
-#include <dev/isa/isavar.h>
-#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
-#include <dev/scsipi/scsi_all.h>
-#include <dev/scsipi/scsipi_all.h>
-#include <dev/scsipi/scsiconf.h>
-
#include <alpha/tlsb/tlsbreg.h>
#include <alpha/tlsb/tlsbvar.h>
#include <alpha/tlsb/kftxxreg.h>
#include <alpha/tlsb/kftxxvar.h>
-#define KV(_addr) ((void *)ALPHA_PHYS_TO_K0SEG((_addr)))
+#define KV(_addr) ((void *)ALPHA_PHYS_TO_K0SEG((_addr)))
void dec_kn8ae_init(void);
void dec_kn8ae_cons_init(void);
@@ -119,131 +106,29 @@ dec_kn8ae_cons_init(void)
static void
dec_kn8ae_device_register(device_t dev, void *aux)
{
- static int found, initted, diskboot, netboot;
- static device_t primarydev, pcidev, ctrlrdev;
+ static device_t primarydev;
struct bootdev_data *b = bootdev_data;
- device_t parent = device_parent(dev);
- if (b == NULL || found)
+ if (booted_device != NULL || b == NULL) {
return;
-
- if (!initted) {
- diskboot = (strcasecmp(b->protocol, "SCSI") == 0);
- netboot = (strcasecmp(b->protocol, "BOOTP") == 0) ||
- (strcasecmp(b->protocol, "MOP") == 0);
-#if BDEBUG
- printf("proto:%s bus:%d slot:%d chan:%d", b->protocol,
- b->bus, b->slot, b->channel);
- if (b->remote_address)
- printf(" remote_addr:%s", b->remote_address);
- printf(" un:%d bdt:%d", b->unit, b->boot_dev_type);
- if (b->ctrl_dev_type)
- printf(" cdt:%s\n", b->ctrl_dev_type);
- else
- printf("\n");
- printf("diskboot = %d, netboot = %d\n", diskboot, netboot);
-#endif
- initted = 1;
}
if (primarydev == NULL) {
- if (!device_is_a(dev, "dwlpx"))
- return;
- else {
+ if (device_is_a(dev, "dwlpx")) {
struct kft_dev_attach_args *ka = aux;
- if (b->bus != ka->ka_hosenum)
- return;
- primarydev = dev;
-#ifdef BDEBUG
- printf("\nprimarydev = %s\n", device_xname(dev));
-#endif
- return;
- }
- }
-
- if (pcidev == NULL) {
- if (!device_is_a(dev, "pci"))
- return;
- /*
- * Try to find primarydev anywhere in the ancestry. This is
- * necessary if the PCI bus is hidden behind a bridge.
- */
- while (parent) {
- if (parent == primarydev)
- break;
- parent = device_parent(parent);
- }
- if (!parent)
- return;
- else {
- struct pcibus_attach_args *pba = aux;
-
- if ((b->slot / 1000) != pba->pba_bus)
- return;
-
- pcidev = dev;
-#if BDEBUG
- printf("\npcidev = %s\n", device_xname(dev));
-#endif
- return;
- }
- }
-
- if (ctrlrdev == NULL) {
- if (parent != pcidev)
- return;
- else {
- struct pci_attach_args *pa = aux;
- int slot;
-
- slot = pa->pa_bus * 1000 + pa->pa_function * 100 +
- pa->pa_device;
- if (b->slot != slot)
- return;
-
- if (netboot) {
- booted_device = dev;
+ if (b->bus == ka->ka_hosenum) {
+ primarydev = dev;
#ifdef BDEBUG
- printf("\nbooted_device = %s\n", device_xname(dev));
-#endif
- found = 1;
- } else {
- ctrlrdev = dev;
-#if BDEBUG
- printf("\nctrlrdev = %s\n", device_xname(dev));
+ printf("\nprimarydev = %s\n",
+ device_xname(dev));
#endif
}
- return;
}
- }
-
- if (!diskboot)
return;
-
- if (device_is_a(dev, "sd") ||
- device_is_a(dev, "st") ||
- device_is_a(dev, "cd")) {
- struct scsipibus_attach_args *sa = aux;
- struct scsipi_periph *periph = sa->sa_periph;
- int unit;
-
- if (device_parent(parent) != ctrlrdev)
- return;
-
- unit = periph->periph_target * 100 + periph->periph_lun;
- if (b->unit != unit)
- return;
- if (b->channel != periph->periph_channel->chan_channel)
- return;
-
- /* we've found it! */
- booted_device = dev;
-#if BDEBUG
- printf("\nbooted_device = %s\n", device_xname(dev));
-#endif
- found = 1;
}
+
+ pci_find_bootdev(primarydev, dev, aux);
}
/*
Index: src/sys/arch/alpha/conf/files.alpha
diff -u src/sys/arch/alpha/conf/files.alpha:1.198 src/sys/arch/alpha/conf/files.alpha:1.199
--- src/sys/arch/alpha/conf/files.alpha:1.198 Wed Mar 6 13:37:35 2024
+++ src/sys/arch/alpha/conf/files.alpha Sun Mar 9 01:06:42 2025
@@ -1,4 +1,4 @@
-# $NetBSD: files.alpha,v 1.198 2024/03/06 13:37:35 thorpej Exp $
+# $NetBSD: files.alpha,v 1.199 2025/03/09 01:06:42 thorpej Exp $
#
# alpha-specific configuration info
@@ -7,27 +7,74 @@ maxpartitions 8
maxusers 8 16 64
+# Common Alpha system support attributes.
+define alpha_pci_bootdev
+define alpha_pci_consinit
+define alpha_tc_bootdev
+
+#
# CPU support option headers
-defflag DEC_2000_300 # "Jensen": 2000/300 (DECpc AXP 150)
-defflag DEC_2100_A50 # Avanti etc: AlphaStation 400, 200, etc.
-defflag DEC_2100_A500 # Sable etc: AlphaServer 2100
-defflag DEC_2100A_A500 # Lynx etc: AlphaServer 2100A
-defflag DEC_3000_300 # Pelican etc: 3000/300*
-defflag DEC_3000_500 # Flamingo etc: 3000/[4-9]00*
-defflag DEC_550 # Miata: Personal Workstation (550)
-defflag DEC_AXPPCI_33 # NoName: AXPpci33, etc.
-defflag DEC_EB164 # EB164: AlphaPC 164
-defflag DEC_EB64PLUS # EB64+: AlphaPC 64, etc.
-defflag DEC_KN20AA # KN20AA: AlphaStation 500 and 600
-defflag DEC_KN7AA # KN7AA: DEC 7000 and 10000
-defflag DEC_KN8AE # KN8AE: AlphaServer 8200 and 8400
-defflag DEC_KN300 # KN300: AlphaServer 4X00
-defflag DEC_1000 # Mikasa etc: AlphaServer 1000
-defflag DEC_1000A # Corelle etc: AlphaServer 800 and 1000A
-defflag DEC_ALPHABOOK1 # AlphaBook1: Tadpole/DEC AlphaBook
-defflag DEC_EB66 # EB66: 21066 Evaluation Board
-defflag DEC_6600 # EV6 Various EV6 Systems
-defflag API_UP1000 # EV6 Alpha Processor, Inc. UP1000
+#
+
+# "Jensen": 2000/300 (DECpc AXP 150)
+defflag DEC_2000_300
+
+# Avanti etc: AlphaStation 400, 200, etc.
+defflag DEC_2100_A50: alpha_pci_bootdev, alpha_pci_consinit
+
+# Sable etc: AlphaServer 2100
+defflag DEC_2100_A500: alpha_pci_bootdev, alpha_pci_consinit
+
+# Lynx etc: AlphaServer 2100A
+defflag DEC_2100A_A500: alpha_pci_bootdev, alpha_pci_consinit
+
+# Pelican etc: 3000/300*
+defflag DEC_3000_300: alpha_tc_bootdev
+
+# Flamingo etc: 3000/[4-9]00*
+defflag DEC_3000_500: alpha_tc_bootdev
+
+# Miata: Personal Workstation (550)
+defflag DEC_550: alpha_pci_bootdev, alpha_pci_consinit
+
+# NoName: AXPpci33, etc.
+defflag DEC_AXPPCI_33: alpha_pci_bootdev, alpha_pci_consinit
+
+# EB164: AlphaPC 164
+defflag DEC_EB164: alpha_pci_bootdev, alpha_pci_consinit
+
+# EB64+: AlphaPC 64, etc.
+defflag DEC_EB64PLUS: alpha_pci_bootdev, alpha_pci_consinit
+
+# KN20AA: AlphaStation 500 and 600
+defflag DEC_KN20AA: alpha_pci_bootdev, alpha_pci_consinit
+
+# KN7AA: DEC 7000 and 10000
+defflag DEC_KN7AA
+
+# KN8AE: AlphaServer 8200 and 8400
+defflag DEC_KN8AE: alpha_pci_bootdev
+
+# KN300: AlphaServer 4X00
+defflag DEC_KN300: alpha_pci_bootdev, alpha_pci_consinit
+
+# Mikasa etc: AlphaServer 1000
+defflag DEC_1000: alpha_pci_bootdev, alpha_pci_consinit
+
+# Corelle etc: AlphaServer 800 and 1000A
+defflag DEC_1000A: alpha_pci_bootdev, alpha_pci_consinit
+
+# AlphaBook1: Tadpole/DEC AlphaBook
+defflag DEC_ALPHABOOK1: alpha_pci_bootdev, alpha_pci_consinit
+
+# EB66: 21066 Evaluation Board
+defflag DEC_EB66: alpha_pci_bootdev, alpha_pci_consinit
+
+# Tsunami/Titan Tsunami/Titan EV6 workstation and server systems
+defflag DEC_6600: alpha_pci_bootdev, alpha_pci_consinit
+
+# Nautilus Alpha Processor, Inc. UP1000 (EV6 + AMD-751)
+defflag API_UP1000: alpha_pci_bootdev, alpha_pci_consinit
# Miscellaneous CPU-specific option headers
defflag FIX_UNALIGNED_VAX_FP
@@ -132,6 +179,8 @@ include "dev/tc/files.tc"
define tcbus { } # TURBOchannel attachment
attach tc at tcbus
+file arch/alpha/tc/tc_bootdev.c alpha_tc_bootdev
+
device tcasic: tcbus
attach tcasic at mainbus
file arch/alpha/tc/tcasic.c tcasic
@@ -346,6 +395,8 @@ file arch/alpha/pci/pci_6600.c dec_6600
# PCI Bus devices
#
+file arch/alpha/pci/pci_bootdev.c alpha_pci_bootdev
+file arch/alpha/pci/pci_consinit.c alpha_pci_consinit
file arch/alpha/pci/pci_machdep.c pci
file arch/alpha/pci/agp_machdep.c agp
Index: src/sys/arch/alpha/include/autoconf.h
diff -u src/sys/arch/alpha/include/autoconf.h:1.23 src/sys/arch/alpha/include/autoconf.h:1.24
--- src/sys/arch/alpha/include/autoconf.h:1.23 Mon Feb 6 02:14:13 2012
+++ src/sys/arch/alpha/include/autoconf.h Sun Mar 9 01:06:42 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: autoconf.h,v 1.23 2012/02/06 02:14:13 matt Exp $ */
+/* $NetBSD: autoconf.h,v 1.24 2025/03/09 01:06:42 thorpej Exp $ */
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -110,6 +110,7 @@ struct alpha_variation_table {
#ifdef _KERNEL
extern struct bootdev_data *bootdev_data;
extern struct bootinfo_kernel bootinfo;
+extern bool bootdev_is_disk, bootdev_is_net;
const char *alpha_variation_name(uint64_t,
const struct alpha_variation_table *);
Index: src/sys/arch/alpha/include/pci_machdep.h
diff -u src/sys/arch/alpha/include/pci_machdep.h:1.24 src/sys/arch/alpha/include/pci_machdep.h:1.25
--- src/sys/arch/alpha/include/pci_machdep.h:1.24 Sun Jul 4 22:36:43 2021
+++ src/sys/arch/alpha/include/pci_machdep.h Sun Mar 9 01:06:42 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_machdep.h,v 1.24 2021/07/04 22:36:43 thorpej Exp $ */
+/* $NetBSD: pci_machdep.h,v 1.25 2025/03/09 01:06:42 thorpej Exp $ */
/*
* Copyright (c) 1996 Carnegie-Mellon University.
@@ -130,8 +130,11 @@ void pci_intr_disestablish(pci_chipset_t
* alpha-specific PCI functions.
* NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
*/
+void pci_consinit(pci_chipset_tag_t, bus_space_tag_t, bus_space_tag_t,
+ bus_space_tag_t, bus_space_tag_t);
void pci_display_console(bus_space_tag_t, bus_space_tag_t,
pci_chipset_tag_t, int, int, int);
+void pci_find_bootdev(device_t, device_t, void *);
void device_pci_register(device_t, void *);
void alpha_pci_intr_init(void *, bus_space_tag_t, bus_space_tag_t,
Index: src/sys/arch/alpha/include/tc_machdep.h
diff -u src/sys/arch/alpha/include/tc_machdep.h:1.8 src/sys/arch/alpha/include/tc_machdep.h:1.9
--- src/sys/arch/alpha/include/tc_machdep.h:1.8 Wed Jul 20 15:45:28 2022
+++ src/sys/arch/alpha/include/tc_machdep.h Sun Mar 9 01:06:42 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: tc_machdep.h,v 1.8 2022/07/20 15:45:28 thorpej Exp $ */
+/* $NetBSD: tc_machdep.h,v 1.9 2025/03/09 01:06:42 thorpej Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
@@ -101,8 +101,9 @@ typedef int32_t tc_offset_t;
* These functions are private, and may not be called by
* machine-independent code.
*/
-bus_space_tag_t tc_bus_mem_init(void *memv);
-void tc_dma_init(void);
+void tc_find_bootdev(device_t, void *);
+bus_space_tag_t tc_bus_mem_init(void *memv);
+void tc_dma_init(void);
/*
* Address of scatter/gather SRAM on the 3000/500-series.
Added files:
Index: src/sys/arch/alpha/pci/pci_bootdev.c
diff -u /dev/null src/sys/arch/alpha/pci/pci_bootdev.c:1.1
--- /dev/null Sun Mar 9 01:06:42 2025
+++ src/sys/arch/alpha/pci/pci_bootdev.c Sun Mar 9 01:06:42 2025
@@ -0,0 +1,188 @@
+/* $NetBSD: pci_bootdev.c,v 1.1 2025/03/09 01:06:42 thorpej Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996, 1997 Carnegie-Mellon University.
+ * 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 [email protected]
+ * 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/cdefs.h> /* RCS ID & Copyright macro defns */
+
+__KERNEL_RCSID(0, "$NetBSD: pci_bootdev.c,v 1.1 2025/03/09 01:06:42 thorpej Exp $");
+
+#include <sys/systm.h>
+#include <sys/device.h>
+
+#include <machine/alpha.h>
+#include <machine/autoconf.h>
+
+#include <dev/ata/atavar.h>
+#include <dev/pci/pcivar.h>
+#include <dev/scsipi/scsiconf.h>
+
+#include <dev/ic/mlxio.h> /* XXX */
+#include <dev/ic/mlxvar.h> /* XXX */
+
+#include <dev/i2o/i2o.h> /* XXX */
+#include <dev/i2o/iopio.h> /* XXX */
+#include <dev/i2o/iopvar.h> /* XXX */
+
+#define DPRINTF(x) if (bootdev_debug) printf x
+
+void
+pci_find_bootdev(device_t hosedev, device_t dev, void *aux)
+{
+ static device_t pcidev, ctrlrdev;
+ struct bootdev_data *b = bootdev_data;
+ device_t parent = device_parent(dev);
+
+ if (booted_device != NULL || b == NULL) {
+ return;
+ }
+
+ if (pcidev == NULL) {
+ if (device_is_a(dev, "pci")) {
+ struct pcibus_attach_args *pba = aux;
+
+ /*
+ * If a hose device was specified, ensure that
+ * this PCI instance has that device as an ancestor.
+ */
+ if (hosedev) {
+ while (parent) {
+ if (parent == hosedev) {
+ break;
+ }
+ parent = device_parent(parent);
+ }
+ if (!parent) {
+ return;
+ }
+ }
+ if ((b->slot / 1000) == pba->pba_bus) {
+ pcidev = dev;
+ DPRINTF(("\npcidev = %s\n", device_xname(dev)));
+ }
+ }
+ return;
+ }
+
+ if (ctrlrdev == NULL) {
+ if (parent == pcidev) {
+ struct pci_attach_args *pa = aux;
+ int slot = pa->pa_bus * 1000 + pa->pa_function * 100 +
+ pa->pa_device;
+
+ if (b->slot == slot) {
+ if (bootdev_is_net) {
+ goto foundit;
+ } else {
+ ctrlrdev = dev;
+ DPRINTF(("\nctrlrdev = %s\n",
+ device_xname(dev)));
+ }
+ }
+ }
+ return;
+ }
+
+ if (!bootdev_is_disk) {
+ return;
+ }
+
+ if (device_is_a(dev, "sd") ||
+ device_is_a(dev, "st") ||
+ device_is_a(dev, "cd")) {
+ struct scsipibus_attach_args *sa = aux;
+ struct scsipi_periph *periph = sa->sa_periph;
+ int unit;
+
+ if (device_parent(parent) != ctrlrdev) {
+ return;
+ }
+
+ unit = periph->periph_target * 100 + periph->periph_lun;
+ if (b->unit != unit ||
+ b->channel != periph->periph_channel->chan_channel) {
+ return;
+ }
+ goto foundit;
+ }
+
+ if (device_is_a(dev, "wd")) {
+ struct ata_device *adev = aux;
+
+ if (!device_is_a(parent, "atabus")) {
+ return;
+ }
+ if (device_parent(parent) != ctrlrdev) {
+ return;
+ }
+
+ DPRINTF(("\natapi info: drive %d, channel %d\n",
+ adev->adev_drv_data->drive, adev->adev_channel));
+ DPRINTF(("bootdev info: unit: %d, channel: %d\n",
+ b->unit, b->channel));
+ if (b->unit != adev->adev_drv_data->drive ||
+ b->channel != adev->adev_channel) {
+ return;
+ }
+ goto foundit;
+ }
+
+ if (device_is_a(dev, "ld")) {
+ /*
+ * XXX Attach arguments for ld devices is not consistent,
+ * XXX so we have to special-case each supported RAID
+ * XXX controller.
+ */
+ if (parent != ctrlrdev) {
+ return;
+ }
+
+ if (device_is_a(parent, "mlx")) {
+ struct mlx_attach_args *mlxa = aux;
+
+ if (b->unit != mlxa->mlxa_unit) {
+ return;
+ }
+ goto foundit;
+ }
+
+ if (device_is_a(parent, "iop")) {
+ struct iop_attach_args *iopa = aux;
+
+ if (b->unit != iopa->ia_tid) {
+ return;
+ }
+ goto foundit;
+ }
+ }
+
+ return;
+
+ foundit:
+ booted_device = dev;
+ DPRINTF(("\nbooted_device = %s\n", device_xname(dev)));
+}
Index: src/sys/arch/alpha/pci/pci_consinit.c
diff -u /dev/null src/sys/arch/alpha/pci/pci_consinit.c:1.1
--- /dev/null Sun Mar 9 01:06:42 2025
+++ src/sys/arch/alpha/pci/pci_consinit.c Sun Mar 9 01:06:42 2025
@@ -0,0 +1,136 @@
+/* $NetBSD: pci_consinit.c,v 1.1 2025/03/09 01:06:42 thorpej Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996, 1997 Carnegie-Mellon University.
+ * 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 [email protected]
+ * 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 "opt_kgdb.h"
+
+#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
+
+__KERNEL_RCSID(0, "$NetBSD: pci_consinit.c,v 1.1 2025/03/09 01:06:42 thorpej Exp $");
+
+#include <sys/systm.h>
+#include <sys/device.h>
+#include <sys/termios.h>
+#include <sys/time.h>
+#include <sys/bus.h>
+
+#include <machine/rpb.h>
+#include <machine/autoconf.h>
+
+#include <dev/ic/comreg.h>
+#include <dev/ic/comvar.h>
+
+#include <dev/ic/i8042reg.h>
+#include <dev/ic/pckbcvar.h>
+
+#include <dev/isa/isareg.h>
+#include <dev/isa/isavar.h>
+
+#include <dev/pci/pcireg.h>
+#include <dev/pci/pcivar.h>
+
+#include "pckbd.h"
+
+#ifndef CONSPEED
+#define CONSPEED TTYDEF_SPEED
+#endif
+static int comcnrate = CONSPEED;
+
+#ifdef KGDB
+#include <machine/db_machdep.h>
+
+static const char *kgdb_devlist[] = {
+ "com",
+ NULL,
+};
+#endif /* KGDB */
+
+void
+pci_consinit(pci_chipset_tag_t disp_pc,
+ bus_space_tag_t disp_iot, bus_space_tag_t disp_memt,
+ bus_space_tag_t isa_iot, bus_space_tag_t isa_memt)
+{
+ const struct ctb *ctb;
+
+ ctb = (struct ctb *)(((char *)hwrpb) + hwrpb->rpb_ctb_off);
+
+ switch (ctb->ctb_term_type) {
+ case CTB_PRINTERPORT:
+ /* serial console ... */
+ /* XXX */
+ /*
+ * Delay to allow PROM putchars to complete.
+ * FIFO depth * character time,
+ * character time = (1000000 / (defaultrate / 10))
+ */
+ DELAY(160000000 / comcnrate);
+
+ if (comcnattach(isa_iot, 0x3f8, comcnrate, COM_FREQ,
+ COM_TYPE_NORMAL,
+ (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8)) {
+ panic("can't init serial console");
+ }
+ break;
+
+ case CTB_GRAPHICS:
+#if NPCKBD > 0
+ /* display console ... */
+ /* XXX */
+ (void) pckbc_cnattach(isa_iot, IO_KBD, KBCMDP,
+ PCKBC_KBD_SLOT, 0);
+
+ switch (CTB_TURBOSLOT_TYPE(ctb->ctb_turboslot)) {
+ case CTB_TURBOSLOT_TYPE_ISA:
+ case CTB_TURBOSLOT_TYPE_EISA:
+ isa_display_console(isa_iot, isa_memt);
+ break;
+
+ case CTB_TURBOSLOT_TYPE_PCI:
+ default:
+ pci_display_console(disp_iot, disp_memt, disp_pc,
+ CTB_TURBOSLOT_BUS(ctb->ctb_turboslot),
+ CTB_TURBOSLOT_SLOT(ctb->ctb_turboslot), 0);
+ break;
+ }
+#else
+ panic("not configured to use display && keyboard console");
+#endif
+ break;
+
+ default:
+ printf("ctb->ctb_term_type = 0x%lx\n", ctb->ctb_term_type);
+ printf("ctb->ctb_turboslot = 0x%lx\n", ctb->ctb_turboslot);
+
+ panic("%s: unknown console type %ld", __func__,
+ ctb->ctb_term_type);
+ }
+#ifdef KGDB
+ /* Attach the KGDB device. */
+ alpha_kgdb_init(kgdb_devlist, isa_iot);
+#endif /* KGDB */
+}
Index: src/sys/arch/alpha/tc/tc_bootdev.c
diff -u /dev/null src/sys/arch/alpha/tc/tc_bootdev.c:1.1
--- /dev/null Sun Mar 9 01:06:42 2025
+++ src/sys/arch/alpha/tc/tc_bootdev.c Sun Mar 9 01:06:42 2025
@@ -0,0 +1,152 @@
+/* $NetBSD: tc_bootdev.c,v 1.1 2025/03/09 01:06:42 thorpej Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 Carnegie-Mellon University.
+ * 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 [email protected]
+ * 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/cdefs.h> /* RCS ID & Copyright macro defns */
+
+__KERNEL_RCSID(0, "$NetBSD: tc_bootdev.c,v 1.1 2025/03/09 01:06:42 thorpej Exp $");
+
+#include <sys/systm.h>
+#include <sys/device.h>
+
+#include <machine/alpha.h>
+#include <machine/autoconf.h>
+#include <machine/rpb.h>
+
+#include <dev/scsipi/scsiconf.h>
+
+#include <dev/tc/tcvar.h>
+#include <dev/tc/tcdsvar.h>
+
+#define DPRINTF(x) if (bootdev_debug) printf x
+
+static inline int
+tc_ioasic_slot(void)
+{
+ /* 5 on 3000/300, 7 on everything else. */
+ return cputype == ST_DEC_3000_300 ? 5 : 7;
+}
+
+void
+tc_find_bootdev(device_t dev, void *aux)
+{
+ static device_t scsidev, tcdsdev;
+ struct bootdev_data *b = bootdev_data;
+ device_t parent = device_parent(dev);
+
+ if (booted_device != NULL || b == NULL) {
+ return;
+ }
+
+ /*
+ * For SCSI boot, we look for "tcds", make sure it has the
+ * right slot number, then find the "asc" on this tcds that
+ * has the right channel. Then we find the actual SCSI
+ * device we came from. NOTE: No SCSI LUN support (yet).
+ */
+ if (bootdev_is_disk) {
+ if (tcdsdev == NULL) {
+ if (device_is_a(dev, "tcds")) {
+ struct tc_attach_args *tcargs = aux;
+
+ if (b->slot == tcargs->ta_slot) {
+ tcdsdev = dev;
+ DPRINTF(("\ntcdsdev = %s\n",
+ device_xname(dev)));
+ }
+ }
+ return;
+ }
+ if (scsidev == NULL) {
+ if (device_is_a(dev, "asc")) {
+ struct tcdsdev_attach_args *ta = aux;
+
+ if (parent == tcdsdev &&
+ b->channel == ta->tcdsda_chip) {
+ scsidev = dev;
+ DPRINTF(("\nscsidev = %s\n",
+ device_xname(dev)));
+ }
+ }
+ return;
+ }
+ if (device_is_a(dev, "sd") ||
+ device_is_a(dev, "st") ||
+ device_is_a(dev, "cd")) {
+ struct scsipibus_attach_args *sa = aux;
+
+ if (device_parent(parent) != scsidev ||
+ b->unit / 100 != sa->sa_periph->periph_target) {
+ return;
+ }
+
+ /* XXX LUN */
+
+ switch (b->boot_dev_type) {
+ case 0:
+ if (!device_is_a(dev, "sd") &&
+ !device_is_a(dev, "cd")) {
+ return;
+ }
+ break;
+
+ case 1:
+ if (!device_is_a(dev, "st")) {
+ return;
+ }
+ break;
+
+ default:
+ return;
+ }
+ goto foundit;
+ }
+ }
+
+ if (bootdev_is_net) {
+ if (device_is_a(dev, "le") &&
+ device_is_a(parent, "ioasic") &&
+ b->slot == tc_ioasic_slot()) {
+ /*
+ * No need to check ioasic_attach_args, since only
+ * one le on ioasic.
+ */
+ goto foundit;
+ }
+
+ /*
+ * XXX GENERIC SUPPORT FOR TC NETWORK BOARDS
+ */
+ }
+
+ return;
+
+ foundit:
+ booted_device = dev;
+ DPRINTF(("\nbooted_device = %s\n", device_xname(dev)));
+}