9815 Want basic AHCI enclosure services
[unleashed.git] / usr / src / uts / i86pc / ml / comm_page.s
blob49d39397bf66d82c10934d216c8ed73e5ab7e34f
2 /*
3 * This file and its contents are supplied under the terms of the
4 * Common Development and Distribution License ("CDDL"), version 1.0.
5 * You may only use this file in accordance with the terms of version
6 * 1.0 of the CDDL.
8 * A full copy of the text of the CDDL should have accompanied this
9 * source. A copy of the CDDL is also available via the Internet at
10 * http://www.illumos.org/license/CDDL.
14 * Copyright 2016 Joyent, Inc.
17 #include <sys/asm_linkage.h>
18 #include <sys/asm_misc.h>
19 #include <sys/param.h>
20 #include <sys/comm_page.h>
21 #include <sys/tsc.h>
23 #if defined(_GENCTF) || defined(__lint)
25 hrtime_t tsc_last;
26 hrtime_t tsc_resume_cap;
27 hrtime_t tsc_hrtime_base;
28 uint32_t tsc_max_delta;
29 volatile uint32_t hres_lock;
30 uint32_t tsc_type;
31 uint32_t nsec_scale;
32 int64_t hrestime_adj;
33 hrtime_t hres_last_tick;
34 uint32_t tsc_ncpu;
35 volatile timestruc_t hrestime;
36 hrtime_t tsc_sync_tick_delta[NCPU];
38 comm_page_t comm_page;
40 #else /* defined(_GENCTF) || defined(__lint) */
42 #include "assym.h"
45 * x86 Comm Page
47 * This is the definition for the comm page on x86. The purpose of this struct
48 * is to consolidate certain pieces of kernel state into one contiguous section
49 * of memory in order for it to be exposed (read-only) to userspace. The
50 * struct contents are defined by hand so that member variables will maintain
51 * their original symbols for use throughout the rest of the kernel. This
52 * layout must exactly match the C definition of comm_page_t.
53 * See: "uts/i86pc/sys/comm_page.h"
56 .data
57 DGDEF3(comm_page, COMM_PAGE_S_SIZE, 4096)
58 DGDEF2(tsc_last, 8)
59 .fill 1, 8, 0
60 DGDEF2(tsc_hrtime_base, 8)
61 .fill 1, 8, 0
62 DGDEF2(tsc_resume_cap, 8)
63 .fill 1, 8, 0
64 DGDEF2(tsc_type, 4);
65 .fill 1, 4, _CONST(TSC_RDTSC_CPUID)
66 DGDEF2(tsc_max_delta, 4);
67 .fill 1, 4, 0
68 DGDEF2(hres_lock, 4);
69 .fill 1, 4, 0
70 DGDEF2(nsec_scale, 4);
71 .fill 1, 4, 0
72 DGDEF2(hrestime_adj, 8)
73 .fill 1, 8, 0
74 DGDEF2(hres_last_tick, 8)
75 .fill 1, 8, 0
76 DGDEF2(tsc_ncpu, 4)
77 .fill 1, 4, 0
78 /* _cp_pad */
79 .fill 1, 4, 0
80 DGDEF2(hrestime, _MUL(2, 8))
81 .fill 2, 8, 0
82 DGDEF2(tsc_sync_tick_delta, _MUL(NCPU, 8))
83 .fill _CONST(NCPU), 8, 0
85 /* pad out the rest of the page from the struct end */
86 .fill _CONST(COMM_PAGE_SIZE - COMM_PAGE_S_SIZE), 1, 0
88 #endif /* defined(_GENCTF) || defined(__lint) */