sync code with last improvements from OpenBSD

This commit is contained in:
purplerain 2023-10-10 01:27:26 +00:00
parent cb73df2d98
commit e4e1b9f314
Signed by: purplerain
GPG Key ID: F42C07F07E2E35B7
26 changed files with 382 additions and 253 deletions

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: uname.3,v 1.18 2022/09/11 06:38:10 jmc Exp $
.\" $OpenBSD: uname.3,v 1.19 2023/10/09 19:32:51 schwarze Exp $
.\"
.\" Copyright (c) 1994
.\" The Regents of the University of California. All rights reserved.
@ -27,7 +27,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd $Mdocdate: September 11 2022 $
.Dd $Mdocdate: October 9 2023 $
.Dt UNAME 3
.Os
.Sh NAME
@ -62,6 +62,13 @@ Version level of the operating system.
.It Fa machine
Machine hardware platform.
.El
.Pp
These are the same strings that can be displayed with
.Xr uname 1 .
Because their format and meaning depends on the operating system,
trying to parse or interpret them is discouraged in portable code.
The only reasonable way an application program can use them
is for displaying them to the user.
.Sh RETURN VALUES
The
.Fn uname

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: ASN1_TYPE_get.3,v 1.18 2022/01/12 17:54:51 tb Exp $
.\" $OpenBSD: ASN1_TYPE_get.3,v 1.19 2023/10/09 16:06:01 tb Exp $
.\" selective merge up to: OpenSSL 6328d367 Jul 4 21:58:30 2020 +0200
.\"
.\" This file is a derived work.
@ -65,7 +65,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: January 12 2022 $
.Dd $Mdocdate: October 9 2023 $
.Dt ASN1_TYPE_GET 3
.Os
.Sh NAME
@ -148,7 +148,8 @@ It also remembers internally which type it currently holds.
.Fn ASN1_TYPE_new
allocates and initializes an empty
.Vt ASN1_TYPE
object of undefined type.
object of type
.Dv V_ASN1_UNDEF .
.Pp
.Fn ASN1_TYPE_free
frees

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: X509_ALGOR_dup.3,v 1.16 2021/07/06 16:05:44 schwarze Exp $
.\" $OpenBSD: X509_ALGOR_dup.3,v 1.18 2023/10/09 16:59:55 tb Exp $
.\" OpenSSL 4692340e Jun 7 15:49:08 2016 -0400
.\"
.\" This file is a derived work.
@ -65,7 +65,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: July 6 2021 $
.Dd $Mdocdate: October 9 2023 $
.Dt X509_ALGOR_DUP 3
.Os
.Sh NAME
@ -125,7 +125,13 @@ certificate revocation lists, and certificate requests.
.Pp
.Fn X509_ALGOR_free
frees
.Fa alg .
.Fa alg
and any data contained in it.
If
.Fa alg
is
.Dv NULL ,
no action occurs.
.Pp
.Fn X509_ALGOR_dup
copies
@ -147,8 +153,20 @@ with value
If
.Fa ptype
is
.Dv V_ASN1_UNDEF ,
the parameter is omitted and
.Fa pval
is ignored.
If
.Fa ptype
is zero,
.Fa pval
is ignored and the existing parameter is left unchanged, or if
.Fa alg
does not contain a parameter, a new, empty parameter of type
.Dv V_ASN1_UNDEF
the parameter is omitted, otherwise
is added.
Otherwise
.Fa ptype
and
.Fa pval
@ -158,9 +176,13 @@ and
.Fa value
parameters to
.Xr ASN1_TYPE_set 3 .
All the supplied parameters are used internally so must
.Sy NOT
be freed after this call.
Ownership of
.Fa aobj
and, unless it is ignored, of
.Fa pval
is transferred to
.Fa alg
on success.
.Pp
.Fn X509_ALGOR_get0
is the inverse of
@ -179,6 +201,21 @@ sets
.Fa alg
to appropriate values for the message digest
.Fa md .
If the
.Dv EVP_MD_FLAG_DIGALGID_ABSENT
flag is not set on
.Fa md ,
.Fn X509_ALGOR_set_md
can leave
.Fa alg
in a corrupted state due to memory allocation failure.
This problem can be avoided by preallocating with an error-checked call to
.Fn X509_ALGOR_set0 alg NULL 0 NULL ,
or the failure can be identified by
.Fn X509_ALGOR_get0 &aobj NULL NULL alg
returning a
.Dv NULL
.Fa aobj .
.Pp
.Fn X509_ALGOR_cmp
compares
@ -196,7 +233,11 @@ object or
if an error occurs.
.Pp
.Fn X509_ALGOR_set0
returns 1 for success or 0 for failure.
returns 1 for success or 0 if
.Fa alg
is
.Dv NULL
or memory allocation fails.
.Pp
.Fn X509_ALGOR_cmp
returns 0 if
@ -240,3 +281,6 @@ and has been available since
.Fn X509_ALGOR_set_md
first appeared in OpenSSL 1.0.1 and has been available since
.Ox 5.3 .
.Sh BUGS
.Fn X509_ALGOR_set_md
can fail but cannot communicate failure to the caller.

View File

