Tidy up TLSB autoconfiguration just a bit.

This commit is contained in:
thorpej 2024-03-06 13:37:35 +00:00
parent 711ef3cdc9
commit b07295a08c
5 changed files with 64 additions and 71 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: GENERIC,v 1.420 2024/03/02 20:15:33 thorpej Exp $
# $NetBSD: GENERIC,v 1.421 2024/03/06 13:37:35 thorpej Exp $
#
# This machine description file is used to generate the default NetBSD
# kernel.
@ -19,7 +19,7 @@ include "arch/alpha/conf/std.alpha"
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
ident "GENERIC-$Revision: 1.420 $"
ident "GENERIC-$Revision: 1.421 $"
maxusers 32
@ -191,9 +191,9 @@ qemu* at mainbus?
# TurboLaser bus support and devices
tlsb* at mainbus?
gbus* at tlsb? node ? offset ?
tlsbmem* at tlsb? node ? offset ?
kft* at tlsb? node ? offset ?
gbus* at tlsb? node ?
tlsbmem* at tlsb? node ?
kft* at tlsb? node ?
# Gbus Devices
mcclock* at gbus? offset ?

View File

@ -1,4 +1,4 @@
# $NetBSD: INSTALL,v 1.119 2024/03/02 20:15:33 thorpej Exp $
# $NetBSD: INSTALL,v 1.120 2024/03/06 13:37:35 thorpej Exp $
#
# Alpha INSTALL kernel.
@ -92,9 +92,9 @@ qemu* at mainbus?
# TurboLaser bus support and devices
tlsb* at mainbus?
gbus* at tlsb? node ? offset ?
tlsbmem* at tlsb? node ? offset ?
kft* at tlsb? node ? offset ?
gbus* at tlsb? node ?
tlsbmem* at tlsb? node ?
kft* at tlsb? node ?
# Gbus Devices
mcclock* at gbus? offset ?

View File

@ -1,4 +1,4 @@
# $NetBSD: files.alpha,v 1.197 2024/03/06 05:33:09 thorpej Exp $
# $NetBSD: files.alpha,v 1.198 2024/03/06 13:37:35 thorpej Exp $
#
# alpha-specific configuration info
@ -85,7 +85,7 @@ file dev/md_root.c memory_disk_hooks
# TurboLaser Bus Support
#
device tlsb { node = -1, offset = -1 }
device tlsb { node = -1 }
attach tlsb at mainbus
file arch/alpha/tlsb/tlsb.c tlsb & dec_kn8ae

View File

