teach the osf1_getsysinfo() function about a few more fields

submitted by: Jim.Pirzyk@disney.com
PR: alpha/22263
This commit is contained in:
Andrew Gallatin 2000-10-25 00:14:11 +00:00
parent 7ff9f88355
commit 785640153d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=67538
2 changed files with 70 additions and 8 deletions

View File

@ -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

View File

@ -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;