@ -1,4 +1,4 @@
/* $OpenBSD: ipsecctl.c,v 1.85 2023/03/07 17:43:59 guenther Exp $ */
/* $OpenBSD: ipsecctl.c,v 1.86 2023/10/09 15:32:14 tobhe Exp $ */
/*
* Copyright (c) 2004, 2005 Hans-Joerg Hoexer <hshoexer@openbsd.org>
*
@ -57,10 +57,10 @@ void ipsecctl_print_flow(struct ipsec_rule *, int);
void ipsecctl_print_sa(struct ipsec_rule *, int);
void ipsecctl_print_sabundle(struct ipsec_rule *, int);
int ipsecctl_flush(int);
void ipsecctl_get_rules(struct ipsecctl *);
char *ipsecctl_get_rules(struct ipsecctl *, size_t *);
void ipsecctl_parse_rules(struct ipsecctl *, char *, size_t);
void ipsecctl_print_title(char *);
void ipsecctl_show_flows(int);
void ipsecctl_show_sas(int);
void ipsecctl_show(int);
int ipsecctl_monitor(int);
void usage(void);
const char *ipsecctl_lookup_option(char *, const char **);
@ -595,30 +595,37 @@ ipsecctl_flush(int opts)
return (0);
}
void
ipsecctl_get_rules(struct ipsecctl *ipsec)
char *
ipsecctl_get_rules(struct ipsecctl *ipsec, size_t *need)
{
struct sadb_msg *msg;
struct ipsec_rule *rule, *last = NULL;
int mib[4];
size_t need;
char *buf, *lim, *next;
char *buf;
mib[0] = CTL_NET;
mib[1] = PF_KEY;
mib[2] = PF_KEY_V2;
mib[3] = NET_KEY_SPD_DUMP;
if (sysctl(mib, 4, NULL, &need, NULL, 0) == -1)
if (sysctl(mib, 4, NULL, need, NULL, 0) == -1)
err(1, "ipsecctl_get_rules: sysctl");
if (need == 0)
return;
if ((buf = malloc(need)) == NULL)
if (*need == 0)
return NULL;
if ((buf = malloc(*need)) == NULL)
err(1, "ipsecctl_get_rules: malloc");
if (sysctl(mib, 4, buf, &need, NULL, 0) == -1)
if (sysctl(mib, 4, buf, need, NULL, 0) == -1)
err(1, "ipsecctl_get_rules: sysctl");
lim = buf + need;
return buf;
}
void
ipsecctl_parse_rules(struct ipsecctl *ipsec, char *buf, size_t need)
{
struct sadb_msg *msg;
struct ipsec_rule *rule, *last = NULL;
char *lim, *next;
lim = buf + need;
for (next = buf; next < lim; next += msg->sadb_msg_len *
PFKEYV2_CHUNK) {
msg = (struct sadb_msg *)next;
@ -627,13 +634,13 @@ ipsecctl_get_rules(struct ipsecctl *ipsec)
rule = calloc(1, sizeof(struct ipsec_rule));
if (rule == NULL)
err(1, "ipsecctl_get_rules: calloc");
err(1, "ipsecctl_parse_rules: calloc");
rule->nr = ipsec->rule_nr++;
rule->type |= RULE_FLOW;
TAILQ_INIT(&rule->collapsed_rules);
if (pfkey_parse(msg, rule))
errx(1, "ipsecctl_get_rules: "
errx(1, "ipsecctl_parse_rules: "
"failed to parse PF_KEY message");
/*
@ -663,108 +670,117 @@ ipsecctl_print_title(char *title)
}
void
ipsecctl_show_flows(int opts)
ipsecctl_show(int opts)
{
struct ipsecctl ipsec;
struct ipsec_rule *rp;
bzero(&ipsec, sizeof(ipsec));
ipsec.opts = opts;
TAILQ_INIT(&ipsec.rule_queue);
ipsecctl_get_rules(&ipsec);
if (opts & IPSECCTL_OPT_SHOWALL)
ipsecctl_print_title("FLOWS:");
if (TAILQ_FIRST(&ipsec.rule_queue) == 0) {
if (opts & IPSECCTL_OPT_SHOWALL)
printf("No flows\n");
return;
}
while ((rp = TAILQ_FIRST(&ipsec.rule_queue))) {
TAILQ_REMOVE(&ipsec.rule_queue, rp, rule_entry);
ipsecctl_print_rule(rp, ipsec.opts);
free(rp->src->name);
free(rp->src);
free(rp->dst->name);
free(rp->dst);
if (rp->local) {
free(rp->local->name);
free(rp->local);
}
if (rp->peer) {
free(rp->peer->name);
free(rp->peer);
}
if (rp->auth) {
free(rp->auth->srcid);
free(rp->auth->dstid);
free(rp->auth);
}
free(rp);
}
}
void
ipsecctl_show_sas(int opts)
{
struct sadb_msg *msg;
struct sad *sad;
int mib[5], sacount, i;
size_t need = 0;
char *buf, *lim, *next;
size_t need = 0, rlen;
char *sbuf = NULL, *rbuf = NULL, *lim, *next;
mib[0] = CTL_NET;
mib[1] = PF_KEY;
mib[2] = PF_KEY_V2;
mib[3] = NET_KEY_SADB_DUMP;
mib[4] = SADB_SATYPE_UNSPEC;
if (opts & IPSECCTL_OPT_SHOWFLOWS) {
bzero(&ipsec, sizeof(ipsec));
ipsec.opts = opts;
TAILQ_INIT(&ipsec.rule_queue);
rbuf = ipsecctl_get_rules(&ipsec, &rlen);
}
if (opts & IPSECCTL_OPT_SHOWALL)
ipsecctl_print_title("SAD:");
if (opts & IPSECCTL_OPT_SHOWSAS) {
mib[0] = CTL_NET;
mib[1] = PF_KEY;
mib[2] = PF_KEY_V2;
mib[3] = NET_KEY_SADB_DUMP;
mib[4] = SADB_SATYPE_UNSPEC;
/* When the SAD is empty we get ENOENT, no need to err(). */
if (sysctl(mib, 5, NULL, &need, NULL, 0) == -1 &&
errno != ENOENT)
err(1, "ipsecctl_show: sysctl");
if (need > 0) {
if ((sbuf = malloc(need)) == NULL)
err(1, "ipsecctl_show: malloc");
if (sysctl(mib, 5, sbuf, &need, NULL, 0) == -1)
err(1, "ipsecctl_show: sysctl");
}
}
if (pledge("stdio", NULL) == -1)
err(1, "pledge");
if (rbuf != NULL) {
ipsecctl_parse_rules(&ipsec, rbuf, rlen);
/* When the SAD is empty we get ENOENT, no need to err(). */
if (sysctl(mib, 5, NULL, &need, NULL, 0) == -1 && errno != ENOENT)
err(1, "ipsecctl_show_sas: sysctl");
if (need == 0) {
if (opts & IPSECCTL_OPT_SHOWALL)
printf("No entries\n");
return;
ipsecctl_print_title("FLOWS:");
if (TAILQ_FIRST(&ipsec.rule_queue) != NULL) {
while ((rp = TAILQ_FIRST(&ipsec.rule_queue))) {
TAILQ_REMOVE(&ipsec.rule_queue, rp, rule_entry);
ipsecctl_print_rule(rp, ipsec.opts);
free(rp->src->name);
free(rp->src);
free(rp->dst->name);
free(rp->dst);
if (rp->local) {
free(rp->local->name);
free(rp->local);
}
if (rp->peer) {
free(rp->peer->name);
free(rp->peer);
}
if (rp->auth) {
free(rp->auth->srcid);
free(rp->auth->dstid);
free(rp->auth);
}
free(rp);
}
}
} else if (opts & IPSECCTL_OPT_SHOWALL) {
ipsecctl_print_title("FLOWS:");
if (opts & IPSECCTL_OPT_SHOWALL)
printf("No flows\n");
}
if ((buf = malloc(need)) == NULL)
err(1, "ipsecctl_show_sas: malloc");
if (sysctl(mib, 5, buf, &need, NULL, 0) == -1)
err(1, "ipsecctl_show_sas: sysctl");
sacount = 0;
lim = buf + need;
for (next = buf; next < lim;
next += msg->sadb_msg_len * PFKEYV2_CHUNK) {
msg = (struct sadb_msg *)next;
if (msg->sadb_msg_len == 0)
break;
sacount++;
if (sbuf != NULL) {
if (opts & IPSECCTL_OPT_SHOWALL)
ipsecctl_print_title("SAD:");
sacount = 0;
lim = sbuf + need;
for (next = sbuf; next < lim;
next += msg->sadb_msg_len * PFKEYV2_CHUNK) {
msg = (struct sadb_msg *)next;
if (msg->sadb_msg_len == 0)
break;
sacount++;
}
if ((sad = calloc(sacount, sizeof(*sad))) == NULL)
err(1, "ipsecctl_show: calloc");
i = 0;
for (next = sbuf; next < lim;
next += msg->sadb_msg_len * PFKEYV2_CHUNK) {
msg = (struct sadb_msg *)next;
if (msg->sadb_msg_len == 0)
break;
sad[i].sad_spi = pfkey_get_spi(msg);
sad[i].sad_msg = msg;
i++;
}
qsort(sad, sacount, sizeof(*sad), sacompare);
for (i = 0; i < sacount; i++)
pfkey_print_sa(sad[i].sad_msg, opts);
free(sad);
free(sbuf);
} else if (opts & IPSECCTL_OPT_SHOWALL) {
ipsecctl_print_title("SAD:");
printf("No entries\n");
}
if ((sad = calloc(sacount, sizeof(*sad))) == NULL)
err(1, "ipsecctl_show_sas: calloc");
i = 0;
for (next = buf; next < lim;
next += msg->sadb_msg_len * PFKEYV2_CHUNK) {
msg = (struct sadb_msg *)next;
if (msg->sadb_msg_len == 0)
break;
sad[i].sad_spi = pfkey_get_spi(msg);
sad[i].sad_msg = msg;
i++;
}
qsort(sad, sacount, sizeof(*sad), sacompare);
for (i = 0; i < sacount; i++)
pfkey_print_sa(sad[i].sad_msg, opts);
free(sad);
free(buf);
}
int
@ -882,16 +898,18 @@ main(int argc, char *argv[])
if (showopt != NULL) {
switch (*showopt) {
case 'f':
ipsecctl_show_flows(opts);
opts |= IPSECCTL_OPT_SHOWFLOWS;
break;
case 's':
ipsecctl_show_sas(opts);
opts |= IPSECCTL_OPT_SHOWSAS;
break;
case 'a':
opts |= IPSECCTL_OPT_SHOWFLOWS;
opts |= IPSECCTL_OPT_SHOWSAS;
opts |= IPSECCTL_OPT_SHOWALL;
ipsecctl_show_flows(opts);
ipsecctl_show_sas(opts);
break;
}
ipsecctl_show(opts);
}
if (opts & IPSECCTL_OPT_MONITOR)

View File

@ -1,4 +1,4 @@
/* $OpenBSD: ipsecctl.h,v 1.76 2023/08/07 04:10:08 dlg Exp $ */
/* $OpenBSD: ipsecctl.h,v 1.77 2023/10/09 15:32:14 tobhe Exp $ */
/*
* Copyright (c) 2004, 2005 Hans-Joerg Hoexer <hshoexer@openbsd.org>
*
@ -30,6 +30,8 @@
#define IPSECCTL_OPT_MONITOR 0x0400
#define IPSECCTL_OPT_SHOWKEY 0x0800
#define IPSECCTL_OPT_COLLAPSE 0x1000
#define IPSECCTL_OPT_SHOWFLOWS 0x2000
#define IPSECCTL_OPT_SHOWSAS 0x4000
enum {
ACTION_ADD, ACTION_DELETE
@ -244,7 +246,6 @@ int parse_rules(const char *, struct ipsecctl *);
int cmdline_symset(char *);
int ipsecctl_add_rule(struct ipsecctl *, struct ipsec_rule *);
void ipsecctl_free_rule(struct ipsec_rule *);
void ipsecctl_get_rules(struct ipsecctl *);
void ipsecctl_print_rule(struct ipsec_rule *, int);
int ike_print_config(struct ipsec_rule *, int);
int ike_ipsec_establish(int, struct ipsec_rule *, const char *);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: pfkey.c,v 1.63 2021/10/22 12:30:54 bluhm Exp $ */
/* $OpenBSD: pfkey.c,v 1.64 2023/10/09 15:32:14 tobhe Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
* Copyright (c) 2003, 2004 Markus Friedl <markus@openbsd.org>
@ -1324,6 +1324,9 @@ pfkey_monitor(int opts)
if (pfkey_promisc() < 0)
return -1;
if (pledge("stdio", NULL) == -1)
err(1, "pledge");
pfd[0].fd = fd;
pfd[0].events = POLLIN;
for (;;) {

View File

@ -1,4 +1,4 @@
/* $OpenBSD: efiacpi.c,v 1.15 2023/09/12 08:22:07 jmatthew Exp $ */
/* $OpenBSD: efiacpi.c,v 1.16 2023/10/09 22:05:27 patrick Exp $ */
/*
* Copyright (c) 2018 Mark Kettenis <kettenis@openbsd.org>
@ -573,7 +573,8 @@ efi_acpi_madt(struct acpi_table_header *hdr)
reg[3] = htobe64(0x100);
break;
case 3:
/* GICv3 */
case 4:
/* GICv3 and GICv4 */
compat = "arm,gic-v3";
reg[0] = htobe64(gicd_base);
reg[1] = htobe64(0x10000);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: if_dwqe_fdt.c,v 1.15 2023/08/30 19:08:48 kettenis Exp $ */
/* $OpenBSD: if_dwqe_fdt.c,v 1.16 2023/10/09 14:25:00 stsp Exp $ */
/*
* Copyright (c) 2008, 2019 Mark Kettenis <kettenis@openbsd.org>
* Copyright (c) 2017, 2022 Patrick Wildt <patrick@blueri.se>
@ -61,16 +61,22 @@
#include <dev/ic/dwqevar.h>
#include <dev/ic/dwqereg.h>
struct dwqe_fdt_softc {
struct dwqe_softc sc_sc;
struct if_device sc_ifd;
int sc_gmac_id;
};
int dwqe_fdt_match(struct device *, void *, void *);
void dwqe_fdt_attach(struct device *, struct device *, void *);
void dwqe_setup_jh7110(struct dwqe_softc *);
void dwqe_mii_statchg_jh7110(struct device *);
void dwqe_setup_rk3568(struct dwqe_softc *);
void dwqe_setup_rk3568(struct dwqe_fdt_softc *);
void dwqe_mii_statchg_rk3568(struct device *);
void dwqe_mii_statchg_rk3588(struct device *);
const struct cfattach dwqe_fdt_ca = {
sizeof(struct dwqe_softc), dwqe_fdt_match, dwqe_fdt_attach
sizeof(struct dwqe_fdt_softc), dwqe_fdt_match, dwqe_fdt_attach
};
void dwqe_reset_phy(struct dwqe_softc *, uint32_t);
@ -87,7 +93,8 @@ dwqe_fdt_match(struct device *parent, void *cfdata, void *aux)
void
dwqe_fdt_attach(struct device *parent, struct device *self, void *aux)
{
struct dwqe_softc *sc = (void *)self;
struct dwqe_fdt_softc *fsc = (void *)self;
struct dwqe_softc *sc = &fsc->sc_sc;
struct fdt_attach_args *faa = aux;
char phy_mode[16] = { 0 };
uint32_t phy, phy_supply;
@ -108,18 +115,18 @@ dwqe_fdt_attach(struct device *parent, struct device *self, void *aux)
switch (faa->fa_reg[0].addr) {
case 0xfe2a0000: /* RK3568 */
case 0x16030000: /* JH7110 */
sc->sc_gmac_id = 0;
fsc->sc_gmac_id = 0;
break;
case 0xfe010000: /* RK3568 */
case 0x16040000: /* JH7110 */
sc->sc_gmac_id = 1;
fsc->sc_gmac_id = 1;
break;
default:
printf(": unknown controller at 0x%llx\n", faa->fa_reg[0].addr);
return;
}
printf(" gmac %d", sc->sc_gmac_id);
printf(" gmac %d", fsc->sc_gmac_id);
OF_getprop(faa->fa_node, "phy-mode", phy_mode, sizeof(phy_mode));
if (strcmp(phy_mode, "rgmii") == 0)
@ -167,7 +174,7 @@ dwqe_fdt_attach(struct device *parent, struct device *self, void *aux)
if (OF_is_compatible(faa->fa_node, "starfive,jh7110-dwmac"))
dwqe_setup_jh7110(sc);
else if (OF_is_compatible(faa->fa_node, "rockchip,rk3568-gmac"))
dwqe_setup_rk3568(sc);
dwqe_setup_rk3568(fsc);
/* Power up PHY. */
phy_supply = OF_getpropint(faa->fa_node, "phy-supply", 0);
@ -252,9 +259,9 @@ dwqe_fdt_attach(struct device *parent, struct device *self, void *aux)
if (sc->sc_ih == NULL)
printf("%s: can't establish interrupt\n", sc->sc_dev.dv_xname);
sc->sc_ifd.if_node = faa->fa_node;
sc->sc_ifd.if_ifp = ifp;
if_register(&sc->sc_ifd);
fsc->sc_ifd.if_node = faa->fa_node;
fsc->sc_ifd.if_ifp = ifp;
if_register(&fsc->sc_ifd);
/* force a configuration of the clocks/mac */
if (sc->sc_fixed_link)
@ -400,8 +407,9 @@ dwqe_mii_statchg_jh7110(struct device *self)
}
void
dwqe_setup_rk3568(struct dwqe_softc *sc)
dwqe_setup_rk3568(struct dwqe_fdt_softc *fsc)
{
struct dwqe_softc *sc = &fsc->sc_sc;
char phy_mode[32];
struct regmap *rm;
uint32_t grf;
@ -439,12 +447,12 @@ dwqe_setup_rk3568(struct dwqe_softc *sc)
return;
/* Program clock delay lines. */
regmap_write_4(rm, RK3568_GRF_GMACx_CON0(sc->sc_gmac_id),
regmap_write_4(rm, RK3568_GRF_GMACx_CON0(fsc->sc_gmac_id),
RK3568_GMAC_CLK_TX_DL_CFG(tx_delay) |
RK3568_GMAC_CLK_RX_DL_CFG(rx_delay));
/* Set interface and enable/disable clock delay. */
regmap_write_4(rm, RK3568_GRF_GMACx_CON1(sc->sc_gmac_id), iface |
regmap_write_4(rm, RK3568_GRF_GMACx_CON1(fsc->sc_gmac_id), iface |
RK3568_GMAC_TXCLK_DLY_SET(tx_delay > 0 ? 1 : 0) |
RK3568_GMAC_RXCLK_DLY_SET(rx_delay > 0 ? 1 : 0));

View File

@ -1,4 +1,4 @@
/* $OpenBSD: bwfm.c,v 1.109 2023/03/28 14:01:42 jsg Exp $ */
/* $OpenBSD: bwfm.c,v 1.110 2023/10/09 21:49:34 kettenis Exp $ */
/*
* Copyright (c) 2010-2016 Broadcom Corporation
* Copyright (c) 2016,2017 Patrick Wildt <patrick@blueri.se>
@ -1089,15 +1089,9 @@ void
bwfm_chip_ai_reset(struct bwfm_softc *sc, struct bwfm_core *core,
uint32_t prereset, uint32_t reset, uint32_t postreset)
{
struct bwfm_core *core2 = NULL;
int i;
if (core->co_id == BWFM_AGENT_CORE_80211)
core2 = bwfm_chip_get_core_idx(sc, BWFM_AGENT_CORE_80211, 1);
bwfm_chip_ai_disable(sc, core, prereset, reset);
if (core2)
bwfm_chip_ai_disable(sc, core2, prereset, reset);
for (i = 50; i > 0; i--) {
if ((sc->sc_buscore_ops->bc_read(sc,
@ -1110,32 +1104,12 @@ bwfm_chip_ai_reset(struct bwfm_softc *sc, struct bwfm_core *core,
}
if (i == 0)
printf("%s: timeout on core reset\n", DEVNAME(sc));
if (core2) {
for (i = 50; i > 0; i--) {
if ((sc->sc_buscore_ops->bc_read(sc,
core2->co_wrapbase + BWFM_AGENT_RESET_CTL) &
BWFM_AGENT_RESET_CTL_RESET) == 0)
break;
sc->sc_buscore_ops->bc_write(sc,
core2->co_wrapbase + BWFM_AGENT_RESET_CTL, 0);
delay(60);
}
if (i == 0)
printf("%s: timeout on core reset\n", DEVNAME(sc));
}
sc->sc_buscore_ops->bc_write(sc,
core->co_wrapbase + BWFM_AGENT_IOCTL,
postreset | BWFM_AGENT_IOCTL_CLK);
sc->sc_buscore_ops->bc_read(sc,
core->co_wrapbase + BWFM_AGENT_IOCTL);
if (core2) {
sc->sc_buscore_ops->bc_write(sc,
core2->co_wrapbase + BWFM_AGENT_IOCTL,
postreset | BWFM_AGENT_IOCTL_CLK);
sc->sc_buscore_ops->bc_read(sc,
core2->co_wrapbase + BWFM_AGENT_IOCTL);
}
}
void
@ -1338,6 +1312,7 @@ bwfm_chip_ca7_set_passive(struct bwfm_softc *sc)
{
struct bwfm_core *core;
uint32_t val;
int i = 0;
core = bwfm_chip_get_core(sc, BWFM_AGENT_CORE_ARM_CA7);
val = sc->sc_buscore_ops->bc_read(sc,
@ -1347,10 +1322,11 @@ bwfm_chip_ca7_set_passive(struct bwfm_softc *sc)
BWFM_AGENT_IOCTL_ARMCR4_CPUHALT,
BWFM_AGENT_IOCTL_ARMCR4_CPUHALT);
core = bwfm_chip_get_core(sc, BWFM_AGENT_CORE_80211);
sc->sc_chip.ch_core_reset(sc, core, BWFM_AGENT_D11_IOCTL_PHYRESET |
BWFM_AGENT_D11_IOCTL_PHYCLOCKEN, BWFM_AGENT_D11_IOCTL_PHYCLOCKEN,
BWFM_AGENT_D11_IOCTL_PHYCLOCKEN);
while ((core = bwfm_chip_get_core_idx(sc, BWFM_AGENT_CORE_80211, i++)))
sc->sc_chip.ch_core_disable(sc, core,
BWFM_AGENT_D11_IOCTL_PHYRESET |
BWFM_AGENT_D11_IOCTL_PHYCLOCKEN,
BWFM_AGENT_D11_IOCTL_PHYCLOCKEN);
}
int

View File

@ -1,4 +1,4 @@
/* $OpenBSD: dwqe.c,v 1.11 2023/08/07 20:28:47 kettenis Exp $ */
/* $OpenBSD: dwqe.c,v 1.12 2023/10/09 14:25:00 stsp Exp $ */
/*
* Copyright (c) 2008, 2019 Mark Kettenis <kettenis@openbsd.org>
* Copyright (c) 2017, 2022 Patrick Wildt <patrick@blueri.se>
@ -34,19 +34,10 @@
#include <sys/timeout.h>
#include <machine/bus.h>
#include <machine/fdt.h>
#include <net/if.h>
#include <net/if_media.h>
#include <dev/ofw/openfirm.h>
#include <dev/ofw/ofw_clock.h>
#include <dev/ofw/ofw_gpio.h>
#include <dev/ofw/ofw_misc.h>
#include <dev/ofw/ofw_pinctrl.h>
#include <dev/ofw/ofw_regulator.h>
#include <dev/ofw/fdt.h>
#include <dev/mii/mii.h>
#include <dev/mii/miivar.h>

View File

@ -1,4 +1,4 @@
/* $OpenBSD: dwqevar.h,v 1.6 2023/04/24 01:33:32 dlg Exp $ */
/* $OpenBSD: dwqevar.h,v 1.7 2023/10/09 14:25:00 stsp Exp $ */
/*
* Copyright (c) 2008, 2019 Mark Kettenis <kettenis@openbsd.org>
* Copyright (c) 2017, 2022 Patrick Wildt <patrick@blueri.se>
@ -53,8 +53,6 @@ struct dwqe_softc {
bus_dma_tag_t sc_dmat;
void *sc_ih;
struct if_device sc_ifd;
struct arpcom sc_ac;
#define sc_lladdr sc_ac.ac_enaddr
struct mii_data sc_mii;
@ -88,7 +86,6 @@ struct dwqe_softc {
uint32_t sc_clk_sel_25;
uint32_t sc_clk_sel_2_5;
int sc_gmac_id;
int sc_hw_feature[4];
int sc_force_thresh_dma_mode;

View File

@ -900,12 +900,17 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
struct atom_context *atom_context;
atom_context = adev->mode_info.atom_context;
memcpy(vbios_info.name, atom_context->name, sizeof(atom_context->name));
memcpy(vbios_info.vbios_pn, atom_context->vbios_pn, sizeof(atom_context->vbios_pn));
vbios_info.version = atom_context->version;
memcpy(vbios_info.vbios_ver_str, atom_context->vbios_ver_str,
sizeof(atom_context->vbios_ver_str));
memcpy(vbios_info.date, atom_context->date, sizeof(atom_context->date));
if (atom_context) {
memcpy(vbios_info.name, atom_context->name,
sizeof(atom_context->name));
memcpy(vbios_info.vbios_pn, atom_context->vbios_pn,
sizeof(atom_context->vbios_pn));
vbios_info.version = atom_context->version;
memcpy(vbios_info.vbios_ver_str, atom_context->vbios_ver_str,
sizeof(atom_context->vbios_ver_str));
memcpy(vbios_info.date, atom_context->date,
sizeof(atom_context->date));
}
return copy_to_user(out, &vbios_info,
min((size_t)size, sizeof(vbios_info))) ? -EFAULT : 0;

View File

@ -344,6 +344,9 @@ static void nbio_v4_3_init_registers(struct amdgpu_device *adev)
data &= ~RCC_DEV0_EPF2_STRAP2__STRAP_NO_SOFT_RESET_DEV0_F2_MASK;
WREG32_SOC15(NBIO, 0, regRCC_DEV0_EPF2_STRAP2, data);
}
if (amdgpu_sriov_vf(adev))
adev->rmmio_remap.reg_offset = SOC15_REG_OFFSET(NBIO, 0,
regBIF_BX_DEV0_EPF0_VF0_HDP_MEM_COHERENCY_FLUSH_CNTL) << 2;
}
static u32 nbio_v4_3_get_rom_offset(struct amdgpu_device *adev)

View File

@ -755,7 +755,7 @@ static int soc21_common_hw_init(void *handle)
* for the purpose of expose those registers
* to process space
*/
if (adev->nbio.funcs->remap_hdp_registers)
if (adev->nbio.funcs->remap_hdp_registers && !amdgpu_sriov_vf(adev))
adev->nbio.funcs->remap_hdp_registers(adev);
/* enable the doorbell aperture */
soc21_enable_doorbell_aperture(adev, true);

View File

@ -201,7 +201,7 @@ static int add_queue_mes(struct device_queue_manager *dqm, struct queue *q,
if (q->wptr_bo) {
wptr_addr_off = (uint64_t)q->properties.write_ptr & (PAGE_SIZE - 1);
queue_input.wptr_mc_addr = ((uint64_t)q->wptr_bo->tbo.resource->start << PAGE_SHIFT) + wptr_addr_off;
queue_input.wptr_mc_addr = amdgpu_bo_gpu_offset(q->wptr_bo) + wptr_addr_off;
}
queue_input.is_kfd_process = 1;

View File

@ -1349,9 +1349,8 @@ void kfd_flush_tlb(struct kfd_process_device *pdd, enum TLB_FLUSH_TYPE type);
static inline bool kfd_flush_tlb_after_unmap(struct kfd_dev *dev)
{
return KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 2) ||
(KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 1) &&
dev->adev->sdma.instance[0].fw_version >= 18) ||
return KFD_GC_VERSION(dev) > IP_VERSION(9, 4, 2) ||
(KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 1) && dev->sdma_fw_version >= 18) ||
KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 0);
}

