1 /* $NetBSD: platid.h,v 1.3 2005/12/11 12:17:25 christos Exp $ */
4 * Copyright (c) 1999-2001
5 * Shin Takemura and PocketBSD Project. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by the PocketBSD project
18 * and its contributors.
19 * 4. Neither the name of the project nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 #ifndef _HPC_PLATID_H_
38 #define _HPC_PLATID_H_
40 #include <sys/cdefs.h>
42 #define PLATID_FLAGS_BITS 8
43 #define PLATID_CPU_SUBMODEL_BITS 6
44 #define PLATID_CPU_MODEL_BITS 6
45 #define PLATID_CPU_SERIES_BITS 6
46 #define PLATID_CPU_ARCH_BITS 6
48 #define PLATID_SUBMODEL_BITS 8
49 #define PLATID_MODEL_BITS 8
50 #define PLATID_SERIES_BITS 6
51 #define PLATID_VENDOR_BITS 10
55 unsigned long dw0
, dw1
;
57 #if BYTE_ORDER == LITTLE_ENDIAN
59 unsigned int flags
:PLATID_FLAGS_BITS
;
60 unsigned int cpu_submodel
:PLATID_CPU_SUBMODEL_BITS
;
61 unsigned int cpu_model
:PLATID_CPU_MODEL_BITS
;
62 unsigned int cpu_series
:PLATID_CPU_SERIES_BITS
;
63 unsigned int cpu_arch
:PLATID_CPU_ARCH_BITS
;
65 unsigned int submodel
:PLATID_SUBMODEL_BITS
;
66 unsigned int model
:PLATID_MODEL_BITS
;
67 unsigned int series
:PLATID_SERIES_BITS
;
68 unsigned int vendor
:PLATID_VENDOR_BITS
;
71 #error BYTE_ORDER != LITTLE_ENDIAN
75 typedef platid_t platid_mask_t
;
78 typedef unsigned short tchar
;
97 #define PLATID_FLAGS_SHIFT 0
98 #define PLATID_CPU_SUBMODEL_SHIFT 8
99 #define PLATID_CPU_MODEL_SHIFT 14
100 #define PLATID_CPU_SERIES_SHIFT 20
101 #define PLATID_CPU_ARCH_SHIFT 26
103 #define PLATID_SUBMODEL_SHIFT 0
104 #define PLATID_MODEL_SHIFT 8
105 #define PLATID_SERIES_SHIFT 16
106 #define PLATID_VENDOR_SHIFT 22
108 #define PLATID_FLAGS_MASK \
109 (((1 << PLATID_FLAGS_BITS) - 1) << PLATID_FLAGS_SHIFT)
110 #define PLATID_CPU_SUBMODEL_MASK \
111 (((1 << PLATID_CPU_SUBMODEL_BITS) - 1) << PLATID_CPU_SUBMODEL_SHIFT)
112 #define PLATID_CPU_MODEL_MASK \
113 (((1 << PLATID_CPU_MODEL_BITS) - 1) << PLATID_CPU_MODEL_SHIFT)
114 #define PLATID_CPU_SERIES_MASK \
115 (((1 << PLATID_CPU_SERIES_BITS) - 1) << PLATID_CPU_SERIES_SHIFT)
116 #define PLATID_CPU_ARCH_MASK \
117 (((1 << PLATID_CPU_ARCH_BITS) - 1) << PLATID_CPU_ARCH_SHIFT)
119 #define PLATID_SUBMODEL_MASK \
120 (((1 << PLATID_SUBMODEL_BITS) - 1) << PLATID_SUBMODEL_SHIFT)
121 #define PLATID_MODEL_MASK \
122 (((1 << PLATID_MODEL_BITS) - 1) << PLATID_MODEL_SHIFT)
123 #define PLATID_SERIES_MASK \
124 (((1 << PLATID_SERIES_BITS) - 1) << PLATID_SERIES_SHIFT)
125 #define PLATID_VENDOR_MASK \
126 (((1 << PLATID_VENDOR_BITS) - 1) << PLATID_VENDOR_SHIFT)
128 #define PLATID_UNKNOWN 0
129 #define PLATID_WILD PLATID_UNKNOWN
130 #define PLATID_DEREFP(pp) ((platid_t *)(pp))
131 #define PLATID_DEREF(pp) (*PLATID_DEREFP(pp))
134 extern platid_t platid_unknown
;
135 extern platid_t platid_wild
;
136 extern platid_t platid
;
137 extern struct platid_name platid_name_table
[];
138 extern int platid_name_table_size
;
140 void platid_ntoh(platid_t
*);
141 void platid_hton(platid_t
*);
142 int platid_match(platid_t
*, platid_mask_t
*);
143 int platid_match_sub(platid_t
*, platid_mask_t
*, int);
144 const tchar
*platid_name(platid_t
*);
145 struct platid_data
*platid_search_data(platid_t
*, struct platid_data
*);
146 void *platid_search(platid_t
*, void *, int, int);
149 void platid_dump(const char *, void *);
153 #if defined(_KERNEL_OPT)
154 #include "opt_spec_platform.h"
156 #include <machine/platid_generated.h>
158 #endif /* _HPC_PLATID_H_ */