diff options
| author | Dan McDonald <danmcd@mnx.io> | 2022-05-13 17:20:24 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-13 17:20:24 -0400 |
| commit | bb7d6c9b47695f41cbacbcf6662baf3d0e152fdf (patch) | |
| tree | 75f2d0cab5fb92f97f2ab2c3186a0b5d1579a33a /usr/src/uts/common/sys | |
| parent | 8ca5534c77e93c25d2c1f777499b12da0f7cc0cd (diff) | |
| parent | 402559e299331588f209b3a9693e3bcd6a83d22c (diff) | |
| download | illumos-joyent-OS-8149.tar.gz | |
Merge branch 'master' into OS-8149OS-8149
Diffstat (limited to 'usr/src/uts/common/sys')
141 files changed, 2405 insertions, 1119 deletions
diff --git a/usr/src/uts/common/sys/Makefile b/usr/src/uts/common/sys/Makefile index 3664f0096b..fed179dad1 100644 --- a/usr/src/uts/common/sys/Makefile +++ b/usr/src/uts/common/sys/Makefile @@ -96,6 +96,7 @@ CHKHDRS= \ bofi.h \ bofi_impl.h \ bpp_io.h \ + bootbanner.h \ bootstat.h \ brand.h \ buf.h \ @@ -1135,6 +1136,9 @@ NXGEHDRS= \ nxge_virtual.h \ nxge_espc.h +PLATHDRS= \ + pci_prd.h + include Makefile.syshdrs dcam/%.check: dcam/%.h @@ -1202,7 +1206,8 @@ CHECKHDRS= \ $(I1394HDRS:%.h=1394/%.check) \ $(RSMHDRS:%.h=rsm/%.check) \ $(TSOLHDRS:%.h=tsol/%.check) \ - $(NXGEHDRS:%.h=nxge/%.check) + $(NXGEHDRS:%.h=nxge/%.check) \ + $(PLATHDRS:%.h=plat/%.check) .KEEP_STATE: @@ -1242,6 +1247,7 @@ CHECKHDRS= \ $(ROOTTAVORHDRS) \ $(ROOTHERMONHDRS) \ $(ROOTMLNXHDRS) \ + $(ROOTPLATHDRS) \ $(ROOTSCSIHDRS) \ $(ROOTSCSIADHDRS) \ $(ROOTSCSICONFHDRS) \ @@ -1310,6 +1316,7 @@ install_h: \ $(ROOTTAVORHDRS) \ $(ROOTHERMONHDRS) \ $(ROOTMLNXHDRS) \ + $(ROOTPLATHDRS) \ $(ROOTSCSIHDRS) \ $(ROOTSCSIADHDRS) \ $(ROOTSCSIISCSIHDRS) \ diff --git a/usr/src/uts/common/sys/aggr_impl.h b/usr/src/uts/common/sys/aggr_impl.h index 80733aa31e..de4162bc61 100644 --- a/usr/src/uts/common/sys/aggr_impl.h +++ b/usr/src/uts/common/sys/aggr_impl.h @@ -23,6 +23,7 @@ * Use is subject to license terms. * Copyright 2012 OmniTI Computer Consulting, Inc All rights reserved. * Copyright 2018 Joyent, Inc. + * Copyright 2020 RackTop Systems, Inc. */ #ifndef _SYS_AGGR_IMPL_H @@ -161,7 +162,8 @@ typedef struct aggr_port_s { */ mac_group_handle_t lp_hwghs[MAX_GROUPS_PER_PORT]; - int lp_tx_ring_cnt; + uint_t lp_tx_ring_alloc; + uint_t lp_tx_ring_cnt; /* handles of the underlying HW TX rings */ mac_ring_handle_t *lp_tx_rings; /* @@ -195,6 +197,7 @@ typedef struct aggr_grp_s { uint16_t lg_key; /* key (group port number) */ uint32_t lg_refs; /* refcount */ uint16_t lg_nports; /* number of MAC ports */ + uint16_t lg_nports_high; /* highest no. of MAC ports */ uint8_t lg_addr[ETHERADDRL]; /* group MAC address */ uint16_t lg_closing : 1, diff --git a/usr/src/uts/common/sys/atomic.h b/usr/src/uts/common/sys/atomic.h index 774e8125f3..a2cb51c6ad 100644 --- a/usr/src/uts/common/sys/atomic.h +++ b/usr/src/uts/common/sys/atomic.h @@ -53,6 +53,7 @@ extern void atomic_inc_uint(volatile uint_t *); extern void atomic_inc_ulong(volatile ulong_t *); #if defined(_KERNEL) || defined(_INT64_TYPE) extern void atomic_inc_64(volatile uint64_t *); +#endif /* * Decrement target @@ -262,7 +263,6 @@ extern void membar_producer(void); * after the available flag has been seen, i.e. it imposes load ordering. */ extern void membar_consumer(void); -#endif #if defined(_KERNEL) @@ -272,10 +272,6 @@ extern void membar_consumer(void); #define casip atomic_cas_ulong #endif -#if defined(__sparc) -extern uint8_t ldstub(uint8_t *); -#endif - #endif /* _KERNEL */ #ifdef __cplusplus diff --git a/usr/src/uts/common/sys/autoconf.h b/usr/src/uts/common/sys/autoconf.h index ee97f8d274..5a3ad7df60 100644 --- a/usr/src/uts/common/sys/autoconf.h +++ b/usr/src/uts/common/sys/autoconf.h @@ -274,7 +274,7 @@ extern int exclude_level(int); extern major_t path_to_major(char *); extern void i_ddi_node_cache_init(void); -extern dev_info_t *i_ddi_alloc_node(dev_info_t *, char *, pnode_t, int, +extern dev_info_t *i_ddi_alloc_node(dev_info_t *, const char *, pnode_t, int, ddi_prop_t *, int); extern void i_ddi_forceattach_drivers(void); extern int i_ddi_io_initialized(void); diff --git a/usr/src/uts/common/sys/auxv_386.h b/usr/src/uts/common/sys/auxv_386.h index a1183b9c6b..3654474787 100644 --- a/usr/src/uts/common/sys/auxv_386.h +++ b/usr/src/uts/common/sys/auxv_386.h @@ -113,9 +113,11 @@ extern "C" { #define AV_386_2_MONITORX 0x01000000 /* MONITORX insns */ #define AV_386_2_CLZERO 0x02000000 /* CLZERO */ #define AV_386_2_AVX512_VNNI 0x04000000 /* AVX512_VNNI */ +#define AV_386_2_VPCLMULQDQ 0x08000000 /* VPCLMULQDQ */ +#define AV_386_2_VAES 0x10000000 /* VAES */ #define FMT_AV_386_2 \ - "\033avx512_vnni" \ + "\035vaes\034vpclmulqdq\033avx512_vnni" \ "\032clzero\031monitorx\030clwb\027clflushopt\026fsgsbase" \ "\025sha\024avx512_4fmaps\023avx512_4nniw\022avx512vpopcntdq" \ "\021avx512vbmi\020avx512vl\017avx512bw\016avx512cd" \ diff --git a/usr/src/uts/common/sys/auxv_SPARC.h b/usr/src/uts/common/sys/auxv_SPARC.h index b4adf1a16e..fd6d7c637b 100644 --- a/usr/src/uts/common/sys/auxv_SPARC.h +++ b/usr/src/uts/common/sys/auxv_SPARC.h @@ -45,6 +45,7 @@ extern "C" { #define AV_SPARC_VIS2 0x0040 /* VIS2 instruction set supported */ #define AV_SPARC_ASI_BLK_INIT 0x0080 /* ASI_BLK_INIT_xxx ASI */ #define AV_SPARC_FMAF 0x0100 /* Fused Multiply-Add */ +/* Bit 9 is not in use */ #define AV_SPARC_VIS3 0x0400 /* VIS3 instruction set extensions */ #define AV_SPARC_HPC 0x0800 /* High Performance Computing insns */ #define AV_SPARC_RANDOM 0x1000 /* random instruction */ @@ -52,11 +53,25 @@ extern "C" { #define AV_SPARC_FJFMAU 0x4000 /* Fujitsu Unfused Multiply-Add */ #define AV_SPARC_IMA 0x8000 /* Integer Multiply-add */ #define AV_SPARC_ASI_CACHE_SPARING 0x10000 +#define AV_SPARC_PAUSE 0x20000 /* pause instruction */ +#define AV_SPARC_CBCOND 0x40000 /* compare and branch instructions */ +#define AV_SPARC_AES 0x80000 /* AES instructions */ +#define AV_SPARC_DES 0x100000 /* DES instructions */ +#define AV_SPARC_KASUMI 0x200000 /* Kasumi instructions */ +#define AV_SPARC_CAMELLIA 0x400000 /* Camellia instructions */ +#define AV_SPARC_MD5 0x800000 /* MD5 instructions */ +#define AV_SPARC_SHA1 0x1000000 /* SHA1 instructions */ +#define AV_SPARC_SHA256 0x2000000 /* SHA256 instructions */ +#define AV_SPARC_SHA512 0x4000000 /* SHA512 instructions */ +#define AV_SPARC_MPMUL 0x8000000 /* multiple precision multiply */ +#define AV_SPARC_MONT 0x10000000 /* Montgomery mult/sqr instructions */ +#define AV_SPARC_CRC32C 0x20000000 /* CRC32C instructions */ #define FMT_AV_SPARC \ "\20" \ - "\21cspare" \ - "\20ima\17fjfmau\16trans\15random\14hpc\13vis3\12-\11fmaf" \ + "\36crc32c\35mont\34mpmul\33sha512\32sha256\31sha1" \ + "\30md5\27camellia\26kasumi\25des\24aes\23cbcond\22pause\21cspare" \ + "\20ima\17fjfmau\16trans\15random\14hpc\13vis3\12-\11fmaf" \ "\10ASIBlkInit\7vis2\6vis\5popc\4v8plus\3fsmuld\2div32\1mul32" /* diff --git a/usr/src/uts/common/sys/bitmap.h b/usr/src/uts/common/sys/bitmap.h index 5e6385811f..4282dca097 100644 --- a/usr/src/uts/common/sys/bitmap.h +++ b/usr/src/uts/common/sys/bitmap.h @@ -28,6 +28,7 @@ * Copyright (c) 2014 by Delphix. All rights reserved. * Copyright 2015 Nexenta Systems, Inc. All rights reserved. * Copyright 2017 RackTop Systems. + * Copyright 2022 Oxide Computer Company */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ @@ -142,14 +143,13 @@ extern "C" { /* * return next available bit index from map with specified number of bits */ -extern index_t bt_availbit(ulong_t *bitmap, size_t nbits); +extern index_t bt_availbit(const ulong_t *, size_t); /* * find the highest order bit that is on, and is within or below * the word specified by wx */ -extern int bt_gethighbit(ulong_t *mapp, int wx); -extern int bt_range(ulong_t *bitmap, size_t *pos1, size_t *pos2, - size_t end_pos); +extern int bt_gethighbit(const ulong_t *, int wx); +extern int bt_range(const ulong_t *, size_t *, size_t *, size_t); /* * Find highest and lowest one bit set. * Returns bit number + 1 of bit that is set, otherwise returns 0. @@ -158,8 +158,8 @@ extern int bt_range(ulong_t *bitmap, size_t *pos1, size_t *pos2, extern int highbit(ulong_t); extern int highbit64(uint64_t); extern int lowbit(ulong_t); -extern int bt_getlowbit(ulong_t *bitmap, size_t start, size_t stop); -extern void bt_copy(ulong_t *, ulong_t *, ulong_t); +extern int bt_getlowbit(const ulong_t *, size_t, size_t); +extern void bt_copy(const ulong_t *, ulong_t *, ulong_t); /* * find the parity diff --git a/usr/src/uts/common/sys/blkdev.h b/usr/src/uts/common/sys/blkdev.h index 7802f06dbc..6407f7b960 100644 --- a/usr/src/uts/common/sys/blkdev.h +++ b/usr/src/uts/common/sys/blkdev.h @@ -23,6 +23,7 @@ * Copyright 2016 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2019 Western Digital Corporation. + * Copyright 2020 Joyent, Inc. */ #ifndef _SYS_BLKDEV_H @@ -79,8 +80,10 @@ typedef struct bd_handle *bd_handle_t; typedef struct bd_xfer bd_xfer_t; typedef struct bd_drive bd_drive_t; typedef struct bd_media bd_media_t; +typedef struct bd_free_info bd_free_info_t; typedef struct bd_ops bd_ops_t; +struct dkioc_free_list_s; struct bd_xfer { /* @@ -95,6 +98,7 @@ struct bd_xfer { caddr_t x_kaddr; unsigned x_flags; unsigned x_qnum; + const struct dkioc_free_list_s *x_dfl; }; #define BD_XFER_POLL (1U << 0) /* no interrupts (dump) */ @@ -119,6 +123,33 @@ struct bd_drive { uint8_t d_eui64[8]; /* Added at the end to maintain binary compatibility */ uint32_t d_qcount; + + /* + * Required starting alignment for free_space requests (in logical + * blocks). Must be >= 1. + */ + uint64_t d_free_align; + + /* + * Maximum number of segments supported in a free space request. + * 0 implies no limit. + */ + uint64_t d_max_free_seg; + + /* + * Maximum number of logical blocks allowed in a free space request. + * 0 implies no limit. + */ + uint64_t d_max_free_blks; + + /* + * Maximum number of logical blocks to free in a single segment. + * 0 implies no limit. If no limit, d_max_free_blks must also be 0. + * If > 0, d_max_free_seg_blks must be <= d_max_free_blks (basically + * you can't set a bigger value of d_max_free_seg_blks than + * d_max_free_blks). + */ + uint64_t d_max_free_seg_blks; }; struct bd_media { @@ -147,14 +178,15 @@ struct bd_media { #define BD_INFO_FLAG_READ_ONLY (1U << 2) /* - * If the API changes and we want to bump the version, add another - * enum value, Eg BD_OPS_VERSION_1. BD_OPS_CURRENT_VERSION should always - * be last. + * When adding a new version of the bd_ops_t struct, be sure to update + * BD_OPS_CURRENT_VERSION */ typedef enum { BD_OPS_VERSION_0 = 0, - BD_OPS_CURRENT_VERSION + BD_OPS_VERSION_1 = 1, + BD_OPS_VERSION_2 = 2, } bd_version_t; +#define BD_OPS_CURRENT_VERSION BD_OPS_VERSION_2 struct bd_ops { bd_version_t o_version; @@ -164,6 +196,7 @@ struct bd_ops { int (*o_sync_cache)(void *, bd_xfer_t *); int (*o_read)(void *, bd_xfer_t *); int (*o_write)(void *, bd_xfer_t *); + int (*o_free_space)(void *, bd_xfer_t *); }; struct bd_errstats { diff --git a/usr/src/uts/common/sys/bootbanner.h b/usr/src/uts/common/sys/bootbanner.h new file mode 100644 index 0000000000..93ba1b9e79 --- /dev/null +++ b/usr/src/uts/common/sys/bootbanner.h @@ -0,0 +1,33 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2020 Oxide Computer Company + */ + +#ifndef _SYS_BOOTBANNER_H +#define _SYS_BOOTBANNER_H + +/* + * Rendering of the boot banner, used on the system and zone consoles. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern void bootbanner_print(void (*)(const char *, uint_t), int kmflag); + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_BOOTBANNER_H */ diff --git a/usr/src/uts/common/sys/ccompile.h b/usr/src/uts/common/sys/ccompile.h index de0031d6b0..94f7c9707b 100644 --- a/usr/src/uts/common/sys/ccompile.h +++ b/usr/src/uts/common/sys/ccompile.h @@ -158,8 +158,19 @@ extern "C" { #define __packed __attribute__((__packed__)) #define __section(x) __attribute__((__section__(x))) #define __unused __sun_attr__((__unused__)) +#ifdef DEBUG +/* We want to discover unused variables in DEBUG build. */ +#define __maybe_unused +#else +/* + * In release build, disable warnings about variables + * which are used only for debugging. + */ +#define __maybe_unused __sun_attr__((__unused__)) +#endif #define __used __attribute__((__used__)) #define __weak_symbol __attribute__((__weak__)) +#define __HIDDEN __attribute__((visibility("hidden"))) #ifdef __cplusplus } diff --git a/usr/src/uts/common/sys/class.h b/usr/src/uts/common/sys/class.h index a132d38419..c795f85eca 100644 --- a/usr/src/uts/common/sys/class.h +++ b/usr/src/uts/common/sys/class.h @@ -130,7 +130,7 @@ extern int loaded_classes; /* number of classes loaded */ extern pri_t minclsyspri; extern id_t syscid; /* system scheduling class ID */ extern id_t sysdccid; /* system duty-cycle scheduling class ID */ -extern id_t defaultcid; /* "default" class id; see dispadmin(1M) */ +extern id_t defaultcid; /* "default" class id; see dispadmin(8) */ extern int alloc_cid(char *, id_t *); extern int scheduler_load(char *, sclass_t *); diff --git a/usr/src/uts/common/sys/console.h b/usr/src/uts/common/sys/console.h index 9f60764092..892f7e5b34 100644 --- a/usr/src/uts/common/sys/console.h +++ b/usr/src/uts/common/sys/console.h @@ -37,6 +37,7 @@ extern "C" { #define _CNIOC (('C'<<24)|('N'<<16)) #define _CNIOC_MASK (~0xffff) #define CONS_GETTERM (_CNIOC | 0) +#define CONS_GETDEV (_CNIOC | 1) #define MAX_TERM_TYPE_LEN 10 @@ -45,6 +46,10 @@ struct cons_getterm { char *cn_term_type; }; +struct cons_getdev { + dev_t cnd_rconsdev; +}; + #ifdef _KERNEL #include <sys/vnode.h> @@ -56,6 +61,10 @@ struct cons_getterm32 { uint32_t cn_term_len; caddr32_t cn_term_type; }; + +struct cons_getdev32 { + dev32_t cnd_rconsdev; +}; #endif /* _SYSCALL32 */ extern void console_get_size(ushort_t *r, ushort_t *c, diff --git a/usr/src/uts/common/sys/contract/process_impl.h b/usr/src/uts/common/sys/contract/process_impl.h index db0b5e321a..a0843b2d44 100644 --- a/usr/src/uts/common/sys/contract/process_impl.h +++ b/usr/src/uts/common/sys/contract/process_impl.h @@ -26,8 +26,6 @@ #ifndef _SYS_CONTRACT_PROCESS_IMPL_H #define _SYS_CONTRACT_PROCESS_IMPL_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/contract.h> #include <sys/contract_impl.h> #include <sys/contract/process.h> @@ -72,8 +70,8 @@ struct cont_process { /* * Kernel APIs */ -ctmpl_process_t *sys_process_tmpl; -ct_type_t *process_type; +extern ctmpl_process_t *sys_process_tmpl; +extern ct_type_t *process_type; struct proc; void contract_process_init(void); diff --git a/usr/src/uts/common/sys/corectl.h b/usr/src/uts/common/sys/corectl.h index 8ebc78e9e9..058d583dbc 100644 --- a/usr/src/uts/common/sys/corectl.h +++ b/usr/src/uts/common/sys/corectl.h @@ -87,8 +87,9 @@ extern "C" { #define CC_CONTENT_CTF 0x0800ULL /* CTF data */ #define CC_CONTENT_SYMTAB 0x1000ULL /* symbol table */ +#define CC_CONTENT_DEBUG 0x2000ULL /* debug information */ -#define CC_CONTENT_ALL 0x1fffULL +#define CC_CONTENT_ALL 0x3fffULL #define CC_CONTENT_NONE 0ULL #define CC_CONTENT_DEFAULT (CC_CONTENT_STACK | CC_CONTENT_HEAP | \ CC_CONTENT_ISM | CC_CONTENT_DISM | CC_CONTENT_SHM | \ diff --git a/usr/src/uts/common/sys/cpuvar.h b/usr/src/uts/common/sys/cpuvar.h index 21bdfbd160..24adbb7418 100644 --- a/usr/src/uts/common/sys/cpuvar.h +++ b/usr/src/uts/common/sys/cpuvar.h @@ -23,9 +23,9 @@ * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. * Copyright 2014 Igor Kozhukhov <ikozhukhov@gmail.com>. - * Copyright 2019 Joyent, Inc. * Copyright 2017 RackTop Systems. * Copyright 2019 Joyent, Inc. + * Copyright 2021 Oxide Computer Company */ #ifndef _SYS_CPUVAR_H @@ -438,9 +438,9 @@ extern void cpuset_atomic_del(cpuset_t *, const uint_t); extern void cpuset_atomic_add(cpuset_t *, const uint_t); extern long cpuset_atomic_xadd(cpuset_t *, const uint_t); extern long cpuset_atomic_xdel(cpuset_t *, const uint_t); -extern void cpuset_or(cpuset_t *, cpuset_t *); -extern void cpuset_xor(cpuset_t *, cpuset_t *); -extern void cpuset_and(cpuset_t *, cpuset_t *); +extern void cpuset_or(cpuset_t *, const cpuset_t *); +extern void cpuset_xor(cpuset_t *, const cpuset_t *); +extern void cpuset_and(cpuset_t *, const cpuset_t *); extern void cpuset_zero(cpuset_t *); diff --git a/usr/src/uts/common/sys/crypto/api.h b/usr/src/uts/common/sys/crypto/api.h index e2df619bdc..4f27bbafb8 100644 --- a/usr/src/uts/common/sys/crypto/api.h +++ b/usr/src/uts/common/sys/crypto/api.h @@ -56,7 +56,7 @@ typedef struct { */ #define CRYPTO_MECH_INVALID ((uint64_t)-1) -extern crypto_mech_type_t crypto_mech2id(crypto_mech_name_t name); +extern crypto_mech_type_t crypto_mech2id(const char *name); /* * Create and destroy context templates. diff --git a/usr/src/uts/common/sys/csiioctl.h b/usr/src/uts/common/sys/csiioctl.h index 78a1303798..6a6debfadb 100644 --- a/usr/src/uts/common/sys/csiioctl.h +++ b/usr/src/uts/common/sys/csiioctl.h @@ -27,8 +27,6 @@ #ifndef _SYS_CSIIOCTL_H #define _SYS_CSIIOCTL_H -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef __cplusplus extern "C" { #endif @@ -37,14 +35,14 @@ extern "C" { * csiioctl.h * * CodeSet Independent codeset width communication between stty(1) and - * ldterm(7M). + * ldterm(4M). * * CSDATA_SET This call takes a pointer to a ldterm_cs_data_t data * structure, and uses it to set the line discipline definition * and also for a possible switch of the internal methods and * data for the current locale's codeset. * - * When this message is reached, the ldterm(7M) will check + * When this message is reached, the ldterm(4M) will check * the validity of the message and if the message contains * a valid data, it will accumulate the data and switch * the internal methods if necessary to support the requested @@ -52,7 +50,7 @@ extern "C" { * * CSDATA_GET This call takes a pointer to a ldterm_cs_data_t structure * and returns in it the codeset data info currently in use by - * the ldterm(7M) module. + * the ldterm(4M) module. */ #define CSI_IOC (('C' | 128) << 8) diff --git a/usr/src/uts/common/sys/dacf_impl.h b/usr/src/uts/common/sys/dacf_impl.h index 0d30ae061c..094e764c87 100644 --- a/usr/src/uts/common/sys/dacf_impl.h +++ b/usr/src/uts/common/sys/dacf_impl.h @@ -121,7 +121,7 @@ void dacf_rsrv_make(dacf_rsrvlist_t *, dacf_rule_t *, void *, void dacf_process_rsrvs(dacf_rsrvlist_t **, dacf_opid_t, int); void dacf_clr_rsrvs(dev_info_t *, dacf_opid_t); -dacf_rule_t *dacf_match(dacf_opid_t, dacf_devspec_t, void *); +dacf_rule_t *dacf_match(dacf_opid_t, dacf_devspec_t, const void *); /* * Failure codes from dacf_op_invoke, assigned to dacf_rsrvlist_t.rsrv_result @@ -147,7 +147,7 @@ extern int dacfdebug; * that utilize the dacf framework */ -void dacfc_match_create_minor(char *, char *, dev_info_t *, +void dacfc_match_create_minor(const char *, const char *, dev_info_t *, struct ddi_minor_data *, int); int dacfc_postattach(dev_info_t *); diff --git a/usr/src/uts/common/sys/ddi_impldefs.h b/usr/src/uts/common/sys/ddi_impldefs.h index 1012c904fd..bf3e29397f 100644 --- a/usr/src/uts/common/sys/ddi_impldefs.h +++ b/usr/src/uts/common/sys/ddi_impldefs.h @@ -289,6 +289,12 @@ struct dev_info { /* detach event data */ char *devi_ev_path; int devi_ev_instance; + + /* + * Unbind callback data. + */ + kmutex_t devi_unbind_lock; + list_t devi_unbind_cbs; }; #define DEVI(dev_info_type) ((struct dev_info *)(dev_info_type)) @@ -623,7 +629,7 @@ struct dev_info { #define DEVI_SET_PCI(dip) (DEVI(dip)->devi_flags |= (DEVI_PCI_DEVICE)) char *i_ddi_devi_class(dev_info_t *); -int i_ddi_set_devi_class(dev_info_t *, char *, int); +int i_ddi_set_devi_class(dev_info_t *, const char *, int); /* * This structure represents one piece of bus space occupied by a given @@ -709,7 +715,7 @@ struct ddi_minor { dev_t dev; /* device number */ int spec_type; /* block or char */ int flags; /* access flags */ - char *node_type; /* block, byte, serial, network */ + const char *node_type; /* block, byte, serial, network */ struct devplcy *node_priv; /* privilege for this minor */ mode_t priv_mode; /* default apparent privilege mode */ }; diff --git a/usr/src/uts/common/sys/ddi_implfuncs.h b/usr/src/uts/common/sys/ddi_implfuncs.h index e7d218844b..c5e84e576a 100644 --- a/usr/src/uts/common/sys/ddi_implfuncs.h +++ b/usr/src/uts/common/sys/ddi_implfuncs.h @@ -25,6 +25,7 @@ */ /* * Copyright 2012 Garrett D'Amore <garrett@damore.org>. All rights reserved. + * Copyright 2020 Joshua M. Clulow <josh@sysmgr.org> */ #ifndef _SYS_DDI_IMPLFUNCS_H @@ -163,7 +164,7 @@ extern int peekpoke_mem(ddi_ctl_enum_t, peekpoke_ctlops_t *); /* * Helper functions */ -extern char *i_ddi_strdup(char *, uint_t); +extern char *i_ddi_strdup(const char *, uint_t); extern void i_ddi_prop_list_delete(ddi_prop_t *); extern ddi_prop_t *i_ddi_prop_list_dup(ddi_prop_t *, uint_t); extern int i_ddi_load_drvconf(major_t); @@ -237,6 +238,16 @@ extern void i_ddi_decr_locked_memory(proc_t *, rctl_qty_t); */ extern void translate_devid(dev_info_t *dip); +/* + * Support routine for file systems that need to scan block devices searching + * for a label as part of mounting the root file system. + */ +extern void preroot_walk_block_devices(int (*)(const char *, void *), void *); + +#define PREROOT_WALK_BLOCK_DEVICES_NEXT 1 +#define PREROOT_WALK_BLOCK_DEVICES_CANCEL 2 + + #endif /* _KERNEL */ #ifdef __cplusplus diff --git a/usr/src/uts/common/sys/ddi_obsolete.h b/usr/src/uts/common/sys/ddi_obsolete.h index c1d63bfc48..39ee6db8c4 100644 --- a/usr/src/uts/common/sys/ddi_obsolete.h +++ b/usr/src/uts/common/sys/ddi_obsolete.h @@ -74,87 +74,6 @@ void ddi_io_rep_put16(ddi_acc_handle_t handle, void ddi_io_rep_put32(ddi_acc_handle_t handle, uint32_t *host_addr, uint32_t *dev_addr, size_t repcount); -/* only support older interfaces on 32-bit systems */ -#ifdef _ILP32 -#define ddi_mem_getb ddi_mem_get8 -#define ddi_mem_getw ddi_mem_get16 -#define ddi_mem_getl ddi_mem_get32 -#define ddi_mem_getll ddi_mem_get64 -#define ddi_mem_rep_getb ddi_mem_rep_get8 -#define ddi_mem_rep_getw ddi_mem_rep_get16 -#define ddi_mem_rep_getl ddi_mem_rep_get32 -#define ddi_mem_rep_getll ddi_mem_rep_get64 -#define ddi_mem_putb ddi_mem_put8 -#define ddi_mem_putw ddi_mem_put16 -#define ddi_mem_putl ddi_mem_put32 -#define ddi_mem_putll ddi_mem_put64 -#define ddi_mem_rep_putb ddi_mem_rep_put8 -#define ddi_mem_rep_putw ddi_mem_rep_put16 -#define ddi_mem_rep_putl ddi_mem_rep_put32 -#define ddi_mem_rep_putll ddi_mem_rep_put64 -#define ddi_io_getb ddi_io_get8 -#define ddi_io_getw ddi_io_get16 -#define ddi_io_getl ddi_io_get32 -#define ddi_io_putb ddi_io_put8 -#define ddi_io_putw ddi_io_put16 -#define ddi_io_putl ddi_io_put32 -#define ddi_getb ddi_get8 -#define ddi_getw ddi_get16 -#define ddi_getl ddi_get32 -#define ddi_getll ddi_get64 -#define ddi_rep_getb ddi_rep_get8 -#define ddi_rep_getw ddi_rep_get16 -#define ddi_rep_getl ddi_rep_get32 -#define ddi_rep_getll ddi_rep_get64 -#define ddi_putb ddi_put8 -#define ddi_putw ddi_put16 -#define ddi_putl ddi_put32 -#define ddi_putll ddi_put64 -#define ddi_rep_putb ddi_rep_put8 -#define ddi_rep_putw ddi_rep_put16 -#define ddi_rep_putl ddi_rep_put32 -#define ddi_rep_putll ddi_rep_put64 - -/* These can't be define's since they're not asm routines */ -void ddi_io_rep_getb(ddi_acc_handle_t handle, uint8_t *host_addr, - uint8_t *dev_addr, size_t repcount); -void ddi_io_rep_getw(ddi_acc_handle_t handle, uint16_t *host_addr, - uint16_t *dev_addr, size_t repcount); -void ddi_io_rep_getl(ddi_acc_handle_t handle, uint32_t *host_addr, - uint32_t *dev_addr, size_t repcount); -void ddi_io_rep_putb(ddi_acc_handle_t handle, uint8_t *host_addr, - uint8_t *dev_addr, size_t repcount); -void ddi_io_rep_putw(ddi_acc_handle_t handle, uint16_t *host_addr, - uint16_t *dev_addr, size_t repcount); -void ddi_io_rep_putl(ddi_acc_handle_t handle, uint32_t *host_addr, - uint32_t *dev_addr, size_t repcount); - -int ddi_peekc(dev_info_t *dip, int8_t *addr, int8_t *val_p); -int ddi_peeks(dev_info_t *dip, int16_t *addr, int16_t *val_p); -int ddi_peekl(dev_info_t *dip, int32_t *addr, int32_t *val_p); -int ddi_peekd(dev_info_t *dip, int64_t *addr, int64_t *val_p); -int ddi_pokec(dev_info_t *dip, int8_t *addr, int8_t val); -int ddi_pokes(dev_info_t *dip, int16_t *addr, int16_t val); -int ddi_pokel(dev_info_t *dip, int32_t *addr, int32_t val); -int ddi_poked(dev_info_t *dip, int64_t *addr, int64_t val); - -uint8_t pci_config_getb(ddi_acc_handle_t handle, off_t offset); -uint16_t pci_config_getw(ddi_acc_handle_t handle, off_t offset); -uint32_t pci_config_getl(ddi_acc_handle_t handle, off_t offset); -uint64_t pci_config_getll(ddi_acc_handle_t handle, off_t offset); -void pci_config_putb(ddi_acc_handle_t handle, off_t offset, uint8_t value); -void pci_config_putw(ddi_acc_handle_t handle, off_t offset, uint16_t value); -void pci_config_putl(ddi_acc_handle_t handle, off_t offset, uint32_t value); -void pci_config_putll(ddi_acc_handle_t handle, off_t offset, uint64_t value); - -extern void repinsb(int port, uint8_t *addr, int count); -extern void repinsw(int port, uint16_t *addr, int count); -extern void repinsd(int port, uint32_t *addr, int count); -extern void repoutsb(int port, uint8_t *addr, int count); -extern void repoutsw(int port, uint16_t *addr, int count); -extern void repoutsd(int port, uint32_t *addr, int count); -#endif - /* Obsolete LDI event interfaces */ extern int ldi_get_eventcookie(ldi_handle_t, char *, ddi_eventcookie_t *); diff --git a/usr/src/uts/common/sys/ddi_ufm.h b/usr/src/uts/common/sys/ddi_ufm.h index e6ad50d9ef..9f2474f2d3 100644 --- a/usr/src/uts/common/sys/ddi_ufm.h +++ b/usr/src/uts/common/sys/ddi_ufm.h @@ -10,7 +10,8 @@ */ /* - * Copyright 2019 Joyent, Inc. + * Copyright 2020 Joyent, Inc. + * Copyright 2020 Oxide Computer Company */ #ifndef _SYS_DDI_UFM_H @@ -39,19 +40,19 @@ extern "C" { #define UFM_IOC_GETCAPS (UFM_IOC | 1) #define UFM_IOC_REPORTSZ (UFM_IOC | 2) #define UFM_IOC_REPORT (UFM_IOC | 3) +#define UFM_IOC_READIMG (UFM_IOC | 4) #define UFM_IOC_MAX UFM_IOC_REPORT /* * Bitfield enumerating the DDI UFM capabilities supported by this device * instance. Currently there is only a single capability of being able to - * report UFM information. Future UFM versions may add additional capabilities - * such as the ability to obtain a raw dump the firmware image or ability to - * upgrade the firmware. When support for new capabilties are added to the DDI - * UFM subsystem, it should be reflected in this enum and the implementation of - * the UFM_IOC_GETCAPS should be extended appropriately. + * report UFM information. When support for new capabilties are added to the + * DDI UFM subsystem, it should be reflected in this enum and the implementation + * of the UFM_IOC_GETCAPS should be extended appropriately. */ typedef enum { DDI_UFM_CAP_REPORT = 1 << 0, + DDI_UFM_CAP_READIMG = 1 << 1 } ddi_ufm_cap_t; /* @@ -111,6 +112,36 @@ typedef struct ufm_ioc_report32 { #endif /* _KERNEL */ /* + * This struct defines the input/output data for the UFM_IOC_READ ioctl, which + * reads the firmware image from a given slot. + */ +typedef struct ufm_ioc_readimg { + uint_t ufri_version; + uint_t ufri_imageno; + uint_t ufri_slotno; + uint64_t ufri_offset; + uint64_t ufri_len; + uint64_t ufri_nread; + void *ufri_buf; + char ufri_devpath[MAXPATHLEN]; +} ufm_ioc_readimg_t; + +#ifdef _KERNEL +#pragma pack(4) +typedef struct ufm_ioc_readimg32 { + uint_t ufri_version; + uint_t ufri_imageno; + uint_t ufri_slotno; + uint64_t ufri_offset; + uint64_t ufri_len; + uint64_t ufri_nread; + caddr32_t ufri_buf; + char ufri_devpath[MAXPATHLEN]; +} ufm_ioc_readimg32_t; +#pragma pack() +#endif /* _KERNEL */ + +/* * The UFM_IOC_REPORT ioctl return UFM image and slot data in the form of a * packed nvlist. The nvlist contains and array of nvlists (one-per-image). * Each image nvlist contains will contain a string nvpair containing a @@ -127,12 +158,18 @@ typedef struct ufm_ioc_report32 { #define DDI_UFM_NV_IMAGE_SLOTS "ufm-image-slots" /* - * Each slot nvlist as a string nvpair describing the firmware image version - * and an uint32 nvpair describing the slot attributes (see ddi_ufm_attr_t - * above). An option nvlist nvpar may be present containing additional - * miscellaneous slot data. + * Each slot nvlist has the following: + * + * o A string nvpair describing the firmware image version + * o A uint32 nvpair describing the slot attributes (see ddi_ufm_attr_t + * below). + * o An optional nvlist nvpar may be present containing additional + * miscellaneous slot data. + * o An optional uint64 slot length that indicates the size of the image in + * that slot. Note htis is the size of the image, not the size of the slot. */ #define DDI_UFM_NV_SLOT_VERSION "ufm-slot-version" +#define DDI_UFM_NV_SLOT_IMGSIZE "ufm-slot-imgsize" typedef enum { DDI_UFM_ATTR_READABLE = 1 << 0, @@ -166,6 +203,8 @@ typedef struct ddi_ufm_ops { int (*ddi_ufm_op_fill_slot)(ddi_ufm_handle_t *, void *, uint_t, uint_t, ddi_ufm_slot_t *); int (*ddi_ufm_op_getcaps)(ddi_ufm_handle_t *, void *, ddi_ufm_cap_t *); + int (*ddi_ufm_op_readimg)(ddi_ufm_handle_t *, void *, uint_t, uint_t, + uint64_t, uint64_t, void *, uint64_t *); } ddi_ufm_ops_t; /* @@ -215,6 +254,7 @@ void ddi_ufm_image_set_misc(ddi_ufm_image_t *, nvlist_t *); void ddi_ufm_slot_set_version(ddi_ufm_slot_t *, const char *); void ddi_ufm_slot_set_attrs(ddi_ufm_slot_t *, ddi_ufm_attr_t); void ddi_ufm_slot_set_misc(ddi_ufm_slot_t *, nvlist_t *); +void ddi_ufm_slot_set_imgsize(ddi_ufm_slot_t *, uint64_t); #endif /* _KERNEL */ #ifdef __cplusplus diff --git a/usr/src/uts/common/sys/ddi_ufm_impl.h b/usr/src/uts/common/sys/ddi_ufm_impl.h index 49fd3b9246..8570f7f11e 100644 --- a/usr/src/uts/common/sys/ddi_ufm_impl.h +++ b/usr/src/uts/common/sys/ddi_ufm_impl.h @@ -11,6 +11,7 @@ /* * Copyright 2019 Joyent, Inc. + * Copyright 2020 Oxide Computer Company */ #ifndef _SYS_DDI_UFM_IMPL_H @@ -38,11 +39,14 @@ void ufm_init(); /* private interfaces for ufm driver */ struct ddi_ufm_handle *ufm_find(const char *); int ufm_cache_fill(struct ddi_ufm_handle *ufmh); +int ufm_read_img(ddi_ufm_handle_t *, uint_t, uint_t, uint64_t, uint64_t, + uintptr_t, uint64_t *, int); struct ddi_ufm_slot { uint_t ufms_slotno; char *ufms_version; ddi_ufm_attr_t ufms_attrs; + uint64_t ufms_imgsize; nvlist_t *ufms_misc; }; diff --git a/usr/src/uts/common/sys/dkio.h b/usr/src/uts/common/sys/dkio.h index 9d88731c5d..6996837b40 100644 --- a/usr/src/uts/common/sys/dkio.h +++ b/usr/src/uts/common/sys/dkio.h @@ -88,7 +88,7 @@ struct dk_cinfo { #define DKC_PCMCIA_MEM 21 /* PCMCIA memory disk-like type (Obsolete) */ #define DKC_PCMCIA_ATA 22 /* PCMCIA AT Attached type */ #define DKC_VBD 23 /* virtual block device */ -#define DKC_BLKDEV 24 /* generic block device (see blkdev(7d)) */ +#define DKC_BLKDEV 24 /* generic block device (see blkdev(4D)) */ /* * Sun reserves up through 1023 @@ -356,6 +356,23 @@ struct dk_minfo_ext { uint_t dki_pbsize; /* Physical blocksize of media */ }; +#ifdef _KERNEL + +/* + * The 32-bit version of the media info API did not end up with a consistent + * size in an ILP32 and LP64 interface. While the actual offsets of the members + * are the same, the resulting structure size is not. + */ +#pragma pack(4) +struct dk_minfo_ext32 { + uint_t dki_media_type; /* Media type or profile info */ + uint_t dki_lbsize; /* Logical blocksize of media */ + diskaddr_t dki_capacity; /* Capacity as # of dki_lbsize blks */ + uint_t dki_pbsize; /* Physical blocksize of media */ +}; +#pragma pack() +#endif + /* * Media types or profiles known */ diff --git a/usr/src/uts/common/sys/dkioc_free_util.h b/usr/src/uts/common/sys/dkioc_free_util.h index 9e83ab3bff..f61630395c 100644 --- a/usr/src/uts/common/sys/dkioc_free_util.h +++ b/usr/src/uts/common/sys/dkioc_free_util.h @@ -11,6 +11,7 @@ /* * Copyright 2017 Nexenta Inc. All rights reserved. + * Copyright 2020 Joyent, Inc. */ #ifndef _SYS_DKIOC_FREE_UTIL_H @@ -24,8 +25,50 @@ extern "C" { #define DFL_COPYIN_MAX_EXTS (1024 * 1024) +#define DFL_ISSYNC(dfl) (((dfl)->dfl_flags & DF_WAIT_SYNC) ? B_TRUE : B_FALSE) + +/* + * Since dkioc_free_list_t and in general DKIOCFREE use bytes to express + * values instead of blocks, dkioc_free_info_t uses bytes as well for + * consistency. + */ +typedef struct dkioc_free_info { + /* log2(block size) */ + uint64_t dfi_bshift; + + /* Maximum number of extents in a single request. 0 == no limit */ + uint64_t dfi_max_ext; + + /* + * Maximum total number of bytes in a single request. 0 == no limit. + * Must by a multiple of 1U << dfi_bshift (e.g. dfi_bshift == 9, + * dfk_max_bytes must be a multiple of 512). + */ + uint64_t dfi_max_bytes; + + /* + * Maximum length of an extent. 0 == same as dfi_max_bytes. If > 0, + * must be a multiple of 1U << dfi_shift (the block size) and + * <= dfi_max_bytes. + */ + uint64_t dfi_max_ext_bytes; + + /* + * Minimum alignment for starting extent offsets in bytes + * Must be > 0, and a multiple of 1U << dfi_shift. + * + * A possible future extention might be to also express a preferred + * alignment when splitting extents. + */ + uint64_t dfi_align; +} dkioc_free_info_t; + +typedef int (*dfl_iter_fn_t)(dkioc_free_list_t *dfl, void *arg, int kmflag); + int dfl_copyin(void *arg, dkioc_free_list_t **out, int ddi_flags, int kmflags); void dfl_free(dkioc_free_list_t *dfl); +int dfl_iter(dkioc_free_list_t *dfl, const dkioc_free_info_t *dfi, uint64_t len, + dfl_iter_fn_t fn, void *arg, int kmflag); #ifdef __cplusplus } diff --git a/usr/src/uts/common/sys/dklabel.h b/usr/src/uts/common/sys/dklabel.h index 457c1ecadc..25b52c014b 100644 --- a/usr/src/uts/common/sys/dklabel.h +++ b/usr/src/uts/common/sys/dklabel.h @@ -87,7 +87,7 @@ typedef daddr32_t blkaddr32_t; /* * partition headers: section 1 - * Returned in struct dk_allmap by ioctl DKIOC[SG]APART (dkio(7I)) + * Returned in struct dk_allmap by ioctl DKIOC[SG]APART (dkio(4I)) */ struct dk_map { blkaddr_t dkl_cylno; /* starting cylinder */ diff --git a/usr/src/uts/common/sys/dld.h b/usr/src/uts/common/sys/dld.h index 5be223ce93..b73d22249a 100644 --- a/usr/src/uts/common/sys/dld.h +++ b/usr/src/uts/common/sys/dld.h @@ -48,7 +48,7 @@ extern "C" { #endif /* - * Data-Link Driver Information (text emitted by modinfo(1m)) + * Data-Link Driver Information (text emitted by modinfo(8)) */ #define DLD_INFO "Data-Link Driver" @@ -446,7 +446,8 @@ typedef struct dld_capab_poll_s { typedef struct dld_capab_lso_s { uint_t lso_flags; /* capability flags */ - uint_t lso_max; /* maximum payload */ + uint_t lso_max_tcpv4; /* maximum TCPv4 payload */ + uint_t lso_max_tcpv6; /* maximum TCPv6 payload */ } dld_capab_lso_t; int dld_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **); diff --git a/usr/src/uts/common/sys/dlpi.h b/usr/src/uts/common/sys/dlpi.h index d76daffeb7..f3a5fd6f70 100644 --- a/usr/src/uts/common/sys/dlpi.h +++ b/usr/src/uts/common/sys/dlpi.h @@ -62,7 +62,7 @@ typedef struct dl_ipnetinfo { uint32_t dli_pktlen; /* length of dl_ipnetinfo_t */ uint32_t dli_ifindex; uint32_t dli_grifindex; - uint32_t dli_zsrc; /* packet source zone ID (if any) */ + uint32_t dli_zsrc; /* packet source zone ID (if any) */ uint32_t dli_zdst; /* packet dest zone ID (if any) */ } dl_ipnetinfo_t; @@ -278,7 +278,7 @@ typedef struct dl_ipnetinfo { #define DL_IPV6 0x80000002ul /* IPv6 Tunnel Link */ #define SUNW_DL_VNI 0x80000003ul /* Virtual network interface */ #define DL_WIFI 0x80000004ul /* IEEE 802.11 */ -#define DL_IPNET 0x80000005ul /* ipnet(7D) link */ +#define DL_IPNET 0x80000005ul /* ipnet(4D) link */ #define SUNW_DL_IPMP 0x80000006ul /* IPMP stub interface */ #define DL_6TO4 0x80000007ul /* 6to4 Tunnel Link */ diff --git a/usr/src/uts/common/sys/dls.h b/usr/src/uts/common/sys/dls.h index 81f9e2abac..0c5ffb0dd7 100644 --- a/usr/src/uts/common/sys/dls.h +++ b/usr/src/uts/common/sys/dls.h @@ -46,7 +46,7 @@ extern "C" { #define DLS_MODULE_NAME "dls" /* - * Data-Link Services Information (text emitted by modinfo(1m)) + * Data-Link Services Information (text emitted by modinfo(8)) */ #define DLS_INFO "Data-Link Services" diff --git a/usr/src/uts/common/sys/dnlc.h b/usr/src/uts/common/sys/dnlc.h index 4a5c20d6d0..1a6be2bebf 100644 --- a/usr/src/uts/common/sys/dnlc.h +++ b/usr/src/uts/common/sys/dnlc.h @@ -82,10 +82,15 @@ typedef struct ncache { struct vnode *dp; /* vnode of parent of name */ int hash; /* hash signature */ uchar_t namlen; /* length of name */ - char name[1]; /* segment name - null terminated */ + char name[]; /* segment name */ } ncache_t; /* + * Produce size of struct ncache with space allocated in name string. + */ +#define NCACHE_SIZE(namelen) offsetof(ncache_t, name) + (namelen) + +/* * Hash table bucket structure of name cache entries for fast lookup. */ typedef struct nc_hash { @@ -214,9 +219,14 @@ typedef struct dcentry { struct dcentry *de_next; /* link to next name entry in bucket */ int de_hash; /* hash signature */ uchar_t de_namelen; /* length of name excluding null */ - char de_name[1]; /* null terminated name */ + char de_name[]; /* name */ } dcentry_t; +/* + * Produce size of struct dcentry with space allocated in name string. + */ +#define DCENTTRY_SIZE(namelen) offsetof(dcentry_t, de_name) + (namelen) + typedef struct dircache { struct dircache *dc_next; /* chain - for purge purposes */ struct dircache *dc_prev; /* chain - for purge purposes */ diff --git a/usr/src/uts/common/sys/dtrace.h b/usr/src/uts/common/sys/dtrace.h index ab6d4c4445..f554fb0e58 100644 --- a/usr/src/uts/common/sys/dtrace.h +++ b/usr/src/uts/common/sys/dtrace.h @@ -43,7 +43,7 @@ extern "C" { * Solaris system and DTrace subsystem and are subject to change at any time * without notice. Applications and drivers using these interfaces will fail * to run on future releases. These interfaces should not be used for any - * purpose except those expressly outlined in dtrace(7D) and libdtrace(3LIB). + * purpose except those expressly outlined in dtrace(4D) and libdtrace(3LIB). * Please refer to the "Solaris Dynamic Tracing Guide" for more information. */ @@ -1188,7 +1188,7 @@ typedef struct dtrace_argdesc { * The D compiler can query the provider attributes (dtrace_pattr_t below) in * order to compute the properties of an input program and report them. */ -typedef uint8_t dtrace_stability_t; /* stability code (see attributes(5)) */ +typedef uint8_t dtrace_stability_t; /* stability code (see attributes(7)) */ typedef uint8_t dtrace_class_t; /* architectural dependency class */ #define DTRACE_STABILITY_INTERNAL 0 /* private to DTrace itself */ diff --git a/usr/src/uts/common/sys/dtrace_impl.h b/usr/src/uts/common/sys/dtrace_impl.h index a55d0d7e1f..fe8666e1dd 100644 --- a/usr/src/uts/common/sys/dtrace_impl.h +++ b/usr/src/uts/common/sys/dtrace_impl.h @@ -43,7 +43,7 @@ extern "C" { * Solaris system and DTrace subsystem and are subject to change at any time * without notice. Applications and drivers using these interfaces will fail * to run on future releases. These interfaces should not be used for any - * purpose except those expressly outlined in dtrace(7D) and libdtrace(3LIB). + * purpose except those expressly outlined in dtrace(4D) and libdtrace(3LIB). * Please refer to the "Solaris Dynamic Tracing Guide" for more information. */ @@ -1201,7 +1201,7 @@ typedef struct dtrace_enabling { * properties in the dtrace.conf file. If there is an anonymous enabling, a * DTrace consumer state and enabling are created on attach. The state may be * subsequently grabbed by the first consumer specifying the "grabanon" - * option. As long as an anonymous DTrace enabling exists, dtrace(7D) will + * option. As long as an anonymous DTrace enabling exists, dtrace(4D) will * refuse to unload. */ typedef struct dtrace_anon { diff --git a/usr/src/uts/common/sys/dumphdr.h b/usr/src/uts/common/sys/dumphdr.h index 57a9a9c2dc..aa2fbde7a5 100644 --- a/usr/src/uts/common/sys/dumphdr.h +++ b/usr/src/uts/common/sys/dumphdr.h @@ -41,8 +41,8 @@ extern "C" { * are written out: one at the beginning of the dump, and the other at * the very end of the dump device. The terminal header is at a known * location (end of device) so we can always find it. The initial header - * is redundant, but helps savecore(1M) determine whether the dump has been - * overwritten by swap activity. See dumpadm(1M) for dump configuration. + * is redundant, but helps savecore(8) determine whether the dump has been + * overwritten by swap activity. See dumpadm(8) for dump configuration. */ #define DUMP_MAGIC 0xdefec8edU /* dump magic number */ #define DUMP_VERSION 10 /* version of this dumphdr */ diff --git a/usr/src/uts/common/sys/elf.h b/usr/src/uts/common/sys/elf.h index 1a2ca397ef..8cb36da033 100644 --- a/usr/src/uts/common/sys/elf.h +++ b/usr/src/uts/common/sys/elf.h @@ -21,6 +21,7 @@ /* * Copyright 2012 DEY Storage Systems, Inc. All rights reserved. * Copyright (c) 2018, Joyent, Inc. + * Copyright 2020 Oxide Computer Company */ /* * Copyright 2010 Sun Microsystems, Inc. All rights reserved. @@ -658,6 +659,21 @@ typedef struct { #define SHT_GNU_LIBLIST 0x6ffffff7 /* Prelink library list */ #define SHT_CHECKSUM 0x6ffffff8 /* Checksum for DSO content */ +/* + * LLVM-specific section types, actually independent of any (ELF) OS. + * See: https://llvm.org/docs/Extensions.html + */ +#define SHT_LLVM_ODRTAB 0x6fff4c00 /* ODR Table */ +#define SHT_LLVM_LINKER_OPTIONS 0x6fff4c01 /* Linker options */ +#define SHT_LLVM_UNKNOWN1 0x6fff4c02 /* previously call graph profile */ +#define SHT_LLVM_ADDRSIG 0x6fff4c03 /* significant address table */ +#define SHT_LLVM_DEPENDENT_LIBRARIES 0x6fff4c04 /* dependent libraries. */ +#define SHT_LLVM_SYMPART 0x6fff4c05 /* symbol partition specs. */ +#define SHT_LLVM_PART_EHDR 0x6fff4c06 /* ehdr for loadable part. */ +#define SHT_LLVM_PART_PHDR 0x6fff4c07 /* phdrs for loadable part. */ +#define SHT_LLVM_BB_ADDR_MAP 0x6fff4c08 /* basic block addr map */ +#define SHT_LLVM_CALL_GRAPH_PROFILE 0x6fff4c09 /* call graph profile */ + #define SHT_LOPROC 0x70000000 /* processor specific range */ #define SHT_HIPROC 0x7fffffff @@ -744,6 +760,9 @@ typedef struct { #define STB_WEAK 2 #define STB_NUM 3 +#define STB_LOOS 10 /* operating system specific range */ +#define STB_HIOS 12 + #define STB_LOPROC 13 /* processor specific range */ #define STB_HIPROC 15 @@ -1018,7 +1037,8 @@ typedef Elf64_Word Elf64_Capchain; #define NT_SPYMASTER 23 /* psinfo_t for agent LWP spymaster */ #define NT_SECFLAGS 24 /* process security-flags */ #define NT_LWPNAME 25 /* prlwpname_t */ -#define NT_NUM 25 +#define NT_UPANIC 26 /* prupanic_t */ +#define NT_NUM 26 #ifdef _KERNEL diff --git a/usr/src/uts/common/sys/elf_386.h b/usr/src/uts/common/sys/elf_386.h index 2ac67c8db2..06e38d3c4c 100644 --- a/usr/src/uts/common/sys/elf_386.h +++ b/usr/src/uts/common/sys/elf_386.h @@ -58,22 +58,27 @@ extern "C" { #define R_386_PC16 21 #define R_386_8 22 #define R_386_PC8 23 -#define R_386_UNKNOWN24 24 -#define R_386_UNKNOWN25 25 -#define R_386_UNKNOWN26 26 -#define R_386_UNKNOWN27 27 -#define R_386_UNKNOWN28 28 -#define R_386_UNKNOWN29 29 -#define R_386_UNKNOWN30 30 -#define R_386_UNKNOWN31 31 +#define R_386_TLS_GD_32 24 +#define R_386_TLS_GD_PUSH 25 +#define R_386_TLS_GD_CALL 26 +#define R_386_TLS_GD_POP 27 +#define R_386_TLS_LDM_32 28 +#define R_386_TLS_LDM_PUSH 29 +#define R_386_TLS_LDM_CALL 30 +#define R_386_TLS_LDM_POP 31 #define R_386_TLS_LDO_32 32 -#define R_386_UNKNOWN33 33 -#define R_386_UNKNOWN34 34 +#define R_386_TLS_IE_32 33 +#define R_386_TLS_LE_32 34 #define R_386_TLS_DTPMOD32 35 #define R_386_TLS_DTPOFF32 36 -#define R_386_UNKNOWN37 37 +#define R_386_TLS_TPOFF32 37 #define R_386_SIZE32 38 -#define R_386_NUM 39 +#define R_386_TLS_GOTDESC 39 +#define R_386_TLS_DESC_CALL 40 +#define R_386_TLS_DESC 41 +#define R_386_IRELATIVE 42 +#define R_386_GOT32X 43 +#define R_386_NUM 44 #define ELF_386_MAXPGSZ 0x10000 /* maximum page size */ diff --git a/usr/src/uts/common/sys/elf_amd64.h b/usr/src/uts/common/sys/elf_amd64.h index e789a1900d..3386dc95b6 100644 --- a/usr/src/uts/common/sys/elf_amd64.h +++ b/usr/src/uts/common/sys/elf_amd64.h @@ -67,50 +67,64 @@ extern "C" { #define R_AMD64_PLTOFF64 31 /* reserved for future expansion */ #define R_AMD64_SIZE32 32 #define R_AMD64_SIZE64 33 -#define R_AMD64_NUM 34 - +#define R_AMD64_GOTPC32_TLSDESC 34 +#define R_AMD64_TLSDESC_CALL 35 +#define R_AMD64_TLSDESC 36 +#define R_AMD64_IRELATIVE 37 +#define R_AMD64_RELATIVE64 38 +#define R_AMD64_UNKNOWN39 39 /* deprecated */ +#define R_AMD64_UNKNOWN40 40 /* deprecated */ +#define R_AMD64_GOTPCRELX 41 +#define R_AMD64_REX_GOTPCRELX 42 +#define R_AMD64_NUM 43 /* * The "System V Application Binary Interface, AMD64 Architecture Processor * Supplement", defines relocations in terms of R_X86_64_ rather than R_AMD64_. * Maintain both relocation naming conventions for compatibility. */ -#define R_X86_64_NONE R_AMD64_NONE -#define R_X86_64_64 R_AMD64_64 -#define R_X86_64_PC32 R_AMD64_PC32 -#define R_X86_64_GOT32 R_AMD64_GOT32 -#define R_X86_64_PLT32 R_AMD64_PLT32 -#define R_X86_64_COPY R_AMD64_COPY -#define R_X86_64_GLOB_DAT R_AMD64_GLOB_DAT -#define R_X86_64_JUMP_SLOT R_AMD64_JUMP_SLOT -#define R_X86_64_RELATIVE R_AMD64_RELATIVE -#define R_X86_64_GOTPCREL R_AMD64_GOTPCREL -#define R_X86_64_32 R_AMD64_32 -#define R_X86_64_32S R_AMD64_32S -#define R_X86_64_16 R_AMD64_16 -#define R_X86_64_PC16 R_AMD64_PC16 -#define R_X86_64_8 R_AMD64_8 -#define R_X86_64_PC8 R_AMD64_PC8 -#define R_X86_64_DTPMOD64 R_AMD64_DTPMOD64 -#define R_X86_64_DTPOFF64 R_AMD64_DTPOFF64 -#define R_X86_64_TPOFF64 R_AMD64_TPOFF64 -#define R_X86_64_TLSGD R_AMD64_TLSGD -#define R_X86_64_TLSLD R_AMD64_TLSLD -#define R_X86_64_DTPOFF32 R_AMD64_DTPOFF32 -#define R_X86_64_GOTTPOFF R_AMD64_GOTTPOFF -#define R_X86_64_TPOFF32 R_AMD64_TPOFF32 -#define R_X86_64_PC64 R_AMD64_PC64 -#define R_X86_64_GOTPC32 R_AMD64_GOTPC32 -#define R_X86_64_GOTOFF64 R_AMD64_GOTOFF64 -#define R_X86_64_GOT64 R_AMD64_GOT64 -#define R_X86_64_GOTPCREL64 R_AMD64_GOTPCREL64 -#define R_X86_64_GOTPC64 R_AMD64_GOTPC64 -#define R_X86_64_GOTPLT64 R_AMD64_GOTPLT64 -#define R_X86_64_PLTOFF64 R_AMD64_PLTOFF64 -#define R_X86_64_SIZE32 R_AMD64_SIZE32 -#define R_X86_64_SIZE64 R_AMD64_SIZE64 -#define R_X86_64_NUM R_AMD64_NUM - +#define R_X86_64_NONE R_AMD64_NONE +#define R_X86_64_64 R_AMD64_64 +#define R_X86_64_PC32 R_AMD64_PC32 +#define R_X86_64_GOT32 R_AMD64_GOT32 +#define R_X86_64_PLT32 R_AMD64_PLT32 +#define R_X86_64_COPY R_AMD64_COPY +#define R_X86_64_GLOB_DAT R_AMD64_GLOB_DAT +#define R_X86_64_JUMP_SLOT R_AMD64_JUMP_SLOT +#define R_X86_64_RELATIVE R_AMD64_RELATIVE +#define R_X86_64_GOTPCREL R_AMD64_GOTPCREL +#define R_X86_64_32 R_AMD64_32 +#define R_X86_64_32S R_AMD64_32S +#define R_X86_64_16 R_AMD64_16 +#define R_X86_64_PC16 R_AMD64_PC16 +#define R_X86_64_8 R_AMD64_8 +#define R_X86_64_PC8 R_AMD64_PC8 +#define R_X86_64_DTPMOD64 R_AMD64_DTPMOD64 +#define R_X86_64_DTPOFF64 R_AMD64_DTPOFF64 +#define R_X86_64_TPOFF64 R_AMD64_TPOFF64 +#define R_X86_64_TLSGD R_AMD64_TLSGD +#define R_X86_64_TLSLD R_AMD64_TLSLD +#define R_X86_64_DTPOFF32 R_AMD64_DTPOFF32 +#define R_X86_64_GOTTPOFF R_AMD64_GOTTPOFF +#define R_X86_64_TPOFF32 R_AMD64_TPOFF32 +#define R_X86_64_PC64 R_AMD64_PC64 +#define R_X86_64_GOTPC32 R_AMD64_GOTPC32 +#define R_X86_64_GOTOFF64 R_AMD64_GOTOFF64 +#define R_X86_64_GOT64 R_AMD64_GOT64 +#define R_X86_64_GOTPCREL64 R_AMD64_GOTPCREL64 +#define R_X86_64_GOTPC64 R_AMD64_GOTPC64 +#define R_X86_64_GOTPLT64 R_AMD64_GOTPLT64 +#define R_X86_64_PLTOFF64 R_AMD64_PLTOFF64 +#define R_X86_64_SIZE32 R_AMD64_SIZE32 +#define R_X86_64_SIZE64 R_AMD64_SIZE64 +#define R_X86_64_GOTPC32_TLSDESC R_AMD64_GOTPC32_TLSDESC +#define R_X86_64_TLSDESC_CALL R_AMD64_TLSDESC_CALL +#define R_X86_64_TLSDESC R_AMD64_TLSDESC +#define R_X86_64_IRELATIVE R_AMD64_IRELATIVE +#define R_X86_64_RELATIVE64 R_AMD64_RELATIVE64 +#define R_X86_64_GOTPCRELX R_AMD64_GOTPCRELX +#define R_X86_64_REX_GOTPCRELX R_AMD64_REX_GOTPCRELX +#define R_X86_64_NUM R_AMD64_NUM #define ELF_AMD64_MAXPGSZ 0x100000 /* maximum page size */ diff --git a/usr/src/uts/common/sys/epoll.h b/usr/src/uts/common/sys/epoll.h index f2e4b90ab7..480bfdf9ff 100644 --- a/usr/src/uts/common/sys/epoll.h +++ b/usr/src/uts/common/sys/epoll.h @@ -11,6 +11,7 @@ /* * Copyright (c) 2014, Joyent, Inc. All rights reserved. + * Copyright 2020 Oxide Computer Company */ #ifndef _SYS_EPOLL_H @@ -44,7 +45,7 @@ typedef struct epoll_event { #endif /* - * Define the EPOLL* constants in terms of their poll(2)/poll(7) equivalents. + * Define the EPOLL* constants in terms of their poll(2)/poll(4D) equivalents. * Note that the values match the equivalents in Linux to allow for any binary * compatibility layers to not need to translate them. */ @@ -60,6 +61,7 @@ typedef struct epoll_event { #define EPOLLHUP 0x0010 #define EPOLLRDHUP 0x2000 +#define EPOLLEXCLUSIVE (1UL << 28) /* sets exclusive wake-up mode */ #define EPOLLWAKEUP (1UL << 29) /* no meaning; silently ignored */ #define EPOLLONESHOT (1UL << 30) /* translated to POLLONESHOT */ #define EPOLLET (1UL << 31) /* translated to POLLET */ diff --git a/usr/src/uts/common/sys/esunddi.h b/usr/src/uts/common/sys/esunddi.h index 8bb4729ae4..92a61a06c8 100644 --- a/usr/src/uts/common/sys/esunddi.h +++ b/usr/src/uts/common/sys/esunddi.h @@ -22,6 +22,7 @@ * Copyright 2005 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * Copyright (c) 2016 by Delphix. All rights reserved. + * Copyright 2020 Oxide Computer Company */ #ifndef _SYS_ESUNDDI_H @@ -46,15 +47,15 @@ extern "C" { int e_ddi_prop_create(dev_t dev, dev_info_t *dip, int flag, - char *name, caddr_t value, int length); + char *name, caddr_t value, int length); int e_ddi_prop_modify(dev_t dev, dev_info_t *dip, int flag, - char *name, caddr_t value, int length); + char *name, caddr_t value, int length); int e_ddi_prop_update_int(dev_t match_dev, dev_info_t *dip, - char *name, int data); + char *name, int data); int e_ddi_prop_update_int64(dev_t match_dev, dev_info_t *dip, @@ -70,7 +71,7 @@ e_ddi_prop_update_int64_array(dev_t match_dev, dev_info_t *dip, int e_ddi_prop_update_string(dev_t match_dev, dev_info_t *dip, - char *name, char *data); + char *name, char *data); int e_ddi_prop_update_string_array(dev_t match_dev, dev_info_t *dip, @@ -94,18 +95,18 @@ e_ddi_getprop(dev_t dev, vtype_t type, char *name, int flags, int defaultval); int64_t e_ddi_getprop_int64(dev_t dev, vtype_t type, char *name, - int flags, int64_t defvalue); + int flags, int64_t defvalue); int e_ddi_getproplen(dev_t dev, vtype_t type, char *name, int flags, int *lengthp); int e_ddi_getlongprop(dev_t dev, vtype_t type, char *name, int flags, - caddr_t valuep, int *lengthp); + caddr_t valuep, int *lengthp); int e_ddi_getlongprop_buf(dev_t dev, vtype_t type, char *name, int flags, - caddr_t valuep, int *lengthp); + caddr_t valuep, int *lengthp); int e_ddi_parental_suspend_resume(dev_info_t *dip); @@ -159,9 +160,8 @@ extern int (*pm_platform_power)(power_req_t *); */ int umem_lockmemory(caddr_t addr, size_t size, int flags, - ddi_umem_cookie_t *cookie, - struct umem_callback_ops *ops_vector, - proc_t *procp); + ddi_umem_cookie_t *cookie, struct umem_callback_ops *ops_vector, + proc_t *procp); #define DDI_UMEMLOCK_LONGTERM 0x04 @@ -249,15 +249,20 @@ extern int e_ddi_branch_referenced(dev_info_t *rdip, * Obsolete interfaces, no longer used, to be removed. * Retained only for driver compatibility. */ -void -e_ddi_enter_driver_list(struct devnames *, int *); /* obsolete */ +void e_ddi_enter_driver_list(struct devnames *, int *); /* obsolete */ -int -e_ddi_tryenter_driver_list(struct devnames *, int *); /* obsolete */ +int e_ddi_tryenter_driver_list(struct devnames *, int *); /* obsolete */ -void -e_ddi_exit_driver_list(struct devnames *, int); /* obsolete */ +void e_ddi_exit_driver_list(struct devnames *, int); /* obsolete */ + +typedef struct ddi_unbind_callback { + list_node_t ddiub_next; + void (*ddiub_cb)(void *, dev_info_t *); + void *ddiub_arg; +} ddi_unbind_callback_t; +extern void e_ddi_register_unbind_callback(dev_info_t *, + ddi_unbind_callback_t *); #endif /* _KERNEL */ diff --git a/usr/src/uts/common/sys/ethernet.h b/usr/src/uts/common/sys/ethernet.h index 5b9de2f2bf..4febb8915f 100644 --- a/usr/src/uts/common/sys/ethernet.h +++ b/usr/src/uts/common/sys/ethernet.h @@ -20,6 +20,7 @@ */ /* * Copyright 2014 Garrett D'Amore <garrett@damore.org> + * Copyright 2021 Oxide Computer Company * * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. @@ -140,6 +141,8 @@ struct ether_vlan_extinfo { #endif #ifdef _KERNEL +#define ETHER_IS_MULTICAST(addr) (((addr)[0] & 0x01) != 0) + extern int localetheraddr(struct ether_addr *, struct ether_addr *); extern char *ether_sprintf(struct ether_addr *); extern int ether_aton(char *, uchar_t *); diff --git a/usr/src/uts/common/sys/fault.h b/usr/src/uts/common/sys/fault.h index d37e8a0f47..139216b5ff 100644 --- a/usr/src/uts/common/sys/fault.h +++ b/usr/src/uts/common/sys/fault.h @@ -40,7 +40,7 @@ extern "C" { * hardware faults. Setting the appropriate flags in a process's * set of traced faults via /proc causes the process to stop each * time one of the designated faults occurs so that a debugger can - * take action. See proc(4) for details. + * take action. See proc(5) for details. */ /* fault enumeration must begin with 1 */ diff --git a/usr/src/uts/common/sys/fcntl.h b/usr/src/uts/common/sys/fcntl.h index cf55ebbf2a..4af23583fd 100644 --- a/usr/src/uts/common/sys/fcntl.h +++ b/usr/src/uts/common/sys/fcntl.h @@ -37,7 +37,7 @@ */ /* Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved. */ -/* Copyright 2015, Joyent, Inc. */ +/* Copyright 2020 Joyent, Inc. */ #ifndef _SYS_FCNTL_H #define _SYS_FCNTL_H @@ -89,6 +89,9 @@ extern "C" { #if !defined(_STRICT_SYMBOLS) || defined(_XPG7) #define O_DIRECTORY 0x1000000 /* fail if not a directory */ #endif +#if !defined(_STRICT_SYMBOLS) +#define O_DIRECT 0x2000000 /* direct disk access hint */ +#endif /* * fcntl(2) requests diff --git a/usr/src/uts/common/sys/feature_tests.h b/usr/src/uts/common/sys/feature_tests.h index 9236a398b8..4422c8bb4e 100644 --- a/usr/src/uts/common/sys/feature_tests.h +++ b/usr/src/uts/common/sys/feature_tests.h @@ -22,6 +22,7 @@ /* * Copyright 2013 Garrett D'Amore <garrett@damore.org> * Copyright 2016 Joyent, Inc. + * Copyright 2022 Oxide Computer Company * * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. @@ -58,7 +59,7 @@ extern "C" { * compress common standards specified feature test macros for easier reading. * These macros should not be used by the application developer as * unexpected results may occur. Instead, the user should reference - * standards(5) for correct usage of the standards feature test macros. + * standards(7) for correct usage of the standards feature test macros. * * __XOPEN_OR_POSIX Used in cases where a symbol is defined by both * X/Open or POSIX or in the negative, when neither @@ -168,6 +169,24 @@ extern "C" { #endif /* + * This is a variant of _STRICT_SYMBOLS that is meant to cover headers that are + * governed by POSIX, but have not been governed by ISO C. One can go two ways + * on what should happen if an application actively includes (not transitively) + * a header that isn't part of the ISO C spec, we opt to say that if someone has + * gone out of there way then they're doing it for a reason and that is an act + * of non-compliance and therefore it's not up to us to hide away every symbol. + * + * In general, prefer using _STRICT_SYMBOLS, but this is here in particular for + * cases where in the past we have only used a POSIX related check and we don't + * wish to make something stricter. Often applications are relying on the + * ability to, or more realistically unwittingly, have _STRICT_STDC declared and + * still use these interfaces. + */ +#if (defined(__XOPEN_OR_POSIX) && !defined(__EXTENSIONS__)) +#define _STRICT_POSIX +#endif + +/* * Large file interfaces: * * _LARGEFILE_SOURCE @@ -259,7 +278,7 @@ extern "C" { * * When writing a conforming X/Open application, as per the specification * requirements, the appropriate feature test macros must be defined at - * compile time. These are as follows. For more info, see standards(5). + * compile time. These are as follows. For more info, see standards(7). * * Feature Test Macro Specification * ------------------------------------------------ ------------- diff --git a/usr/src/uts/common/sys/fibre-channel/fca/emlxs/emlxs_hw.h b/usr/src/uts/common/sys/fibre-channel/fca/emlxs/emlxs_hw.h index ab4b4b4e6b..406c90303b 100644 --- a/usr/src/uts/common/sys/fibre-channel/fca/emlxs/emlxs_hw.h +++ b/usr/src/uts/common/sys/fibre-channel/fca/emlxs/emlxs_hw.h @@ -2140,7 +2140,7 @@ typedef struct #define SLI_FW_TYPE_101 SLI_FW_TYPE_SHIFT(0xb) /* LP101 */ -enum emlxs_prog_type +typedef enum emlxs_prog_type { TEST_PROGRAM, /* 0 */ UTIL_PROGRAM, /* 1 */ diff --git a/usr/src/uts/common/sys/file.h b/usr/src/uts/common/sys/file.h index 816f6a7d33..66620ab7b9 100644 --- a/usr/src/uts/common/sys/file.h +++ b/usr/src/uts/common/sys/file.h @@ -27,7 +27,8 @@ /* All Rights Reserved */ /* Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved. */ -/* Copyright 2017 Joyent, Inc. */ +/* Copyright 2020 Joyent, Inc. */ +/* Copyright 2021 OmniOS Community Edition (OmniOSce) Association. */ #ifndef _SYS_FILE_H #define _SYS_FILE_H @@ -119,13 +120,18 @@ typedef struct fpollinfo { #define FCLOEXEC 0x800000 /* O_CLOEXEC = 0x800000 */ #define FDIRECTORY 0x1000000 /* O_DIRECTORY = 0x1000000 */ - -#if defined(_KERNEL) || defined(_FAKE_KERNEL) - +#define FDIRECT 0x2000000 /* O_DIRECT = 0x2000000 */ /* - * This is a flag that is set on f_flag2, but is never user-visible + * Private interface for lx O_PATH|O_NOFOLLOW emulation for symlinks. */ -#define FEPOLLED 0x8000 +#define __FLXPATH 0x80000000 +/* + * Private interface for lx fstatat(AT_NO_AUTOMOUNT) emulation. + * Since usage is disjoint, the __FLXPATH bit is re-used. + */ +#define __FLXNOAUTO 0x80000000 + +#if defined(_KERNEL) || defined(_FAKE_KERNEL) /* * Fake flags for driver ioctl calls to inform them of the originating diff --git a/usr/src/uts/common/sys/fm/protocol.h b/usr/src/uts/common/sys/fm/protocol.h index 5eca760dad..e0140bb0fb 100644 --- a/usr/src/uts/common/sys/fm/protocol.h +++ b/usr/src/uts/common/sys/fm/protocol.h @@ -21,6 +21,7 @@ /* * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright 2020 Joyent, Inc. */ #ifndef _SYS_FM_PROTOCOL_H @@ -200,6 +201,7 @@ extern "C" { #define FM_FMRI_SCHEME_LEGACY "legacy-hc" #define FM_FMRI_SCHEME_ZFS "zfs" #define FM_FMRI_SCHEME_SW "sw" +#define FM_FMRI_SCHEME_PATH "path" /* Scheme versions */ #define FMD_SCHEME_VERSION0 0 @@ -225,6 +227,8 @@ extern "C" { #define FM_ZFS_SCHEME_VERSION ZFS_SCHEME_VERSION0 #define SW_SCHEME_VERSION0 0 #define FM_SW_SCHEME_VERSION SW_SCHEME_VERSION0 +#define PATH_SCHEME_VERSION0 0 +#define FM_PATH_SCHEME_VERSION PATH_SCHEME_VERSION0 /* hc scheme member names */ #define FM_FMRI_HC_SERIAL_ID "serial" @@ -328,6 +332,13 @@ extern "C" { #define FM_FMRI_SW_CTXT_CTID "ctid" #define FM_FMRI_SW_CTXT_STACK "stack" +/* path scheme member names */ +#define FM_FMRI_PATH_VERSION "path-scheme-version" +#define FM_FMRI_PATH "path" +#define FM_FMRI_PATH_NAME "path-name" +#define FM_FMRI_PATH_INST "path-instance" +#define FM_FMRI_PATH_DIGRAPH_SCHEME "path-digraph-scheme" + extern nv_alloc_t *fm_nva_xcreate(char *, size_t); extern void fm_nva_xdestroy(nv_alloc_t *); diff --git a/usr/src/uts/common/sys/font.h b/usr/src/uts/common/sys/font.h index 5733686bf3..fe65e69136 100644 --- a/usr/src/uts/common/sys/font.h +++ b/usr/src/uts/common/sys/font.h @@ -84,9 +84,11 @@ typedef struct bitmap_data { } bitmap_data_t; typedef enum { - FONT_AUTO, - FONT_MANUAL, - FONT_BOOT + FONT_AUTO, /* This font is loaded by software */ + FONT_MANUAL, /* This font is loaded manually by user */ + FONT_BOOT, /* This font was passed to kernel by bootloader */ + FONT_BUILTIN, /* This font was built in at compile time */ + FONT_RELOAD /* This font is marked to be re-read from file */ } FONT_FLAGS; struct fontlist { @@ -126,9 +128,9 @@ extern bitmap_data_t font_data_8x16; void reset_font_flags(void); bitmap_data_t *set_font(short *, short *, short, short); const uint8_t *font_lookup(const struct font *, uint32_t); -void font_bit_to_pix4(struct font *, uint8_t *, uint32_t, uint8_t, uint8_t); -void font_bit_to_pix8(struct font *, uint8_t *, uint32_t, uint8_t, uint8_t); -void font_bit_to_pix16(struct font *, uint16_t *, uint32_t, uint16_t, uint16_t); +void font_bit_to_pix4(struct font *, uint8_t *, uint32_t, uint32_t, uint32_t); +void font_bit_to_pix8(struct font *, uint8_t *, uint32_t, uint32_t, uint32_t); +void font_bit_to_pix16(struct font *, uint16_t *, uint32_t, uint32_t, uint32_t); void font_bit_to_pix24(struct font *, uint8_t *, uint32_t, uint32_t, uint32_t); void font_bit_to_pix32(struct font *, uint32_t *, uint32_t, uint32_t, uint32_t); diff --git a/usr/src/uts/common/sys/fs/sdev_impl.h b/usr/src/uts/common/sys/fs/sdev_impl.h index d1c5f674f1..676193fcfa 100644 --- a/usr/src/uts/common/sys/fs/sdev_impl.h +++ b/usr/src/uts/common/sys/fs/sdev_impl.h @@ -39,6 +39,7 @@ extern "C" { #include <sys/nvpair.h> #include <sys/fs/sdev_plugin.h> #include <sys/sunddi.h> +#include <sys/fs/sdev_plugin.h> /* * sdev_nodes are the file-system specific part of the diff --git a/usr/src/uts/common/sys/fs/ufs_fsdir.h b/usr/src/uts/common/sys/fs/ufs_fsdir.h index d0719c6f02..8e1c8a7d06 100644 --- a/usr/src/uts/common/sys/fs/ufs_fsdir.h +++ b/usr/src/uts/common/sys/fs/ufs_fsdir.h @@ -105,6 +105,19 @@ struct dirtemplate { short dotdot_namlen; char dotdot_name[4]; /* ditto */ }; + +/* + * Reduced structure for manipulating directories. + * Note, we are using __packed here to ensure the size of structure + * without changing the alignment. + */ +struct tmp_dir { + uint32_t d_ino; /* inode number of entry */ + ushort_t d_reclen; /* length of this record */ + ushort_t d_namlen; /* length of string in d_name */ + char d_name[4]; /* name must be no longer than this */ +} __packed; + #endif #ifdef __cplusplus diff --git a/usr/src/uts/common/sys/fs/ufs_inode.h b/usr/src/uts/common/sys/fs/ufs_inode.h index bfdd32fa4a..a3aa0fd80c 100644 --- a/usr/src/uts/common/sys/fs/ufs_inode.h +++ b/usr/src/uts/common/sys/fs/ufs_inode.h @@ -137,7 +137,7 @@ extern "C" { * bmap routines. * * SVR4 Extended Fundamental Type (EFT) support: - * The inode structure has been enhanced to support + * The inode structure has been enhanced to support * 32-bit user-id, 32-bit group-id, and 32-bit device number. * Standard SVR4 ufs also supports 32-bit mode field. For the reason * of backward compatibility with the previous ufs disk format, @@ -189,7 +189,7 @@ extern "C" { #define i_fs i_ufsvfs->vfs_bufp->b_un.b_fs #define i_vfs i_vnode->v_vfsp -struct icommon { +struct icommon { o_mode_t ic_smode; /* 0: mode and type of file */ short ic_nlink; /* 2: number of links to file */ o_uid_t ic_suid; /* 4: owner's user id */ @@ -240,7 +240,7 @@ typedef struct inode { struct inode *i_chain[2]; /* must be first */ struct inode *i_freef; /* free list forward - must be before i_ic */ struct inode *i_freeb; /* free list back - must be before i_ic */ - struct icommon i_ic; /* Must be here */ + struct icommon i_ic; /* Must be here */ struct vnode *i_vnode; /* vnode associated with this inode */ struct vnode *i_devvp; /* vnode for block I/O */ dev_t i_dev; /* device where inode resides */ @@ -518,7 +518,7 @@ extern int vttoif_tab[]; * (Note that UFS's concept of time only keeps 32 bits of seconds * in the on-disk format). */ -struct timeval32 iuniqtime; +extern struct timeval32 iuniqtime; extern kmutex_t ufs_iuniqtime_lock; #define ITIMES_NOLOCK(ip) ufs_itimes_nolock(ip) @@ -786,7 +786,7 @@ typedef struct ufsvfs { */ clock_t vfs_lastwhinetime; - int vfs_nolog_si; /* not logging summary info */ + int vfs_nolog_si; /* not logging summary info */ int vfs_validfs; /* indicates mounted fs */ /* diff --git a/usr/src/uts/common/sys/fs/zfs.h b/usr/src/uts/common/sys/fs/zfs.h index 93a2b5887a..0ed966d22f 100644 --- a/usr/src/uts/common/sys/fs/zfs.h +++ b/usr/src/uts/common/sys/fs/zfs.h @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2016 by Delphix. All rights reserved. + * Copyright (c) 2011, 2020 by Delphix. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2020 Joyent, Inc. @@ -247,7 +247,7 @@ typedef enum { ZPOOL_NUM_PROPS } zpool_prop_t; -/* Small enough to not hog a whole line of printout in zpool(1M). */ +/* Small enough to not hog a whole line of printout in zpool(8). */ #define ZPROP_MAX_COMMENT 32 #define ZPROP_VALUE "value" @@ -561,6 +561,11 @@ typedef enum zfs_key_location { #define ZPL_VERSION_USERSPACE ZPL_VERSION_4 #define ZPL_VERSION_SA ZPL_VERSION_5 +/* Persistent L2ARC version */ +#define L2ARC_PERSISTENT_VERSION_1 1ULL +#define L2ARC_PERSISTENT_VERSION L2ARC_PERSISTENT_VERSION_1 +#define L2ARC_PERSISTENT_VERSION_STRING "1" + /* Rewind policy information */ #define ZPOOL_NO_REWIND 1 /* No policy - default behavior */ #define ZPOOL_NEVER_REWIND 2 /* Do not search for best txg or rewind */ @@ -1168,88 +1173,110 @@ typedef struct ddt_histogram { * /dev/zfs ioctl numbers. */ typedef enum zfs_ioc { + /* + * Core features - 81/128 numbers reserved. + */ +#ifdef __FreeBSD__ + ZFS_IOC_FIRST = 0, +#else ZFS_IOC_FIRST = ('Z' << 8), +#endif ZFS_IOC = ZFS_IOC_FIRST, - ZFS_IOC_POOL_CREATE = ZFS_IOC_FIRST, - ZFS_IOC_POOL_DESTROY, - ZFS_IOC_POOL_IMPORT, - ZFS_IOC_POOL_EXPORT, - ZFS_IOC_POOL_CONFIGS, - ZFS_IOC_POOL_STATS, - ZFS_IOC_POOL_TRYIMPORT, - ZFS_IOC_POOL_SCAN, - ZFS_IOC_POOL_FREEZE, - ZFS_IOC_POOL_UPGRADE, - ZFS_IOC_POOL_GET_HISTORY, - ZFS_IOC_VDEV_ADD, - ZFS_IOC_VDEV_REMOVE, - ZFS_IOC_VDEV_SET_STATE, - ZFS_IOC_VDEV_ATTACH, - ZFS_IOC_VDEV_DETACH, - ZFS_IOC_VDEV_SETPATH, - ZFS_IOC_VDEV_SETFRU, - ZFS_IOC_OBJSET_STATS, - ZFS_IOC_OBJSET_ZPLPROPS, - ZFS_IOC_DATASET_LIST_NEXT, - ZFS_IOC_SNAPSHOT_LIST_NEXT, - ZFS_IOC_SET_PROP, - ZFS_IOC_CREATE, - ZFS_IOC_DESTROY, - ZFS_IOC_ROLLBACK, - ZFS_IOC_RENAME, - ZFS_IOC_RECV, - ZFS_IOC_SEND, - ZFS_IOC_INJECT_FAULT, - ZFS_IOC_CLEAR_FAULT, - ZFS_IOC_INJECT_LIST_NEXT, - ZFS_IOC_ERROR_LOG, - ZFS_IOC_CLEAR, - ZFS_IOC_PROMOTE, - ZFS_IOC_SNAPSHOT, - ZFS_IOC_DSOBJ_TO_DSNAME, - ZFS_IOC_OBJ_TO_PATH, - ZFS_IOC_POOL_SET_PROPS, - ZFS_IOC_POOL_GET_PROPS, - ZFS_IOC_SET_FSACL, - ZFS_IOC_GET_FSACL, - ZFS_IOC_SHARE, - ZFS_IOC_INHERIT_PROP, - ZFS_IOC_SMB_ACL, - ZFS_IOC_USERSPACE_ONE, - ZFS_IOC_USERSPACE_MANY, - ZFS_IOC_USERSPACE_UPGRADE, - ZFS_IOC_HOLD, - ZFS_IOC_RELEASE, - ZFS_IOC_GET_HOLDS, - ZFS_IOC_OBJSET_RECVD_PROPS, - ZFS_IOC_VDEV_SPLIT, - ZFS_IOC_NEXT_OBJ, - ZFS_IOC_DIFF, - ZFS_IOC_TMP_SNAPSHOT, - ZFS_IOC_OBJ_TO_STATS, - ZFS_IOC_SPACE_WRITTEN, - ZFS_IOC_SPACE_SNAPS, - ZFS_IOC_DESTROY_SNAPS, - ZFS_IOC_POOL_REGUID, - ZFS_IOC_POOL_REOPEN, - ZFS_IOC_SEND_PROGRESS, - ZFS_IOC_LOG_HISTORY, - ZFS_IOC_SEND_NEW, - ZFS_IOC_SEND_SPACE, - ZFS_IOC_CLONE, - ZFS_IOC_BOOKMARK, - ZFS_IOC_GET_BOOKMARKS, - ZFS_IOC_DESTROY_BOOKMARKS, - ZFS_IOC_CHANNEL_PROGRAM, - ZFS_IOC_REMAP, - ZFS_IOC_POOL_CHECKPOINT, - ZFS_IOC_POOL_DISCARD_CHECKPOINT, - ZFS_IOC_POOL_INITIALIZE, - ZFS_IOC_POOL_SYNC, - ZFS_IOC_LOAD_KEY, - ZFS_IOC_UNLOAD_KEY, - ZFS_IOC_CHANGE_KEY, - ZFS_IOC_POOL_TRIM, + ZFS_IOC_POOL_CREATE = ZFS_IOC_FIRST, /* 0x5a00 */ + ZFS_IOC_POOL_DESTROY, /* 0x5a01 */ + ZFS_IOC_POOL_IMPORT, /* 0x5a02 */ + ZFS_IOC_POOL_EXPORT, /* 0x5a03 */ + ZFS_IOC_POOL_CONFIGS, /* 0x5a04 */ + ZFS_IOC_POOL_STATS, /* 0x5a05 */ + ZFS_IOC_POOL_TRYIMPORT, /* 0x5a06 */ + ZFS_IOC_POOL_SCAN, /* 0x5a07 */ + ZFS_IOC_POOL_FREEZE, /* 0x5a08 */ + ZFS_IOC_POOL_UPGRADE, /* 0x5a09 */ + ZFS_IOC_POOL_GET_HISTORY, /* 0x5a0a */ + ZFS_IOC_VDEV_ADD, /* 0x5a0b */ + ZFS_IOC_VDEV_REMOVE, /* 0x5a0c */ + ZFS_IOC_VDEV_SET_STATE, /* 0x5a0d */ + ZFS_IOC_VDEV_ATTACH, /* 0x5a0e */ + ZFS_IOC_VDEV_DETACH, /* 0x5a0f */ + ZFS_IOC_VDEV_SETPATH, /* 0x5a10 */ + ZFS_IOC_VDEV_SETFRU, /* 0x5a11 */ + ZFS_IOC_OBJSET_STATS, /* 0x5a12 */ + ZFS_IOC_OBJSET_ZPLPROPS, /* 0x5a13 */ + ZFS_IOC_DATASET_LIST_NEXT, /* 0x5a14 */ + ZFS_IOC_SNAPSHOT_LIST_NEXT, /* 0x5a15 */ + ZFS_IOC_SET_PROP, /* 0x5a16 */ + ZFS_IOC_CREATE, /* 0x5a17 */ + ZFS_IOC_DESTROY, /* 0x5a18 */ + ZFS_IOC_ROLLBACK, /* 0x5a19 */ + ZFS_IOC_RENAME, /* 0x5a1a */ + ZFS_IOC_RECV, /* 0x5a1b */ + ZFS_IOC_SEND, /* 0x5a1c */ + ZFS_IOC_INJECT_FAULT, /* 0x5a1d */ + ZFS_IOC_CLEAR_FAULT, /* 0x5a1e */ + ZFS_IOC_INJECT_LIST_NEXT, /* 0x5a1f */ + ZFS_IOC_ERROR_LOG, /* 0x5a20 */ + ZFS_IOC_CLEAR, /* 0x5a21 */ + ZFS_IOC_PROMOTE, /* 0x5a22 */ + ZFS_IOC_SNAPSHOT, /* 0x5a23 */ + ZFS_IOC_DSOBJ_TO_DSNAME, /* 0x5a24 */ + ZFS_IOC_OBJ_TO_PATH, /* 0x5a25 */ + ZFS_IOC_POOL_SET_PROPS, /* 0x5a26 */ + ZFS_IOC_POOL_GET_PROPS, /* 0x5a27 */ + ZFS_IOC_SET_FSACL, /* 0x5a28 */ + ZFS_IOC_GET_FSACL, /* 0x5a29 */ + ZFS_IOC_SHARE, /* 0x5a2a */ + ZFS_IOC_INHERIT_PROP, /* 0x5a2b */ + ZFS_IOC_SMB_ACL, /* 0x5a2c */ + ZFS_IOC_USERSPACE_ONE, /* 0x5a2d */ + ZFS_IOC_USERSPACE_MANY, /* 0x5a2e */ + ZFS_IOC_USERSPACE_UPGRADE, /* 0x5a2f */ + ZFS_IOC_HOLD, /* 0x5a30 */ + ZFS_IOC_RELEASE, /* 0x5a31 */ + ZFS_IOC_GET_HOLDS, /* 0x5a32 */ + ZFS_IOC_OBJSET_RECVD_PROPS, /* 0x5a33 */ + ZFS_IOC_VDEV_SPLIT, /* 0x5a34 */ + ZFS_IOC_NEXT_OBJ, /* 0x5a35 */ + ZFS_IOC_DIFF, /* 0x5a36 */ + ZFS_IOC_TMP_SNAPSHOT, /* 0x5a37 */ + ZFS_IOC_OBJ_TO_STATS, /* 0x5a38 */ + ZFS_IOC_SPACE_WRITTEN, /* 0x5a39 */ + ZFS_IOC_SPACE_SNAPS, /* 0x5a3a */ + ZFS_IOC_DESTROY_SNAPS, /* 0x5a3b */ + ZFS_IOC_POOL_REGUID, /* 0x5a3c */ + ZFS_IOC_POOL_REOPEN, /* 0x5a3d */ + ZFS_IOC_SEND_PROGRESS, /* 0x5a3e */ + ZFS_IOC_LOG_HISTORY, /* 0x5a3f */ + ZFS_IOC_SEND_NEW, /* 0x5a40 */ + ZFS_IOC_SEND_SPACE, /* 0x5a41 */ + ZFS_IOC_CLONE, /* 0x5a42 */ + ZFS_IOC_BOOKMARK, /* 0x5a43 */ + ZFS_IOC_GET_BOOKMARKS, /* 0x5a44 */ + ZFS_IOC_DESTROY_BOOKMARKS, /* 0x5a45 */ + ZFS_IOC_POOL_SYNC, /* 0x5a47 */ + ZFS_IOC_CHANNEL_PROGRAM, /* 0x5a48 */ + ZFS_IOC_LOAD_KEY, /* 0x5a49 */ + ZFS_IOC_UNLOAD_KEY, /* 0x5a4a */ + ZFS_IOC_CHANGE_KEY, /* 0x5a4b */ + ZFS_IOC_REMAP, /* 0x5a4c */ + ZFS_IOC_POOL_CHECKPOINT, /* 0x5a4d */ + ZFS_IOC_POOL_DISCARD_CHECKPOINT, /* 0x5a4e */ + ZFS_IOC_POOL_INITIALIZE, /* 0x5a4f */ + ZFS_IOC_POOL_TRIM, /* 0x5a50 */ + ZFS_IOC_REDACT, /* 0x5a51 */ + ZFS_IOC_GET_BOOKMARK_PROPS, /* 0x5a52 */ + + /* + * Per-platform (Optional) - 8/128 numbers reserved. + */ + ZFS_IOC_PLATFORM = ZFS_IOC_FIRST + 0x80, + ZFS_IOC_EVENTS_NEXT, /* 0x81 (Linux) */ + ZFS_IOC_EVENTS_CLEAR, /* 0x82 (Linux) */ + ZFS_IOC_EVENTS_SEEK, /* 0x83 (Linux) */ + ZFS_IOC_NEXTBOOT, /* 0x84 (FreeBSD) */ + ZFS_IOC_JAIL, /* 0x85 (FreeBSD) */ + ZFS_IOC_UNJAIL, /* 0x86 (FreeBSD) */ + ZFS_IOC_SET_BOOTENV, /* 0x87 */ + ZFS_IOC_GET_BOOTENV, /* 0x88 */ ZFS_IOC_LAST } zfs_ioc_t; @@ -1270,6 +1297,11 @@ typedef enum { ZFS_ERR_FROM_IVSET_GUID_MISSING, ZFS_ERR_FROM_IVSET_GUID_MISMATCH, ZFS_ERR_SPILL_BLOCK_FLAG_MISSING, + ZFS_ERR_UNKNOWN_SEND_STREAM_FEATURE, + ZFS_ERR_IOC_CMD_UNAVAIL, + ZFS_ERR_IOC_ARG_UNAVAIL, + ZFS_ERR_IOC_ARG_REQUIRED, + ZFS_ERR_IOC_ARG_BADTYPE, } zfs_errno_t; /* diff --git a/usr/src/uts/common/sys/fsspriocntl.h b/usr/src/uts/common/sys/fsspriocntl.h index 66931e813b..4f61519a7c 100644 --- a/usr/src/uts/common/sys/fsspriocntl.h +++ b/usr/src/uts/common/sys/fsspriocntl.h @@ -27,8 +27,6 @@ #ifndef _SYS_FSSPRIOCNTL_H #define _SYS_FSSPRIOCNTL_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> #include <sys/fss.h> @@ -58,7 +56,7 @@ typedef struct fssinfo { #define FSS_KY_UPRI 2 /* user priority */ /* - * The following is used by the dispadmin(1M) command for scheduler + * The following is used by the dispadmin(8) command for scheduler * administration and is not for general use. */ typedef struct fssadmin { diff --git a/usr/src/uts/common/sys/fxpriocntl.h b/usr/src/uts/common/sys/fxpriocntl.h index feff8a2ad4..8a1c680ee9 100644 --- a/usr/src/uts/common/sys/fxpriocntl.h +++ b/usr/src/uts/common/sys/fxpriocntl.h @@ -27,8 +27,6 @@ #ifndef _SYS_FXPRIOCNTL_H #define _SYS_FXPRIOCNTL_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> #include <sys/thread.h> @@ -68,7 +66,7 @@ typedef struct fxinfo { /* - * The following is used by the dispadmin(1M) command for + * The following is used by the dispadmin(8) command for * scheduler administration and is not for general use. */ diff --git a/usr/src/uts/common/sys/iapriocntl.h b/usr/src/uts/common/sys/iapriocntl.h index b6dcd1162b..d35577f9e8 100644 --- a/usr/src/uts/common/sys/iapriocntl.h +++ b/usr/src/uts/common/sys/iapriocntl.h @@ -78,7 +78,7 @@ typedef struct iainfo { #define IA_KY_MODE 3 /* interactive on/off */ /* - * The following is used by the dispadmin(1M) command for + * The following is used by the dispadmin(8) command for * scheduler administration and is not for general use. */ diff --git a/usr/src/uts/common/sys/ib/clients/of/sol_uverbs/sol_uverbs_qp.h b/usr/src/uts/common/sys/ib/clients/of/sol_uverbs/sol_uverbs_qp.h index ca6665b83a..03f49b3b3c 100644 --- a/usr/src/uts/common/sys/ib/clients/of/sol_uverbs/sol_uverbs_qp.h +++ b/usr/src/uts/common/sys/ib/clients/of/sol_uverbs/sol_uverbs_qp.h @@ -41,7 +41,7 @@ extern "C" { * Definitions */ #define IBT_TO_OFA_QP_STATE(_state) ((_state) < IBT_STATE_SQDRAIN ? \ - (_state) : IBT_STATE_SQD) + (enum ib_qp_state)(_state) : IB_QPS_SQD) /* * Structures diff --git a/usr/src/uts/common/sys/ib/clients/rds/rdsib_buf.h b/usr/src/uts/common/sys/ib/clients/rds/rdsib_buf.h index 5e2f419600..164af2aa7a 100644 --- a/usr/src/uts/common/sys/ib/clients/rds/rdsib_buf.h +++ b/usr/src/uts/common/sys/ib/clients/rds/rdsib_buf.h @@ -75,8 +75,6 @@ #ifndef _RDSIB_BUF_H #define _RDSIB_BUF_H -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef __cplusplus extern "C" { #endif @@ -149,8 +147,8 @@ typedef struct rds_bufpool_s { } rds_bufpool_t; /* Global pools of buffers */ -rds_bufpool_t rds_dpool; /* data pool */ -rds_bufpool_t rds_cpool; /* ctrl pool */ +extern rds_bufpool_t rds_dpool; /* data pool */ +extern rds_bufpool_t rds_cpool; /* ctrl pool */ /* defined in rds_buf.c */ int rds_init_recv_caches(rds_state_t *statep); diff --git a/usr/src/uts/common/sys/ib/clients/rdsv3/rdsv3_impl.h b/usr/src/uts/common/sys/ib/clients/rdsv3/rdsv3_impl.h index 56b92f8037..c462306418 100644 --- a/usr/src/uts/common/sys/ib/clients/rdsv3/rdsv3_impl.h +++ b/usr/src/uts/common/sys/ib/clients/rdsv3/rdsv3_impl.h @@ -117,7 +117,7 @@ typedef unsigned int atomic_t; #define clear_le_bit(b, p) clear_bit(b ^ LE_BIT_XOR, p) #define test_le_bit(b, p) test_bit(b ^ LE_BIT_XOR, p) -uint_t rdsv3_one_sec_in_hz; +extern uint_t rdsv3_one_sec_in_hz; #define jiffies 100 #define HZ (drv_hztousec(1)) diff --git a/usr/src/uts/common/sys/ib/ibnex/ibnex.h b/usr/src/uts/common/sys/ib/ibnex/ibnex.h index f2928d8f4b..3b12a499fc 100644 --- a/usr/src/uts/common/sys/ib/ibnex/ibnex.h +++ b/usr/src/uts/common/sys/ib/ibnex/ibnex.h @@ -263,7 +263,7 @@ typedef struct ibnex_s { IBNEX_MAX_COMPAT_NAMES * IBNEX_MAX_COMPAT_LEN #define IBNEX_MAX_IBPORT_COMPAT_PROP_SZ \ IBNEX_MAX_IBPORT_COMPAT_NAMES * IBNEX_MAX_COMPAT_LEN -#define IBNEX_DEVFS_ENUMERATE 0x1 /* enumerate via devfs(7fs) */ +#define IBNEX_DEVFS_ENUMERATE 0x1 /* enumerate via devfs(4FS) */ #define IBNEX_CFGADM_ENUMERATE 0x2 /* enumerate via cfgadm */ #define IBNEX_MAX_NODEADDR_SZ 35 diff --git a/usr/src/uts/common/sys/ib/ibnex/ibnex_devctl.h b/usr/src/uts/common/sys/ib/ibnex/ibnex_devctl.h index c82b43b5a5..8d74d61c86 100644 --- a/usr/src/uts/common/sys/ib/ibnex/ibnex_devctl.h +++ b/usr/src/uts/common/sys/ib/ibnex/ibnex_devctl.h @@ -82,14 +82,14 @@ typedef enum ib_service_type_e { #define IBNEX_NODE_COND_NVL "node_condition" /* - * This flag is passed from cfgadm to ib(7d) to convey that it + * This flag is passed from cfgadm to ib(4D) to convey that it * need not attempt to probe the fabric. * * The value of these flags should be same as flags in enum * ibdm_ibnex_get_ioclist_mtd_t. */ #define IBNEX_DONOT_PROBE_FLAG 1 -#define IBNEX_NORMAL_PROBE 0 /* flag used by ib(7d) only */ +#define IBNEX_NORMAL_PROBE 0 /* flag used by ib(4D) only */ /* * The following are sub-commands to DEVCTL_AP_CONTROL. diff --git a/usr/src/uts/common/sys/ib/ibtl/impl/ibtl_ibnex.h b/usr/src/uts/common/sys/ib/ibtl/impl/ibtl_ibnex.h index 824d692306..4acabc9e86 100644 --- a/usr/src/uts/common/sys/ib/ibtl/impl/ibtl_ibnex.h +++ b/usr/src/uts/common/sys/ib/ibtl/impl/ibtl_ibnex.h @@ -118,7 +118,7 @@ void ibtl_ibnex_unregister_callback(); * alternate_HCA database * IBTL_IBNEX_UNCFG_CLNTS_FLAG - Build client devpaths/ * ap_id database - * callback - Callback function to get ap_id from ib(7d) + * callback - Callback function to get ap_id from ib(4D) * Output: * buffer - The information is returned in this buffer * bufsiz - The size of the information buffer @@ -192,7 +192,7 @@ ibt_status_t ibtl_ibnex_get_hca_verbose_data(ib_guid_t, char **, size_t *); * registered HCAs's dip. If match found return IBT_SUCCESS, * else IBT_NO_HCAS_AVAILABLE. * For IOC/Pseudo devices check if the given pdip is that of - * the ib(7d) nexus. If yes return IBT_SUCCESS, + * the ib(4D) nexus. If yes return IBT_SUCCESS, * else IBT_NO_HCAS_AVAILABLE. */ ibt_status_t ibtl_ibnex_valid_hca_parent(dev_info_t *); diff --git a/usr/src/uts/common/sys/idm/idm_impl.h b/usr/src/uts/common/sys/idm/idm_impl.h index 346611719d..1e816ee211 100644 --- a/usr/src/uts/common/sys/idm/idm_impl.h +++ b/usr/src/uts/common/sys/idm/idm_impl.h @@ -472,7 +472,7 @@ typedef struct { kmem_cache_t *idm_so_128k_buf_cache; } idm_global_t; -idm_global_t idm; /* Global state */ +extern idm_global_t idm; /* Global state */ int idm_idpool_create(idm_idpool_t *pool); diff --git a/usr/src/uts/common/sys/int_types.h b/usr/src/uts/common/sys/int_types.h index e57d6f8b75..8f7c423643 100644 --- a/usr/src/uts/common/sys/int_types.h +++ b/usr/src/uts/common/sys/int_types.h @@ -173,6 +173,9 @@ typedef long long int_least64_t; #endif #endif +/* + * If these are changed, please update char16_t and char32_t in head/uchar.h. + */ typedef unsigned char uint_least8_t; typedef unsigned short uint_least16_t; typedef unsigned int uint_least32_t; diff --git a/usr/src/uts/common/sys/kcpc.h b/usr/src/uts/common/sys/kcpc.h index d90b1c1d29..9644d019e3 100644 --- a/usr/src/uts/common/sys/kcpc.h +++ b/usr/src/uts/common/sys/kcpc.h @@ -199,13 +199,12 @@ extern int kcpc_overflow_ast(void); extern uint_t kcpc_hw_overflow_intr(caddr_t, caddr_t); extern int kcpc_hw_cpu_hook(int cpuid, ulong_t *kcpc_cpumap); extern int kcpc_hw_lwp_hook(void); -extern void kcpc_idle_save(struct cpu *cp); -extern void kcpc_idle_restore(struct cpu *cp); +extern void kcpc_idle_ctxop_install(struct _kthread *, struct cpu *); extern krwlock_t kcpc_cpuctx_lock; /* lock for 'kcpc_cpuctx' below */ extern int kcpc_cpuctx; /* number of cpu-specific contexts */ -extern void kcpc_free(kcpc_ctx_t *ctx, int isexec); +extern void kcpc_free_cpu(kcpc_ctx_t *); /* * 'dtrace_cpc_in_use' contains the number of currently active cpc provider diff --git a/usr/src/uts/common/sys/kfpu.h b/usr/src/uts/common/sys/kfpu.h new file mode 100644 index 0000000000..a8a8c9a649 --- /dev/null +++ b/usr/src/uts/common/sys/kfpu.h @@ -0,0 +1,64 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2020 Joyent, Inc. + */ + +#ifndef _SYS_KFPU_H +#define _SYS_KFPU_H + +/* + * This header file provides a means for the kernel to opt into using the FPU. + * Care should be exercised when using the FPU. + */ + +#include <sys/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct kfpu_state kfpu_state_t; + +/* + * Allocate a new kernel FPU state. This may be allocated at a time independent + * from its use. It will stay around until such a time as kernel_fpu_free() is + * called. A given kernel FPU state may only be used by a single thread at any + * time; however, it is not bound to a given thread. + */ +extern kfpu_state_t *kernel_fpu_alloc(int); +extern void kernel_fpu_free(kfpu_state_t *); + +/* + * These functions begin and end the use of the kernel FPU. Once this is called, + * a given kernel thread will be allowed to use the FPU. This will be saved and + * restored across context switches. + */ +extern void kernel_fpu_begin(kfpu_state_t *, uint_t); +extern void kernel_fpu_end(kfpu_state_t *, uint_t); + +/* + * Internal validation function. + */ +extern void kernel_fpu_no_swtch(void); + +/* + * Flag definitions for kernel_fpu_begin and kernel_fpu_end. + */ +#define KFPU_NO_STATE 0x01 /* kfpu_state_t not passed; use preemption */ +#define KFPU_USE_LWP 0x02 /* kfpu_state_t not passed; use lwp */ + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_KFPU_H */ diff --git a/usr/src/uts/common/sys/kmem.h b/usr/src/uts/common/sys/kmem.h index aac2eafa3c..bfc301a521 100644 --- a/usr/src/uts/common/sys/kmem.h +++ b/usr/src/uts/common/sys/kmem.h @@ -23,7 +23,7 @@ * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. * Copyright 2013 Nexenta Systems, Inc. All rights reserved. - * Copyright 2018, Joyent, Inc. + * Copyright 2022 Joyent, Inc. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ @@ -49,6 +49,7 @@ extern "C" { #define KM_PANIC 0x0002 /* if memory cannot be allocated, panic */ #define KM_PUSHPAGE 0x0004 /* can block for memory; may use reserve */ #define KM_NORMALPRI 0x0008 /* with KM_NOSLEEP, lower priority allocation */ +#define KM_NOSLEEP_LAZY (KM_NOSLEEP | KM_NORMALPRI) /* Syntactic sugar. */ #define KM_VMFLAGS 0x00ff /* flags that must match VM_* flags */ #define KM_FLAGS 0xffff /* all settable kmem flags */ diff --git a/usr/src/uts/common/sys/ksensor_impl.h b/usr/src/uts/common/sys/ksensor_impl.h new file mode 100644 index 0000000000..7407a264a2 --- /dev/null +++ b/usr/src/uts/common/sys/ksensor_impl.h @@ -0,0 +1,52 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2020 Oxide Computer Company + */ + +#ifndef _SYS_KSENSOR_IMPL_H +#define _SYS_KSENSOR_IMPL_H + +/* + * ksensor implementation glue. + */ + +#include <sys/sensors.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Routine for the kernel to initalize the subsystem. + */ +extern void ksensor_init(void); + +/* + * Operations vectors. + */ +extern int ksensor_op_kind(id_t, sensor_ioctl_kind_t *); +extern int ksensor_op_scalar(id_t, sensor_ioctl_scalar_t *); + +/* + * Registration callbacks. + */ +typedef int (*ksensor_create_f)(id_t, const char *, const char *); +typedef void (*ksensor_remove_f)(id_t, const char *); +extern int ksensor_register(dev_info_t *, ksensor_create_f, ksensor_remove_f); +extern void ksensor_unregister(dev_info_t *); + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_KSENSOR_IMPL_H */ diff --git a/usr/src/uts/common/sys/ksocket.h b/usr/src/uts/common/sys/ksocket.h index d720caa631..abf6bccfa5 100644 --- a/usr/src/uts/common/sys/ksocket.h +++ b/usr/src/uts/common/sys/ksocket.h @@ -84,47 +84,68 @@ typedef struct ksocket_callbacks { #define KSOCKET_SLEEP SOCKET_SLEEP #define KSOCKET_NOSLEEP SOCKET_NOSLEEP -extern int ksocket_socket(ksocket_t *, int, int, int, int, struct cred *); -extern int ksocket_bind(ksocket_t, struct sockaddr *, socklen_t, +extern int ksocket_socket(ksocket_t *, int, int, int, int, struct cred *); +extern int ksocket_bind(ksocket_t, struct sockaddr *, socklen_t, struct cred *); -extern int ksocket_listen(ksocket_t, int, struct cred *); -extern int ksocket_accept(ksocket_t, struct sockaddr *, socklen_t *, +extern int ksocket_listen(ksocket_t, int, struct cred *); +extern int ksocket_accept(ksocket_t, struct sockaddr *, socklen_t *, ksocket_t *, struct cred *); -extern int ksocket_connect(ksocket_t, struct sockaddr *, socklen_t, +extern int ksocket_connect(ksocket_t, struct sockaddr *, socklen_t, struct cred *); -extern int ksocket_send(ksocket_t, void *, size_t, int, size_t *, +extern int ksocket_send(ksocket_t, void *, size_t, int, size_t *, struct cred *); extern int ksocket_sendto(ksocket_t, void *, size_t, int, struct sockaddr *, socklen_t, size_t *, struct cred *); -extern int ksocket_sendmsg(ksocket_t, struct nmsghdr *, int, size_t *, +extern int ksocket_sendmsg(ksocket_t, struct nmsghdr *, int, size_t *, struct cred *); extern int ksocket_sendmblk(ksocket_t, struct nmsghdr *, int, struct msgb **, struct cred *); -extern int ksocket_recv(ksocket_t, void *, size_t, int, size_t *, +extern int ksocket_recv(ksocket_t, void *, size_t, int, size_t *, struct cred *); extern int ksocket_recvfrom(ksocket_t, void *, size_t, int, struct sockaddr *, socklen_t *, size_t *, struct cred *); extern int ksocket_recvmsg(ksocket_t, struct nmsghdr *, int, size_t *, struct cred *); extern int ksocket_shutdown(ksocket_t, int, struct cred *); -extern int ksocket_setsockopt(ksocket_t, int, int, const void *, int, +extern int ksocket_setsockopt(ksocket_t, int, int, const void *, int, struct cred *); -extern int ksocket_getsockopt(ksocket_t, int, int, void *, int *, +extern int ksocket_getsockopt(ksocket_t, int, int, void *, int *, struct cred *); -extern int ksocket_getpeername(ksocket_t, struct sockaddr *, socklen_t *, +extern int ksocket_getpeername(ksocket_t, struct sockaddr *, socklen_t *, struct cred *); -extern int ksocket_getsockname(ksocket_t, struct sockaddr *, socklen_t *, +extern int ksocket_getsockname(ksocket_t, struct sockaddr *, socklen_t *, struct cred *); extern int ksocket_ioctl(ksocket_t, int, intptr_t, int *, struct cred *); extern int ksocket_spoll(ksocket_t, int, short, short *, struct cred *); extern int ksocket_setcallbacks(ksocket_t, ksocket_callbacks_t *, void *, struct cred *); -extern int ksocket_close(ksocket_t, struct cred *); +extern int ksocket_close(ksocket_t, struct cred *); extern void ksocket_hold(ksocket_t); extern void ksocket_rele(ksocket_t); +/* + * These functions allow an alternative way for a ksocket to directly + * receive data when it arrives in sockfs rather than having it queued + * in a socket buffer that it must separately poll. The use of this + * results in no data being queued in sockfs. + * + * When the receive function receives data, it is responsible for always + * consuming all of the data. The return value of the callback function + * is used to indicate flow control and backpressure (similar to + * mac_tx(9E)). If, after processing the data, additional data can be + * received and processed, then the callback function should return + * B_TRUE. Otherwise it should return B_FALSE. This will result in the + * lower level socket interfaces (e.g. TCP) understanding that + * backpressure has been asserted (as though the sockfs buffer is full). + * + * Once whatever conditions that caused the callback function to assert + * that it needed to assert flow control are done, then it must call + * ksocket_krecv_unblock() to allow the flow to continue. If the receive + * callback ever returns B_FALSE there will generally be no additional + * data received until this is called. + */ typedef boolean_t (*ksocket_krecv_f)(ksocket_t, struct msgb *, size_t, int, - void *); + void *); extern int ksocket_krecv_set(ksocket_t, ksocket_krecv_f, void *); extern void ksocket_krecv_unblock(ksocket_t); diff --git a/usr/src/uts/common/sys/lofi.h b/usr/src/uts/common/sys/lofi.h index f57388a098..f5285149fa 100644 --- a/usr/src/uts/common/sys/lofi.h +++ b/usr/src/uts/common/sys/lofi.h @@ -137,7 +137,7 @@ extern "C" { * torn down. * * Oh, and last but not least: these ioctls are totally private and only - * for use by lofiadm(1M). + * for use by lofiadm(8). * */ diff --git a/usr/src/uts/common/sys/log.h b/usr/src/uts/common/sys/log.h index 2d1fb46b73..934b4111fd 100644 --- a/usr/src/uts/common/sys/log.h +++ b/usr/src/uts/common/sys/log.h @@ -30,8 +30,6 @@ #ifndef _SYS_LOG_H #define _SYS_LOG_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> #include <sys/strlog.h> #include <sys/stream.h> @@ -55,7 +53,7 @@ extern "C" { #define LOG_HIWAT 1048576 /* threshold for tossing messages */ #define LOG_MAGIC 0xf00d4109U /* "food for log" - unsent msg magic */ -#define LOG_RECENTSIZE 8192 /* queue of most recent messages */ +#define LOG_RECENTSIZE 65536 /* queue of most recent messages */ #define LOG_MINFREE 4096 /* message cache low water mark */ #define LOG_MAXFREE 8192 /* message cache high water mark */ diff --git a/usr/src/uts/common/sys/mac.h b/usr/src/uts/common/sys/mac.h index 1d7ddf9648..da2cff93a7 100644 --- a/usr/src/uts/common/sys/mac.h +++ b/usr/src/uts/common/sys/mac.h @@ -23,6 +23,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2018 Joyent, Inc. * Copyright (c) 2015 Garrett D'Amore <garrett@damore.org> + * Copyright 2020 RackTop Systems, Inc. */ #ifndef _SYS_MAC_H @@ -42,7 +43,7 @@ extern "C" { #endif /* - * MAC Information (text emitted by modinfo(1m)) + * MAC Information (text emitted by modinfo(8)) */ #define MAC_INFO "MAC Services" @@ -88,6 +89,13 @@ typedef enum { } link_flowctrl_t; typedef enum { + LINK_FEC_NONE = 1 << 0, + LINK_FEC_AUTO = 1 << 1, + LINK_FEC_RS = 1 << 2, + LINK_FEC_BASE_R = 1 << 3 +} link_fec_t; + +typedef enum { LINK_TAGMODE_VLANONLY = 0, LINK_TAGMODE_NORMAL } link_tagmode_t; @@ -105,7 +113,7 @@ typedef struct mac_propval_uint32_range_s { */ typedef struct mac_propval_str_range_s { uint32_t mpur_nextbyte; - char mpur_data[1]; + char mpur_data[]; } mac_propval_str_range_t; /* @@ -163,6 +171,7 @@ typedef enum { * Please append properties to the end of this list. Do not reorder the list. */ typedef enum { + MAC_PROP_PRIVATE = -1, MAC_PROP_DUPLEX = 0x00000001, MAC_PROP_SPEED, MAC_PROP_STATUS, @@ -239,7 +248,8 @@ typedef enum { MAC_PROP_EN_25GFDX_CAP, MAC_PROP_ADV_50GFDX_CAP, MAC_PROP_EN_50GFDX_CAP, - MAC_PROP_PRIVATE = -1 + MAC_PROP_EN_FEC_CAP, + MAC_PROP_ADV_FEC_CAP } mac_prop_id_t; /* @@ -583,7 +593,7 @@ typedef struct mactype_ops_s { * Note that the ndd ioctls are obsolete, and may be removed in a future * release of Solaris. The ndd ioctls are not typically used in legacy * ethernet drivers. New datalink drivers of all link-types should use - * dladm(1m) interfaces for administering tunables and not have to provide + * dladm(8) interfaces for administering tunables and not have to provide * a mapping. */ typedef struct mac_ndd_mapping_s { diff --git a/usr/src/uts/common/sys/mac_flow.h b/usr/src/uts/common/sys/mac_flow.h index d37752ec23..a9a2a5f61e 100644 --- a/usr/src/uts/common/sys/mac_flow.h +++ b/usr/src/uts/common/sys/mac_flow.h @@ -23,6 +23,7 @@ * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * Copyright 2017 Joyent, Inc. All rights reserved. + * Copyright 2020 RackTop Systems, Inc. */ #ifndef _MAC_FLOW_H @@ -92,7 +93,7 @@ typedef struct flow_desc_s { uint8_t fd_dsfield_mask; } flow_desc_t; -#define MRP_NCPUS 128 +#define MRP_NCPUS 256 /* * In MCM_CPUS mode, cpu bindings is user specified. In MCM_FANOUT mode, @@ -118,7 +119,7 @@ typedef struct mac_tx_intr_cpus_s { typedef struct mac_cpus_props_s { uint32_t mc_ncpus; /* num of cpus */ - uint32_t mc_cpus[MRP_NCPUS]; /* cpu list */ + uint32_t mc_cpus[MRP_NCPUS]; /* cpu list */ uint32_t mc_rx_fanout_cnt; /* soft ring cpu cnt */ uint32_t mc_rx_fanout_cpus[MRP_NCPUS]; /* SR cpu list */ uint32_t mc_rx_pollid; /* poll thr binding */ @@ -198,10 +199,10 @@ typedef struct mac_protect_s { /* The default priority for flows */ #define MPL_SUBFLOW_DEFAULT MPL_MEDIUM -#define MRP_MAXBW 0x00000001 /* Limit set */ -#define MRP_CPUS 0x00000002 /* CPU/fanout set */ -#define MRP_CPUS_USERSPEC 0x00000004 /* CPU/fanout from user */ -#define MRP_PRIORITY 0x00000008 /* Priority set */ +#define MRP_MAXBW 0x00000001 /* Limit set */ +#define MRP_CPUS 0x00000002 /* CPU/fanout set */ +#define MRP_CPUS_USERSPEC 0x00000004 /* CPU/fanout from user */ +#define MRP_PRIORITY 0x00000008 /* Priority set */ #define MRP_PROTECT 0x00000010 /* Protection set */ #define MRP_RX_RINGS 0x00000020 /* Rx rings */ #define MRP_TX_RINGS 0x00000040 /* Tx rings */ diff --git a/usr/src/uts/common/sys/mac_impl.h b/usr/src/uts/common/sys/mac_impl.h index 3c103c073a..21f2c10a8e 100644 --- a/usr/src/uts/common/sys/mac_impl.h +++ b/usr/src/uts/common/sys/mac_impl.h @@ -290,54 +290,6 @@ struct mac_group_s { #define GROUP_INTR_ENABLE_FUNC(g) (g)->mrg_info.mgi_intr.mi_enable #define GROUP_INTR_DISABLE_FUNC(g) (g)->mrg_info.mgi_intr.mi_disable -#define MAC_RING_TX(mhp, rh, mp, rest) { \ - mac_ring_handle_t mrh = rh; \ - mac_impl_t *mimpl = (mac_impl_t *)mhp; \ - /* \ - * Send packets through a selected tx ring, or through the \ - * default handler if there is no selected ring. \ - */ \ - if (mrh == NULL) \ - mrh = mimpl->mi_default_tx_ring; \ - if (mrh == NULL) { \ - rest = mimpl->mi_tx(mimpl->mi_driver, mp); \ - } else { \ - rest = mac_hwring_tx(mrh, mp); \ - } \ -} - -/* - * This is the final stop before reaching the underlying driver - * or aggregation, so this is where the bridging hook is implemented. - * Packets that are bridged will return through mac_bridge_tx(), with - * rh nulled out if the bridge chooses to send output on a different - * link due to forwarding. - */ -#define MAC_TX(mip, rh, mp, src_mcip) { \ - mac_ring_handle_t rhandle = (rh); \ - /* \ - * If there is a bound Hybrid I/O share, send packets through \ - * the default tx ring. (When there's a bound Hybrid I/O share, \ - * the tx rings of this client are mapped in the guest domain \ - * and not accessible from here.) \ - */ \ - _NOTE(CONSTANTCONDITION) \ - if ((src_mcip)->mci_state_flags & MCIS_SHARE_BOUND) \ - rhandle = (mip)->mi_default_tx_ring; \ - if (mip->mi_promisc_list != NULL) \ - mac_promisc_dispatch(mip, mp, src_mcip); \ - /* \ - * Grab the proper transmit pointer and handle. Special \ - * optimization: we can test mi_bridge_link itself atomically, \ - * and if that indicates no bridge send packets through tx ring.\ - */ \ - if (mip->mi_bridge_link == NULL) { \ - MAC_RING_TX(mip, rhandle, mp, mp); \ - } else { \ - mp = mac_bridge_tx(mip, rhandle, mp); \ - } \ -} - /* mci_tx_flag */ #define MCI_TX_QUIESCE 0x1 diff --git a/usr/src/uts/common/sys/mac_provider.h b/usr/src/uts/common/sys/mac_provider.h index fc3b3892bd..431de67ff5 100644 --- a/usr/src/uts/common/sys/mac_provider.h +++ b/usr/src/uts/common/sys/mac_provider.h @@ -22,6 +22,7 @@ /* * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, Joyent, Inc. + * Copyright 2020 RackTop Systems, Inc. */ #ifndef _SYS_MAC_PROVIDER_H @@ -109,7 +110,7 @@ typedef enum { MAC_CAPAB_LEGACY = 0x00200000, /* data is mac_capab_legacy_t */ MAC_CAPAB_VRRP = 0x00400000, /* data is mac_capab_vrrp_t */ MAC_CAPAB_OVERLAY = 0x00800000, /* boolean only, no data */ - MAC_CAPAB_TRANSCEIVER = 0x01000000, /* mac_capab_transciever_t */ + MAC_CAPAB_TRANSCEIVER = 0x01000000, /* mac_capab_transceiver_t */ MAC_CAPAB_LED = 0x02000000 /* data is mac_capab_led_t */ } mac_capab_t; @@ -120,10 +121,15 @@ typedef struct lso_basic_tcp_ipv4_s { t_uscalar_t lso_max; /* maximum payload */ } lso_basic_tcp_ipv4_t; +typedef struct lso_basic_tcp_ipv6_s { + t_uscalar_t lso_max; /* maximum payload */ +} lso_basic_tcp_ipv6_t; + /* * Currently supported flags for LSO. */ -#define LSO_TX_BASIC_TCP_IPV4 0x01 /* TCP LSO capability */ +#define LSO_TX_BASIC_TCP_IPV4 0x01 /* TCPv4 LSO capability */ +#define LSO_TX_BASIC_TCP_IPV6 0x02 /* TCPv6 LSO capability */ /* * Future LSO capabilities can be added at the end of the mac_capab_lso_t. @@ -136,6 +142,7 @@ typedef struct lso_basic_tcp_ipv4_s { typedef struct mac_capab_lso_s { t_uscalar_t lso_flags; lso_basic_tcp_ipv4_t lso_basic_tcp_ipv4; + lso_basic_tcp_ipv6_t lso_basic_tcp_ipv6; /* Add future lso capabilities here */ } mac_capab_lso_t; @@ -625,6 +632,8 @@ extern void mac_prop_info_set_default_uint32( mac_prop_info_handle_t, uint32_t); extern void mac_prop_info_set_default_link_flowctrl( mac_prop_info_handle_t, link_flowctrl_t); +extern void mac_prop_info_set_default_fec( + mac_prop_info_handle_t, link_fec_t); extern void mac_prop_info_set_range_uint32( mac_prop_info_handle_t, uint32_t, uint32_t); @@ -647,6 +656,31 @@ extern void mac_transceiver_info_set_usable( mac_transceiver_info_t *, boolean_t); +/* + * This represents a provisional set of currently illumos-private APIs to get + * information about a mblk_t chain's type. This is an evolving interface. + */ +typedef enum mac_ether_offload_flags { + MEOI_L2INFO_SET = 1 << 0, + MEOI_VLAN_TAGGED = 1 << 1, + MEOI_L3INFO_SET = 1 << 2, + MEOI_L4INFO_SET = 1 << 3 +} mac_ether_offload_flags_t; + +typedef struct mac_ether_offload_info { + mac_ether_offload_flags_t meoi_flags; /* What's valid? */ + size_t meoi_len; /* Total message length */ + uint8_t meoi_l2hlen; /* How long is the Ethernet header? */ + uint16_t meoi_l3proto; /* What's the Ethertype */ + uint8_t meoi_l3hlen; /* How long is the header? */ + uint8_t meoi_l4proto; /* What is the payload type? */ + uint8_t meoi_l4hlen; /* How long is the L4 header */ +} mac_ether_offload_info_t; + +extern int mac_ether_offload_info(mblk_t *, + mac_ether_offload_info_t *); + + #endif /* _KERNEL */ #ifdef __cplusplus diff --git a/usr/src/uts/common/sys/mac_wifi.h b/usr/src/uts/common/sys/mac_wifi.h index 2ff46dbc6c..425c1a6613 100644 --- a/usr/src/uts/common/sys/mac_wifi.h +++ b/usr/src/uts/common/sys/mac_wifi.h @@ -50,7 +50,7 @@ extern "C" { sizeof (struct ieee80211_llc)) enum wifi_stat { - /* statistics described in ieee802.11(5) */ + /* statistics described in ieee802.11(7) */ WIFI_STAT_TX_FRAGS = MACTYPE_STAT_MIN, WIFI_STAT_MCAST_TX, WIFI_STAT_TX_FAILED, diff --git a/usr/src/uts/common/sys/mem.h b/usr/src/uts/common/sys/mem.h index c73a1b6e95..ff265b185c 100644 --- a/usr/src/uts/common/sys/mem.h +++ b/usr/src/uts/common/sys/mem.h @@ -68,7 +68,7 @@ typedef struct mem_vtop32 { #endif /* - * Private ioctls for fmd(1M). These interfaces are Sun Private. Applications + * Private ioctls for fmd(8). These interfaces are Sun Private. Applications * and drivers should not make use of these interfaces: they can change without * notice and programs that consume them will fail to run on future releases. */ @@ -86,7 +86,7 @@ typedef struct mem_vtop32 { #define MEM_SID (('M' << 8) | 0x0B) /* - * Bits returned from MEM_PAGE_GETERRORS ioctl for use by fmd(1M). + * Bits returned from MEM_PAGE_GETERRORS ioctl for use by fmd(8). */ #define MEM_PAGE_ERR_NONE 0x0 #define MEM_PAGE_ERR_MULTI_CE 0x1 diff --git a/usr/src/uts/common/sys/mhd.h b/usr/src/uts/common/sys/mhd.h index 66d57266ad..3d7e0d5d5a 100644 --- a/usr/src/uts/common/sys/mhd.h +++ b/usr/src/uts/common/sys/mhd.h @@ -27,8 +27,6 @@ #ifndef _SYS_MHD_H #define _SYS_MHD_H -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef __cplusplus extern "C" { #endif @@ -41,8 +39,8 @@ extern "C" { #define MHIOCTKOWN (MHIOC|2) #define MHIOCRELEASE (MHIOC|3) #define MHIOCSTATUS (MHIOC|4) -#define MHIOCGRP_INKEYS (MHIOC|5) -#define MHIOCGRP_INRESV (MHIOC|6) +#define MHIOCGRP_INKEYS (MHIOC|5) +#define MHIOCGRP_INRESV (MHIOC|6) #define MHIOCGRP_REGISTER (MHIOC|7) #define MHIOCGRP_RESERVE (MHIOC|8) #define MHIOCGRP_PREEMPTANDABORT (MHIOC|9) @@ -79,13 +77,13 @@ typedef struct mhioc_inkeys { } mhioc_inkeys_t; #if defined(_SYSCALL32) -struct mhioc_key_list32 { +typedef struct mhioc_key_list32 { uint32_t listsize; uint32_t listlen; caddr32_t list; } mhioc_key_list32_t; -struct mhioc_inkeys32 { +typedef struct mhioc_inkeys32 { uint32_t generation; caddr32_t li; } mhioc_inkeys32_t; @@ -110,7 +108,7 @@ typedef struct mhioc_inresvs { } mhioc_inresvs_t; #if defined(_SYSCALL32) -struct mhioc_resv_desc_list32 { +typedef struct mhioc_resv_desc_list32 { uint32_t listsize; uint32_t listlen; caddr32_t list; diff --git a/usr/src/uts/common/sys/mixer.h b/usr/src/uts/common/sys/mixer.h index 9abcd6121d..e50ad9fc47 100644 --- a/usr/src/uts/common/sys/mixer.h +++ b/usr/src/uts/common/sys/mixer.h @@ -81,7 +81,7 @@ struct am_control { audio_info_t dev_info; /* - * The mixer(7I) manual page shows an example of using the ch_open[] + * The mixer(4I) manual page shows an example of using the ch_open[] * array. Each element that is set to 0 represents a channel which * isn't allocated, and non-zero elements represent a channel that is * alloacted. This size of this array may change, depending on the @@ -111,7 +111,7 @@ struct am_sample_rates { /* * Set this number to the number of sample rates to request. The - * mixer(7I) manual page shows an example of using this structure. + * mixer(4I) manual page shows an example of using this structure. * When AUDIO_MIXER_GET_SAMPLE_RATES returns the number of samples * available is set. This may be more or less than the number requested. * If more that only the requested number of samples is arctually @@ -121,7 +121,7 @@ struct am_sample_rates { /* * Variable size array for the supported sample rates. See the example - * in the mixer(7I) manual page for how to use this array. + * in the mixer(4I) manual page for how to use this array. */ uint_t samp_rates[1]; }; diff --git a/usr/src/uts/common/sys/mman.h b/usr/src/uts/common/sys/mman.h index 65819c1209..7dec4371b7 100644 --- a/usr/src/uts/common/sys/mman.h +++ b/usr/src/uts/common/sys/mman.h @@ -26,6 +26,7 @@ * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * Copyright 2015 Joyent, Inc. All rights reserved. + * Copyright 2022 Oxide Computer Company */ /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ @@ -46,6 +47,15 @@ #include <sys/feature_tests.h> +/* + * <sys/mman.h> has had a bit of a tortured symbol visibility history. In + * particular, when things were honored under __EXTENSIONS__ or not in the past + * wasn't very consistent. As this was not a header that was part of ISO-C it + * traditionally just checked around XOPEN/POSIX related feature tests. This + * makes the use of the standard _STRICT_POSIX something that actually is more + * restrictive than previously was used. + */ + #ifdef __cplusplus extern "C" { #endif @@ -68,7 +78,7 @@ extern "C" { #define PROT_EXEC 0x4 /* pages can be executed */ #ifdef _KERNEL -#define PROT_USER 0x8 /* pages are user accessable */ +#define PROT_USER 0x8 /* pages are user accessible */ #define PROT_ZFOD (PROT_READ | PROT_WRITE | PROT_EXEC | PROT_USER) #define PROT_ALL (PROT_READ | PROT_WRITE | PROT_EXEC | PROT_USER) #endif /* _KERNEL */ @@ -93,25 +103,19 @@ extern "C" { #define MAP_TEXT 0x400 /* map code segment */ #define MAP_INITDATA 0x800 /* map data segment */ +/* + * Internal to the kernel, extensions to mmap flags. + */ #ifdef _KERNEL #define _MAP_TEXTREPL 0x1000 #define _MAP_RANDOMIZE 0x2000 #endif /* _KERNEL */ -#if (_POSIX_C_SOURCE <= 2) && !defined(_XPG4_2) -/* these flags are used by memcntl */ -#define PROC_TEXT (PROT_EXEC | PROT_READ) -#define PROC_DATA (PROT_READ | PROT_WRITE | PROT_EXEC) -#define SHARED 0x10 -#define PRIVATE 0x20 -#define VALID_ATTR (PROT_READ|PROT_WRITE|PROT_EXEC|SHARED|PRIVATE) -#endif /* (_POSIX_C_SOURCE <= 2) && !defined(_XPG4_2) */ - -#if (_POSIX_C_SOURCE <= 2) || defined(_XPG4_2) -#ifdef _KERNEL -#define PROT_EXCL 0x20 -#endif /* _KERNEL */ - +/* + * Extensions to mmap flags. These are available in the default compilation + * environment, but not in a strict environment. + */ +#if !defined(_STRICT_POSIX) #define _MAP_LOW32 0x80 /* force mapping in lower 4G of address space */ #define MAP_32BIT _MAP_LOW32 @@ -125,10 +129,9 @@ extern "C" { * unless the MAP_FIXED flag is given. */ #define _MAP_NEW 0x80000000 /* users should not need to use this */ -#endif /* (_POSIX_C_SOURCE <= 2) */ +#endif /* !defined(_STRICT_POSIX) */ - -#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +#if !defined(_STRICT_POSIX) /* External flags for mmapobj syscall (Exclusive of MAP_* flags above) */ #define MMOBJ_PADDING 0x10000 #define MMOBJ_INTERPRET 0x20000 @@ -190,7 +193,7 @@ typedef struct mmapobj_result32 { } mmapobj_result32_t; #endif /* defined(_KERNEL) || defined(_SYSCALL32) */ #endif /* !defined(_ASM) */ -#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ +#endif /* !defined(_STRICT_POSIX) */ #if !defined(_ASM) && !defined(_KERNEL) /* @@ -223,34 +226,50 @@ typedef struct mmapobj_result32 { #endif /* - * Except for old binaries mmap() will return the resultant - * address of mapping on success and (caddr_t)-1 on error. + * Except for old binaries mmap() will return the resultant address of mapping + * on success and (void *)-1 on error. illumos traditionally used a 'caddr_t' + * instead of a void * and did not require certain addresses to be const. + * + * Note, the following group of symbols are always visible since we have always + * exposed them and they appear to have been defined in most relevant versions + * of the specifications. While these are not strictly defined in ISO C, this + * header isn't a part of it and it isn't our job to guard against that. */ -#if (_POSIX_C_SOURCE > 2) || defined(_XPG4_2) extern void *mmap(void *, size_t, int, int, int, off_t); extern int munmap(void *, size_t); extern int mprotect(void *, size_t, int); extern int msync(void *, size_t, int); -#if (!defined(_XPG4_2) || (_POSIX_C_SOURCE > 2)) || defined(__EXTENSIONS__) -extern int mlock(const void *, size_t); -extern int munlock(const void *, size_t); -#endif /* (!defined(_XPG4_2) || (_POSIX_C_SOURCE > 2))... */ -/* transitional large file interface version */ + #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ !defined(__PRAGMA_REDEFINE_EXTNAME)) extern void *mmap64(void *, size_t, int, int, int, off64_t); -#endif /* _LARGEFILE64_SOURCE... */ -#else /* (_POSIX_C_SOURCE > 2) || defined(_XPG4_2) */ -extern caddr_t mmap(caddr_t, size_t, int, int, int, off_t); -extern int munmap(caddr_t, size_t); -extern int mprotect(caddr_t, size_t, int); -extern int msync(caddr_t, size_t, int); -extern int mlock(caddr_t, size_t); -extern int munlock(caddr_t, size_t); +#endif /* _LARGEFILE64_SOURCE... */ + +/* + * These functions were all part of the older POSIX realtime suite and didn't + * make it into XPG until v5. + */ + +#if !defined(_STRICT_POSIX) || (_POSIX_C_SOURCE > 2) || defined(_XPG5) +extern int mlock(const void *, size_t); +extern int munlock(const void *, size_t); +extern int mlockall(int); +extern int munlockall(void); +extern int shm_open(const char *, int, mode_t); +extern int shm_unlink(const char *); +#endif /* !_STRICT_POSIX || _POSIX_C_SOURCE > 2 || _XPG5 */ + +#if !defined(_STRICT_POSIX) || defined(_XPG6) +extern int posix_madvise(void *, size_t, int); +#endif + +/* + * The following are extensions that we have added. + */ +#if !defined(_STRICT_POSIX) extern int mincore(caddr_t, size_t, char *); -extern int memcntl(caddr_t, size_t, int, caddr_t, int, int); -extern int madvise(caddr_t, size_t, int); -#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +extern int memcntl(void *, size_t, int, void *, int, int); +extern int madvise(void *, size_t, int); extern int getpagesizes(size_t *, int); extern int getpagesizes2(size_t *, int); extern int mmapobj(int, uint_t, mmapobj_result_t *, uint_t *, void *); @@ -259,52 +278,34 @@ extern int mmapobj(int, uint_t, mmapobj_result_t *, uint_t *, void *); extern int meminfo(const uint64_t *, int, const uint_t *, int, uint64_t *, uint_t *); #endif /* defined(_INT64_TYPE) */ -#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ -/* transitional large file interface version */ -#ifdef _LARGEFILE64_SOURCE -extern caddr_t mmap64(caddr_t, size_t, int, int, int, off64_t); -#endif -#endif /* (_POSIX_C_SOURCE > 2) || defined(_XPG4_2) */ - -#if (!defined(_XPG4_2) || (_POSIX_C_SOURCE > 2)) || defined(__EXTENSIONS__) -extern int mlockall(int); -extern int munlockall(void); -extern int shm_open(const char *, int, mode_t); -extern int shm_unlink(const char *); -#endif +#endif /* !defined(_STRICT_POSIX) */ -#if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__) -extern int posix_madvise(void *, size_t, int); -#endif /* mmap failure value */ #define MAP_FAILED ((void *) -1) - #endif /* !_ASM && !_KERNEL */ -#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) +#if !defined(_STRICT_POSIX) #if !defined(_ASM) /* * structure for memcntl hat advise operations. */ struct memcntl_mha { - uint_t mha_cmd; /* command(s) */ + uint_t mha_cmd; /* command(s) */ uint_t mha_flags; size_t mha_pagesize; }; #if defined(_SYSCALL32) struct memcntl_mha32 { - uint_t mha_cmd; /* command(s) */ + uint_t mha_cmd; /* command(s) */ uint_t mha_flags; size32_t mha_pagesize; }; #endif /* _SYSCALL32 */ #endif /* !defined(_ASM) */ -#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ -#if (_POSIX_C_SOURCE <= 2) && !defined(_XPG4_2) || defined(__EXTENSIONS__) /* * advice to madvise * @@ -322,9 +323,9 @@ struct memcntl_mha32 { #define MADV_ACCESS_MANY 8 /* many processes to access heavily */ #define MADV_PURGE 9 /* contents will be purged */ -#endif /* (_POSIX_C_SOURCE <= 2) && !defined(_XPG4_2) ... */ +#endif /* !defined(_STRICT_POSIX) */ -#if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__) +#if !defined(_STRICT_POSIX) || defined(_XPG6) /* advice to posix_madvise */ /* these values must be kept in sync with the MADV_* values, above */ #define POSIX_MADV_NORMAL 0 /* MADV_NORMAL */ @@ -334,7 +335,7 @@ struct memcntl_mha32 { #define POSIX_MADV_DONTNEED 4 /* MADV_DONTNEED */ #endif -/* flags to msync */ +/* flags to msync, always visible to match the function */ #define MS_OLDSYNC 0x0 /* old value of MS_SYNC */ /* modified for UNIX98 compliance */ #define MS_SYNC 0x4 /* wait for msync */ @@ -342,8 +343,34 @@ struct memcntl_mha32 { #define MS_INVALIDATE 0x2 /* invalidate caches */ #define MS_INVALCURPROC 0x8 /* invalidate cache for curproc only */ -#if (_POSIX_C_SOURCE <= 2) && !defined(_XPG4_2) || defined(__EXTENSIONS__) -/* functions to mctl */ +#if !defined(_STRICT_POSIX) || (_POSIX_C_SOURCE > 2) || defined(_XPG5) +/* flags to mlockall */ +#define MCL_CURRENT 0x1 /* lock current mappings */ +#define MCL_FUTURE 0x2 /* lock future mappings */ +#endif /* !_STRICT_POSIX || _POSIX_C_SOURCE > 2 || _XPG5 */ + +/* + * The following flags are older variants used by memcntl that if more generally + * visible under more generous rules basically conflict all over the place due + * to the use of common words. As such, these retain their original feature + * guards, as weird as they may be. + */ +#if (_POSIX_C_SOURCE <= 2) && !defined(_XPG4_2) +#define SHARED 0x10 /* Use MEMCNTL_SHARED */ +#define PRIVATE 0x20 /* Use MEMCNTL_PRIVATE */ +#define VALID_ATTR (PROT_READ|PROT_WRITE|PROT_EXEC|SHARED|PRIVATE) +#endif /* (_POSIX_C_SOURCE <= 2) && !defined(_XPG4_2) */ + +#if !defined(_STRICT_POSIX) +/* these flags are used by memcntl */ +#define PROC_TEXT (PROT_EXEC | PROT_READ) +#define PROC_DATA (PROT_READ | PROT_WRITE | PROT_EXEC) +#define MEMCNTL_SHARED 0x10 +#define MENCNTL_PRIVATE 0x20 +#define MEMCNTL_VALID_ATTR (PROT_READ |PROT_WRITE |PROT_EXEC | \ + MEMCNTL_SHARED | MEMCNTL_PRIVATE) + +/* functions to memcntl */ #define MC_SYNC 1 /* sync with backing store */ #define MC_LOCK 2 /* lock pages in memory */ #define MC_UNLOCK 3 /* unlock pages from memory */ @@ -360,17 +387,6 @@ struct memcntl_mha32 { /* brk area and brk area itself */ #define MHA_MAPSIZE_STACK 0x4 /* set preferred page size */ /* processes main stack */ - -#endif /* (_POSIX_C_SOURCE <= 2) && !defined(_XPG4_2) ... */ - -#if (!defined(_XPG4_2) || (_POSIX_C_SOURCE > 2)) || defined(__EXTENSIONS__) -/* flags to mlockall */ -#define MCL_CURRENT 0x1 /* lock current mappings */ -#define MCL_FUTURE 0x2 /* lock future mappings */ -#endif /* (!defined(_XPG4_2) || (_POSIX_C_SOURCE)) || defined(__EXTENSIONS__) */ - -#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) - /* definitions for meminfosys syscall */ #define MISYS_MEMINFO 0x0 @@ -421,7 +437,7 @@ typedef struct meminfo32 { /* maximum number of request types */ #define MAX_MEMINFO_REQ 31 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ +#endif /* !defined(_STRICT_POSIX) */ #ifdef __cplusplus } diff --git a/usr/src/uts/common/sys/mutex.h b/usr/src/uts/common/sys/mutex.h index db34243dcc..7f6dc8ae10 100644 --- a/usr/src/uts/common/sys/mutex.h +++ b/usr/src/uts/common/sys/mutex.h @@ -51,7 +51,7 @@ extern "C" { * either MUTEX_ADAPTIVE or MUTEX_SPIN depending on the iblock cookie. * * Mutex statistics can be gathered on the fly, without rebooting or - * recompiling the kernel, via the lockstat driver (lockstat(7D)). + * recompiling the kernel, via the lockstat driver (lockstat(4D)). */ typedef enum { MUTEX_ADAPTIVE = 0, /* spin if owner is running, otherwise block */ diff --git a/usr/src/uts/common/sys/net80211.h b/usr/src/uts/common/sys/net80211.h index 1946e0b284..be6b65fe90 100644 --- a/usr/src/uts/common/sys/net80211.h +++ b/usr/src/uts/common/sys/net80211.h @@ -700,7 +700,7 @@ ieee80211_node_t *ieee80211_find_node(ieee80211_node_table_t *, ieee80211_node_t *ieee80211_find_node_with_ssid(ieee80211_node_table_t *, const uint8_t *, uint32_t, const uint8_t *); ieee80211_node_t *ieee80211_find_txnode(ieee80211com_t *, - const uint8_t daddr[IEEE80211_ADDR_LEN]); + const uint8_t *daddr); ieee80211_node_t *ieee80211_find_rxnode(ieee80211com_t *, const struct ieee80211_frame *); @@ -713,7 +713,7 @@ extern int ieee80211_crypto_newkey(ieee80211com_t *, int, int, struct ieee80211_key *); extern int ieee80211_crypto_delkey(ieee80211com_t *, struct ieee80211_key *); extern int ieee80211_crypto_setkey(ieee80211com_t *, struct ieee80211_key *, - const uint8_t macaddr[IEEE80211_ADDR_LEN]); + const uint8_t *macaddr); /* Helper Functions */ int ieee80211_stat(ieee80211com_t *ic, uint_t stat, uint64_t *val); diff --git a/usr/src/uts/common/sys/null.h b/usr/src/uts/common/sys/null.h index dc86fe9e8e..4009d3eaaf 100644 --- a/usr/src/uts/common/sys/null.h +++ b/usr/src/uts/common/sys/null.h @@ -20,38 +20,6 @@ #ifndef NULL -#if defined(__sparc) -/* - * SPARC code is not yet NULL pointer clean. - */ - -/* - * POSIX.1-2008 requires that the NULL macro be cast to type void *. - * Historically, this has not been done, so we only enable this in a - * POSIX.1-2008 compilation environment. - */ - -#if defined(_XPG7) && !defined(__cplusplus) -#define NULL ((void *)0) -#else - -/* - * ISO C++ requires that the NULL macro be a constant integral type evaluating - * to zero until C++11, and an integer or pointer literal with value zero from - * C++11 onwards. - */ - -#if defined(__cplusplus) && __cplusplus >= 201103L -#define NULL nullptr -#else -#if defined(_LP64) -#define NULL 0L -#else -#define NULL 0 -#endif /* _LP64 */ -#endif /* C++11 */ -#endif /* _XPG7 */ -#else /* * POSIX.1-2008 requires that the NULL macro be cast to type void *. */ @@ -76,7 +44,6 @@ #endif /* _LP64 */ #endif /* C++11 */ #endif /* !__cplusplus */ -#endif /* __sparc */ #endif /* NULL */ diff --git a/usr/src/uts/common/sys/nvme.h b/usr/src/uts/common/sys/nvme.h index 9a0d926dc5..9e154131b1 100644 --- a/usr/src/uts/common/sys/nvme.h +++ b/usr/src/uts/common/sys/nvme.h @@ -13,6 +13,8 @@ * Copyright 2016 Nexenta Systems, Inc. * Copyright 2020 Joyent, Inc. * Copyright 2019 Western Digital Corporation + * Copyright 2021 Oxide Computer Company + * Copyright 2022 OmniOS Community Edition (OmniOSce) Association. */ #ifndef _SYS_NVME_H @@ -27,7 +29,7 @@ #endif /* - * Declarations used for communication between nvmeadm(1M) and nvme(7D) + * Declarations used for communication between nvmeadm(8) and nvme(4D) */ #ifdef __cplusplus @@ -51,7 +53,9 @@ extern "C" { #define NVME_IOC_ATTACH (NVME_IOC | 10) #define NVME_IOC_FIRMWARE_DOWNLOAD (NVME_IOC | 11) #define NVME_IOC_FIRMWARE_COMMIT (NVME_IOC | 12) -#define NVME_IOC_MAX NVME_IOC_FIRMWARE_COMMIT +#define NVME_IOC_PASSTHRU (NVME_IOC | 13) +#define NVME_IOC_IS_IGNORED_NS (NVME_IOC | 14) +#define NVME_IOC_MAX NVME_IOC_IS_IGNORED_NS #define IS_NVME_IOC(x) ((x) > NVME_IOC && (x) <= NVME_IOC_MAX) #define NVME_IOC_CMD(x) ((x) & 0xff) @@ -97,6 +101,11 @@ typedef struct { #pragma pack(1) +typedef struct { + uint64_t lo; + uint64_t hi; +} nvme_uint128_t; + /* * NVMe Identify data structures */ @@ -153,41 +162,94 @@ typedef struct { struct { /* Multi-Interface Capabilities */ uint8_t m_multi_pci:1; /* HW has multiple PCIe interfaces */ uint8_t m_multi_ctrl:1; /* HW has multiple controllers (1.1) */ - uint8_t m_sr_iov:1; /* controller is SR-IOV virt fn (1.1) */ - uint8_t m_rsvd:5; + uint8_t m_sr_iov:1; /* Controller is SR-IOV virt fn (1.1) */ + uint8_t m_anar_sup:1; /* ANA Reporting Supported (1.4) */ + uint8_t m_rsvd:4; } id_mic; uint8_t id_mdts; /* Maximum Data Transfer Size */ uint16_t id_cntlid; /* Unique Controller Identifier (1.1) */ /* Added in NVMe 1.2 */ - uint32_t id_ver; /* Version */ - uint32_t id_rtd3r; /* RTD3 Resume Latency */ - uint32_t id_rtd3e; /* RTD3 Entry Latency */ - uint32_t id_oaes; /* Optional Asynchronous Events */ - /* Added in NVMe 1.3 */ - uint32_t id_ctratt; /* Controller Attributes */ - uint8_t id_rsvd_cc[12]; - uint8_t id_frguid[16]; /* FRU GUID */ - uint8_t id_rsvd2_cc[240 - 128]; - uint8_t id_rsvd_nvmemi[255 - 240]; - uint8_t id_mec; /* Management Endpiont Capabilities */ + uint32_t id_ver; /* Version (1.2) */ + uint32_t id_rtd3r; /* RTD3 Resume Latency (1.2) */ + uint32_t id_rtd3e; /* RTD3 Entry Latency (1.2) */ + struct { + uint32_t oaes_rsvd0:8; + uint32_t oaes_nsan:1; /* Namespace Attribute Notices (1.2) */ + uint32_t oaes_fwact:1; /* Firmware Activation Notices (1.2) */ + uint32_t oaes_rsvd1:1; + uint32_t oaes_ansacn:1; /* Asymmetric NS Access Change (1.4) */ + uint32_t oaes_plat:1; /* Predictable Lat Event Agg. (1.4) */ + uint32_t oaes_lbasi:1; /* LBA Status Information (1.4) */ + uint32_t oaes_egeal:1; /* Endurance Group Event Agg. (1.4) */ + uint32_t oaes_rsvd2:17; + } id_oaes; + struct { + uint32_t ctrat_hid:1; /* 128-bit Host Identifier (1.2) */ + uint32_t ctrat_nops:1; /* Non-Operational Power State (1.3) */ + uint32_t ctrat_nvmset:1; /* NVMe Sets (1.4) */ + uint32_t ctrat_rrl:1; /* Read Recovery Levels (1.4) */ + uint32_t ctrat_engrp:1; /* Endurance Groups (1.4) */ + uint32_t ctrat_plm:1; /* Predictable Latency Mode (1.4) */ + uint32_t ctrat_tbkas:1; /* Traffic Based Keep Alive (1.4) */ + uint32_t ctrat_nsg:1; /* Namespace Granularity (1.4) */ + uint32_t ctrat_sqass:1; /* SQ Associations (1.4) */ + uint32_t ctrat_uuid:1; /* UUID List (1.4) */ + uint32_t ctrat_rsvd:22; + } id_ctratt; + uint16_t id_rrls; /* Read Recovery Levels (1.4) */ + uint8_t id_rsvd_cc[111-102]; + uint8_t id_cntrltype; /* Controller Type (1.4) */ + uint8_t id_frguid[16]; /* FRU GUID (1.3) */ + uint16_t id_crdt1; /* Command Retry Delay Time 1 (1.4) */ + uint16_t id_crdt2; /* Command Retry Delay Time 2 (1.4) */ + uint16_t id_crdt3; /* Command Retry Delay Time 3 (1.4) */ + uint8_t id_rsvd2_cc[240 - 134]; + uint8_t id_rsvd_nvmemi[253 - 240]; + /* NVMe-MI region */ + struct { /* NVMe Subsystem Report */ + uint8_t nvmsr_nvmesd:1; /* NVMe Storage Device */ + uint8_t nvmsr_nvmee:1; /* NVMe Enclosure */ + uint8_t nvmsr_rsvd:6; + } id_nvmsr; + struct { /* VPD Write Cycle Information */ + uint8_t vwci_crem:7; /* Write Cycles Remaining */ + uint8_t vwci_valid:1; /* Write Cycles Remaining Valid */ + } id_vpdwc; + struct { /* Management Endpoint Capabilities */ + uint8_t mec_smbusme:1; /* SMBus Port Management Endpoint */ + uint8_t mec_pcieme:1; /* PCIe Port Management Endpoint */ + uint8_t mec_rsvd:6; + } id_mec; /* Admin Command Set Attributes */ struct { /* Optional Admin Command Support */ uint16_t oa_security:1; /* Security Send & Receive */ uint16_t oa_format:1; /* Format NVM */ uint16_t oa_firmware:1; /* Firmware Activate & Download */ - uint16_t oa_rsvd:13; + uint16_t oa_nsmgmt:1; /* Namespace Management (1.2) */ + uint16_t oa_selftest:1; /* Self Test (1.3) */ + uint16_t oa_direct:1; /* Directives (1.3) */ + uint16_t oa_nvmemi:1; /* MI-Send/Recv (1.3) */ + uint16_t oa_virtmgmt:1; /* Virtualization Management (1.3) */ + uint16_t oa_doorbell:1; /* Doorbell Buffer Config (1.3) */ + uint16_t oa_lbastat:1; /* LBA Status (1.4) */ + uint16_t oa_rsvd:6; } id_oacs; uint8_t id_acl; /* Abort Command Limit */ uint8_t id_aerl; /* Asynchronous Event Request Limit */ struct { /* Firmware Updates */ uint8_t fw_readonly:1; /* Slot 1 is Read-Only */ uint8_t fw_nslot:3; /* number of firmware slots */ - uint8_t fw_rsvd:4; + uint8_t fw_norst:1; /* Activate w/o reset (1.2) */ + uint8_t fw_rsvd:3; } id_frmw; struct { /* Log Page Attributes */ uint8_t lp_smart:1; /* SMART/Health information per NS */ - uint8_t lp_rsvd:7; + uint8_t lp_cmdeff:1; /* Command Effects (1.2) */ + uint8_t lp_extsup:1; /* Extended Get Log Page (1.2) */ + uint8_t lp_telemetry:1; /* Telemetry Log Pages (1.3) */ + uint8_t lp_persist:1; /* Persistent Log Page (1.4) */ + uint8_t lp_rsvd:3; } id_lpa; uint8_t id_elpe; /* Error Log Page Entries */ uint8_t id_npss; /* Number of Power States */ @@ -199,25 +261,61 @@ typedef struct { uint8_t ap_sup:1; /* APST supported (1.1) */ uint8_t ap_rsvd:7; } id_apsta; - /* Added in NVMe 1.2 */ - uint16_t ap_wctemp; /* Warning Composite Temperature */ - uint16_t ap_cctemp; /* Critical Composite Temperature */ - uint16_t ap_mtfa; /* Maximum Firmware Activation Time */ - uint32_t ap_hmpre; /* Host Memory Buffer Preferred Size */ - uint32_t ap_hmmin; /* Host Memory Buffer Min Size */ - uint8_t ap_tnvmcap[16]; /* Total NVM Capacity in Bytes */ - uint8_t ap_unvmcap[16]; /* Unallocated NVM Capacity */ - uint32_t ap_rpmbs; /* Replay Protected Memory Block */ + uint16_t ap_wctemp; /* Warning Composite Temp. (1.2) */ + uint16_t ap_cctemp; /* Critical Composite Temp. (1.2) */ + uint16_t ap_mtfa; /* Maximum Firmware Activation (1.2) */ + uint32_t ap_hmpre; /* Host Memory Buf Pref Size (1.2) */ + uint32_t ap_hmmin; /* Host Memory Buf Min Size (1.2) */ + nvme_uint128_t ap_tnvmcap; /* Total NVM Capacity in Bytes (1.2) */ + nvme_uint128_t ap_unvmcap; /* Unallocated NVM Capacity (1.2) */ + struct { /* Replay Protected Mem. Block (1.2) */ + uint32_t rpmbs_units:3; /* Number of targets */ + uint32_t rpmbs_auth:3; /* Auth method */ + uint32_t rpmbs_rsvd:10; + uint32_t rpmbs_tot:8; /* Total size in 128KB */ + uint32_t rpmbs_acc:8; /* Access size in 512B */ + } ap_rpmbs; /* Added in NVMe 1.3 */ - uint16_t ap_edstt; /* Extended Device Self-test time */ - uint8_t ap_dsto; /* Device Self-test Options */ - uint8_t ap_fwug; /* Firmware Update Granularity */ - uint16_t ap_kas; /* Keep Alive Support */ - uint16_t ap_hctma; /* Host Thermal Management */ - uint16_t ap_mntmt; /* Minimum Thermal Temperature */ - uint16_t ap_mxtmt; /* Maximum Thermal Temperature */ - uint32_t ap_sanitize; /* Sanitize Caps */ - uint8_t id_rsvd_ac[512 - 332]; + uint16_t ap_edstt; /* Ext. Device Self-test time (1.3) */ + struct { /* Device Self-test Options */ + uint8_t dsto_sub:1; /* Subsystem level self-test (1.3) */ + uint8_t dsto_rsvd:7; + } ap_dsto; + uint8_t ap_fwug; /* Firmware Update Granularity (1.3) */ + uint16_t ap_kas; /* Keep Alive Support (1.2) */ + struct { /* Host Thermal Management (1.3) */ + uint16_t hctma_hctm:1; /* Host Controlled (1.3) */ + uint16_t hctma_rsvd:15; + } ap_hctma; + uint16_t ap_mntmt; /* Minimum Thermal Temperature (1.3) */ + uint16_t ap_mxtmt; /* Maximum Thermal Temperature (1.3) */ + struct { /* Sanitize Caps */ + uint32_t san_ces:1; /* Crypto Erase Support (1.3) */ + uint32_t san_bes:1; /* Block Erase Support (1.3) */ + uint32_t san_ows:1; /* Overwite Support (1.3) */ + uint32_t san_rsvd:26; + uint32_t san_ndi:1; /* No-deallocate Inhibited (1.4) */ + uint32_t san_nodmmas:2; /* No-Deallocate Modifies Media (1.4) */ + } ap_sanitize; + uint32_t ap_hmminds; /* Host Mem Buf Min Desc Entry (1.4) */ + uint16_t ap_hmmaxd; /* How Mem Max Desc Entries (1.4) */ + uint16_t ap_nsetidmax; /* Max NVMe set identifier (1.4) */ + uint16_t ap_engidmax; /* Max Endurance Group ID (1.4) */ + uint8_t ap_anatt; /* ANA Transition Time (1.4) */ + struct { /* Asymmetric Namespace Access Caps */ + uint8_t anacap_opt:1; /* Optimized State (1.4) */ + uint8_t anacap_unopt:1; /* Un-optimized State (1.4) */ + uint8_t anacap_inacc:1; /* Inaccessible State (1.4) */ + uint8_t anacap_ploss:1; /* Persistent Loss (1.4) */ + uint8_t anacap_chg:1; /* Change State (1.4 ) */ + uint8_t anacap_rsvd:1; + uint8_t anacap_grpns:1; /* ID Changes with NS Attach (1.4) */ + uint8_t anacap_grpid:1; /* Supports Group ID (1.4) */ + } ap_anacap; + uint32_t ap_anagrpmax; /* ANA Group ID Max (1.4) */ + uint32_t ap_nanagrpid; /* Number of ANA Group IDs (1.4) */ + uint32_t ap_pels; /* Persistent Event Log Size (1.4) */ + uint8_t id_rsvd_ac[512 - 356]; /* NVM Command Set Attributes */ nvme_idctl_qes_t id_sqes; /* Submission Queue Entry Size */ @@ -231,7 +329,9 @@ typedef struct { uint16_t on_wr_zero:1; /* Write Zeros (1.1) */ uint16_t on_save:1; /* Save/Select in Get/Set Feat (1.1) */ uint16_t on_reserve:1; /* Reservations (1.1) */ - uint16_t on_rsvd:10; + uint16_t on_ts:1; /* Timestamp (1.3) */ + uint16_t on_verify:1; /* Verify (1.4) */ + uint16_t on_rsvd:8; } id_oncs; struct { /* Fused Operation Support */ uint16_t f_cmp_wr:1; /* Compare and Write */ @@ -245,7 +345,8 @@ typedef struct { } id_fna; struct { /* Volatile Write Cache */ uint8_t vwc_present:1; /* Volatile Write Cache present */ - uint8_t rsvd:7; + uint8_t vwc_nsflush:2; /* Flush with NS ffffffff (1.4) */ + uint8_t rsvd:5; } id_vwc; uint16_t id_awun; /* Atomic Write Unit Normal */ uint16_t id_awupf; /* Atomic Write Unit Power Fail */ @@ -253,16 +354,28 @@ typedef struct { uint8_t nv_spec:1; /* use format from spec */ uint8_t nv_rsvd:7; } id_nvscc; - uint8_t id_rsvd_nc_2; + struct { /* Namespace Write Protection Caps */ + uint8_t nwpc_base:1; /* Base support (1.4) */ + uint8_t nwpc_wpupc:1; /* Write prot until power cycle (1.4) */ + uint8_t nwpc_permwp:1; /* Permanent write prot (1.4) */ + uint8_t nwpc_rsvd:5; + } id_nwpc; uint16_t id_acwu; /* Atomic Compare & Write Unit (1.1) */ uint16_t id_rsvd_nc_3; struct { /* SGL Support (1.1) */ - uint16_t sgl_sup:1; /* SGL Supported in NVM cmds (1.1) */ - uint16_t sgl_rsvd1:15; + uint16_t sgl_sup:2; /* SGL Supported in NVM cmds (1.3) */ + uint16_t sgl_keyed:1; /* Keyed SGL Support (1.2) */ + uint16_t sgl_rsvd1:13; uint16_t sgl_bucket:1; /* SGL Bit Bucket supported (1.1) */ - uint16_t sgl_rsvd2:15; + uint16_t sgl_balign:1; /* SGL Byte Aligned (1.2) */ + uint16_t sgl_sglgtd:1; /* SGL Length Longer than Data (1.2) */ + uint16_t sgl_mptr:1; /* SGL MPTR w/ SGL (1.2) */ + uint16_t sgl_offset:1; /* SGL Address is offset (1.2) */ + uint16_t sgl_tport:1; /* Transport SGL Data Block (1.4) */ + uint16_t sgl_rsvd2:10; } id_sgls; - uint8_t id_rsvd_nc_4[768 - 540]; + uint32_t id_mnam; /* Maximum Number of Allowed NSes */ + uint8_t id_rsvd_nc_4[768 - 544]; /* I/O Command Set Attributes */ uint8_t id_subnqn[1024 - 768]; /* Subsystem Qualified Name (1.2.1+) */ @@ -276,6 +389,40 @@ typedef struct { uint8_t id_vs[1024]; } nvme_identify_ctrl_t; +/* + * NVMe Controller Types + */ +#define NVME_CNTRLTYPE_RSVD 0 +#define NVME_CNTRLTYPE_IO 1 +#define NVME_CNTRLTYPE_DISC 2 +#define NVME_CNTRLTYPE_ADMIN 3 + +/* + * RPMBS Authentication Types + */ +#define NVME_RPMBS_AUTH_HMAC_SHA256 0 + +/* + * NODMMAS Values + */ +#define NVME_NODMMAS_UNDEF 0x00 +#define NVME_NODMMAS_NOMOD 0x01 +#define NVME_NODMMAS_DOMOD 0x02 + +/* + * VWC NSID flushes + */ +#define NVME_VWCNS_UNKNOWN 0x00 +#define NVME_VWCNS_UNSUP 0x02 +#define NVME_VWCNS_SUP 0x03 + +/* + * SGL Support Values + */ +#define NVME_SGL_UNSUP 0x00 +#define NVME_SGL_SUP_UNALIGN 0x01 +#define NVME_SGL_SUP_ALIGN 0x02 + /* NVMe Identify Namespace LBA Format */ typedef struct { uint16_t lbaf_ms; /* Metadata Size */ @@ -291,7 +438,11 @@ typedef struct { uint64_t id_nuse; /* Namespace Utilization */ struct { /* Namespace Features */ uint8_t f_thin:1; /* Thin Provisioning */ - uint8_t f_rsvd:7; + uint8_t f_nsabp:1; /* Namespace atomics (1.2) */ + uint8_t f_dae:1; /* Deallocated errors supported (1.2) */ + uint8_t f_uidreuse:1; /* GUID reuse impossible (1.3) */ + uint8_t f_optperf:1; /* Namespace I/O opt (1.4) */ + uint8_t f_rsvd:3; } id_nsfeat; uint8_t id_nlbaf; /* Number of LBA formats */ struct { /* Formatted LBA size */ @@ -329,9 +480,12 @@ typedef struct { uint8_t rc_excl_r:1; /* Excl Acc - Registrants Only (1.1) */ uint8_t rc_wr_excl_a:1; /* Wr Excl - All Registrants (1.1) */ uint8_t rc_excl_a:1; /* Excl Acc - All Registrants (1.1) */ - uint8_t rc_rsvd:1; + uint8_t rc_ign_ekey:1; /* Ignore Existing Key (1.3) */ } id_rescap; - uint8_t id_fpi; /* Format Progress Indicator (1.2) */ + struct { /* Format Progress Indicator (1.2) */ + uint8_t fpi_remp:7; /* Percent NVM Format Remaining (1.2) */ + uint8_t fpi_sup:1; /* Supported (1.2) */ + } id_fpi; uint8_t id_dfleat; /* Deallocate Log. Block (1.3) */ uint16_t id_nawun; /* Atomic Write Unit Normal (1.2) */ uint16_t id_nawupf; /* Atomic Write Unit Power Fail (1.2) */ @@ -340,13 +494,26 @@ typedef struct { uint16_t id_nbao; /* Atomic Boundary Offset (1.2) */ uint16_t id_nabspf; /* Atomic Boundary Size Fail (1.2) */ uint16_t id_noiob; /* Optimal I/O Bondary (1.3) */ - uint8_t id_nvmcap[16]; /* NVM Capacity */ - uint8_t id_rsvd1[104 - 64]; + nvme_uint128_t id_nvmcap; /* NVM Capacity */ + uint16_t id_npwg; /* NS Pref. Write Gran. (1.4) */ + uint16_t id_npwa; /* NS Pref. Write Align. (1.4) */ + uint16_t id_npdg; /* NS Pref. Deallocate Gran. (1.4) */ + uint16_t id_npda; /* NS Pref. Deallocate Align. (1.4) */ + uint16_t id_nows; /* NS. Optimal Write Size (1.4) */ + uint8_t id_rsvd1[92 - 74]; + uint32_t id_anagrpid; /* ANA Group Identifier (1.4) */ + uint8_t id_rsvd2[99 - 96]; + struct { + uint8_t nsa_wprot:1; /* Write Protected (1.4) */ + uint8_t nsa_rsvd:7; + } id_nsattr; + uint16_t id_nvmsetid; /* NVM Set Identifier (1.4) */ + uint16_t id_endgid; /* Endurance Group Identifier (1.4) */ uint8_t id_nguid[16]; /* Namespace GUID (1.2) */ uint8_t id_eui64[8]; /* IEEE Extended Unique Id (1.1) */ nvme_idns_lbaf_t id_lbaf[16]; /* LBA Formats */ - uint8_t id_rsvd2[384 - 192]; + uint8_t id_rsvd3[384 - 192]; uint8_t id_vs[4096 - 384]; /* Vendor Specific */ } nvme_identify_nsid_t; @@ -366,7 +533,7 @@ typedef struct { uint8_t nipc_rvsd1[64 - 48]; uint32_t nipc_vifrt; /* VI Flexible total */ uint32_t nipc_virfa; /* VI Flexible Assigned */ - uint16_t nipc_virfap; /* VI Flexible Allocatd to Primary */ + uint16_t nipc_virfap; /* VI Flexible Allocated to Primary */ uint16_t nipc_viprt; /* VI Resources Private Total */ uint16_t nipc_vifrsm; /* VI Resources Secondary Max */ uint16_t nipc_vigran; /* VI Flexible Granularity */ @@ -392,6 +559,7 @@ typedef struct { #define NVME_LOGPAGE_ERROR 0x1 /* Error Information */ #define NVME_LOGPAGE_HEALTH 0x2 /* SMART/Health Information */ #define NVME_LOGPAGE_FWSLOT 0x3 /* Firmware Slot Information */ +#define NVME_LOGPAGE_NSCHANGE 0x4 /* Changed namespace (1.2) */ typedef struct { uint64_t el_count; /* Error Count */ @@ -408,11 +576,6 @@ typedef struct { } nvme_error_log_entry_t; typedef struct { - uint64_t lo; - uint64_t hi; -} nvme_uint128_t; - -typedef struct { struct { /* Critical Warning */ uint8_t cw_avail:1; /* available space too low */ uint8_t cw_temp:1; /* temperature too high */ @@ -436,7 +599,23 @@ typedef struct { nvme_uint128_t hl_unsafe_shutdn; /* Unsafe Shutdowns */ nvme_uint128_t hl_media_errors; /* Media Errors */ nvme_uint128_t hl_errors_logged; /* Number of errors logged */ - uint8_t hl_rsvd2[512 - 192]; + /* Added in NVMe 1.2 */ + uint32_t hl_warn_temp_time; /* Warning Composite Temp Time */ + uint32_t hl_crit_temp_time; /* Critical Composite Temp Time */ + uint16_t hl_temp_sensor_1; /* Temperature Sensor 1 */ + uint16_t hl_temp_sensor_2; /* Temperature Sensor 2 */ + uint16_t hl_temp_sensor_3; /* Temperature Sensor 3 */ + uint16_t hl_temp_sensor_4; /* Temperature Sensor 4 */ + uint16_t hl_temp_sensor_5; /* Temperature Sensor 5 */ + uint16_t hl_temp_sensor_6; /* Temperature Sensor 6 */ + uint16_t hl_temp_sensor_7; /* Temperature Sensor 7 */ + uint16_t hl_temp_sensor_8; /* Temperature Sensor 8 */ + /* Added in NVMe 1.3 */ + uint32_t hl_tmtemp_1_tc; /* Thermal Mgmt Temp 1 Transition # */ + uint32_t hl_tmtemp_2_tc; /* Thermal Mgmt Temp 1 Transition # */ + uint32_t hl_tmtemp_1_time; /* Time in Thermal Mgmt Temp 1 */ + uint32_t hl_tmtemp_2_time; /* Time in Thermal Mgmt Temp 2 */ + uint8_t hl_rsvd2[512 - 232]; } nvme_health_log_t; /* @@ -458,6 +637,18 @@ typedef struct { uint8_t fw_rsvd4[512 - 64]; } nvme_fwslot_log_t; +/* + * The NVMe spec specifies that the changed namespace list contains up to + * 1024 entries. + */ +#define NVME_NSCHANGE_LIST_SIZE 1024 + +typedef struct { + uint32_t nscl_ns[NVME_NSCHANGE_LIST_SIZE]; +} __packed nvme_nschange_list_t; + +/* CSTYLED */ +_Static_assert(sizeof (nvme_nschange_list_t) == 4096, "bad size for nvme_nschange_list_t"); /* * NVMe Format NVM @@ -551,11 +742,18 @@ typedef struct { typedef union { struct { uint16_t tt_tmpth; /* Temperature Threshold */ - uint16_t tt_rsvd; + uint16_t tt_tmpsel:4; /* Temperature Select */ + uint16_t tt_thsel:2; /* Temperature Type */ + uint16_t tt_resv:10; } b; uint32_t r; } nvme_temp_threshold_t; +#define NVME_TEMP_THRESH_MAX_SENSOR 8 +#define NVME_TEMP_THRESH_ALL 0xf +#define NVME_TEMP_THRESH_OVER 0x00 +#define NVME_TEMP_THRESH_UNDER 0x01 + /* Error Recovery Feature */ typedef union { struct { @@ -615,13 +813,21 @@ typedef union { /* Asynchronous Event Configuration Feature */ typedef union { struct { - uint8_t aec_avail:1; /* available space too low */ - uint8_t aec_temp:1; /* temperature too high */ - uint8_t aec_reliab:1; /* degraded reliability */ - uint8_t aec_readonly:1; /* media is read-only */ - uint8_t aec_volatile:1; /* volatile memory backup failed */ + uint8_t aec_avail:1; /* Available space too low */ + uint8_t aec_temp:1; /* Temperature too high */ + uint8_t aec_reliab:1; /* Degraded reliability */ + uint8_t aec_readonly:1; /* Media is read-only */ + uint8_t aec_volatile:1; /* Volatile memory backup failed */ uint8_t aec_rsvd1:3; - uint8_t aec_rsvd2[3]; + uint8_t aec_nsan:1; /* Namespace attribute notices (1.2) */ + uint8_t aec_fwact:1; /* Firmware activation notices (1.2) */ + uint8_t aec_telln:1; /* Telemetry log notices (1.3) */ + uint8_t aec_ansacn:1; /* Asymm. NS access change (1.4) */ + uint8_t aec_plat:1; /* Predictable latency ev. agg. (1.4) */ + uint8_t aec_lbasi:1; /* LBA status information (1.4) */ + uint8_t aec_egeal:1; /* Endurance group ev. agg. (1.4) */ + uint8_t aec_rsvd2:1; + uint8_t aec_rsvd3[2]; } b; uint32_t r; } nvme_async_event_conf_t; @@ -764,6 +970,65 @@ typedef union { #define NVME_CQE_SC_INT_NVM_COMPARE 0x85 /* Compare Failure */ #define NVME_CQE_SC_INT_NVM_ACCESS 0x86 /* Access Denied */ +/* Flags for NVMe passthru commands. */ +#define NVME_PASSTHRU_READ 0x1 /* Read from device */ +#define NVME_PASSTHRU_WRITE 0x2 /* Write to device */ + +/* Error codes for NVMe passthru command validation. */ +/* Must be sizeof(nvme_passthru_cmd_t) */ +#define NVME_PASSTHRU_ERR_CMD_SIZE 0x01 +#define NVME_PASSTHRU_ERR_NOT_SUPPORTED 0x02 /* Not supported on device */ +#define NVME_PASSTHRU_ERR_INVALID_OPCODE 0x03 +#define NVME_PASSTHRU_ERR_READ_AND_WRITE 0x04 /* Must read ^ write */ +#define NVME_PASSTHRU_ERR_INVALID_TIMEOUT 0x05 + +/* + * Must be + * - multiple of 4 bytes in length + * - non-null iff length is non-zero + * - null if neither reading nor writing + * - non-null if either reading or writing + * - <= `nvme_vendor_specific_admin_cmd_size` in length, 16 MiB + * - <= UINT32_MAX in length + */ +#define NVME_PASSTHRU_ERR_INVALID_BUFFER 0x06 + + +/* Generic struct for passing through vendor-unique commands to a device. */ +typedef struct { + uint8_t npc_opcode; /* Command opcode. */ + uint8_t npc_status; /* Command completion status code. */ + uint8_t npc_err; /* Error-code if validation fails. */ + uint8_t npc_rsvd0; /* Align to 4 bytes */ + uint32_t npc_timeout; /* Command timeout, in seconds. */ + uint32_t npc_flags; /* Flags for the command. */ + uint32_t npc_cdw0; /* Command-specific result DWord 0 */ + uint32_t npc_cdw12; /* Command-specific DWord 12 */ + uint32_t npc_cdw13; /* Command-specific DWord 13 */ + uint32_t npc_cdw14; /* Command-specific DWord 14 */ + uint32_t npc_cdw15; /* Command-specific DWord 15 */ + size_t npc_buflen; /* Size of npc_buf. */ + uintptr_t npc_buf; /* I/O source or destination */ +} nvme_passthru_cmd_t; + +#ifdef _KERNEL +typedef struct { + uint8_t npc_opcode; /* Command opcode. */ + uint8_t npc_status; /* Command completion status code. */ + uint8_t npc_err; /* Error-code if validation fails. */ + uint8_t npc_rsvd0; /* Align to 4 bytes */ + uint32_t npc_timeout; /* Command timeout, in seconds. */ + uint32_t npc_flags; /* Flags for the command. */ + uint32_t npc_cdw0; /* Command-specific result DWord 0 */ + uint32_t npc_cdw12; /* Command-specific DWord 12 */ + uint32_t npc_cdw13; /* Command-specific DWord 13 */ + uint32_t npc_cdw14; /* Command-specific DWord 14 */ + uint32_t npc_cdw15; /* Command-specific DWord 15 */ + size32_t npc_buflen; /* Size of npc_buf. */ + uintptr32_t npc_buf; /* I/O source or destination */ +} nvme_passthru_cmd32_t; +#endif + #ifdef __cplusplus } #endif diff --git a/usr/src/uts/common/sys/nxge/nxge_impl.h b/usr/src/uts/common/sys/nxge/nxge_impl.h index 429c906c5e..0f247df1a5 100644 --- a/usr/src/uts/common/sys/nxge/nxge_impl.h +++ b/usr/src/uts/common/sys/nxge/nxge_impl.h @@ -619,8 +619,8 @@ struct _nxge_dma_pool_t { */ typedef struct _nxge_ldg_t nxge_ldg_t, *p_nxge_ldg_t; typedef struct _nxge_ldv_t nxge_ldv_t, *p_nxge_ldv_t; -typedef uint_t (*nxge_sys_intr_t)(void *arg1, void *arg2); -typedef uint_t (*nxge_ldv_intr_t)(void *arg1, void *arg2); +typedef uint_t (*nxge_sys_intr_t)(char *arg1, char *arg2); +typedef uint_t (*nxge_ldv_intr_t)(char *arg1, char *arg2); /* * Each logical device Group (64) needs to have the following @@ -894,7 +894,7 @@ void nxge_hw_ioctl(p_nxge_t, queue_t *, mblk_t *, struct iocblk *); void nxge_loopback_ioctl(p_nxge_t, queue_t *, mblk_t *, struct iocblk *); nxge_status_t nxge_global_reset(p_nxge_t); -uint_t nxge_intr(void *, void *); +uint_t nxge_intr(char *, char *); void nxge_intr_enable(p_nxge_t); void nxge_intr_disable(p_nxge_t); void nxge_hw_blank(void *arg, time_t, uint_t); diff --git a/usr/src/uts/common/sys/overlay_common.h b/usr/src/uts/common/sys/overlay_common.h index d638096006..894644b50a 100644 --- a/usr/src/uts/common/sys/overlay_common.h +++ b/usr/src/uts/common/sys/overlay_common.h @@ -34,7 +34,7 @@ typedef enum overlay_plugin_dest { OVERLAY_PLUGIN_D_INVALID = 0x0, OVERLAY_PLUGIN_D_ETHERNET = 0x1, OVERLAY_PLUGIN_D_IP = 0x2, - OVERLAY_PLUGIN_D_PORT = 0x4, + OVERLAY_PLUGIN_D_PORT = 0x4, OVERLAY_PLUGIN_D_MASK = 0x7 } overlay_plugin_dest_t; @@ -42,14 +42,14 @@ typedef enum overlay_prop_type { OVERLAY_PROP_T_INT = 0x1, /* signed int */ OVERLAY_PROP_T_UINT, /* unsigned int */ OVERLAY_PROP_T_IP, /* sinaddr6 */ - OVERLAY_PROP_T_STRING /* OVERLAY_PROPS_SIZEMAX */ + OVERLAY_PROP_T_STRING /* OVERLAY_PROP_SIZEMAX */ } overlay_prop_type_t; typedef enum overlay_prop_prot { OVERLAY_PROP_PERM_REQ = 0x1, OVERLAY_PROP_PERM_READ = 0x2, OVERLAY_PROP_PERM_WRITE = 0x4, - OVERLAY_PROP_PERM_RW = 0x6, + OVERLAY_PROP_PERM_RW = 0x6, OVERLAY_PROP_PERM_RRW = 0x7, OVERLAY_PROP_PERM_MASK = 0x7 } overlay_prop_prot_t; diff --git a/usr/src/uts/common/sys/overlay_impl.h b/usr/src/uts/common/sys/overlay_impl.h index 7fb8b8da1d..0095c75eeb 100644 --- a/usr/src/uts/common/sys/overlay_impl.h +++ b/usr/src/uts/common/sys/overlay_impl.h @@ -59,7 +59,7 @@ typedef struct overlay_mux { int omux_domain; /* RO: socket domain */ int omux_family; /* RO: socket family */ int omux_protocol; /* RO: socket protocol */ - struct sockaddr *omux_addr; /* RO: socket address */ + struct sockaddr *omux_addr; /* RO: socket address */ socklen_t omux_alen; /* RO: sockaddr len */ kmutex_t omux_lock; /* Protects everything below */ uint_t omux_count; /* Active instances */ diff --git a/usr/src/uts/common/sys/overlay_plugin.h b/usr/src/uts/common/sys/overlay_plugin.h index 07efaa05df..3392973562 100644 --- a/usr/src/uts/common/sys/overlay_plugin.h +++ b/usr/src/uts/common/sys/overlay_plugin.h @@ -54,30 +54,30 @@ * * overlay_plugin_init_t * - * This interface is used to create a new instance of a plugin. An instance - * of a plugin will be created for each overlay device that is created. For - * example, if a device is created with VXLAN ID 23 and ID 42, then there - * will be two different calls to this function. + * This interface is used to create a new instance of a plugin. An instance + * of a plugin will be created for each overlay device that is created. For + * example, if a device is created with VXLAN ID 23 and ID 42, then there + * will be two different calls to this function. * - * This function gives the plugin a chance to create a private data - * structure that will be returned on subsequent calls to the system. + * This function gives the plugin a chance to create a private data + * structure that will be returned on subsequent calls to the system. * * overlay_plugin_fini_t * - * This is the opposite of overlay_plugin_init_t. It will be called when it - * is safe to remove any private data that is associated with this instance - * of the plugin. + * This is the opposite of overlay_plugin_init_t. It will be called when it + * is safe to remove any private data that is associated with this instance + * of the plugin. * * overlay_plugin_propinfo_t * - * This is called with the name of a property that is registered when the - * plugin is created. This function will be called with the name of the - * property that information is being requested about. The plugin is - * responsible for filling out information such as setting the name, the - * type of property it is, the protection of the property (can a user - * update it?), whether the property is required, an optional default value - * for the property, and an optional set of values or ranges that are - * allowed. + * This is called with the name of a property that is registered when the + * plugin is created. This function will be called with the name of the + * property that information is being requested about. The plugin is + * responsible for filling out information such as setting the name, the + * type of property it is, the protection of the property (can a user + * update it?), whether the property is required, an optional default value + * for the property, and an optional set of values or ranges that are + * allowed. * * overlay_plugin_getprop_t * @@ -93,103 +93,103 @@ * * overlay_plugin_socket_t * - * Every overlay device has a corresponding socket that it uses to send and - * receive traffic. This routine is used to get the parameters that should - * be used to define such a socket. The actual socket may be multiplexed - * with other uses of it. + * Every overlay device has a corresponding socket that it uses to send and + * receive traffic. This routine is used to get the parameters that should + * be used to define such a socket. The actual socket may be multiplexed + * with other uses of it. * * overlay_plugin_sockopt_t * - * Allow a plugin to set any necessary socket options that it needs on the - * kernel socket that is being used by a mux. This will only be called once - * for a given mux, if additional devices are added to a mux, it will not - * be called additional times. + * Allow a plugin to set any necessary socket options that it needs on the + * kernel socket that is being used by a mux. This will only be called once + * for a given mux, if additional devices are added to a mux, it will not + * be called additional times. * * overlay_plugin_encap_t * - * In this routine you're given a message block and information about the - * packet, such as the identifier and are asked to fill out a message block - * that represents the encapsulation header and optionally manipulate the - * input message if required. + * In this routine you're given a message block and information about the + * packet, such as the identifier and are asked to fill out a message block + * that represents the encapsulation header and optionally manipulate the + * input message if required. * * overlay_plugin_decap_t * - * In this routine, you're given the encapsulated message block. The - * requirement is to decapsulate it and determine what is the correct - * overlay identifier for this network and to fill in the header size so - * the broader system knows how much of this data should be considered - * consumed. + * In this routine, you're given the encapsulated message block. The + * requirement is to decapsulate it and determine what is the correct + * overlay identifier for this network and to fill in the header size so + * the broader system knows how much of this data should be considered + * consumed. * * ovpo_callbacks * - * This should be set to zero, it's reserved for future use. + * This should be set to zero, it's reserved for future use. * * Once these properties are defined, the module should define the following * members in the overlay_plugin_register_t. * * ovep_version * - * Should be set to the value of the macro OVEP_VERSION. + * Should be set to the value of the macro OVEP_VERSION. * * ovep_name * - * Should be set to a character string that has the name of the module. - * Generally this should match the name of the kernel module; however, this - * is the name that users will use to refer to this module when creating - * devices. + * Should be set to a character string that has the name of the module. + * Generally this should match the name of the kernel module; however, this + * is the name that users will use to refer to this module when creating + * devices. * * overlay_plugin_ops_t * - * Should be set to the functions as described above. + * Should be set to the functions as described above. * * ovep_props * - * This is an array of character strings that holds the names of the - * properties of the encapsulation plugin. + * This is an array of character strings that holds the names of the + * properties of the encapsulation plugin. * * * ovep_id_size * - * This is the size in bytes of the valid range for the identifier. The - * valid identifier range is considered a ovep_id_size byte unsigned - * integer, [ 0, 1 << (ovep_id_size * 8) ). + * This is the size in bytes of the valid range for the identifier. The + * valid identifier range is considered a ovep_id_size byte unsigned + * integer, [ 0, 1 << (ovep_id_size * 8) ). * * ovep_flags * - * A series of flags that indicate optional features that are supported. - * Valid flags include: + * A series of flags that indicate optional features that are supported. + * Valid flags include: * - * OVEP_F_VLAN_TAG + * OVEP_F_VLAN_TAG * - * The encapsulation format allows for the encapsulated - * packet to maintain a VLAN tag. + * The encapsulation format allows for the encapsulated + * packet to maintain a VLAN tag. * * ovep_dest * - * Describes the kind of destination that the overlay plugin supports for - * sending traffic. For example, vxlan uses UDP, therefore it requires both - * an IP address and a port; however, nvgre uses the gre header and - * therefore only requires an IP address. The following flags may be - * combined: + * Describes the kind of destination that the overlay plugin supports for + * sending traffic. For example, vxlan uses UDP, therefore it requires both + * an IP address and a port; however, nvgre uses the gre header and + * therefore only requires an IP address. The following flags may be + * combined: * - * OVERLAY_PLUGIN_D_ETHERNET + * OVERLAY_PLUGIN_D_ETHERNET * - * Indicates that to send a packet to its destination, we - * require a link-layer ethernet address. + * Indicates that to send a packet to its destination, we + * require a link-layer ethernet address. * - * OVERLAY_PLUGIN_D_IP + * OVERLAY_PLUGIN_D_IP * - * Indicates that to send a packet to its destination, we - * require an IP address. Note, all IP addresses are - * transmitted as IPv6 addresses and for an IPv4 - * destination, using an IPv4-mapped IPv6 address is the - * expected way to transmit that. + * Indicates that to send a packet to its destination, we + * require an IP address. Note, all IP addresses are + * transmitted as IPv6 addresses and for an IPv4 + * destination, using an IPv4-mapped IPv6 address is the + * expected way to transmit that. * - * OVERLAY_PLUGIN_D_PORT + * OVERLAY_PLUGIN_D_PORT * - * Indicates that to send a packet to its destination, a - * port is required, this usually indicates that the - * protocol uses something like TCP or UDP. + * Indicates that to send a packet to its destination, a + * port is required, this usually indicates that the + * protocol uses something like TCP or UDP. * * * ------------------------------------------------- @@ -209,7 +209,7 @@ * * While servicing a downcall from the general overlay device framework, a * kernel module should not make any upcalls, excepting those functions that are - * defined in this header file, eg. the property related callbacks. Improtantly, + * defined in this header file, eg. the property related callbacks. Importantly, * it cannot make any assumptions about what locks may or may not be held by the * broader system. The only thing that it is safe for it to use are its own * locks. @@ -291,7 +291,7 @@ typedef struct overlay_plugin_register { uint_t ovep_version; const char *ovep_name; const overlay_plugin_ops_t *ovep_ops; - const char **ovep_props; + const char **ovep_props; uint_t ovep_id_size; uint_t ovep_flags; uint_t ovep_dest; diff --git a/usr/src/uts/common/sys/overlay_target.h b/usr/src/uts/common/sys/overlay_target.h index ae92ef3532..775c7d27b8 100644 --- a/usr/src/uts/common/sys/overlay_target.h +++ b/usr/src/uts/common/sys/overlay_target.h @@ -120,30 +120,30 @@ typedef struct overlay_targ_id { * drop a packet. * * - * OVERLAY_TARG_INJECT - overlay_targ_pkt_t + * OVERLAY_TARG_INJECT - overlay_targ_pkt_t * - * The overlay_targ_pkt_t injects a fully formed packet into the - * virtual network. It may either be identified by its data link id - * or by the request id. If both are specified, the - * datalink id will be used. Note, that an injection is not - * considered a reply and if this corresponds to a requeset, then - * that individual packet must still be dropped. + * The overlay_targ_pkt_t injects a fully formed packet into the + * virtual network. It may either be identified by its data link id + * or by the request id. If both are specified, the + * datalink id will be used. Note, that an injection is not + * considered a reply and if this corresponds to a request, then + * that individual packet must still be dropped. * * - * OVERLAY_TARG_PKT - overlay_targ_pkt_t + * OVERLAY_TARG_PKT - overlay_targ_pkt_t * - * This ioctl can be used to copy data from a given request into a - * user buffer. This can be used in combination with - * OVERLAY_TARG_INJECT to implemnt services such as a proxy-arp. + * This ioctl can be used to copy data from a given request into a + * user buffer. This can be used in combination with + * OVERLAY_TARG_INJECT to implement services such as a proxy-arp. * * - * OVERLAY_TARG_RESEND - overlay_targ_pkt_t + * OVERLAY_TARG_RESEND - overlay_targ_pkt_t * - * This ioctl is similar to the OVERLAY_TARG_INJECT, except instead - * of receiving it on the local mac handle, it queues it for - * retransmission again. This is useful if you have a packet that - * was originally destined for some broadcast or multicast address - * that you now want to send to a unicast address. + * This ioctl is similar to the OVERLAY_TARG_INJECT, except instead + * of receiving it on the local mac handle, it queues it for + * retransmission again. This is useful if you have a packet that + * was originally destined for some broadcast or multicast address + * that you now want to send to a unicast address. */ #define OVERLAY_TARG_LOOKUP (OVERLAY_TARG_IOCTL | 0x10) #define OVERLAY_TARG_RESPOND (OVERLAY_TARG_IOCTL | 0x11) @@ -180,12 +180,14 @@ typedef struct overlay_targ_pkt { #ifdef _KERNEL +#pragma pack(4) typedef struct overlay_targ_pkt32 { uint64_t otp_linkid; uint64_t otp_reqid; uint64_t otp_size; caddr32_t otp_buf; } overlay_targ_pkt32_t; +#pragma pack() #endif /* _KERNEL */ @@ -208,46 +210,46 @@ typedef struct overlay_targ_list { * The following family of ioctls all manipulate the target cache of a given * device. * - * OVERLAY_TARG_CACHE_GET - overlay_targ_cache_t + * OVERLAY_TARG_CACHE_GET - overlay_targ_cache_t * - * The overlay_targ_cache_t should be have its link identifier and - * the desired mac address filled in. On return, it will fill in - * the otc_dest member, if the entry exists in the table. + * The overlay_targ_cache_t should be have its link identifier and + * the desired mac address filled in. On return, it will fill in + * the otc_dest member, if the entry exists in the table. * * - * OVERLAY_TARG_CACHE_SET - overlay_targ_cache_t + * OVERLAY_TARG_CACHE_SET - overlay_targ_cache_t * - * The cache table entry of the mac address referred to by otc_mac - * and otd_linkid will be filled in with the details provided by in - * the otc_dest member. + * The cache table entry of the mac address referred to by otc_mac + * and otd_linkid will be filled in with the details provided by in + * the otc_dest member. * - * OVERLAY_TARG_CACHE_REMOVE - overlay_targ_cache_t + * OVERLAY_TARG_CACHE_REMOVE - overlay_targ_cache_t * - * Removes the cache entry identified by otc_mac from the table. - * Note that this does not stop any in-flight lookups or deal with - * any data that is awaiting a lookup. + * Removes the cache entry identified by otc_mac from the table. + * Note that this does not stop any in-flight lookups or deal with + * any data that is awaiting a lookup. * * - * OVERLAY_TARG_CACHE_FLUSH - overlay_targ_cache_t + * OVERLAY_TARG_CACHE_FLUSH - overlay_targ_cache_t * - * Similar to OVERLAY_TARG_CACHE_REMOVE, but functions on the - * entire table identified by otc_linkid. All other parameters are - * ignored. + * Similar to OVERLAY_TARG_CACHE_REMOVE, but functions on the + * entire table identified by otc_linkid. All other parameters are + * ignored. * * - * OVERLAY_TARG_CACHE_ITER - overlay_targ_cache_iter_t + * OVERLAY_TARG_CACHE_ITER - overlay_targ_cache_iter_t * - * Iterates over the contents of a target cache identified by - * otci_linkid. Iteration is guaranteed to be exactly once for - * items which are in the hashtable at the beginning and end of - * iteration. For items which are added or removed after iteration - * has begun, only at most once semantics are guaranteed. Consumers - * should ensure that otci_marker is zeroed before starting - * iteration and should preserve its contents across calls. + * Iterates over the contents of a target cache identified by + * otci_linkid. Iteration is guaranteed to be exactly once for + * items which are in the hashtable at the beginning and end of + * iteration. For items which are added or removed after iteration + * has begun, only at most once semantics are guaranteed. Consumers + * should ensure that otci_marker is zeroed before starting + * iteration and should preserve its contents across calls. * - * Before calling in, otci_count should be set to the number of - * entries that space has been allocated for in otci_ents. The - * value will be updated to indicate the total number written out. + * Before calling in, otci_count should be set to the number of + * entries that space has been allocated for in otci_ents. The + * value will be updated to indicate the total number written out. */ #define OVERLAY_TARG_CACHE_GET (OVERLAY_TARG_IOCTL | 0x30) diff --git a/usr/src/uts/common/sys/pci.h b/usr/src/uts/common/sys/pci.h index d62d19c3a5..5dd6762ab5 100644 --- a/usr/src/uts/common/sys/pci.h +++ b/usr/src/uts/common/sys/pci.h @@ -621,6 +621,8 @@ extern "C" { #define PCI_CAP_ID_MSI_X 0x11 /* MSI-X supported */ #define PCI_CAP_ID_SATA 0x12 /* SATA Data/Index Config supported */ #define PCI_CAP_ID_FLR 0x13 /* Function Level Reset supported */ +#define PCI_CAP_ID_EA 0x14 /* Enhanced Allocation */ +#define PCI_CAP_ID_FPB 0x15 /* Flattening Portal Bridge */ /* * Capability next entry pointer values @@ -909,13 +911,16 @@ typedef struct pcix_attr { #define PCI_MSI_CTRL 0x02 /* MSI control register, 2 bytes */ #define PCI_MSI_ADDR_OFFSET 0x04 /* MSI 32-bit msg address, 4 bytes */ #define PCI_MSI_32BIT_DATA 0x08 /* MSI 32-bit msg data, 2 bytes */ +#define PCI_MSI_32BIT_EXTDATA 0x0A /* MSI 32-bit msg ext data, 2 bytes */ #define PCI_MSI_32BIT_MASK 0x0C /* MSI 32-bit mask bits, 4 bytes */ #define PCI_MSI_32BIT_PENDING 0x10 /* MSI 32-bit pending bits, 4 bytes */ /* * PCI Message Signalled Interrupts (MSI) capability entry offsets for 64-bit */ +#define PCI_MSI_64BIT_ADDR 0x08 /* MSI 64-bit upper address, 4 bytes */ #define PCI_MSI_64BIT_DATA 0x0C /* MSI 64-bit msg data, 2 bytes */ +#define PCI_MSI_64BIT_EXTDATA 0x0E /* MSI 64-bit msg ext data, 2 bytes */ #define PCI_MSI_64BIT_MASKBITS 0x10 /* MSI 64-bit mask bits, 4 bytes */ #define PCI_MSI_64BIT_PENDING 0x14 /* MSI 64-bit pending bits, 4 bytes */ diff --git a/usr/src/uts/common/sys/pcie.h b/usr/src/uts/common/sys/pcie.h index e8f91a1390..1901b200d8 100644 --- a/usr/src/uts/common/sys/pcie.h +++ b/usr/src/uts/common/sys/pcie.h @@ -24,6 +24,7 @@ */ /* * Copyright 2019 Joyent, Inc. + * Copyright 2021 Oxide Computer Company */ #ifndef _SYS_PCIE_H @@ -536,6 +537,7 @@ extern "C" { #define PCIE_EXT_CAP_NEXT_PTR_MASK 0xFFF #define PCIE_EXT_CAP_NEXT_PTR_NULL 0x0 +#define PCIE_EXT_CAP_MAX_PTR 0x3c0 /* max. number of caps */ /* * PCI-Express Enhanced Capability Identifier Values @@ -559,6 +561,7 @@ extern "C" { #define PCIE_EXT_CAP_ID_SRIOV 0x10 /* Single Root I/O Virt. */ #define PCIE_EXT_CAP_ID_MRIOV 0x11 /* Multi Root I/O Virt. */ #define PCIE_EXT_CAP_ID_MULTICAST 0x12 /* Multicast Services */ +#define PCIE_EXT_CAP_ID_PGREQ 0x13 /* Page Request */ #define PCIE_EXT_CAP_ID_EA 0x14 /* Enhanced Allocation */ #define PCIE_EXT_CAP_ID_RESIZE_BAR 0x15 /* Resizable BAR */ #define PCIE_EXT_CAP_ID_DPA 0x16 /* Dynamic Power Allocation */ @@ -573,11 +576,23 @@ extern "C" { #define PCIE_EXT_CAP_ID_FRS 0x21 /* Function Ready Stat. Queue */ #define PCIE_EXT_CAP_ID_RTR 0x22 /* Readiness Time Reporting */ #define PCIE_EXT_CAP_ID_DVS 0x23 /* Designated Vendor-Specific */ +#define PCIE_EXT_CAP_ID_VFRBAR 0x24 /* VF Resizable BAR */ #define PCIE_EXT_CAP_ID_DLF 0x25 /* Data Link Feature */ -#define PCIE_EXT_CAP_ID_PL16GTE 0x26 /* Physical Layer 16.0 GT/s */ +#define PCIE_EXT_CAP_ID_PL16GT 0x26 /* Physical Layer 16.0 GT/s */ #define PCIE_EXT_CAP_ID_LANE_MARGIN 0x27 /* Lane Margining */ #define PCIE_EXT_CAP_ID_HIEARCHY_ID 0x28 /* Hierarchy ID */ #define PCIE_EXT_CAP_ID_NPEM 0x29 /* Native PCIe Enclosure Mgmt */ +#define PCIE_EXT_CAP_ID_PL32GT 0x2A /* Physical Layer 32.0 GT/s */ +#define PCIE_EXT_CAP_ID_AP 0x2B /* Alternate Protocol */ +#define PCIE_EXT_CAP_ID_SFI 0x2C /* Sys. Firmware Intermediary */ +#define PCIE_EXT_CAP_ID_SHDW_FUNC 0x2D /* Shadow Functions */ +#define PCIE_EXT_CAP_ID_DOE 0x2E /* Data Object Exchange */ +#define PCIE_EXT_CAP_ID_DEV3 0x2F /* Device 3 */ +#define PCIE_EXT_CAP_ID_IDE 0x30 /* Integrity and Data Encr. */ +#define PCIE_EXT_CAP_ID_PL64GT 0x31 /* Physical Layer 64.0 GT/s */ +#define PCIE_EXT_CAP_ID_FLIT_LOG 0x32 /* Flit Logging */ +#define PCIE_EXT_CAP_ID_FLIT_PERF 0x33 /* Flit Perf. Measurement */ +#define PCIE_EXT_CAP_ID_FLIT_ERR 0x34 /* Flit Error Injection */ /* * PCI-Express Advanced Error Reporting Extended Capability Offsets @@ -596,6 +611,7 @@ extern "C" { #define PCIE_AER_RE_STS 0x30 /* Root Error Status */ #define PCIE_AER_CE_SRC_ID 0x34 /* Error Source ID */ #define PCIE_AER_ERR_SRC_ID 0x36 /* Error Source ID */ +#define PCIE_AER_TLP_PRE_LOG 0x38 /* TLP Prefix Log */ /* Bridges Only */ #define PCIE_AER_SUCE_STS 0x2c /* Secondary UCE Status */ diff --git a/usr/src/uts/common/sys/pcie_impl.h b/usr/src/uts/common/sys/pcie_impl.h index 442c55043c..07eb6fee65 100644 --- a/usr/src/uts/common/sys/pcie_impl.h +++ b/usr/src/uts/common/sys/pcie_impl.h @@ -379,8 +379,6 @@ typedef struct pcie_bus { void *bus_hp_ctrl; /* HP bus ctrl data */ int bus_ari; /* ARI device */ - uint64_t bus_cfgacc_base; /* config space base address */ - /* workaround for PCI/PCI-X devs behind PCIe2PCI Bridge */ pcie_req_id_t bus_pcie2pci_secbus; diff --git a/usr/src/uts/common/sys/plat/pci_prd.h b/usr/src/uts/common/sys/plat/pci_prd.h new file mode 100644 index 0000000000..aa0a7932b8 --- /dev/null +++ b/usr/src/uts/common/sys/plat/pci_prd.h @@ -0,0 +1,130 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2022 Oxide Computer Company + */ + +#ifndef _SYS_PLAT_PCI_PRD_H +#define _SYS_PLAT_PCI_PRD_H + +/* + * PCI Platform Resource Discovery (PRD) + * + * This file forms the platform-specific interfaces that a given platform must + * implement to support the discovery of PCI resources. In particular: + * + * o Any root complexes that do not show up through the use of normal scanning + * o Available resources per root-port including: + * + I/O ports + * + Prefetchable Memory + * + Normal Memory + * + PCI buses + * o The naming of slots (the platform uses the PCIe default) + * + * These interfaces are all expected to be implemented by a platform's 'pci_prd' + * module. This is left as a module and not a part of say, unix, so that it can + * in turn depend on other modules that a platform might require, such as ACPI. + * + * In general, unless otherwise indicated, these interfaces will always be + * called from kernel context, typically during boot. The interfaces will only + * be called from a single thread at this time and any locking is managed at a + * layer outside of the pci_prd interfaces. If the subsystem is using some other + * interfaces that may be used by multiple consumers and needs locking (e.g. + * ACPI), then that still must be considered in the design and implementation. + */ + +#include <sys/types.h> +#include <sys/memlist.h> +#include <sys/sunddi.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Resource types that can be asked after. + */ +typedef enum pci_prd_rsrc { + PCI_PRD_R_IO, + PCI_PRD_R_MMIO, + PCI_PRD_R_PREFETCH, + PCI_PRD_R_BUS +} pci_prd_rsrc_t; + +typedef struct pci_prd_upcalls { + /* + * Return a dev_info_t, if one exists, for this PCI bus. + */ + dev_info_t *(*pru_bus2dip_f)(uint32_t); +} pci_prd_upcalls_t; + +/* + * Initialization and teardown functions that will be used by the PCI + * enumeration code when it attaches and detaches. If all work is done before + * these come up, there is nothing to do; however, after a call to the _init() + * function, it is expected that the platform module will be ready to respond to + * all function calls. + * + * Note that the _fini function may never be called as on a typical system, as + * any PCI(e) devices with attached drivers will result in the PRD consumer + * remaining loaded. + */ +extern int pci_prd_init(pci_prd_upcalls_t *); +extern void pci_prd_fini(void); + +/* + * Return the maximum PCI bus on this platform that should be searched. This + * number is the last bus number that should be scanned. e.g. a value of 0x10 + * indicates that we will search buses [0, 0x10]. In general, it is expected + * that platforms will just return 0xff (PCI_MAX_BUS_NUM - 1) unless for some + * reason it has other knowledge here. + */ +extern uint32_t pci_prd_max_bus(void); + +/* + * Look up a set of resources that should be assigned to the PCI bus. In + * general, it is expected that these are only the buses that are assigned to + * root complexes. + */ +extern struct memlist *pci_prd_find_resource(uint32_t, pci_prd_rsrc_t); + +/* + * Originally when only using BIOS-derived (pre-ACPI) sources on i86pc, the + * ability to utilize data about multiple buses was considered suspect. As such, + * this exists as a way to indicate that resources on each root complex are + * actually valid. + */ +extern boolean_t pci_prd_multi_root_ok(void); + +/* + * This is used to allow the PCI enumeration code to ask the platform about any + * PCI root complexes that it might know about which might not be discovered + * through the normal scanning process. One callback will be emitted for each + * PCI bus via a call to the callback function. The return value of the callback + * function determines whether we should continue iterating (B_TRUE) or + * terminate (B_FALSE). + */ +typedef boolean_t (*pci_prd_root_complex_f)(uint32_t, void *); +extern void pci_prd_root_complex_iter(pci_prd_root_complex_f, void *); + +/* + * Give the chance for a platform file to go through and use knowledge that it + * has (such as the traditional BIOS PCI IRQ routing table) to name the PCI(e) + * slot. + */ +extern void pci_prd_slot_name(uint32_t, dev_info_t *); + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_PLAT_PCI_PRD_H */ diff --git a/usr/src/uts/common/sys/policy.h b/usr/src/uts/common/sys/policy.h index 816d6995cf..9f1b80d390 100644 --- a/usr/src/uts/common/sys/policy.h +++ b/usr/src/uts/common/sys/policy.h @@ -53,12 +53,12 @@ typedef uint16_t in_port_t; * priv_policy_choice * determines extend of operation * audit on success - * returns a boolean_t indicating success (B_TRUE) or failure. + * returns a boolean_t indicating success (B_TRUE) or failure. * * priv_policy_only * when auditing is in appropriate (interrupt context) * to determine context of operation - * returns a boolean_t indicating success (B_TRUE) or failure. + * returns a boolean_t indicating success (B_TRUE) or failure. * */ int priv_policy(const cred_t *, int, boolean_t, int, const char *); @@ -166,7 +166,7 @@ int secpolicy_vnode_setid_retain(const cred_t *, boolean_t); int secpolicy_vnode_setids_setgids(const cred_t *, gid_t); int secpolicy_vnode_stky_modify(const cred_t *); int secpolicy_vscan(const cred_t *); -int secpolicy_xhci(const cred_t *); +int secpolicy_hwmanip(const cred_t *); int secpolicy_zinject(const cred_t *); int secpolicy_zfs(const cred_t *); int secpolicy_ucode_update(const cred_t *); diff --git a/usr/src/uts/common/sys/priocntl.h b/usr/src/uts/common/sys/priocntl.h index 682c79ed7c..396672a31f 100644 --- a/usr/src/uts/common/sys/priocntl.h +++ b/usr/src/uts/common/sys/priocntl.h @@ -54,7 +54,7 @@ extern long priocntlset(procset_t *, int, ...); #define PC_SETPARMS 2 /* Set scheduling parameters */ #define PC_GETPARMS 3 /* Get scheduling parameters */ #define PC_ADMIN 4 /* Scheduler administration (used by */ - /* dispadmin(1M), not for general use) */ + /* dispadmin(8), not for general use) */ #define PC_GETPRIRANGE 5 /* Get priority range for a class */ /* posix.4 scheduling, not for general use */ #define PC_DONICE 6 /* Set or get nice value */ @@ -152,7 +152,7 @@ typedef struct pcpri { } pcpri_t; /* - * The following is used by the dispadmin(1M) command for + * The following is used by the dispadmin(8) command for * scheduler administration and is not for general use. */ diff --git a/usr/src/uts/common/sys/proc.h b/usr/src/uts/common/sys/proc.h index 7d2209132d..74c6d46781 100644 --- a/usr/src/uts/common/sys/proc.h +++ b/usr/src/uts/common/sys/proc.h @@ -21,7 +21,8 @@ /* * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright 2018 Joyent, Inc. + * Copyright 2021 Joyent, Inc. + * Copyright 2021 Oxide Computer Company */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ @@ -153,7 +154,7 @@ typedef struct proc { char p_stat; /* status of process */ char p_wcode; /* current wait code */ ushort_t p_pidflag; /* flags protected only by pidlock */ - int p_wdata; /* current wait return value */ + int p_wdata; /* current wait return value */ pid_t p_ppid; /* process id of parent */ struct proc *p_link; /* forward link */ struct proc *p_parent; /* ptr to parent process */ @@ -162,16 +163,16 @@ typedef struct proc { struct proc *p_psibling; /* ptr to prev sibling proc on chain */ struct proc *p_sibling_ns; /* prt to siblings with new state */ struct proc *p_child_ns; /* prt to children with new state */ - struct proc *p_next; /* active chain link next */ - struct proc *p_prev; /* active chain link prev */ - struct proc *p_nextofkin; /* gets accounting info at exit */ - struct proc *p_orphan; - struct proc *p_nextorph; + struct proc *p_next; /* active chain link next */ + struct proc *p_prev; /* active chain link prev */ + struct proc *p_nextofkin; /* gets accounting info at exit */ + struct proc *p_orphan; + struct proc *p_nextorph; struct proc *p_pglink; /* process group hash chain link next */ struct proc *p_ppglink; /* process group hash chain link prev */ struct sess *p_sessp; /* session information */ - struct pid *p_pidp; /* process ID info */ - struct pid *p_pgidp; /* process group ID info */ + struct pid *p_pidp; /* process ID info */ + struct pid *p_pgidp; /* process group ID info */ /* * Fields protected by p_lock */ @@ -216,7 +217,7 @@ typedef struct proc { * Per process lwp and kernel thread stuff */ id_t p_lwpid; /* most recently allocated lwpid */ - int p_lwpcnt; /* number of lwps in this process */ + int p_lwpcnt; /* number of lwps in this process */ int p_lwprcnt; /* number of not stopped lwps */ int p_lwpdaemon; /* number of TP_DAEMON lwps */ int p_lwpwait; /* number of lwps in lwp_wait() */ @@ -355,6 +356,8 @@ typedef struct proc { kcondvar_t p_poolcv; /* synchronization with pools */ uint_t p_poolcnt; /* # threads inside pool barrier */ uint_t p_poolflag; /* pool-related flags (see below) */ + uint_t p_upanicflag; /* upanic-related flags (see below) */ + void *p_upanic; /* optional upanic data */ uintptr_t p_portcnt; /* event ports counter */ struct zone *p_zone; /* zone in which process lives */ struct vnode *p_execdir; /* directory that p_exec came from */ @@ -524,6 +527,14 @@ extern struct pid pid0; /* p0's pid */ #define PBWAIT 0x0001 /* process should wait outside fork/exec/exit */ #define PEXITED 0x0002 /* process exited and about to become zombie */ +/* + * p_upanicflag codes + */ +#define P_UPF_PANICKED 0x0001 +#define P_UPF_HAVEMSG 0x0002 +#define P_UPF_TRUNCMSG 0x0004 +#define P_UPF_INVALMSG 0x0008 + /* Macro to convert proc pointer to a user block pointer */ #define PTOU(p) (&(p)->p_user) @@ -701,7 +712,7 @@ extern kthread_t *thread_create( void (*proc)(), void *arg, size_t len, - proc_t *pp, + proc_t *pp, int state, pri_t pri); extern void thread_exit(void) __NORETURN; @@ -709,10 +720,27 @@ extern void thread_free(kthread_t *); extern void thread_rele(kthread_t *); extern void thread_join(kt_did_t); extern int reaper(void); -extern void installctx(kthread_t *, void *, void (*)(), void (*)(), - void (*)(), void (*)(), void (*)(), void (*)()); -extern int removectx(kthread_t *, void *, void (*)(), void (*)(), - void (*)(), void (*)(), void (*)(), void (*)()); + +#define CTXOP_TPL_REV 1 + +struct ctxop_template { + uint32_t ct_rev; + uint32_t ct_pad; + void (*ct_save)(void *); + void (*ct_restore)(void *); + void (*ct_fork)(void *, void *); + void (*ct_lwp_create)(void *, void *); + void (*ct_exit)(void *); + void (*ct_free)(void *, int); +}; + +extern struct ctxop *ctxop_allocate(const struct ctxop_template *, void *); +extern void ctxop_free(struct ctxop *); +extern void ctxop_attach(kthread_t *, struct ctxop *); +extern void ctxop_detach(kthread_t *, struct ctxop *); +extern void ctxop_install(kthread_t *, const struct ctxop_template *, void *); +extern int ctxop_remove(kthread_t *, const struct ctxop_template *, void *); + extern void savectx(kthread_t *); extern void restorectx(kthread_t *); extern void forkctx(kthread_t *, kthread_t *); @@ -748,7 +776,7 @@ extern int tsd_agent_set(kthread_t *, uint_t, void *); /* lwp function prototypes */ extern kthread_t *lwp_kernel_create(proc_t *, void (*)(), void *, int, pri_t); -extern klwp_t *lwp_create( +extern klwp_t *lwp_create( void (*proc)(), caddr_t arg, size_t len, diff --git a/usr/src/uts/common/sys/procfs.h b/usr/src/uts/common/sys/procfs.h index 517f2551b4..3d6760a7b4 100644 --- a/usr/src/uts/common/sys/procfs.h +++ b/usr/src/uts/common/sys/procfs.h @@ -678,6 +678,21 @@ typedef struct prheader { (((unsigned)((flag)-1) < 32*sizeof (*(sp))/sizeof (uint32_t)) && \ (((uint32_t *)(sp))[((flag)-1)/32] & (1U<<(((flag)-1)%32)))) +/* + * Core file upanic NT_UPANIC structure. + */ +#define PRUPANIC_VERSION_1 1 +#define PRUPANIC_VERSION_CURRENT PRUPANIC_VERSION_1 +#define PRUPANIC_FLAG_MSG_VALID 0x01 +#define PRUPANIC_FLAG_MSG_ERROR 0x02 +#define PRUPANIC_FLAG_MSG_TRUNC 0x04 +#define PRUPANIC_BUFLEN 1024 +typedef struct prupanic { + uint32_t pru_version; + uint32_t pru_flags; + uint8_t pru_data[PRUPANIC_BUFLEN]; +} prupanic_t; + #if defined(_SYSCALL32) /* diff --git a/usr/src/uts/common/sys/ptms.h b/usr/src/uts/common/sys/ptms.h index 8b97fd7e3b..52d69b3416 100644 --- a/usr/src/uts/common/sys/ptms.h +++ b/usr/src/uts/common/sys/ptms.h @@ -35,18 +35,17 @@ extern "C" { #ifdef _KERNEL /* - * Structures and definitions supporting the pseudo terminal - * drivers. This structure is private and should not be used by any - * applications. + * Structures and definitions supporting the pseudo-terminal drivers. This + * structure is private and should not be used by any applications. */ struct pt_ttys { - queue_t *ptm_rdq; /* master's read queue pointer */ - queue_t *pts_rdq; /* slave's read queue pointer */ + queue_t *ptm_rdq; /* manager's read queue pointer */ + queue_t *pts_rdq; /* subsidiary's read queue pointer */ mblk_t *pt_nullmsg; /* 0-bytes message block for pts close */ pid_t pt_pid; /* process id (for debugging) */ minor_t pt_minor; /* Minor number of this pty */ int pt_refcnt; /* reference count for ptm_rdq/pts_rdq uses */ - ushort_t pt_state; /* state of master/slave pair */ + ushort_t pt_state; /* state of manager/subsidiary pair */ kcondvar_t pt_cv; /* condition variable for exclusive access */ kmutex_t pt_lock; /* Per-element lock */ zoneid_t pt_zoneid; /* Zone membership for this pty */ @@ -57,10 +56,10 @@ struct pt_ttys { /* * pt_state values */ -#define PTLOCK 0x01 /* master/slave pair is locked */ -#define PTMOPEN 0x02 /* master side is open */ -#define PTSOPEN 0x04 /* slave side is open */ -#define PTSTTY 0x08 /* slave side is tty */ +#define PTLOCK 0x01 /* manager/subsidiary pair is locked */ +#define PTMOPEN 0x02 /* manager side is open */ +#define PTSOPEN 0x04 /* subsidiary side is open */ +#define PTSTTY 0x08 /* subsidiary side is tty */ /* * Multi-threading primitives. @@ -104,17 +103,17 @@ struct pt_ttys { * ptms_lock and pt_cnt are defined in ptms_conf.c */ extern kmutex_t ptms_lock; -extern dev_info_t *pts_dip; /* private copy of devinfo ptr */ +extern dev_info_t *pts_dip; /* private copy of devinfo ptr */ extern void ptms_init(void); extern struct pt_ttys *pt_ttys_alloc(void); extern void ptms_close(struct pt_ttys *, uint_t); extern struct pt_ttys *ptms_minor2ptty(minor_t); -extern int ptms_attach_slave(void); +extern int ptms_attach_subsidiary(void); extern int ptms_minor_valid(minor_t ptmin, uid_t *uid, gid_t *gid); extern int ptms_minor_exists(minor_t ptmin); extern void ptms_set_owner(minor_t ptmin, uid_t uid, gid_t gid); -extern major_t ptms_slave_attached(void); +extern major_t ptms_subsidiary_attached(void); #ifdef DEBUG extern void ptms_log(char *, uint_t); @@ -140,28 +139,32 @@ typedef struct pt_own { } pt_own_t; /* - * ioctl commands + * IOCTL COMMANDS * - * ISPTM: Determines whether the file descriptor is that of an open master - * device. Return code of zero indicates that the file descriptor - * represents master device. + * ISPTM + * Determines whether the file descriptor is that of an open + * manager device. Return code of zero indicates that the file + * descriptor represents a manager device. * - * UNLKPT: Unlocks the master and slave devices. It returns 0 on success. On - * failure, the errno is set to EINVAL indicating that the master - * device is not open. + * UNLKPT + * Unlocks the manager and subsidiary devices. It returns 0 on + * success. On failure, the errno is set to EINVAL indicating + * that the manager device is not open. * - * ZONEPT: Sets the zoneid of the pair of master and slave devices. It - * returns 0 upon success. Used to force a pty 'into' a zone upon - * zone entry. - * - * PT_OWNER: Sets uid and gid for slave device. It returns 0 on success. + * ZONEPT + * Sets the zoneid of the pair of manager and subsidiary devices. + * It returns 0 upon success. Used to force a pty 'into' a zone + * upon zone entry. * + * PT_OWNER + * Sets uid and gid for subsidiary device. It returns 0 on + * success. */ -#define ISPTM (('P'<<8)|1) /* query for master */ -#define UNLKPT (('P'<<8)|2) /* unlock master/slave pair */ -#define PTSSTTY (('P'<<8)|3) /* set tty flag */ -#define ZONEPT (('P'<<8)|4) /* set zone of master/slave pair */ -#define OWNERPT (('P'<<8)|5) /* set owner/group for slave device */ +#define ISPTM (('P'<<8)|1) /* query for manager */ +#define UNLKPT (('P'<<8)|2) /* unlock manager/subsidiary pair */ +#define PTSSTTY (('P'<<8)|3) /* set tty flag */ +#define ZONEPT (('P'<<8)|4) /* set zone of manager/subsidiary pair */ +#define OWNERPT (('P'<<8)|5) /* set owner/group for subsidiary */ #ifdef _KERNEL /* diff --git a/usr/src/uts/common/sys/ptyvar.h b/usr/src/uts/common/sys/ptyvar.h index 76bc74c36a..ee00379fd8 100644 --- a/usr/src/uts/common/sys/ptyvar.h +++ b/usr/src/uts/common/sys/ptyvar.h @@ -25,14 +25,12 @@ */ /* - * Pseudo-tty driver data structures. + * Pseudo-terminal driver data structures. */ #ifndef _SYS_PTYVAR_H #define _SYS_PTYVAR_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/tty.h> #ifdef __cplusplus @@ -49,8 +47,8 @@ struct pty { struct proc *pt_selr; /* proc selecting on controller read */ struct proc *pt_selw; /* proc selecting on controller write */ struct proc *pt_sele; /* proc selecting on exception */ - dev_t pt_sdev; /* XXX dev no for the slave */ - struct vnode *pt_vnode; /* XXX vnode for the slave */ + dev_t pt_sdev; /* XXX dev no for the subsidiary */ + struct vnode *pt_vnode; /* XXX vnode for the subsidiary */ short pt_pgrp; /* controller side process group */ uchar_t pt_send; /* pending message to controller */ uchar_t pt_ucntl; /* pending iocontrol for controller */ @@ -67,11 +65,11 @@ struct pty { #define PF_ASYNC 0x00000010 /* asynchronous I/O on controller */ #define PF_WOPEN 0x00000020 /* waiting for open to complete */ #define PF_CARR_ON 0x00000040 /* "carrier" is on (cntlr. is open) */ -#define PF_SLAVEGONE 0x00000080 /* slave was open, but is now closed */ +#define PF_SUBSIDGONE 0x00000080 /* subsidiary was open, now closed */ #define PF_PKT 0x00000100 /* packet mode */ #define PF_STOPPED 0x00000200 /* user told stopped */ #define PF_REMOTE 0x00000400 /* remote and flow controlled input */ -#define PF_NOSTOP 0x00000800 /* slave is doing XON/XOFF */ +#define PF_NOSTOP 0x00000800 /* subsidiary is doing XON/XOFF */ #define PF_UCNTL 0x00001000 /* user control mode */ #define PF_43UCNTL 0x00002000 /* real 4.3 user control mode */ #define PF_IOCTL 0x00004000 /* ioctl call in progress */ diff --git a/usr/src/uts/common/sys/ramdisk.h b/usr/src/uts/common/sys/ramdisk.h index a750336d37..202fff360f 100644 --- a/usr/src/uts/common/sys/ramdisk.h +++ b/usr/src/uts/common/sys/ramdisk.h @@ -26,8 +26,6 @@ #ifndef _SYS_RAMDISK_H #define _SYS_RAMDISK_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> #include <sys/time.h> #include <sys/vtoc.h> @@ -93,7 +91,7 @@ extern "C" { } /* - * Interface between the ramdisk(7D) driver and ramdiskadm(1M). Use is: + * Interface between the ramdisk(4D) driver and ramdiskadm(8). Use is: * * fd = open("/dev/ramdiskctl", O_RDWR | O_EXCL); * @@ -117,7 +115,7 @@ extern "C" { * by the RD_DELETE_DISK ioctl). * * Note that these ioctls are completely private, and only for the use of - * ramdiskadm(1M). + * ramdiskadm(8). */ #define RD_IOC_BASE (('R' << 16) | ('D' << 8)) diff --git a/usr/src/uts/common/sys/rgb.h b/usr/src/uts/common/sys/rgb.h index 9ddfaa9e3f..3f5bc12937 100644 --- a/usr/src/uts/common/sys/rgb.h +++ b/usr/src/uts/common/sys/rgb.h @@ -23,6 +23,13 @@ extern "C" { #endif /* + * Number of "base" colors is 16, 8 dark and 8 bright/light. + * Color map size for indexed colors is 256, to support VGA 256-color modes. + */ +#define NCOLORS 16 +#define NCMAP 256 + +/* * Color data from bootloader. */ typedef struct rgb_color { @@ -36,10 +43,12 @@ typedef struct rgb { rgb_color_t blue; } rgb_t; +extern rgb_t rgb_info; + typedef struct { - uint8_t red[16]; - uint8_t green[16]; - uint8_t blue[16]; + uint8_t red[NCOLORS]; + uint8_t green[NCOLORS]; + uint8_t blue[NCOLORS]; } text_cmap_t; extern const text_cmap_t cmap4_to_24; @@ -67,12 +76,34 @@ typedef enum pc_colors { pc_brt_white = 15 } pc_colors_t; +typedef enum sun_colors { + sun_brt_white = 0, + sun_black = 1, + sun_blue = 2, + sun_green = 3, + sun_cyan = 4, + sun_red = 5, + sun_magenta = 6, + sun_brown = 7, + sun_white = 8, + sun_grey = 9, + sun_brt_blue = 10, + sun_brt_green = 11, + sun_brt_cyan = 12, + sun_brt_red = 13, + sun_brt_magenta = 14, + sun_yellow = 15, +} sun_colors_t; + #define XLATE_NCOLORS 8 extern const uint8_t dim_xlate[XLATE_NCOLORS]; extern const uint8_t brt_xlate[XLATE_NCOLORS]; -extern const uint8_t solaris_color_to_pc_color[16]; +extern const uint8_t solaris_color_to_pc_color[NCOLORS]; +extern const uint8_t pc_color_to_solaris_color[NCOLORS]; -extern uint32_t rgb_color_map(const rgb_t *, uint8_t); +extern uint32_t rgb_to_color(const rgb_t *, uint32_t, uint32_t, uint32_t, + uint32_t); +extern uint32_t rgb_color_map(const rgb_t *, uint8_t, uint8_t); #ifdef __cplusplus } diff --git a/usr/src/uts/common/sys/rtpriocntl.h b/usr/src/uts/common/sys/rtpriocntl.h index 6c9d824944..3baa1b62d8 100644 --- a/usr/src/uts/common/sys/rtpriocntl.h +++ b/usr/src/uts/common/sys/rtpriocntl.h @@ -67,7 +67,7 @@ typedef struct rtinfo { #define RT_KY_TQSIG 4 /* real-time time quantum signal */ /* - * The following is used by the dispadmin(1M) command for + * The following is used by the dispadmin(8) command for * scheduler administration and is not for general use. */ diff --git a/usr/src/uts/common/sys/scsi/adapters/mpapi_impl.h b/usr/src/uts/common/sys/scsi/adapters/mpapi_impl.h index a2f8343a50..f19c0c9346 100644 --- a/usr/src/uts/common/sys/scsi/adapters/mpapi_impl.h +++ b/usr/src/uts/common/sys/scsi/adapters/mpapi_impl.h @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright 2021 RackTop Systems, Inc. */ #ifndef _SYS_SCSI_ADAPTERS_MPAPI_IMPL_H @@ -28,6 +29,7 @@ #include <sys/sunmdi.h> #include <sys/sunddi.h> #include <sys/mdi_impldefs.h> +#include <sys/debug.h> #ifdef __cplusplus extern "C" { @@ -69,7 +71,11 @@ typedef struct mp_driver_prop { uint32_t autoProbingEnabled; uint32_t proprietaryPropSize; caddr_t proprietaryProp; +#ifdef _ILP32 + uint32_t pad; +#endif } mp_driver_prop_t; +CTASSERT(sizeof (mp_driver_prop_t) == 0x248); /* Size of "proprietaryProp" field */ @@ -161,7 +167,11 @@ typedef struct mp_logical_unit_prop { boolean_t overridePathInUse; uint32_t proprietaryPropSize; caddr_t proprietaryProp; +#ifdef _ILP32 + uint32_t pad; +#endif } mp_logical_unit_prop_t; +CTASSERT(sizeof (mp_logical_unit_prop_t) == 0x268); /* Constants for nameType */ @@ -262,7 +272,11 @@ typedef struct mp_proprietary_loadbalance_prop { uint32_t typeIndex; uint32_t proprietaryPropSize; caddr_t proprietaryProp; +#ifdef _ILP32 + uint32_t pad; +#endif } mp_proprietary_loadbalance_prop_t; +CTASSERT(sizeof (mp_proprietary_loadbalance_prop_t) == 0x218); /* @@ -283,7 +297,7 @@ typedef struct mp_uscsi_cmd { struct buf *rqbp; /* auto-rqsense packet */ mdi_pathinfo_t *pip; /* path information */ int arq_enabled; /* auto-rqsense enable flag */ -}mp_uscsi_cmd_t; +} mp_uscsi_cmd_t; /* * Structure used as input to @@ -369,7 +383,7 @@ typedef struct mp_iocdata32 { #define MP_OBJECT_TYPE_DEVICE_PRODUCT 6 #define MP_OBJECT_TYPE_TARGET_PORT_GROUP 7 #define MP_OBJECT_TYPE_PROPRIETARY_LOAD_BALANCE 8 -#define MP_OBJECT_TYPE_LAST_ENTRY MP_OBJECT_TYPE_PROPRIETARY_LOAD_BALANCE +#define MP_OBJECT_TYPE_LAST_ENTRY MP_OBJECT_TYPE_PROPRIETARY_LOAD_BALANCE #define MP_MAX_OBJECT_TYPE (MP_OBJECT_TYPE_LAST_ENTRY + 1) @@ -399,7 +413,7 @@ typedef struct mp_iocdata32 { #define MP_GET_TARGET_PORT_LIST_FOR_TPG (MP_SUB_CMD + 0x11) #define MP_SET_TPG_ACCESS_STATE (MP_SUB_CMD + 0x12) #define MP_ENABLE_AUTO_FAILBACK (MP_SUB_CMD + 0x13) -#define MP_DISABLE_AUTO_FAILBACK (MP_SUB_CMD + 0x14) +#define MP_DISABLE_AUTO_FAILBACK (MP_SUB_CMD + 0x14) #define MP_ENABLE_PATH (MP_SUB_CMD + 0x15) #define MP_DISABLE_PATH (MP_SUB_CMD + 0x16) #define MP_GET_PROPRIETARY_LOADBALANCE_LIST (MP_SUB_CMD + 0x17) diff --git a/usr/src/uts/common/sys/scsi/adapters/smrt/smrt_scsi.h b/usr/src/uts/common/sys/scsi/adapters/smrt/smrt_scsi.h index 47ef99b2e0..45c4c84407 100644 --- a/usr/src/uts/common/sys/scsi/adapters/smrt/smrt_scsi.h +++ b/usr/src/uts/common/sys/scsi/adapters/smrt/smrt_scsi.h @@ -26,10 +26,10 @@ extern "C" { #endif /* CISS LUN Addressing MODEs */ -#define PERIPHERIAL_DEV_ADDR 0x0 -#define LOGICAL_VOL_ADDR 0x1 -#define MASK_PERIPHERIAL_DEV_ADDR 0x3 -#define CISS_PHYS_MODE 0x0 +#define PERIPHERIAL_DEV_ADDR 0x0 +#define LOGICAL_VOL_ADDR 0x1 +#define MASK_PERIPHERIAL_DEV_ADDR 0x3 +#define CISS_PHYS_MODE 0x0 /* * Vendor-specific SCSI Commands diff --git a/usr/src/uts/common/sys/sensors.h b/usr/src/uts/common/sys/sensors.h index b9ca9f1f3f..a5d830a933 100644 --- a/usr/src/uts/common/sys/sensors.h +++ b/usr/src/uts/common/sys/sensors.h @@ -11,6 +11,7 @@ /* * Copyright 2019, Joyent, Inc. + * Copyright 2020 Oxide Computer Company */ #ifndef _SYS_SENSORS_H @@ -32,6 +33,8 @@ extern "C" { */ #define SENSOR_KIND_UNKNOWN 0x00 #define SENSOR_KIND_TEMPERATURE 0x01 +#define SENSOR_KIND_VOLTAGE 0x02 +#define SENSOR_KIND_CURRENT 0x03 /* * Lists of units that senors may have. @@ -40,39 +43,81 @@ extern "C" { #define SENSOR_UNIT_CELSIUS 0x01 #define SENSOR_UNIT_FAHRENHEIT 0x02 #define SENSOR_UNIT_KELVIN 0x03 +#define SENSOR_UNIT_VOLTS 0x04 +#define SENSOR_UNIT_AMPS 0x05 #define SENSOR_IOCTL (('s' << 24) | ('e' << 16) | ('n' << 8)) /* * Ask the sensor what kind of sensor it is. */ -#define SENSOR_IOCTL_TYPE (SENSOR_IOCTL | 0x01) +#define SENSOR_IOCTL_KIND (SENSOR_IOCTL | 0x01) typedef struct sensor_ioctl_kind { uint64_t sik_kind; } sensor_ioctl_kind_t; /* - * Ask the sensor for a temperature measurement. The sensor is responsible for - * returning the units it's in. A temperature measurement is broken down into a + * Ask the sensor for a scalar measurement. The sensor is responsible for + * returning the units it's in. A scalar measurement is broken down into a * signed value and a notion of its granularity. The sit_gran member indicates - * the granularity: the number of increments per degree in the temperature - * measurement (the sit_temp member). sit_gran is signed and the sign indicates - * whether one needs to multiply or divide the granularity. For example, a - * value that set sit_gran to 10 would mean that the value in sit_temp was in - * 10ths of a degree and that to get the actual value in degrees, one would - * divide by 10. On the other hand, a negative value means that we effectively - * have to multiply to get there. For example, a value of -2 would indicate that - * each value in sit_temp indicated two degrees and to get the temperature in - * degrees you would multiply sit_temp by two. + * the granularity: the number of increments per unit in the measurement (the + * sit_value member). sit_gran is signed and the sign indicates whether one + * needs to multiply or divide the granularity. The sit_prec member describes a + * +/- value (taking sit_gran into account) that describes the precision of the + * sensor. + * + * For example, consider a temperature sensor that set sit_gran to 10. This + * would mean that the value in sit_value was in 10ths of a degree and that to + * get the actual value in degrees, one would divide by 10. On the other hand, a + * negative value means that we effectively have to multiply to get there. For + * example, a value of -2 would indicate that each value in sit_value indicated + * two degrees and to get the temperature in degrees you would multiply + * sit_value * by two. + */ +#define SENSOR_IOCTL_SCALAR (SENSOR_IOCTL | 0x02) + +typedef struct sensor_ioctl_scalar { + uint32_t sis_unit; + int32_t sis_gran; + uint32_t sis_prec; + uint32_t sis_pad; + int64_t sis_value; +} sensor_ioctl_scalar_t; + +#ifdef _KERNEL +typedef int (*ksensor_kind_f)(void *, sensor_ioctl_kind_t *); +typedef int (*ksensor_scalar_f)(void *, sensor_ioctl_scalar_t *); + +typedef struct { + ksensor_kind_f kso_kind; + ksensor_scalar_f kso_scalar; +} ksensor_ops_t; + +extern int ksensor_kind_temperature(void *, sensor_ioctl_kind_t *); +extern int ksensor_kind_voltage(void *, sensor_ioctl_kind_t *); +extern int ksensor_kind_current(void *, sensor_ioctl_kind_t *); + +/* + * Create a sensor where the class and name is supplied. */ -#define SENSOR_IOCTL_TEMPERATURE (SENSOR_IOCTL | 0x02) +extern int ksensor_create(dev_info_t *, const ksensor_ops_t *, void *, + const char *, const char *, id_t *); -typedef struct sensor_ioctl_temperature { - uint32_t sit_unit; - int32_t sit_gran; - int64_t sit_temp; -} sensor_ioctl_temperature_t; +/* + * Create a scalar sensor for a PCI device. If this is not a device-wide + * (e.g. per-function) sensor, this should not be used. + */ +extern int ksensor_create_scalar_pcidev(dev_info_t *, uint_t, + const ksensor_ops_t *, void *, const char *, id_t *); + +/* + * Remove a named or all sensors from this driver. + */ +#define KSENSOR_ALL_IDS INT_MIN +extern int ksensor_remove(dev_info_t *, id_t); + +#endif #ifdef __cplusplus } diff --git a/usr/src/uts/common/sys/smbios.h b/usr/src/uts/common/sys/smbios.h index 34281898e0..257956b047 100644 --- a/usr/src/uts/common/sys/smbios.h +++ b/usr/src/uts/common/sys/smbios.h @@ -22,6 +22,7 @@ /* * Copyright 2015 OmniTI Computer Consulting, Inc. All rights reserved. * Copyright (c) 2018, Joyent, Inc. + * Copyright 2021 Oxide Computer Company * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -157,12 +158,14 @@ typedef union { #define SMB_TYPE_MCHI 42 /* mgmt controller host interface */ #define SMB_TYPE_TPM 43 /* TPM device */ #define SMB_TYPE_PROCESSOR_INFO 44 /* Processor Additional Information */ +#define SMB_TYPE_FWINFO 45 /* Firmware Inventory Information */ +#define SMB_TYPE_STRPROP 46 /* String Property */ #define SMB_TYPE_INACTIVE 126 /* inactive table entry */ #define SMB_TYPE_EOT 127 /* end of table */ #define SMB_TYPE_OEM_LO 128 /* start of OEM-specific type range */ #define SUN_OEM_EXT_PROCESSOR 132 /* processor extended info */ -#define SUN_OEM_EXT_PORT 136 /* port exteded info */ +#define SUN_OEM_EXT_PORT 136 /* port extended info */ #define SUN_OEM_PCIEXRC 138 /* PCIE RootComplex/RootPort info */ #define SUN_OEM_EXT_MEMARRAY 144 /* phys memory array extended info */ #define SUN_OEM_EXT_MEMDEVICE 145 /* memory device extended info */ @@ -201,8 +204,6 @@ typedef struct smbios_version { uint8_t smbv_minor; /* version minor number */ } smbios_version_t; -#define SMB_CONT_BYTE 1 /* contained elements are byte size */ -#define SMB_CONT_WORD 2 /* contained elements are word size */ #define SMB_CONT_MAX 255 /* maximum contained objects */ /* @@ -285,6 +286,8 @@ typedef struct smbios_bios { #define SMB_BIOSXB2_ETCDIST 0x04 /* Enable Targeted Content Distrib. */ #define SMB_BIOSXB2_UEFI 0x08 /* UEFI Specification supported */ #define SMB_BIOSXB2_VM 0x10 /* SMBIOS table describes a VM */ +#define SMB_BIOSXB2_MFG_MODE 0x20 /* Manufacturing mode is supported */ +#define SMB_BIOSXB2_MFG_EN 0x40 /* Manufacturing mode is enabled */ /* * SMBIOS System Information. See DSP0134 Section 7.2 for more information. @@ -322,7 +325,7 @@ typedef struct smbios_bboard { #define SMB_BBFL_MOTHERBOARD 0x01 /* board is a motherboard */ #define SMB_BBFL_NEEDAUX 0x02 /* auxiliary card or daughter req'd */ #define SMB_BBFL_REMOVABLE 0x04 /* board is removable */ -#define SMB_BBFL_REPLACABLE 0x08 /* board is field-replacable */ +#define SMB_BBFL_REPLACABLE 0x08 /* board is field-replaceable */ #define SMB_BBFL_HOTSWAP 0x10 /* board is hot-swappable */ #define SMB_BBT_UNKNOWN 0x1 /* unknown */ @@ -355,7 +358,7 @@ typedef struct smbios_chassis { uint8_t smbc_cords; /* number of power cords */ uint8_t smbc_elems; /* number of element records (n) */ uint8_t smbc_elemlen; /* length of contained element (m) */ - char smbc_sku[256]; /* SKU number (as a string) */ + const char *smbc_sku; /* SKU number (as a string) */ } smbios_chassis_t; #define SMB_CHT_OTHER 0x01 /* other */ @@ -409,6 +412,19 @@ typedef struct smbios_chassis { #define SMB_CHSC_EIENAB 0x05 /* external interface enabled */ /* + * Chassis element record types + */ +typedef struct smbios_chassis_entry { + uint8_t smbce_type; /* Type of elt */ + uint8_t smbce_elt; /* Containing Element */ + uint8_t smbce_min; /* minimum number of elt */ + uint8_t smbce_max; /* minimum number of elt */ +} smbios_chassis_entry_t; + +#define SMB_CELT_BBOARD 0 /* smbce_elt is a base board type */ +#define SMB_CELT_SMBIOS 1 /* smbce_elt is an smbios type */ + +/* * SMBIOS Processor description. See DSP0134 Section 7.5 for more details. * If the L1, L2, or L3 cache handle is -1, the cache information is unknown. * If the handle refers to something of size 0, that type of cache is absent. @@ -527,6 +543,9 @@ typedef struct smbios_processor { #define SMB_PRU_BGA1392 0x3A /* Socket BGA1392 */ #define SMB_PRU_BGA1510 0x3B /* Socket BGA1510 */ #define SMB_PRU_BGA1528 0x3C /* Socket BGA1528 */ +#define SMB_PRU_LGA4189 0x3D /* Socket LGA4189 */ +#define SMB_PRU_LGA1200 0x3E /* Socket LGA1200 */ +#define SMB_PRU_LGA4677 0x3F /* Socket LGA4677 */ #define SMB_PRC_RESERVED 0x0001 /* reserved */ #define SMB_PRC_UNKNOWN 0x0002 /* unknown */ @@ -944,6 +963,10 @@ typedef struct smbios_slot { uint8_t smbl_df; /* device/function number */ uint8_t smbl_dbw; /* data bus width */ uint8_t smbl_npeers; /* PCIe bifurcation peers */ + uint8_t smbl_info; /* slot info */ + uint8_t smbl_pwidth; /* slot physical width */ + uint32_t smbl_pitch; /* slot pitch in 10um */ + uint8_t smbl_height; /* slot height */ } smbios_slot_t; #define SMB_SLT_OTHER 0x01 /* other */ @@ -976,8 +999,8 @@ typedef struct smbios_slot { #define SMB_SLT_MXM_V 0x1C /* MXM Type IV */ #define SMB_SLT_MXM3_A 0x1D /* MXM 3.0 Type A */ #define SMB_SLT_MXM3_B 0x1E /* MXM 3.0 Type B */ -#define SMB_SLT_PCIEG2_SFF 0x1F /* PCI Express Gen 2 SFF-8639 */ -#define SMB_SLT_PCIEG3_SFF 0x20 /* PCI Express Gen 3 SFF-8639 */ +#define SMB_SLT_PCIEG2_SFF 0x1F /* PCI Express Gen 2 SFF-8639 (U.2) */ +#define SMB_SLT_PCIEG3_SFF 0x20 /* PCI Express Gen 3 SFF-8639 (U.2) */ /* * These lines must be on one line for the string generating code. */ @@ -986,6 +1009,11 @@ typedef struct smbios_slot { #define SMB_SLT_PCIE_M52_WOBSKO 0x22 /* PCI Express Mini 52-pin without bottom-side keep-outs */ /* END CSTYLED */ #define SMB_SLT_PCIE_M76 0x23 /* PCI Express Mini 72-pin */ +#define SMB_SLT_PCIEG4_SFF 0x24 /* PCI Express Gen 4 SFF-8639 (U.2) */ +#define SMB_SLT_PCIEG5_SFF 0x25 /* PCI Express Gen 5 SFF-8639 (U.2) */ +#define SMB_SLT_OCP3_SFF 0x26 /* OCP NIC 3.0 Small Form Factor */ +#define SMB_SLT_OCP3_LFF 0x27 /* OCP NIC 3.0 Large Form Factor */ +#define SMB_SLT_OCP_PRE 0x28 /* OCP NIC prior to 3.0 */ #define SMB_SLT_CXL1 0x30 /* CXL Flexbus 1.0 */ #define SMB_SLT_PC98_C20 0xA0 /* PC-98/C20 */ #define SMB_SLT_PC98_C24 0xA1 /* PC-98/C24 */ @@ -1016,6 +1044,15 @@ typedef struct smbios_slot { #define SMB_SLT_PCIE4G4 0xBB /* PCI Exp. Gen 4 x4 */ #define SMB_SLT_PCIE4G8 0xBC /* PCI Exp. Gen 4 x8 */ #define SMB_SLT_PCIE4G16 0xBD /* PCI Exp. Gen 4 x16 */ +#define SMB_SLT_PCIE5G 0xBE /* PCI Exp. Gen 5 */ +#define SMB_SLT_PCIE5G1 0xBF /* PCI Exp. Gen 5 x1 */ +#define SMB_SLT_PCIE5G2 0xC0 /* PCI Exp. Gen 5 x2 */ +#define SMB_SLT_PCIE5G4 0xC1 /* PCI Exp. Gen 5 x4 */ +#define SMB_SLT_PCIE5G8 0xC2 /* PCI Exp. Gen 5 x8 */ +#define SMB_SLT_PCIE5G16 0xC3 /* PCI Exp. Gen 5 x16 */ +#define SMB_SLT_PCIEG6P 0xC4 /* PCI Exp. Gen 6+ */ +#define SMB_SLT_EDSFF_E1 0xC5 /* Ent. and DC 1U E1 Form Factor */ +#define SMB_SLT_EDSFF_E3 0xC6 /* Ent. and DC 3" E3 Form Factor */ #define SMB_SLW_OTHER 0x01 /* other */ #define SMB_SLW_UNKNOWN 0x02 /* unknown */ @@ -1041,6 +1078,8 @@ typedef struct smbios_slot { #define SMB_SLL_UNKNOWN 0x02 /* unknown */ #define SMB_SLL_SHORT 0x03 /* short length */ #define SMB_SLL_LONG 0x04 /* long length */ +#define SMB_SLL_2IN5 0x05 /* 2.5" drive form factor */ +#define SMB_SLL_3IN5 0x06 /* 3.5" drive form factor */ #define SMB_SLCH1_UNKNOWN 0x01 /* characteristics unknown */ #define SMB_SLCH1_5V 0x02 /* provides 5.0V */ @@ -1055,6 +1094,15 @@ typedef struct smbios_slot { #define SMB_SLCH2_HOTPLUG 0x02 /* slot supports hot-plug devices */ #define SMB_SLCH2_SMBUS 0x04 /* slot supports SMBus signal */ #define SMB_SLCH2_BIFUR 0x08 /* slot supports PCIe bifurcation */ +#define SMB_SLCH2_SURPREM 0x10 /* slot supports surprise removal */ +#define SMB_SLCH2_CXL1 0x20 /* Flexbus slot, CXL 1.0 capable */ +#define SMB_SLCH2_CXL2 0x40 /* Flexbus slot, CXL 2.0 capable */ + +#define SMB_SLHT_NA 0x00 /* not applicable */ +#define SMB_SLHT_OTHER 0x01 /* other */ +#define SMB_SLHT_UNKNOWN 0x02 /* unknown */ +#define SMB_SLHT_FULL 0x03 /* full height */ +#define SMB_SLHT_LP 0x04 /* low profile */ /* * SMBIOS 7.10.9 Slot Peer Devices @@ -1178,7 +1226,7 @@ typedef struct smbios_memarray { #define SMB_MAL_PC98C24 0xA1 /* PC-98/C24 add-on card */ #define SMB_MAL_PC98E 0xA2 /* PC-98/E add-on card */ #define SMB_MAL_PC98LB 0xA3 /* PC-98/Local bus add-on card */ -#define SMB_MAL_CXL1 0xA4 /* CXL Flexbus 1.0 add-on card */ +#define SMB_MAL_CXL1 0xA4 /* CXL add-on card */ #define SMB_MAU_OTHER 0x01 /* other */ #define SMB_MAU_UNKNOWN 0x02 /* unknown */ @@ -1285,6 +1333,8 @@ typedef struct smbios_memdevice { #define SMB_MDT_LOGNV 0x1F /* Logical non-volatile device */ #define SMB_MDT_HBM 0x20 /* High Bandwidth Memory */ #define SMB_MDT_HBM2 0x21 /* High Bandwidth Memory 2 */ +#define SMB_MDT_DDR5 0x22 /* DDR5 */ +#define SMB_MDT_LPDDR5 0x23 /* LPDDR5 */ #define SMB_MDF_OTHER 0x0002 /* other */ #define SMB_MDF_UNKNOWN 0x0004 /* unknown */ @@ -1313,13 +1363,14 @@ typedef struct smbios_memdevice { #define SMB_MTECH_NVDIMM_N 0x04 /* NVDIMM-N */ #define SMB_MTECH_NVDIMM_F 0x05 /* NVDIMM-F */ #define SMB_MTECH_NVDIMM_P 0x06 /* NVDIMM-P */ -#define SMB_MTECH_INTCPM 0x07 /* Intel Optane DC Persistent Memory */ +#define SMB_MTECH_INTCPM 0x07 /* Intel Optane persistent memory */ -#define SMB_MOMC_OTHER 0x01 /* other */ -#define SMB_MOMC_UNKNOWN 0x02 /* unknown */ -#define SMB_MOMC_VOLATILE 0x04 /* Volatile memory */ -#define SMB_MOMC_BYTE_PM 0x08 /* Byte-accessible persistent memory */ -#define SMB_MOMC_BLOCK_PM 0x10 /* Block-accessible persistent memory */ +#define SMB_MOMC_RESERVED 0x01 /* reserved */ +#define SMB_MOMC_OTHER 0x02 /* other */ +#define SMB_MOMC_UNKNOWN 0x04 /* unknown */ +#define SMB_MOMC_VOLATILE 0x08 /* Volatile memory */ +#define SMB_MOMC_BYTE_PM 0x10 /* Byte-accessible persistent memory */ +#define SMB_MOMC_BLOCK_PM 0x20 /* Block-accessible persistent memory */ /* * SMBIOS Memory Array Mapped Address. See DSP0134 Section 7.20 for more @@ -1376,7 +1427,9 @@ typedef struct smbios_pointdev { #define SMB_PDI_ADB 0x08 /* ADB (Apple Desktop Bus) */ #define SMB_PDI_BUSM_DB9 0xA0 /* Bus mouse DB-9 */ #define SMB_PDI_BUSM_UDIN 0xA1 /* Bus mouse micro-DIN */ -#define SMB_PDI_BUSM_USB 0xA2 /* USB */ +#define SMB_PDI_USB 0xA2 /* USB */ +#define SMB_PDI_I2C 0xA3 /* I2C */ +#define SMB_PDI_SPI 0xA4 /* SPI */ /* * SMBIOS Portable Battery. See DSP0134 Section 7.23 for more information. @@ -1683,8 +1736,25 @@ typedef struct smbios_obdev_ext { uint8_t smboe_df; /* device/function number */ } smbios_obdev_ext_t; +#define SMB_OBET_OTHER 0x01 /* Other */ +#define SMB_OBET_UNKNOWN 0x02 /* Unknown */ +#define SMB_OBET_VIDEO 0x03 /* video */ +#define SMB_OBET_SCSI 0x04 /* SCSI */ +#define SMB_OBET_ETHERNET 0x05 /* Ethernet */ +#define SMB_OBET_TOKEN 0x06 /* Token Ring */ +#define SMB_OBET_SOUND 0x07 /* Sound */ +#define SMB_OBET_PATA 0x08 /* PATA */ +#define SMB_OBET_SATA 0x09 /* SATA */ +#define SMB_OBET_SAS 0x0A /* SAS */ +#define SMB_OBET_WLAN 0x0B /* Wireless LAN */ +#define SMB_OBET_BT 0x0C /* Bluetooth */ +#define SMB_OBET_WWAN 0x0D /* WWAN */ +#define SMB_OBET_EMMC 0x0E /* eMMC */ +#define SMB_OBET_NVME 0x0F /* NVMe */ +#define SMB_OBET_UFS 0x10 /* UFS */ + /* - * SMBIOS Processor Additional Information (Type 44). See sectoin 7.45 for more + * SMBIOS Processor Additional Information (Type 44). See section 7.45 for more * information. */ typedef struct smbios_processor_info { @@ -1756,7 +1826,7 @@ typedef struct smbios_processor_info_riscv { #define SMB_RV_ISA_N (1 << 13) /* User-level interrupts */ #define SMB_RV_ISA_O (1 << 14) /* Reserved */ #define SMB_RV_ISA_P (1 << 15) /* Reserved */ -#define SMB_RV_ISA_Q (1 << 16) /* Quad-precision floating-poit */ +#define SMB_RV_ISA_Q (1 << 16) /* Quad-precision floating-point */ #define SMB_RV_ISA_R (1 << 17) /* Reserved */ #define SMB_RV_ISA_S (1 << 18) /* Supervisor mode */ #define SMB_RV_ISA_T (1 << 19) /* Reserved */ @@ -1769,11 +1839,78 @@ typedef struct smbios_processor_info_riscv { /* END CSTYLED */ /* + * SMBIOS Firmware Inventory Information (Type 45). + */ +typedef struct smbios_fwinfo { + const char *smbfw_name; /* Firmware component name */ + const char *smbfw_id; /* Firmware ID */ + const char *smbfw_reldate; /* Release date */ + const char *smbfw_lsv; /* Lowest supported version */ + uint64_t smbfw_imgsz; /* Image size */ + uint16_t smbfw_chars; /* Characteristics */ + uint16_t smbfw_state; /* State */ + uint16_t smbfw_ncomps; /* Number of associated components */ + uint8_t smbfw_vers_fmt; /* Firmware version format */ + uint8_t smbfw_id_fmt; /* Firmware ID format */ +} smbios_fwinfo_t; + +typedef struct smbios_fwinfo_comp { + id_t smbfwe_id; /* Contained element ID */ +} smbios_fwinfo_comp_t; + +/* + * Firmware version format constants. + */ +#define SMB_FWV_FF 0x00 /* free-form */ +#define SMB_FWV_MM 0x01 /* major.minor */ +#define SMB_FWV_HEX32 0x02 /* 32-bit hex */ +#define SMB_FWV_HEX64 0x03 /* 64-bit hex */ + +/* + * Firmware ID format constants. + */ +#define SMB_FWI_FF 0x00 /* free-form */ +#define SMB_FWI_UEFI 0x01 /* UEFI GUID */ + +/* + * Firmware characteristic bitfields. + */ +#define SMB_FWC_UPDATE 0x01 /* updatable */ +#define SMB_FWC_WP 0x02 /* write-protect */ + +/* + * Firmware state constants. + */ +#define SMB_FWS_OTHER 0x01 /* other */ +#define SMB_FWS_UNKNOWN 0x02 /* unknown */ +#define SMB_FWS_DISABLED 0x03 /* disabled */ +#define SMB_FWS_ENABLED 0x04 /* enabled */ +#define SMB_FWS_ABSENT 0x05 /* absent */ +#define SMB_FWS_STB_OFFLINE 0x06 /* standby offline */ +#define SMB_FWS_STB_SPARE 0x07 /* standby spare */ +#define SMB_FWS_UA_OFFLINE 0x08 /* unavailable offline */ + +/* + * SMBIOS String Property (Type 46). See section 7.47 for more information. + */ +typedef struct smbios_strprop { + uint32_t smbsp_prop_id; /* property ID */ + const char *smbsp_prop_val; /* property Value */ + id_t smbsp_parent; /* parent handle */ +} smbios_strprop_t; + +/* + * String Property IDs + */ +#define SMB_STRP_RESERVED 0x00 /* reserved */ +#define SMB_STRP_UEFI_DEVPATH 0x01 /* UEFI device path */ + +/* * SMBIOS OEM-specific (Type 132) Processor Extended Information. */ typedef struct smbios_processor_ext { uint16_t smbpe_processor; /* extending processor handle */ - uint8_t smbpe_fru; /* FRU indicaor */ + uint8_t smbpe_fru; /* FRU indicator */ uint8_t smbpe_n; /* number of APIC IDs */ uint16_t *smbpe_apicid; /* strand Inital APIC IDs */ } smbios_processor_ext_t; @@ -1837,7 +1974,9 @@ typedef struct smbios_memdevice_ext { #define SMB_VERSION_31 0x0301 /* SMBIOS encoding for DMTF spec 3.1 */ #define SMB_VERSION_32 0x0302 /* SMBIOS encoding for DMTF spec 3.2 */ #define SMB_VERSION_33 0x0303 /* SMBIOS encoding for DMTF spec 3.3 */ -#define SMB_VERSION SMB_VERSION_33 /* SMBIOS latest version definitions */ +#define SMB_VERSION_34 0x0304 /* SMBIOS encoding for DMTF spec 3.4 */ +#define SMB_VERSION_35 0x0305 /* SMBIOS encoding for DMTF spec 3.5 */ +#define SMB_VERSION SMB_VERSION_35 /* SMBIOS latest version definitions */ #define SMB_O_NOCKSUM 0x1 /* do not verify header checksums */ #define SMB_O_NOVERS 0x2 /* do not verify header versions */ @@ -1890,6 +2029,10 @@ extern id_t smbios_info_bios(smbios_hdl_t *, smbios_bios_t *); extern id_t smbios_info_system(smbios_hdl_t *, smbios_system_t *); extern int smbios_info_bboard(smbios_hdl_t *, id_t, smbios_bboard_t *); extern int smbios_info_chassis(smbios_hdl_t *, id_t, smbios_chassis_t *); +extern int smbios_info_chassis_elts(smbios_hdl_t *, id_t, uint_t *, + smbios_chassis_entry_t **); +extern void smbios_info_chassis_elts_free(smbios_hdl_t *, uint_t, + smbios_chassis_entry_t *); extern int smbios_info_processor(smbios_hdl_t *, id_t, smbios_processor_t *); extern int smbios_info_extprocessor(smbios_hdl_t *, id_t, smbios_processor_ext_t *); @@ -1929,7 +2072,12 @@ extern int smbios_info_processor_info(smbios_hdl_t *, id_t, smbios_processor_info_t *); extern int smbios_info_processor_riscv(smbios_hdl_t *, id_t, smbios_processor_info_riscv_t *); - +extern int smbios_info_strprop(smbios_hdl_t *, id_t, smbios_strprop_t *); +extern int smbios_info_fwinfo(smbios_hdl_t *, id_t, smbios_fwinfo_t *); +extern int smbios_info_fwinfo_comps(smbios_hdl_t *, id_t, uint_t *, + smbios_fwinfo_comp_t **); +extern void smbios_info_fwinfo_comps_free(smbios_hdl_t *, uint_t, + smbios_fwinfo_comp_t *); extern const char *smbios_psn(smbios_hdl_t *); extern const char *smbios_csn(smbios_hdl_t *); @@ -1937,7 +2085,7 @@ extern const char *smbios_csn(smbios_hdl_t *); #ifndef _KERNEL /* * The smbios_*_desc() and smbios_*_name() interfaces can be used for utilities - * such as smbios(1M) that wish to decode SMBIOS fields for humans. The _desc + * such as smbios(8) that wish to decode SMBIOS fields for humans. The _desc * functions return the comment string next to the #defines listed above, and * the _name functions return the appropriate #define identifier itself. */ @@ -1975,6 +2123,12 @@ extern const char *smbios_evlog_flag_name(uint_t); extern const char *smbios_evlog_format_desc(uint_t); extern const char *smbios_evlog_method_desc(uint_t); +extern const char *smbios_fwinfo_ch_name(uint_t); +extern const char *smbios_fwinfo_ch_desc(uint_t); +extern const char *smbios_fwinfo_id_desc(uint_t); +extern const char *smbios_fwinfo_state_desc(uint_t); +extern const char *smbios_fwinfo_vers_desc(uint_t); + extern const char *smbios_vprobe_loc_desc(uint_t); extern const char *smbios_vprobe_status_desc(uint_t); @@ -2013,6 +2167,7 @@ extern const char *smbios_memdevice_op_capab_name(uint_t); extern const char *smbios_memdevice_op_capab_desc(uint_t); extern const char *smbios_onboard_type_desc(uint_t); +extern const char *smbios_onboard_ext_type_desc(uint_t); extern const char *smbios_pointdev_iface_desc(uint_t); extern const char *smbios_pointdev_type_desc(uint_t); @@ -2042,6 +2197,9 @@ extern const char *smbios_slot_ch1_desc(uint_t); extern const char *smbios_slot_ch1_name(uint_t); extern const char *smbios_slot_ch2_desc(uint_t); extern const char *smbios_slot_ch2_name(uint_t); +extern const char *smbios_slot_height_desc(uint_t); + +extern const char *smbios_strprop_id_desc(uint_t); extern const char *smbios_type_desc(uint_t); extern const char *smbios_type_name(uint_t); diff --git a/usr/src/uts/common/sys/smbios_impl.h b/usr/src/uts/common/sys/smbios_impl.h index 69ca79e94f..41424aa03a 100644 --- a/usr/src/uts/common/sys/smbios_impl.h +++ b/usr/src/uts/common/sys/smbios_impl.h @@ -22,6 +22,7 @@ /* * Copyright 2015 OmniTI Computer Consulting, Inc. All rights reserved. * Copyright (c) 2018, Joyent, Inc. + * Copyright 2021 Oxide Computer Company * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -133,14 +134,20 @@ typedef struct smb_chassis { uint8_t smbch_cords; /* number of power cords */ uint8_t smbch_cn; /* number of contained records */ uint8_t smbch_cm; /* size of contained records */ - uint8_t smbch_cv[1]; /* array of contained records */ + uint8_t smbch_cv[]; /* array of contained records */ } smb_chassis_t; -/* WARNING: the argument is evaluated three times! */ -#define SMB_CH_SKU(smbcp) ((char *) \ - (smbcp)->smbch_cv + ((smbcp)->smbch_cn * (smbcp)->smbch_cm)) #define SMB_CHT_LOCK 0x80 /* lock bit within smbch_type */ +typedef struct smb_chassis_entry { + uint8_t smbce_type; /* Containing Element and Type */ + uint8_t smbce_min; /* minimum number of elt */ + uint8_t smbce_max; /* minimum number of elt */ +} smb_chassis_entry_t; + +#define SMB_CHE_TYPE_IS_SMB(x) (((x) & 0x80) == 0x80) +#define SMB_CHE_TYPE_TYPE(x) (((x) & 0x7f)) + /* * SMBIOS implementation structure for SMB_TYPE_PROCESSOR. */ @@ -250,9 +257,32 @@ typedef struct smb_slot { uint8_t smbsl_dbw; /* Data bus width */ uint8_t smbsl_npeers; /* Peer bdf groups */ smb_slot_peer_t smbsl_peers[]; /* bifurcation peers */ + /* There are later additions in 3.4+, see smbios_slot_cont_t */ } smb_slot_t; /* + * After the variable number of smbsl_peers, the smbios_slot has continued in + * size and has the following members defined as of version 3.4. These occur + * starting at byte 14 + 5 * smbsl_npeers. + */ +typedef struct smb_slot_cont { + uint8_t smbsl_info; /* slot info */ + uint8_t smbsl_pwidth; /* slot physical width */ + uint16_t smbsl_pitch; /* slot pitch */ + /* Added in SMBIOS 3.5 */ + uint8_t smbsl_height; /* slot height */ +} smb_slot_cont_t; + +/* + * The first byte that the smb_slot_cont_t is defined to start at. Note, this + * was originally indicated to be 0x14 in the SMBIOS 3.4 specification. This has + * been noted as an errata. Right now we assume that most things have the + * updated behavior in SMBIOS 3.5. However, if we encounter things in the wild + * that have the other offset then we will need to condition this on 3.4. + */ +#define SMB_SLOT_CONT_START 0x13 + +/* * SMBIOS implementation structure for SMB_TYPE_OBDEVS. */ typedef struct smb_obdev { @@ -632,6 +662,36 @@ typedef struct smb_processor_info_riscv { } smb_processor_info_riscv_t; /* + * SMBIOS implementation structure for SMBIOS_TYPE_FWINFO. + */ +typedef struct smb_fwinfo { + smb_header_t smbfwii_hdr; /* structure handle */ + uint8_t smbfwii_name; /* Firmware component name */ + uint8_t smbfwii_vers; /* Firmware version */ + uint8_t smbfwii_vers_fmt; /* Version format */ + uint8_t smbfwii_id; /* Firmware ID */ + uint8_t smbfwii_id_fmt; /* Firmware ID format */ + uint8_t smbfwii_reldate; /* Release Date */ + uint8_t smbfwii_mfg; /* Manufacturer */ + uint8_t smbfwii_lsv; /* Lowest supported version */ + uint64_t smbfwii_imgsz; /* Image size */ + uint16_t smbfwii_chars; /* Characteristics */ + uint8_t smbfwii_state; /* State */ + uint8_t smbfwii_ncomps; /* Number of associated components */ + uint16_t smbfwii_comps[]; /* Variable handles */ +} smb_fwinfo_t; + +/* + * SMBIOS implementation structure for SMBIOS_TYPE_STRPROP. + */ +typedef struct smb_strprop { + smb_header_t smbstrp_hdr; /* structure handle */ + uint16_t smbstrp_prop_id; /* string property ID */ + uint8_t smbstrp_prop_val; /* string property value */ + uint16_t smbstrp_phdl; /* parent handle */ +} smb_strprop_t; + +/* * SMBIOS implementation structure for SUN_OEM_EXT_PROCESSOR. */ typedef struct smb_processor_ext { @@ -865,6 +925,28 @@ typedef struct smb_base_slot { uint8_t smbbl_df; /* device/function number */ } smb_base_slot_t; +/* + * Prior to reivison 3.5 of the library and interface we had embedded a 256 byte + * string for the SKU into here rather than pointing to constant data. This, + * combined withe bugs in the implementation, generally led to strings with + * garbage. As part of fixing this with the 3.5 support, we moved the struct to + * ve more inline with everything else. + */ +typedef struct smb_chassis_pre35 { + uint32_t smbc_oemdata; /* OEM-specific data */ + uint8_t smbc_lock; /* lock present? */ + uint8_t smbc_type; /* type */ + uint8_t smbc_bustate; /* boot-up state */ + uint8_t smbc_psstate; /* power supply state */ + uint8_t smbc_thstate; /* thermal state */ + uint8_t smbc_security; /* security status */ + uint8_t smbc_uheight; /* enclosure height in U's */ + uint8_t smbc_cords; /* number of power cords */ + uint8_t smbc_elems; /* number of element records (n) */ + uint8_t smbc_elemlen; /* length of contained element (m) */ + char smbc_sku[256]; +} smb_chassis_pre35_t; + #ifdef __cplusplus } #endif diff --git a/usr/src/uts/common/sys/socket_proto.h b/usr/src/uts/common/sys/socket_proto.h index 4e1a4a0f35..825d0501c7 100644 --- a/usr/src/uts/common/sys/socket_proto.h +++ b/usr/src/uts/common/sys/socket_proto.h @@ -21,6 +21,7 @@ /* * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2019 OmniOS Community Edition (OmniOSce) Association. + * Copyright 2020 Joyent, Inc. */ #ifndef _SYS_SOCKET_PROTO_H_ @@ -202,7 +203,16 @@ struct sock_upcalls_s { void (*su_signal_oob)(sock_upper_handle_t, ssize_t); void (*su_zcopy_notify)(sock_upper_handle_t); void (*su_set_error)(sock_upper_handle_t, int); + /* + * NOTE: This function frees upper handle items. Caller cannot + * rely on them after this upcall. + */ void (*su_closed)(sock_upper_handle_t); + /* + * NOTE: This function MUST be implemented without using lower-level + * downcalls or accesses. This allows callers to ensure su_closed() + * upcalls can happen indepdently or concurrently. + */ vnode_t *(*su_get_vnode)(sock_upper_handle_t); }; diff --git a/usr/src/uts/common/sys/socketvar.h b/usr/src/uts/common/sys/socketvar.h index 55a182fa68..1e48b00dd7 100644 --- a/usr/src/uts/common/sys/socketvar.h +++ b/usr/src/uts/common/sys/socketvar.h @@ -38,7 +38,7 @@ */ /* * Copyright 2015 Nexenta Systems, Inc. All rights reserved. - * Copyright 2019 OmniOS Community Edition (OmniOSce) Association. + * Copyright 2020 OmniOS Community Edition (OmniOSce) Association. */ #ifndef _SYS_SOCKETVAR_H @@ -617,7 +617,7 @@ extern smod_info_t *smod_lookup_byname(const char *); /* * Used to traverse the list of AF_UNIX sockets to construct the kstat - * for netstat(1m). + * for netstat(8). */ struct socklist { kmutex_t sl_lock; @@ -930,6 +930,8 @@ extern void fdbuf_free(struct fdbuf *); extern mblk_t *fdbuf_allocmsg(int, struct fdbuf *); extern int fdbuf_create(void *, int, struct fdbuf **); extern void so_closefds(void *, t_uscalar_t, int, int); +extern void so_truncatecmsg(void *, t_uscalar_t, uint_t); + extern int so_getfdopt(void *, t_uscalar_t, int, void **, int *); t_uscalar_t so_optlen(void *, t_uscalar_t, int); extern void so_cmsg2opt(void *, t_uscalar_t, int, mblk_t *); diff --git a/usr/src/uts/common/sys/stddef.h b/usr/src/uts/common/sys/stddef.h index aaba0ced0a..99cadf3992 100644 --- a/usr/src/uts/common/sys/stddef.h +++ b/usr/src/uts/common/sys/stddef.h @@ -25,7 +25,7 @@ extern "C" { #endif #if !defined(offsetof) -#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) #define offsetof(s, m) __builtin_offsetof(s, m) #else #if __cplusplus >= 199711L diff --git a/usr/src/uts/common/sys/sunddi.h b/usr/src/uts/common/sys/sunddi.h index e19e5e8b29..0dc4894839 100644 --- a/usr/src/uts/common/sys/sunddi.h +++ b/usr/src/uts/common/sys/sunddi.h @@ -1574,16 +1574,16 @@ void swab(void *src, void *dst, size_t nbytes); int -ddi_create_minor_node(dev_info_t *dip, char *name, int spec_type, - minor_t minor_num, char *node_type, int flag); +ddi_create_minor_node(dev_info_t *dip, const char *name, int spec_type, + minor_t minor_num, const char *node_type, int flag); int -ddi_create_priv_minor_node(dev_info_t *dip, char *name, int spec_type, - minor_t minor_num, char *node_type, int flag, +ddi_create_priv_minor_node(dev_info_t *dip, const char *name, int spec_type, + minor_t minor_num, const char *node_type, int flag, const char *rdpriv, const char *wrpriv, mode_t priv_mode); void -ddi_remove_minor_node(dev_info_t *dip, char *name); +ddi_remove_minor_node(dev_info_t *dip, const char *name); int ddi_in_panic(void); diff --git a/usr/src/uts/common/sys/sunldi_impl.h b/usr/src/uts/common/sys/sunldi_impl.h index e9fdb431bf..3d04078a53 100644 --- a/usr/src/uts/common/sys/sunldi_impl.h +++ b/usr/src/uts/common/sys/sunldi_impl.h @@ -72,8 +72,8 @@ void ldi_init(void); * LDI streams linking interfaces */ extern int ldi_mlink_lh(vnode_t *, int, intptr_t, cred_t *, int *); -extern void ldi_mlink_fp(struct stdata *, struct file *, int, int); -extern void ldi_munlink_fp(struct stdata *, struct file *, int); +extern int ldi_mlink_fp(struct stdata *, struct file *, int, int); +extern int ldi_munlink_fp(struct stdata *, struct file *, int); /* * LDI module identifier diff --git a/usr/src/uts/common/sys/sunndi.h b/usr/src/uts/common/sys/sunndi.h index e6a998322d..94313a450e 100644 --- a/usr/src/uts/common/sys/sunndi.h +++ b/usr/src/uts/common/sys/sunndi.h @@ -118,11 +118,11 @@ ndi_prop_remove_all(dev_info_t *dip); * not allowed to sleep. */ int -ndi_devi_alloc(dev_info_t *parent, char *node_name, pnode_t nodeid, +ndi_devi_alloc(dev_info_t *parent, const char *node_name, pnode_t nodeid, dev_info_t **ret_dip); void -ndi_devi_alloc_sleep(dev_info_t *parent, char *node_name, pnode_t nodeid, +ndi_devi_alloc_sleep(dev_info_t *parent, const char *node_name, pnode_t nodeid, dev_info_t **ret_dip); /* @@ -174,7 +174,7 @@ ndi_devi_bind_driver_async(dev_info_t *dip, uint_t flags); */ int ndi_devctl_device_getstate(dev_info_t *parent, struct devctl_iocdata *dcp, - uint_t *state); + uint_t *state); /* * Transition the child addressed by "name@addr" to the online state. @@ -182,7 +182,7 @@ ndi_devctl_device_getstate(dev_info_t *parent, struct devctl_iocdata *dcp, */ int ndi_devctl_device_online(dev_info_t *dip, struct devctl_iocdata *dcp, - uint_t flags); + uint_t flags); /* * Transition the child addressed by "name@addr" to the offline state. @@ -190,7 +190,7 @@ ndi_devctl_device_online(dev_info_t *dip, struct devctl_iocdata *dcp, */ int ndi_devctl_device_offline(dev_info_t *dip, struct devctl_iocdata *dcp, - uint_t flags); + uint_t flags); /* * Remove the child addressed by name@addr. @@ -198,7 +198,7 @@ ndi_devctl_device_offline(dev_info_t *dip, struct devctl_iocdata *dcp, */ int ndi_devctl_device_remove(dev_info_t *dip, struct devctl_iocdata *dcp, - uint_t flags); + uint_t flags); /* * Bus get state @@ -206,7 +206,7 @@ ndi_devctl_device_remove(dev_info_t *dip, struct devctl_iocdata *dcp, */ int ndi_devctl_bus_getstate(dev_info_t *dip, struct devctl_iocdata *dcp, - uint_t *state); + uint_t *state); /* * Place the devinfo in the ONLINE state @@ -219,7 +219,7 @@ ndi_devi_online(dev_info_t *dip, uint_t flags); */ int ndi_devctl_ioctl(dev_info_t *dip, int cmd, intptr_t arg, int mode, - uint_t flags); + uint_t flags); /* * Asynchronous version of ndi_devi_online, callable from interrupt @@ -524,7 +524,7 @@ typedef struct ndi_event_set { */ int ndi_event_alloc_hdl(dev_info_t *dip, ddi_iblock_cookie_t cookie, - ndi_event_hdl_t *ndi_event_hdl, uint_t flag); + ndi_event_hdl_t *ndi_event_hdl, uint_t flag); /* * free the ndi event handle @@ -536,40 +536,28 @@ ndi_event_free_hdl(ndi_event_hdl_t handle); * bind or unbind a set of events to/from the event handle */ int -ndi_event_bind_set(ndi_event_hdl_t handle, - ndi_event_set_t *ndi_event_set, - uint_t flag); +ndi_event_bind_set(ndi_event_hdl_t handle, ndi_event_set_t *ndi_event_set, + uint_t flag); int -ndi_event_unbind_set(ndi_event_hdl_t handle, - ndi_event_set_t *ndi_event_set, - uint_t flag); +ndi_event_unbind_set(ndi_event_hdl_t handle, ndi_event_set_t *ndi_event_set, + uint_t flag); /* * get an event cookie */ int -ndi_event_retrieve_cookie(ndi_event_hdl_t handle, - dev_info_t *child_dip, - char *eventname, - ddi_eventcookie_t *cookiep, - uint_t flag); +ndi_event_retrieve_cookie(ndi_event_hdl_t handle, dev_info_t *child_dip, + char *eventname, ddi_eventcookie_t *cookiep, uint_t flag); /* * add an event callback info to the ndi event handle */ int -ndi_event_add_callback(ndi_event_hdl_t handle, - dev_info_t *child_dip, - ddi_eventcookie_t cookie, - void (*event_callback) - (dev_info_t *, - ddi_eventcookie_t, - void *arg, - void *impldata), - void *arg, - uint_t flag, - ddi_callback_id_t *cb_id); +ndi_event_add_callback(ndi_event_hdl_t handle, dev_info_t *child_dip, + ddi_eventcookie_t cookie, void (*event_callback)(dev_info_t *, + ddi_eventcookie_t, void *arg, void *impldata), void *arg, uint_t flag, + ddi_callback_id_t *cb_id); /* * remove an event callback registration from the ndi event handle @@ -588,7 +576,7 @@ ndi_event_run_callbacks(ndi_event_hdl_t handle, dev_info_t *child_dip, * do callback for just one child_dip, regardless of attributes */ int ndi_event_do_callback(ndi_event_hdl_t handle, dev_info_t *child_dip, - ddi_eventcookie_t cookie, void *bus_impldata); + ddi_eventcookie_t cookie, void *bus_impldata); /* * ndi_event_tag_to_cookie: utility function to find an event cookie @@ -603,7 +591,7 @@ ndi_event_tag_to_cookie(ndi_event_hdl_t handle, int event_tag); */ int ndi_event_cookie_to_tag(ndi_event_hdl_t handle, - ddi_eventcookie_t cookie); + ddi_eventcookie_t cookie); /* * ndi_event_cookie_to_name: utility function to find an event @@ -611,7 +599,7 @@ ndi_event_cookie_to_tag(ndi_event_hdl_t handle, */ char * ndi_event_cookie_to_name(ndi_event_hdl_t handle, - ddi_eventcookie_t cookie); + ddi_eventcookie_t cookie); /* * ndi_event_tag_to_name: utility function to find an event @@ -681,7 +669,7 @@ typedef struct ndi_ra_request { uint64_t ra_boundlen; /* Length of the area, starting */ /* from ra_boundbase, for the */ /* allocated resource to be */ - /* restricted to. */ + /* restricted to. */ uint64_t ra_align_mask; /* Alignment mask used for */ /* allocated base address */ @@ -743,11 +731,11 @@ ndi_ra_map_destroy(dev_info_t *dip, char *type); int ndi_ra_alloc(dev_info_t *dip, ndi_ra_request_t *req, uint64_t *basep, - uint64_t *lenp, char *type, uint_t flag); + uint64_t *lenp, char *type, uint_t flag); int ndi_ra_free(dev_info_t *dip, uint64_t base, uint64_t len, char *type, - uint_t flag); + uint_t flag); /* * ndi_dev_is_prom_node: Return non-zero if the node is a prom node diff --git a/usr/src/uts/common/sys/syscall.h b/usr/src/uts/common/sys/syscall.h index 8709f98c26..cd4f5445b0 100644 --- a/usr/src/uts/common/sys/syscall.h +++ b/usr/src/uts/common/sys/syscall.h @@ -24,6 +24,7 @@ * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013 by Delphix. All rights reserved. * Copyright (c) 2015, Joyent, Inc. All rights reserved. + * Copyright 2020 Oxide Computer Company */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ @@ -168,38 +169,38 @@ extern "C" { #define SYS_tasksys 70 /* * subcodes: - * settaskid(...) :: tasksys(0, ...) - * gettaskid(...) :: tasksys(1, ...) - * getprojid(...) :: tasksys(2, ...) + * settaskid(...) :: tasksys(0, ...) + * gettaskid(...) :: tasksys(1, ...) + * getprojid(...) :: tasksys(2, ...) */ #define SYS_acctctl 71 #define SYS_exacctsys 72 /* * subcodes: - * getacct(...) :: exacct(0, ...) - * putacct(...) :: exacct(1, ...) - * wracct(...) :: exacct(2, ...) + * getacct(...) :: exacct(0, ...) + * putacct(...) :: exacct(1, ...) + * wracct(...) :: exacct(2, ...) */ #define SYS_getpagesizes 73 /* * subcodes: * getpagesizes2(...) :: getpagesizes(0, ...) - * getpagesizes(...) :: getpagesizes(1, ...) legacy + * getpagesizes(...) :: getpagesizes(1, ...) legacy */ #define SYS_rctlsys 74 /* * subcodes: - * getrctl(...) :: rctlsys(0, ...) - * setrctl(...) :: rctlsys(1, ...) - * rctllist(...) :: rctlsys(2, ...) - * rctlctl(...) :: rctlsys(3, ...) + * getrctl(...) :: rctlsys(0, ...) + * setrctl(...) :: rctlsys(1, ...) + * rctllist(...) :: rctlsys(2, ...) + * rctlctl(...) :: rctlsys(3, ...) */ #define SYS_sidsys 75 /* * subcodes: - * allocids(...) :: sidsys(0, ...) - * idmap_reg(...) :: sidsys(1, ...) - * idmap_unreg(...) :: sidsys(2, ...) + * allocids(...) :: sidsys(0, ...) + * idmap_reg(...) :: sidsys(1, ...) + * idmap_unreg(...) :: sidsys(2, ...) */ #define SYS_lwp_park 77 /* @@ -213,8 +214,8 @@ extern "C" { #define SYS_sendfilev 78 /* * subcodes : - * sendfilev() :: sendfilev(0, ...) - * sendfilev64() :: sendfilev(1, ...) + * sendfilev() :: sendfilev(0, ...) + * sendfilev64() :: sendfilev(1, ...) */ #define SYS_rmdir 79 #define SYS_mkdir 80 @@ -222,11 +223,11 @@ extern "C" { #define SYS_privsys 82 /* * subcodes: - * setppriv(...) :: privsys(0, ...) - * getppriv(...) :: privsys(1, ...) - * getimplinfo(...) :: privsys(2, ...) - * setpflags(...) :: privsys(3, ...) - * getpflags(...) :: privsys(4, ...) + * setppriv(...) :: privsys(0, ...) + * getppriv(...) :: privsys(1, ...) + * getimplinfo(...) :: privsys(2, ...) + * setpflags(...) :: privsys(3, ...) + * getpflags(...) :: privsys(4, ...) * issetugid(); :: privsys(5) */ #define SYS_ucredsys 83 @@ -297,6 +298,7 @@ extern "C" { #define SYS_writev 122 #define SYS_preadv 123 #define SYS_pwritev 124 +#define SYS_upanic 125 #define SYS_getrandom 126 #define SYS_mmapobj 127 #define SYS_setrlimit 128 @@ -368,7 +370,7 @@ extern "C" { #define SYS_meminfosys SYS_lgrpsys /* * subcodes: - * meminfo(...) :: meminfosys(MISYS_MEMINFO, ...) + * meminfo(...) :: meminfosys(MISYS_MEMINFO, ...) */ #define SYS_rusagesys 181 /* diff --git a/usr/src/uts/common/sys/sysconfig.h b/usr/src/uts/common/sys/sysconfig.h index d5b65ef78c..7e87d7a983 100644 --- a/usr/src/uts/common/sys/sysconfig.h +++ b/usr/src/uts/common/sys/sysconfig.h @@ -101,8 +101,9 @@ extern int mach_sysconfig(int); #define _CONFIG_SYMLOOP_MAX 46 /* maximum # of symlinks in pathname */ #define _CONFIG_EPHID_MAX 47 /* maximum ephemeral uid */ +#define _CONFIG_UADDR_MAX 48 /* maximum user address */ -#define _CONFIG_NPROC_NCPU 48 /* NCPU (sometimes > NPROC_MAX) */ +#define _CONFIG_NPROC_NCPU 49 /* NCPU (sometimes > NPROC_MAX) */ #ifdef __cplusplus } diff --git a/usr/src/uts/common/sys/sysevent.h b/usr/src/uts/common/sys/sysevent.h index 392b426977..c2be00ad27 100644 --- a/usr/src/uts/common/sys/sysevent.h +++ b/usr/src/uts/common/sys/sysevent.h @@ -73,7 +73,7 @@ extern "C" { #define SE_KERN_PUB "kern:" #define SUNW_KERN_PUB SUNW_VENDOR ":" SE_KERN_PUB #define SUNW_USR_PUB SUNW_VENDOR ":" SE_USR_PUB -#define ILLUMOS_KERN_PUB ILLUMOS_VENDOR":"SE_KERN_PUB +#define ILLUMOS_KERN_PUB ILLUMOS_VENDOR ":" SE_KERN_PUB /* * Event header and attribute value limits diff --git a/usr/src/uts/common/sys/sysmsg_impl.h b/usr/src/uts/common/sys/sysmsg_impl.h index 9081277478..a573db1320 100644 --- a/usr/src/uts/common/sys/sysmsg_impl.h +++ b/usr/src/uts/common/sys/sysmsg_impl.h @@ -27,8 +27,6 @@ #ifndef _SYS_SYSMSG_IMPL_H #define _SYS_SYSMSG_IMPL_H -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef __cplusplus extern "C" { #endif @@ -36,7 +34,7 @@ extern "C" { #define SYSMSG "/dev/sysmsg" /* - * consadm(1M) uses these ioctls to interface with /dev/sysmsg. + * consadm(8) uses these ioctls to interface with /dev/sysmsg. */ /* diff --git a/usr/src/uts/common/sys/systeminfo.h b/usr/src/uts/common/sys/systeminfo.h index a664a19b9e..951d799a70 100644 --- a/usr/src/uts/common/sys/systeminfo.h +++ b/usr/src/uts/common/sys/systeminfo.h @@ -21,6 +21,7 @@ /* * Copyright 2014 Garrett D'Amore <garrett@damore.org> * Copyright 2017 RackTop Systems. + * Copyright 2020 Oxide Computer Company * * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. @@ -56,8 +57,8 @@ extern char platform[]; * 257 - 512 Unix International assigned numbers for `set' style commands * where the value is selected to be the value for the * corresponding `get' command plus 256. - * 513 - 768 Solaris specific `get' style commands. - * 769 - 1024 Solaris specific `set' style commands where the value is + * 513 - 768 illumos-defined `get' style commands. + * 769 - 1024 illumos-defined `set' style commands where the value is * selected to be the value for the corresponding `get' command * plus 256. * @@ -69,7 +70,7 @@ extern char platform[]; /* UI defined `get' commands (1-256) */ #define SI_SYSNAME 1 /* return name of operating system */ #define SI_HOSTNAME 2 /* return name of node */ -#define SI_RELEASE 3 /* return release of operating system */ +#define SI_RELEASE 3 /* return release of operating system */ #define SI_VERSION 4 /* return version field of utsname */ #define SI_MACHINE 5 /* return kind of machine */ #define SI_ARCHITECTURE 6 /* return instruction set arch */ @@ -81,7 +82,7 @@ extern char platform[]; #define SI_SET_HOSTNAME 258 /* set name of node */ #define SI_SET_SRPC_DOMAIN 265 /* set secure RPC domain */ -/* Solaris defined `get' commands (513-768) */ +/* illumos-defined `get' commands (513-768) */ #define SI_PLATFORM 513 /* return platform identifier */ #define SI_ISALIST 514 /* return supported isa list */ #define SI_DHCP_CACHE 515 /* return kernel-cached DHCPACK */ @@ -89,8 +90,9 @@ extern char platform[]; #define SI_ARCHITECTURE_64 517 /* basic 64-bit SI_ARCHITECTURE */ #define SI_ARCHITECTURE_K 518 /* kernel SI_ARCHITECTURE equivalent */ #define SI_ARCHITECTURE_NATIVE 519 /* SI_ARCHITECTURE of the caller */ +#define SI_ADDRESS_WIDTH 520 /* number of bits in native address */ -/* Solaris defined `set' commands (769-1024) (none currently assigned) */ +/* illumos-defined `set' commands (769-1024) (none currently assigned) */ #define HW_INVALID_HOSTID 0xFFFFFFFF /* an invalid hostid */ diff --git a/usr/src/uts/common/sys/tem_impl.h b/usr/src/uts/common/sys/tem_impl.h index eeb5881a22..8af55ab75f 100644 --- a/usr/src/uts/common/sys/tem_impl.h +++ b/usr/src/uts/common/sys/tem_impl.h @@ -77,7 +77,6 @@ extern "C" { #define TEM_ATTR_ISSET(c, a) ((TEM_CHAR_ATTR(c) & (a)) == (a)) #define TEM_MAXPARAMS 5 /* maximum number of ANSI paramters */ -#define TEM_MAXTAB 40 /* maximum number of tab stops */ #define TEM_MAXFKEY 30 /* max length of function key with <ESC>Q */ #define TEM_SCROLL_UP 0 @@ -96,6 +95,8 @@ extern "C" { #define TEM_ATTR_BRIGHT_BG 0x0040 #define TEM_ATTR_TRANSPARENT 0x0080 #define TEM_ATTR_IMAGE 0x0100 +#define TEM_ATTR_RGB_FG 0x0200 +#define TEM_ATTR_RGB_BG 0x0400 #define ANSI_COLOR_BLACK 0 #define ANSI_COLOR_RED 1 @@ -140,7 +141,15 @@ extern "C" { #define DEFAULT_ANSI_BACKGROUND ANSI_COLOR_WHITE typedef uint32_t tem_char_t; /* 32bit char to support UTF-8 */ -typedef uint8_t text_color_t; +typedef union { + uint32_t n; + struct bgra { + uint8_t b; + uint8_t g; + uint8_t r; + uint8_t a; + } rgb; +} text_color_t; typedef uint16_t text_attr_t; #if !defined(_BOOT) @@ -180,6 +189,7 @@ typedef struct term_char { struct tem_vt_state { kmutex_t tvs_lock; uchar_t tvs_fbmode; /* framebuffer mode */ + uchar_t tvs_alpha; /* rgb alpha channel */ text_attr_t tvs_flags; /* flags for this x3.64 terminal */ int tvs_state; /* state in output esc seq processing */ boolean_t tvs_gotparam; /* does output esc seq have a param */ @@ -187,8 +197,9 @@ struct tem_vt_state { int tvs_curparam; /* current param # of output esc seq */ int tvs_paramval; /* value of current param */ int tvs_params[TEM_MAXPARAMS]; /* parameters of output esc seq */ - screen_pos_t tvs_tabs[TEM_MAXTAB]; /* tab stops */ - int tvs_ntabs; /* number of tabs used */ + screen_pos_t *tvs_tabs; /* tab stops */ + size_t tvs_maxtab; /* maximum number of tab stops */ + size_t tvs_ntabs; /* number of tabs used */ int tvs_nscroll; /* number of lines to scroll */ struct tem_char_pos tvs_s_cursor; /* start cursor position */ @@ -200,8 +211,10 @@ struct tem_vt_state { size_t tvs_outindex; /* index into a_outbuf */ void *tvs_pix_data; /* pointer to tmp bitmap area */ size_t tvs_pix_data_size; - text_color_t tvs_fg_color; - text_color_t tvs_bg_color; + + text_color_t tvs_fg_color; /* console foreground */ + text_color_t tvs_bg_color; /* console background */ + int tvs_first_line; /* kernel console output begins */ term_char_t *tvs_screen_buf; /* whole screen buffer */ @@ -227,7 +240,7 @@ typedef struct tem_safe_callbacks { screen_pos_t, screen_pos_t, cred_t *, enum called_from); void (*tsc_cursor)(struct tem_vt_state *, short, cred_t *, enum called_from); - void (*tsc_bit2pix)(struct tem_vt_state *, term_char_t); + void (*tsc_bit2pix)(struct tem_vt_state *, term_char_t *); void (*tsc_cls)(struct tem_vt_state *, int, screen_pos_t, screen_pos_t, cred_t *, enum called_from); } tem_safe_callbacks_t; @@ -311,7 +324,7 @@ void tem_safe_pix_copy(struct tem_vt_state *, cred_t *, enum called_from); void tem_safe_pix_cursor(struct tem_vt_state *, short, cred_t *, enum called_from); -void tem_safe_pix_bit2pix(struct tem_vt_state *, term_char_t); +void tem_safe_pix_bit2pix(struct tem_vt_state *, term_char_t *); void tem_safe_pix_cls(struct tem_vt_state *, int, screen_pos_t, screen_pos_t, cred_t *, enum called_from); void tem_safe_pix_cls_range(struct tem_vt_state *, diff --git a/usr/src/uts/common/sys/termios.h b/usr/src/uts/common/sys/termios.h index b955e5f3f2..4edeb7a41c 100644 --- a/usr/src/uts/common/sys/termios.h +++ b/usr/src/uts/common/sys/termios.h @@ -329,8 +329,8 @@ extern pid_t tcgetsid(int); /* Slots reserved for 386/XENIX compatibility - keyboard control */ #define TIOCKBON (_TIOC|8) -#define TIOCKBOF (_TIOC|9) -#define KBENABLED (_TIOC|10) +#define TIOCKBOF (_TIOC|9) +#define KBENABLED (_TIOC|10) #ifndef IOCTYPE #define IOCTYPE 0xff00 @@ -431,7 +431,7 @@ struct ppsclockev32 { #define TIOCSETD (tIOC|1) #define TIOCHPCL (tIOC|2) #define TIOCGETP (tIOC|8) -#define TIOCSETP (tIOC|9) +#define TIOCSETP (tIOC|9) #define TIOCSETN (tIOC|10) #define TIOCEXCL (tIOC|13) #define TIOCNXCL (tIOC|14) @@ -496,7 +496,7 @@ struct ppsclockev32 { /* pseudo-tty */ #define TIOCREMOTE (tIOC|30) /* remote input editing */ -#define TIOCSIGNAL (tIOC|31) /* pty: send signal to slave */ +#define TIOCSIGNAL (tIOC|31) /* pty: send signal to subsidiary */ /* Some more 386 xenix stuff */ @@ -540,30 +540,38 @@ struct ppsclockev32 { /* * Speeds */ -#define B0 0 -#define B50 1 -#define B75 2 -#define B110 3 -#define B134 4 -#define B150 5 -#define B200 6 -#define B300 7 -#define B600 8 -#define B1200 9 -#define B1800 10 -#define B2400 11 -#define B4800 12 -#define B9600 13 -#define B19200 14 -#define B38400 15 -#define B57600 16 -#define B76800 17 -#define B115200 18 -#define B153600 19 -#define B230400 20 -#define B307200 21 -#define B460800 22 -#define B921600 23 +#define B0 0 +#define B50 1 +#define B75 2 +#define B110 3 +#define B134 4 +#define B150 5 +#define B200 6 +#define B300 7 +#define B600 8 +#define B1200 9 +#define B1800 10 +#define B2400 11 +#define B4800 12 +#define B9600 13 +#define B19200 14 +#define B38400 15 +#define B57600 16 +#define B76800 17 +#define B115200 18 +#define B153600 19 +#define B230400 20 +#define B307200 21 +#define B460800 22 +#define B921600 23 +#define B1000000 24 +#define B1152000 25 +#define B1500000 26 +#define B2000000 27 +#define B2500000 28 +#define B3000000 29 +#define B3500000 30 +#define B4000000 31 #ifndef _SYS_TTOLD_H diff --git a/usr/src/uts/common/sys/thread.h b/usr/src/uts/common/sys/thread.h index 3ecb7c00b0..3ca82366a0 100644 --- a/usr/src/uts/common/sys/thread.h +++ b/usr/src/uts/common/sys/thread.h @@ -25,7 +25,7 @@ */ /* - * Copyright 2019 Joyent, Inc. + * Copyright 2020 Joyent, Inc. */ #ifndef _SYS_THREAD_H @@ -122,7 +122,7 @@ typedef struct _kthread { struct cpu *t_bound_cpu; /* cpu bound to, or NULL if not bound */ short t_affinitycnt; /* nesting level of kernel affinity-setting */ short t_bind_cpu; /* user-specified CPU binding (-1 if none) */ - ushort_t t_flag; /* modified only by current thread */ + uint_t t_flag; /* modified only by current thread */ ushort_t t_proc_flag; /* modified holding ttproc(t)->p_lock */ ushort_t t_schedflag; /* modified holding thread_lock(t) */ volatile char t_preempt; /* don't preempt thread if set */ @@ -384,6 +384,8 @@ typedef struct _kthread { #define T_CAPTURING 0x2000 /* thread is in page capture logic */ #define T_VFPARENT 0x4000 /* thread is vfork parent, must call vfwait */ #define T_DONTDTRACE 0x8000 /* disable DTrace probes */ +#define T_KFPU 0x10000 /* kernel FPU active */ +#define T_PUSHPAGE 0x20000 /* this thread may be assisting pageout */ /* * Flags in t_proc_flag. diff --git a/usr/src/uts/common/sys/tihdr.h b/usr/src/uts/common/sys/tihdr.h index 8332ec71bd..e3bc4759d3 100644 --- a/usr/src/uts/common/sys/tihdr.h +++ b/usr/src/uts/common/sys/tihdr.h @@ -24,6 +24,7 @@ /* * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright 2020 Joyent, Inc. */ #ifndef _SYS_TIHDR_H @@ -180,44 +181,6 @@ extern "C" { #endif /* _KERNEL */ /* - * The following are the events that drive the state machine - */ -/* Initialization events */ -#define TE_BIND_REQ 0 /* bind request */ -#define TE_UNBIND_REQ 1 /* unbind request */ -#define TE_OPTMGMT_REQ 2 /* manage options req */ -#define TE_BIND_ACK 3 /* bind acknowledment */ -#define TE_OPTMGMT_ACK 4 /* manage options ack */ -#define TE_ERROR_ACK 5 /* error acknowledgment */ -#define TE_OK_ACK1 6 /* ok ack seqcnt == 0 */ -#define TE_OK_ACK2 7 /* ok ack seqcnt == 1, q == resq */ -#define TE_OK_ACK3 8 /* ok ack seqcnt == 1, q != resq */ -#define TE_OK_ACK4 9 /* ok ack seqcnt > 1 */ - -/* Connection oriented events */ -#define TE_CONN_REQ 10 /* connection request */ -#define TE_CONN_RES 11 /* connection response */ -#define TE_DISCON_REQ 12 /* disconnect request */ -#define TE_DATA_REQ 13 /* data request */ -#define TE_EXDATA_REQ 14 /* expedited data request */ -#define TE_ORDREL_REQ 15 /* orderly release req */ -#define TE_CONN_IND 16 /* connection indication */ -#define TE_CONN_CON 17 /* connection confirmation */ -#define TE_DATA_IND 18 /* data indication */ -#define TE_EXDATA_IND 19 /* expedited data indication */ -#define TE_ORDREL_IND 20 /* orderly release ind */ -#define TE_DISCON_IND1 21 /* disconnect indication seq == 0 */ -#define TE_DISCON_IND2 22 /* disconnect indication seq == 1 */ -#define TE_DISCON_IND3 23 /* disconnect indication seq > 1 */ -#define TE_PASS_CONN 24 /* pass connection */ - -/* Unit data events */ -#define TE_UNITDATA_REQ 25 /* unitdata request */ -#define TE_UNITDATA_IND 26 /* unitdata indication */ -#define TE_UDERROR_IND 27 /* unitdata error indication */ - -#define TE_NOEVENTS 28 -/* * The following are the possible states of the Transport * Service Interface */ @@ -434,7 +397,7 @@ struct T_info_ack { * Flag XPG4_1: * transport provider supports TPI modifications motivated by and * in conjunction with XTI inspired TPI support and all the - * compatibility baggage that implies. + * compatibility baggage that implies. * It implies, - primitives T_ADDR_REQ & T_ADDR_ACK supported * - primitives O_T_BIND_REQ & T_BIND_REQ separately supported * - primitives T_SVR4_OPTMGMT_REQ & T_OPTMGMT_REQ separately @@ -520,12 +483,12 @@ struct T_addr_ack { * subsume the functionality of T_INFO_{REQ,ACK}. */ struct T_capability_req { - t_scalar_t PRIM_type; /* always T_CAPABILITY_REQ */ + t_scalar_t PRIM_type; /* always T_CAPABILITY_REQ */ t_uscalar_t CAP_bits1; /* capability bits #1 */ }; struct T_capability_ack { - t_scalar_t PRIM_type; /* always T_CAPABILITY_ACK */ + t_scalar_t PRIM_type; /* always T_CAPABILITY_ACK */ t_uscalar_t CAP_bits1; /* capability bits #1 */ struct T_info_ack INFO_ack; /* info acknowledgement */ diff --git a/usr/src/uts/common/sys/time.h b/usr/src/uts/common/sys/time.h index a69bf4dd63..f6cfa1a7e5 100644 --- a/usr/src/uts/common/sys/time.h +++ b/usr/src/uts/common/sys/time.h @@ -16,6 +16,8 @@ * * Copyright 2013 Nexenta Systems, Inc. All rights reserved. * Copyright 2016 Joyent, Inc. + * + * Copyright 2020 OmniOS Community Edition (OmniOSce) Association. */ /* @@ -365,14 +367,14 @@ extern todinfo_t utc_to_tod(time_t); extern time_t tod_to_utc(todinfo_t); extern int hr_clock_lock(void); extern void hr_clock_unlock(int); -extern hrtime_t gethrtime(void); -extern hrtime_t gethrtime_unscaled(void); +extern hrtime_t gethrtime(void); +extern hrtime_t gethrtime_unscaled(void); extern hrtime_t gethrtime_max(void); extern hrtime_t gethrtime_waitfree(void); extern void scalehrtime(hrtime_t *); extern uint64_t unscalehrtime(hrtime_t); -extern void gethrestime(timespec_t *); -extern time_t gethrestime_sec(void); +extern void gethrestime(timespec_t *); +extern time_t gethrestime_sec(void); extern void gethrestime_lasttick(timespec_t *); extern void hrt2ts(hrtime_t, timestruc_t *); extern hrtime_t ts2hrt(const timestruc_t *); @@ -408,6 +410,7 @@ int futimesat(int, const char *, const struct timeval *); int getitimer(int, struct itimerval *); int utimes(const char *, const struct timeval *); + #if defined(_XPG4_2) int setitimer(int, const struct itimerval *_RESTRICT_KYWD, struct itimerval *_RESTRICT_KYWD); @@ -418,6 +421,22 @@ int setitimer(int, struct itimerval *_RESTRICT_KYWD, #endif /* !defined(_KERNEL) ... defined(_XPG4_2) */ +#if !defined(_KERNEL) && !defined(_STRICT_SYMBOLS) +int futimes(int, const struct timeval *); +int lutimes(const char *, const struct timeval *); + +#define TIMESPEC_TO_TIMEVAL(tv, ts) { \ + (tv)->tv_sec = (ts)->tv_sec; \ + (tv)->tv_usec = (ts)->tv_nsec / 1000; \ +} + +#define TIMEVAL_TO_TIMESPEC(tv, ts) { \ + (ts)->tv_sec = (tv)->tv_sec; \ + (ts)->tv_nsec = (tv)->tv_usec * 1000; \ +} + +#endif /* !defined(_KERNEL) && !defined(_STRICT_SYMBOLS) */ + /* * gettimeofday() and settimeofday() were included in SVr4 due to their * common use in BSD based applications. They were to be included exactly diff --git a/usr/src/uts/common/sys/timer.h b/usr/src/uts/common/sys/timer.h index 748e0c0627..db27960413 100644 --- a/usr/src/uts/common/sys/timer.h +++ b/usr/src/uts/common/sys/timer.h @@ -25,7 +25,7 @@ */ /* - * Copyright 2016 Joyent, Inc. + * Copyright 2020 Joyent, Inc. */ #ifndef _SYS_TIMER_H @@ -48,6 +48,8 @@ extern "C" { /* * Max timers per process. This is patchable via /etc/system and can be * updated via kmdb. Sticking to positive powers of 2 is recommended. + * The default value is 4 * NCPU. Setting timer_max to a value below the + * default via /etc/system is ignored. */ extern int timer_max; diff --git a/usr/src/uts/common/sys/tspriocntl.h b/usr/src/uts/common/sys/tspriocntl.h index 1c8c35a5d6..6d814631e0 100644 --- a/usr/src/uts/common/sys/tspriocntl.h +++ b/usr/src/uts/common/sys/tspriocntl.h @@ -62,7 +62,7 @@ typedef struct tsinfo { #define TS_KY_UPRI 2 /* user priority */ /* - * The following is used by the dispadmin(1M) command for + * The following is used by the dispadmin(8) command for * scheduler administration and is not for general use. */ diff --git a/usr/src/uts/common/sys/types.h b/usr/src/uts/common/sys/types.h index dcb2c86283..c583bc6362 100644 --- a/usr/src/uts/common/sys/types.h +++ b/usr/src/uts/common/sys/types.h @@ -28,6 +28,7 @@ * * Copyright 2013 Nexenta Systems, Inc. All rights reserved. * Copyright 2016 Joyent, Inc. + * Copyright 2021 Oxide Computer Company */ #ifndef _SYS_TYPES_H @@ -188,15 +189,36 @@ typedef int blksize_t; /* used for block sizes */ typedef long blksize_t; /* used for block sizes */ #endif -#if defined(__XOPEN_OR_POSIX) +/* + * The boolean_t type has had a varied amount of exposure over the years in + * terms of how its enumeration constants have been exposed. In particular, it + * originally used the __XOPEN_OR_POSIX macro to determine whether to prefix the + * B_TRUE and B_FALSE with an underscore. This check never included the + * question of if we were in a strict ANSI C environment or whether extensions + * were defined. + * + * Compilers such as clang started defaulting to always including an + * XOPEN_SOURCE declaration on behalf of users, but also noted __EXTENSIONS__. + * This would lead most software that had used the non-underscore versions to + * need it. As such, we have adjusted the non-strict XOPEN environment to retain + * its old behavior so as to minimize namespace pollution; however, we instead + * include both variants of the definitions in the generally visible version + * allowing software written in either world to hopefully end up in a good + * place. + * + * This isn't perfect, but should hopefully minimize the pain for folks actually + * trying to build software. + */ +#if defined(__XOPEN_OR_POSIX) && !defined(__EXTENSIONS__) typedef enum { _B_FALSE, _B_TRUE } boolean_t; #else -typedef enum { B_FALSE, B_TRUE } boolean_t; +typedef enum { B_FALSE = 0, B_TRUE = 1, _B_FALSE = 0, _B_TRUE = 1 } boolean_t; +#endif /* __XOPEN_OR_POSIX && !__EXTENSIONS__ */ + #ifdef _KERNEL #define VALID_BOOLEAN(x) (((x) == B_FALSE) || ((x) == B_TRUE)) #define VOID2BOOLEAN(x) (((uintptr_t)(x) == 0) ? B_FALSE : B_TRUE) #endif /* _KERNEL */ -#endif /* defined(__XOPEN_OR_POSIX) */ #ifdef _KERNEL #define BOOLEAN2VOID(x) ((x) ? 1 : 0) @@ -409,8 +431,8 @@ typedef struct _pthread_mutex { /* = mutex_t in synch.h */ uint16_t __pthread_mutex_flag1; uint8_t __pthread_mutex_flag2; uint8_t __pthread_mutex_ceiling; - uint16_t __pthread_mutex_type; - uint16_t __pthread_mutex_magic; + uint16_t __pthread_mutex_type; + uint16_t __pthread_mutex_magic; } __pthread_mutex_flags; union { struct { @@ -428,8 +450,8 @@ typedef struct _pthread_mutex { /* = mutex_t in synch.h */ typedef struct _pthread_cond { /* = cond_t in synch.h */ struct { uint8_t __pthread_cond_flag[4]; - uint16_t __pthread_cond_type; - uint16_t __pthread_cond_magic; + uint16_t __pthread_cond_type; + uint16_t __pthread_cond_magic; } __pthread_cond_flags; upad64_t __pthread_cond_data; } pthread_cond_t; diff --git a/usr/src/uts/common/sys/ucode.h b/usr/src/uts/common/sys/ucode.h index 8bbace2b99..c770f14419 100644 --- a/usr/src/uts/common/sys/ucode.h +++ b/usr/src/uts/common/sys/ucode.h @@ -21,6 +21,9 @@ /* * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * + * Copyright 2021 OmniOS Community Edition (OmniOSce) Association. + * Copyright 2022 Joyent, Inc. */ #ifndef _SYS_UCODE_H @@ -197,7 +200,7 @@ typedef union ucode_file { #define UCODE_DEFAULT_BODY_SIZE (UCODE_KB(2) - UCODE_HEADER_SIZE_INTEL) /* - * For a single microcode file, the minimum size is 1K, maximum size is 128K. + * For a single microcode file, the minimum size is 1K, maximum size is 384K. * Such limitations, while somewhat artificial, are not only to provide better * sanity checks, but also avoid wasting precious memory at startup time as the * microcode buffer for the first processor has to be statically allocated. @@ -206,7 +209,7 @@ typedef union ucode_file { * is 16M. */ #define UCODE_MIN_SIZE UCODE_KB(1) -#define UCODE_MAX_SIZE UCODE_KB(128) +#define UCODE_MAX_SIZE UCODE_KB(384) #define UCODE_MAX_COMBINED_SIZE UCODE_MB(16) #define UCODE_SIZE_CONVERT(size, default_size) \ @@ -224,6 +227,8 @@ typedef union ucode_file { extern ucode_errno_t ucode_header_validate_intel(ucode_header_intel_t *); extern uint32_t ucode_checksum_intel(uint32_t, uint32_t, uint8_t *); +extern uint32_t ucode_checksum_intel_extsig(ucode_header_intel_t *, + ucode_ext_sig_intel_t *); extern ucode_errno_t ucode_validate_amd(uint8_t *, int); extern ucode_errno_t ucode_validate_intel(uint8_t *, int); diff --git a/usr/src/uts/common/sys/unistd.h b/usr/src/uts/common/sys/unistd.h index f366e99f6a..591a3426f5 100644 --- a/usr/src/uts/common/sys/unistd.h +++ b/usr/src/uts/common/sys/unistd.h @@ -106,9 +106,9 @@ extern "C" { #define _SC_ARG_MAX 1 #define _SC_CHILD_MAX 2 #define _SC_CLK_TCK 3 -#define _SC_NGROUPS_MAX 4 +#define _SC_NGROUPS_MAX 4 #define _SC_OPEN_MAX 5 -#define _SC_JOB_CONTROL 6 +#define _SC_JOB_CONTROL 6 #define _SC_SAVED_IDS 7 #define _SC_VERSION 8 /* SVR4 names */ @@ -151,21 +151,21 @@ extern "C" { #define _SC_TIMER_MAX 44 /* XPG4 names */ #define _SC_2_C_BIND 45 -#define _SC_2_C_DEV 46 +#define _SC_2_C_DEV 46 #define _SC_2_C_VERSION 47 -#define _SC_2_FORT_DEV 48 -#define _SC_2_FORT_RUN 49 +#define _SC_2_FORT_DEV 48 +#define _SC_2_FORT_RUN 49 #define _SC_2_LOCALEDEF 50 -#define _SC_2_SW_DEV 51 +#define _SC_2_SW_DEV 51 #define _SC_2_UPE 52 #define _SC_2_VERSION 53 #define _SC_BC_BASE_MAX 54 -#define _SC_BC_DIM_MAX 55 +#define _SC_BC_DIM_MAX 55 #define _SC_BC_SCALE_MAX 56 #define _SC_BC_STRING_MAX 57 #define _SC_COLL_WEIGHTS_MAX 58 #define _SC_EXPR_NEST_MAX 59 -#define _SC_LINE_MAX 60 +#define _SC_LINE_MAX 60 #define _SC_RE_DUP_MAX 61 #define _SC_XOPEN_CRYPT 62 #define _SC_XOPEN_ENH_I18N 63 @@ -210,6 +210,7 @@ extern "C" { #define _SC_NPROCESSORS_MAX 516 /* maximum # of processors */ #define _SC_CPUID_MAX 517 /* maximum CPU id */ #define _SC_EPHID_MAX 518 /* maximum ephemeral id */ +#define _SC_UADDR_MAX 519 /* maximum user address */ /* * POSIX.1c (pthreads) names. These values are defined above @@ -351,7 +352,7 @@ extern "C" { #ifdef _XPG6 #define _POSIX_VERSION 200112L /* Supports IEEE Std 1003.1-2001 */ #else -#define _POSIX_VERSION 199506L /* Supports POSIX-1c DIS */ +#define _POSIX_VERSION 199506L /* Supports POSIX-1c DIS */ #endif #endif /* _POSIX_VERSION */ @@ -359,7 +360,7 @@ extern "C" { #ifdef _XPG6 #define _POSIX2_VERSION 200112L /* Supports IEEE Std 1003.1-2001 */ #else -#define _POSIX2_VERSION 199209L /* Supports ISO POSIX-2 DIS */ +#define _POSIX2_VERSION 199209L /* Supports ISO POSIX-2 DIS */ #endif #endif /* _POSIX2_VERSION */ @@ -395,14 +396,14 @@ extern "C" { #define _POSIX2_FORT_RUN 200112L /* Supports FORTRAN runtime */ #define _POSIX2_LOCALEDEF 200112L /* Supports creation of locales */ #define _POSIX2_SW_DEV 200112L /* Supports S/W Development Utility */ -#define _POSIX2_UPE 200112L /* Supports User Portability Utility */ +#define _POSIX2_UPE 200112L /* Supports User Portability Utility */ #else #define _POSIX2_C_BIND 1 /* Supports C Language Bindings */ #define _POSIX2_C_DEV 1 /* Supports C language dev utility */ #define _POSIX2_FORT_RUN 1 /* Supports FORTRAN runtime */ #define _POSIX2_LOCALEDEF 1 /* Supports creation of locales */ #define _POSIX2_SW_DEV 1 /* Supports S/W Development Utility */ -#define _POSIX2_UPE 1 /* Supports User Portability Utility */ +#define _POSIX2_UPE 1 /* Supports User Portability Utility */ #endif /* _XPG6 */ /* UNIX 03 names */ diff --git a/usr/src/uts/common/sys/usb/clients/ccid/ccid.h b/usr/src/uts/common/sys/usb/clients/ccid/ccid.h index 0437a957ba..c5ed9ad1f2 100644 --- a/usr/src/uts/common/sys/usb/clients/ccid/ccid.h +++ b/usr/src/uts/common/sys/usb/clients/ccid/ccid.h @@ -175,23 +175,23 @@ typedef union ccid_params { typedef enum ccid_intr_code { CCID_INTR_CODE_SLOT_CHANGE = 0x50, CCID_INTR_CODE_HW_ERROR = 0x51 -} __packed ccid_intr_code_t; +} ccid_intr_code_t; typedef enum ccid_intr_hwerr_code { CCID_INTR_HWERR_OVERCURRENT = 0x01 -} __packed ccid_intr_hwerr_code_t; +} ccid_intr_hwerr_code_t; typedef struct ccid_intr_slot { uint8_t cis_type; uint8_t cis_state[]; -} __packed ccid_intr_slot_t; +} ccid_intr_slot_t; typedef struct ccid_intr_hwerr { uint8_t cih_type; uint8_t cih_slot; uint8_t cih_seq; uint8_t cih_code; -} __packed ccid_intr_hwerr_t; +} ccid_intr_hwerr_t; /* * Message request codes. These codes are based on CCID r1.1.0 Table 6.1-1 @@ -214,7 +214,7 @@ typedef enum ccid_request_code { CCID_REQEUST_ABORT = 0x72, /* PC_to_RDR_Abort */ CCID_REQUEST_DATA_CLOCK = 0x73 /* PC_to_RDR_SetDataRateAnd */ /* ClockFrequency */ -} __packed ccid_request_code_t; +} ccid_request_code_t; /* * Message request codes. These codes are based on CCID r1.1.0 Table 6.2-1 @@ -228,7 +228,7 @@ typedef enum ccid_response_code { CCID_RESPONSE_ESCAPE = 0x83, /* RDR_to_PC_Escape */ CCID_RESPONSE_DATA_CLOCK = 0x84 /* RDR_to_PC_DataRateAnd */ /* ClockFrequency */ -} __packed ccid_response_code_t; +} ccid_response_code_t; /* * This represents the CCID command header that is used for every request and @@ -265,13 +265,13 @@ typedef enum { CCID_REPLY_ICC_ACTIVE = 0, CCID_REPLY_ICC_INACTIVE, CCID_REPLY_ICC_MISSING -} __packed ccid_reply_icc_status_t; +} ccid_reply_icc_status_t; typedef enum { CCID_REPLY_STATUS_COMPLETE = 0, CCID_REPLY_STATUS_FAILED, CCID_REPLY_STATUS_MORE_TIME -} __packed ccid_reply_command_status_t; +} ccid_reply_command_status_t; /* * Errors that are defined based when commands fail. These are based on CCID @@ -294,7 +294,7 @@ typedef enum ccid_command_err { CCID_ERR_PIN_CANCELLED = 0xef, CCID_ERR_CMD_SLOT_BUSY = 0xe0, CCID_ERR_CMD_NOT_SUPPORTED = 0x00 -} __packed ccid_command_err_t; +} ccid_command_err_t; /* * Maximum size of an APDU (application data unit) payload. There are both short diff --git a/usr/src/uts/common/sys/usb/clients/ccid/uccid.h b/usr/src/uts/common/sys/usb/clients/ccid/uccid.h index 9aee0559b6..032ac73274 100644 --- a/usr/src/uts/common/sys/usb/clients/ccid/uccid.h +++ b/usr/src/uts/common/sys/usb/clients/ccid/uccid.h @@ -56,7 +56,7 @@ extern "C" { typedef struct uccid_cmd_txn_begin { uint32_t uct_version; uint32_t uct_flags; -} __packed uccid_cmd_txn_begin_t; +} uccid_cmd_txn_begin_t; /* * Relinquish exclusive access. Takes a uccid_cmd_txn_end_t. The callers should @@ -72,7 +72,7 @@ typedef struct uccid_cmd_txn_begin { typedef struct uccid_cmd_txn_end { uint32_t uct_version; uint32_t uct_flags; -} __packed uccid_cmd_txn_end_t; +} uccid_cmd_txn_end_t; /* * Obtain the status of the slot. Returns a filled-in uccid_cmd_status_t. @@ -83,6 +83,7 @@ typedef struct uccid_cmd_txn_end { * Protocol definitions. This should match common/ccid/atr.h. */ typedef enum { + UCCID_PROT_NONE = 0, UCCID_PROT_T0 = 1 << 0, UCCID_PROT_T1 = 1 << 1 } uccid_prot_t; @@ -109,7 +110,7 @@ typedef struct uccid_cmd_status { ccid_class_descr_t ucs_class; uccid_prot_t ucs_prot; ccid_params_t ucs_params; -} __packed uccid_cmd_status_t; +} uccid_cmd_status_t; /* * Modify the state of the ICC, if present. @@ -123,7 +124,7 @@ typedef struct uccid_cmd_status { typedef struct uccid_cmd_icc_modify { uint32_t uci_version; uint32_t uci_action; -} __packed uccid_cmd_icc_modify_t; +} uccid_cmd_icc_modify_t; #ifdef __cplusplus } diff --git a/usr/src/uts/common/sys/usb/clients/hid/hidvar.h b/usr/src/uts/common/sys/usb/clients/hid/hidvar.h index ee68f0088a..61ac49800a 100644 --- a/usr/src/uts/common/sys/usb/clients/hid/hidvar.h +++ b/usr/src/uts/common/sys/usb/clients/hid/hidvar.h @@ -84,10 +84,10 @@ extern "C" { * If the hid descriptor is not valid, the following values are * used. */ -#define USBKPSZ 8 /* keyboard packet size */ -#define USBMSSZ 3 /* mouse packet size */ -#define USB_KB_HID_DESCR_LENGTH 0x3f /* keyboard Report descr length */ -#define USB_MS_HID_DESCR_LENGTH 0x32 /* mouse Report descr length */ +#define USBKPSZ 8 /* keyboard packet size */ +#define USBMSSZ 3 /* mouse packet size */ +#define USB_KB_HID_DESCR_LENGTH 0x3f /* keyboard Report descr length */ +#define USB_MS_HID_DESCR_LENGTH 0x32 /* mouse Report descr length */ /* * Flags for the default pipe. @@ -119,12 +119,12 @@ extern "C" { /* Attach/detach states */ #define HID_LOCK_INIT 0x01 /* Initial attach state */ -#define HID_MINOR_NODES 0x02 /* Set after minor node is created */ +#define HID_MINOR_NODES 0x02 /* Set after minor node is created */ /* HID Protocol Requests */ -#define SET_IDLE 0x0a /* bRequest value to set idle request */ -#define DURATION (0<<8) /* no. of repeat reports (HID 7.2.4) */ -#define SET_PROTOCOL 0x0b /* bRequest value for boot protocol */ +#define SET_IDLE 0x0a /* bRequest value to set idle request */ +#define DURATION (0<<8) /* no. of repeat reports (HID 7.2.4) */ +#define SET_PROTOCOL 0x0b /* bRequest value for boot protocol */ /* Hid PM scheme */ typedef enum { @@ -249,7 +249,7 @@ _NOTE(SCHEME_PROTECTS_DATA("stable data", usb_ep_descr)) * handle is used when the kernel is in the single thread mode * so the field is tagged with this note. */ -_NOTE(SCHEME_PROTECTS_DATA("unique per call", +_NOTE(SCHEME_PROTECTS_DATA("unique per call", hid_state_t::hid_polled_console_info)) /* @@ -316,7 +316,7 @@ _NOTE(SCHEME_PROTECTS_DATA("unique per call", hid_default_pipe_arg_t)) * Debug message Masks */ #define PRINT_MASK_ATTA 0x00000001 -#define PRINT_MASK_OPEN 0x00000002 +#define PRINT_MASK_OPEN 0x00000002 #define PRINT_MASK_CLOSE 0x00000004 #define PRINT_MASK_EVENTS 0x00000008 #define PRINT_MASK_PM 0x00000010 diff --git a/usr/src/uts/common/sys/usb/clients/ugen/usb_ugen.h b/usr/src/uts/common/sys/usb/clients/ugen/usb_ugen.h index d1bcc096d1..a63fb02f1a 100644 --- a/usr/src/uts/common/sys/usb/clients/ugen/usb_ugen.h +++ b/usr/src/uts/common/sys/usb/clients/ugen/usb_ugen.h @@ -39,7 +39,7 @@ extern "C" { /* * UGEN provides a mechanism to retrieve USB bus specific information - * through endpoint status minor nodes (See ugen(7D) for more information). + * through endpoint status minor nodes (See ugen(4D) for more information). * Whenever an error occurs on any endpoint, the application can retrieve * the last command status (int). Possible values are give below */ @@ -81,7 +81,7 @@ extern "C" { /* * Possible Device status (int) values * Application can poll(2) and read(2) device status on device status minor - * nodes (See ugen(7D) for more details). + * nodes (See ugen(4D) for more details). */ #define USB_DEV_STAT_ONLINE 0x1 /* Device is online */ #define USB_DEV_STAT_DISCONNECTED 0x2 /* Device is disconnected */ diff --git a/usr/src/uts/common/sys/usb/clients/usbser/usbser_keyspan/keyspan_49fw.h b/usr/src/uts/common/sys/usb/clients/usbser/usbser_keyspan/keyspan_49fw.h index 3dc5dbfba4..9ff61ffb35 100644 --- a/usr/src/uts/common/sys/usb/clients/usbser/usbser_keyspan/keyspan_49fw.h +++ b/usr/src/uts/common/sys/usb/clients/usbser/usbser_keyspan/keyspan_49fw.h @@ -32,7 +32,7 @@ /* * For the 4-port Keyspan usb-to-serial adapter (usa49wlc) support - * in the usbsksp(7D) driver, users can download a firmware package + * in the usbsksp(4D) driver, users can download a firmware package * from the Keyspan website (http://www.keyspan.com). * Please contact Keyspan technical support for questions regarding * firmware source access. @@ -45,7 +45,7 @@ * $ cd usr/src/uts/intel/usbs49_fw * $ make install * - * See usbsksp(7D) for details on using the Solaris USB keyspan + * See usbsksp(4D) for details on using the Solaris USB keyspan * driver. */ diff --git a/usr/src/uts/common/sys/usb/clients/usbser/usbser_var.h b/usr/src/uts/common/sys/usb/clients/usbser/usbser_var.h index 4cf89fe648..ceba9a81c9 100644 --- a/usr/src/uts/common/sys/usb/clients/usbser/usbser_var.h +++ b/usr/src/uts/common/sys/usb/clients/usbser/usbser_var.h @@ -171,7 +171,7 @@ _NOTE(LOCK_ORDER(usbser_state::us_mutex usbser_port::port_mutex)) * * [2] tty mode open may be blocked waiting for carrier. * if dial-out mode open happens at this time, it is allowed - * for it to overtake the port; from zs(7D) man page: + * for it to overtake the port; from zs(4D) man page: * * This allows a modem to be attached to /dev/term/[n] * and used for dial-in (by enabling the line for login in /etc/inittab) diff --git a/usr/src/uts/common/sys/usb/scsa2usb/scsa2usb.h b/usr/src/uts/common/sys/usb/scsa2usb/scsa2usb.h index c619a32e64..a161530e97 100644 --- a/usr/src/uts/common/sys/usb/scsa2usb/scsa2usb.h +++ b/usr/src/uts/common/sys/usb/scsa2usb/scsa2usb.h @@ -56,7 +56,9 @@ extern "C" { */ #define SCSA2USB_MAX_BULK_XFER_SIZE (64 * 1024) -/* Blacklist some vendors whose devices could cause problems */ +/* + * Identify devices with quirks of implementation that we need to work around: + */ #define MS_HAGIWARA_SYS_COM_VID 0x693 /* VendorId of Hagiwara Sys-Com */ #define MS_HAGIWARA_SYSCOM_PID1 0x1 /* PID for SmartMedia(SM) device */ #define MS_HAGIWARA_SYSCOM_PID2 0x3 /* PID for CompactFlash(CF) device */ @@ -125,6 +127,13 @@ extern "C" { #define MS_WD_PID 0x1001 /* PID for Western Digital USB External HDD */ /* + * The virtual CD-ROM device emulated by at least some Insyde BMCs is not + * completely implemented. It hangs when a MODE SENSE command is sent. + */ +#define MS_INSYDE_VID 0xb1f /* Vendor: Insyde Software Corp */ +#define MS_INSYDE_PID_CDROM 0x03ea /* Product: BMC Virtual CD-ROM */ + +/* * The AMI virtual floppy device is not a real USB storage device, but * emulated by the SP firmware shipped together with important Sun x86 * products such as Galaxy and Thumper platforms. The device causes @@ -143,7 +152,7 @@ extern "C" { * Reducing timeout value to 1 second can help a little bit, but the delay * is still noticeable, because the target driver would make many retries * for this command. It is not desirable to mess with the target driver - * for a broken USB device. So adding the device to the scsa2usb blacklist + * for a broken USB device. So adding the device to the scsa2usb quirks list * is the best choice we have. * * It is found that the READ CAPACITY failure only happens when there is @@ -187,7 +196,7 @@ extern "C" { * instead of highest logical block address on READ_CAPACITY cmd. * * NOTE: If a device simply STALLs the GET_MAX_LUN BO class-specific command - * and recovers then it will not be added to the scsa2usb_blacklist[] table + * and recovers then it will not be added to the scsa2usb_quirks[] table * in scsa2usb.c. The other attributes will not be taken of the table unless * their inclusion causes a recovery and retries (thus seriously affecting * the driver performance). @@ -508,10 +517,12 @@ _NOTE(SCHEME_PROTECTS_DATA("unshared data", usb_bulk_req_t)) FORMG0COUNT(((union scsi_cdb *)(pktp)->pkt_cdbp), (cnt)) -/* transport related */ -#define SCSA2USB_JUST_ACCEPT 0 -#define SCSA2USB_TRANSPORT 1 -#define SCSA2USB_REJECT -1 +/* + * Transport dispositions for commands: + */ +#define SCSA2USB_JUST_ACCEPT 0 /* Simulate command without device */ +#define SCSA2USB_TRANSPORT 1 /* Send the command to the device */ +#define SCSA2USB_REJECT -1 /* Reject with immediate fatal error */ /* * The scsa2usb_cpr_info data structure is used for cpr related diff --git a/usr/src/uts/common/sys/usb/usba/usba_impl.h b/usr/src/uts/common/sys/usb/usba/usba_impl.h index ddb6f7346d..8ad72b4f05 100644 --- a/usr/src/uts/common/sys/usb/usba/usba_impl.h +++ b/usr/src/uts/common/sys/usb/usba/usba_impl.h @@ -327,7 +327,7 @@ void usba_free_binary_object_store(usba_device_t *); #define DPRINT_MASK_REGISTER 0x00000040 #define DPRINT_MASK_DEVDB 0x00000080 #define DPRINT_MASK_WHCDI 0x00000100 -#define DPRINT_MASK_ALL 0xFFFFFFFF +#define DPRINT_MASK_ALL 0xFFFFFFFF typedef struct usba_log_handle_impl { dev_info_t *lh_dip; @@ -445,7 +445,7 @@ typedef struct usb_dev_cap { usb_dev_driver_callback_t usba_dev_driver_cb; } usb_dev_cap_t; -usb_dev_cap_t usb_cap; +extern usb_dev_cap_t usb_cap; _NOTE(SCHEME_PROTECTS_DATA("unique device capture data", usb_cap)) #ifdef __cplusplus diff --git a/usr/src/uts/common/sys/user.h b/usr/src/uts/common/sys/user.h index 8c424e7bf3..0b17066632 100644 --- a/usr/src/uts/common/sys/user.h +++ b/usr/src/uts/common/sys/user.h @@ -111,7 +111,7 @@ typedef struct uf_entry { short uf_busy; /* file is allocated [grow, fork] */ kcondvar_t uf_wanted_cv; /* waiting for setf() [never copied] */ kcondvar_t uf_closing_cv; /* waiting for close() [never copied] */ - struct portfd *uf_portfd; /* associated with port [grow] */ + struct portfd *uf_portfd; /* associated with port [grow] */ uf_entry_gen_t uf_gen; /* assigned fd generation [grow,fork] */ /* Avoid false sharing - pad to coherency granularity (64 bytes) */ char uf_pad[64 - sizeof (kmutex_t) - 2 * sizeof (void*) - @@ -197,7 +197,7 @@ typedef struct { /* kernel syscall set type */ * for the portions of the kernel that care about aux vectors. * * Applications that need to know how many aux vectors the kernel - * supplies should use the proc(4) interface to read /proc/PID/auxv. + * supplies should use the proc(5) interface to read /proc/PID/auxv. * * This value should not be changed in a patch. */ diff --git a/usr/src/uts/common/sys/visual_io.h b/usr/src/uts/common/sys/visual_io.h index 0194d00206..c894bb48bc 100644 --- a/usr/src/uts/common/sys/visual_io.h +++ b/usr/src/uts/common/sys/visual_io.h @@ -167,6 +167,7 @@ typedef union { unsigned char eight; /* eight bit */ unsigned char sixteen[2]; /* 16 bit */ unsigned char twentyfour[3]; /* 24 bit */ + unsigned char thirtytwo[4]; /* 32 bit */ } color_t; /* @@ -178,7 +179,7 @@ typedef union { * ioctl(fd, VIS_DEVINIT, struct vis_devinit *) */ #define VIS_DEVINIT (VIOC|1) -#define VIS_CONS_REV 4 /* Console IO interface version */ +#define VIS_CONS_REV 5 /* Console IO interface version */ /* Modes */ #define VIS_TEXT 0 /* Use text mode when displaying data */ #define VIS_PIXEL 1 /* Use pixel mode when displaying data */ @@ -237,7 +238,7 @@ typedef union { #define VIS_CONSCLEAR (VIOC|8) struct vis_consclear { - unsigned char bg_color; /* Background color */ + color_t bg_color; /* Background color */ }; struct vis_consdisplay { @@ -246,8 +247,8 @@ struct vis_consdisplay { screen_size_t width; /* Width of data */ screen_size_t height; /* Height of data */ unsigned char *data; /* Data to display */ - unsigned char fg_color; /* Foreground color */ - unsigned char bg_color; /* Background color */ + color_t fg_color; /* Foreground color */ + color_t bg_color; /* Background color */ }; struct vis_conscopy { diff --git a/usr/src/uts/common/sys/vm.h b/usr/src/uts/common/sys/vm.h index 0f7dfa9fd0..b32a789d36 100644 --- a/usr/src/uts/common/sys/vm.h +++ b/usr/src/uts/common/sys/vm.h @@ -50,7 +50,7 @@ extern "C" { #if defined(_KERNEL) #include <sys/vnode.h> -void setupclock(int); +void setupclock(void); void pageout(void); void cv_signal_pageout(void); int queue_io_request(struct vnode *, u_offset_t); diff --git a/usr/src/uts/common/sys/vmsystm.h b/usr/src/uts/common/sys/vmsystm.h index 2292310bda..daf76f9f51 100644 --- a/usr/src/uts/common/sys/vmsystm.h +++ b/usr/src/uts/common/sys/vmsystm.h @@ -76,13 +76,14 @@ extern pgcnt_t pageout_reserve; /* point at which we deny non-PG_WAIT calls */ extern pgcnt_t pages_before_pager; /* XXX */ /* - * TRUE if the pageout daemon, fsflush daemon or the scheduler. These - * processes can't sleep while trying to free up memory since a deadlock - * will occur if they do sleep. + * TRUE if the pageout daemon, fsflush daemon, or the scheduler. These threads + * can't sleep while trying to free up memory since a deadlock will occur if + * they do sleep. */ #define NOMEMWAIT() (ttoproc(curthread) == proc_pageout || \ ttoproc(curthread) == proc_fsflush || \ - ttoproc(curthread) == proc_sched) + ttoproc(curthread) == proc_sched || \ + (curthread->t_flag & T_PUSHPAGE) != 0) /* insure non-zero */ #define nz(x) ((x) != 0 ? (x) : 1) diff --git a/usr/src/uts/common/sys/vnode.h b/usr/src/uts/common/sys/vnode.h index 494264731b..df5da6c2e7 100644 --- a/usr/src/uts/common/sys/vnode.h +++ b/usr/src/uts/common/sys/vnode.h @@ -21,7 +21,7 @@ /* * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, Joyent, Inc. + * Copyright 2020 Joyent, Inc. * Copyright (c) 2011, 2017 by Delphix. All rights reserved. * Copyright 2017 RackTop Systems. */ @@ -197,6 +197,7 @@ struct vsd_node { * v_count * v_shrlocks * v_path + * v_phantom_count * v_vsd * v_xattrdir * @@ -214,6 +215,7 @@ struct vsd_node { * v_lock * v_flag * v_count + * v_phantom_count * v_data * v_vfsp * v_stream @@ -285,6 +287,8 @@ typedef struct vnode { kmutex_t v_lock; /* protects vnode fields */ uint_t v_flag; /* vnode flags (see below) */ uint_t v_count; /* reference count */ + /* non vn_count() ref count (see below) */ + uint_t v_phantom_count; void *v_data; /* private data for fs */ struct vfs *v_vfsp; /* ptr to containing VFS */ struct stdata *v_stream; /* associated stream */ @@ -811,9 +815,9 @@ typedef enum vnevent { VE_REMOVE = 3, /* Remove of vnode's name */ VE_RMDIR = 4, /* Remove of directory vnode's name */ VE_CREATE = 5, /* Create with vnode's name which exists */ - VE_LINK = 6, /* Link with vnode's name as source */ + VE_LINK = 6, /* Link with vnode's name as source */ VE_RENAME_DEST_DIR = 7, /* Rename with vnode as target dir */ - VE_MOUNTEDOVER = 8, /* File or Filesystem got mounted over vnode */ + VE_MOUNTEDOVER = 8, /* File or Filesystem got mounted over vnode */ VE_TRUNCATE = 9, /* Truncate */ VE_PRE_RENAME_SRC = 10, /* Pre-rename, with vnode as source */ VE_PRE_RENAME_DEST = 11, /* Pre-rename, with vnode as target/dest. */ @@ -1294,9 +1298,9 @@ void vn_recycle(vnode_t *); void vn_free(vnode_t *); int vn_is_readonly(vnode_t *); -int vn_is_opened(vnode_t *, v_mode_t); -int vn_is_mapped(vnode_t *, v_mode_t); -int vn_has_other_opens(vnode_t *, v_mode_t); +int vn_is_opened(vnode_t *, v_mode_t); +int vn_is_mapped(vnode_t *, v_mode_t); +int vn_has_other_opens(vnode_t *, v_mode_t); void vn_open_upgrade(vnode_t *, int); void vn_open_downgrade(vnode_t *, int); @@ -1335,10 +1339,12 @@ int vn_createat(char *pnamep, enum uio_seg seg, struct vattr *vap, int vn_rdwr(enum uio_rw rw, struct vnode *vp, caddr_t base, ssize_t len, offset_t offset, enum uio_seg seg, int ioflag, rlim64_t ulimit, cred_t *cr, ssize_t *residp); +uint_t vn_count(struct vnode *vp); void vn_rele(struct vnode *vp); void vn_rele_async(struct vnode *vp, struct taskq *taskq); void vn_rele_dnlc(struct vnode *vp); void vn_rele_stream(struct vnode *vp); +void vn_phantom_rele(struct vnode *vp); int vn_link(char *from, char *to, enum uio_seg seg); int vn_linkat(vnode_t *fstartvp, char *from, enum symfollow follow, vnode_t *tstartvp, char *to, enum uio_seg seg); @@ -1443,6 +1449,16 @@ extern uint_t pvn_vmodsort_supported; * this->vp->v_path == NULL ? "NULL" : stringof(this->vp->v_path), * this->vp->v_count) * }' + * + * There are some situations where we don't want a hold to make the vnode + * 'busy'. For example, watching a directory via port events or inotify + * should not prevent a filesystem from mounting on a watched directory. + * For those instances, a phantom hold is used via VN_PHANTOM_HOLD(). + * + * A phantom hold works identically to regular hold, except that those holds + * are excluded from the return value of vn_count(). + * + * A phantom hold must be released by VN_PHANTOM_RELE(). */ #define VN_HOLD_LOCKED(vp) { \ ASSERT(mutex_owned(&(vp)->v_lock)); \ @@ -1471,6 +1487,22 @@ extern uint_t pvn_vmodsort_supported; DTRACE_PROBE1(vn__rele, vnode_t *, vp); \ } +#define VN_PHANTOM_HOLD_LOCKED(vp) { \ + VN_HOLD_LOCKED(vp); \ + (vp)->v_phantom_count++; \ + DTRACE_PROBE1(vn__phantom_hold, vnode_t *, vp); \ +} + +#define VN_PHANTOM_HOLD(vp) { \ + mutex_enter(&(vp)->v_lock); \ + VN_PHANTOM_HOLD_LOCKED(vp); \ + mutex_exit(&(vp)->v_lock); \ +} + +#define VN_PHANTOM_RELE(vp) { \ + vn_phantom_rele(vp); \ +} + #define VN_SET_VFS_TYPE_DEV(vp, vfsp, type, dev) { \ (vp)->v_vfsp = (vfsp); \ (vp)->v_type = (type); \ @@ -1481,7 +1513,7 @@ extern uint_t pvn_vmodsort_supported; * Compare two vnodes for equality. In general this macro should be used * in preference to calling VOP_CMP directly. */ -#define VN_CMP(VP1, VP2) ((VP1) == (VP2) ? 1 : \ +#define VN_CMP(VP1, VP2) ((VP1) == (VP2) ? 1 : \ ((VP1) && (VP2) && (vn_getops(VP1) == vn_getops(VP2)) ? \ VOP_CMP(VP1, VP2, NULL) : 0)) diff --git a/usr/src/uts/common/sys/watchpoint.h b/usr/src/uts/common/sys/watchpoint.h index 36eb3addc2..7483a1fc35 100644 --- a/usr/src/uts/common/sys/watchpoint.h +++ b/usr/src/uts/common/sys/watchpoint.h @@ -38,7 +38,7 @@ extern "C" { /* * Definitions for the VM implementation of watchpoints. - * See proc(4) and <sys/procfs.h> for definitions of the user interface. + * See proc(5) and <sys/procfs.h> for definitions of the user interface. */ /* diff --git a/usr/src/uts/common/sys/zcons.h b/usr/src/uts/common/sys/zcons.h index 218d1a67ad..84abdc12fb 100644 --- a/usr/src/uts/common/sys/zcons.h +++ b/usr/src/uts/common/sys/zcons.h @@ -33,19 +33,19 @@ extern "C" { #endif /* - * Minor node name of the global zone side (often called the "master" side) + * Minor node name of the global zone side (often called the "manager" side) * of the zcons driver. */ -#define ZCONS_MASTER_NAME "masterconsole" +#define ZCONS_MANAGER_NAME "globalconsole" /* - * Minor node name of the non-global zone side (often called the "slave" - * side) of the zcons driver. We name it "zoneconsole" since that nameo + * Minor node name of the non-global zone side (often called the "subsidiary" + * side) of the zcons driver. We name it "zoneconsole" since that name * will show up in 'ps' output, and will make some sense to the global zone * user. Inside the zone, it will simply show up as "console" due to the * links we create. */ -#define ZCONS_SLAVE_NAME "zoneconsole" +#define ZCONS_SUBSIDIARY_NAME "zoneconsole" /* * ZC_IOC forms the base for all zcons ioctls. @@ -53,18 +53,18 @@ extern "C" { #define ZC_IOC (('Z' << 24) | ('o' << 16) | ('n' << 8)) /* - * These ioctls instruct the master side of the console to hold or release - * a reference to the slave side's vnode. They are meant to be issued by + * These ioctls instruct the manager side of the console to hold or release + * a reference to the subsidiary side's vnode. They are meant to be issued by * zoneadmd after the console device node is created and before it is destroyed - * so that the slave's STREAMS anchor, ptem, is preserved when ttymon starts - * popping STREAMS modules from within the associated zone. This guarantees - * that the zone slave console will always have terminal semantics while the - * zone is running. + * so that the subsidiary's STREAMS anchor, ptem, is preserved when ttymon + * starts popping STREAMS modules from within the associated zone. This + * guarantees that the zone subsidiary console will always have terminal + * semantics while the zone is running. * * A more detailed description can be found in uts/common/io/zcons.c. */ -#define ZC_HOLDSLAVE (ZC_IOC | 0) /* get and save slave side reference */ -#define ZC_RELEASESLAVE (ZC_IOC | 1) /* release slave side reference */ +#define ZC_HOLDSUBSID (ZC_IOC | 0) +#define ZC_RELEASESUBSID (ZC_IOC | 1) #ifdef __cplusplus } diff --git a/usr/src/uts/common/sys/zone.h b/usr/src/uts/common/sys/zone.h index f6bfe6626d..afef75013f 100644 --- a/usr/src/uts/common/sys/zone.h +++ b/usr/src/uts/common/sys/zone.h @@ -111,7 +111,13 @@ extern "C" { #define ZONE_CHECK_DATALINK 12 #define ZONE_LIST_DATALINK 13 -/* zone attributes */ +/* + * zone attributes + * + * Note that values up to ZONE_ATTR_HOSTID are baked into things like Solaris + * 10 which can be run under the s10 brand; don't renumber or change them. Ones + * which are no longer used are commented out. + */ #define ZONE_ATTR_ROOT 1 #define ZONE_ATTR_NAME 2 #define ZONE_ATTR_STATUS 3 @@ -123,19 +129,24 @@ extern "C" { #define ZONE_ATTR_INITNAME 9 #define ZONE_ATTR_BOOTARGS 10 #define ZONE_ATTR_BRAND 11 -#define ZONE_ATTR_SCHED_CLASS 12 -#define ZONE_ATTR_FLAGS 13 -#define ZONE_ATTR_HOSTID 14 -#define ZONE_ATTR_FS_ALLOWED 15 -#define ZONE_ATTR_NETWORK 16 -#define ZONE_ATTR_DID 17 -#define ZONE_ATTR_INITNORESTART 18 -#define ZONE_ATTR_APP_SVC_CT 19 -#define ZONE_ATTR_SCHED_FIXEDHI 20 +/* #define ZONE_ATTR_PHYS_MCAP 12 */ +#define ZONE_ATTR_SCHED_CLASS 13 +#define ZONE_ATTR_FLAGS 14 +#define ZONE_ATTR_HOSTID 15 +#define ZONE_ATTR_FS_ALLOWED 16 +#define ZONE_ATTR_NETWORK 17 + +/* illumos extensions */ +#define ZONE_ATTR_INITNORESTART 20 #define ZONE_ATTR_SECFLAGS 21 #define ZONE_ATTR_INITRESTART0 22 #define ZONE_ATTR_INITREBOOT 23 +/* OmniOS/SmartOS extensions */ +#define ZONE_ATTR_DID 30 +#define ZONE_ATTR_APP_SVC_CT 31 +#define ZONE_ATTR_SCHED_FIXEDHI 32 + /* Start of the brand-specific attribute namespace */ #define ZONE_ATTR_BRAND_ATTRS 32768 @@ -249,7 +260,7 @@ typedef struct { /* * zone_status values * - * You must modify zone_status_names in mdb(1M)'s genunix module + * You must modify zone_status_names in mdb(1)'s genunix module * (genunix/zone.c) when you modify this enum. */ typedef enum { @@ -310,7 +321,7 @@ typedef struct zone_cmd_rval { #define GLOBAL_ZONENAME "global" /* - * Extended Regular expression (see regex(5)) which matches all valid zone + * Extended Regular expression (see regex(7)) which matches all valid zone * names. */ #define ZONENAME_REGEXP "[a-zA-Z0-9][-_.a-zA-Z0-9]{0,62}" |
