diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2001-06-26 20:25:52 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2001-06-26 20:25:52 +0000 |
commit | 6e8e19c3ec5c652ee22bb615672cceb868d6ebe5 (patch) | |
tree | ffd29ca20e827e0bf3430ec5c65fdfcadf997e87 /sys | |
parent | a7926156e17b493f9d7b9ac07f4d7fe8d7a003ef (diff) |
Provide some chipset information to usreland through sysctl.
The chipset support is not here yet, but the skeleton works.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/alpha/alpha/machdep.c | 10 | ||||
-rw-r--r-- | sys/arch/alpha/include/cpu.h | 10 | ||||
-rw-r--r-- | sys/arch/alpha/pci/pci_machdep.c | 31 | ||||
-rw-r--r-- | sys/arch/alpha/pci/pci_machdep.h | 8 |
4 files changed, 52 insertions, 7 deletions
diff --git a/sys/arch/alpha/alpha/machdep.c b/sys/arch/alpha/alpha/machdep.c index efc343b18e9..07a652b6182 100644 --- a/sys/arch/alpha/alpha/machdep.c +++ b/sys/arch/alpha/alpha/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.47 2001/06/25 00:43:06 mickey Exp $ */ +/* $OpenBSD: machdep.c,v 1.48 2001/06/26 20:25:50 art Exp $ */ /* $NetBSD: machdep.c,v 1.206 2000/05/23 05:12:54 thorpej Exp $ */ /*- @@ -118,6 +118,8 @@ #include <machine/prom.h> #include <machine/cpuconf.h> +#include <dev/pci/pcivar.h> + #ifdef DDB #include <machine/db_machdep.h> #include <ddb/db_access.h> @@ -1773,8 +1775,7 @@ cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) { dev_t consdev; - /* all sysctl names at this level are terminal */ - if (namelen != 1) + if (name[0] != CPU_CHIPSET && namelen != 1) return (ENOTDIR); /* overloaded */ switch (name[0]) { @@ -1806,6 +1807,9 @@ cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) return (sysctl_rdstring(oldp, oldlenp, newp, bootinfo.booted_kernel)); + case CPU_CHIPSET: + return (alpha_sysctl_chipset(name + 1, namelen - 1, oldp, + oldlenp)); default: return (EOPNOTSUPP); } diff --git a/sys/arch/alpha/include/cpu.h b/sys/arch/alpha/include/cpu.h index 5ec15a90ba3..79bbc8cc65f 100644 --- a/sys/arch/alpha/include/cpu.h +++ b/sys/arch/alpha/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.11 2001/02/12 11:12:35 art Exp $ */ +/* $OpenBSD: cpu.h,v 1.12 2001/06/26 20:25:50 art Exp $ */ /* $NetBSD: cpu.h,v 1.45 2000/08/21 02:03:12 thorpej Exp $ */ /*- @@ -310,7 +310,12 @@ do { \ #define CPU_UNALIGNED_FIX 4 /* int: fix unaligned accesses */ #define CPU_UNALIGNED_SIGBUS 5 /* int: SIGBUS unaligned accesses */ #define CPU_BOOTED_KERNEL 6 /* string: booted kernel name */ -#define CPU_MAXID 7 /* 6 valid machdep IDs */ +#define CPU_CHIPSET 7 /* chipset information */ +#define CPU_MAXID 8 /* 6 valid machdep IDs */ + +#define CPU_CHIPSET_MEM 1 /* PCI memory address */ +#define CPU_CHIPSET_BWX 2 /* PCI supports BWX */ +#define CPU_CHIPSET_TYPE 3 /* PCI chipset name */ #define CTL_MACHDEP_NAMES { \ { 0, 0 }, \ @@ -320,6 +325,7 @@ do { \ { "unaligned_fix", CTLTYPE_INT }, \ { "unaligned_sigbus", CTLTYPE_INT }, \ { "booted_kernel", CTLTYPE_STRING }, \ + { "chipset", CTLTYPE_NODE }, \ } #ifdef _KERNEL diff --git a/sys/arch/alpha/pci/pci_machdep.c b/sys/arch/alpha/pci/pci_machdep.c index cffb296b604..c1aa3144c65 100644 --- a/sys/arch/alpha/pci/pci_machdep.c +++ b/sys/arch/alpha/pci/pci_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.c,v 1.10 2000/07/03 19:30:21 mickey Exp $ */ +/* $OpenBSD: pci_machdep.c,v 1.11 2001/06/26 20:25:51 art Exp $ */ /* $NetBSD: pci_machdep.c,v 1.7 1996/11/19 04:57:32 cgd Exp $ */ /* @@ -39,6 +39,8 @@ #include <sys/errno.h> #include <sys/device.h> #include <vm/vm.h> +#include <machine/cpu.h> +#include <sys/sysctl.h> #include <dev/isa/isavar.h> #include <dev/pci/pcireg.h> @@ -55,6 +57,8 @@ #include <dev/pci/tgavar.h> #endif +struct alpha_pci_chipset *alpha_pci_chipset; + void pci_display_console(iot, memt, pc, bus, device, function) bus_space_tag_t iot, memt; @@ -101,3 +105,28 @@ pci_display_console(iot, memt, pc, bus, device, function) panic("pci_display_console: unconfigured device at %d/%d/%d", bus, device, function); } + +int +alpha_sysctl_chipset(int *name, u_int namelen, char *where, size_t *sizep) +{ + if (namelen != 1) + return (ENOTDIR); + + if (alpha_pci_chipset == NULL) + return (EOPNOTSUPP); + + switch (name[0]) { + case CPU_CHIPSET_TYPE: + return (sysctl_rdstring(where, sizep, NULL, + alpha_pci_chipset->pc_name)); + case CPU_CHIPSET_BWX: + return (sysctl_rdint(where, sizep, NULL, + alpha_pci_chipset->pc_bwx)); + case CPU_CHIPSET_MEM: + return (sysctl_rdquad(where, sizep, NULL, + alpha_pci_chipset->pc_bwx)); + default: + return (EOPNOTSUPP); + } + /* NOTREACHED */ +} diff --git a/sys/arch/alpha/pci/pci_machdep.h b/sys/arch/alpha/pci/pci_machdep.h index a78c5af74d2..b3d7df1451f 100644 --- a/sys/arch/alpha/pci/pci_machdep.h +++ b/sys/arch/alpha/pci/pci_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.h,v 1.12 2001/06/25 23:03:04 art Exp $ */ +/* $OpenBSD: pci_machdep.h,v 1.13 2001/06/26 20:25:51 art Exp $ */ /* $NetBSD: pci_machdep.h,v 1.6 1996/11/19 04:49:21 cgd Exp $ */ /* @@ -73,8 +73,14 @@ struct alpha_pci_chipset { int (*)(void *), void *)); void (*pc_pciide_compat_intr_disestablish) __P((void *, void *)); + char *pc_name; /* PCI chipset name */ + vaddr_t pc_mem; /* PCI memory address */ + int pc_bwx; /* chipset supports BWX */ }; +extern struct alpha_pci_chipset *alpha_pci_chipset; +int alpha_sysctl_chipset(int *, u_int, char *, size_t *); + /* * Functions provided to machine-independent PCI code. */ |