Project

General

Profile

Statistics
| Revision:

root / lab4 / .minix-src / include / sys / cpuio.h @ 13

History | View | Annotate | Download (3.32 KB)

1 13 up20180614
/*        $NetBSD: cpuio.h,v 1.9 2013/01/05 16:36:38 dsl Exp $        */
2
3
/*-
4
 * Copyright (c) 2007, 2009, 2012 The NetBSD Foundation, Inc.
5
 * All rights reserved.
6
 *
7
 * This code is derived from software contributed to The NetBSD Foundation
8
 * by Andrew Doran.
9
 *
10
 * Redistribution and use in source and binary forms, with or without
11
 * modification, are permitted provided that the following conditions
12
 * are met:
13
 * 1. Redistributions of source code must retain the above copyright
14
 *    notice, this list of conditions and the following disclaimer.
15
 * 2. Redistributions in binary form must reproduce the above copyright
16
 *    notice, this list of conditions and the following disclaimer in the
17
 *    documentation and/or other materials provided with the distribution.
18
 *
19
 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
 * POSSIBILITY OF SUCH DAMAGE.
30
 */
31
32
#if !defined(_SYS_CPUIO_H_)
33
#define        _SYS_CPUIO_H_
34
35
#include <sys/types.h>
36
#include <sys/time.h>
37
#include <sys/ioccom.h>
38
39
#ifndef _KERNEL
40
#include <limits.h>
41
#include <stdbool.h>
42
#endif
43
44
/*
45
 * This is not a great place to describe CPU properties, those
46
 * are better returned via autoconf.
47
 */
48
typedef struct cpustate {
49
        u_int                cs_id;                /* matching ci_cpuid */
50
        bool                cs_online;        /* running unbound LWPs */
51
        bool                cs_intr;        /* fielding interrupts */
52
        bool                cs_unused[2];        /* reserved */
53
        int32_t                cs_lastmod;        /* time of last state change */
54
        char                cs_name[16];        /* reserved */
55
        int32_t                cs_lastmodhi;        /* time of last state change */
56
        uint32_t        cs_intrcnt;        /* count of interrupt handlers + 1 */
57
        uint32_t        cs_hwid;        /* hardware id */
58
        uint32_t        cs_reserved;        /* reserved */
59
} cpustate_t;
60
61
#define        IOC_CPU_SETSTATE        _IOW('c', 0, cpustate_t)
62
#define        IOC_CPU_GETSTATE        _IOWR('c', 1, cpustate_t)
63
#define        IOC_CPU_GETCOUNT        _IOR('c', 2, int)
64
#define        IOC_CPU_MAPID                _IOWR('c', 3, int)
65
/* 4 and 5 reserved for compat nb6 x86 amd ucode loader */
66
67
struct cpu_ucode_version {
68
        int loader_version;        /* IN: md version number */
69
        void *data;                /* OUT: CPU ID data */
70
};
71
72
#define IOC_CPU_UCODE_GET_VERSION        _IOWR('c', 6, struct cpu_ucode_version)
73
74
#ifdef __i386__
75
/* In order to read the info from an amd64 kernel we need ... */
76
struct cpu_ucode_version_64 {
77
        int loader_version;        /* IN: md version number */
78
        int pad1;
79
        void *data;                /* OUT: CPU ID data */
80
        int must_be_zero;
81
};
82
#define IOC_CPU_UCODE_GET_VERSION_64        _IOWR('c', 6, struct cpu_ucode_version_64)
83
#endif
84
85
struct cpu_ucode {
86
        int loader_version;        /* md version number */
87
        int cpu_nr;                /* CPU index or special value below */
88
#define CPU_UCODE_ALL_CPUS (-1)
89
#define CPU_UCODE_CURRENT_CPU (-2)
90
        char fwname[PATH_MAX];
91
};
92
93
#define IOC_CPU_UCODE_APPLY                _IOW('c', 7, struct cpu_ucode)
94
95
#endif /* !_SYS_CPUIO_H_ */