Module Name: src Committed By: thorpej Date: Wed Mar 6 13:37:35 UTC 2024
Modified Files: src/sys/arch/alpha/conf: GENERIC INSTALL files.alpha src/sys/arch/alpha/tlsb: tlsb.c tlsbvar.h Log Message: Tidy up TLSB autoconfiguration just a bit. To generate a diff of this commit: cvs rdiff -u -r1.420 -r1.421 src/sys/arch/alpha/conf/GENERIC cvs rdiff -u -r1.119 -r1.120 src/sys/arch/alpha/conf/INSTALL cvs rdiff -u -r1.197 -r1.198 src/sys/arch/alpha/conf/files.alpha cvs rdiff -u -r1.41 -r1.42 src/sys/arch/alpha/tlsb/tlsb.c cvs rdiff -u -r1.7 -r1.8 src/sys/arch/alpha/tlsb/tlsbvar.h 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/conf/GENERIC diff -u src/sys/arch/alpha/conf/GENERIC:1.420 src/sys/arch/alpha/conf/GENERIC:1.421 --- src/sys/arch/alpha/conf/GENERIC:1.420 Sat Mar 2 20:15:33 2024 +++ src/sys/arch/alpha/conf/GENERIC Wed Mar 6 13:37:35 2024 @@ -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 ? Index: src/sys/arch/alpha/conf/INSTALL diff -u src/sys/arch/alpha/conf/INSTALL:1.119 src/sys/arch/alpha/conf/INSTALL:1.120 --- src/sys/arch/alpha/conf/INSTALL:1.119 Sat Mar 2 20:15:33 2024 +++ src/sys/arch/alpha/conf/INSTALL Wed Mar 6 13:37:35 2024 @@ -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 ? Index: src/sys/arch/alpha/conf/files.alpha diff -u src/sys/arch/alpha/conf/files.alpha:1.197 src/sys/arch/alpha/conf/files.alpha:1.198 --- src/sys/arch/alpha/conf/files.alpha:1.197 Wed Mar 6 05:33:09 2024 +++ src/sys/arch/alpha/conf/files.alpha Wed Mar 6 13:37:35 2024 @@ -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 Index: src/sys/arch/alpha/tlsb/tlsb.c diff -u src/sys/arch/alpha/tlsb/tlsb.c:1.41 src/sys/arch/alpha/tlsb/tlsb.c:1.42 --- src/sys/arch/alpha/tlsb/tlsb.c:1.41 Sat Aug 7 16:18:41 2021 +++ src/sys/arch/alpha/tlsb/tlsb.c Wed Mar 6 13:37:35 2024 @@ -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 sel 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 sel * 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 sel */ 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); - - locs[TLSBCF_NODE] = node; - locs[TLSBCF_OFFSET] = 0; /* XXX unused? */ - - config_found(self, &ta, tlsbprint, - CFARGS(.submatch = config_stdsubmatch, - .locators = locs)); - } + 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; + + 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 */ } Index: src/sys/arch/alpha/tlsb/tlsbvar.h diff -u src/sys/arch/alpha/tlsb/tlsbvar.h:1.7 src/sys/arch/alpha/tlsb/tlsbvar.h:1.8 --- src/sys/arch/alpha/tlsb/tlsbvar.h:1.7 Mon Feb 6 02:14:16 2012 +++ src/sys/arch/alpha/tlsb/tlsbvar.h Wed Mar 6 13:37:35 2024 @@ -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