View File

@ -973,7 +973,9 @@ void dce110_edp_backlight_control(
return;
}
if (link->panel_cntl) {
if (link->panel_cntl && !(link->dpcd_sink_ext_caps.bits.oled ||
link->dpcd_sink_ext_caps.bits.hdr_aux_backlight_control == 1 ||
link->dpcd_sink_ext_caps.bits.sdr_aux_backlight_control == 1)) {
bool is_backlight_on = link->panel_cntl->funcs->is_panel_backlight_on(link->panel_cntl);
if ((enable && is_backlight_on) || (!enable && !is_backlight_on)) {

View File

@ -541,7 +541,6 @@ static int intel_engine_setup(struct intel_gt *gt, enum intel_engine_id id,
DRIVER_CAPS(i915)->has_logical_contexts = true;
ewma__engine_latency_init(&engine->latency);
seqcount_init(&engine->stats.execlists.lock);
ATOMIC_INIT_NOTIFIER_HEAD(&engine->context_status_notifier);

View File

@ -3558,6 +3558,8 @@ int intel_execlists_submission_setup(struct intel_engine_cs *engine)
logical_ring_default_vfuncs(engine);
logical_ring_default_irqs(engine);
seqcount_init(&engine->stats.execlists.lock);
if (engine->flags & I915_ENGINE_HAS_RCS_REG_STATE)
rcs_submission_override(engine);

View File

@ -529,20 +529,31 @@ void intel_ggtt_unbind_vma(struct i915_address_space *vm,
vm->clear_range(vm, vma_res->start, vma_res->vma_size);
}
/*
* Reserve the top of the GuC address space for firmware images. Addresses
* beyond GUC_GGTT_TOP in the GuC address space are inaccessible by GuC,
* which makes for a suitable range to hold GuC/HuC firmware images if the
* size of the GGTT is 4G. However, on a 32-bit platform the size of the GGTT
* is limited to 2G, which is less than GUC_GGTT_TOP, but we reserve a chunk
* of the same size anyway, which is far more than needed, to keep the logic
* in uc_fw_ggtt_offset() simple.
*/
#define GUC_TOP_RESERVE_SIZE (SZ_4G - GUC_GGTT_TOP)
static int ggtt_reserve_guc_top(struct i915_ggtt *ggtt)
{
u64 size;
u64 offset;
int ret;
if (!intel_uc_uses_guc(&ggtt->vm.gt->uc))
return 0;
GEM_BUG_ON(ggtt->vm.total <= GUC_GGTT_TOP);
size = ggtt->vm.total - GUC_GGTT_TOP;
GEM_BUG_ON(ggtt->vm.total <= GUC_TOP_RESERVE_SIZE);
offset = ggtt->vm.total - GUC_TOP_RESERVE_SIZE;
ret = i915_gem_gtt_reserve(&ggtt->vm, NULL, &ggtt->uc_fw, size,
GUC_GGTT_TOP, I915_COLOR_UNEVICTABLE,
PIN_NOEVICT);
ret = i915_gem_gtt_reserve(&ggtt->vm, NULL, &ggtt->uc_fw,
GUC_TOP_RESERVE_SIZE, offset,
I915_COLOR_UNEVICTABLE, PIN_NOEVICT);
if (ret)
drm_dbg(&ggtt->vm.i915->drm,
"Failed to reserve top of GGTT for GuC\n");

View File

@ -3,21 +3,22 @@
#ifndef _LINUX_SIZES_H
#define _LINUX_SIZES_H
#define SZ_1K (1024 * 1)
#define SZ_2K (1024 * 2)
#define SZ_4K (1024 * 4)
#define SZ_8K (1024 * 8)
#define SZ_16K (1024 * 16)
#define SZ_32K (1024 * 32)
#define SZ_64K (1024 * 64)
#define SZ_128K (1024 * 128)
#define SZ_256K (1024 * 256)
#define SZ_512K (1024 * 512)
#define SZ_1M (1024 * 1024 * 1)
#define SZ_2M (1024 * 1024 * 2)
#define SZ_4M (1024 * 1024 * 4)
#define SZ_8M (1024 * 1024 * 8)
#define SZ_16M (1024 * 1024 * 16)
#define SZ_1G (1024 * 1024 * 1024 * 1)
#define SZ_1K (1 << 10)
#define SZ_2K (2 << 10)
#define SZ_4K (4 << 10)
#define SZ_8K (8 << 10)
#define SZ_16K (16 << 10)
#define SZ_32K (32 << 10)
#define SZ_64K (64 << 10)
#define SZ_128K (128 << 10)
#define SZ_256K (256 << 10)
#define SZ_512K (512 << 10)
#define SZ_1M (1 << 20)
#define SZ_2M (2 << 20)
#define SZ_4M (4 << 20)
#define SZ_8M (8 << 20)
#define SZ_16M (16 << 20)
#define SZ_1G (1 << 30)
#define SZ_4G (4ULL << 30)
#endif

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: uname.1,v 1.18 2022/07/25 02:25:56 jsg Exp $
.\" $OpenBSD: uname.1,v 1.19 2023/10/09 19:28:42 schwarze Exp $
.\"
.\" Copyright (c) 1990 The Regents of the University of California.
.\" All rights reserved.
@ -29,7 +29,7 @@
.\"
.\" from: @(#)du.1 6.13 (Berkeley) 6/20/91
.\"
.Dd $Mdocdate: July 25 2022 $
.Dd $Mdocdate: October 9 2023 $
.Dt UNAME 1
.Os
.Sh NAME
@ -41,8 +41,9 @@
.Sh DESCRIPTION
The
.Nm uname
utility writes symbols representing one or more system characteristics
utility writes strings representing one or more system characteristics
to the standard output.
The formats and meanings of all these strings vary among operating systems.
.Pp
The options are as follows:
.Bl -tag -width Ds
@ -51,19 +52,71 @@ Behave as though all of the options
.Fl mnrsv
were specified.
.It Fl m
Print the machine hardware name.
Print the name of the hardware type.
On
.Ox ,
this is the kernel architecture as returned by
.Xr machine 1 .
.It Fl n
Print the nodename (the nodename may be a name
that the system is known by to a communications
network).
Print the network name of this machine.
On
.Ox ,
the same name can be printed with
.Xr hostname 1 .
.It Fl p
Print the machine processor architecture name.
Print the application architecture as returned by
.Xr arch 1
.Fl s .
.It Fl r
Print the operating system release.
On
.Ox ,
the format is
.Sm off
.Ar digit . digit Bq \- Ar flavor .
.Sm on
.Pp
The meaning of the
.Pf \- Ar flavor
suffix is as follows:
.Bl -tag -width "no suffix"
.It \-beta
A development version preceding the
.Ar digit . Ns Ar digit
release.
.It no suffix
A public release,
or a development version very closely preceding that release.
.It \-stable
A branch based on the
.Ar digit . Ns Ar digit
release that only contains patches to fix very important bugs.
.It \-current
A development version coming after the
.Ar digit . Ns Ar digit
release.
Some time before the subsequent release, the second
.Ar digit
is incremented and the
.Pf \- Ar flavor
switched to \-beta.
.El
.It Fl s
Print the operating system name.
On
.Ox ,
this is always
.Dq Ox .
.It Fl v
Print the operating system version.
On
.Ox ,
the format is
.Ar SYSTEMNAME Ns # Ns Ar buildnumber
with the
.Ar SYSTEMNAME
mentioned in
.Xr config 8 .
.El
.Pp
If no options are specified,
@ -71,6 +124,14 @@ If no options are specified,
prints the operating system name as if the
.Fl s
option had been specified.
.Pp
If
.Fl a
or more than one option is specified,
.Ox
prints the selected fields separated by single space characters
in the following order: operating system name, network name,
release, version, kernel architecture, application architecture.
.Sh EXIT STATUS
.Ex -std uname
.Sh SEE ALSO

View File

@ -1,4 +1,4 @@
/* $OpenBSD: session.c,v 1.447 2023/08/04 09:20:12 claudio Exp $ */
/* $OpenBSD: session.c,v 1.448 2023/10/09 07:11:20 claudio Exp $ */
/*
* Copyright (c) 2003, 2004, 2005 Henning Brauer <henning@openbsd.org>
@ -1204,7 +1204,7 @@ session_setup_socket(struct peer *p)
/* compare two sockaddrs by converting them into bgpd_addr */
static int
sa_cmp(struct sockaddr *a, struct sockaddr *b)
sa_equal(struct sockaddr *a, struct sockaddr *b)
{
struct bgpd_addr ba, bb;
@ -1223,8 +1223,7 @@ get_alternate_addr(struct sockaddr *sa, struct bgpd_addr *alt)
fatal("getifaddrs");
for (match = ifap; match != NULL; match = match->ifa_next)
if (match->ifa_addr != NULL &&
sa_cmp(sa, match->ifa_addr) == 0)
if (match->ifa_addr != NULL && sa_equal(sa, match->ifa_addr))
break;
if (match == NULL) {

View File

@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
# $OpenBSD: AddCreateDelete.pm,v 1.55 2023/10/08 12:44:58 espie Exp $
# $OpenBSD: AddCreateDelete.pm,v 1.56 2023/10/09 07:03:49 espie Exp $
#
# Copyright (c) 2007-2014 Marc Espie <espie@openbsd.org>
#
@ -56,30 +56,24 @@ sub add_interactive_options($self)
}
my $setup = {
nowantlib => sub() {
eval '
nowantlib => q'
use OpenBSD::Dependencies::SolverBase;
no warnings qw(redefine);
package OpenBSD::Dependencies::SolverBase;
sub solve_wantlibs($, $) { 1 }
';
},
nosystemwantlib => sub() {
eval '
',
nosystemwantlib => q'
use OpenBSD::LibSpec;
package OpenBSD::Library::System;
sub no_match_dispatch($library, $spec, $base)
{
return $spec->no_match_name($library, $base);
}
';
},
norun => sub() {
eval '
',
norun => q'
package OpenBSD::State;
sub _system(@) { 0 }
';
},
',
};
@ -110,7 +104,12 @@ sub handle_options($state, $opt_string, @usage)
for my $i (split(',', $state->defines('REGRESSION_TESTING'))) {
$state->{regression}{$i} = 1;
if (defined $setup->{$i}) {
&{$setup->{$i}}();
eval "$setup->{$i}";
if ($@) {
$state->fatal(
"Regression testing #1: #2",
$i, $@);
}
}
}
}

View File

@ -1,6 +1,6 @@
#!/usr/bin/perl
# ex:ts=8 sw=4:
# $OpenBSD: PkgDelete.pm,v 1.50 2023/06/16 10:08:17 espie Exp $
# $OpenBSD: PkgDelete.pm,v 1.51 2023/10/09 07:12:22 espie Exp $
#
# Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org>
#
@ -290,6 +290,7 @@ sub process_set($self, $set, $state)
}
}
}
# that's where I should check for alternates in bad
if (keys %$bad > 0) {
if (!$state->{do_automatic} || $state->verbose) {
$state->errsay("can't delete #1 without deleting #2",

View File

@ -1,4 +1,4 @@
/* $OpenBSD: smtp_session.c,v 1.435 2023/06/23 18:32:28 op Exp $ */
/* $OpenBSD: smtp_session.c,v 1.436 2023/10/09 20:55:32 millert Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@ -2624,7 +2624,7 @@ smtp_tx_dataline(struct smtp_tx *tx, const char *line)
case RFC5322_END_OF_HEADERS:
if (tx->session->listener->local ||
tx->session->listener->port == 587) {
tx->session->listener->port == htons(587)) {
if (!tx->has_date) {
log_debug("debug: %p: adding Date", tx);