sync with OpenBSD -current

This commit is contained in:
purplerain 2024-05-29 01:16:43 +00:00
parent 3af7aba2fd
commit 222e583e28
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
80 changed files with 1944 additions and 657 deletions

View file

@ -486,7 +486,6 @@
./usr/include/dev/mii/tlphyvar.h ./usr/include/dev/mii/tlphyvar.h
./usr/include/dev/mii/tqphyreg.h ./usr/include/dev/mii/tqphyreg.h
./usr/include/dev/mii/urlphyreg.h ./usr/include/dev/mii/urlphyreg.h
./usr/include/dev/mii/xmphyreg.h
./usr/include/dev/mulaw.h ./usr/include/dev/mulaw.h
./usr/include/dev/ofw ./usr/include/dev/ofw
./usr/include/dev/ofw/fdt.h ./usr/include/dev/ofw/fdt.h

View file

@ -1,4 +1,4 @@
.\" $OpenBSD: HMAC.3,v 1.20 2022/01/25 17:55:39 tb Exp $ .\" $OpenBSD: HMAC.3,v 1.21 2024/05/26 09:54:16 tb Exp $
.\" full merge up to: OpenSSL crypto/hmac a528d4f0 Oct 27 13:40:11 2015 -0400 .\" full merge up to: OpenSSL crypto/hmac a528d4f0 Oct 27 13:40:11 2015 -0400
.\" selective merge up to: OpenSSL man3/HMAC b3696a55 Sep 2 09:35:50 2017 -0400 .\" selective merge up to: OpenSSL man3/HMAC b3696a55 Sep 2 09:35:50 2017 -0400
.\" .\"
@ -52,7 +52,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE. .\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\" .\"
.Dd $Mdocdate: January 25 2022 $ .Dd $Mdocdate: May 26 2024 $
.Dt HMAC 3 .Dt HMAC 3
.Os .Os
.Sh NAME .Sh NAME
@ -160,11 +160,6 @@ which must have space for the output of the hash function, which is no
more than more than
.Dv EVP_MAX_MD_SIZE .Dv EVP_MAX_MD_SIZE
bytes. bytes.
If
.Fa md
is
.Dv NULL ,
the digest is placed in a static array, which is not thread safe.
The size of the output is placed in The size of the output is placed in
.Fa md_len , .Fa md_len ,
unless it is unless it is
@ -329,3 +324,11 @@ and
.Fn HMAC_CTX_get_md .Fn HMAC_CTX_get_md
first appeared in OpenSSL 1.1.0 and have been available since first appeared in OpenSSL 1.1.0 and have been available since
.Ox 6.3 . .Ox 6.3 .
.Sh CAVEATS
Other implementations allow
.Fa md
in
.Fn HMAC
to be
.Dv NULL
and return a static array, which is not thread safe.

View file

@ -1,4 +1,4 @@
.\" $OpenBSD: MD5.3,v 1.8 2018/03/27 17:35:50 schwarze Exp $ .\" $OpenBSD: MD5.3,v 1.9 2024/05/26 09:54:16 tb Exp $
.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
.\" .\"
.\" This file was written by Ulf Moeller <ulf@openssl.org> and .\" This file was written by Ulf Moeller <ulf@openssl.org> and
@ -49,7 +49,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE. .\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\" .\"
.Dd $Mdocdate: March 27 2018 $ .Dd $Mdocdate: May 26 2024 $
.Dt MD5 3 .Dt MD5 3
.Os .Os
.Sh NAME .Sh NAME
@ -123,11 +123,6 @@ and place it in
which must have space for which must have space for
.Dv MD4_DIGEST_LENGTH No == Dv MD5_DIGEST_LENGTH No == 16 .Dv MD4_DIGEST_LENGTH No == Dv MD5_DIGEST_LENGTH No == 16
bytes of output. bytes of output.
If
.Fa md
is
.Dv NULL ,
the digest is placed in a static array.
.Pp .Pp
The following functions may be used if the message is not completely The following functions may be used if the message is not completely
stored in memory: stored in memory:
@ -194,3 +189,13 @@ and
.Fn MD4_Final .Fn MD4_Final
first appeared in OpenSSL 0.9.6 and have been available since first appeared in OpenSSL 0.9.6 and have been available since
.Ox 2.9 . .Ox 2.9 .
.Sh CAVEATS
Other implementations allow
.Fa md
in
.Fn MD4
and
.Fn MD5
to be
.Dv NULL
and return a static array, which is not thread safe.

View file

@ -1,4 +1,4 @@
.\" $OpenBSD: RIPEMD160.3,v 1.7 2019/08/25 15:17:19 schwarze Exp $ .\" $OpenBSD: RIPEMD160.3,v 1.8 2024/05/26 09:54:16 tb Exp $
.\" full merge up to: OpenSSL 72a7a702 Feb 26 14:05:09 2019 +0000 .\" full merge up to: OpenSSL 72a7a702 Feb 26 14:05:09 2019 +0000
.\" .\"
.\" This file was written by Ulf Moeller <ulf@openssl.org>. .\" This file was written by Ulf Moeller <ulf@openssl.org>.
@ -48,7 +48,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE. .\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\" .\"
.Dd $Mdocdate: August 25 2019 $ .Dd $Mdocdate: May 26 2024 $
.Dt RIPEMD160 3 .Dt RIPEMD160 3
.Os .Os
.Sh NAME .Sh NAME
@ -93,11 +93,6 @@ and places it in
which must have space for which must have space for
.Dv RIPEMD160_DIGEST_LENGTH .Dv RIPEMD160_DIGEST_LENGTH
== 20 bytes of output. == 20 bytes of output.
If
.Fa md
is
.Dv NULL ,
the digest is placed in a static array.
.Pp .Pp
The following functions may be used if the message is not completely The following functions may be used if the message is not completely
stored in memory: stored in memory:
@ -149,3 +144,11 @@ and
.Fn RIPEMD160_Final .Fn RIPEMD160_Final
first appeared in SSLeay 0.9.0 and have been available since first appeared in SSLeay 0.9.0 and have been available since
.Ox 2.4 . .Ox 2.4 .
.Sh CAVEATS
Other implementations allow
.Fa md
in
.Fn RIPEMD160
to be
.Dv NULL
and return a static array, which is not thread safe.

View file

@ -1,4 +1,4 @@
.\" $OpenBSD: SHA1.3,v 1.7 2018/03/27 17:35:50 schwarze Exp $ .\" $OpenBSD: SHA1.3,v 1.8 2024/05/26 09:54:16 tb Exp $
.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
.\" .\"
.\" This file was written by Ulf Moeller <ulf@openssl.org> and .\" This file was written by Ulf Moeller <ulf@openssl.org> and
@ -49,7 +49,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE. .\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\" .\"
.Dd $Mdocdate: March 27 2018 $ .Dd $Mdocdate: May 26 2024 $
.Dt SHA1 3 .Dt SHA1 3
.Os .Os
.Sh NAME .Sh NAME
@ -195,11 +195,6 @@ and places it in
which must have space for which must have space for
.Dv SHA_DIGEST_LENGTH .Dv SHA_DIGEST_LENGTH
== 20 bytes of output. == 20 bytes of output.
If
.Fa md
is
.Dv NULL ,
the digest is placed in a static array, which is not thread safe.
.Pp .Pp
The following functions may be used if the message is not completely The following functions may be used if the message is not completely
stored in memory: stored in memory:
@ -274,3 +269,16 @@ first appeared in SSLeay 0.5.1 and have been available since
The other functions first appeared in OpenSSL 0.9.8 The other functions first appeared in OpenSSL 0.9.8
and have been available since and have been available since
.Ox 4.5 . .Ox 4.5 .
.Sh CAVEATS
Other implementations allow
.Fa md
in
.Fn SHA1 ,
.Fn SHA224 ,
.Fn SHA256 ,
.Fn SHA384 ,
and
.Fn SHA512
to be
.Dv NULL
and return a static array, which is not thread safe.

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ossl_typ.h,v 1.30 2023/08/11 05:10:35 tb Exp $ */ /* $OpenBSD: ossl_typ.h,v 1.31 2024/05/27 09:12:32 jsg Exp $ */
/* ==================================================================== /* ====================================================================
* Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
* *
@ -94,9 +94,6 @@ typedef struct bn_gencb_st BN_GENCB;
typedef struct bio_st BIO; typedef struct bio_st BIO;
typedef struct buf_mem_st BUF_MEM; typedef struct buf_mem_st BUF_MEM;
typedef struct comp_ctx_st COMP_CTX;
typedef struct comp_method_st COMP_METHOD;
typedef struct evp_cipher_st EVP_CIPHER; typedef struct evp_cipher_st EVP_CIPHER;
typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX; typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX;
typedef struct evp_md_st EVP_MD; typedef struct evp_md_st EVP_MD;
@ -130,7 +127,6 @@ typedef struct rand_meth_st RAND_METHOD;
typedef struct x509_st X509; typedef struct x509_st X509;
typedef struct X509_algor_st X509_ALGOR; typedef struct X509_algor_st X509_ALGOR;
typedef struct X509_crl_st X509_CRL; typedef struct X509_crl_st X509_CRL;
typedef struct x509_crl_method_st X509_CRL_METHOD;
typedef struct x509_revoked_st X509_REVOKED; typedef struct x509_revoked_st X509_REVOKED;
typedef struct X509_name_st X509_NAME; typedef struct X509_name_st X509_NAME;
typedef struct X509_pubkey_st X509_PUBKEY; typedef struct X509_pubkey_st X509_PUBKEY;
@ -147,9 +143,6 @@ typedef struct pkcs8_priv_key_info_st PKCS8_PRIV_KEY_INFO;
typedef struct v3_ext_ctx X509V3_CTX; typedef struct v3_ext_ctx X509V3_CTX;
typedef struct conf_st CONF; typedef struct conf_st CONF;
typedef struct store_st STORE;
typedef struct store_method_st STORE_METHOD;
typedef struct ui_st UI; typedef struct ui_st UI;
typedef struct ui_method_st UI_METHOD; typedef struct ui_method_st UI_METHOD;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: x509_lib.c,v 1.20 2024/05/11 18:59:39 tb Exp $ */ /* $OpenBSD: x509_lib.c,v 1.21 2024/05/28 15:40:38 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 1999. * project 1999.
*/ */
@ -244,85 +244,117 @@ X509V3_get_d2i(const STACK_OF(X509_EXTENSION) *x, int nid, int *crit, int *idx)
} }
LCRYPTO_ALIAS(X509V3_get_d2i); LCRYPTO_ALIAS(X509V3_get_d2i);
/* This function is a general extension append, replace and delete utility.
* The precise operation is governed by the 'flags' value. The 'crit' and
* 'value' arguments (if relevant) are the extensions internal structure.
*/
int int
X509V3_add1_i2d(STACK_OF(X509_EXTENSION) **x, int nid, void *value, X509V3_add1_i2d(STACK_OF(X509_EXTENSION) **x, int nid, void *value,
int crit, unsigned long flags) int crit, unsigned long flags)
{ {
int extidx = -1; STACK_OF(X509_EXTENSION) *exts = *x;
int errcode; X509_EXTENSION *ext = NULL;
X509_EXTENSION *ext, *extmp; X509_EXTENSION *existing;
unsigned long ext_op = flags & X509V3_ADD_OP_MASK; int extidx;
int errcode = 0;
int ret = 0;
/* If appending we don't care if it exists, otherwise /* See if the extension already exists. */
* look for existing extension. extidx = X509v3_get_ext_by_NID(*x, nid, -1);
*/
if (ext_op != X509V3_ADD_APPEND)
extidx = X509v3_get_ext_by_NID(*x, nid, -1);
/* See if extension exists */ switch (flags & X509V3_ADD_OP_MASK) {
if (extidx >= 0) { case X509V3_ADD_DEFAULT:
/* If keep existing, nothing to do */ /* If the extension exists, adding another one is an error. */
if (ext_op == X509V3_ADD_KEEP_EXISTING) if (extidx >= 0) {
return 1;
/* If default then its an error */
if (ext_op == X509V3_ADD_DEFAULT) {
errcode = X509V3_R_EXTENSION_EXISTS; errcode = X509V3_R_EXTENSION_EXISTS;
goto err; goto err;
} }
/* If delete, just delete it */ break;
if (ext_op == X509V3_ADD_DELETE) { case X509V3_ADD_APPEND:
if ((extmp = sk_X509_EXTENSION_delete(*x, extidx)) == NULL) /*
return -1; * XXX - Total misfeature. If the extension exists, appending
X509_EXTENSION_free(extmp); * another one will invalidate the certificate. Unfortunately
return 1; * things use this, in particular Viktor's DANE code.
}
} else {
/* If replace existing or delete, error since
* extension must exist
*/ */
if ((ext_op == X509V3_ADD_REPLACE_EXISTING) || /* Pretend the extension didn't exist and append the new one. */
(ext_op == X509V3_ADD_DELETE)) { extidx = -1;
break;
case X509V3_ADD_REPLACE:
/* Replace existing extension, otherwise append the new one. */
break;
case X509V3_ADD_REPLACE_EXISTING:
/* Can't replace a non-existent extension. */
if (extidx < 0) {
errcode = X509V3_R_EXTENSION_NOT_FOUND; errcode = X509V3_R_EXTENSION_NOT_FOUND;
goto err; goto err;
} }
break;
case X509V3_ADD_KEEP_EXISTING:
/* If the extension exists, there's nothing to do. */
if (extidx >= 0)
goto done;
break;
case X509V3_ADD_DELETE:
/* Can't delete a non-existent extension. */
if (extidx < 0) {
errcode = X509V3_R_EXTENSION_NOT_FOUND;
goto err;
}
if ((existing = sk_X509_EXTENSION_delete(*x, extidx)) == NULL) {
ret = -1;
goto err;
}
X509_EXTENSION_free(existing);
existing = NULL;
goto done;
default:
errcode = X509V3_R_UNSUPPORTED_OPTION; /* XXX */
ret = -1;
goto err;
} }
/* If we get this far then we have to create an extension: if ((ext = X509V3_EXT_i2d(nid, crit, value)) == NULL) {
* could have some flags for alternative encoding schemes...
*/
ext = X509V3_EXT_i2d(nid, crit, value);
if (!ext) {
X509V3error(X509V3_R_ERROR_CREATING_EXTENSION); X509V3error(X509V3_R_ERROR_CREATING_EXTENSION);
return 0; goto err;
} }
/* If extension exists replace it.. */ /* From here, errors are fatal. */
ret = -1;
/* If extension exists, replace it. */
if (extidx >= 0) { if (extidx >= 0) {
extmp = sk_X509_EXTENSION_value(*x, extidx); existing = sk_X509_EXTENSION_value(*x, extidx);
X509_EXTENSION_free(extmp); X509_EXTENSION_free(existing);
if (!sk_X509_EXTENSION_set(*x, extidx, ext)) existing = NULL;
return -1; if (sk_X509_EXTENSION_set(*x, extidx, ext) == NULL) {
return 1; /*
* XXX - Can't happen. If it did happen, |existing| is
* now a freed pointer. Nothing we can do here.
*/
goto err;
}
goto done;
} }
if (!*x && !(*x = sk_X509_EXTENSION_new_null())) if (exts == NULL)
return -1; exts = sk_X509_EXTENSION_new_null();
if (!sk_X509_EXTENSION_push(*x, ext)) if (exts == NULL)
return -1; goto err;
if (!sk_X509_EXTENSION_push(exts, ext))
goto err;
ext = NULL;
*x = exts;
done:
return 1; return 1;
err: err:
if (!(flags & X509V3_ADD_SILENT)) if ((flags & X509V3_ADD_SILENT) == 0 && errcode != 0)
X509V3error(errcode); X509V3error(errcode);
return 0;
if (exts != *x)
sk_X509_EXTENSION_pop_free(exts, X509_EXTENSION_free);
X509_EXTENSION_free(ext);
return ret;
} }
LCRYPTO_ALIAS(X509V3_add1_i2d); LCRYPTO_ALIAS(X509V3_add1_i2d);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ssl.h,v 1.236 2024/03/02 11:48:55 tb Exp $ */ /* $OpenBSD: ssl.h,v 1.237 2024/05/27 09:12:31 jsg Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved. * All rights reserved.
* *
@ -510,11 +510,6 @@ int SSL_CTX_set_num_tickets(SSL_CTX *ctx, size_t num_tickets);
size_t SSL_CTX_get_num_tickets(const SSL_CTX *ctx); size_t SSL_CTX_get_num_tickets(const SSL_CTX *ctx);
STACK_OF(X509) *SSL_get0_verified_chain(const SSL *s); STACK_OF(X509) *SSL_get0_verified_chain(const SSL *s);
#ifndef LIBRESSL_INTERNAL
struct ssl_aead_ctx_st;
typedef struct ssl_aead_ctx_st SSL_AEAD_CTX;
#endif
#define SSL_MAX_CERT_LIST_DEFAULT 1024*100 /* 100k max cert list :-) */ #define SSL_MAX_CERT_LIST_DEFAULT 1024*100 /* 100k max cert list :-) */
#define SSL_SESSION_CACHE_MAX_SIZE_DEFAULT (1024*20) #define SSL_SESSION_CACHE_MAX_SIZE_DEFAULT (1024*20)

View file

@ -1,4 +1,4 @@
.\" $OpenBSD: compress.3,v 1.27 2024/02/07 20:51:38 tb Exp $ .\" $OpenBSD: compress.3,v 1.28 2024/05/28 13:42:06 tb Exp $
.\" .\"
.\" Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler .\" Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
.\" .\"
@ -21,9 +21,7 @@
.\" Converted to mdoc format for the OpenBSD project .\" Converted to mdoc format for the OpenBSD project
.\" by Jason McIntyre <jmc@openbsd.org> .\" by Jason McIntyre <jmc@openbsd.org>
.\" .\"
.\" This page corresponds to zlib version 1.2.3 .Dd $Mdocdate: May 28 2024 $
.\"
.Dd $Mdocdate: February 7 2024 $
.Dt COMPRESS 3 .Dt COMPRESS 3
.Os .Os
.Sh NAME .Sh NAME
@ -256,10 +254,6 @@ Checksum functions
.Fn crc32_combine_gen "z_off_t len2" .Fn crc32_combine_gen "z_off_t len2"
.Fn crc32_combine_op "uLong crc1" "uLong crc2" "uLong op" .Fn crc32_combine_op "uLong crc1" "uLong crc2" "uLong op"
.Sh DESCRIPTION .Sh DESCRIPTION
This manual page describes the
.Nm zlib
general purpose compression library, version 1.2.11.
.Pp
The The
.Nm zlib .Nm zlib
compression library provides in-memory compression and decompression functions, compression library provides in-memory compression and decompression functions,

View file

@ -1,4 +1,4 @@
/* $OpenBSD: asn1time.c,v 1.28 2024/05/25 12:47:25 tb Exp $ */ /* $OpenBSD: asn1time.c,v 1.29 2024/05/25 18:59:03 tb Exp $ */
/* /*
* Copyright (c) 2015 Joel Sing <jsing@openbsd.org> * Copyright (c) 2015 Joel Sing <jsing@openbsd.org>
* Copyright (c) 2024 Google Inc. * Copyright (c) 2024 Google Inc.
@ -121,6 +121,18 @@ static const struct asn1_time_test asn1_gentime_tests[] = {
0x5a, 0x5a,
}, },
}, },
{
/* 1 second after the 32-bit epoch wraps. */
.str = "20380119031408Z",
.data = "20380119031408Z",
.time = 2147483648LL,
.der = {
0x18, 0x0f, 0x32, 0x30, 0x33, 0x38, 0x30, 0x31,
0x31, 0x39, 0x30, 0x33, 0x31, 0x34, 0x30, 0x38,
0x5a,
},
},
}; };
static const struct asn1_time_test asn1_utctime_tests[] = { static const struct asn1_time_test asn1_utctime_tests[] = {
@ -280,6 +292,7 @@ asn1_gentime_test(int test_no, const struct asn1_time_test *att)
const unsigned char *der; const unsigned char *der;
unsigned char *p = NULL; unsigned char *p = NULL;
ASN1_GENERALIZEDTIME *gt = NULL; ASN1_GENERALIZEDTIME *gt = NULL;
time_t t;
int failure = 1; int failure = 1;
int len; int len;
struct tm tm; struct tm tm;
@ -307,11 +320,18 @@ asn1_gentime_test(int test_no, const struct asn1_time_test *att)
goto done; goto done;
} }
if (timegm(&tm) != att->time) { if (!OPENSSL_timegm(&tm, &t)) {
/* things with crappy time_t should die in fire */ /* things with crappy time_t should die in fire */
int64_t a = timegm(&tm); fprintf(stderr, "FAIL: test %d - OPENSSL_timegm failed\n",
int64_t b = att->time; test_no);
fprintf(stderr, "FAIL: test %d - times don't match, expected %lld got %lld\n", }
if (t != att->time) {
/* things with crappy time_t should die in fire */
int64_t a = t, b = att->time;
fprintf(stderr, "FAIL: test %d - times don't match, "
"expected %lld got %lld\n",
test_no, (long long)b, (long long)a); test_no, (long long)b, (long long)a);
goto done; goto done;
} }

View file

@ -1,7 +1,7 @@
# $OpenBSD: Makefile,v 1.21 2023/04/30 05:02:59 tb Exp $ # $OpenBSD: Makefile,v 1.22 2024/05/28 15:33:35 tb Exp $
PROGS = constraints verify x509attribute x509name x509req_ext callback PROGS = constraints verify x509attribute x509name x509req_ext callback
PROGS += expirecallback callbackfailures x509_asn1 PROGS += expirecallback callbackfailures x509_asn1 x509_extensions_test
LDADD = -lcrypto LDADD = -lcrypto
DPADD = ${LIBCRYPTO} DPADD = ${LIBCRYPTO}

View file

