aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2014-06-20 13:13:38 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2014-06-20 13:13:38 +0000
commitcef789cd618d93bc428d17df34ff87f93a9db46e (patch)
treea96da53e534b64bb12c3124eaf81076623891ae1 /sys
parent8c0ddf28da360b43617f9a7130198b61c15b8173 (diff)
downloadsrc-cef789cd618d93bc428d17df34ff87f93a9db46e.tar.gz
src-cef789cd618d93bc428d17df34ff87f93a9db46e.zip
Restore the ABI of the cpuctl(4) ioctl request CPUCTL_CPUID, use
separate argument structure with added level_type field for CPUID_CPUID_COUNT request. Reviewed by: attilio (previous version) Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=267673
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/cpuctl/cpuctl.c18
-rw-r--r--sys/sys/cpuctl.h9
2 files changed, 19 insertions, 8 deletions
diff --git a/sys/dev/cpuctl/cpuctl.c b/sys/dev/cpuctl/cpuctl.c
index 63187bdc4b8b..9832933d0c91 100644
--- a/sys/dev/cpuctl/cpuctl.c
+++ b/sys/dev/cpuctl/cpuctl.c
@@ -69,7 +69,7 @@ static int cpuctl_do_msr(int cpu, cpuctl_msr_args_t *data, u_long cmd,
struct thread *td);
static int cpuctl_do_cpuid(int cpu, cpuctl_cpuid_args_t *data,
struct thread *td);
-static int cpuctl_do_cpuid_count(int cpu, cpuctl_cpuid_args_t *data,
+static int cpuctl_do_cpuid_count(int cpu, cpuctl_cpuid_count_args_t *data,
struct thread *td);
static int cpuctl_do_update(int cpu, cpuctl_update_args_t *data,
struct thread *td);
@@ -180,8 +180,8 @@ cpuctl_ioctl(struct cdev *dev, u_long cmd, caddr_t data,
ret = cpuctl_do_update(cpu, (cpuctl_update_args_t *)data, td);
break;
case CPUCTL_CPUID_COUNT:
- ret = cpuctl_do_cpuid_count(cpu, (cpuctl_cpuid_args_t *)data,
- td);
+ ret = cpuctl_do_cpuid_count(cpu,
+ (cpuctl_cpuid_count_args_t *)data, td);
break;
default:
ret = EINVAL;
@@ -195,7 +195,8 @@ fail:
* Actually perform cpuid operation.
*/
static int
-cpuctl_do_cpuid_count(int cpu, cpuctl_cpuid_args_t *data, struct thread *td)
+cpuctl_do_cpuid_count(int cpu, cpuctl_cpuid_count_args_t *data,
+ struct thread *td)
{
int is_bound = 0;
int oldcpu;
@@ -218,10 +219,15 @@ cpuctl_do_cpuid_count(int cpu, cpuctl_cpuid_args_t *data, struct thread *td)
static int
cpuctl_do_cpuid(int cpu, cpuctl_cpuid_args_t *data, struct thread *td)
{
+ cpuctl_cpuid_count_args_t cdata;
+ int error;
+ cdata.level = data->level;
/* Override the level type. */
- data->level_type = 0;
- return (cpuctl_do_cpuid_count(cpu, data, td));
+ cdata.level_type = 0;
+ error = cpuctl_do_cpuid_count(cpu, &cdata, td);
+ bcopy(cdata.data, data->data, sizeof(data->data)); /* Ignore error */
+ return (error);
}
/*
diff --git a/sys/sys/cpuctl.h b/sys/sys/cpuctl.h
index 4220dee33186..30af52405c66 100644
--- a/sys/sys/cpuctl.h
+++ b/sys/sys/cpuctl.h
@@ -36,11 +36,16 @@ typedef struct {
typedef struct {
int level; /* CPUID level */
- int level_type; /* CPUID level type */
uint32_t data[4];
} cpuctl_cpuid_args_t;
typedef struct {
+ int level; /* CPUID level */
+ int level_type; /* CPUID level type */
+ uint32_t data[4];
+} cpuctl_cpuid_count_args_t;
+
+typedef struct {
void *data;
size_t size;
} cpuctl_update_args_t;
@@ -51,6 +56,6 @@ typedef struct {
#define CPUCTL_UPDATE _IOWR('c', 4, cpuctl_update_args_t)
#define CPUCTL_MSRSBIT _IOWR('c', 5, cpuctl_msr_args_t)
#define CPUCTL_MSRCBIT _IOWR('c', 6, cpuctl_msr_args_t)
-#define CPUCTL_CPUID_COUNT _IOWR('c', 7, cpuctl_cpuid_args_t)
+#define CPUCTL_CPUID_COUNT _IOWR('c', 7, cpuctl_cpuid_count_args_t)
#endif /* _CPUCTL_H_ */