@ -1,4 +1,4 @@
/* $NetBSD: tlsb.c,v 1.41 2021/08/07 16:18:41 thorpej Exp $ */
/* $NetBSD: tlsb.c,v 1.42 2024/03/06 13:37:35 thorpej Exp $ */
/*
* Copyright (c) 1997 by Matthew Jacob
* NASA AMES Research Center.
@ -39,7 +39,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: tlsb.c,v 1.41 2021/08/07 16:18:41 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: tlsb.c,v 1.42 2024/03/06 13:37:35 thorpej Exp $");
#include "opt_multiprocessor.h"
@ -70,7 +70,7 @@ CFATTACH_DECL_NEW(tlsb, 0,
extern struct cfdriver tlsb_cd;
static int tlsbprint(void *, const char *);
static const char *tlsb_node_type_str(uint32_t);
static const char *tlsb_node_type_str(uint32_t, char *, size_t);
/*
* There can be only one TurboLaser, and we'll overload it
@ -87,13 +87,15 @@ static int
tlsbprint(void *aux, const char *pnp)
{
struct tlsb_dev_attach_args *tap = aux;
char buf[64];
if (pnp)
aprint_normal("%s at %s node %d",
tlsb_node_type_str(tap->ta_dtype), pnp, tap->ta_node);
tlsb_node_type_str(tap->ta_dtype, buf, sizeof(buf)),
pnp, tap->ta_node);
else
aprint_normal(" node %d: %s", tap->ta_node,
tlsb_node_type_str(tap->ta_dtype));
tlsb_node_type_str(tap->ta_dtype, buf, sizeof(buf)));
return (UNCONF);
}
@ -124,7 +126,9 @@ tlsbattach(device_t parent, device_t self, void *aux)
struct tlsb_dev_attach_args ta;
uint32_t tldev;
int node;
int ionodes = 0;
int locs[TLSBCF_NLOCS];
char buf[64];
printf("\n");
@ -158,9 +162,11 @@ tlsbattach(device_t parent, device_t self, void *aux)
* We do this so that we don't have to do something
* silly at fault time like try a 'baddadr'...
*/
tlsb_found |= (1 << node);
if (TLDEV_ISIOPORT(tldev))
tlsb_found |= __BIT(node);
if (TLDEV_ISIOPORT(tldev)) {
ionodes |= __BIT(node);
continue; /* not interested right now */
}
ta.ta_node = node;
ta.ta_dtype = TLDEV_DTYPE(tldev);
ta.ta_swrev = TLDEV_SWREV(tldev);
@ -171,73 +177,71 @@ tlsbattach(device_t parent, device_t self, void *aux)
*/
if (TLDEV_ISCPU(tldev)) {
aprint_normal("%s node %d: %s\n", device_xname(self),
node, tlsb_node_type_str(tldev));
node,
tlsb_node_type_str(tldev, buf, sizeof(buf)));
}
/*
* Attach any children nodes, including a CPU's GBus
*/
locs[TLSBCF_NODE] = node;
locs[TLSBCF_OFFSET] = 0; /* XXX unused? */
config_found(self, &ta, tlsbprint,
CFARGS(.submatch = config_stdsubmatch,
.locators = locs));
}
/*
* *Now* search for I/O nodes (in descending order)
* *Now* attach I/O nodes (in descending order). We don't
* need to bother using badaddr() here; we have a cheat sheet
* from above.
*/
while (--node > 0) {
if (badaddr(TLSB_NODE_REG_ADDR(node, TLDEV), sizeof(uint32_t)))
while (--node >= 0) {
if ((ionodes & __BIT(node)) == 0) {
continue;
}
tldev = TLSB_GET_NODEREG(node, TLDEV);
if (tldev == 0) {
continue;
}
if (TLDEV_ISIOPORT(tldev)) {
#if defined(MULTIPROCESSOR)
/*
* XXX Eventually, we want to select a secondary
* XXX processor on which to field interrupts for
* XXX this node. However, we just send them to
* XXX the primary CPU for now.
*
* XXX Maybe multiple CPUs? Does the hardware
* XXX round-robin, or check the length of the
* XXX per-CPU interrupt queue?
*/
printf("%s node %d: routing interrupts to %s\n",
device_xname(self), node,
device_xname(cpu_info[hwrpb->rpb_primary_cpu_id]->ci_softc->sc_dev));
TLSB_PUT_NODEREG(node, TLCPUMASK,
(1UL << hwrpb->rpb_primary_cpu_id));
/*
* XXX Eventually, we want to select a secondary
* XXX processor on which to field interrupts for
* XXX this node. However, we just send them to
* XXX the primary CPU for now.
*
* XXX Maybe multiple CPUs? Does the hardware
* XXX round-robin, or check the length of the
* XXX per-CPU interrupt queue?
*/
printf("%s node %d: routing interrupts to %s\n",
device_xname(self), node,
device_xname(cpu_info[hwrpb->rpb_primary_cpu_id]->ci_softc->sc_dev));
TLSB_PUT_NODEREG(node, TLCPUMASK,
(1UL << hwrpb->rpb_primary_cpu_id));
#else
/*
* Make sure interrupts are sent to the primary CPU.
*/
TLSB_PUT_NODEREG(node, TLCPUMASK,
(1UL << hwrpb->rpb_primary_cpu_id));
/*
* Make sure interrupts are sent to the primary CPU.
*/
TLSB_PUT_NODEREG(node, TLCPUMASK,
(1UL << hwrpb->rpb_primary_cpu_id));
#endif /* MULTIPROCESSOR */
ta.ta_node = node;
ta.ta_dtype = TLDEV_DTYPE(tldev);
ta.ta_swrev = TLDEV_SWREV(tldev);
ta.ta_hwrev = TLDEV_HWREV(tldev);
ta.ta_node = node;
ta.ta_dtype = TLDEV_DTYPE(tldev);
ta.ta_swrev = TLDEV_SWREV(tldev);
ta.ta_hwrev = TLDEV_HWREV(tldev);
locs[TLSBCF_NODE] = node;
locs[TLSBCF_OFFSET] = 0; /* XXX unused? */
locs[TLSBCF_NODE] = node;
config_found(self, &ta, tlsbprint,
CFARGS(.submatch = config_stdsubmatch,
.locators = locs));
}
config_found(self, &ta, tlsbprint,
CFARGS(.submatch = config_stdsubmatch,
.locators = locs));
}
}
static const char *
tlsb_node_type_str(uint32_t dtype)
tlsb_node_type_str(uint32_t dtype, char *buf, size_t buflen)
{
static char tlsb_line[64];
switch (dtype & TLDEV_DTYPE_MASK) {
case TLDEV_DTYPE_KFTHA:
return ("KFTHA I/O interface");
@ -261,9 +265,8 @@ tlsb_node_type_str(uint32_t dtype)
return ("Dual CPU, 16MB cache");
default:
snprintf(tlsb_line, sizeof(tlsb_line), "unknown, dtype 0x%x",
dtype);
return (tlsb_line);
snprintf(buf, buflen, "unknown, dtype 0x%04x", dtype);
return (buf);
}
/* NOTREACHED */
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: tlsbvar.h,v 1.7 2012/02/06 02:14:16 matt Exp $ */
/* $NetBSD: tlsbvar.h,v 1.8 2024/03/06 13:37:35 thorpej Exp $ */
/*
* Copyright (c) 1997 by Matthew Jacob
@ -48,16 +48,6 @@ struct tlsb_dev_attach_args {
uint8_t ta_hwrev; /* hardware revision */
};
/*
* Bus-dependent structure for CPUs. This is dynamically allocated
* for each CPU on the TurboLaser, and glued into the cpu_softc
* as sc_busdep (when there is a cpu_softc to do this to).
*/
struct tlsb_cpu_busdep {
uint8_t tcpu_vid; /* virtual ID of CPU */
int tcpu_node; /* TurboLaser node */
};
#ifdef _KERNEL
extern int tlsb_found;
#endif