@ -0,0 +1,655 @@
/* $OpenBSD: x509_extensions_test.c,v 1.2 2024/05/28 15:42:09 tb Exp $ */
/*
* Copyright (c) 2024 Theo Buehler <tb@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <err.h>
#include <stdio.h>
#include <openssl/asn1.h>
#include <openssl/err.h>
#include <openssl/x509.h>
#include <openssl/x509v3.h>
#define ASN1_BOOLEAN_TRUE 0xff
#define ASN1_BOOLEAN_FALSE 0x00
static BASIC_CONSTRAINTS *
create_basic_constraints(int ca)
{
BASIC_CONSTRAINTS *bc;
if ((bc = BASIC_CONSTRAINTS_new()) == NULL)
errx(1, "BASIC_CONSTRAINTS_new");
bc->ca = ca ? ASN1_BOOLEAN_TRUE : ASN1_BOOLEAN_FALSE;
return bc;
}
static int
test_x509v3_add1_i2d_empty_stack(STACK_OF(X509_EXTENSION) **extensions)
{
unsigned long error;
int op, got;
int nid = NID_basic_constraints;
int failed = 1;
if (X509v3_get_ext_count(*extensions) != 0) {
fprintf(stderr, "%s: FAIL: need empty stack\n", __func__);
goto err;
}
ERR_clear_error();
op = X509V3_ADD_REPLACE_EXISTING;
if ((got = X509V3_add1_i2d(extensions, nid, NULL, 0, op)) != 0) {
fprintf(stderr, "%s: FAIL: X509V3_ADD_REPLACE_EXISTING "
"want %d, got %d.\n", __func__, 0, got);
goto err;
}
error = ERR_get_error();
if (ERR_GET_REASON(error) != X509V3_R_EXTENSION_NOT_FOUND) {
fprintf(stderr, "%s: FAIL: X509V3_ADD_REPLACE_EXISTING "
"pushed %d for empty stack, want %d.\n", __func__,
ERR_GET_REASON(error), X509V3_R_EXTENSION_NOT_FOUND);
goto err;
}
if ((error = ERR_get_error()) != 0) {
fprintf(stderr, "%s: FAIL: X509V3_ADD_REPLACE_EXISTING "
"expected exactly one error.\n", __func__);
goto err;
}
op = X509V3_ADD_REPLACE_EXISTING | X509V3_ADD_SILENT;
if ((got = X509V3_add1_i2d(extensions, nid, NULL, 0, op)) != 0) {
fprintf(stderr, "%s: FAIL: silent X509V3_ADD_REPLACE_EXISTING "
"want %d, got %d.\n", __func__, 0, got);
goto err;
}
if ((error = ERR_get_error()) != 0) {
fprintf(stderr, "%s: FAIL: silent X509V3_ADD_REPLACE_EXISTING "
"added error %d, want %d.\n", __func__,
ERR_GET_REASON(error), 0);
goto err;
}
op = X509V3_ADD_DELETE;
if ((got = X509V3_add1_i2d(extensions, nid, NULL, 0, op)) != 0) {
fprintf(stderr, "%s: FAIL: X509V3_ADD_DELETE "
"want %d, got %d.\n", __func__, 0, got);
goto err;
}
error = ERR_get_error();
if (ERR_GET_REASON(error) != X509V3_R_EXTENSION_NOT_FOUND) {
fprintf(stderr, "%s: FAIL: X509V3_ADD_DELETE "
"pushed %d for empty stack, want %d.\n", __func__,
ERR_GET_REASON(error), X509V3_R_EXTENSION_NOT_FOUND);
goto err;
}
if ((error = ERR_get_error()) != 0) {
fprintf(stderr, "%s: FAIL: X509V3_ADD_DELETE "
"expected exactly one error.\n", __func__);
goto err;
}
failed = 0;
err:
return failed;
}
static int
test_x509v3_add1_i2d_single_nid(STACK_OF(X509_EXTENSION) **extensions)
{
BASIC_CONSTRAINTS *bc = NULL;
unsigned long error;
int crit, got, nid, op;
int failed = 1;
if (X509v3_get_ext_count(*extensions) != 0) {
fprintf(stderr, "%s: FAIL: need an empty stack.\n", __func__);
goto err;
}
/*
* Add basic ca constraints.
*/
nid = NID_basic_constraints;
bc = create_basic_constraints(1);
op = X509V3_ADD_DEFAULT;
if ((got = X509V3_add1_i2d(extensions, nid, bc, 1, op)) != 1) {
fprintf(stderr, "%s: FAIL: X509V3_ADD_DEFAULT failed to add "
"basic constraints to empty stack: want %d, got %d.\n",
__func__, 1, got);
goto err;
}
BASIC_CONSTRAINTS_free(bc);
bc = NULL;
if ((got = X509v3_get_ext_count(*extensions)) != 1) {
fprintf(stderr, "%s: FAIL: expected 1 extension, have %d.\n",
__func__, got);
goto err;
}
/*
* Can't delete or replace non-existent extension.
*/
nid = NID_policy_constraints;
op = X509V3_ADD_DELETE;
if ((got = X509V3_add1_i2d(extensions, nid, NULL, 0, op)) != 0) {
fprintf(stderr, "%s: FAIL: X509V3_ADD_DELETE non-existent "
"want %d, got %d,\n", __func__, 0, got);
goto err;
}
nid = NID_policy_constraints;
op = X509V3_ADD_REPLACE_EXISTING;
if ((got = X509V3_add1_i2d(extensions, nid, NULL, 0, op)) != 0) {
fprintf(stderr, "%s: FAIL: X509V3_ADD_REPLACE_EXISTING non-existent "
"want %d, got %d.\n", __func__, 0, got);
goto err;
}
/*
* X509V3_ADD_DEFAULT refuses to add second basic constraints extension.
*/
ERR_clear_error();
nid = NID_basic_constraints;
bc = create_basic_constraints(0);
op = X509V3_ADD_DEFAULT;
if ((got = X509V3_add1_i2d(extensions, nid, bc, 1, op)) != 0) {
fprintf(stderr, "%s: FAIL: X509V3_ADD_DEFAULT second constraints "
"want %d, got %d.\n", __func__, 0, got);
goto err;
}
BASIC_CONSTRAINTS_free(bc);
bc = NULL;
error = ERR_get_error();
if (ERR_GET_REASON(error) != X509V3_R_EXTENSION_EXISTS) {
fprintf(stderr, "%s: FAIL: X509V3_ADD_DEFAULT second constraints "
" pushed %d, want %d.\n", __func__,
ERR_GET_REASON(error), X509V3_R_EXTENSION_EXISTS);
goto err;
}
if ((got = X509v3_get_ext_count(*extensions)) != 1) {
fprintf(stderr, "%s: FAIL: X509V3_ADD_DEFAULT second contraints "
"expected 1 extension, have %d.\n", __func__, got);
goto err;
}
/*
* We can replace existing basic constraints using X509V3_ADD_REPLACE.
*/
nid = NID_basic_constraints;
bc = create_basic_constraints(0);
op = X509V3_ADD_REPLACE;
if ((got = X509V3_add1_i2d(extensions, nid, bc, 1, op)) != 1) {
fprintf(stderr, "%s: FAIL: X509V3_ADD_REPLACE "
"want %d, got %d.\n", __func__, 1, got);
goto err;
}
BASIC_CONSTRAINTS_free(bc);
bc = NULL;
if ((got = X509v3_get_ext_count(*extensions)) != 1) {
fprintf(stderr, "%s: FAIL: X509V3_ADD_REPLACE "
"expected 1 extension, have %d.\n", __func__, got);
goto err;
}
/* Check that the extension was actually replaced. */
nid = NID_basic_constraints;
if ((bc = X509V3_get_d2i(*extensions, nid, &crit, NULL)) == NULL) {
if (crit != -1)
errx(1, "X509V3_get_d2i");
fprintf(stderr, "%s: FAIL: X509V3_ADD_REPLACE "
"expected basic constraints\n", __func__);
goto err;
}
if (bc->ca != ASN1_BOOLEAN_FALSE) {
fprintf(stderr, "%s: FAIL: X509V3_ADD_REPLACE "
"expected cA = false in basic constraints\n", __func__);
goto err;
}
BASIC_CONSTRAINTS_free(bc);
bc = NULL;
/*
* X509V3_ADD_KEEP_EXISTING existing does what it is supposed to do
* if basic constraints are already present.
*/
nid = NID_basic_constraints;
bc = create_basic_constraints(1);
op = X509V3_ADD_KEEP_EXISTING;
if ((got = X509V3_add1_i2d(extensions, nid, bc, 1, op)) != 1) {
fprintf(stderr, "%s: FAIL: X509V3_ADD_KEEP_EXISTING "
"want %d, got %d.\n", __func__, 1, got);
goto err;
}
BASIC_CONSTRAINTS_free(bc);
bc = NULL;
/*
* Check we still have non-ca basic constraints.
*/
nid = NID_basic_constraints;
if ((bc = X509V3_get_d2i(*extensions, nid, &crit, NULL)) == NULL) {
if (crit != -1)
errx(1, "X509V3_get_d2i");
fprintf(stderr, "%s: FAIL: X509V3_ADD_KEEP_EXISTING "
"expected basic constraints\n", __func__);
goto err;
}
if (bc->ca != ASN1_BOOLEAN_FALSE) {
fprintf(stderr, "%s: FAIL: X509V3_ADD_KEEP_EXISTING "
"expected non-ca basic constraints\n", __func__);
goto err;
}
BASIC_CONSTRAINTS_free(bc);
bc = NULL;
/*
* X509V3_ADD_REPLACE_EXISTING also works.
*/
nid = NID_basic_constraints;
bc = create_basic_constraints(1);
op = X509V3_ADD_REPLACE_EXISTING;
if ((got = X509V3_add1_i2d(extensions, nid, bc, 1, op)) != 1) {
fprintf(stderr, "%s: FAIL: X509V3_ADD_REPLACE_EXISTING "
"want %d, got %d.\n", __func__, 1, got);
goto err;
}
BASIC_CONSTRAINTS_free(bc);
bc = NULL;
/*
* Check we again have ca basic constraints.
*/
nid = NID_basic_constraints;
if ((bc = X509V3_get_d2i(*extensions, nid, &crit, NULL)) == NULL) {
if (crit != -1)
errx(1, "X509V3_get_d2i");
fprintf(stderr, "%s: FAIL: X509V3_ADD_REPLACE_EXISTING "
"expected basic constraints\n", __func__);
goto err;
}
if (bc->ca != ASN1_BOOLEAN_TRUE) {
fprintf(stderr, "%s: FAIL: X509V3_ADD_REPLACE_EXISTING "
"expected ca basic constraints\n", __func__);
goto err;
}
BASIC_CONSTRAINTS_free(bc);
bc = NULL;
/*
* And X509V3_ADD_DELETE now works.
*/
nid = NID_basic_constraints;
op = X509V3_ADD_DELETE;
if ((got = X509V3_add1_i2d(extensions, nid, NULL, 0, op)) != 1) {
fprintf(stderr, "%s: FAIL: X509V3_ADD_DELETE "
"want %d, got %d.\n", __func__, 0, got);
goto err;
}
if ((got = X509v3_get_ext_count(*extensions)) != 0) {
fprintf(stderr, "%s: FAIL: X509V3_ADD_DELETE "
"expected 0 extensions, have %d.\n", __func__, got);
goto err;
}
/*
* X509V3_ADD_REPLACE adds the extension to empty stack as it should.
*/
nid = NID_basic_constraints;
bc = create_basic_constraints(0);
op = X509V3_ADD_REPLACE;
if ((got = X509V3_add1_i2d(extensions, nid, bc, 1, op)) != 1) {
fprintf(stderr, "%s: FAIL: X509V3_ADD_REPLACE on empty stack "
"want %d, got %d.\n", __func__, 1, got);
goto err;
}
BASIC_CONSTRAINTS_free(bc);
bc = NULL;
if ((got = X509v3_get_ext_count(*extensions)) != 1) {
fprintf(stderr, "%s: FAIL: X509V3_ADD_REPLACE "
"expected 1 extension, have %d.\n", __func__, got);
goto err;
}
/*
* And X509V3_ADD_DELETE works again.
*/
nid = NID_basic_constraints;
op = X509V3_ADD_DELETE;
if ((got = X509V3_add1_i2d(extensions, nid, NULL, 0, op)) != 1) {
fprintf(stderr, "%s: FAIL: X509V3_ADD_DELETE after add replace "
"want %d, got %d.\n", __func__, 0, got);
goto err;
}
if ((got = X509v3_get_ext_count(*extensions)) != 0) {
fprintf(stderr, "%s: FAIL: X509V3_ADD_DELETE "
"expected 0 extensions, have %d.\n", __func__, got);
goto err;
}
failed = 0;
err:
BASIC_CONSTRAINTS_free(bc);
return failed;
}
static int
test_x509v3_add1_i2d_add_append(STACK_OF(X509_EXTENSION) **extensions)
{
BASIC_CONSTRAINTS *bc = NULL;
int crit, got, idx, nid, op;
int failed = 1;
if (X509v3_get_ext_count(*extensions) != 0) {
fprintf(stderr, "%s: FAIL: need empty stack.\n", __func__);
goto err;
}
/*
* Let the toolkit add two basic constraints extensions.
*/
nid = NID_basic_constraints;
bc = create_basic_constraints(1);
crit = 1;
op = X509V3_ADD_APPEND;
if ((got = X509V3_add1_i2d(extensions, nid, bc, crit, op)) != 1) {
fprintf(stderr, "%s: FAIL: first X509V3_ADD_APPEND "
"want %d, got %d.\n", __func__, 0, got);
goto err;
}
BASIC_CONSTRAINTS_free(bc);
bc = NULL;
nid = NID_basic_constraints;
bc = create_basic_constraints(0);
crit = 1;
op = X509V3_ADD_APPEND;
if ((got = X509V3_add1_i2d(extensions, nid, bc, crit, op)) != 1) {
fprintf(stderr, "%s: FAIL: second X509V3_ADD_APPEND "
"want %d, got %d.\n", __func__, 0, got);
goto err;
}
BASIC_CONSTRAINTS_free(bc);
bc = NULL;
if ((got = X509v3_get_ext_count(*extensions)) != 2) {
fprintf(stderr, "%s: FAIL: second X509V3_ADD_APPEND "
"expected 2 extensions, have %d.\n", __func__, got);
goto err;
}
/*
* Inspect the extensions on the stack. First we should get the one
* with the ca bit set and it should be critical.
*/
nid = NID_basic_constraints;
idx = -1;
if ((bc = X509V3_get_d2i(*extensions, nid, &crit, &idx)) == NULL) {
fprintf(stderr, "%s: FAIL: X509V3_ADD_APPEND "
"expected basic constraints.\n", __func__);
goto err;
}
if (bc->ca != ASN1_BOOLEAN_TRUE) {
fprintf(stderr, "%s: FAIL: X509V3_ADD_APPEND "
"expected ca basic constraints.\n", __func__);
goto err;
}
if (crit != 1) {
fprintf(stderr, "%s: FAIL: X509V3_ADD_APPEND "
"expected critical basic constraints.\n", __func__);
goto err;
}
BASIC_CONSTRAINTS_free(bc);
bc = NULL;
/* Redo the exercise and get the basic constraints with ca bit unset. */
nid = NID_basic_constraints;
if ((bc = X509V3_get_d2i(*extensions, nid, &crit, &idx)) == NULL) {
fprintf(stderr, "%s: FAIL: second X509V3_ADD_APPEND "
"expected basic constraints.\n", __func__);
goto err;
}
if (bc->ca != ASN1_BOOLEAN_FALSE) {
fprintf(stderr, "%s: FAIL: second X509V3_ADD_APPEND "
"expected basic constraints to be non-ca.\n", __func__);
goto err;
}
if (crit != 1) {
fprintf(stderr, "%s: FAIL: second X509V3_ADD_APPEND "
"expected critical basic constraints.\n", __func__);
goto err;
}
BASIC_CONSTRAINTS_free(bc);
bc = NULL;
/*
* Now X509V3_ADD_REPLACE non-critical ca constraints. They should
* replace the critical ca constraints we added before.
*/
nid = NID_basic_constraints;
bc = create_basic_constraints(1);
crit = 0;
op = X509V3_ADD_REPLACE;
if ((got = X509V3_add1_i2d(extensions, nid, bc, crit, op)) != 1) {
fprintf(stderr, "%s: FAIL: X509V3_ADD_REPLACE "
"want %d, got %d\n", __func__, 1, got);
goto err;
}
BASIC_CONSTRAINTS_free(bc);
bc = NULL;
/*
* If we get basic constraints now, we get the non-critical one with the
* ca bit set.
*/
nid = NID_basic_constraints;
idx = -1;
if ((bc = X509V3_get_d2i(*extensions, nid, &crit, &idx)) == NULL) {
fprintf(stderr, "%s: FAIL: X509V3_ADD_REPLACE "
"expected basic constraints.\n", __func__);
goto err;
}
if (bc->ca != ASN1_BOOLEAN_TRUE) {
fprintf(stderr, "%s: FAIL: X509V3_ADD_REPLACE "
"expected ca basic constraints.\n", __func__);
goto err;
}
if (crit != 0) {
fprintf(stderr, "%s: FAIL: X509V3_ADD_REPLACE "
"expected non-critical basic constraints.\n", __func__);
goto err;
}
BASIC_CONSTRAINTS_free(bc);
bc = NULL;
if ((got = X509v3_get_ext_count(*extensions)) != 2) {
fprintf(stderr, "%s: FAIL: X509V3_ADD_REPLACE "
"expected 2 extensions, got %d.\n", __func__, got);
goto err;
}
nid = NID_basic_constraints;
op = X509V3_ADD_DELETE;
if ((got = X509V3_add1_i2d(extensions, nid, NULL, 0, op)) != 1) {
fprintf(stderr, "%s: FAIL: X509V3_ADD_DELETE "
"want %d, got %d\n", __func__, 1, got);
goto err;
}
if ((got = X509v3_get_ext_count(*extensions)) != 1) {
fprintf(stderr, "%s: FAIL: X509V3_ADD_DELETE "
"expected 1 extension, got %d.\n", __func__, got);
goto err;
}
/* The last deletion will have left the critical non-ca constraints. */
nid = NID_basic_constraints;
idx = -1;
if ((bc = X509V3_get_d2i(*extensions, nid, &crit, &idx)) == NULL) {
fprintf(stderr, "%s: FAIL: X509V3_ADD_DELETE "
"expected basic constraints.\n", __func__);
goto err;
}
if (bc->ca != ASN1_BOOLEAN_FALSE) {
fprintf(stderr, "%s: FAIL: X509V3_ADD_DELETE "
"expected ca basic constraints.\n", __func__);
goto err;
}
if (crit != 1) {
fprintf(stderr, "%s: FAIL: X509V3_ADD_DELETE "
"expected critical basic constraints.\n", __func__);
goto err;
}
BASIC_CONSTRAINTS_free(bc);
bc = NULL;
/* Now delete the last extension. */
nid = NID_basic_constraints;
op = X509V3_ADD_DELETE;
if ((got = X509V3_add1_i2d(extensions, nid, NULL, 0, op)) != 1) {
fprintf(stderr, "%s: FAIL: second X509V3_ADD_DELETE "
"want %d, got %d\n", __func__, 1, got);
goto err;
}
if ((got = X509v3_get_ext_count(*extensions)) != 0) {
fprintf(stderr, "%s: FAIL: second X509V3_ADD_DELETE "
"expected 0 extensions, got %d.\n", __func__, got);
goto err;
}
failed = 0;
err:
BASIC_CONSTRAINTS_free(bc);
return failed;
}
static int
test_x509v3_add1_i2d_invalid_operations(STACK_OF(X509_EXTENSION) **extensions)
{
BASIC_CONSTRAINTS *bc = NULL;
long error;
int crit, got, nid, op;
int failed = 1;
if (X509v3_get_ext_count(*extensions) != 0) {
fprintf(stderr, "%s: FAIL: need empty stack.\n", __func__);
goto err;
}
/*
* Attempt to add a basic constraint extension with invalid operations
*/
nid = NID_basic_constraints;
bc = create_basic_constraints(1);
crit = 1;
for (op = X509V3_ADD_DELETE + 1; op <= X509V3_ADD_OP_MASK; op++) {
if ((got = X509V3_add1_i2d(extensions, nid, bc, crit, op)) != -1) {
fprintf(stderr, "%s: FAIL: operation %d "
"want %d, got %d.\n", __func__, op, -1, got);
goto err;
}
error = ERR_get_error();
if (ERR_GET_REASON(error) != X509V3_R_UNSUPPORTED_OPTION) {
fprintf(stderr, "%s: FAIL: invalid operation %d "
" pushed %d, want %d.\n", __func__, op,
ERR_GET_REASON(error), X509V3_R_EXTENSION_EXISTS);
goto err;
}
}
BASIC_CONSTRAINTS_free(bc);
bc = NULL;
if ((got = X509v3_get_ext_count(*extensions)) != 0) {
fprintf(stderr, "%s: FAIL: expected 0 extensions, have %d.\n",
__func__, got);
goto err;
}
failed = 0;
err:
BASIC_CONSTRAINTS_free(bc);
return failed;
}
static int
test_x509v3_add1_i2d(void)
{
STACK_OF(X509_EXTENSION) *extensions;
int failed = 0;
if ((extensions = sk_X509_EXTENSION_new_null()) == NULL)
errx(1, "sk_X509_EXTENSION_new_null");
failed |= test_x509v3_add1_i2d_empty_stack(&extensions);
failed |= test_x509v3_add1_i2d_single_nid(&extensions);
failed |= test_x509v3_add1_i2d_add_append(&extensions);
failed |= test_x509v3_add1_i2d_invalid_operations(&extensions);
sk_X509_EXTENSION_pop_free(extensions, X509_EXTENSION_free);
return failed;
}
int
main(void)
{
int failed = 0;
failed |= test_x509v3_add1_i2d();
return failed;
}

View file

@ -1,4 +1,4 @@
.\" $OpenBSD: changelist.5,v 1.9 2017/07/13 19:16:33 jmc Exp $ .\" $OpenBSD: changelist.5,v 1.10 2024/05/28 05:09:19 jmc Exp $
.\" .\"
.\" Copyright (c) 2003 Jason McIntyre <jmc@openbsd.org> .\" Copyright (c) 2003 Jason McIntyre <jmc@openbsd.org>
.\" .\"
@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\" .\"
.Dd $Mdocdate: July 13 2017 $ .Dd $Mdocdate: May 28 2024 $
.Dt CHANGELIST 5 .Dt CHANGELIST 5
.Os .Os
.Sh NAME .Sh NAME
@ -88,7 +88,7 @@ checksums.
Results are mailed in the following format: Results are mailed in the following format:
.Bd -unfilled -offset indent .Bd -unfilled -offset indent
====== ======
/etc/ssh/ssh_host_key SHA-256 checksums /etc/ssh/ssh_host_ed25519_key SHA-256 checksums
====== ======
OLD: OLD:
NEW: NEW:

View file

@ -1,4 +1,4 @@
.\" $OpenBSD: python-module.5,v 1.11 2024/04/17 13:34:23 sthen Exp $ .\" $OpenBSD: python-module.5,v 1.12 2024/05/28 16:05:39 sthen Exp $
.\" .\"
.\" Copyright (c) 2008 Marc Espie .\" Copyright (c) 2008 Marc Espie
.\" .\"
@ -24,7 +24,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\" .\"
.Dd $Mdocdate: April 17 2024 $ .Dd $Mdocdate: May 28 2024 $
.Dt PYTHON-MODULE 5 .Dt PYTHON-MODULE 5
.Os .Os
.Sh NAME .Sh NAME
@ -165,6 +165,11 @@ to disable certain test scripts with
.Sq --ignore , .Sq --ignore ,
or to disable certain individual tests with or to disable certain individual tests with
.Sq -k . .Sq -k .
User setting
.Ev MODPY_PYTEST_USERARGS ,
if present, is passed on the command line.
This allows setting py.test flags to increase verbosity,
show test durations, enable colours, etc.
.Pp .Pp
All ports that generate egg-info or dist-info files should set All ports that generate egg-info or dist-info files should set
.Ev MODPY_EGG_VERSION .Ev MODPY_EGG_VERSION
@ -182,6 +187,16 @@ These filenames can be relative to ${WRKSRC} and will be modified
at the end of at the end of
.Cm pre-configure . .Cm pre-configure .
.Pp .Pp
For ports not using standard Python build infrastructure,
it may be necessary to bytecode-compile installed .py files.
This can be done by using
.Ev ${MODPY_COMPILEALL} ,
usually in a post-install target.
This passes flags to use MAKE_JOBS, strip off WRKINST, and use
standard optimization passes.
File or directory names can be given.
Directories are handled recursively.
.Pp
This module also affects This module also affects
.Ev CATEGORIES , .Ev CATEGORIES ,
.Ev MAKE_ENV , .Ev MAKE_ENV ,

View file

@ -1,4 +1,4 @@
/* $OpenBSD: acpi_machdep.c,v 1.108 2023/06/07 04:46:09 deraadt Exp $ */ /* $OpenBSD: acpi_machdep.c,v 1.109 2024/05/26 13:37:31 kettenis Exp $ */
/* /*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com> * Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
* *
@ -333,7 +333,8 @@ acpi_attach_machdep(struct acpi_softc *sc)
extern void (*cpuresetfn)(void); extern void (*cpuresetfn)(void);
sc->sc_interrupt = isa_intr_establish(NULL, sc->sc_fadt->sci_int, sc->sc_interrupt = isa_intr_establish(NULL, sc->sc_fadt->sci_int,
IST_LEVEL, IPL_BIO, acpi_interrupt, sc, sc->sc_dev.dv_xname); IST_LEVEL, IPL_BIO | IPL_WAKEUP, acpi_interrupt,
sc, sc->sc_dev.dv_xname);
cpuresetfn = acpi_reset; cpuresetfn = acpi_reset;
#ifndef SMALL_KERNEL #ifndef SMALL_KERNEL

View file

@ -1,4 +1,4 @@
/* $OpenBSD: intr.c,v 1.56 2024/01/19 18:38:16 kettenis Exp $ */ /* $OpenBSD: intr.c,v 1.57 2024/05/26 13:37:31 kettenis Exp $ */
/* $NetBSD: intr.c,v 1.3 2003/03/03 22:16:20 fvdl Exp $ */ /* $NetBSD: intr.c,v 1.3 2003/03/03 22:16:20 fvdl Exp $ */
/* /*
@ -354,8 +354,8 @@ intr_establish(int legacy_irq, struct pic *pic, int pin, int type, int level,
panic("intr_establish: non-legacy IRQ on i8259"); panic("intr_establish: non-legacy IRQ on i8259");
#endif #endif
flags = level & IPL_MPSAFE; flags = level & (IPL_MPSAFE | IPL_WAKEUP);
level &= ~IPL_MPSAFE; level &= ~(IPL_MPSAFE | IPL_WAKEUP);
KASSERT(level <= IPL_TTY || level >= IPL_CLOCK || flags & IPL_MPSAFE); KASSERT(level <= IPL_TTY || level >= IPL_CLOCK || flags & IPL_MPSAFE);
@ -694,6 +694,52 @@ intr_barrier(void *cookie)
sched_barrier(ih->ih_cpu); sched_barrier(ih->ih_cpu);
} }
#ifdef SUSPEND
void
intr_enable_wakeup(void)
{
struct cpu_info *ci = curcpu();
struct pic *pic;
int irq, pin;
for (irq = 0; irq < MAX_INTR_SOURCES; irq++) {
if (ci->ci_isources[irq] == NULL)
continue;
if (ci->ci_isources[irq]->is_handlers->ih_flags & IPL_WAKEUP)
continue;
pic = ci->ci_isources[irq]->is_pic;
pin = ci->ci_isources[irq]->is_pin;
if (pic->pic_hwmask)
pic->pic_hwmask(pic, pin);
}
}
void
intr_disable_wakeup(void)
{
struct cpu_info *ci = curcpu();
struct pic *pic;
int irq, pin;
for (irq = 0; irq < MAX_INTR_SOURCES; irq++) {
if (ci->ci_isources[irq] == NULL)
continue;
if (ci->ci_isources[irq]->is_handlers->ih_flags & IPL_WAKEUP)
continue;
pic = ci->ci_isources[irq]->is_pic;
pin = ci->ci_isources[irq]->is_pin;
if (pic->pic_hwunmask)
pic->pic_hwunmask(pic, pin);
}
}
#endif
/* /*
* Add a mask to cpl, and return the old value of cpl. * Add a mask to cpl, and return the old value of cpl.
*/ */

View file

@ -1,4 +1,4 @@
/* $OpenBSD: intr.h,v 1.33 2021/12/14 18:16:14 deraadt Exp $ */ /* $OpenBSD: intr.h,v 1.34 2024/05/26 13:37:31 kettenis Exp $ */
/* $NetBSD: intr.h,v 1.2 2003/05/04 22:01:56 fvdl Exp $ */ /* $NetBSD: intr.h,v 1.2 2003/05/04 22:01:56 fvdl Exp $ */
/*- /*-
@ -206,6 +206,8 @@ int intr_handler(struct intrframe *, struct intrhand *);
void cpu_intr_init(struct cpu_info *); void cpu_intr_init(struct cpu_info *);
void intr_printconfig(void); void intr_printconfig(void);
void intr_barrier(void *); void intr_barrier(void *);
void intr_enable_wakeup(void);
void intr_disable_wakeup(void);
#ifdef MULTIPROCESSOR #ifdef MULTIPROCESSOR
void x86_send_ipi(struct cpu_info *, int); void x86_send_ipi(struct cpu_info *, int);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: intrdefs.h,v 1.23 2024/01/04 20:50:43 kettenis Exp $ */ /* $OpenBSD: intrdefs.h,v 1.24 2024/05/26 13:37:31 kettenis Exp $ */
/* $NetBSD: intrdefs.h,v 1.2 2003/05/04 22:01:56 fvdl Exp $ */ /* $NetBSD: intrdefs.h,v 1.2 2003/05/04 22:01:56 fvdl Exp $ */
#ifndef _AMD64_INTRDEFS_H #ifndef _AMD64_INTRDEFS_H
@ -36,6 +36,7 @@
#define IPL_MPFLOOR IPL_TTY #define IPL_MPFLOOR IPL_TTY
#define IPL_MPSAFE 0x100 #define IPL_MPSAFE 0x100
#define IPL_WAKEUP 0x200
/* Interrupt sharing types. */ /* Interrupt sharing types. */
#define IST_NONE 0 /* none */ #define IST_NONE 0 /* none */

View file

