aboutsummaryrefslogtreecommitdiff
path: root/sys/alpha
diff options
context:
space:
mode:
authorAndrew Gallatin <gallatin@FreeBSD.org>2000-10-25 00:14:11 +0000
committerAndrew Gallatin <gallatin@FreeBSD.org>2000-10-25 00:14:11 +0000
commit785640153d0e04aba102a381b00db264e86bfa70 (patch)
treef31575f85beba53e69bb91c9736fbbf955b8d9c3 /sys/alpha
parent7ff9f8835532b81ba6179ac566ef42951c9fe034 (diff)
Notes
Diffstat (limited to 'sys/alpha')
-rw-r--r--sys/alpha/osf1/osf1.h26
-rw-r--r--sys/alpha/osf1/osf1_misc.c52
2 files changed, 70 insertions, 8 deletions
diff --git a/sys/alpha/osf1/osf1.h b/sys/alpha/osf1/osf1.h
index ff1df4a7c3e7..7628bf004e1f 100644
--- a/sys/alpha/osf1/osf1.h
+++ b/sys/alpha/osf1/osf1.h
@@ -45,10 +45,30 @@ extern int bsd_to_osf1_errno[];
#define OSF1_IOCCMD(x) ((x) & 0xff)
/* for get sysinfo */
-#define OSF_GET_MAX_UPROCS 2
-#define OSF_GET_IEEE_FP_CONTROL 45
-#define OSF_GET_PROC_TYPE 60
+#define OSF_GET_MAX_UPROCS 2
+#define OSF_GET_PHYSMEM 19
+#define OSF_GET_MAX_CPU 30
+#define OSF_GET_IEEE_FP_CONTROL 45
+#define OSF_GET_CPUS_IN_BOX 55
+#define OSF_GET_CPU_INFO 59
+#define OSF_GET_PROC_TYPE 60
#define OSF_GET_HWRPB 101
+#define OSF_GET_PLATFORM_NAME 103
+
+struct osf1_cpu_info {
+ int current_cpu;
+ int cpus_in_box;
+ int cpu_type;
+ int ncpus;
+ u_int64_t cpus_present;
+ u_int64_t cpus_running;
+ u_int64_t cpu_binding;
+ u_int64_t cpu_ex_binding;
+ int mhz;
+ int unused[3];
+};
+
+
/* for set sysinfo */
#define OSF_SET_IEEE_FP_CONTROL 14
diff --git a/sys/alpha/osf1/osf1_misc.c b/sys/alpha/osf1/osf1_misc.c
index 485d962ba282..241ac584dacc 100644
--- a/sys/alpha/osf1/osf1_misc.c
+++ b/sys/alpha/osf1/osf1_misc.c
@@ -89,6 +89,7 @@
#include <sys/user.h>
#include <machine/cpu.h>
+#include <machine/cpuconf.h>
#include <machine/fpu.h>
#include <sys/sysctl.h>
@@ -261,6 +262,7 @@ osf1_open(p, uap)
return open(p, &a);
}
+extern int totalphysmem;
int
osf1_getsysinfo(p, uap)
@@ -268,6 +270,12 @@ osf1_getsysinfo(p, uap)
struct osf1_getsysinfo_args *uap;
{
int error, retval;
+ int ncpus = 1; /* XXX until SMP */
+ int ophysmem;
+ int unit;
+ long percpu;
+ long proctype;
+ struct osf1_cpu_info cpuinfo;
error = retval = 0;
@@ -277,16 +285,46 @@ osf1_getsysinfo(p, uap)
sizeof(maxprocperuid));
retval = 1;
break;
+ case OSF_GET_PHYSMEM:
+ ophysmem = totalphysmem * (PAGE_SIZE >> 10);
+ error = copyout(&ophysmem, uap->buffer,
+ sizeof(ophysmem));
+ retval = 1;
+ break;
+ case OSF_GET_MAX_CPU:
+ case OSF_GET_CPUS_IN_BOX:
+ error = copyout(&ncpus, uap->buffer,
+ sizeof(ncpus));
+ retval = 1;
+ break;
case OSF_GET_IEEE_FP_CONTROL:
error = copyout(&p->p_addr->u_pcb.pcb_fp_control,uap->buffer,
sizeof(p->p_addr->u_pcb.pcb_fp_control));
retval = 1;
break;
- case OSF_GET_PROC_TYPE: {
- int unit;
- long percpu;
- long proctype;
+ case OSF_GET_CPU_INFO:
+ if (uap->nbytes < sizeof(cpuinfo))
+ error = EINVAL;
+ else {
+ bzero(&cpuinfo, sizeof(cpuinfo));
+ unit = alpha_pal_whami();
+ cpuinfo.current_cpu = unit;
+ cpuinfo.cpus_in_box = ncpus;
+ cpuinfo.cpu_type =
+ LOCATE_PCS(hwrpb, unit)->pcs_proc_type;
+ cpuinfo.ncpus = ncpus;
+ cpuinfo.cpus_present = ncpus;
+ cpuinfo.cpus_running = ncpus;
+ cpuinfo.cpu_binding = 1;
+ cpuinfo.cpu_ex_binding = 0;
+ cpuinfo.mhz = hwrpb->rpb_cc_freq / 1000000;
+ error = copyout(&cpuinfo, uap->buffer,
+ sizeof(cpuinfo));
+ retval = 1;
+ }
+ break;
+ case OSF_GET_PROC_TYPE:
if(uap->nbytes < sizeof(proctype))
error = EINVAL;
else {
@@ -296,7 +334,6 @@ osf1_getsysinfo(p, uap)
sizeof(percpu));
retval = 1;
}
- }
break;
case OSF_GET_HWRPB: { /* note -- osf/1 doesn't have rpb_tbhint[8] */
unsigned long rpb_size;
@@ -313,6 +350,11 @@ osf1_getsysinfo(p, uap)
}
}
break;
+ case OSF_GET_PLATFORM_NAME:
+ error = copyout(platform.model, uap->buffer,
+ strlen(platform.model));
+ retval = 1;
+ break;
default:
printf("osf1_getsysinfo called with unknown op=%ld\n", uap->op);
return EINVAL;