@ -1,4 +1,4 @@
/* $OpenBSD: cpu.c,v 1.114 2024/04/13 14:19:39 kettenis Exp $ */ /* $OpenBSD: cpu.c,v 1.116 2024/05/27 06:20:59 kettenis Exp $ */
/* /*
* Copyright (c) 2016 Dale Rahn <drahn@dalerahn.com> * Copyright (c) 2016 Dale Rahn <drahn@dalerahn.com>
@ -742,6 +742,37 @@ cpu_identify(struct cpu_info *ci)
*/ */
id = READ_SPECIALREG(id_aa64isar1_el1); id = READ_SPECIALREG(id_aa64isar1_el1);
if (ID_AA64ISAR1_LS64(id) >= ID_AA64ISAR1_LS64_BASE) {
printf("%sLS64", sep);
sep = ",";
}
if (ID_AA64ISAR1_LS64(id) >= ID_AA64ISAR1_LS64_V)
printf("+V");
if (ID_AA64ISAR1_LS64(id) >= ID_AA64ISAR1_LS64_ACCDATA)
printf("+ACCDATA");
if (ID_AA64ISAR1_XS(id) >= ID_AA64ISAR1_XS_IMPL) {
printf("%sXS", sep);
sep = ",";
}
if (ID_AA64ISAR1_I8MM(id) >= ID_AA64ISAR1_I8MM_IMPL) {
printf("%sI8MM", sep);
sep = ",";
}
if (ID_AA64ISAR1_DGH(id) >= ID_AA64ISAR1_DGH_IMPL) {
printf("%sDGH", sep);
sep = ",";
}
if (ID_AA64ISAR1_BF16(id) >= ID_AA64ISAR1_BF16_BASE) {
printf("%sBF16", sep);
sep = ",";
}
if (ID_AA64ISAR1_BF16(id) >= ID_AA64ISAR1_BF16_EBF)
printf("+EBF");
if (ID_AA64ISAR1_SPECRES(id) >= ID_AA64ISAR1_SPECRES_IMPL) { if (ID_AA64ISAR1_SPECRES(id) >= ID_AA64ISAR1_SPECRES_IMPL) {
printf("%sSPECRES", sep); printf("%sSPECRES", sep);
sep = ","; sep = ",";
@ -1526,7 +1557,8 @@ cpu_suspend_primary(void)
* wake us up by clearing the flag. * wake us up by clearing the flag.
*/ */
cpu_suspended = 1; cpu_suspended = 1;
intr_enable_wakeup(); arm_intr_func.setipl(IPL_NONE);
intr_enable();
while (cpu_suspended) { while (cpu_suspended) {
#if NPSCI > 0 #if NPSCI > 0
@ -1542,7 +1574,8 @@ cpu_suspend_primary(void)
} }
resume: resume:
intr_disable_wakeup(); intr_disable();
arm_intr_func.setipl(IPL_HIGH);
/* Unmask clock interrupts. */ /* Unmask clock interrupts. */
WRITE_SPECIALREG(cntv_ctl_el0, WRITE_SPECIALREG(cntv_ctl_el0,

View file

@ -1,4 +1,4 @@
/* $OpenBSD: intr.c,v 1.27 2022/12/21 22:30:42 kettenis Exp $ */ /* $OpenBSD: intr.c,v 1.28 2024/05/26 13:37:31 kettenis Exp $ */
/* /*
* Copyright (c) 2011 Dale Rahn <drahn@openbsd.org> * Copyright (c) 2011 Dale Rahn <drahn@openbsd.org>
* *
@ -888,15 +888,11 @@ intr_enable_wakeup(void)
{ {
if (arm_intr_func.enable_wakeup) if (arm_intr_func.enable_wakeup)
arm_intr_func.enable_wakeup(); arm_intr_func.enable_wakeup();
arm_intr_func.setipl(IPL_NONE);
intr_enable();
} }
void void
intr_disable_wakeup(void) intr_disable_wakeup(void)
{ {
intr_disable();
arm_intr_func.setipl(IPL_HIGH);
if (arm_intr_func.disable_wakeup) if (arm_intr_func.disable_wakeup)
arm_intr_func.disable_wakeup(); arm_intr_func.disable_wakeup();
} }

View file

@ -1,4 +1,4 @@
/* $OpenBSD: pmap.c,v 1.102 2024/03/27 15:40:50 kurt Exp $ */ /* $OpenBSD: pmap.c,v 1.103 2024/05/28 15:16:45 claudio Exp $ */
/* /*
* Copyright (c) 2008-2009,2014-2016 Dale Rahn <drahn@dalerahn.com> * Copyright (c) 2008-2009,2014-2016 Dale Rahn <drahn@dalerahn.com>
* *
@ -217,7 +217,7 @@ const uint64_t ap_bits_kern[8] = {
int pmap_nasid = (1 << 8); int pmap_nasid = (1 << 8);
uint32_t pmap_asid[PMAP_MAX_NASID / 32]; uint32_t pmap_asid[PMAP_MAX_NASID / 32];
uint64_t pmap_asid_gen = PMAP_MAX_NASID; unsigned long pmap_asid_gen = PMAP_MAX_NASID;
struct mutex pmap_asid_mtx = MUTEX_INITIALIZER(IPL_HIGH); struct mutex pmap_asid_mtx = MUTEX_INITIALIZER(IPL_HIGH);
int int
@ -227,6 +227,8 @@ pmap_find_asid(pmap_t pm)
int asid, bit; int asid, bit;
int retry; int retry;
MUTEX_ASSERT_LOCKED(&pmap_asid_mtx);
/* Attempt to re-use the old ASID. */ /* Attempt to re-use the old ASID. */
asid = pm->pm_asid & PMAP_ASID_MASK; asid = pm->pm_asid & PMAP_ASID_MASK;
bit = asid & (32 - 1); bit = asid & (32 - 1);
@ -262,23 +264,26 @@ pmap_rollover_asid(pmap_t pm)
{ {
struct cpu_info *ci; struct cpu_info *ci;
CPU_INFO_ITERATOR cii; CPU_INFO_ITERATOR cii;
unsigned long gen;
int asid, bit; int asid, bit;
SCHED_ASSERT_LOCKED();
MUTEX_ASSERT_LOCKED(&pmap_asid_mtx); MUTEX_ASSERT_LOCKED(&pmap_asid_mtx);
/* Start a new generation. Mark ASID 0 as in-use again. */ /* Start a new generation. Mark ASID 0 as in-use again. */
pmap_asid_gen += PMAP_MAX_NASID; gen = atomic_add_long_nv(&pmap_asid_gen, PMAP_MAX_NASID);
memset(pmap_asid, 0, (pmap_nasid / 32) * sizeof(uint32_t)); memset(pmap_asid, 0, (pmap_nasid / 32) * sizeof(uint32_t));
pmap_asid[0] |= (3U << 0); pmap_asid[0] |= (3U << 0);
/* /*
* Carry over all the ASIDs that are currently active into the * Carry over all the ASIDs that are currently active into the
* new generation and reserve them. * new generation and reserve them.
* CPUs in cpu_switchto() will spin in pmap_setttb() waiting for
* the mutex. In that case an old ASID will be carried over but
* that is not problematic.
*/ */
CPU_INFO_FOREACH(cii, ci) { CPU_INFO_FOREACH(cii, ci) {
asid = ci->ci_curpm->pm_asid & PMAP_ASID_MASK; asid = ci->ci_curpm->pm_asid & PMAP_ASID_MASK;
ci->ci_curpm->pm_asid = asid | pmap_asid_gen; ci->ci_curpm->pm_asid = asid | gen;
bit = (asid & (32 - 1)); bit = (asid & (32 - 1));
pmap_asid[asid / 32] |= (3U << bit); pmap_asid[asid / 32] |= (3U << bit);
} }
@ -286,7 +291,7 @@ pmap_rollover_asid(pmap_t pm)
/* Flush the TLBs on all CPUs. */ /* Flush the TLBs on all CPUs. */
cpu_tlb_flush(); cpu_tlb_flush();
if ((pm->pm_asid & ~PMAP_ASID_MASK) == pmap_asid_gen) if ((pm->pm_asid & ~PMAP_ASID_MASK) == gen)
return pm->pm_asid & PMAP_ASID_MASK; return pm->pm_asid & PMAP_ASID_MASK;
return pmap_find_asid(pm); return pmap_find_asid(pm);
@ -1397,13 +1402,9 @@ void
pmap_activate(struct proc *p) pmap_activate(struct proc *p)
{ {
pmap_t pm = p->p_vmspace->vm_map.pmap; pmap_t pm = p->p_vmspace->vm_map.pmap;
int s;
if (p == curproc && pm != curcpu()->ci_curpm) { if (p == curproc && pm != curcpu()->ci_curpm)
SCHED_LOCK(s);
pmap_setttb(p); pmap_setttb(p);
SCHED_UNLOCK(s);
}
} }
/* /*
@ -2274,14 +2275,12 @@ pmap_setttb(struct proc *p)
struct cpu_info *ci = curcpu(); struct cpu_info *ci = curcpu();
pmap_t pm = p->p_vmspace->vm_map.pmap; pmap_t pm = p->p_vmspace->vm_map.pmap;
SCHED_ASSERT_LOCKED();
/* /*
* If the generation of the ASID for the new pmap doesn't * If the generation of the ASID for the new pmap doesn't
* match the current generation, allocate a new ASID. * match the current generation, allocate a new ASID.
*/ */
if (pm != pmap_kernel() && if (pm != pmap_kernel() &&
(pm->pm_asid & ~PMAP_ASID_MASK) != pmap_asid_gen) (pm->pm_asid & ~PMAP_ASID_MASK) != READ_ONCE(pmap_asid_gen))
pmap_allocate_asid(pm); pmap_allocate_asid(pm);
if (pm != pmap_kernel()) if (pm != pmap_kernel())

View file

@ -1,4 +1,4 @@
/* $OpenBSD: apm.c,v 1.24 2023/07/08 14:44:43 tobhe Exp $ */ /* $OpenBSD: apm.c,v 1.25 2024/05/28 09:40:40 kettenis Exp $ */
/*- /*-
* Copyright (c) 2001 Alexander Guy. All rights reserved. * Copyright (c) 2001 Alexander Guy. All rights reserved.
@ -444,11 +444,6 @@ gosleep(void *v)
return cpu_suspend_primary(); return cpu_suspend_primary();
} }
void
sleep_abort(void *v)
{
}
int int
sleep_resume(void *v) sleep_resume(void *v)
{ {

View file

@ -1,4 +1,4 @@
/* $OpenBSD: armreg.h,v 1.33 2024/03/18 18:35:21 kettenis Exp $ */ /* $OpenBSD: armreg.h,v 1.34 2024/05/27 06:20:59 kettenis Exp $ */
/*- /*-
* Copyright (c) 2013, 2014 Andrew Turner * Copyright (c) 2013, 2014 Andrew Turner
* Copyright (c) 2015 The FreeBSD Foundation * Copyright (c) 2015 The FreeBSD Foundation
@ -337,7 +337,7 @@
#define ID_AA64ISAR0_RNDR_IMPL (0x1ULL << ID_AA64ISAR0_RNDR_SHIFT) #define ID_AA64ISAR0_RNDR_IMPL (0x1ULL << ID_AA64ISAR0_RNDR_SHIFT)
/* ID_AA64ISAR1_EL1 */ /* ID_AA64ISAR1_EL1 */
#define ID_AA64ISAR1_MASK 0x00000fffffffffffULL #define ID_AA64ISAR1_MASK 0xffffffffffffffffULL
#define ID_AA64ISAR1_DPB_SHIFT 0 #define ID_AA64ISAR1_DPB_SHIFT 0
#define ID_AA64ISAR1_DPB_MASK (0xfULL << ID_AA64ISAR1_DPB_SHIFT) #define ID_AA64ISAR1_DPB_MASK (0xfULL << ID_AA64ISAR1_DPB_SHIFT)
#define ID_AA64ISAR1_DPB(x) ((x) & ID_AA64ISAR1_DPB_MASK) #define ID_AA64ISAR1_DPB(x) ((x) & ID_AA64ISAR1_DPB_MASK)
@ -396,6 +396,34 @@
#define ID_AA64ISAR1_SPECRES(x) ((x) & ID_AA64ISAR1_SPECRES_MASK) #define ID_AA64ISAR1_SPECRES(x) ((x) & ID_AA64ISAR1_SPECRES_MASK)
#define ID_AA64ISAR1_SPECRES_NONE (0x0ULL << ID_AA64ISAR1_SPECRES_SHIFT) #define ID_AA64ISAR1_SPECRES_NONE (0x0ULL << ID_AA64ISAR1_SPECRES_SHIFT)
#define ID_AA64ISAR1_SPECRES_IMPL (0x1ULL << ID_AA64ISAR1_SPECRES_SHIFT) #define ID_AA64ISAR1_SPECRES_IMPL (0x1ULL << ID_AA64ISAR1_SPECRES_SHIFT)
#define ID_AA64ISAR1_BF16_SHIFT 44
#define ID_AA64ISAR1_BF16_MASK (0xfULL << ID_AA64ISAR1_BF16_SHIFT)
#define ID_AA64ISAR1_BF16(x) ((x) & ID_AA64ISAR1_BF16_MASK)
#define ID_AA64ISAR1_BF16_NONE (0x0ULL << ID_AA64ISAR1_BF16_SHIFT)
#define ID_AA64ISAR1_BF16_BASE (0x1ULL << ID_AA64ISAR1_BF16_SHIFT)
#define ID_AA64ISAR1_BF16_EBF (0x2ULL << ID_AA64ISAR1_BF16_SHIFT)
#define ID_AA64ISAR1_DGH_SHIFT 48
#define ID_AA64ISAR1_DGH_MASK (0xfULL << ID_AA64ISAR1_DGH_SHIFT)
#define ID_AA64ISAR1_DGH(x) ((x) & ID_AA64ISAR1_DGH_MASK)
#define ID_AA64ISAR1_DGH_NONE (0x0ULL << ID_AA64ISAR1_DGH_SHIFT)
#define ID_AA64ISAR1_DGH_IMPL (0x1ULL << ID_AA64ISAR1_DGH_SHIFT)
#define ID_AA64ISAR1_I8MM_SHIFT 52
#define ID_AA64ISAR1_I8MM_MASK (0xfULL << ID_AA64ISAR1_I8MM_SHIFT)
#define ID_AA64ISAR1_I8MM(x) ((x) & ID_AA64ISAR1_I8MM_MASK)
#define ID_AA64ISAR1_I8MM_NONE (0x0ULL << ID_AA64ISAR1_I8MM_SHIFT)
#define ID_AA64ISAR1_I8MM_IMPL (0x1ULL << ID_AA64ISAR1_I8MM_SHIFT)
#define ID_AA64ISAR1_XS_SHIFT 56
#define ID_AA64ISAR1_XS_MASK (0xfULL << ID_AA64ISAR1_XS_SHIFT)
#define ID_AA64ISAR1_XS(x) ((x) & ID_AA64ISAR1_XS_MASK)
#define ID_AA64ISAR1_XS_NONE (0x0ULL << ID_AA64ISAR1_XS_SHIFT)
#define ID_AA64ISAR1_XS_IMPL (0x1ULL << ID_AA64ISAR1_XS_SHIFT)
#define ID_AA64ISAR1_LS64_SHIFT 60
#define ID_AA64ISAR1_LS64_MASK (0xfULL << ID_AA64ISAR1_LS64_SHIFT)
#define ID_AA64ISAR1_LS64(x) ((x) & ID_AA64ISAR1_LS64_MASK)
#define ID_AA64ISAR1_LS64_NONE (0x0ULL << ID_AA64ISAR1_LS64_SHIFT)
#define ID_AA64ISAR1_LS64_BASE (0x1ULL << ID_AA64ISAR1_LS64_SHIFT)
#define ID_AA64ISAR1_LS64_V (0x2ULL << ID_AA64ISAR1_LS64_SHIFT)
#define ID_AA64ISAR1_LS64_ACCDATA (0x3ULL << ID_AA64ISAR1_LS64_SHIFT)
/* ID_AA64ISAR2_EL1 */ /* ID_AA64ISAR2_EL1 */
#define ID_AA64ISAR2_MASK 0x00000000f0000000ULL #define ID_AA64ISAR2_MASK 0x00000000f0000000ULL

View file

@ -1,4 +1,4 @@
/* $OpenBSD: machdep.c,v 1.670 2024/04/29 00:29:48 jsg Exp $ */ /* $OpenBSD: machdep.c,v 1.671 2024/05/26 13:37:32 kettenis Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*- /*-
@ -3966,6 +3966,20 @@ intr_barrier(void *ih)
sched_barrier(NULL); sched_barrier(NULL);
} }
#ifdef SUSPEND
void
intr_enable_wakeup(void)
{
}
void
intr_disable_wakeup(void)
{
}
#endif
unsigned int unsigned int
cpu_rnd_messybits(void) cpu_rnd_messybits(void)
{ {

View file

@ -1,4 +1,4 @@
/* $OpenBSD: intr.h,v 1.49 2021/12/14 18:16:14 deraadt Exp $ */ /* $OpenBSD: intr.h,v 1.50 2024/05/26 13:37:32 kettenis Exp $ */
/* $NetBSD: intr.h,v 1.5 1996/05/13 06:11:28 mycroft Exp $ */ /* $NetBSD: intr.h,v 1.5 1996/05/13 06:11:28 mycroft Exp $ */
/* /*
@ -128,6 +128,8 @@ void splassert_check(int, const char *);
struct cpu_info; struct cpu_info;
void intr_barrier(void *); void intr_barrier(void *);
void intr_enable_wakeup(void);
void intr_disable_wakeup(void);
#ifdef MULTIPROCESSOR #ifdef MULTIPROCESSOR
void i386_send_ipi(struct cpu_info *, int); void i386_send_ipi(struct cpu_info *, int);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: acpi_x86.c,v 1.18 2024/05/13 19:56:37 kettenis Exp $ */ /* $OpenBSD: acpi_x86.c,v 1.20 2024/05/28 09:40:40 kettenis Exp $ */
/* /*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com> * Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org> * Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
@ -96,19 +96,10 @@ gosleep(void *v)
ret = acpi_sleep_cpu(sc, sc->sc_state); ret = acpi_sleep_cpu(sc, sc->sc_state);
acpi_resume_cpu(sc, sc->sc_state); acpi_resume_cpu(sc, sc->sc_state);
sc->sc_state = ACPI_STATE_S0;
return ret; return ret;
} }
void
sleep_abort(void *v)
{
struct acpi_softc *sc = v;
sc->sc_state = ACPI_STATE_S0;
}
int int
sleep_resume(void *v) sleep_resume(void *v)
{ {
@ -119,7 +110,7 @@ sleep_resume(void *v)
acpibtn_disable_psw(); /* disable _LID for wakeup */ acpibtn_disable_psw(); /* disable _LID for wakeup */
/* 3rd resume AML step: _TTS(runstate) */ /* 3rd resume AML step: _TTS(runstate) */
if (aml_node_setval(sc, sc->sc_tts, sc->sc_state) != 0) if (aml_node_setval(sc, sc->sc_tts, ACPI_STATE_S0) != 0)
return (EINVAL); return (EINVAL);
acpi_indicator(sc, ACPI_SST_WAKING); /* blink */ acpi_indicator(sc, ACPI_SST_WAKING); /* blink */
return 0; return 0;
@ -147,6 +138,8 @@ suspend_finish(void *v)
acpi_record_event(sc, APM_NORMAL_RESUME); acpi_record_event(sc, APM_NORMAL_RESUME);
acpi_indicator(sc, ACPI_SST_WORKING); acpi_indicator(sc, ACPI_SST_WORKING);
sc->sc_state = ACPI_STATE_S0;
/* If we woke up but all the lids are closed, go back to sleep */ /* If we woke up but all the lids are closed, go back to sleep */
return checklids(sc); return checklids(sc);
} }

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ata.c,v 1.36 2017/12/30 20:46:59 guenther Exp $ */ /* $OpenBSD: ata.c,v 1.37 2024/05/26 10:01:01 jsg Exp $ */
/* $NetBSD: ata.c,v 1.9 1999/04/15 09:41:09 bouyer Exp $ */ /* $NetBSD: ata.c,v 1.9 1999/04/15 09:41:09 bouyer Exp $ */
/* /*
* Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved. * Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved.
@ -26,15 +26,8 @@
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/stat.h>
#include <sys/malloc.h>
#include <sys/device.h>
#include <sys/syslog.h>
#include <sys/pool.h> #include <sys/pool.h>
#include <machine/bus.h>
#include <dev/ata/atareg.h> #include <dev/ata/atareg.h>
#include <dev/ata/atavar.h> #include <dev/ata/atavar.h>
#include <dev/ic/wdcreg.h> #include <dev/ic/wdcreg.h>

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ata_wdc.c,v 1.52 2018/11/02 09:59:36 fcambus Exp $ */ /* $OpenBSD: ata_wdc.c,v 1.53 2024/05/26 10:01:01 jsg Exp $ */
/* $NetBSD: ata_wdc.c,v 1.21 1999/08/09 09:43:11 bouyer Exp $ */ /* $NetBSD: ata_wdc.c,v 1.21 1999/08/09 09:43:11 bouyer Exp $ */
/* /*
@ -57,16 +57,12 @@
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/buf.h> #include <sys/buf.h>
#include <sys/malloc.h>
#include <sys/device.h> #include <sys/device.h>
#include <sys/disklabel.h> #include <sys/disklabel.h>
#include <sys/disk.h> #include <sys/disk.h>
#include <sys/syslog.h>
#include <machine/intr.h>
#include <machine/bus.h> #include <machine/bus.h>
#include <dev/ata/atavar.h> #include <dev/ata/atavar.h>

View file

@ -1,4 +1,4 @@
/* $OpenBSD: atascsi.c,v 1.154 2024/05/13 01:15:50 jsg Exp $ */ /* $OpenBSD: atascsi.c,v 1.155 2024/05/26 10:01:01 jsg Exp $ */
/* /*
* Copyright (c) 2007 David Gwynne <dlg@openbsd.org> * Copyright (c) 2007 David Gwynne <dlg@openbsd.org>
@ -20,11 +20,8 @@
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
#include <sys/buf.h>
#include <sys/kernel.h>
#include <sys/malloc.h> #include <sys/malloc.h>
#include <sys/device.h> #include <sys/device.h>
#include <sys/queue.h>
#include <sys/pool.h> #include <sys/pool.h>
#include <scsi/scsi_all.h> #include <scsi/scsi_all.h>

View file

@ -1,4 +1,4 @@
/* $OpenBSD: wd.c,v 1.130 2022/10/23 14:39:19 krw Exp $ */ /* $OpenBSD: wd.c,v 1.131 2024/05/26 10:01:01 jsg Exp $ */
/* $NetBSD: wd.c,v 1.193 1999/02/28 17:15:27 explorer Exp $ */ /* $NetBSD: wd.c,v 1.193 1999/02/28 17:15:27 explorer Exp $ */
/* /*
@ -60,12 +60,9 @@
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/conf.h> #include <sys/conf.h>
#include <sys/fcntl.h> #include <sys/fcntl.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/mutex.h>
#include <sys/buf.h> #include <sys/buf.h>
#include <sys/uio.h> #include <sys/uio.h>
#include <sys/malloc.h> #include <sys/malloc.h>
@ -74,7 +71,6 @@
#include <sys/disk.h> #include <sys/disk.h>
#include <sys/syslog.h> #include <sys/syslog.h>
#include <sys/timeout.h> #include <sys/timeout.h>
#include <sys/vnode.h>
#include <sys/dkio.h> #include <sys/dkio.h>
#include <sys/reboot.h> #include <sys/reboot.h>

View file

@ -1,4 +1,4 @@
/* $OpenBSD: atapiscsi.c,v 1.120 2022/04/16 19:19:58 naddy Exp $ */ /* $OpenBSD: atapiscsi.c,v 1.121 2024/05/26 10:01:01 jsg Exp $ */
/* /*
* This code is derived from code with the copyright below. * This code is derived from code with the copyright below.
@ -30,19 +30,12 @@
* *
*/ */
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
#include <sys/kernel.h> #include <sys/kernel.h>
#include <sys/device.h> #include <sys/device.h>
#include <sys/buf.h>
#include <sys/disklabel.h>
#include <sys/malloc.h>
#include <sys/reboot.h>
#include <sys/ioctl.h>
#include <sys/timeout.h> #include <sys/timeout.h>
#include <scsi/scsi_all.h> #include <scsi/scsi_all.h>
#include <scsi/scsi_disk.h>
#include <scsi/scsi_tape.h> #include <scsi/scsi_tape.h>
#include <scsi/scsiconf.h> #include <scsi/scsiconf.h>
@ -134,9 +127,6 @@ void wdc_atapi_reset_2(struct channel_softc *, struct wdc_xfer *,
void wdc_atapi_tape_done(struct channel_softc *, struct wdc_xfer *, void wdc_atapi_tape_done(struct channel_softc *, struct wdc_xfer *,
int, struct atapi_return_args *); int, struct atapi_return_args *);
struct atapiscsi_softc;
struct atapiscsi_xfer;
int atapiscsi_match(struct device *, void *, void *); int atapiscsi_match(struct device *, void *, void *);
void atapiscsi_attach(struct device *, struct device *, void *); void atapiscsi_attach(struct device *, struct device *, void *);
int atapiscsi_activate(struct device *, int); int atapiscsi_activate(struct device *, int);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: bcm2835_mbox.c,v 1.4 2022/08/27 20:31:45 mglocker Exp $ */ /* $OpenBSD: bcm2835_mbox.c,v 1.5 2024/05/28 09:19:04 claudio Exp $ */
/* /*
* Copyright (c) 2020 Tobias Heider <tobhe@openbsd.org> * Copyright (c) 2020 Tobias Heider <tobhe@openbsd.org>
@ -153,15 +153,6 @@ bcmmbox_attach(struct device *parent, struct device *self, void *aux)
printf("\n"); printf("\n");
bcmmbox_write(BCMMBOX_CHANPM, (
(1 << VCPROP_POWER_SDCARD) |
(1 << VCPROP_POWER_UART0) |
(1 << VCPROP_POWER_USB) |
(1 << VCPROP_POWER_I2C0) |
(1 << VCPROP_POWER_I2C1) |
(1 << VCPROP_POWER_SPI) |
0) << 4);
return; return;
clean_dmamap: clean_dmamap:

View file

@ -1,4 +1,4 @@
/* $OpenBSD: dwmshc.c,v 1.5 2023/06/20 09:26:36 kettenis Exp $ */ /* $OpenBSD: dwmshc.c,v 1.7 2024/05/26 22:04:52 kettenis Exp $ */
/* /*
* Copyright (c) 2023 David Gwynne <dlg@openbsd.org> * Copyright (c) 2023 David Gwynne <dlg@openbsd.org>

View file

@ -1,4 +1,4 @@
/* $OpenBSD: fanpwr.c,v 1.8 2023/11/12 12:41:43 patrick Exp $ */ /* $OpenBSD: fanpwr.c,v 1.10 2024/05/26 22:04:52 kettenis Exp $ */
/* /*
* Copyright (c) 2018 Mark Kettenis <kettenis@openbsd.org> * Copyright (c) 2018 Mark Kettenis <kettenis@openbsd.org>
* *

View file

@ -1,4 +1,4 @@
/* $OpenBSD: rkpmic.c,v 1.15 2024/05/12 20:02:13 kettenis Exp $ */ /* $OpenBSD: rkpmic.c,v 1.17 2024/05/26 18:06:21 kettenis Exp $ */
/* /*
* Copyright (c) 2017 Mark Kettenis <kettenis@openbsd.org> * Copyright (c) 2017 Mark Kettenis <kettenis@openbsd.org>
* *
@ -76,7 +76,8 @@ struct rkpmic_vsel_range {
struct rkpmic_regdata { struct rkpmic_regdata {
const char *name; const char *name;
uint8_t reg, mask; uint8_t vreg, vmask;
uint8_t sreg, smask;
const struct rkpmic_vsel_range *vsel_range; const struct rkpmic_vsel_range *vsel_range;
}; };
@ -112,12 +113,12 @@ const struct rkpmic_vsel_range rk805_vsel_range3[] = {
}; };
const struct rkpmic_regdata rk805_regdata[] = { const struct rkpmic_regdata rk805_regdata[] = {
{ "DCDC_REG1", 0x2f, 0x3f, rk805_vsel_range1 }, { "DCDC_REG1", 0x2f, 0x3f, 0, 0, rk805_vsel_range1 },
{ "DCDC_REG2", 0x33, 0x3f, rk805_vsel_range1 }, { "DCDC_REG2", 0x33, 0x3f, 0, 0, rk805_vsel_range1 },
{ "DCDC_REG4", 0x38, 0x1f, rk805_vsel_range2 }, { "DCDC_REG4", 0x38, 0x1f, 0, 0, rk805_vsel_range2 },
{ "LDO_REG1", 0x3b, 0x1f, rk805_vsel_range3 }, { "LDO_REG1", 0x3b, 0x1f, 0, 0, rk805_vsel_range3 },
{ "LDO_REG2", 0x3d, 0x1f, rk805_vsel_range3 }, { "LDO_REG2", 0x3d, 0x1f, 0, 0, rk805_vsel_range3 },
{ "LDO_REG3", 0x3f, 0x1f, rk805_vsel_range3 }, { "LDO_REG3", 0x3f, 0x1f, 0, 0, rk805_vsel_range3 },
{ } { }
}; };
@ -146,27 +147,27 @@ const struct rkpmic_vsel_range rk806_vsel_range2[] = {
}; };
const struct rkpmic_regdata rk806_regdata[] = { const struct rkpmic_regdata rk806_regdata[] = {
{ "dcdc-reg1", 0x1a, 0xff, rk806_vsel_range1 }, { "dcdc-reg1", 0x1a, 0xff, 0, 0, rk806_vsel_range1 },
{ "dcdc-reg2", 0x1b, 0xff, rk806_vsel_range1 }, { "dcdc-reg2", 0x1b, 0xff, 0, 0, rk806_vsel_range1 },
{ "dcdc-reg3", 0x1c, 0xff, rk806_vsel_range1 }, { "dcdc-reg3", 0x1c, 0xff, 0, 0, rk806_vsel_range1 },
{ "dcdc-reg4", 0x1d, 0xff, rk806_vsel_range1 }, { "dcdc-reg4", 0x1d, 0xff, 0, 0, rk806_vsel_range1 },
{ "dcdc-reg5", 0x1e, 0xff, rk806_vsel_range1 }, { "dcdc-reg5", 0x1e, 0xff, 0, 0, rk806_vsel_range1 },
{ "dcdc-reg6", 0x1f, 0xff, rk806_vsel_range1 }, { "dcdc-reg6", 0x1f, 0xff, 0, 0, rk806_vsel_range1 },
{ "dcdc-reg7", 0x20, 0xff, rk806_vsel_range1 }, { "dcdc-reg7", 0x20, 0xff, 0, 0, rk806_vsel_range1 },
{ "dcdc-reg8", 0x21, 0xff, rk806_vsel_range1 }, { "dcdc-reg8", 0x21, 0xff, 0, 0, rk806_vsel_range1 },
{ "dcdc-reg9", 0x22, 0xff, rk806_vsel_range1 }, { "dcdc-reg9", 0x22, 0xff, 0, 0, rk806_vsel_range1 },
{ "dcdc-reg10", 0x23, 0xff, rk806_vsel_range1 }, { "dcdc-reg10", 0x23, 0xff, 0, 0, rk806_vsel_range1 },
{ "nldo-reg1", 0x43, 0xff, rk806_vsel_range2 }, { "nldo-reg1", 0x43, 0xff, 0, 0, rk806_vsel_range2 },
{ "nldo-reg2", 0x44, 0xff, rk806_vsel_range2 }, { "nldo-reg2", 0x44, 0xff, 0, 0, rk806_vsel_range2 },
{ "nldo-reg3", 0x45, 0xff, rk806_vsel_range2 }, { "nldo-reg3", 0x45, 0xff, 0, 0, rk806_vsel_range2 },
{ "nldo-reg4", 0x46, 0xff, rk806_vsel_range2 }, { "nldo-reg4", 0x46, 0xff, 0, 0, rk806_vsel_range2 },
{ "nldo-reg5", 0x47, 0xff, rk806_vsel_range2 }, { "nldo-reg5", 0x47, 0xff, 0, 0, rk806_vsel_range2 },
{ "pldo-reg1", 0x4e, 0xff, rk806_vsel_range2 }, { "pldo-reg1", 0x4e, 0xff, 0, 0, rk806_vsel_range2 },
{ "pldo-reg2", 0x4f, 0xff, rk806_vsel_range2 }, { "pldo-reg2", 0x4f, 0xff, 0, 0, rk806_vsel_range2 },
{ "pldo-reg3", 0x50, 0xff, rk806_vsel_range2 }, { "pldo-reg3", 0x50, 0xff, 0, 0, rk806_vsel_range2 },
{ "pldo-reg4", 0x51, 0xff, rk806_vsel_range2 }, { "pldo-reg4", 0x51, 0xff, 0, 0, rk806_vsel_range2 },
{ "pldo-reg5", 0x52, 0xff, rk806_vsel_range2 }, { "pldo-reg5", 0x52, 0xff, 0, 0, rk806_vsel_range2 },
{ "pldo-reg6", 0x53, 0xff, rk806_vsel_range2 }, { "pldo-reg6", 0x53, 0xff, 0, 0, rk806_vsel_range2 },
{ } { }
}; };
@ -220,17 +221,17 @@ const struct rkpmic_vsel_range rk808_vsel_range5[] = {
}; };
const struct rkpmic_regdata rk808_regdata[] = { const struct rkpmic_regdata rk808_regdata[] = {
{ "DCDC_REG1", 0x2f, 0x3f, rk808_vsel_range1 }, { "DCDC_REG1", 0x2f, 0x3f, 0, 0, rk808_vsel_range1 },
{ "DCDC_REG2", 0x33, 0x3f, rk808_vsel_range1 }, { "DCDC_REG2", 0x33, 0x3f, 0, 0, rk808_vsel_range1 },
{ "DCDC_REG4", 0x38, 0x0f, rk808_vsel_range2 }, { "DCDC_REG4", 0x38, 0x0f, 0, 0, rk808_vsel_range2 },
{ "LDO_REG1", 0x3b, 0x1f, rk808_vsel_range3 }, { "LDO_REG1", 0x3b, 0x1f, 0, 0, rk808_vsel_range3 },
{ "LDO_REG2", 0x3d, 0x1f, rk808_vsel_range3 }, { "LDO_REG2", 0x3d, 0x1f, 0, 0, rk808_vsel_range3 },
{ "LDO_REG3", 0x3f, 0x0f, rk808_vsel_range4 }, { "LDO_REG3", 0x3f, 0x0f, 0, 0, rk808_vsel_range4 },
{ "LDO_REG4", 0x41, 0x1f, rk808_vsel_range3 }, { "LDO_REG4", 0x41, 0x1f, 0, 0, rk808_vsel_range3 },
{ "LDO_REG5", 0x43, 0x1f, rk808_vsel_range3 }, { "LDO_REG5", 0x43, 0x1f, 0, 0, rk808_vsel_range3 },
{ "LDO_REG6", 0x45, 0x1f, rk808_vsel_range5 }, { "LDO_REG6", 0x45, 0x1f, 0, 0, rk808_vsel_range5 },
{ "LDO_REG7", 0x47, 0x1f, rk808_vsel_range5 }, { "LDO_REG7", 0x47, 0x1f, 0, 0, rk808_vsel_range5 },
{ "LDO_REG8", 0x49, 0x1f, rk808_vsel_range3 }, { "LDO_REG8", 0x49, 0x1f, 0, 0, rk808_vsel_range3 },
{ } { }
}; };
@ -281,20 +282,22 @@ const struct rkpmic_vsel_range rk809_vsel_range4[] = {
}; };
const struct rkpmic_regdata rk809_regdata[] = { const struct rkpmic_regdata rk809_regdata[] = {
{ "DCDC_REG1", 0xbb, 0x7f, rk809_vsel_range1 }, { "DCDC_REG1", 0xbb, 0x7f, 0xb5, 0x01, rk809_vsel_range1 },
{ "DCDC_REG2", 0xbe, 0x7f, rk809_vsel_range1 }, { "DCDC_REG2", 0xbe, 0x7f, 0xb5, 0x02, rk809_vsel_range1 },
{ "DCDC_REG3", 0xc1, 0x7f, rk809_vsel_range1 }, { "DCDC_REG3", 0xc1, 0x7f, 0xb5, 0x04, rk809_vsel_range1 },
{ "DCDC_REG4", 0xc4, 0x7f, rk809_vsel_range2 }, { "DCDC_REG4", 0xc4, 0x7f, 0xb5, 0x08, rk809_vsel_range2 },
{ "DCDC_REG5", 0xde, 0x0f, rk809_vsel_range3}, { "DCDC_REG5", 0xde, 0x0f, 0xb5, 0x20, rk809_vsel_range3 },
{ "LDO_REG1", 0xcc, 0x7f, rk809_vsel_range4 }, { "LDO_REG1", 0xcc, 0x7f, 0xb6, 0x01, rk809_vsel_range4 },
{ "LDO_REG2", 0xce, 0x7f, rk809_vsel_range4 }, { "LDO_REG2", 0xce, 0x7f, 0xb6, 0x02, rk809_vsel_range4 },
{ "LDO_REG3", 0xd0, 0x7f, rk809_vsel_range4 }, { "LDO_REG3", 0xd0, 0x7f, 0xb6, 0x04, rk809_vsel_range4 },
{ "LDO_REG4", 0xd2, 0x7f, rk809_vsel_range4 }, { "LDO_REG4", 0xd2, 0x7f, 0xb6, 0x08, rk809_vsel_range4 },
{ "LDO_REG5", 0xd4, 0x7f, rk809_vsel_range4 }, { "LDO_REG5", 0xd4, 0x7f, 0xb6, 0x10, rk809_vsel_range4 },
{ "LDO_REG6", 0xd6, 0x7f, rk809_vsel_range4 }, { "LDO_REG6", 0xd6, 0x7f, 0xb6, 0x20, rk809_vsel_range4 },
{ "LDO_REG7", 0xd8, 0x7f, rk809_vsel_range4 }, { "LDO_REG7", 0xd8, 0x7f, 0xb6, 0x40, rk809_vsel_range4 },
{ "LDO_REG8", 0xda, 0x7f, rk809_vsel_range4 }, { "LDO_REG8", 0xda, 0x7f, 0xb6, 0x80, rk809_vsel_range4 },
{ "LDO_REG9", 0xdc, 0x7f, rk809_vsel_range4 }, { "LDO_REG9", 0xdc, 0x7f, 0xb5, 0x10, rk809_vsel_range4 },
{ "SWITCH_REG1", 0, 0, 0xb5, 0x40, NULL },
{ "SWITCH_REG2", 0, 0, 0xb5, 0x80, NULL },
{ } { }
}; };
@ -308,20 +311,20 @@ const struct rkpmic_vsel_range rk817_boost_range[] = {
}; };
const struct rkpmic_regdata rk817_regdata[] = { const struct rkpmic_regdata rk817_regdata[] = {
{ "DCDC_REG1", 0xbb, 0x7f, rk809_vsel_range1 }, { "DCDC_REG1", 0xbb, 0x7f, 0, 0, rk809_vsel_range1 },
{ "DCDC_REG2", 0xbe, 0x7f, rk809_vsel_range1 }, { "DCDC_REG2", 0xbe, 0x7f, 0, 0, rk809_vsel_range1 },
{ "DCDC_REG3", 0xc1, 0x7f, rk809_vsel_range1 }, { "DCDC_REG3", 0xc1, 0x7f, 0, 0, rk809_vsel_range1 },
{ "DCDC_REG4", 0xc4, 0x7f, rk809_vsel_range2 }, { "DCDC_REG4", 0xc4, 0x7f, 0, 0, rk809_vsel_range2 },
{ "LDO_REG1", 0xcc, 0x7f, rk809_vsel_range4 }, { "LDO_REG1", 0xcc, 0x7f, 0, 0, rk809_vsel_range4 },
{ "LDO_REG2", 0xce, 0x7f, rk809_vsel_range4 }, { "LDO_REG2", 0xce, 0x7f, 0, 0, rk809_vsel_range4 },
{ "LDO_REG3", 0xd0, 0x7f, rk809_vsel_range4 }, { "LDO_REG3", 0xd0, 0x7f, 0, 0, rk809_vsel_range4 },
{ "LDO_REG4", 0xd2, 0x7f, rk809_vsel_range4 }, { "LDO_REG4", 0xd2, 0x7f, 0, 0, rk809_vsel_range4 },
{ "LDO_REG5", 0xd4, 0x7f, rk809_vsel_range4 }, { "LDO_REG5", 0xd4, 0x7f, 0, 0, rk809_vsel_range4 },
{ "LDO_REG6", 0xd6, 0x7f, rk809_vsel_range4 }, { "LDO_REG6", 0xd6, 0x7f, 0, 0, rk809_vsel_range4 },
{ "LDO_REG7", 0xd8, 0x7f, rk809_vsel_range4 }, { "LDO_REG7", 0xd8, 0x7f, 0, 0, rk809_vsel_range4 },
{ "LDO_REG8", 0xda, 0x7f, rk809_vsel_range4 }, { "LDO_REG8", 0xda, 0x7f, 0, 0, rk809_vsel_range4 },
{ "LDO_REG9", 0xdc, 0x7f, rk809_vsel_range4 }, { "LDO_REG9", 0xdc, 0x7f, 0, 0, rk809_vsel_range4 },
{ "BOOST", 0xde, 0x07, rk817_boost_range }, { "BOOST", 0xde, 0x07, 0, 0, rk817_boost_range },
{ } { }
}; };
@ -531,6 +534,7 @@ rkpmic_activate(struct device *self, int act)
val &= ~RK809_PMIC_SYS_CFG3_SLP_FUN_MASK; val &= ~RK809_PMIC_SYS_CFG3_SLP_FUN_MASK;
val |= RK809_PMIC_SYS_CFG3_SLP_FUN_NONE; val |= RK809_PMIC_SYS_CFG3_SLP_FUN_NONE;
rkpmic_reg_write(sc, RK809_PMIC_SYS_CFG3, val); rkpmic_reg_write(sc, RK809_PMIC_SYS_CFG3, val);
rkpmic_reg_write(sc, RK809_PMIC_INT_STS0, 0xff);
} }
break; break;
} }
@ -556,7 +560,7 @@ rkpmic_intr(void *arg)
struct rkpmic_regulator { struct rkpmic_regulator {
struct rkpmic_softc *rr_sc; struct rkpmic_softc *rr_sc;
uint8_t rr_reg, rr_mask; uint8_t rr_vreg, rr_vmask;
const struct rkpmic_vsel_range *rr_vsel_range; const struct rkpmic_vsel_range *rr_vsel_range;
struct regulator_device rr_rd; struct regulator_device rr_rd;
@ -564,13 +568,16 @@ struct rkpmic_regulator {
uint32_t rkpmic_get_voltage(void *); uint32_t rkpmic_get_voltage(void *);
int rkpmic_set_voltage(void *, uint32_t); int rkpmic_set_voltage(void *, uint32_t);
int rkpmic_do_set_voltage(struct rkpmic_regulator *, uint32_t, int);
void void
rkpmic_attach_regulator(struct rkpmic_softc *sc, int node) rkpmic_attach_regulator(struct rkpmic_softc *sc, int node)
{ {
struct rkpmic_regulator *rr; struct rkpmic_regulator *rr;
char name[32]; char name[32];
int i; uint32_t voltage;
int i, snode;
uint8_t val;
name[0] = 0; name[0] = 0;
OF_getprop(node, "name", name, sizeof(name)); OF_getprop(node, "name", name, sizeof(name));
@ -585,8 +592,8 @@ rkpmic_attach_regulator(struct rkpmic_softc *sc, int node)
rr = malloc(sizeof(*rr), M_DEVBUF, M_WAITOK | M_ZERO); rr = malloc(sizeof(*rr), M_DEVBUF, M_WAITOK | M_ZERO);
rr->rr_sc = sc; rr->rr_sc = sc;
rr->rr_reg = sc->sc_regdata[i].reg; rr->rr_vreg = sc->sc_regdata[i].vreg;
rr->rr_mask = sc->sc_regdata[i].mask; rr->rr_vmask = sc->sc_regdata[i].vmask;
rr->rr_vsel_range = sc->sc_regdata[i].vsel_range; rr->rr_vsel_range = sc->sc_regdata[i].vsel_range;
rr->rr_rd.rd_node = node; rr->rr_rd.rd_node = node;
@ -594,6 +601,25 @@ rkpmic_attach_regulator(struct rkpmic_softc *sc, int node)
rr->rr_rd.rd_get_voltage = rkpmic_get_voltage; rr->rr_rd.rd_get_voltage = rkpmic_get_voltage;
rr->rr_rd.rd_set_voltage = rkpmic_set_voltage; rr->rr_rd.rd_set_voltage = rkpmic_set_voltage;
regulator_register(&rr->rr_rd); regulator_register(&rr->rr_rd);
if (sc->sc_regdata[i].smask) {
snode = OF_getnodebyname(node, "regulator-state-mem");
if (snode) {
val = rkpmic_reg_read(sc, sc->sc_regdata[i].sreg);
if (OF_getpropbool(snode, "regulator-on-in-suspend"))
val |= sc->sc_regdata[i].smask;
if (OF_getpropbool(snode, "regulator-off-in-suspend"))
val &= ~sc->sc_regdata[i].smask;
rkpmic_reg_write(sc, sc->sc_regdata[i].sreg, val);
voltage = OF_getpropint(snode,
"regulator-suspend-min-microvolt", 0);
voltage = OF_getpropint(snode,
"regulator-suspend-microvolt", voltage);
if (voltage > 0)
rkpmic_do_set_voltage(rr, voltage, 1);
}
}
} }
uint32_t uint32_t
@ -604,7 +630,10 @@ rkpmic_get_voltage(void *cookie)
uint8_t vsel; uint8_t vsel;
uint32_t ret = 0; uint32_t ret = 0;
vsel = rkpmic_reg_read(rr->rr_sc, rr->rr_reg) & rr->rr_mask; if (vsel_range == NULL)
return 0;
vsel = rkpmic_reg_read(rr->rr_sc, rr->rr_vreg) & rr->rr_vmask;
while (vsel_range->base) { while (vsel_range->base) {
ret = vsel_range->base; ret = vsel_range->base;
@ -626,11 +655,19 @@ rkpmic_get_voltage(void *cookie)
int int
rkpmic_set_voltage(void *cookie, uint32_t voltage) rkpmic_set_voltage(void *cookie, uint32_t voltage)
{ {
struct rkpmic_regulator *rr = cookie; return rkpmic_do_set_voltage(cookie, voltage, 0);
}
int
rkpmic_do_set_voltage(struct rkpmic_regulator *rr, uint32_t voltage, int sleep)
{
const struct rkpmic_vsel_range *vsel_range = rr->rr_vsel_range; const struct rkpmic_vsel_range *vsel_range = rr->rr_vsel_range;
uint32_t vmin, vmax, volt; uint32_t vmin, vmax, volt;
uint8_t reg, vsel; uint8_t reg, vsel;
if (vsel_range == NULL)
return ENODEV;
while (vsel_range->base) { while (vsel_range->base) {
vmin = vsel_range->base; vmin = vsel_range->base;
vmax = vmin + (vsel_range->vsel_max - vsel_range->vsel_min) * vmax = vmin + (vsel_range->vsel_max - vsel_range->vsel_min) *
@ -658,10 +695,10 @@ rkpmic_set_voltage(void *cookie, uint32_t voltage)
if (vsel_range->base == 0) if (vsel_range->base == 0)
return EINVAL; return EINVAL;
reg = rkpmic_reg_read(rr->rr_sc, rr->rr_reg); reg = rkpmic_reg_read(rr->rr_sc, rr->rr_vreg + sleep);
reg &= ~rr->rr_mask; reg &= ~rr->rr_vmask;
reg |= vsel; reg |= vsel;
rkpmic_reg_write(rr->rr_sc, rr->rr_reg, reg); rkpmic_reg_write(rr->rr_sc, rr->rr_vreg + sleep, reg);
return 0; return 0;
} }

View file

@ -1,4 +1,4 @@
/* $OpenBSD: pca9532.c,v 1.4 2022/04/06 18:59:28 naddy Exp $ */ /* $OpenBSD: pca9532.c,v 1.5 2024/05/28 13:21:13 jsg Exp $ */
/* /*
* Copyright (c) 2006 Dale Rahn <drahn@openbsd.org> * Copyright (c) 2006 Dale Rahn <drahn@openbsd.org>
* *
@ -48,8 +48,8 @@ struct pcaled_softc {
int pcaled_match(struct device *, void *, void *); int pcaled_match(struct device *, void *, void *);
void pcaled_attach(struct device *, struct device *, void *); void pcaled_attach(struct device *, struct device *, void *);
int pcaled_gpio_pin_read(void *arg, int pin); int pcaled_gpio_pin_read(void *arg, int pin);
void pcaled_gpio_pin_write (void *arg, int pin, int value); void pcaled_gpio_pin_write(void *arg, int pin, int value);
void pcaled_gpio_pin_ctl (void *arg, int pin, int flags); void pcaled_gpio_pin_ctl(void *arg, int pin, int flags);
const struct cfattach pcaled_ca = { const struct cfattach pcaled_ca = {
sizeof(struct pcaled_softc), pcaled_match, pcaled_attach sizeof(struct pcaled_softc), pcaled_match, pcaled_attach
@ -150,7 +150,7 @@ fail:
} }
void void
pcaled_gpio_pin_write (void *arg, int pin, int value) pcaled_gpio_pin_write(void *arg, int pin, int value)
{ {
struct pcaled_softc *sc = arg; struct pcaled_softc *sc = arg;
uint8_t cmd, data; uint8_t cmd, data;
@ -177,7 +177,7 @@ fail:
} }
void void
pcaled_gpio_pin_ctl (void *arg, int pin, int flags) pcaled_gpio_pin_ctl(void *arg, int pin, int flags)
{ {
/* XXX all pins are inout */ /* XXX all pins are inout */
} }

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ahci.c,v 1.40 2024/04/23 13:09:21 jsg Exp $ */ /* $OpenBSD: ahci.c,v 1.41 2024/05/28 01:37:53 jsg Exp $ */
/* /*
* Copyright (c) 2006 David Gwynne <dlg@openbsd.org> * Copyright (c) 2006 David Gwynne <dlg@openbsd.org>
@ -2350,9 +2350,9 @@ failall:
sizeof(struct ata_fis_d2h)); sizeof(struct ata_fis_d2h));
} }
ccb->ccb_done(ccb);
processed |= 1 << ccb->ccb_slot; processed |= 1 << ccb->ccb_slot;
ccb->ccb_done(ccb);
} }
if (need_restart) { if (need_restart) {

View file

@ -1,4 +1,4 @@
/* $OpenBSD: nvme.c,v 1.112 2024/05/24 12:04:07 krw Exp $ */ /* $OpenBSD: nvme.c,v 1.115 2024/05/28 00:24:44 jsg Exp $ */
/* /*
* Copyright (c) 2014 David Gwynne <dlg@openbsd.org> * Copyright (c) 2014 David Gwynne <dlg@openbsd.org>
@ -156,6 +156,7 @@ static const struct nvme_ops nvme_ops = {
}; };
#define NVME_TIMO_QOP 5000 /* ms to create/delete queue */ #define NVME_TIMO_QOP 5000 /* ms to create/delete queue */
#define NVME_TIMO_PT 5000 /* ms to complete passthrough */
#define NVME_TIMO_IDENT 10000 /* ms to probe/identify */ #define NVME_TIMO_IDENT 10000 /* ms to probe/identify */
#define NVME_TIMO_DELAYNS 10 /* ns to delay() in poll loop */ #define NVME_TIMO_DELAYNS 10 /* ns to delay() in poll loop */
@ -978,7 +979,7 @@ nvme_passthrough_cmd(struct nvme_softc *sc, struct nvme_pt_cmd *pt, int dv_unit,
nvme_dmamem_sync(sc, mem, BUS_DMASYNC_PREREAD); nvme_dmamem_sync(sc, mem, BUS_DMASYNC_PREREAD);
} }
flags = nvme_poll(sc, sc->sc_admin_q, ccb, nvme_sqe_fill, NVME_TIMO_QOP); flags = nvme_poll(sc, sc->sc_admin_q, ccb, nvme_sqe_fill, NVME_TIMO_PT);
if (pt->pt_databuflen > 0) { if (pt->pt_databuflen > 0) {
nvme_dmamem_sync(sc, mem, BUS_DMASYNC_POSTREAD); nvme_dmamem_sync(sc, mem, BUS_DMASYNC_POSTREAD);
@ -1896,12 +1897,12 @@ nvme_bioctl_sdname(const struct nvme_softc *sc, int target)
const struct sd_softc *sd; const struct sd_softc *sd;
link = scsi_get_link(sc->sc_scsibus, target, 0); link = scsi_get_link(sc->sc_scsibus, target, 0);
if (link) { if (link == NULL)
sd = (struct sd_softc *)(link->device_softc); return NULL;
if (ISSET(link->state, SDEV_S_DYING) || sd == NULL || sd = (struct sd_softc *)(link->device_softc);
ISSET(sd->flags, SDF_DYING)) if (ISSET(link->state, SDEV_S_DYING) || sd == NULL ||
return NULL; ISSET(sd->flags, SDF_DYING))
} return NULL;
if (nvme_read4(sc, NVME_VS) == 0xffffffff) if (nvme_read4(sc, NVME_VS) == 0xffffffff)
return NULL; return NULL;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: qwx.c,v 1.59 2024/05/03 14:32:11 stsp Exp $ */ /* $OpenBSD: qwx.c,v 1.61 2024/05/28 13:02:45 jsg Exp $ */
/* /*
* Copyright 2023 Stefan Sperling <stsp@openbsd.org> * Copyright 2023 Stefan Sperling <stsp@openbsd.org>
@ -152,6 +152,11 @@ int qwx_dp_tx_send_reo_cmd(struct qwx_softc *, struct dp_rx_tid *,
void (*func)(struct qwx_dp *, void *, enum hal_reo_cmd_status)); void (*func)(struct qwx_dp *, void *, enum hal_reo_cmd_status));
void qwx_dp_rx_deliver_msdu(struct qwx_softc *, struct qwx_rx_msdu *); void qwx_dp_rx_deliver_msdu(struct qwx_softc *, struct qwx_rx_msdu *);
void qwx_dp_service_mon_ring(void *); void qwx_dp_service_mon_ring(void *);
void qwx_peer_frags_flush(struct qwx_softc *, struct ath11k_peer *);
int qwx_wmi_vdev_install_key(struct qwx_softc *,
struct wmi_vdev_install_key_arg *, uint8_t);
int qwx_dp_peer_rx_pn_replay_config(struct qwx_softc *, struct qwx_vif *,
struct ieee80211_node *, struct ieee80211_key *, int);
int qwx_scan(struct qwx_softc *); int qwx_scan(struct qwx_softc *);
void qwx_scan_abort(struct qwx_softc *); void qwx_scan_abort(struct qwx_softc *);
@ -178,7 +183,7 @@ qwx_init(struct ifnet *ifp)
struct ieee80211com *ic = &sc->sc_ic; struct ieee80211com *ic = &sc->sc_ic;
sc->fw_mode = ATH11K_FIRMWARE_MODE_NORMAL; sc->fw_mode = ATH11K_FIRMWARE_MODE_NORMAL;
sc->crypto_mode = ATH11K_CRYPT_MODE_SW; sc->crypto_mode = ATH11K_CRYPT_MODE_HW;
sc->frame_mode = ATH11K_HW_TXRX_NATIVE_WIFI; sc->frame_mode = ATH11K_HW_TXRX_NATIVE_WIFI;
ic->ic_state = IEEE80211_S_INIT; ic->ic_state = IEEE80211_S_INIT;
sc->ns_nstate = IEEE80211_S_INIT; sc->ns_nstate = IEEE80211_S_INIT;
@ -283,6 +288,7 @@ qwx_stop(struct ifnet *ifp)
/* Cancel scheduled tasks and let any stale tasks finish up. */ /* Cancel scheduled tasks and let any stale tasks finish up. */
task_del(systq, &sc->init_task); task_del(systq, &sc->init_task);
qwx_del_task(sc, sc->sc_nswq, &sc->newstate_task); qwx_del_task(sc, sc->sc_nswq, &sc->newstate_task);
qwx_del_task(sc, systq, &sc->setkey_task);
refcnt_finalize(&sc->task_refs, "qwxstop"); refcnt_finalize(&sc->task_refs, "qwxstop");
clear_bit(ATH11K_FLAG_CRASH_FLUSH, sc->sc_flags); clear_bit(ATH11K_FLAG_CRASH_FLUSH, sc->sc_flags);
@ -495,6 +501,262 @@ qwx_media_change(struct ifnet *ifp)
return err; return err;
} }
int
qwx_queue_setkey_cmd(struct ieee80211com *ic, struct ieee80211_node *ni,
struct ieee80211_key *k, int cmd)
{
struct qwx_softc *sc = ic->ic_softc;
struct qwx_setkey_task_arg *a;
if (sc->setkey_nkeys >= nitems(sc->setkey_arg) ||
k->k_id > WMI_MAX_KEY_INDEX)
return ENOSPC;
a = &sc->setkey_arg[sc->setkey_cur];
a->ni = ieee80211_ref_node(ni);
a->k = k;
a->cmd = cmd;
sc->setkey_cur = (sc->setkey_cur + 1) % nitems(sc->setkey_arg);
sc->setkey_nkeys++;
qwx_add_task(sc, systq, &sc->setkey_task);
return EBUSY;
}
int
qwx_set_key(struct ieee80211com *ic, struct ieee80211_node *ni,
struct ieee80211_key *k)
{
struct qwx_softc *sc = ic->ic_softc;
if (test_bit(ATH11K_FLAG_HW_CRYPTO_DISABLED, sc->sc_flags) ||
(k->k_cipher != IEEE80211_CIPHER_CCMP &&
k->k_cipher != IEEE80211_CIPHER_TKIP))
return ieee80211_set_key(ic, ni, k);
return qwx_queue_setkey_cmd(ic, ni, k, QWX_ADD_KEY);
}
void
qwx_delete_key(struct ieee80211com *ic, struct ieee80211_node *ni,
struct ieee80211_key *k)
{
struct qwx_softc *sc = ic->ic_softc;
if (test_bit(ATH11K_FLAG_HW_CRYPTO_DISABLED, sc->sc_flags) ||
(k->k_cipher != IEEE80211_CIPHER_CCMP &&
k->k_cipher != IEEE80211_CIPHER_TKIP)) {
ieee80211_delete_key(ic, ni, k);
return;
}
if (ic->ic_state != IEEE80211_S_RUN) {
/* Keys removed implicitly when firmware station is removed. */
return;
}
/*
* net80211 calls us with a NULL node when deleting group keys,
* but firmware expects a MAC address in the command.
*/
if (ni == NULL)
ni = ic->ic_bss;
qwx_queue_setkey_cmd(ic, ni, k, QWX_DEL_KEY);
}
int
qwx_wmi_install_key_cmd(struct qwx_softc *sc, struct qwx_vif *arvif,
uint8_t *macaddr, struct ieee80211_key *k, uint32_t flags,
int delete_key)
{
int ret;
struct wmi_vdev_install_key_arg arg = {
.vdev_id = arvif->vdev_id,
.key_idx = k->k_id,
.key_len = k->k_len,
.key_data = k->k_key,
.key_flags = flags,
.macaddr = macaddr,
};
uint8_t pdev_id = 0; /* TODO: derive pdev ID somehow? */
#ifdef notyet
lockdep_assert_held(&arvif->ar->conf_mutex);
reinit_completion(&ar->install_key_done);
#endif
if (test_bit(ATH11K_FLAG_HW_CRYPTO_DISABLED, sc->sc_flags))
return 0;
if (delete_key) {
arg.key_cipher = WMI_CIPHER_NONE;
arg.key_data = NULL;
} else {
switch (k->k_cipher) {
case IEEE80211_CIPHER_CCMP:
arg.key_cipher = WMI_CIPHER_AES_CCM;
#if 0
/* TODO: Re-check if flag is valid */
key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV_MGMT;
#endif
break;
case IEEE80211_CIPHER_TKIP:
arg.key_cipher = WMI_CIPHER_TKIP;
arg.key_txmic_len = 8;
arg.key_rxmic_len = 8;
break;
#if 0
case WLAN_CIPHER_SUITE_CCMP_256:
arg.key_cipher = WMI_CIPHER_AES_CCM;
break;
case WLAN_CIPHER_SUITE_GCMP:
case WLAN_CIPHER_SUITE_GCMP_256:
arg.key_cipher = WMI_CIPHER_AES_GCM;
break;
#endif
default:
printf("%s: cipher %u is not supported\n",
sc->sc_dev.dv_xname, k->k_cipher);
return EOPNOTSUPP;
}
#if 0
if (test_bit(ATH11K_FLAG_RAW_MODE, &ar->ab->dev_flags))
key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV |
IEEE80211_KEY_FLAG_RESERVE_TAILROOM;
#endif
}
sc->install_key_done = 0;
ret = qwx_wmi_vdev_install_key(sc, &arg, pdev_id);
if (ret)
return ret;
while (!sc->install_key_done) {
ret = tsleep_nsec(&sc->install_key_done, 0, "qwxinstkey",
SEC_TO_NSEC(1));
if (ret) {
printf("%s: install key timeout\n",
sc->sc_dev.dv_xname);
return -1;
}
}
return sc->install_key_status;
}
int
qwx_add_sta_key(struct qwx_softc *sc, struct ieee80211_node *ni,
struct ieee80211_key *k)
{
struct ieee80211com *ic = &sc->sc_ic;
struct qwx_node *nq = (struct qwx_node *)ni;
struct ath11k_peer *peer = &nq->peer;
struct qwx_vif *arvif = TAILQ_FIRST(&sc->vif_list); /* XXX */
int ret = 0;
uint32_t flags = 0;
const int want_keymask = (QWX_NODE_FLAG_HAVE_PAIRWISE_KEY |
QWX_NODE_FLAG_HAVE_GROUP_KEY);
/*
* Flush the fragments cache during key (re)install to
* ensure all frags in the new frag list belong to the same key.
*/
qwx_peer_frags_flush(sc, peer);
if (k->k_flags & IEEE80211_KEY_GROUP)
flags |= WMI_KEY_GROUP;
else
flags |= WMI_KEY_PAIRWISE;
ret = qwx_wmi_install_key_cmd(sc, arvif, ni->ni_macaddr, k, flags, 0);
if (ret) {
printf("%s: installing crypto key failed (%d)\n",
sc->sc_dev.dv_xname, ret);
return ret;
}
ret = qwx_dp_peer_rx_pn_replay_config(sc, arvif, ni, k, 0);
if (ret) {
printf("%s: failed to offload PN replay detection %d\n",
sc->sc_dev.dv_xname, ret);
return ret;
}
if (k->k_flags & IEEE80211_KEY_GROUP)
nq->flags |= QWX_NODE_FLAG_HAVE_GROUP_KEY;
else
nq->flags |= QWX_NODE_FLAG_HAVE_PAIRWISE_KEY;
if ((nq->flags & want_keymask) == want_keymask) {
DPRINTF("marking port %s valid\n",
ether_sprintf(ni->ni_macaddr));
ni->ni_port_valid = 1;
ieee80211_set_link_state(ic, LINK_STATE_UP);
}
return 0;
}
int
qwx_del_sta_key(struct qwx_softc *sc, struct ieee80211_node *ni,
struct ieee80211_key *k)
{
struct qwx_node *nq = (struct qwx_node *)ni;
struct qwx_vif *arvif = TAILQ_FIRST(&sc->vif_list); /* XXX */
int ret = 0;
ret = qwx_wmi_install_key_cmd(sc, arvif, ni->ni_macaddr, k, 0, 1);
if (ret) {
printf("%s: deleting crypto key failed (%d)\n",
sc->sc_dev.dv_xname, ret);
return ret;
}
ret = qwx_dp_peer_rx_pn_replay_config(sc, arvif, ni, k, 1);
if (ret) {
printf("%s: failed to disable PN replay detection %d\n",
sc->sc_dev.dv_xname, ret);
return ret;
}
if (k->k_flags & IEEE80211_KEY_GROUP)
nq->flags &= ~QWX_NODE_FLAG_HAVE_GROUP_KEY;
else
nq->flags &= ~QWX_NODE_FLAG_HAVE_PAIRWISE_KEY;
return 0;
}
void
qwx_setkey_task(void *arg)
{
struct qwx_softc *sc = arg;
struct ieee80211com *ic = &sc->sc_ic;
struct qwx_setkey_task_arg *a;
int err = 0, s = splnet();
while (sc->setkey_nkeys > 0) {
if (err || test_bit(ATH11K_FLAG_CRASH_FLUSH, sc->sc_flags))
break;
a = &sc->setkey_arg[sc->setkey_tail];
KASSERT(a->cmd == QWX_ADD_KEY || a->cmd == QWX_DEL_KEY);
if (ic->ic_state == IEEE80211_S_RUN) {
if (a->cmd == QWX_ADD_KEY)
err = qwx_add_sta_key(sc, a->ni, a->k);
else
err = qwx_del_sta_key(sc, a->ni, a->k);
}
ieee80211_release_node(ic, a->ni);
a->ni = NULL;
a->k = NULL;
sc->setkey_tail = (sc->setkey_tail + 1) %
nitems(sc->setkey_arg);
sc->setkey_nkeys--;
}
refcnt_rele_wake(&sc->task_refs);
splx(s);
}
int int
qwx_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg) qwx_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg)
{ {
@ -510,15 +772,27 @@ qwx_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg)
if (sc->ns_nstate == nstate && nstate != IEEE80211_S_SCAN && if (sc->ns_nstate == nstate && nstate != IEEE80211_S_SCAN &&
nstate != IEEE80211_S_AUTH) nstate != IEEE80211_S_AUTH)
return 0; return 0;
#if 0
if (ic->ic_state == IEEE80211_S_RUN) { if (ic->ic_state == IEEE80211_S_RUN) {
struct qwx_setkey_task_arg *a;
#if 0
qwx_del_task(sc, systq, &sc->ba_task); qwx_del_task(sc, systq, &sc->ba_task);
#endif
qwx_del_task(sc, systq, &sc->setkey_task); qwx_del_task(sc, systq, &sc->setkey_task);
while (sc->setkey_nkeys > 0) {
a = &sc->setkey_arg[sc->setkey_tail];
ieee80211_release_node(ic, a->ni);
a->ni = NULL;
sc->setkey_tail = (sc->setkey_tail + 1) %
nitems(sc->setkey_arg);
sc->setkey_nkeys--;
}
memset(sc->setkey_arg, 0, sizeof(sc->setkey_arg)); memset(sc->setkey_arg, 0, sizeof(sc->setkey_arg));
sc->setkey_cur = sc->setkey_tail = sc->setkey_nkeys = 0; sc->setkey_cur = sc->setkey_tail = sc->setkey_nkeys = 0;
#if 0
qwx_del_task(sc, systq, &sc->bgscan_done_task); qwx_del_task(sc, systq, &sc->bgscan_done_task);
}
#endif #endif
}
sc->ns_nstate = nstate; sc->ns_nstate = nstate;
sc->ns_arg = arg; sc->ns_arg = arg;
@ -636,7 +910,8 @@ struct cfdriver qwx_cd = {
NULL, "qwx", DV_IFNET NULL, "qwx", DV_IFNET
}; };
void qwx_init_wmi_config_qca6390(struct qwx_softc *sc, void
qwx_init_wmi_config_qca6390(struct qwx_softc *sc,
struct target_resource_config *config) struct target_resource_config *config)
{ {
config->num_vdevs = 4; config->num_vdevs = 4;
@ -726,7 +1001,8 @@ qwx_hw_ipq8074_reo_setup(struct qwx_softc *sc)
FIELD_PREP(HAL_REO_DEST_RING_CTRL_HASH_RING_MAP, ring_hash_map)); FIELD_PREP(HAL_REO_DEST_RING_CTRL_HASH_RING_MAP, ring_hash_map));
} }
void qwx_init_wmi_config_ipq8074(struct qwx_softc *sc, void
qwx_init_wmi_config_ipq8074(struct qwx_softc *sc,
struct target_resource_config *config) struct target_resource_config *config)
{ {
config->num_vdevs = sc->num_radios * TARGET_NUM_VDEVS(sc); config->num_vdevs = sc->num_radios * TARGET_NUM_VDEVS(sc);
@ -882,7 +1158,8 @@ qwx_hw_mac_id_to_srng_id_ipq8074(struct ath11k_hw_params *hw, int mac_id)
return 0; return 0;
} }
int qwx_hw_mac_id_to_pdev_id_qca6390(struct ath11k_hw_params *hw, int mac_id) int
qwx_hw_mac_id_to_pdev_id_qca6390(struct ath11k_hw_params *hw, int mac_id)
{ {
return 0; return 0;
} }
@ -893,6 +1170,13 @@ qwx_hw_mac_id_to_srng_id_qca6390(struct ath11k_hw_params *hw, int mac_id)
return mac_id; return mac_id;
} }
int
qwx_hw_ipq8074_rx_desc_get_first_msdu(struct hal_rx_desc *desc)
{
return !!FIELD_GET(RX_MSDU_END_INFO2_FIRST_MSDU,
le32toh(desc->u.ipq8074.msdu_end.info2));
}
uint8_t uint8_t
qwx_hw_ipq8074_rx_desc_get_l3_pad_bytes(struct hal_rx_desc *desc) qwx_hw_ipq8074_rx_desc_get_l3_pad_bytes(struct hal_rx_desc *desc)
{ {
@ -1059,6 +1343,12 @@ qwx_hw_ipq8074_rx_desc_set_msdu_len(struct hal_rx_desc *desc, uint16_t len)
desc->u.ipq8074.msdu_start.info1 = htole32(info); desc->u.ipq8074.msdu_start.info1 = htole32(info);
} }
int
qwx_dp_rx_h_msdu_end_first_msdu(struct qwx_softc *sc, struct hal_rx_desc *desc)
{
return sc->hw_params.hw_ops->rx_desc_get_first_msdu(desc);
}
int int
qwx_hw_ipq8074_rx_desc_mac_addr2_valid(struct hal_rx_desc *desc) qwx_hw_ipq8074_rx_desc_mac_addr2_valid(struct hal_rx_desc *desc)
{ {
@ -1503,7 +1793,8 @@ qwx_hw_ipq8074_mac_from_pdev_id(int pdev_idx)
} }
} }
uint8_t qwx_hw_ipq6018_mac_from_pdev_id(int pdev_idx) uint8_t
qwx_hw_ipq6018_mac_from_pdev_id(int pdev_idx)
{ {
return pdev_idx; return pdev_idx;
} }
@ -1524,7 +1815,9 @@ const struct ath11k_hw_ops ipq8074_ops = {
.mac_id_to_srng_id = qwx_hw_mac_id_to_srng_id_ipq8074, .mac_id_to_srng_id = qwx_hw_mac_id_to_srng_id_ipq8074,
#if notyet #if notyet
.tx_mesh_enable = ath11k_hw_ipq8074_tx_mesh_enable, .tx_mesh_enable = ath11k_hw_ipq8074_tx_mesh_enable,
.rx_desc_get_first_msdu = ath11k_hw_ipq8074_rx_desc_get_first_msdu, #endif
.rx_desc_get_first_msdu = qwx_hw_ipq8074_rx_desc_get_first_msdu,
#if notyet
.rx_desc_get_last_msdu = ath11k_hw_ipq8074_rx_desc_get_last_msdu, .rx_desc_get_last_msdu = ath11k_hw_ipq8074_rx_desc_get_last_msdu,
#endif #endif
.rx_desc_get_l3_pad_bytes = qwx_hw_ipq8074_rx_desc_get_l3_pad_bytes, .rx_desc_get_l3_pad_bytes = qwx_hw_ipq8074_rx_desc_get_l3_pad_bytes,
@ -1576,7 +1869,9 @@ const struct ath11k_hw_ops ipq6018_ops = {
.mac_id_to_srng_id = qwx_hw_mac_id_to_srng_id_ipq8074, .mac_id_to_srng_id = qwx_hw_mac_id_to_srng_id_ipq8074,
#if notyet #if notyet
.tx_mesh_enable = ath11k_hw_ipq8074_tx_mesh_enable, .tx_mesh_enable = ath11k_hw_ipq8074_tx_mesh_enable,
.rx_desc_get_first_msdu = ath11k_hw_ipq8074_rx_desc_get_first_msdu, #endif
.rx_desc_get_first_msdu = qwx_hw_ipq8074_rx_desc_get_first_msdu,
#if notyet
.rx_desc_get_last_msdu = ath11k_hw_ipq8074_rx_desc_get_last_msdu, .rx_desc_get_last_msdu = ath11k_hw_ipq8074_rx_desc_get_last_msdu,
#endif #endif
.rx_desc_get_l3_pad_bytes = qwx_hw_ipq8074_rx_desc_get_l3_pad_bytes, .rx_desc_get_l3_pad_bytes = qwx_hw_ipq8074_rx_desc_get_l3_pad_bytes,
@ -1628,7 +1923,9 @@ const struct ath11k_hw_ops qca6390_ops = {
.mac_id_to_srng_id = qwx_hw_mac_id_to_srng_id_qca6390, .mac_id_to_srng_id = qwx_hw_mac_id_to_srng_id_qca6390,
#if notyet #if notyet
.tx_mesh_enable = ath11k_hw_ipq8074_tx_mesh_enable, .tx_mesh_enable = ath11k_hw_ipq8074_tx_mesh_enable,
.rx_desc_get_first_msdu = ath11k_hw_ipq8074_rx_desc_get_first_msdu, #endif
.rx_desc_get_first_msdu = qwx_hw_ipq8074_rx_desc_get_first_msdu,
#if notyet
.rx_desc_get_last_msdu = ath11k_hw_ipq8074_rx_desc_get_last_msdu, .rx_desc_get_last_msdu = ath11k_hw_ipq8074_rx_desc_get_last_msdu,
#endif #endif
.rx_desc_get_l3_pad_bytes = qwx_hw_ipq8074_rx_desc_get_l3_pad_bytes, .rx_desc_get_l3_pad_bytes = qwx_hw_ipq8074_rx_desc_get_l3_pad_bytes,
@ -1680,7 +1977,9 @@ const struct ath11k_hw_ops qcn9074_ops = {
.mac_id_to_srng_id = qwx_hw_mac_id_to_srng_id_ipq8074, .mac_id_to_srng_id = qwx_hw_mac_id_to_srng_id_ipq8074,
#if notyet #if notyet
.tx_mesh_enable = ath11k_hw_qcn9074_tx_mesh_enable, .tx_mesh_enable = ath11k_hw_qcn9074_tx_mesh_enable,
.rx_desc_get_first_msdu = ath11k_hw_qcn9074_rx_desc_get_first_msdu, #endif
.rx_desc_get_first_msdu = qwx_hw_qcn9074_rx_desc_get_first_msdu,
#if notyet
.rx_desc_get_last_msdu = ath11k_hw_qcn9074_rx_desc_get_last_msdu, .rx_desc_get_last_msdu = ath11k_hw_qcn9074_rx_desc_get_last_msdu,
#endif #endif
.rx_desc_get_l3_pad_bytes = qwx_hw_qcn9074_rx_desc_get_l3_pad_bytes, .rx_desc_get_l3_pad_bytes = qwx_hw_qcn9074_rx_desc_get_l3_pad_bytes,
@ -1732,7 +2031,9 @@ const struct ath11k_hw_ops wcn6855_ops = {
.mac_id_to_srng_id = qwx_hw_mac_id_to_srng_id_qca6390, .mac_id_to_srng_id = qwx_hw_mac_id_to_srng_id_qca6390,
#if notyet #if notyet
.tx_mesh_enable = ath11k_hw_wcn6855_tx_mesh_enable, .tx_mesh_enable = ath11k_hw_wcn6855_tx_mesh_enable,
.rx_desc_get_first_msdu = ath11k_hw_wcn6855_rx_desc_get_first_msdu, #endif
.rx_desc_get_first_msdu = qwx_hw_wcn6855_rx_desc_get_first_msdu,
#if notyet
.rx_desc_get_last_msdu = ath11k_hw_wcn6855_rx_desc_get_last_msdu, .rx_desc_get_last_msdu = ath11k_hw_wcn6855_rx_desc_get_last_msdu,
#endif #endif
.rx_desc_get_l3_pad_bytes = qwx_hw_wcn6855_rx_desc_get_l3_pad_bytes, .rx_desc_get_l3_pad_bytes = qwx_hw_wcn6855_rx_desc_get_l3_pad_bytes,
@ -1784,7 +2085,9 @@ const struct ath11k_hw_ops wcn6750_ops = {
.mac_id_to_srng_id = qwx_hw_mac_id_to_srng_id_qca6390, .mac_id_to_srng_id = qwx_hw_mac_id_to_srng_id_qca6390,
#if notyet #if notyet
.tx_mesh_enable = ath11k_hw_qcn9074_tx_mesh_enable, .tx_mesh_enable = ath11k_hw_qcn9074_tx_mesh_enable,
.rx_desc_get_first_msdu = ath11k_hw_qcn9074_rx_desc_get_first_msdu, #endif
.rx_desc_get_first_msdu = qwx_hw_qcn9074_rx_desc_get_first_msdu,
#if notyet
.rx_desc_get_last_msdu = ath11k_hw_qcn9074_rx_desc_get_last_msdu, .rx_desc_get_last_msdu = ath11k_hw_qcn9074_rx_desc_get_last_msdu,
#endif #endif
.rx_desc_get_l3_pad_bytes = qwx_hw_qcn9074_rx_desc_get_l3_pad_bytes, .rx_desc_get_l3_pad_bytes = qwx_hw_qcn9074_rx_desc_get_l3_pad_bytes,
@ -11826,8 +12129,8 @@ qwx_print_reg_rule(struct qwx_softc *sc, const char *band,
} }
} }
struct cur_reg_rule struct cur_reg_rule *
*qwx_create_reg_rules_from_wmi(uint32_t num_reg_rules, qwx_create_reg_rules_from_wmi(uint32_t num_reg_rules,
struct wmi_regulatory_rule_struct *wmi_reg_rule) struct wmi_regulatory_rule_struct *wmi_reg_rule)
{ {
struct cur_reg_rule *reg_rule_ptr; struct cur_reg_rule *reg_rule_ptr;
@ -12990,6 +13293,84 @@ qwx_roam_event(struct qwx_softc *sc, struct mbuf *m)
} }
} }
int
qwx_pull_vdev_install_key_compl_ev(struct qwx_softc *sc, struct mbuf *m,
struct wmi_vdev_install_key_complete_arg *arg)
{
const void **tb;
const struct wmi_vdev_install_key_compl_event *ev;
int ret;
tb = qwx_wmi_tlv_parse_alloc(sc, mtod(m, void *), m->m_pkthdr.len);
if (tb == NULL) {
ret = ENOMEM;
printf("%s: failed to parse tlv: %d\n",
sc->sc_dev.dv_xname, ret);
return ret;
}
ev = tb[WMI_TAG_VDEV_INSTALL_KEY_COMPLETE_EVENT];
if (!ev) {
printf("%s: failed to fetch vdev install key compl ev\n",
sc->sc_dev.dv_xname);
free(tb, M_DEVBUF, WMI_TAG_MAX * sizeof(*tb));
return EPROTO;
}
arg->vdev_id = ev->vdev_id;
arg->macaddr = ev->peer_macaddr.addr;
arg->key_idx = ev->key_idx;
arg->key_flags = ev->key_flags;
arg->status = ev->status;
free(tb, M_DEVBUF, WMI_TAG_MAX * sizeof(*tb));
return 0;
}
void
qwx_vdev_install_key_compl_event(struct qwx_softc *sc, struct mbuf *m)
{
struct wmi_vdev_install_key_complete_arg install_key_compl = { 0 };
struct qwx_vif *arvif;
if (qwx_pull_vdev_install_key_compl_ev(sc, m,
&install_key_compl) != 0) {
printf("%s: failed to extract install key compl event\n",
sc->sc_dev.dv_xname);
return;
}
DNPRINTF(QWX_D_WMI, "%s: event vdev install key ev idx %d flags %08x "
"macaddr %s status %d\n", __func__, install_key_compl.key_idx,
install_key_compl.key_flags,
ether_sprintf((u_char *)install_key_compl.macaddr),
install_key_compl.status);
TAILQ_FOREACH(arvif, &sc->vif_list, entry) {
if (arvif->vdev_id == install_key_compl.vdev_id)
break;
}
if (!arvif) {
printf("%s: invalid vdev id in install key compl ev %d\n",
sc->sc_dev.dv_xname, install_key_compl.vdev_id);
return;
}
sc->install_key_status = 0;
if (install_key_compl.status !=
WMI_VDEV_INSTALL_KEY_COMPL_STATUS_SUCCESS) {
printf("%s: install key failed for %s status %d\n",
sc->sc_dev.dv_xname,
ether_sprintf((u_char *)install_key_compl.macaddr),
install_key_compl.status);
sc->install_key_status = install_key_compl.status;
}
sc->install_key_done = 1;
wakeup(&sc->install_key_done);
}
void void
qwx_wmi_tlv_op_rx(struct qwx_softc *sc, struct mbuf *m) qwx_wmi_tlv_op_rx(struct qwx_softc *sc, struct mbuf *m)
{ {
@ -13060,10 +13441,10 @@ qwx_wmi_tlv_op_rx(struct qwx_softc *sc, struct mbuf *m)
case WMI_PDEV_BSS_CHAN_INFO_EVENTID: case WMI_PDEV_BSS_CHAN_INFO_EVENTID:
ath11k_pdev_bss_chan_info_event(ab, skb); ath11k_pdev_bss_chan_info_event(ab, skb);
break; break;
case WMI_VDEV_INSTALL_KEY_COMPLETE_EVENTID:
ath11k_vdev_install_key_compl_event(ab, skb);
break;
#endif #endif
case WMI_VDEV_INSTALL_KEY_COMPLETE_EVENTID:
qwx_vdev_install_key_compl_event(sc, m);
break;
case WMI_SERVICE_AVAILABLE_EVENTID: case WMI_SERVICE_AVAILABLE_EVENTID:
qwx_service_available_event(sc, m); qwx_service_available_event(sc, m);
break; break;
@ -15813,6 +16194,16 @@ qwx_dp_rx_get_attention(struct qwx_softc *sc, struct hal_rx_desc *desc)
return sc->hw_params.hw_ops->rx_desc_get_attention(desc); return sc->hw_params.hw_ops->rx_desc_get_attention(desc);
} }
int
qwx_dp_rx_h_attn_is_mcbc(struct qwx_softc *sc, struct hal_rx_desc *desc)
{
struct rx_attention *attn = qwx_dp_rx_get_attention(sc, desc);
return qwx_dp_rx_h_msdu_end_first_msdu(sc, desc) &&
(!!FIELD_GET(RX_ATTENTION_INFO1_MCAST_BCAST,
le32toh(attn->info1)));
}
static inline uint8_t static inline uint8_t
qwx_dp_rx_h_msdu_end_l3pad(struct qwx_softc *sc, struct hal_rx_desc *desc) qwx_dp_rx_h_msdu_end_l3pad(struct qwx_softc *sc, struct hal_rx_desc *desc)
{ {
@ -15873,6 +16264,13 @@ qwx_dp_rx_h_attn_msdu_len_err(struct qwx_softc *sc, struct hal_rx_desc *desc)
return errmap & DP_RX_MPDU_ERR_MSDU_LEN; return errmap & DP_RX_MPDU_ERR_MSDU_LEN;
} }
int
qwx_dp_rx_h_attn_is_decrypted(struct rx_attention *attn)
{
return (FIELD_GET(RX_ATTENTION_INFO2_DCRYPT_STATUS_CODE,
le32toh(attn->info2)) == RX_DESC_DECRYPT_STATUS_CODE_OK);
}
int int
qwx_dp_rx_msdu_coalesce(struct qwx_softc *sc, struct qwx_rx_msdu_list *msdu_list, qwx_dp_rx_msdu_coalesce(struct qwx_softc *sc, struct qwx_rx_msdu_list *msdu_list,
struct qwx_rx_msdu *first, struct qwx_rx_msdu *last, uint8_t l3pad_bytes, struct qwx_rx_msdu *first, struct qwx_rx_msdu *last, uint8_t l3pad_bytes,
@ -15908,7 +16306,13 @@ void
qwx_dp_rx_h_undecap_nwifi(struct qwx_softc *sc, struct qwx_rx_msdu *msdu, qwx_dp_rx_h_undecap_nwifi(struct qwx_softc *sc, struct qwx_rx_msdu *msdu,
uint8_t *first_hdr, enum hal_encrypt_type enctype) uint8_t *first_hdr, enum hal_encrypt_type enctype)
{ {
printf("%s: not implemented\n", __func__); /*
* This function will need to do some work once we are receiving
* aggregated frames. For now, it needs to do nothing.
*/
if (!msdu->is_first_msdu)
printf("%s: not implemented\n", __func__);
} }
void void
@ -16034,28 +16438,28 @@ qwx_dp_rx_h_undecap(struct qwx_softc *sc, struct qwx_rx_msdu *msdu,
} }
} }
int
void
qwx_dp_rx_h_mpdu(struct qwx_softc *sc, struct qwx_rx_msdu *msdu, qwx_dp_rx_h_mpdu(struct qwx_softc *sc, struct qwx_rx_msdu *msdu,
struct hal_rx_desc *rx_desc) struct hal_rx_desc *rx_desc)
{ {
#if 0 struct ieee80211com *ic = &sc->sc_ic;
bool fill_crypto_hdr; int fill_crypto_hdr = 0;
#endif
enum hal_encrypt_type enctype; enum hal_encrypt_type enctype;
int is_decrypted = 0; int is_decrypted = 0;
#if 0 #if 0
struct ath11k_skb_rxcb *rxcb; struct ath11k_skb_rxcb *rxcb;
struct ieee80211_hdr *hdr; #endif
struct ieee80211_frame *wh;
#if 0
struct ath11k_peer *peer; struct ath11k_peer *peer;
#endif
struct rx_attention *rx_attention; struct rx_attention *rx_attention;
u32 err_bitmap; uint32_t err_bitmap;
/* PN for multicast packets will be checked in mac80211 */
rxcb = ATH11K_SKB_RXCB(msdu);
fill_crypto_hdr = ath11k_dp_rx_h_attn_is_mcbc(ar->ab, rx_desc);
rxcb->is_mcbc = fill_crypto_hdr;
/* PN for multicast packets will be checked in net80211 */
fill_crypto_hdr = qwx_dp_rx_h_attn_is_mcbc(sc, rx_desc);
msdu->is_mcbc = fill_crypto_hdr;
#if 0
if (rxcb->is_mcbc) { if (rxcb->is_mcbc) {
rxcb->peer_id = ath11k_dp_rx_h_mpdu_start_peer_id(ar->ab, rx_desc); rxcb->peer_id = ath11k_dp_rx_h_mpdu_start_peer_id(ar->ab, rx_desc);
rxcb->seq_no = ath11k_dp_rx_h_mpdu_start_seq_no(ar->ab, rx_desc); rxcb->seq_no = ath11k_dp_rx_h_mpdu_start_seq_no(ar->ab, rx_desc);
@ -16074,12 +16478,12 @@ qwx_dp_rx_h_mpdu(struct qwx_softc *sc, struct qwx_rx_msdu *msdu,
#if 0 #if 0
} }
spin_unlock_bh(&ar->ab->base_lock); spin_unlock_bh(&ar->ab->base_lock);
#endif
rx_attention = ath11k_dp_rx_get_attention(ar->ab, rx_desc); rx_attention = qwx_dp_rx_get_attention(sc, rx_desc);
err_bitmap = ath11k_dp_rx_h_attn_mpdu_err(rx_attention); err_bitmap = qwx_dp_rx_h_attn_mpdu_err(rx_attention);
if (enctype != HAL_ENCRYPT_TYPE_OPEN && !err_bitmap) if (enctype != HAL_ENCRYPT_TYPE_OPEN && !err_bitmap)
is_decrypted = ath11k_dp_rx_h_attn_is_decrypted(rx_attention); is_decrypted = qwx_dp_rx_h_attn_is_decrypted(rx_attention);
#if 0
/* Clear per-MPDU flags while leaving per-PPDU flags intact */ /* Clear per-MPDU flags while leaving per-PPDU flags intact */
rx_status->flag &= ~(RX_FLAG_FAILED_FCS_CRC | rx_status->flag &= ~(RX_FLAG_FAILED_FCS_CRC |
RX_FLAG_MMIC_ERROR | RX_FLAG_MMIC_ERROR |
@ -16087,12 +16491,23 @@ qwx_dp_rx_h_mpdu(struct qwx_softc *sc, struct qwx_rx_msdu *msdu,
RX_FLAG_IV_STRIPPED | RX_FLAG_IV_STRIPPED |
RX_FLAG_MMIC_STRIPPED); RX_FLAG_MMIC_STRIPPED);
if (err_bitmap & DP_RX_MPDU_ERR_FCS) #endif
rx_status->flag |= RX_FLAG_FAILED_FCS_CRC; if (err_bitmap & DP_RX_MPDU_ERR_FCS) {
if (ic->ic_flags & IEEE80211_F_RSNON)
ic->ic_stats.is_rx_decryptcrc++;
else
ic->ic_stats.is_rx_decap++;
}
/* XXX Trusting firmware to handle Michael MIC counter-measures... */
if (err_bitmap & DP_RX_MPDU_ERR_TKIP_MIC) if (err_bitmap & DP_RX_MPDU_ERR_TKIP_MIC)
rx_status->flag |= RX_FLAG_MMIC_ERROR; ic->ic_stats.is_rx_locmicfail++;
if (err_bitmap & DP_RX_MPDU_ERR_DECRYPT)
ic->ic_stats.is_rx_wepfail++;
if (is_decrypted) { if (is_decrypted) {
#if 0
rx_status->flag |= RX_FLAG_DECRYPTED | RX_FLAG_MMIC_STRIPPED; rx_status->flag |= RX_FLAG_DECRYPTED | RX_FLAG_MMIC_STRIPPED;
if (fill_crypto_hdr) if (fill_crypto_hdr)
@ -16101,21 +16516,23 @@ qwx_dp_rx_h_mpdu(struct qwx_softc *sc, struct qwx_rx_msdu *msdu,
else else
rx_status->flag |= RX_FLAG_IV_STRIPPED | rx_status->flag |= RX_FLAG_IV_STRIPPED |
RX_FLAG_PN_VALIDATED; RX_FLAG_PN_VALIDATED;
#endif
msdu->rxi.rxi_flags |= IEEE80211_RXI_HWDEC;
} }
#if 0
ath11k_dp_rx_h_csum_offload(ar, msdu); ath11k_dp_rx_h_csum_offload(ar, msdu);
#endif #endif
qwx_dp_rx_h_undecap(sc, msdu, rx_desc, enctype, is_decrypted); qwx_dp_rx_h_undecap(sc, msdu, rx_desc, enctype, is_decrypted);
#if 0
if (!is_decrypted || fill_crypto_hdr)
return;
if (ath11k_dp_rx_h_msdu_start_decap_type(ar->ab, rx_desc) != if (is_decrypted && !fill_crypto_hdr &&
qwx_dp_rx_h_msdu_start_decap_type(sc, rx_desc) !=
DP_RX_DECAP_TYPE_ETHERNET2_DIX) { DP_RX_DECAP_TYPE_ETHERNET2_DIX) {
hdr = (void *)msdu->data; /* Hardware has stripped the IV. */
hdr->frame_control &= ~__cpu_to_le16(IEEE80211_FCTL_PROTECTED); wh = mtod(msdu->m, struct ieee80211_frame *);
wh->i_fc[1] &= ~IEEE80211_FC1_PROTECTED;
} }
#endif
return err_bitmap ? EIO : 0;
} }
int int
@ -16189,9 +16606,8 @@ qwx_dp_rx_process_msdu(struct qwx_softc *sc, struct qwx_rx_msdu *msdu,
memset(&msdu->rxi, 0, sizeof(msdu->rxi)); memset(&msdu->rxi, 0, sizeof(msdu->rxi));
qwx_dp_rx_h_ppdu(sc, rx_desc, &msdu->rxi); qwx_dp_rx_h_ppdu(sc, rx_desc, &msdu->rxi);
qwx_dp_rx_h_mpdu(sc, msdu, rx_desc);
return 0; return qwx_dp_rx_h_mpdu(sc, msdu, rx_desc);
} }
void void
@ -18003,6 +18419,65 @@ qwx_wmi_send_peer_delete_cmd(struct qwx_softc *sc, const uint8_t *peer_addr,
return 0; return 0;
} }
int
qwx_wmi_vdev_install_key(struct qwx_softc *sc,
struct wmi_vdev_install_key_arg *arg, uint8_t pdev_id)
{
struct qwx_pdev_wmi *wmi = &sc->wmi.wmi[pdev_id];
struct wmi_vdev_install_key_cmd *cmd;
struct wmi_tlv *tlv;
struct mbuf *m;
int ret, len;
int key_len_aligned = roundup(arg->key_len, sizeof(uint32_t));
len = sizeof(*cmd) + TLV_HDR_SIZE + key_len_aligned;
m = qwx_wmi_alloc_mbuf(len);
if (m == NULL)
return -ENOMEM;
cmd = (struct wmi_vdev_install_key_cmd *)(mtod(m, uint8_t *) +
sizeof(struct ath11k_htc_hdr) + sizeof(struct wmi_cmd_hdr));
cmd->tlv_header = FIELD_PREP(WMI_TLV_TAG,
WMI_TAG_VDEV_INSTALL_KEY_CMD) |
FIELD_PREP(WMI_TLV_LEN, sizeof(*cmd) - TLV_HDR_SIZE);
cmd->vdev_id = arg->vdev_id;
IEEE80211_ADDR_COPY(cmd->peer_macaddr.addr, arg->macaddr);
cmd->key_idx = arg->key_idx;
cmd->key_flags = arg->key_flags;
cmd->key_cipher = arg->key_cipher;
cmd->key_len = arg->key_len;
cmd->key_txmic_len = arg->key_txmic_len;
cmd->key_rxmic_len = arg->key_rxmic_len;
if (arg->key_rsc_counter)
memcpy(&cmd->key_rsc_counter, &arg->key_rsc_counter,
sizeof(struct wmi_key_seq_counter));
tlv = (struct wmi_tlv *)(mtod(m, uint8_t *) +
sizeof(struct ath11k_htc_hdr) + sizeof(struct wmi_cmd_hdr) +
sizeof(*cmd));
tlv->header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_ARRAY_BYTE) |
FIELD_PREP(WMI_TLV_LEN, key_len_aligned);
if (arg->key_data)
memcpy(tlv->value, (uint8_t *)arg->key_data,
key_len_aligned);
ret = qwx_wmi_cmd_send(wmi, m, WMI_VDEV_INSTALL_KEY_CMDID);
if (ret) {
printf("%s: failed to send WMI_VDEV_INSTALL_KEY cmd\n",
sc->sc_dev.dv_xname);
m_freem(m);
return ret;
}
DNPRINTF(QWX_D_WMI,
"%s: cmd vdev install key idx %d cipher %d len %d\n",
__func__, arg->key_idx, arg->key_cipher, arg->key_len);
return ret;
}
void void
qwx_wmi_copy_peer_flags(struct wmi_peer_assoc_complete_cmd *cmd, qwx_wmi_copy_peer_flags(struct wmi_peer_assoc_complete_cmd *cmd,
struct peer_assoc_params *param, int hw_crypto_disabled) struct peer_assoc_params *param, int hw_crypto_disabled)
@ -23302,6 +23777,26 @@ qwx_dp_rx_frags_cleanup(struct qwx_softc *sc, struct dp_rx_tid *rx_tid,
#endif #endif
} }
void
qwx_peer_frags_flush(struct qwx_softc *sc, struct ath11k_peer *peer)
{
struct dp_rx_tid *rx_tid;
int i;
#ifdef notyet
lockdep_assert_held(&ar->ab->base_lock);
#endif
for (i = 0; i < IEEE80211_NUM_TID; i++) {
rx_tid = &peer->rx_tid[i];
qwx_dp_rx_frags_cleanup(sc, rx_tid, 1);
#if 0
spin_unlock_bh(&ar->ab->base_lock);
del_timer_sync(&rx_tid->frag_timer);
spin_lock_bh(&ar->ab->base_lock);
#endif
}
}
void void
qwx_peer_rx_tid_cleanup(struct qwx_softc *sc, struct ath11k_peer *peer) qwx_peer_rx_tid_cleanup(struct qwx_softc *sc, struct ath11k_peer *peer)
{ {
@ -23556,6 +24051,70 @@ peer_clean:
return ret; return ret;
} }
int
qwx_dp_peer_rx_pn_replay_config(struct qwx_softc *sc, struct qwx_vif *arvif,
struct ieee80211_node *ni, struct ieee80211_key *k, int delete_key)
{
struct ath11k_hal_reo_cmd cmd = {0};
struct qwx_node *nq = (struct qwx_node *)ni;
struct ath11k_peer *peer = &nq->peer;
struct dp_rx_tid *rx_tid;
uint8_t tid;
int ret = 0;
/*
* NOTE: Enable PN/TSC replay check offload only for unicast frames.
* We use net80211 PN/TSC replay check functionality for bcast/mcast
* for now.
*/
if (k->k_flags & IEEE80211_KEY_GROUP)
return 0;
cmd.flag |= HAL_REO_CMD_FLG_NEED_STATUS;
cmd.upd0 |= HAL_REO_CMD_UPD0_PN |
HAL_REO_CMD_UPD0_PN_SIZE |
HAL_REO_CMD_UPD0_PN_VALID |
HAL_REO_CMD_UPD0_PN_CHECK |
HAL_REO_CMD_UPD0_SVLD;
switch (k->k_cipher) {
case IEEE80211_CIPHER_TKIP:
case IEEE80211_CIPHER_CCMP:
#if 0
case WLAN_CIPHER_SUITE_CCMP_256:
case WLAN_CIPHER_SUITE_GCMP:
case WLAN_CIPHER_SUITE_GCMP_256:
#endif
if (!delete_key) {
cmd.upd1 |= HAL_REO_CMD_UPD1_PN_CHECK;
cmd.pn_size = 48;
}
break;
default:
printf("%s: cipher %u is not supported\n",
sc->sc_dev.dv_xname, k->k_cipher);
return EOPNOTSUPP;
}
for (tid = 0; tid < IEEE80211_NUM_TID; tid++) {
rx_tid = &peer->rx_tid[tid];
if (!rx_tid->active)
continue;
cmd.addr_lo = rx_tid->paddr & 0xffffffff;
cmd.addr_hi = (rx_tid->paddr >> 32);
ret = qwx_dp_tx_send_reo_cmd(sc, rx_tid,
HAL_REO_CMD_UPDATE_RX_QUEUE, &cmd, NULL);
if (ret) {
printf("%s: failed to configure rx tid %d queue "
"for pn replay detection %d\n",
sc->sc_dev.dv_xname, tid, ret);
break;
}
}
return ret;
}
enum hal_tcl_encap_type enum hal_tcl_encap_type
qwx_dp_tx_get_encap_type(struct qwx_softc *sc) qwx_dp_tx_get_encap_type(struct qwx_softc *sc)
{ {
@ -23676,20 +24235,25 @@ qwx_dp_tx(struct qwx_softc *sc, struct qwx_vif *arvif, uint8_t pdev_id,
ti.meta_data_flags = arvif->tcl_metadata; ti.meta_data_flags = arvif->tcl_metadata;
if (ti.encap_type == HAL_TCL_ENCAP_TYPE_RAW) { if ((wh->i_fc[1] & IEEE80211_FC1_PROTECTED) &&
#if 0 ti.encap_type == HAL_TCL_ENCAP_TYPE_RAW) {
if (skb_cb->flags & ATH11K_SKB_CIPHER_SET) { k = ieee80211_get_txkey(ic, wh, ni);
ti.encrypt_type = switch (k->k_cipher) {
ath11k_dp_tx_get_encrypt_type(skb_cb->cipher); case IEEE80211_CIPHER_CCMP:
ti.encrypt_type = HAL_ENCRYPT_TYPE_CCMP_128;
if (ieee80211_has_protected(hdr->frame_control)) m->m_pkthdr.len += IEEE80211_CCMP_MICLEN;
skb_put(skb, IEEE80211_CCMP_MIC_LEN); break;
} else case IEEE80211_CIPHER_TKIP:
#endif ti.encrypt_type = HAL_ENCRYPT_TYPE_TKIP_MIC;
m->m_pkthdr.len += IEEE80211_TKIP_MICLEN;
break;
default:
/* Fallback to software crypto for other ciphers. */
ti.encrypt_type = HAL_ENCRYPT_TYPE_OPEN; ti.encrypt_type = HAL_ENCRYPT_TYPE_OPEN;
break;
}
if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { if (ti.encrypt_type == HAL_ENCRYPT_TYPE_OPEN) {
k = ieee80211_get_txkey(ic, wh, ni);
if ((m = ieee80211_encrypt(ic, m, k)) == NULL) if ((m = ieee80211_encrypt(ic, m, k)) == NULL)
return ENOBUFS; return ENOBUFS;
/* 802.11 header may have moved. */ /* 802.11 header may have moved. */
@ -24582,6 +25146,25 @@ qwx_peer_assoc_h_basic(struct qwx_softc *sc, struct qwx_vif *arvif,
arg->peer_caps = ni->ni_capinfo; arg->peer_caps = ni->ni_capinfo;
} }
void
qwx_peer_assoc_h_crypto(struct qwx_softc *sc, struct qwx_vif *arvif,
struct ieee80211_node *ni, struct peer_assoc_params *arg)
{
struct ieee80211com *ic = &sc->sc_ic;
if (ic->ic_flags & IEEE80211_F_RSNON) {
arg->need_ptk_4_way = 1;
if (ni->ni_rsnprotos == IEEE80211_PROTO_WPA)
arg->need_gtk_2_way = 1;
}
#if 0
if (sta->mfp) {
/* TODO: Need to check if FW supports PMF? */
arg->is_pmf_enabled = true;
}
#endif
}
int int
qwx_mac_rate_is_cck(uint8_t rate) qwx_mac_rate_is_cck(uint8_t rate)
{ {
@ -24641,9 +25224,7 @@ qwx_peer_assoc_prepare(struct qwx_softc *sc, struct qwx_vif *arvif,
arg->peer_new_assoc = !reassoc; arg->peer_new_assoc = !reassoc;
qwx_peer_assoc_h_basic(sc, arvif, ni, arg); qwx_peer_assoc_h_basic(sc, arvif, ni, arg);
#if 0
qwx_peer_assoc_h_crypto(sc, arvif, ni, arg); qwx_peer_assoc_h_crypto(sc, arvif, ni, arg);
#endif
qwx_peer_assoc_h_rates(ni, arg); qwx_peer_assoc_h_rates(ni, arg);
qwx_peer_assoc_h_phymode(sc, ni, arg); qwx_peer_assoc_h_phymode(sc, ni, arg);
#if 0 #if 0
@ -24757,12 +25338,15 @@ qwx_run_stop(struct qwx_softc *sc)
struct ieee80211com *ic = &sc->sc_ic; struct ieee80211com *ic = &sc->sc_ic;
struct qwx_vif *arvif = TAILQ_FIRST(&sc->vif_list); /* XXX */ struct qwx_vif *arvif = TAILQ_FIRST(&sc->vif_list); /* XXX */
uint8_t pdev_id = 0; /* TODO: derive pdev ID somehow? */ uint8_t pdev_id = 0; /* TODO: derive pdev ID somehow? */
struct qwx_node *nq = (void *)ic->ic_bss;
int ret; int ret;
sc->ops.irq_disable(sc); sc->ops.irq_disable(sc);
if (ic->ic_opmode == IEEE80211_M_STA) if (ic->ic_opmode == IEEE80211_M_STA) {
ic->ic_bss->ni_txrate = 0; ic->ic_bss->ni_txrate = 0;
nq->flags = 0;
}
ret = qwx_wmi_vdev_down(sc, arvif->vdev_id, pdev_id); ret = qwx_wmi_vdev_down(sc, arvif->vdev_id, pdev_id);
if (ret) if (ret)
@ -24801,6 +25385,7 @@ qwx_attach(struct qwx_softc *sc)
task_set(&sc->init_task, qwx_init_task, sc); task_set(&sc->init_task, qwx_init_task, sc);
task_set(&sc->newstate_task, qwx_newstate_task, sc); task_set(&sc->newstate_task, qwx_newstate_task, sc);
task_set(&sc->setkey_task, qwx_setkey_task, sc);
timeout_set_proc(&sc->scan.timeout, qwx_scan_timeout, sc); timeout_set_proc(&sc->scan.timeout, qwx_scan_timeout, sc);
#if NBPFILTER > 0 #if NBPFILTER > 0
qwx_radiotap_attach(sc); qwx_radiotap_attach(sc);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: qwxvar.h,v 1.25 2024/05/13 01:15:50 jsg Exp $ */ /* $OpenBSD: qwxvar.h,v 1.26 2024/05/28 08:34:52 stsp Exp $ */
/* /*
* Copyright (c) 2018-2019 The Linux Foundation. * Copyright (c) 2018-2019 The Linux Foundation.
@ -264,7 +264,9 @@ struct ath11k_hw_ops {
#if notyet #if notyet
void (*tx_mesh_enable)(struct ath11k_base *ab, void (*tx_mesh_enable)(struct ath11k_base *ab,
struct hal_tcl_data_cmd *tcl_cmd); struct hal_tcl_data_cmd *tcl_cmd);
bool (*rx_desc_get_first_msdu)(struct hal_rx_desc *desc); #endif
int (*rx_desc_get_first_msdu)(struct hal_rx_desc *desc);
#if notyet
bool (*rx_desc_get_last_msdu)(struct hal_rx_desc *desc); bool (*rx_desc_get_last_msdu)(struct hal_rx_desc *desc);
#endif #endif
uint8_t (*rx_desc_get_l3_pad_bytes)(struct hal_rx_desc *desc); uint8_t (*rx_desc_get_l3_pad_bytes)(struct hal_rx_desc *desc);
@ -1745,6 +1747,14 @@ struct qwx_tx_radiotap_header {
#define IWX_TX_RADIOTAP_PRESENT 0 /* TODO add more information */ #define IWX_TX_RADIOTAP_PRESENT 0 /* TODO add more information */
struct qwx_setkey_task_arg {
struct ieee80211_node *ni;
struct ieee80211_key *k;
int cmd;
#define QWX_ADD_KEY 1
#define QWX_DEL_KEY 2
};
struct qwx_softc { struct qwx_softc {
struct device sc_dev; struct device sc_dev;
struct ieee80211com sc_ic; struct ieee80211com sc_ic;
@ -1762,6 +1772,23 @@ struct qwx_softc {
enum ieee80211_state ns_nstate; enum ieee80211_state ns_nstate;
int ns_arg; int ns_arg;
/* Task for setting encryption keys and its arguments. */
struct task setkey_task;
/*
* At present we need to process at most two keys at once:
* Our pairwise key and a group key.
* When hostap mode is implemented this array needs to grow or
* it might become a bottleneck for associations that occur at
* roughly the same time.
*/
struct qwx_setkey_task_arg setkey_arg[2];
int setkey_cur;
int setkey_tail;
int setkey_nkeys;
int install_key_done;
int install_key_status;
enum ath11k_11d_state state_11d; enum ath11k_11d_state state_11d;
int completed_11d_scan; int completed_11d_scan;
uint32_t vdev_id_11d_scan; uint32_t vdev_id_11d_scan;
@ -1962,9 +1989,16 @@ struct ath11k_peer {
struct qwx_node { struct qwx_node {
struct ieee80211_node ni; struct ieee80211_node ni;
struct ath11k_peer peer; struct ath11k_peer peer;
unsigned int flags;
#define QWX_NODE_FLAG_HAVE_PAIRWISE_KEY 0x01
#define QWX_NODE_FLAG_HAVE_GROUP_KEY 0x02
}; };
struct ieee80211_node *qwx_node_alloc(struct ieee80211com *); struct ieee80211_node *qwx_node_alloc(struct ieee80211com *);
int qwx_set_key(struct ieee80211com *, struct ieee80211_node *,
struct ieee80211_key *);
void qwx_delete_key(struct ieee80211com *, struct ieee80211_node *,
struct ieee80211_key *);
void qwx_qrtr_recv_msg(struct qwx_softc *, struct mbuf *); void qwx_qrtr_recv_msg(struct qwx_softc *, struct mbuf *);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ufshci.c,v 1.32 2024/05/24 20:34:06 mglocker Exp $ */ /* $OpenBSD: ufshci.c,v 1.33 2024/05/27 10:27:58 mglocker Exp $ */
/* /*
* Copyright (c) 2022 Marcus Glocker <mglocker@openbsd.org> * Copyright (c) 2022 Marcus Glocker <mglocker@openbsd.org>
@ -62,7 +62,8 @@ void ufshci_dmamem_free(struct ufshci_softc *,
int ufshci_init(struct ufshci_softc *); int ufshci_init(struct ufshci_softc *);
int ufshci_doorbell_read(struct ufshci_softc *); int ufshci_doorbell_read(struct ufshci_softc *);
void ufshci_doorbell_write(struct ufshci_softc *, int); void ufshci_doorbell_write(struct ufshci_softc *, int);
int ufshci_doorbell_poll(struct ufshci_softc *, int); int ufshci_doorbell_poll(struct ufshci_softc *, int,
uint32_t);
int ufshci_utr_cmd_nop(struct ufshci_softc *, int ufshci_utr_cmd_nop(struct ufshci_softc *,
struct ufshci_ccb *, struct scsi_xfer *); struct ufshci_ccb *, struct scsi_xfer *);
int ufshci_utr_cmd_lun(struct ufshci_softc *, int ufshci_utr_cmd_lun(struct ufshci_softc *,
@ -502,20 +503,21 @@ ufshci_doorbell_write(struct ufshci_softc *sc, int slot)
} }
int int
ufshci_doorbell_poll(struct ufshci_softc *sc, int slot) ufshci_doorbell_poll(struct ufshci_softc *sc, int slot, uint32_t timeout_ms)
{ {
uint32_t reg; uint32_t reg;
int i, retry = 25; uint64_t timeout_us;
DPRINTF(3, "%s\n", __func__); DPRINTF(3, "%s\n", __func__);
for (i = 0; i < retry; i++) { for (timeout_us = timeout_ms * 1000; timeout_us != 0;
timeout_us -= 1000) {
reg = UFSHCI_READ_4(sc, UFSHCI_REG_UTRLDBR); reg = UFSHCI_READ_4(sc, UFSHCI_REG_UTRLDBR);
if ((reg & (1U << slot)) == 0) if ((reg & (1U << slot)) == 0)
break; break;
delay(10); delay(1000);
} }
if (i == retry) { if (timeout_us == 0) {
printf("%s: %s: timeout\n", sc->sc_dev.dv_xname, __func__); printf("%s: %s: timeout\n", sc->sc_dev.dv_xname, __func__);
return -1; return -1;
} }
@ -1620,7 +1622,7 @@ ufshci_scsi_inquiry(struct scsi_xfer *xs)
goto error2; goto error2;
if (ISSET(xs->flags, SCSI_POLL)) { if (ISSET(xs->flags, SCSI_POLL)) {
if (ufshci_doorbell_poll(sc, ccb->ccb_slot) == 0) { if (ufshci_doorbell_poll(sc, ccb->ccb_slot, xs->timeout) == 0) {
ccb->ccb_done(sc, ccb); ccb->ccb_done(sc, ccb);
return; return;
} }
@ -1675,7 +1677,7 @@ ufshci_scsi_capacity16(struct scsi_xfer *xs)
goto error2; goto error2;
if (ISSET(xs->flags, SCSI_POLL)) { if (ISSET(xs->flags, SCSI_POLL)) {
if (ufshci_doorbell_poll(sc, ccb->ccb_slot) == 0) { if (ufshci_doorbell_poll(sc, ccb->ccb_slot, xs->timeout) == 0) {
ccb->ccb_done(sc, ccb); ccb->ccb_done(sc, ccb);
return; return;
} }
@ -1730,7 +1732,7 @@ ufshci_scsi_capacity(struct scsi_xfer *xs)
goto error2; goto error2;
if (ISSET(xs->flags, SCSI_POLL)) { if (ISSET(xs->flags, SCSI_POLL)) {
if (ufshci_doorbell_poll(sc, ccb->ccb_slot) == 0) { if (ufshci_doorbell_poll(sc, ccb->ccb_slot, xs->timeout) == 0) {
ccb->ccb_done(sc, ccb); ccb->ccb_done(sc, ccb);
return; return;
} }
@ -1775,7 +1777,7 @@ ufshci_scsi_sync(struct scsi_xfer *xs)
goto error; goto error;
if (ISSET(xs->flags, SCSI_POLL)) { if (ISSET(xs->flags, SCSI_POLL)) {
if (ufshci_doorbell_poll(sc, ccb->ccb_slot) == 0) { if (ufshci_doorbell_poll(sc, ccb->ccb_slot, xs->timeout) == 0) {
ccb->ccb_done(sc, ccb); ccb->ccb_done(sc, ccb);
return; return;
} }
@ -1831,7 +1833,7 @@ ufshci_scsi_io(struct scsi_xfer *xs, int dir)
goto error2; goto error2;
if (ISSET(xs->flags, SCSI_POLL)) { if (ISSET(xs->flags, SCSI_POLL)) {
if (ufshci_doorbell_poll(sc, ccb->ccb_slot) == 0) { if (ufshci_doorbell_poll(sc, ccb->ccb_slot, xs->timeout) == 0) {
ccb->ccb_done(sc, ccb); ccb->ccb_done(sc, ccb);
return; return;
} }

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ad1848.c,v 1.49 2024/04/13 23:44:11 jsg Exp $ */ /* $OpenBSD: ad1848.c,v 1.50 2024/05/28 09:27:08 jsg Exp $ */
/* $NetBSD: ad1848.c,v 1.45 1998/01/30 02:02:38 augustss Exp $ */ /* $NetBSD: ad1848.c,v 1.45 1998/01/30 02:02:38 augustss Exp $ */
/* /*
@ -89,7 +89,6 @@
#include <dev/ic/ad1848reg.h> #include <dev/ic/ad1848reg.h>
#include <dev/ic/cs4231reg.h> #include <dev/ic/cs4231reg.h>
#include <dev/isa/ad1848var.h> #include <dev/isa/ad1848var.h>
#include <dev/isa/cs4231var.h>
#ifdef AUDIO_DEBUG #ifdef AUDIO_DEBUG
#define DPRINTF(x) do { if (ad1848debug) printf x; } while (0); #define DPRINTF(x) do { if (ad1848debug) printf x; } while (0);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: addcom_isa.c,v 1.7 2022/04/06 18:59:28 naddy Exp $ */ /* $OpenBSD: addcom_isa.c,v 1.8 2024/05/28 05:46:32 jsg Exp $ */
/* $NetBSD: addcom_isa.c,v 1.2 2000/04/21 20:13:41 explorer Exp $ */ /* $NetBSD: addcom_isa.c,v 1.2 2000/04/21 20:13:41 explorer Exp $ */
/* /*
@ -120,9 +120,7 @@ struct cfdriver addcom_cd = {
}; };
int int
addcomprobe(parent, self, aux) addcomprobe(struct device *parent, void *self, void *aux)
struct device *parent;
void *self, *aux;
{ {
struct isa_attach_args *ia = aux; struct isa_attach_args *ia = aux;
int iobase = ia->ia_iobase; int iobase = ia->ia_iobase;
@ -175,9 +173,7 @@ out:
} }
int int
addcomprint(aux, pnp) addcomprint(void *aux, const char *pnp)
void *aux;
const char *pnp;
{ {
struct commulti_attach_args *ca = aux; struct commulti_attach_args *ca = aux;
@ -188,9 +184,7 @@ addcomprint(aux, pnp)
} }
void void
addcomattach(parent, self, aux) addcomattach(struct device *parent, struct device *self, void *aux)
struct device *parent, *self;
void *aux;
{ {
struct addcom_softc *sc = (void *)self; struct addcom_softc *sc = (void *)self;
struct isa_attach_args *ia = aux; struct isa_attach_args *ia = aux;
@ -253,8 +247,7 @@ addcomattach(parent, self, aux)
} }
int int
addcomintr(arg) addcomintr(void *arg)
void *arg;
{ {
struct addcom_softc *sc = arg; struct addcom_softc *sc = arg;
int intrd, r = 0, i; int intrd, r = 0, i;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: boca.c,v 1.17 2022/04/06 18:59:28 naddy Exp $ */ /* $OpenBSD: boca.c,v 1.18 2024/05/28 05:46:32 jsg Exp $ */
/* $NetBSD: boca.c,v 1.15 1996/05/12 23:51:50 mycroft Exp $ */ /* $NetBSD: boca.c,v 1.15 1996/05/12 23:51:50 mycroft Exp $ */
/* /*
@ -74,10 +74,7 @@ struct cfdriver boca_cd = {
}; };
int int
bocaprobe(parent, self, aux) bocaprobe(struct device *parent, void *self, void *aux)
struct device *parent;
void *self;
void *aux;
{ {
struct isa_attach_args *ia = aux; struct isa_attach_args *ia = aux;
int iobase = ia->ia_iobase; int iobase = ia->ia_iobase;
@ -126,9 +123,7 @@ out:
} }
int int
bocaprint(aux, pnp) bocaprint(void *aux, const char *pnp)
void *aux;
const char *pnp;
{ {
struct commulti_attach_args *ca = aux; struct commulti_attach_args *ca = aux;
@ -139,9 +134,7 @@ bocaprint(aux, pnp)
} }
void void
bocaattach(parent, self, aux) bocaattach(struct device *parent, struct device *self, void *aux)
struct device *parent, *self;
void *aux;
{ {
struct boca_softc *sc = (void *)self; struct boca_softc *sc = (void *)self;
struct isa_attach_args *ia = aux; struct isa_attach_args *ia = aux;
@ -177,8 +170,7 @@ bocaattach(parent, self, aux)
} }
int int
bocaintr(arg) bocaintr(void *arg)
void *arg;
{ {
struct boca_softc *sc = arg; struct boca_softc *sc = arg;
bus_space_tag_t iot = sc->sc_iot; bus_space_tag_t iot = sc->sc_iot;

View file

@ -1,51 +0,0 @@
/* $OpenBSD: cs4231var.h,v 1.4 2008/06/26 05:42:16 ray Exp $ */
/* $NetBSD: cs4231var.h,v 1.2 1996/02/05 02:21:51 jtc Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Ken Hornstein and John Kohl.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Software gunk for CS4231, as used in Gravis UltraSound MAX.
*/
struct cs4231_softc {
int in_port; /* which MUX input port? */
#define CS4231_MUX_MIXED_IN 0
#define CS4231_MUX_MIC_IN 1
#define CS4231_MUX_AUX1_IN 2
#define CS4231_MUX_LINE_IN 3
};
int cs4231_set_linein_gain(struct ad1848_softc *, struct ad1848_volume *);
int cs4231_get_linein_gain(struct ad1848_softc *, struct ad1848_volume *);
int cs4231_set_mono_gain(struct ad1848_softc *, struct ad1848_volume *);
int cs4231_get_mono_gain(struct ad1848_softc *, struct ad1848_volume *);
void cs4231_mute_mono(struct ad1848_softc *, int /* onoff */);
void cs4231_mute_line(struct ad1848_softc *, int /* onoff */);
void cs4231_mute_monitor(struct ad1848_softc *, int /* onoff */);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: gus.c,v 1.55 2022/11/02 10:41:34 kn Exp $ */ /* $OpenBSD: gus.c,v 1.56 2024/05/28 09:27:08 jsg Exp $ */
/* $NetBSD: gus.c,v 1.51 1998/01/25 23:48:06 mycroft Exp $ */ /* $NetBSD: gus.c,v 1.51 1998/01/25 23:48:06 mycroft Exp $ */
/*- /*-
@ -115,7 +115,6 @@
#include <dev/ic/ad1848reg.h> #include <dev/ic/ad1848reg.h>
#include <dev/isa/ics2101var.h> #include <dev/isa/ics2101var.h>
#include <dev/isa/ad1848var.h> #include <dev/isa/ad1848var.h>
#include <dev/isa/cs4231var.h>
#include "gusreg.h" #include "gusreg.h"
#include "gusvar.h" #include "gusvar.h"

View file

@ -1,4 +1,4 @@
/* $OpenBSD: gus_isa.c,v 1.9 2022/04/06 18:59:28 naddy Exp $ */ /* $OpenBSD: gus_isa.c,v 1.10 2024/05/28 09:27:08 jsg Exp $ */
/* $NetBSD: gus.c,v 1.51 1998/01/25 23:48:06 mycroft Exp $ */ /* $NetBSD: gus.c,v 1.51 1998/01/25 23:48:06 mycroft Exp $ */
/*- /*-
@ -115,7 +115,6 @@
#include <dev/ic/ad1848reg.h> #include <dev/ic/ad1848reg.h>
#include <dev/isa/ics2101var.h> #include <dev/isa/ics2101var.h>
#include <dev/isa/ad1848var.h> #include <dev/isa/ad1848var.h>
#include <dev/isa/cs4231var.h>
#include "gusreg.h" #include "gusreg.h"
#include "gusvar.h" #include "gusvar.h"

View file

@ -1,4 +1,4 @@
/* $OpenBSD: gus_isapnp.c,v 1.10 2022/04/06 18:59:28 naddy Exp $ */ /* $OpenBSD: gus_isapnp.c,v 1.11 2024/05/28 09:27:08 jsg Exp $ */
/* $NetBSD: gus.c,v 1.51 1998/01/25 23:48:06 mycroft Exp $ */ /* $NetBSD: gus.c,v 1.51 1998/01/25 23:48:06 mycroft Exp $ */
/*- /*-
@ -115,7 +115,6 @@
#include <dev/ic/ad1848reg.h> #include <dev/ic/ad1848reg.h>
#include <dev/isa/ics2101var.h> #include <dev/isa/ics2101var.h>
#include <dev/isa/ad1848var.h> #include <dev/isa/ad1848var.h>
#include <dev/isa/cs4231var.h>
#include "gusreg.h" #include "gusreg.h"
#include "gusvar.h" #include "gusvar.h"

View file

@ -1,4 +1,4 @@
/* $OpenBSD: hsq.c,v 1.7 2022/04/06 18:59:28 naddy Exp $ */ /* $OpenBSD: hsq.c,v 1.8 2024/05/28 05:46:32 jsg Exp $ */
/*- /*-
* Copyright (c) 1999 Denis A. Doroshenko. All rights reserved. * Copyright (c) 1999 Denis A. Doroshenko. All rights reserved.
@ -120,10 +120,7 @@ struct cfdriver hsq_cd = {
}; };
int int
hsqprobe(parent, self, aux) hsqprobe(struct device *parent, void *self, void *aux)
struct device *parent;
void *self;
void *aux;
{ {
struct isa_attach_args *ia = aux; struct isa_attach_args *ia = aux;
int iobase = ia->ia_iobase; int iobase = ia->ia_iobase;
@ -174,9 +171,7 @@ out:
} }
int int
hsqprint(aux, pnp) hsqprint(void *aux, const char *pnp)
void *aux;
const char *pnp;
{ {
struct commulti_attach_args *ca = aux; struct commulti_attach_args *ca = aux;
@ -187,9 +182,7 @@ hsqprint(aux, pnp)
} }
void void
hsqattach(parent, self, aux) hsqattach(struct device *parent, struct device *self, void *aux)
struct device *parent, *self;
void *aux;
{ {
struct hsq_softc *sc = (void *)self; struct hsq_softc *sc = (void *)self;
struct isa_attach_args *ia = aux; struct isa_attach_args *ia = aux;
@ -225,8 +218,7 @@ hsqattach(parent, self, aux)
} }
int int
hsqintr(arg) hsqintr(void *arg)
void *arg;
{ {
struct hsq_softc *sc = arg; struct hsq_softc *sc = arg;
bus_space_tag_t iot = sc->sc_iot; bus_space_tag_t iot = sc->sc_iot;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: txphy.c,v 1.13 2023/03/30 09:24:22 kevlo Exp $ */ /* $OpenBSD: txphy.c,v 1.14 2024/05/27 03:56:59 jsg Exp $ */
/* /*
* Copyright (c) 1999 Jason L. Wright (jason@thought.net) * Copyright (c) 1999 Jason L. Wright (jason@thought.net)
@ -38,6 +38,7 @@
#include <sys/errno.h> #include <sys/errno.h>
#include <net/if.h> #include <net/if.h>
#include <net/if_var.h>
#include <net/if_media.h> #include <net/if_media.h>
#include <dev/mii/mii.h> #include <dev/mii/mii.h>

View file

@ -1,4 +1,4 @@
/* $OpenBSD: xmphy.c,v 1.24 2022/04/06 18:59:29 naddy Exp $ */ /* $OpenBSD: xmphy.c,v 1.25 2024/05/27 04:58:43 jsg Exp $ */
/* /*
* Copyright (c) 2000 * Copyright (c) 2000
@ -54,8 +54,6 @@
#include <dev/mii/miivar.h> #include <dev/mii/miivar.h>
#include <dev/mii/miidevs.h> #include <dev/mii/miidevs.h>
#include <dev/mii/xmphyreg.h>
int xmphy_probe(struct device *, void *, void *); int xmphy_probe(struct device *, void *, void *);
void xmphy_attach(struct device *, struct device *, void *); void xmphy_attach(struct device *, struct device *, void *);

View file

@ -1,50 +0,0 @@
/* $OpenBSD: xmphyreg.h,v 1.6 2015/07/19 06:28:12 yuo Exp $ */
/*
* Copyright (c) 2000
* Bill Paul <wpaul@ee.columbia.edu>. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Bill Paul.
* 4. Neither the name of the author nor the names of any co-contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD: src/sys/dev/mii/xmphyreg.h,v 1.1 2000/04/22 01:58:18 wpaul Exp $
*/
#ifndef _DEV_MII_XMPHYREG_H_
#define _DEV_MII_XMPHYREG_H_
/*
* XaQti XMAC II PHY registers
*/
#define XMPHY_MII_RESAB 0x10 /* Resolved ability */
#define XMPHY_RESAB_PAUSEBITS 0x0180 /* Pause bits */
#define XMPHY_RESAB_HDX 0x0040 /* Half duplex selected */
#define XMPHY_RESAB_FDX 0x0020 /* Full duplex selected */
#define XMPHY_RESAB_ABLMIS 0x0010 /* Ability mismatch */
#define XMPHY_RESAB_PAUSEMIS 0x0008 /* Pause mismatch */
#endif /* _DEV_MII_XMPHYREG_H_ */

View file

@ -1029,6 +1029,9 @@ int amdgpu_ras_query_error_status(struct amdgpu_device *adev,
if (!obj) if (!obj)
return -EINVAL; return -EINVAL;
if (!info || info->head.block == AMDGPU_RAS_BLOCK_COUNT)
return -EINVAL;
if (info->head.block == AMDGPU_RAS_BLOCK__UMC) { if (info->head.block == AMDGPU_RAS_BLOCK__UMC) {
amdgpu_ras_get_ecc_info(adev, &err_data); amdgpu_ras_get_ecc_info(adev, &err_data);
} else { } else {

View file

@ -1033,7 +1033,12 @@ static bool setup_dsc_config(
if (!is_dsc_possible) if (!is_dsc_possible)
goto done; goto done;
dsc_cfg->num_slices_v = pic_height/slice_height; if (slice_height > 0) {
dsc_cfg->num_slices_v = pic_height / slice_height;
} else {
is_dsc_possible = false;
goto done;
}
if (target_bandwidth_kbps > 0) { if (target_bandwidth_kbps > 0) {
is_dsc_possible = decide_dsc_target_bpp_x16( is_dsc_possible = decide_dsc_target_bpp_x16(

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_qwx_pci.c,v 1.16 2024/05/24 06:02:56 jsg Exp $ */ /* $OpenBSD: if_qwx_pci.c,v 1.19 2024/05/28 09:26:55 stsp Exp $ */
/* /*
* Copyright 2023 Stefan Sperling <stsp@openbsd.org> * Copyright 2023 Stefan Sperling <stsp@openbsd.org>
@ -96,6 +96,7 @@
#include <dev/ic/qwxreg.h> #include <dev/ic/qwxreg.h>
#include <dev/ic/qwxvar.h> #include <dev/ic/qwxvar.h>
#ifdef QWX_DEBUG
/* Headers needed for RDDM dump */ /* Headers needed for RDDM dump */
#include <sys/namei.h> #include <sys/namei.h>
#include <sys/pledge.h> #include <sys/pledge.h>
@ -103,6 +104,7 @@
#include <sys/fcntl.h> #include <sys/fcntl.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/proc.h> #include <sys/proc.h>
#endif
#define ATH11K_PCI_IRQ_CE0_OFFSET 3 #define ATH11K_PCI_IRQ_CE0_OFFSET 3
#define ATH11K_PCI_IRQ_DP_OFFSET 14 #define ATH11K_PCI_IRQ_DP_OFFSET 14
@ -452,7 +454,9 @@ void qwx_mhi_init_mmio(struct qwx_pci_softc *);
int qwx_mhi_fw_load_bhi(struct qwx_pci_softc *, uint8_t *, size_t); int qwx_mhi_fw_load_bhi(struct qwx_pci_softc *, uint8_t *, size_t);
int qwx_mhi_fw_load_bhie(struct qwx_pci_softc *, uint8_t *, size_t); int qwx_mhi_fw_load_bhie(struct qwx_pci_softc *, uint8_t *, size_t);
void qwx_rddm_prepare(struct qwx_pci_softc *); void qwx_rddm_prepare(struct qwx_pci_softc *);
#ifdef QWX_DEBUG
void qwx_rddm_task(void *); void qwx_rddm_task(void *);
#endif
void * qwx_pci_event_ring_get_elem(struct qwx_pci_event_ring *, uint64_t); void * qwx_pci_event_ring_get_elem(struct qwx_pci_event_ring *, uint64_t);
void qwx_pci_intr_ctrl_event_mhi(struct qwx_pci_softc *, uint32_t); void qwx_pci_intr_ctrl_event_mhi(struct qwx_pci_softc *, uint32_t);
void qwx_pci_intr_ctrl_event_ee(struct qwx_pci_softc *, uint32_t); void qwx_pci_intr_ctrl_event_ee(struct qwx_pci_softc *, uint32_t);
@ -1042,8 +1046,9 @@ unsupported_wcn6855_soc:
goto err_irq_affinity_cleanup; goto err_irq_affinity_cleanup;
} }
#endif #endif
#ifdef QWX_DEBUG
task_set(&psc->rddm_task, qwx_rddm_task, psc); task_set(&psc->rddm_task, qwx_rddm_task, psc);
#endif
ic->ic_phytype = IEEE80211_T_OFDM; /* not only, but not used */ ic->ic_phytype = IEEE80211_T_OFDM; /* not only, but not used */
ic->ic_opmode = IEEE80211_M_STA; /* default to BSS mode */ ic->ic_opmode = IEEE80211_M_STA; /* default to BSS mode */
ic->ic_state = IEEE80211_S_INIT; ic->ic_state = IEEE80211_S_INIT;
@ -1086,6 +1091,8 @@ unsupported_wcn6855_soc:
/* Override 802.11 state transition machine. */ /* Override 802.11 state transition machine. */
sc->sc_newstate = ic->ic_newstate; sc->sc_newstate = ic->ic_newstate;
ic->ic_newstate = qwx_newstate; ic->ic_newstate = qwx_newstate;
ic->ic_set_key = qwx_set_key;
ic->ic_delete_key = qwx_delete_key;
#if 0 #if 0
ic->ic_updatechan = qwx_updatechan; ic->ic_updatechan = qwx_updatechan;
ic->ic_updateprot = qwx_updateprot; ic->ic_updateprot = qwx_updateprot;
@ -3466,6 +3473,7 @@ qwx_rddm_prepare(struct qwx_pci_softc *psc)
psc->rddm_vec = vec_adm; psc->rddm_vec = vec_adm;
} }
#ifdef QWX_DEBUG
void void
qwx_rddm_task(void *arg) qwx_rddm_task(void *arg)
{ {
@ -3560,6 +3568,7 @@ done:
psc->rddm_vec = NULL; psc->rddm_vec = NULL;
DPRINTF("%s: done, error %d\n", __func__, error); DPRINTF("%s: done, error %d\n", __func__, error);
} }
#endif
void * void *
qwx_pci_event_ring_get_elem(struct qwx_pci_event_ring *ring, uint64_t rp) qwx_pci_event_ring_get_elem(struct qwx_pci_event_ring *ring, uint64_t rp)
@ -4071,11 +4080,23 @@ qwx_pci_intr(void *arg)
sc->sc_dev.dv_xname, psc->bhi_ee, ee, psc->mhi_state, state); sc->sc_dev.dv_xname, psc->bhi_ee, ee, psc->mhi_state, state);
if (ee == MHI_EE_RDDM) { if (ee == MHI_EE_RDDM) {
/* Firmware crash, e.g. due to invalid DMA memory access. */
psc->bhi_ee = ee; psc->bhi_ee = ee;
#ifdef QWX_DEBUG
if (!psc->rddm_triggered) { if (!psc->rddm_triggered) {
/* Write fw memory dump to root's home directory. */
task_add(systq, &psc->rddm_task); task_add(systq, &psc->rddm_task);
psc->rddm_triggered = 1; psc->rddm_triggered = 1;
} }
#else
printf("%s: fatal firmware error\n",
sc->sc_dev.dv_xname);
if (!test_bit(ATH11K_FLAG_CRASH_FLUSH, sc->sc_flags)) {
/* Try to reset the device. */
set_bit(ATH11K_FLAG_CRASH_FLUSH, sc->sc_flags);
task_add(systq, &sc->init_task);
}
#endif
return 1; return 1;
} else if (psc->bhi_ee == MHI_EE_PBL || psc->bhi_ee == MHI_EE_SBL) { } else if (psc->bhi_ee == MHI_EE_PBL || psc->bhi_ee == MHI_EE_SBL) {
int new_ee = -1, new_mhi_state = -1; int new_ee = -1, new_mhi_state = -1;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: aic_pcmcia.c,v 1.20 2023/09/11 08:41:27 mvs Exp $ */ /* $OpenBSD: aic_pcmcia.c,v 1.21 2024/05/26 08:46:28 jsg Exp $ */
/* $NetBSD: aic_pcmcia.c,v 1.6 1998/07/19 17:28:15 christos Exp $ */ /* $NetBSD: aic_pcmcia.c,v 1.6 1998/07/19 17:28:15 christos Exp $ */
/* /*
@ -34,7 +34,6 @@
#include <sys/systm.h> #include <sys/systm.h>
#include <sys/device.h> #include <sys/device.h>
#include <machine/cpu.h>
#include <machine/bus.h> #include <machine/bus.h>
#include <machine/intr.h> #include <machine/intr.h>

View file

@ -1,4 +1,4 @@
/* $OpenBSD: cfxga.c,v 1.33 2022/07/15 17:57:26 kettenis Exp $ */ /* $OpenBSD: cfxga.c,v 1.35 2024/05/26 08:46:28 jsg Exp $ */
/* /*
* Copyright (c) 2005, 2006, Matthieu Herrb and Miodrag Vallat * Copyright (c) 2005, 2006, Matthieu Herrb and Miodrag Vallat
@ -31,11 +31,9 @@
*/ */
#include <sys/param.h> #include <sys/param.h>
#include <sys/kernel.h>
#include <sys/device.h> #include <sys/device.h>
#include <sys/systm.h> #include <sys/systm.h>
#include <sys/malloc.h> #include <sys/malloc.h>
#include <sys/conf.h>
#include <dev/pcmcia/pcmciavar.h> #include <dev/pcmcia/pcmciavar.h>
#include <dev/pcmcia/pcmciareg.h> #include <dev/pcmcia/pcmciareg.h>
@ -324,7 +322,7 @@ cfxga_activate(struct device *dev, int act)
pcmcia_function_disable(sc->sc_pf); pcmcia_function_disable(sc->sc_pf);
break; break;
default: default:
rv = config_activate_children(self, act); rv = config_activate_children(dev, act);
break; break;
} }
return (rv); return (rv);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: com_pcmcia.c,v 1.61 2024/05/13 01:15:51 jsg Exp $ */ /* $OpenBSD: com_pcmcia.c,v 1.62 2024/05/26 08:46:28 jsg Exp $ */
/* $NetBSD: com_pcmcia.c,v 1.15 1998/08/22 17:47:58 msaitoh Exp $ */ /* $NetBSD: com_pcmcia.c,v 1.15 1998/08/22 17:47:58 msaitoh Exp $ */
/* /*
@ -90,12 +90,7 @@
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
#include <sys/ioctl.h>
#include <sys/tty.h> #include <sys/tty.h>
#include <sys/conf.h>
#include <sys/uio.h>
#include <sys/kernel.h>
#include <sys/syslog.h>
#include <sys/device.h> #include <sys/device.h>
#include <machine/intr.h> #include <machine/intr.h>
@ -104,8 +99,6 @@
#include <dev/pcmcia/pcmciareg.h> #include <dev/pcmcia/pcmciareg.h>
#include <dev/pcmcia/pcmciadevs.h> #include <dev/pcmcia/pcmciadevs.h>
#include "com.h"
#include <dev/ic/comreg.h> #include <dev/ic/comreg.h>
#include <dev/ic/comvar.h> #include <dev/ic/comvar.h>
#include <dev/ic/ns16550reg.h> #include <dev/ic/ns16550reg.h>

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_an_pcmcia.c,v 1.27 2022/04/06 18:59:30 naddy Exp $ */ /* $OpenBSD: if_an_pcmcia.c,v 1.28 2024/05/26 08:46:28 jsg Exp $ */
/* /*
* Copyright (c) 1999 Michael Shalayeff * Copyright (c) 1999 Michael Shalayeff
@ -29,9 +29,6 @@
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
#include <sys/device.h> #include <sys/device.h>
#include <sys/timeout.h>
#include <sys/socket.h>
#include <sys/tree.h>
#include <net/if.h> #include <net/if.h>
#include <net/if_media.h> #include <net/if_media.h>

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_ep_pcmcia.c,v 1.51 2023/09/11 08:41:27 mvs Exp $ */ /* $OpenBSD: if_ep_pcmcia.c,v 1.52 2024/05/26 08:46:28 jsg Exp $ */
/* $NetBSD: if_ep_pcmcia.c,v 1.16 1998/08/17 23:20:40 thorpej Exp $ */ /* $NetBSD: if_ep_pcmcia.c,v 1.16 1998/08/17 23:20:40 thorpej Exp $ */
/*- /*-
@ -60,15 +60,8 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "bpfilter.h"
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
#include <sys/mbuf.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <sys/errno.h>
#include <sys/syslog.h>
#include <sys/timeout.h> #include <sys/timeout.h>
#include <sys/device.h> #include <sys/device.h>
@ -78,14 +71,8 @@
#include <netinet/in.h> #include <netinet/in.h>
#include <netinet/if_ether.h> #include <netinet/if_ether.h>
#if NBPFILTER > 0
#include <net/bpf.h>
#endif
#include <machine/cpu.h>
#include <machine/bus.h> #include <machine/bus.h>
#include <dev/mii/mii.h>
#include <dev/mii/miivar.h> #include <dev/mii/miivar.h>
#include <dev/ic/elink3var.h> #include <dev/ic/elink3var.h>

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_malo.c,v 1.99 2022/04/06 18:59:30 naddy Exp $ */ /* $OpenBSD: if_malo.c,v 1.100 2024/05/26 08:46:28 jsg Exp $ */
/* /*
* Copyright (c) 2007 Marcus Glocker <mglocker@openbsd.org> * Copyright (c) 2007 Marcus Glocker <mglocker@openbsd.org>
@ -20,11 +20,8 @@
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/device.h> #include <sys/device.h>
#include <sys/timeout.h> #include <sys/timeout.h>
#include <sys/socket.h>
#include <sys/tree.h>
#include <sys/malloc.h> #include <sys/malloc.h>
#include <sys/sockio.h> #include <sys/sockio.h>
#include <sys/mbuf.h> #include <sys/mbuf.h>

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_ne_pcmcia.c,v 1.102 2023/09/11 08:41:27 mvs Exp $ */ /* $OpenBSD: if_ne_pcmcia.c,v 1.103 2024/05/26 08:46:28 jsg Exp $ */
/* $NetBSD: if_ne_pcmcia.c,v 1.17 1998/08/15 19:00:04 thorpej Exp $ */ /* $NetBSD: if_ne_pcmcia.c,v 1.17 1998/08/15 19:00:04 thorpej Exp $ */
/* /*
@ -33,7 +33,6 @@
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
#include <sys/device.h> #include <sys/device.h>
#include <sys/socket.h>
#include <net/if.h> #include <net/if.h>
#include <net/if_media.h> #include <net/if_media.h>
@ -42,12 +41,10 @@
#include <machine/bus.h> #include <machine/bus.h>
#include <dev/pcmcia/pcmciareg.h>
#include <dev/pcmcia/pcmciavar.h> #include <dev/pcmcia/pcmciavar.h>
#include <dev/pcmcia/pcmciadevs.h> #include <dev/pcmcia/pcmciadevs.h>
#include <dev/mii/miivar.h> #include <dev/mii/miivar.h>
#include <dev/mii/mii_bitbang.h>
#include <dev/ic/dp8390reg.h> #include <dev/ic/dp8390reg.h>
#include <dev/ic/dp8390var.h> #include <dev/ic/dp8390var.h>

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_sm_pcmcia.c,v 1.40 2023/09/11 08:41:27 mvs Exp $ */ /* $OpenBSD: if_sm_pcmcia.c,v 1.41 2024/05/26 08:46:28 jsg Exp $ */
/* $NetBSD: if_sm_pcmcia.c,v 1.11 1998/08/15 20:47:32 thorpej Exp $ */ /* $NetBSD: if_sm_pcmcia.c,v 1.11 1998/08/15 20:47:32 thorpej Exp $ */
/*- /*-
@ -31,15 +31,8 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "bpfilter.h"
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
#include <sys/mbuf.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <sys/errno.h>
#include <sys/syslog.h>
#include <sys/timeout.h> #include <sys/timeout.h>
#include <sys/device.h> #include <sys/device.h>
@ -49,14 +42,9 @@
#include <netinet/in.h> #include <netinet/in.h>
#include <netinet/if_ether.h> #include <netinet/if_ether.h>
#if NBPFILTER > 0
#include <net/bpf.h>
#endif
#include <machine/intr.h> #include <machine/intr.h>
#include <machine/bus.h> #include <machine/bus.h>
#include <dev/mii/mii.h>
#include <dev/mii/miivar.h> #include <dev/mii/miivar.h>
#include <dev/ic/smc91cxxvar.h> #include <dev/ic/smc91cxxvar.h>

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_wi_pcmcia.c,v 1.76 2022/04/06 18:59:30 naddy Exp $ */ /* $OpenBSD: if_wi_pcmcia.c,v 1.77 2024/05/26 08:46:28 jsg Exp $ */
/* $NetBSD: if_wi_pcmcia.c,v 1.14 2001/11/26 04:34:56 ichiro Exp $ */ /* $NetBSD: if_wi_pcmcia.c,v 1.14 2001/11/26 04:34:56 ichiro Exp $ */
/* /*
@ -46,9 +46,7 @@
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
#include <sys/timeout.h> #include <sys/timeout.h>
#include <sys/socket.h>
#include <sys/device.h> #include <sys/device.h>
#include <sys/tree.h>
#include <net/if.h> #include <net/if.h>
#include <net/if_media.h> #include <net/if_media.h>
@ -61,7 +59,6 @@
#include <machine/bus.h> #include <machine/bus.h>
#include <dev/pcmcia/pcmciareg.h>
#include <dev/pcmcia/pcmciavar.h> #include <dev/pcmcia/pcmciavar.h>
#include <dev/pcmcia/pcmciadevs.h> #include <dev/pcmcia/pcmciadevs.h>

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_xe.c,v 1.63 2023/05/30 08:30:01 jsg Exp $ */ /* $OpenBSD: if_xe.c,v 1.64 2024/05/26 08:46:28 jsg Exp $ */
/* /*
* Copyright (c) 1999 Niklas Hallqvist, Brandon Creighton, Job de Haas * Copyright (c) 1999 Niklas Hallqvist, Brandon Creighton, Job de Haas
@ -52,8 +52,6 @@
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/mbuf.h> #include <sys/mbuf.h>
#include <sys/malloc.h> #include <sys/malloc.h>
#include <sys/kernel.h>
#include <sys/socket.h>
#include <sys/syslog.h> #include <sys/syslog.h>
#include <net/if.h> #include <net/if.h>

View file

@ -1,4 +1,4 @@
/* $OpenBSD: wdc_pcmcia.c,v 1.34 2022/04/06 18:59:30 naddy Exp $ */ /* $OpenBSD: wdc_pcmcia.c,v 1.35 2024/05/26 08:46:28 jsg Exp $ */
/* $NetBSD: wdc_pcmcia.c,v 1.19 1999/02/19 21:49:43 abs Exp $ */ /* $NetBSD: wdc_pcmcia.c,v 1.19 1999/02/19 21:49:43 abs Exp $ */
/*- /*-
@ -32,19 +32,8 @@
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/conf.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/buf.h>
#include <sys/uio.h>
#include <sys/malloc.h>
#include <sys/device.h> #include <sys/device.h>
#include <sys/disklabel.h>
#include <sys/disk.h>
#include <sys/syslog.h>
#include <machine/cpu.h>
#include <machine/intr.h> #include <machine/intr.h>
#include <machine/bus.h> #include <machine/bus.h>

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_vio.c,v 1.35 2024/05/24 10:05:55 jsg Exp $ */ /* $OpenBSD: if_vio.c,v 1.36 2024/05/28 12:11:26 jan Exp $ */
/* /*
* Copyright (c) 2012 Stefan Fritsch, Alexander Fiveg. * Copyright (c) 2012 Stefan Fritsch, Alexander Fiveg.
@ -1118,8 +1118,6 @@ vio_rxeof(struct vio_softc *sc)
bufs_left = hdr->num_buffers - 1; bufs_left = hdr->num_buffers - 1;
else else
bufs_left = 0; bufs_left = 0;
if (virtio_has_feature(vsc, VIRTIO_NET_F_GUEST_CSUM))
vio_rx_offload(m, hdr);
} else { } else {
m->m_flags &= ~M_PKTHDR; m->m_flags &= ~M_PKTHDR;
m0->m_pkthdr.len += m->m_len; m0->m_pkthdr.len += m->m_len;
@ -1129,6 +1127,8 @@ vio_rxeof(struct vio_softc *sc)
} }
if (bufs_left == 0) { if (bufs_left == 0) {
if (virtio_has_feature(vsc, VIRTIO_NET_F_GUEST_CSUM))
vio_rx_offload(m0, hdr);
ml_enqueue(&ml, m0); ml_enqueue(&ml, m0);
m0 = NULL; m0 = NULL;
} }

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ums.c,v 1.52 2024/05/23 03:21:09 jsg Exp $ */ /* $OpenBSD: ums.c,v 1.53 2024/05/26 20:06:27 mglocker Exp $ */
/* $NetBSD: ums.c,v 1.60 2003/03/11 16:44:00 augustss Exp $ */ /* $NetBSD: ums.c,v 1.60 2003/03/11 16:44:00 augustss Exp $ */
/* /*
@ -178,14 +178,14 @@ ums_attach(struct device *parent, struct device *self, void *aux)
ms->sc_loc_btn[2].pos = 2; ms->sc_loc_btn[2].pos = 2;
} }
hidms_attach(ms, &ums_accessops);
if (sc->sc_quirks & UQ_ALWAYS_OPEN) { if (sc->sc_quirks & UQ_ALWAYS_OPEN) {
/* open uhidev and keep it open */ /* open uhidev and keep it open */
ums_enable(sc); ums_enable(sc);
/* but mark the hidms not in use */ /* but mark the hidms not in use */
ums_disable(sc); ums_disable(sc);
} }
hidms_attach(ms, &ums_accessops);
} }
int int

View file

@ -1,4 +1,4 @@
/* $OpenBSD: umt.c,v 1.7 2024/05/23 03:21:09 jsg Exp $ */ /* $OpenBSD: umt.c,v 1.8 2024/05/26 20:06:27 mglocker Exp $ */
/* /*
* USB multitouch touchpad driver for devices conforming to * USB multitouch touchpad driver for devices conforming to
* Windows Precision Touchpad standard * Windows Precision Touchpad standard
@ -181,14 +181,14 @@ umt_attach(struct device *parent, struct device *self, void *aux)
if (hidmt_setup(self, mt, desc, size) != 0) if (hidmt_setup(self, mt, desc, size) != 0)
return; return;
hidmt_attach(mt, &umt_accessops);
if (sc->sc_quirks & UQ_ALWAYS_OPEN) { if (sc->sc_quirks & UQ_ALWAYS_OPEN) {
/* open uhidev and keep it open */ /* open uhidev and keep it open */
umt_enable(sc); umt_enable(sc);
/* but mark the hidmt not in use */ /* but mark the hidmt not in use */
umt_disable(sc); umt_disable(sc);
} }
hidmt_attach(mt, &umt_accessops);
} }
int int

View file

@ -1,4 +1,4 @@
/* $OpenBSD: subr_suspend.c,v 1.16 2023/07/12 18:40:06 cheloha Exp $ */ /* $OpenBSD: subr_suspend.c,v 1.18 2024/05/28 09:40:40 kettenis Exp $ */
/* /*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com> * Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org> * Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
@ -84,7 +84,6 @@ top:
uvmpd_hibernate(); uvmpd_hibernate();
if (hibernate_alloc()) { if (hibernate_alloc()) {
printf("failed to allocate hibernate memory\n"); printf("failed to allocate hibernate memory\n");
sleep_abort(v);
error = ENOMEM; error = ENOMEM;
goto fail_hiballoc; goto fail_hiballoc;
} }
@ -93,7 +92,6 @@ top:
sensor_quiesce(); sensor_quiesce();
if (config_suspend_all(DVACT_QUIESCE)) { if (config_suspend_all(DVACT_QUIESCE)) {
sleep_abort(v);
error = EIO; error = EIO;
goto fail_quiesce; goto fail_quiesce;
} }
@ -132,15 +130,14 @@ top:
s = splhigh(); s = splhigh();
intr_disable(); /* PSL_I for resume; PIC/APIC broken until repair */ intr_disable(); /* PSL_I for resume; PIC/APIC broken until repair */
cold = 2; /* Force other code to delay() instead of tsleep() */ cold = 2; /* Force other code to delay() instead of tsleep() */
intr_enable_wakeup();
if (config_suspend_all(DVACT_SUSPEND) != 0) { if (config_suspend_all(DVACT_SUSPEND) != 0) {
sleep_abort(v);
error = EDEADLK; error = EDEADLK;
goto fail_suspend; goto fail_suspend;
} }
suspend_randomness(); suspend_randomness();
if (sleep_setstate(v)) { if (sleep_setstate(v)) {
sleep_abort(v);
error = ENOTBLK; error = ENOTBLK;
goto fail_pts; goto fail_pts;
} }
@ -172,6 +169,7 @@ fail_pts:
config_suspend_all(DVACT_RESUME); config_suspend_all(DVACT_RESUME);
fail_suspend: fail_suspend:
intr_disable_wakeup();
cold = 0; cold = 0;
intr_enable(); intr_enable();
splx(s); splx(s);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: device.h,v 1.66 2023/07/08 14:44:43 tobhe Exp $ */ /* $OpenBSD: device.h,v 1.67 2024/05/28 09:40:40 kettenis Exp $ */
/* $NetBSD: device.h,v 1.15 1996/04/09 20:55:24 cgd Exp $ */ /* $NetBSD: device.h,v 1.15 1996/04/09 20:55:24 cgd Exp $ */
/* /*
@ -208,7 +208,6 @@ void resume_mp(void);
int sleep_showstate(void *v, int sleepmode); int sleep_showstate(void *v, int sleepmode);
int sleep_setstate(void *v); int sleep_setstate(void *v);
int sleep_resume(void *v); int sleep_resume(void *v);
void sleep_abort(void *v);
int gosleep(void *v); int gosleep(void *v);
int suspend_finish(void *v); int suspend_finish(void *v);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: systm.h,v 1.170 2023/10/30 07:04:36 claudio Exp $ */ /* $OpenBSD: systm.h,v 1.171 2024/05/28 12:50:23 jsg Exp $ */
/* $NetBSD: systm.h,v 1.50 1996/06/09 04:55:09 briggs Exp $ */ /* $NetBSD: systm.h,v 1.50 1996/06/09 04:55:09 briggs Exp $ */
/*- /*-
@ -91,7 +91,6 @@ extern int ncpusfound; /* number of CPUs found */
extern int nblkdev; /* number of entries in bdevsw */ extern int nblkdev; /* number of entries in bdevsw */
extern int nchrdev; /* number of entries in cdevsw */ extern int nchrdev; /* number of entries in cdevsw */
extern int maxmem; /* max memory per process */
extern int physmem; /* physical memory */ extern int physmem; /* physical memory */
extern dev_t dumpdev; /* dump device */ extern dev_t dumpdev; /* dump device */

View file

@ -1,4 +1,4 @@
/* $OpenBSD: uvm_swap_encrypt.h,v 1.11 2024/05/12 09:27:13 jsg Exp $ */ /* $OpenBSD: uvm_swap_encrypt.h,v 1.12 2024/05/28 12:31:24 jsg Exp $ */
/* /*
* Copyright 1999 Niels Provos <provos@citi.umich.edu> * Copyright 1999 Niels Provos <provos@citi.umich.edu>
@ -79,7 +79,6 @@ void swap_key_create(struct swap_key *);
void swap_key_delete(struct swap_key *); void swap_key_delete(struct swap_key *);
extern int uvm_doswapencrypt; /* swapencrypt enabled/disabled */ extern int uvm_doswapencrypt; /* swapencrypt enabled/disabled */
extern u_int uvm_swpkeyexpire; /* expiry time for keys (tR) */
extern int swap_encrypt_initialized; extern int swap_encrypt_initialized;
#endif /* _UVM_SWAP_ENCRYPT_H */ #endif /* _UVM_SWAP_ENCRYPT_H */

View file

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.12 2023/04/25 16:11:02 tb Exp $ # $OpenBSD: Makefile,v 1.13 2024/05/27 16:11:43 tb Exp $
.include <bsd.own.mk> .include <bsd.own.mk>
@ -11,12 +11,12 @@ CFLAGS+= -Wformat
CFLAGS+= -Wformat-security CFLAGS+= -Wformat-security
CFLAGS+= -Wimplicit CFLAGS+= -Wimplicit
CFLAGS+= -Wreturn-type CFLAGS+= -Wreturn-type
#CFLAGS+= -Wshadow
CFLAGS+= -Wtrigraphs CFLAGS+= -Wtrigraphs
CFLAGS+= -Wuninitialized CFLAGS+= -Wuninitialized
CFLAGS+= -Wunused CFLAGS+= -Wunused
.if ${COMPILER_VERSION:L} == "clang" .if ${COMPILER_VERSION:L} == "clang"
CFLAGS+= -Werror CFLAGS+= -Werror
CFLAGS+= -Wshadow
.endif .endif
CFLAGS+= -DLIBRESSL_INTERNAL CFLAGS+= -DLIBRESSL_INTERNAL

View file

@ -1,4 +1,4 @@
/* $OpenBSD: x509.c,v 1.37 2024/01/26 11:58:37 job Exp $ */ /* $OpenBSD: x509.c,v 1.39 2024/05/27 16:12:55 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved. * All rights reserved.
* *
@ -1142,44 +1142,42 @@ x509_main(int argc, char **argv)
purpose_print(STDout, x, ptmp); purpose_print(STDout, x, ptmp);
} }
} else if (cfg.modulus == i) { } else if (cfg.modulus == i) {
EVP_PKEY *pkey; EVP_PKEY *pubkey;
pkey = X509_get0_pubkey(x); if ((pubkey = X509_get0_pubkey(x)) == NULL) {
if (pkey == NULL) {
BIO_printf(bio_err, BIO_printf(bio_err,
"Modulus=unavailable\n"); "Modulus=unavailable\n");
ERR_print_errors(bio_err); ERR_print_errors(bio_err);
goto end; goto end;
} }
BIO_printf(STDout, "Modulus="); BIO_printf(STDout, "Modulus=");
if (EVP_PKEY_id(pkey) == EVP_PKEY_RSA) { if (EVP_PKEY_id(pubkey) == EVP_PKEY_RSA) {
RSA *rsa = EVP_PKEY_get0_RSA(pkey); RSA *rsa = EVP_PKEY_get0_RSA(pubkey);
const BIGNUM *n = NULL; const BIGNUM *n = NULL;
RSA_get0_key(rsa, &n, NULL, NULL); RSA_get0_key(rsa, &n, NULL, NULL);
BN_print(STDout, n); BN_print(STDout, n);
} else if (EVP_PKEY_id(pkey) == EVP_PKEY_DSA) { } else if (EVP_PKEY_id(pubkey) == EVP_PKEY_DSA) {
DSA *dsa = EVP_PKEY_get0_DSA(pkey); DSA *dsa = EVP_PKEY_get0_DSA(pubkey);
const BIGNUM *pub_key = NULL; const BIGNUM *dsa_pub_key = NULL;
DSA_get0_key(dsa, &pub_key, NULL); DSA_get0_key(dsa, &dsa_pub_key, NULL);
BN_print(STDout, pub_key); BN_print(STDout, dsa_pub_key);
} else } else
BIO_printf(STDout, BIO_printf(STDout,
"Wrong Algorithm type"); "Wrong Algorithm type");
BIO_printf(STDout, "\n"); BIO_printf(STDout, "\n");
} else if (cfg.pubkey == i) { } else if (cfg.pubkey == i) {
EVP_PKEY *pkey; EVP_PKEY *pubkey;
pkey = X509_get0_pubkey(x); if ((pubkey = X509_get0_pubkey(x)) == NULL) {
if (pkey == NULL) {
BIO_printf(bio_err, BIO_printf(bio_err,
"Error getting public key\n"); "Error getting public key\n");
ERR_print_errors(bio_err); ERR_print_errors(bio_err);
goto end; goto end;
} }
PEM_write_bio_PUBKEY(STDout, pkey); PEM_write_bio_PUBKEY(STDout, pubkey);
} else if (cfg.C == i) { } else if (cfg.C == i) {
unsigned char *d; unsigned char *d;
char *m; char *m;

View file

@ -15,7 +15,6 @@
*/ */
#include <sys/types.h> #include <sys/types.h>
#include <sys/queue.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

View file

@ -33,8 +33,8 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\" .\"
.\" $OpenBSD: ssh.1,v 1.439 2024/03/14 06:23:14 job Exp $ .\" $OpenBSD: ssh.1,v 1.440 2024/05/26 20:35:12 naddy Exp $
.Dd $Mdocdate: March 14 2024 $ .Dd $Mdocdate: May 26 2024 $
.Dt SSH 1 .Dt SSH 1
.Os .Os
.Sh NAME .Sh NAME
@ -1633,8 +1633,6 @@ Systemwide configuration file.
The file format and configuration options are described in The file format and configuration options are described in
.Xr ssh_config 5 . .Xr ssh_config 5 .
.Pp .Pp
.It Pa /etc/ssh/ssh_host_key
.It Pa /etc/ssh/ssh_host_dsa_key
.It Pa /etc/ssh/ssh_host_ecdsa_key .It Pa /etc/ssh/ssh_host_ecdsa_key
.It Pa /etc/ssh/ssh_host_ed25519_key .It Pa /etc/ssh/ssh_host_ed25519_key
.It Pa /etc/ssh/ssh_host_rsa_key .It Pa /etc/ssh/ssh_host_rsa_key

View file

@ -1,4 +1,4 @@
/* $OpenBSD: smtpd.h,v 1.684 2024/05/07 12:10:06 op Exp $ */ /* $OpenBSD: smtpd.h,v 1.685 2024/05/28 07:10:30 op Exp $ */
/* /*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@ -356,6 +356,7 @@ struct table {
enum table_type t_type; enum table_type t_type;
char t_config[PATH_MAX]; char t_config[PATH_MAX];
unsigned int t_services;
void *t_handle; void *t_handle;
struct table_backend *t_backend; struct table_backend *t_backend;
}; };

View file

@ -1,4 +1,4 @@
/* $OpenBSD: table.c,v 1.52 2024/05/07 12:10:06 op Exp $ */ /* $OpenBSD: table.c,v 1.53 2024/05/28 07:10:30 op Exp $ */
/* /*
* Copyright (c) 2013 Eric Faurot <eric@openbsd.org> * Copyright (c) 2013 Eric Faurot <eric@openbsd.org>
@ -245,6 +245,7 @@ table_create(struct smtpd *conf, const char *backend, const char *name,
fatalx("table_create: backend \"%s\" does not exist", backend); fatalx("table_create: backend \"%s\" does not exist", backend);
t = xcalloc(1, sizeof(*t)); t = xcalloc(1, sizeof(*t));
t->t_services = tb->services;
t->t_backend = tb; t->t_backend = tb;
if (config) { if (config) {
@ -341,7 +342,7 @@ table_check_type(struct table *t, uint32_t mask)
int int
table_check_service(struct table *t, uint32_t mask) table_check_service(struct table *t, uint32_t mask)
{ {
return t->t_backend->services & mask; return t->t_services & mask;
} }
int int

View file

@ -1,4 +1,4 @@
/* $OpenBSD: table_proc.c,v 1.22 2024/05/23 17:10:00 op Exp $ */ /* $OpenBSD: table_proc.c,v 1.23 2024/05/28 07:10:30 op Exp $ */
/* /*
* Copyright (c) 2024 Omar Polo <op@openbsd.org> * Copyright (c) 2024 Omar Polo <op@openbsd.org>
@ -172,6 +172,7 @@ table_proc_open(struct table *table)
if (services == 0) if (services == 0)
fatalx("table-proc: no services registered"); fatalx("table-proc: no services registered");
table->t_services = services;
table->t_handle = priv; table->t_handle = priv;
return (1); return (1);