move to 1.6-beta

This commit is contained in:
purplerain 2024-08-08 20:49:23 +00:00
parent 45c7370e13
commit 509ad7f110
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
81 changed files with 886 additions and 439 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: cpu.c,v 1.191 2024/07/21 19:41:31 bluhm Exp $ */
/* $OpenBSD: cpu.c,v 1.192 2024/08/08 07:02:38 kettenis Exp $ */
/* $NetBSD: cpu.c,v 1.1 2003/04/26 18:39:26 fvdl Exp $ */
/*-
@ -1464,6 +1464,7 @@ wbinvd_on_all_cpus(void)
#endif
int cpu_suspended;
int cpu_wakeups;
#ifdef SUSPEND
@ -1480,9 +1481,6 @@ int
cpu_suspend_primary(void)
{
struct cpu_info *ci = curcpu();
int count = 0;
printf("suspend\n");
/* Mask clock interrupts. */
local_pic.pic_hwmask(&local_pic, 0);
@ -1500,7 +1498,7 @@ cpu_suspend_primary(void)
while (cpu_suspended) {
cpu_suspend_cycle();
count++;
cpu_wakeups++;
}
intr_disable();
@ -1509,7 +1507,6 @@ cpu_suspend_primary(void)
/* Unmask clock interrupts. */
local_pic.pic_hwunmask(&local_pic, 0);
printf("resume %d\n", count);
return 0;
}

View file

@ -1,4 +1,4 @@
/* $OpenBSD: pmap.c,v 1.170 2024/07/21 19:41:31 bluhm Exp $ */
/* $OpenBSD: pmap.c,v 1.171 2024/08/08 15:57:22 dv Exp $ */
/* $NetBSD: pmap.c,v 1.3 2003/05/08 18:13:13 thorpej Exp $ */
/*
@ -2655,6 +2655,7 @@ pmap_enter_ept(struct pmap *pmap, paddr_t gpa, paddr_t hpa, vm_prot_t prot)
}
atomic_clearbits_int(&ptp->pg_flags, PG_BUSY);
ptp->wire_count = 1;
pptp->wire_count++;
npa = VM_PAGE_TO_PHYS(ptp);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: cpu.c,v 1.115 2024/05/29 12:21:33 kettenis Exp $ */
/* $OpenBSD: cpu.c,v 1.116 2024/08/08 07:02:38 kettenis Exp $ */
/* $NetBSD: cpu.c,v 1.1.2.7 2000/06/26 02:04:05 sommerfeld Exp $ */
/*-
@ -927,3 +927,4 @@ wbinvd_on_all_cpus(void)
#endif
int cpu_suspended;
int cpu_wakeups;

View file

@ -1,6 +1,6 @@
#!/bin/sh -
#
# $OpenBSD: newvers.sh,v 1.203 2024/03/12 01:20:30 deraadt Exp $
# $OpenBSD: newvers.sh,v 1.204 2024/08/07 15:59:24 deraadt Exp $
# $NetBSD: newvers.sh,v 1.17.2.1 1995/10/12 05:17:11 jtc Exp $
#
# Copyright (c) 1984, 1986, 1990, 1993
@ -68,13 +68,13 @@ id=`basename "${d}"`
# and disable POOL_DEBUG in sys/conf/GENERIC
ost="SecBSD"
osr="1.5"
osr="1.6"
cat >vers.c <<eof
#define STATUS "-current" /* just after a release */
#define STATUS "-beta" /* just before a release */
#if 0
#define STATUS "" /* release */
#define STATUS "-beta" /* just before a release */
#define STATUS "-current" /* just after a release */
#define STATUS "-stable" /* stable branch */
#endif

View file

@ -1,4 +1,4 @@
/* $OpenBSD: acpi_x86.c,v 1.23 2024/08/04 11:05:18 kettenis Exp $ */
/* $OpenBSD: acpi_x86.c,v 1.25 2024/08/08 07:02:38 kettenis Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
@ -87,6 +87,7 @@ sleep_setstate(void *v)
int
gosleep(void *v)
{
extern int cpu_wakeups;
struct acpi_softc *sc = v;
int ret;
@ -107,8 +108,20 @@ gosleep(void *v)
if (sc->sc_pmc_suspend)
sc->sc_pmc_suspend(sc->sc_pmc_cookie);
ret = acpi_sleep_cpu(sc, sc->sc_state);
acpi_resume_cpu(sc, sc->sc_state);
cpu_wakeups = 0;
sc->sc_wakeup = 0;
sc->sc_wakeups = 0;
while (!sc->sc_wakeup) {
ret = acpi_sleep_cpu(sc, sc->sc_state);
acpi_resume_cpu(sc, sc->sc_state);
sc->sc_wakeups++;
if (sc->sc_ec && sc->sc_wakegpe == sc->sc_ec->sc_gpe) {
sc->sc_wakeup = 0;
acpiec_gpehandler(sc, sc->sc_wakegpe, sc->sc_ec);
} else
sc->sc_wakeup = 1;
}
if (sc->sc_pmc_resume)
sc->sc_pmc_resume(sc->sc_pmc_cookie);
@ -151,10 +164,15 @@ checklids(struct acpi_softc *sc)
int
suspend_finish(void *v)
{
extern int cpu_wakeups;
struct acpi_softc *sc = v;
printf("wakeups: %d %d\n", cpu_wakeups, sc->sc_wakeups);
printf("wakeup event: ");
switch (sc->sc_wakegpe) {
case 0:
printf("unknown\n");
break;
case -1:
printf("PWRBTN\n");
break;
@ -165,6 +183,7 @@ suspend_finish(void *v)
printf("GPE 0x%x\n", sc->sc_wakegpe);
break;
}
sc->sc_wakegpe = 0;
acpi_record_event(sc, APM_NORMAL_RESUME);
acpi_indicator(sc, ACPI_SST_WORKING);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: acpibtn.c,v 1.52 2024/05/13 19:56:37 kettenis Exp $ */
/* $OpenBSD: acpibtn.c,v 1.53 2024/08/06 17:38:56 kettenis Exp $ */
/*
* Copyright (c) 2005 Marco Peereboom <marco@openbsd.org>
*
@ -213,7 +213,7 @@ acpibtn_attach(struct device *parent, struct device *self, void *aux)
printf("\n");
aml_register_notify(sc->sc_devnode, aa->aaa_dev, acpibtn_notify,
sc, ACPIDEV_NOPOLL);
sc, ACPIDEV_NOPOLL | ACPIDEV_WAKEUP);
}
int

View file

@ -1,4 +1,4 @@
/* $OpenBSD: acpidev.h,v 1.44 2018/06/29 17:39:18 kettenis Exp $ */
/* $OpenBSD: acpidev.h,v 1.45 2024/08/06 17:38:56 kettenis Exp $ */
/*
* Copyright (c) 2005 Marco Peereboom <marco@openbsd.org>
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
@ -26,8 +26,9 @@
#define DEVNAME(s) ((s)->sc_dev.dv_xname)
#define ACPIDEV_NOPOLL 0
#define ACPIDEV_POLL 1
#define ACPIDEV_NOPOLL 0x0000
#define ACPIDEV_POLL 0x0001
#define ACPIDEV_WAKEUP 0x0002
/*
* _BIF (Battery InFormation)

View file

@ -1,4 +1,4 @@
/* $OpenBSD: acpireg.h,v 1.60 2023/09/12 08:32:58 jmatthew Exp $ */
/* $OpenBSD: acpireg.h,v 1.61 2024/08/08 07:01:22 kettenis Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
* Copyright (c) 2005 Marco Peereboom <marco@openbsd.org>
@ -476,6 +476,30 @@ struct acpi_tpm2 {
uint32_t start_method;
} __packed;
/*
* Intel ACPI Low Power S0 Idle
*/
struct acpi_lpit {
struct acpi_table_header hdr;
#define LPIT_SIG "LPIT"
/* struct acpi_lpit_entry[]; */
} __packed;
struct acpi_lpit_entry {
uint32_t type;
uint32_t length;
uint16_t uid;
uint16_t reserved;
uint32_t flags;
#define LPIT_DISABLED (1L << 0)
#define LPIT_COUNTER_NOT_AVAILABLE (1L << 1)
struct acpi_gas entry_trigger;
uint32_t residency;
uint32_t latency;
struct acpi_gas residency_counter;
uint64_t residency_frequency;
};
/*
* Intel ACPI DMA Remapping Entries
*/

View file

@ -1,4 +1,4 @@
/* $OpenBSD: acpivar.h,v 1.132 2024/08/04 11:05:18 kettenis Exp $ */
/* $OpenBSD: acpivar.h,v 1.134 2024/08/08 07:02:38 kettenis Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
*
@ -264,6 +264,8 @@ struct acpi_softc {
struct aml_node *sc_sst;
struct aml_node *sc_wak;
int sc_state;
int sc_wakeup;
int sc_wakeups;
time_t sc_resume_time;
struct acpiec_softc *sc_ec; /* XXX assume single EC */
@ -341,6 +343,7 @@ int acpi_set_gpehandler(struct acpi_softc *, int,
void acpiec_read(struct acpiec_softc *, uint8_t, int, uint8_t *);
void acpiec_write(struct acpiec_softc *, uint8_t, int, uint8_t *);
int acpiec_gpehandler(struct acpi_softc *, int, void *);
#if NACPIPWRRES > 0
int acpipwrres_ref_incr(struct acpipwrres_softc *, struct aml_node *);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: dsdt.c,v 1.269 2024/06/26 01:40:49 jsg Exp $ */
/* $OpenBSD: dsdt.c,v 1.270 2024/08/06 17:38:56 kettenis Exp $ */
/*
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
*
@ -28,6 +28,7 @@
#include <machine/db_machdep.h>
#endif
#include <dev/acpi/acpidev.h>
#include <dev/acpi/acpireg.h>
#include <dev/acpi/acpivar.h>
#include <dev/acpi/amltypes.h>
@ -364,7 +365,7 @@ struct aml_notify_data {
char pnpid[20];
void *cbarg;
int (*cbproc)(struct aml_node *, int, void *);
int poll;
int flags;
SLIST_ENTRY(aml_notify_data) link;
};
@ -536,7 +537,7 @@ aml_notify_task(void *node, int notify_value)
void
aml_register_notify(struct aml_node *node, const char *pnpid,
int (*proc)(struct aml_node *, int, void *), void *arg, int poll)
int (*proc)(struct aml_node *, int, void *), void *arg, int flags)
{
struct aml_notify_data *pdata;
extern int acpi_poll_enabled;
@ -548,23 +549,30 @@ aml_register_notify(struct aml_node *node, const char *pnpid,
pdata->node = node;
pdata->cbarg = arg;
pdata->cbproc = proc;
pdata->poll = poll;
pdata->flags = flags;
if (pnpid)
strlcpy(pdata->pnpid, pnpid, sizeof(pdata->pnpid));
SLIST_INSERT_HEAD(&aml_notify_list, pdata, link);
if (poll && !acpi_poll_enabled)
if ((flags & ACPIDEV_POLL) && !acpi_poll_enabled)
timeout_add_sec(&acpi_softc->sc_dev_timeout, 10);
}
void
aml_notify(struct aml_node *node, int notify_value)
{
struct aml_notify_data *pdata;
if (node == NULL)
return;
SLIST_FOREACH(pdata, &aml_notify_list, link) {
if (pdata->node == node && (pdata->flags & ACPIDEV_WAKEUP))
acpi_softc->sc_wakeup = 1;
}
dnprintf(10,"queue notify: %s %x\n", aml_nodename(node), notify_value);
acpi_addtask(acpi_softc, aml_notify_task, node, notify_value);
}
@ -588,7 +596,7 @@ acpi_poll_notify_task(void *arg0, int arg1)
struct aml_notify_data *pdata = NULL;
SLIST_FOREACH(pdata, &aml_notify_list, link)
if (pdata->cbproc && pdata->poll)
if (pdata->cbproc && (pdata->flags & ACPIDEV_POLL))
pdata->cbproc(pdata->node, 0, pdata->cbarg);
}

View file

@ -1,4 +1,4 @@
/* $OpenBSD: intelpmc.c,v 1.1 2024/08/04 11:05:18 kettenis Exp $ */
/* $OpenBSD: intelpmc.c,v 1.2 2024/08/08 07:01:22 kettenis Exp $ */
/*
* Copyright (c) 2024 Mark Kettenis <kettenis@openbsd.org>
*
@ -46,6 +46,9 @@ struct intelpmc_softc {
struct acpi_softc *sc_acpi;
struct aml_node *sc_node;
struct acpi_gas sc_counter[4];
int sc_num_counters;
#ifdef INTELPMC_DEBUG
uint64_t sc_c3[2];
uint64_t sc_c6[2];
@ -57,6 +60,7 @@ struct intelpmc_softc {
uint64_t sc_pc8[2];
uint64_t sc_pc9[2];
uint64_t sc_pc10[2];
uint64_t sc_lpit[4][2];
#endif
};
@ -78,6 +82,7 @@ const char *intelpmc_hids[] = {
NULL
};
void intelpmc_parse_lpit(struct intelpmc_softc *, struct acpi_lpit *);
void intelpmc_suspend(void *);
void intelpmc_resume(void *);
@ -95,12 +100,25 @@ intelpmc_attach(struct device *parent, struct device *self, void *aux)
{
struct intelpmc_softc *sc = (struct intelpmc_softc *)self;
struct acpi_attach_args *aaa = aux;
struct acpi_q *entry;
struct acpi_lpit *lpit = NULL;
sc->sc_acpi = (struct acpi_softc *)parent;
sc->sc_node = aaa->aaa_node;
printf(": %s\n", aaa->aaa_node->name);
SIMPLEQ_FOREACH(entry, &sc->sc_acpi->sc_tables, q_next) {
if (memcmp(entry->q_table, LPIT_SIG,
sizeof(LPIT_SIG) - 1) == 0) {
lpit = entry->q_table;
break;
}
}
if (lpit)
intelpmc_parse_lpit(sc, lpit);
sc->sc_acpi->sc_pmc_suspend = intelpmc_suspend;
sc->sc_acpi->sc_pmc_resume = intelpmc_resume;
sc->sc_acpi->sc_pmc_cookie = sc;
@ -111,6 +129,7 @@ intelpmc_activate(struct device *self, int act)
{
#ifdef INTELPMC_DEBUG
struct intelpmc_softc *sc = (struct intelpmc_softc *)self;
int i;
switch (act) {
case DVACT_RESUME:
@ -124,6 +143,10 @@ intelpmc_activate(struct device *self, int act)
printf("PC8: %lld -> %lld\n", sc->sc_pc8[0], sc->sc_pc8[1]);
printf("PC9: %lld -> %lld\n", sc->sc_pc9[0], sc->sc_pc9[1]);
printf("PC10: %lld -> %lld\n", sc->sc_pc10[0], sc->sc_pc10[1]);
for (i = 0; i < sc->sc_num_counters; i++) {
printf("LPIT%d: %lld -> %lld\n", i,
sc->sc_lpit[i][0], sc->sc_lpit[i][1]);
}
break;
}
#endif
@ -131,6 +154,63 @@ intelpmc_activate(struct device *self, int act)
return 0;
}
void
intelpmc_parse_lpit(struct intelpmc_softc *sc, struct acpi_lpit *lpit)
{
caddr_t addr = (caddr_t)(lpit + 1);
while (addr < (caddr_t)lpit + lpit->hdr.length) {
struct acpi_lpit_entry *entry = (struct acpi_lpit_entry *)addr;
uint32_t length = entry->length;
if (length < 8)
return;
if (addr + length > (caddr_t)lpit + lpit->hdr.length)
return;
switch (entry->type) {
case 0:
if (length != sizeof(struct acpi_lpit_entry))
return;
if (entry->flags & LPIT_DISABLED)
break;
#ifdef INTELPMC_DEBUG
printf("state %d: 0x%02x:%d:%d:0x%02x:0x%016llx\n",
entry->uid, entry->entry_trigger.address_space_id,
entry->entry_trigger.register_bit_width,
entry->entry_trigger.register_bit_offset,
entry->entry_trigger.access_size,
entry->entry_trigger.address);
#endif
if (entry->flags & LPIT_COUNTER_NOT_AVAILABLE)
break;
#ifdef INTELPMC_DEBUG
printf("counter: 0x%02x:%d:%d:0x%02x:0x%016llx\n",
entry->residency_counter.address_space_id,
entry->residency_counter.register_bit_width,
entry->residency_counter.register_bit_offset,
entry->residency_counter.access_size,
entry->residency_counter.address);
printf("frequency: %lld\n",
entry->residency_frequency);
#endif
if (sc->sc_num_counters >= nitems(sc->sc_counter))
break;
memcpy(&sc->sc_counter[sc->sc_num_counters++],
&entry->residency_counter, sizeof(struct acpi_gas));
break;
}
addr += length;
}
}
int
intelpmc_dsm(struct acpi_softc *sc, struct aml_node *node, int func)
{
@ -173,6 +253,9 @@ void
intelpmc_suspend(void *cookie)
{
struct intelpmc_softc *sc = cookie;
#ifdef INTELPMC_DEBUG
int i;
#endif
if (sc->sc_acpi->sc_state != ACPI_STATE_S0)
return;
@ -188,6 +271,18 @@ intelpmc_suspend(void *cookie)
rdmsr_safe(MSR_PKG_C8_RESIDENCY, &sc->sc_pc8[0]);
rdmsr_safe(MSR_PKG_C9_RESIDENCY, &sc->sc_pc9[0]);
rdmsr_safe(MSR_PKG_C10_RESIDENCY, &sc->sc_pc10[0]);
for (i = 0; i < sc->sc_num_counters; i++) {
if (sc->sc_counter[i].address_space_id == GAS_FUNCTIONAL_FIXED)
rdmsr_safe(sc->sc_counter[i].address, &sc->sc_lpit[i][0]);
else {
acpi_gasio(sc->sc_acpi, ACPI_IOREAD,
sc->sc_counter[i].address_space_id,
sc->sc_counter[i].address,
(1 << sc->sc_counter[i].access_size),
sc->sc_counter[i].register_bit_width / 8,
&sc->sc_lpit[i][0]);
}
}
#endif
intelpmc_dsm(sc->sc_acpi, sc->sc_node, ACPI_LPS0_SCREEN_OFF);
@ -198,6 +293,9 @@ void
intelpmc_resume(void *cookie)
{
struct intelpmc_softc *sc = cookie;
#ifdef INTELPMC_DEBUG
int i;
#endif
if (sc->sc_acpi->sc_state != ACPI_STATE_S0)
return;
@ -216,5 +314,17 @@ intelpmc_resume(void *cookie)
rdmsr_safe(MSR_PKG_C8_RESIDENCY, &sc->sc_pc8[1]);
rdmsr_safe(MSR_PKG_C9_RESIDENCY, &sc->sc_pc9[1]);
rdmsr_safe(MSR_PKG_C10_RESIDENCY, &sc->sc_pc10[1]);
for (i = 0; i < sc->sc_num_counters; i++) {
if (sc->sc_counter[i].address_space_id == GAS_FUNCTIONAL_FIXED)
rdmsr_safe(sc->sc_counter[i].address, &sc->sc_lpit[i][1]);
else {
acpi_gasio(sc->sc_acpi, ACPI_IOREAD,
sc->sc_counter[i].address_space_id,
sc->sc_counter[i].address,
(1 << sc->sc_counter[i].access_size),
sc->sc_counter[i].register_bit_width / 8,
&sc->sc_lpit[i][1]);
}
}
#endif
}

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_igc.c,v 1.25 2024/05/24 06:02:53 jsg Exp $ */
/* $OpenBSD: if_igc.c,v 1.26 2024/08/08 14:58:49 jan Exp $ */
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
@ -881,7 +881,7 @@ igc_init(void *arg)
}
igc_initialize_transmit_unit(sc);
sc->rx_mbuf_sz = MCLBYTES + ETHER_ALIGN;
sc->rx_mbuf_sz = MCLBYTES;
/* Prepare receive descriptors and buffers. */
if (igc_setup_receive_structures(sc)) {
printf("%s: Could not setup receive structures\n",
@ -2159,7 +2159,7 @@ igc_allocate_receive_buffers(struct igc_rxring *rxr)
rxbuf = rxr->rx_buffers;
for (i = 0; i < sc->num_rx_desc; i++, rxbuf++) {
error = bus_dmamap_create(rxr->rxdma.dma_tag,
MAX_JUMBO_FRAME_SIZE, 1, MAX_JUMBO_FRAME_SIZE, 0,
MAX_JUMBO_FRAME_SIZE, IGC_MAX_SCATTER, MCLBYTES, 0,
BUS_DMA_NOWAIT, &rxbuf->map);
if (error) {
printf("%s: Unable to create RX DMA map\n",

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ksmn.c,v 1.9 2023/09/05 13:06:01 stsp Exp $ */
/* $OpenBSD: ksmn.c,v 1.10 2024/08/07 17:39:00 brynet Exp $ */
/*
* Copyright (c) 2019 Bryan Steele <brynet@openbsd.org>
@ -107,6 +107,7 @@ static const struct pci_matchid ksmn_devices[] = {
{ PCI_VENDOR_AMD, PCI_PRODUCT_AMD_17_6X_RC },
{ PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_4X_RC },
{ PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_6X_RC },
{ PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_7X_RC },
};
int

View file

@ -1,4 +1,4 @@
$OpenBSD: pcidevs,v 1.2080 2024/07/29 01:17:53 jsg Exp $
$OpenBSD: pcidevs,v 1.2081 2024/08/07 06:48:55 jsg Exp $
/* $NetBSD: pcidevs,v 1.30 1997/06/24 06:20:24 thorpej Exp $ */
/*
@ -707,6 +707,14 @@ product AMD 10_ADDR 0x1201 10h Address Map
product AMD 10_DRAM 0x1202 10h DRAM Cfg
product AMD 10_MISC 0x1203 10h Misc Cfg
product AMD 10_LINK 0x1204 10h Link Cfg
product AMD 19_78_DF_1 0x12f8 19h/7xh Data Fabric
product AMD 19_78_DF_2 0x12f9 19h/7xh Data Fabric
product AMD 19_78_DF_3 0x12fa 19h/7xh Data Fabric
product AMD 19_78_DF_4 0x12fb 19h/7xh Data Fabric
product AMD 19_78_DF_5 0x12fc 19h/7xh Data Fabric
product AMD 19_78_DF_6 0x12fd 19h/7xh Data Fabric
product AMD 19_78_DF_7 0x12fe 19h/7xh Data Fabric
product AMD 19_78_DF_8 0x12ff 19h/7xh Data Fabric
product AMD 11_HT 0x1300 11h HyperTransport
product AMD 11_ADDR 0x1301 11h Address Map
product AMD 11_DRAM 0x1302 11h DRAM Cfg
@ -876,8 +884,12 @@ product AMD 19_6X_XHCI_2 0x15b7 19h/6xh xHCI
product AMD 19_6X_XHCI_3 0x15b8 19h/6xh xHCI
product AMD 19_7X_XHCI_1 0x15b9 19h/7xh xHCI
product AMD 19_7X_XHCI_2 0x15ba 19h/7xh xHCI
product AMD 19_78_XHCI_1 0x15bb 19h/7xh xHCI
product AMD 19_78_XHCI_2 0x15bd 19h/7xh xHCI
product AMD 19_7X_XHCI_3 0x15c0 19h/7xh xHCI
product AMD 19_7X_XHCI_4 0x15c1 19h/7xh xHCI
product AMD 19_78_XHCI_3 0x15c2 19h/7xh xHCI
product AMD 19_78_XHCI_4 0x15c3 19h/7xh xHCI
product AMD 19_7X_PSP 0x15c7 19h/7xh PSP
product AMD 17_1X_RC 0x15d0 17h/1xh Root Complex
product AMD 17_1X_IOMMU 0x15d1 17h/1xh IOMMU
@ -8792,6 +8804,7 @@ product REALTEK REALMANAGE_SERIAL_1 0x816a RealManage Serial
product REALTEK REALMANAGE_SERIAL_2 0x816b RealManage Serial
product REALTEK REALMANAGE_IPMI 0x816c RealManage IPMI
product REALTEK REALMANAGE_EHCI 0x816d RealManage USB
product REALTEK REALMANAGE_BMC 0x816e RealManage BMC
product REALTEK RTL8192SE 0x8172 8192SE
product REALTEK RTL8188CE 0x8176 8188CE
product REALTEK RTL8192CE 0x8178 RTL8192CE
@ -9146,6 +9159,7 @@ product SIS 966_HDA 0x7502 966 HD Audio
/* SK hynix products */
product SKHYNIX SSD 0x1327 BC501 NVMe
product SKHYNIX BC901 0x1d59 BC901
/* SMC products */
product SMC 83C170 0x0005 83C170

View file

@ -2,7 +2,7 @@
* THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.
*
* generated from:
* OpenBSD: pcidevs,v 1.2080 2024/07/29 01:17:53 jsg Exp
* OpenBSD: pcidevs,v 1.2081 2024/08/07 06:48:55 jsg Exp
*/
/* $NetBSD: pcidevs,v 1.30 1997/06/24 06:20:24 thorpej Exp $ */
@ -712,6 +712,14 @@
#define PCI_PRODUCT_AMD_10_DRAM 0x1202 /* 10h DRAM Cfg */
#define PCI_PRODUCT_AMD_10_MISC 0x1203 /* 10h Misc Cfg */
#define PCI_PRODUCT_AMD_10_LINK 0x1204 /* 10h Link Cfg */
#define PCI_PRODUCT_AMD_19_78_DF_1 0x12f8 /* 19h/7xh Data Fabric */
#define PCI_PRODUCT_AMD_19_78_DF_2 0x12f9 /* 19h/7xh Data Fabric */
#define PCI_PRODUCT_AMD_19_78_DF_3 0x12fa /* 19h/7xh Data Fabric */
#define PCI_PRODUCT_AMD_19_78_DF_4 0x12fb /* 19h/7xh Data Fabric */
#define PCI_PRODUCT_AMD_19_78_DF_5 0x12fc /* 19h/7xh Data Fabric */
#define PCI_PRODUCT_AMD_19_78_DF_6 0x12fd /* 19h/7xh Data Fabric */
#define PCI_PRODUCT_AMD_19_78_DF_7 0x12fe /* 19h/7xh Data Fabric */
#define PCI_PRODUCT_AMD_19_78_DF_8 0x12ff /* 19h/7xh Data Fabric */
#define PCI_PRODUCT_AMD_11_HT 0x1300 /* 11h HyperTransport */
#define PCI_PRODUCT_AMD_11_ADDR 0x1301 /* 11h Address Map */
#define PCI_PRODUCT_AMD_11_DRAM 0x1302 /* 11h DRAM Cfg */
@ -881,8 +889,12 @@
#define PCI_PRODUCT_AMD_19_6X_XHCI_3 0x15b8 /* 19h/6xh xHCI */
#define PCI_PRODUCT_AMD_19_7X_XHCI_1 0x15b9 /* 19h/7xh xHCI */
#define PCI_PRODUCT_AMD_19_7X_XHCI_2 0x15ba /* 19h/7xh xHCI */
#define PCI_PRODUCT_AMD_19_78_XHCI_1 0x15bb /* 19h/7xh xHCI */
#define PCI_PRODUCT_AMD_19_78_XHCI_2 0x15bd /* 19h/7xh xHCI */
#define PCI_PRODUCT_AMD_19_7X_XHCI_3 0x15c0 /* 19h/7xh xHCI */
#define PCI_PRODUCT_AMD_19_7X_XHCI_4 0x15c1 /* 19h/7xh xHCI */
#define PCI_PRODUCT_AMD_19_78_XHCI_3 0x15c2 /* 19h/7xh xHCI */
#define PCI_PRODUCT_AMD_19_78_XHCI_4 0x15c3 /* 19h/7xh xHCI */
#define PCI_PRODUCT_AMD_19_7X_PSP 0x15c7 /* 19h/7xh PSP */
#define PCI_PRODUCT_AMD_17_1X_RC 0x15d0 /* 17h/1xh Root Complex */
#define PCI_PRODUCT_AMD_17_1X_IOMMU 0x15d1 /* 17h/1xh IOMMU */
@ -8797,6 +8809,7 @@
#define PCI_PRODUCT_REALTEK_REALMANAGE_SERIAL_2 0x816b /* RealManage Serial */
#define PCI_PRODUCT_REALTEK_REALMANAGE_IPMI 0x816c /* RealManage IPMI */
#define PCI_PRODUCT_REALTEK_REALMANAGE_EHCI 0x816d /* RealManage USB */
#define PCI_PRODUCT_REALTEK_REALMANAGE_BMC 0x816e /* RealManage BMC */
#define PCI_PRODUCT_REALTEK_RTL8192SE 0x8172 /* 8192SE */
#define PCI_PRODUCT_REALTEK_RTL8188CE 0x8176 /* 8188CE */
#define PCI_PRODUCT_REALTEK_RTL8192CE 0x8178 /* RTL8192CE */
@ -9151,6 +9164,7 @@
/* SK hynix products */
#define PCI_PRODUCT_SKHYNIX_SSD 0x1327 /* BC501 NVMe */
#define PCI_PRODUCT_SKHYNIX_BC901 0x1d59 /* BC901 */
/* SMC products */
#define PCI_PRODUCT_SMC_83C170 0x0005 /* 83C170 */

View file

@ -2,7 +2,7 @@
* THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.
*
* generated from:
* OpenBSD: pcidevs,v 1.2080 2024/07/29 01:17:53 jsg Exp
* OpenBSD: pcidevs,v 1.2081 2024/08/07 06:48:55 jsg Exp
*/
/* $NetBSD: pcidevs,v 1.30 1997/06/24 06:20:24 thorpej Exp $ */
@ -1079,6 +1079,38 @@ static const struct pci_known_product pci_known_products[] = {
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_10_LINK,
"10h Link Cfg",
},
{
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_78_DF_1,
"19h/7xh Data Fabric",
},
{
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_78_DF_2,
"19h/7xh Data Fabric",
},
{
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_78_DF_3,
"19h/7xh Data Fabric",
},
{
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_78_DF_4,
"19h/7xh Data Fabric",
},
{
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_78_DF_5,
"19h/7xh Data Fabric",
},
{
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_78_DF_6,
"19h/7xh Data Fabric",
},
{
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_78_DF_7,
"19h/7xh Data Fabric",
},
{
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_78_DF_8,
"19h/7xh Data Fabric",
},
{
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_11_HT,
"11h HyperTransport",
@ -1755,6 +1787,14 @@ static const struct pci_known_product pci_known_products[] = {
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_7X_XHCI_2,
"19h/7xh xHCI",
},
{
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_78_XHCI_1,
"19h/7xh xHCI",
},
{
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_78_XHCI_2,
"19h/7xh xHCI",
},
{
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_7X_XHCI_3,
"19h/7xh xHCI",
@ -1763,6 +1803,14 @@ static const struct pci_known_product pci_known_products[] = {
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_7X_XHCI_4,
"19h/7xh xHCI",
},
{
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_78_XHCI_3,
"19h/7xh xHCI",
},
{
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_78_XHCI_4,
"19h/7xh xHCI",
},
{
PCI_VENDOR_AMD, PCI_PRODUCT_AMD_19_7X_PSP,
"19h/7xh PSP",
@ -31731,6 +31779,10 @@ static const struct pci_known_product pci_known_products[] = {
PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_REALMANAGE_EHCI,
"RealManage USB",
},
{
PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_REALMANAGE_BMC,
"RealManage BMC",
},
{
PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8192SE,
"8192SE",
@ -32971,6 +33023,10 @@ static const struct pci_known_product pci_known_products[] = {
PCI_VENDOR_SKHYNIX, PCI_PRODUCT_SKHYNIX_SSD,
"BC501 NVMe",
},
{
PCI_VENDOR_SKHYNIX, PCI_PRODUCT_SKHYNIX_BC901,
"BC901",
},
{
PCI_VENDOR_SMC, PCI_PRODUCT_SMC_83C170,
"83C170",

View file

@ -1,4 +1,4 @@
/* $OpenBSD: sdhc.c,v 1.76 2023/10/01 08:56:24 kettenis Exp $ */
/* $OpenBSD: sdhc.c,v 1.77 2024/08/06 15:03:36 patrick Exp $ */
/*
* Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
@ -1057,6 +1057,9 @@ sdhc_start_command(struct sdhc_host *hp, struct sdmmc_command *cmd)
DPRINTF(1,("%s: cmd=%#x mode=%#x blksize=%d blkcount=%d\n",
DEVNAME(hp->sc), command, mode, blksize, blkcount));
/* We're starting a new command, reset state. */
hp->intr_status = 0;
/*
* Start a CPU data transfer. Writing to the high order byte
* of the SDHC_COMMAND register triggers the SD command. (1.5)

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_umb.c,v 1.58 2024/05/23 03:21:09 jsg Exp $ */
/* $OpenBSD: if_umb.c,v 1.59 2024/08/08 05:10:00 deraadt Exp $ */
/*
* Copyright (c) 2016 genua mbH
@ -241,7 +241,13 @@ struct umb_quirk {
int umb_match;
};
const struct umb_quirk umb_quirks[] = {
{ { USB_VENDOR_DELL, USB_PRODUCT_DELL_DW5821E },
{ { USB_VENDOR_DELL, USB_PRODUCT_DELL_DW5821E_1 },
0,
2,
UMATCH_VENDOR_PRODUCT
},
{ { USB_VENDOR_DELL, USB_PRODUCT_DELL_DW5821E_2 },
0,
2,
UMATCH_VENDOR_PRODUCT

View file

@ -1,4 +1,4 @@
$OpenBSD: usbdevs,v 1.766 2024/05/29 06:48:43 jsg Exp $
$OpenBSD: usbdevs,v 1.767 2024/08/08 05:09:09 deraadt Exp $
/* $NetBSD: usbdevs,v 1.322 2003/05/10 17:47:14 hamajima Exp $ */
/*
@ -1537,7 +1537,8 @@ product DELL PRISM_GT_2 0x8104 PrismGT USB 2.0 WLAN
product DELL W5500 0x8115 W5500 HSDPA
product DELL U740 0x8135 U740 CDMA
product DELL EU870D 0x8138 EU870D HSDPA
product DELL DW5821E 0x81d7 DW5821e LTE
product DELL DW5821E_1 0x81d7 DW5821e LTE
product DELL DW5821E_2 0x81e0 DW5821e LTE
product DELL DW700 0x9500 DW700 GPS
product DELL2 UPS 0xffff UPS

View file

@ -1,10 +1,10 @@
/* $OpenBSD: usbdevs.h,v 1.778 2024/05/29 06:49:38 jsg Exp $ */
/* $OpenBSD: usbdevs.h,v 1.779 2024/08/08 05:09:33 deraadt Exp $ */
/*
* THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
*
* generated from:
* OpenBSD: usbdevs,v 1.766 2024/05/29 06:48:43 jsg Exp
* OpenBSD: usbdevs,v 1.767 2024/08/08 05:09:09 deraadt Exp
*/
/* $NetBSD: usbdevs,v 1.322 2003/05/10 17:47:14 hamajima Exp $ */
@ -1544,7 +1544,8 @@
#define USB_PRODUCT_DELL_W5500 0x8115 /* W5500 HSDPA */
#define USB_PRODUCT_DELL_U740 0x8135 /* U740 CDMA */
#define USB_PRODUCT_DELL_EU870D 0x8138 /* EU870D HSDPA */
#define USB_PRODUCT_DELL_DW5821E 0x81d7 /* DW5821e LTE */
#define USB_PRODUCT_DELL_DW5821E_1 0x81d7 /* DW5821e LTE */
#define USB_PRODUCT_DELL_DW5821E_2 0x81e0 /* DW5821e LTE */
#define USB_PRODUCT_DELL_DW700 0x9500 /* DW700 GPS */
#define USB_PRODUCT_DELL2_UPS 0xffff /* UPS */

View file

@ -1,10 +1,10 @@
/* $OpenBSD: usbdevs_data.h,v 1.772 2024/05/29 06:49:38 jsg Exp $ */
/* $OpenBSD: usbdevs_data.h,v 1.773 2024/08/08 05:09:33 deraadt Exp $ */
/*
* THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
*
* generated from:
* OpenBSD: usbdevs,v 1.766 2024/05/29 06:48:43 jsg Exp
* OpenBSD: usbdevs,v 1.767 2024/08/08 05:09:09 deraadt Exp
*/
/* $NetBSD: usbdevs,v 1.322 2003/05/10 17:47:14 hamajima Exp $ */
@ -2494,7 +2494,11 @@ const struct usb_known_product usb_known_products[] = {
"EU870D HSDPA",
},
{
USB_VENDOR_DELL, USB_PRODUCT_DELL_DW5821E,
USB_VENDOR_DELL, USB_PRODUCT_DELL_DW5821E_1,
"DW5821e LTE",
},
{
USB_VENDOR_DELL, USB_PRODUCT_DELL_DW5821E_2,
"DW5821e LTE",
},
{

View file

@ -1,4 +1,4 @@
/* $OpenBSD: xhci.c,v 1.131 2024/05/23 03:21:09 jsg Exp $ */
/* $OpenBSD: xhci.c,v 1.132 2024/08/06 17:30:04 kettenis Exp $ */
/*
* Copyright (c) 2014-2015 Martin Pieuchot
@ -79,6 +79,7 @@ struct xhci_pipe {
};
int xhci_reset(struct xhci_softc *);
void xhci_suspend(struct xhci_softc *);
int xhci_intr1(struct xhci_softc *);
void xhci_event_dequeue(struct xhci_softc *);
void xhci_event_xfer(struct xhci_softc *, uint64_t, uint32_t, uint32_t);
@ -533,7 +534,7 @@ xhci_activate(struct device *self, int act)
break;
case DVACT_POWERDOWN:
rv = config_activate_children(self, act);
xhci_reset(sc);
xhci_suspend(sc);
break;
default:
rv = config_activate_children(self, act);
@ -577,6 +578,73 @@ xhci_reset(struct xhci_softc *sc)
return (0);
}
void
xhci_suspend(struct xhci_softc *sc)
{
uint32_t hcr;
int i;
XOWRITE4(sc, XHCI_USBCMD, 0); /* Halt controller */
for (i = 0; i < 100; i++) {
usb_delay_ms(&sc->sc_bus, 1);
hcr = XOREAD4(sc, XHCI_USBSTS) & XHCI_STS_HCH;
if (hcr)
break;
}
if (!hcr) {
printf("%s: halt timeout\n", DEVNAME(sc));
xhci_reset(sc);
return;
}
/*
* Some Intel controllers will not power down completely
* unless they have seen a save state command. This in turn
* will prevent the SoC from reaching its lowest idle state.
* So save the state here.
*
* Note that we don't restore this saved state anywhere.
* Instead we reset the controller and reinitialize it from
* scratch when we resume.
*/
XOWRITE4(sc, XHCI_USBCMD, XHCI_CMD_CSS); /* Save state */
hcr = XOREAD4(sc, XHCI_USBSTS);
for (i = 0; i < 100; i++) {
usb_delay_ms(&sc->sc_bus, 1);
hcr = XOREAD4(sc, XHCI_USBSTS) & XHCI_STS_SSS;
if (!hcr)
break;
}
if (hcr) {
printf("%s: save state timeout\n", DEVNAME(sc));
xhci_reset(sc);
return;
}
/* Disable interrupts. */
XRWRITE4(sc, XHCI_IMOD(0), 0);
XRWRITE4(sc, XHCI_IMAN(0), 0);
/* Clear the event ring address. */
XRWRITE4(sc, XHCI_ERDP_LO(0), 0);
XRWRITE4(sc, XHCI_ERDP_HI(0), 0);
XRWRITE4(sc, XHCI_ERSTBA_LO(0), 0);
XRWRITE4(sc, XHCI_ERSTBA_HI(0), 0);
XRWRITE4(sc, XHCI_ERSTSZ(0), 0);
/* Clear the command ring address. */
XOWRITE4(sc, XHCI_CRCR_LO, 0);
XOWRITE4(sc, XHCI_CRCR_HI, 0);
XOWRITE4(sc, XHCI_DCBAAP_LO, 0);
XOWRITE4(sc, XHCI_DCBAAP_HI, 0);
}
void
xhci_reinit(struct xhci_softc *sc)
{

View file

@ -1,4 +1,4 @@
/* $OpenBSD: kern_event.c,v 1.199 2024/07/29 12:42:53 claudio Exp $ */
/* $OpenBSD: kern_event.c,v 1.200 2024/08/06 08:44:54 claudio Exp $ */
/*-
* Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org>
@ -124,6 +124,8 @@ int filt_kqueue_common(struct knote *kn, struct kqueue *kq);
int filt_procattach(struct knote *kn);
void filt_procdetach(struct knote *kn);
int filt_proc(struct knote *kn, long hint);
int filt_procmodify(struct kevent *kev, struct knote *kn);
int filt_procprocess(struct knote *kn, struct kevent *kev);
int filt_sigattach(struct knote *kn);
void filt_sigdetach(struct knote *kn);
int filt_signal(struct knote *kn, long hint);
@ -145,17 +147,21 @@ const struct filterops kqread_filtops = {
};
const struct filterops proc_filtops = {
.f_flags = 0,
.f_flags = FILTEROP_MPSAFE,
.f_attach = filt_procattach,
.f_detach = filt_procdetach,
.f_event = filt_proc,
.f_modify = filt_procmodify,
.f_process = filt_procprocess,
};
const struct filterops sig_filtops = {
.f_flags = 0,
.f_flags = FILTEROP_MPSAFE,
.f_attach = filt_sigattach,
.f_detach = filt_sigdetach,
.f_event = filt_signal,
.f_modify = filt_procmodify,
.f_process = filt_procprocess,
};
const struct filterops file_filtops = {
@ -177,6 +183,7 @@ const struct filterops timer_filtops = {
struct pool knote_pool;
struct pool kqueue_pool;
struct mutex kqueue_klist_lock = MUTEX_INITIALIZER(IPL_MPFLOOR);
struct rwlock kqueue_ps_list_lock = RWLOCK_INITIALIZER("kqpsl");
int kq_ntimeouts = 0;
int kq_timeoutmax = (4 * 1024);
@ -333,7 +340,7 @@ int
filt_procattach(struct knote *kn)
{
struct process *pr;
int s;
int nolock;
if ((curproc->p_p->ps_flags & PS_PLEDGE) &&
(curproc->p_p->ps_pledge & PLEDGE_PROC) == 0)
@ -342,13 +349,14 @@ filt_procattach(struct knote *kn)
if (kn->kn_id > PID_MAX)
return ESRCH;
KERNEL_LOCK();
pr = prfind(kn->kn_id);
if (pr == NULL)
return (ESRCH);
goto fail;
/* exiting processes can't be specified */
if (pr->ps_flags & PS_EXITING)
return (ESRCH);
goto fail;
kn->kn_ptr.p_process = pr;
kn->kn_flags |= EV_CLEAR; /* automatically set */
@ -360,13 +368,26 @@ filt_procattach(struct knote *kn)
kn->kn_data = kn->kn_sdata; /* ppid */
kn->kn_fflags = NOTE_CHILD;
kn->kn_flags &= ~EV_FLAG1;
rw_assert_wrlock(&kqueue_ps_list_lock);
}
s = splhigh();
/* this needs both the ps_mtx and exclusive kqueue_ps_list_lock. */
nolock = (rw_status(&kqueue_ps_list_lock) == RW_WRITE);
if (!nolock)
rw_enter_write(&kqueue_ps_list_lock);
mtx_enter(&pr->ps_mtx);
klist_insert_locked(&pr->ps_klist, kn);
splx(s);
mtx_leave(&pr->ps_mtx);
if (!nolock)
rw_exit_write(&kqueue_ps_list_lock);
KERNEL_UNLOCK();
return (0);
fail:
KERNEL_UNLOCK();
return (ESRCH);
}
/*
@ -380,25 +401,25 @@ filt_procattach(struct knote *kn)
void
filt_procdetach(struct knote *kn)
{
struct kqueue *kq = kn->kn_kq;
struct process *pr = kn->kn_ptr.p_process;
int s, status;
int status;
mtx_enter(&kq->kq_lock);
/* this needs both the ps_mtx and exclusive kqueue_ps_list_lock. */
rw_enter_write(&kqueue_ps_list_lock);
mtx_enter(&pr->ps_mtx);
status = kn->kn_status;
mtx_leave(&kq->kq_lock);
if (status & KN_DETACHED)
return;
if ((status & KN_DETACHED) == 0)
klist_remove_locked(&pr->ps_klist, kn);
s = splhigh();
klist_remove_locked(&pr->ps_klist, kn);
splx(s);
mtx_leave(&pr->ps_mtx);
rw_exit_write(&kqueue_ps_list_lock);
}
int
filt_proc(struct knote *kn, long hint)
{
struct process *pr = kn->kn_ptr.p_process;
struct kqueue *kq = kn->kn_kq;
u_int event;
@ -419,17 +440,14 @@ filt_proc(struct knote *kn, long hint)
*/
if (event == NOTE_EXIT) {
struct process *pr = kn->kn_ptr.p_process;
int s;
mtx_enter(&kq->kq_lock);
kn->kn_status |= KN_DETACHED;
mtx_leave(&kq->kq_lock);
s = splhigh();
kn->kn_flags |= (EV_EOF | EV_ONESHOT);
kn->kn_data = W_EXITCODE(pr->ps_xexit, pr->ps_xsig);
klist_remove_locked(&pr->ps_klist, kn);
splx(s);
return (1);
}
@ -452,7 +470,12 @@ filt_proc(struct knote *kn, long hint)
kev.fflags = kn->kn_sfflags;
kev.data = kn->kn_id; /* parent */
kev.udata = kn->kn_udata; /* preserve udata */
rw_assert_wrlock(&kqueue_ps_list_lock);
mtx_leave(&pr->ps_mtx);
error = kqueue_register(kq, &kev, 0, NULL);
mtx_enter(&pr->ps_mtx);
if (error)
kn->kn_fflags |= NOTE_TRACKERR;
}
@ -460,6 +483,37 @@ filt_proc(struct knote *kn, long hint)
return (kn->kn_fflags != 0);
}
int
filt_procmodify(struct kevent *kev, struct knote *kn)
{
struct process *pr = kn->kn_ptr.p_process;
int active;
mtx_enter(&pr->ps_mtx);
active = knote_modify(kev, kn);
mtx_leave(&pr->ps_mtx);
return (active);
}
/*
* By default only grab the mutex here. If the event requires extra protection
* because it alters the klist (NOTE_EXIT, NOTE_FORK the caller of the knote
* needs to grab the rwlock first.
*/
int
filt_procprocess(struct knote *kn, struct kevent *kev)
{
struct process *pr = kn->kn_ptr.p_process;
int active;
mtx_enter(&pr->ps_mtx);
active = knote_process(kn, kev);
mtx_leave(&pr->ps_mtx);
return (active);
}
/*
* signal knotes are shared with proc knotes, so we apply a mask to
* the hint in order to differentiate them from process hints. This
@ -470,7 +524,6 @@ int
filt_sigattach(struct knote *kn)
{
struct process *pr = curproc->p_p;
int s;
if (kn->kn_id >= NSIG)
return EINVAL;
@ -478,9 +531,12 @@ filt_sigattach(struct knote *kn)
kn->kn_ptr.p_process = pr;
kn->kn_flags |= EV_CLEAR; /* automatically set */
s = splhigh();
/* this needs both the ps_mtx and exclusive kqueue_ps_list_lock. */
rw_enter_write(&kqueue_ps_list_lock);
mtx_enter(&pr->ps_mtx);
klist_insert_locked(&pr->ps_klist, kn);
splx(s);
mtx_leave(&pr->ps_mtx);
rw_exit_write(&kqueue_ps_list_lock);
return (0);
}
@ -489,17 +545,17 @@ void
filt_sigdetach(struct knote *kn)
{
struct process *pr = kn->kn_ptr.p_process;
int s;
s = splhigh();
rw_enter_write(&kqueue_ps_list_lock);
mtx_enter(&pr->ps_mtx);
klist_remove_locked(&pr->ps_klist, kn);
splx(s);
mtx_leave(&pr->ps_mtx);
rw_exit_write(&kqueue_ps_list_lock);
}
int
filt_signal(struct knote *kn, long hint)
{
if (hint & NOTE_SIGNAL) {
hint &= ~NOTE_SIGNAL;
@ -2002,14 +2058,28 @@ knote_fdclose(struct proc *p, int fd)
void
knote_processexit(struct process *pr)
{
KERNEL_ASSERT_LOCKED();
/* this needs both the ps_mtx and exclusive kqueue_ps_list_lock. */
rw_enter_write(&kqueue_ps_list_lock);
mtx_enter(&pr->ps_mtx);
knote_locked(&pr->ps_klist, NOTE_EXIT);
mtx_leave(&pr->ps_mtx);
rw_exit_write(&kqueue_ps_list_lock);
/* remove other knotes hanging off the process */
klist_invalidate(&pr->ps_klist);
}
void
knote_processfork(struct process *pr, pid_t pid)
{
/* this needs both the ps_mtx and exclusive kqueue_ps_list_lock. */
rw_enter_write(&kqueue_ps_list_lock);
mtx_enter(&pr->ps_mtx);
knote_locked(&pr->ps_klist, NOTE_FORK | pid);
mtx_leave(&pr->ps_mtx);
rw_exit_write(&kqueue_ps_list_lock);
}
void
knote_attach(struct knote *kn)
{

View file

@ -1,4 +1,4 @@
/* $OpenBSD: kern_exec.c,v 1.256 2024/07/08 13:17:12 claudio Exp $ */
/* $OpenBSD: kern_exec.c,v 1.257 2024/08/06 08:44:54 claudio Exp $ */
/* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $ */
/*-
@ -711,7 +711,7 @@ sys_execve(struct proc *p, void *v, register_t *retval)
/*
* notify others that we exec'd
*/
knote_locked(&pr->ps_klist, NOTE_EXEC);
knote(&pr->ps_klist, NOTE_EXEC);
/* map the process's timekeep page, needs to be before exec_elf_fixup */
if (exec_timekeep_map(pr))

View file

@ -1,4 +1,4 @@
/* $OpenBSD: kern_exit.c,v 1.228 2024/07/29 09:49:49 claudio Exp $ */
/* $OpenBSD: kern_exit.c,v 1.230 2024/08/06 18:41:20 claudio Exp $ */
/* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */
/*

View file

@ -1,4 +1,4 @@
/* $OpenBSD: kern_fork.c,v 1.260 2024/06/03 12:48:25 claudio Exp $ */
/* $OpenBSD: kern_fork.c,v 1.261 2024/08/06 08:44:54 claudio Exp $ */
/* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */
/*
@ -199,6 +199,7 @@ process_initialize(struct process *pr, struct proc *p)
rw_init(&pr->ps_lock, "pslock");
mtx_init(&pr->ps_mtx, IPL_HIGH);
klist_init_mutex(&pr->ps_klist, &pr->ps_mtx);
timeout_set_flags(&pr->ps_realit_to, realitexpire, pr,
KCLOCK_UPTIME, 0);
@ -484,7 +485,7 @@ fork1(struct proc *curp, int flags, void (*func)(void *), void *arg,
/*
* Notify any interested parties about the new process.
*/
knote_locked(&curpr->ps_klist, NOTE_FORK | pr->ps_pid);
knote_processfork(curpr, pr->ps_pid);
/*
* Update stats now that we know the fork was successful.

View file

@ -1,4 +1,4 @@
/* $OpenBSD: kern_sig.c,v 1.336 2024/07/29 12:42:53 claudio Exp $ */
/* $OpenBSD: kern_sig.c,v 1.337 2024/08/06 08:44:54 claudio Exp $ */
/* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */
/*
@ -985,7 +985,7 @@ ptsignal(struct proc *p, int signum, enum signal_type type)
}
if (type != SPROPAGATED)
knote_locked(&pr->ps_klist, NOTE_SIGNAL | signum);
knote(&pr->ps_klist, NOTE_SIGNAL | signum);
prop = sigprop[signum];

View file

@ -1,4 +1,4 @@
/* $OpenBSD: kern_sysctl.c,v 1.433 2024/08/05 18:47:29 mvs Exp $ */
/* $OpenBSD: kern_sysctl.c,v 1.436 2024/08/08 15:02:36 bluhm Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
@ -507,6 +507,8 @@ kern_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
return (sysctl_rdstring(oldp, oldlenp, newp, version));
case KERN_NUMVNODES: /* XXX numvnodes is a long */
return (sysctl_rdint(oldp, oldlenp, newp, numvnodes));
case KERN_CLOCKRATE:
return (sysctl_clockrate(oldp, oldlenp, newp));
case KERN_BOOTTIME: {
struct timeval bt;
memset(&bt, 0, sizeof bt);
@ -531,6 +533,18 @@ kern_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
return (sysctl_rdstruct(oldp, oldlenp, newp,
&mbs, sizeof(mbs)));
}
case KERN_MSGBUFSIZE:
case KERN_CONSBUFSIZE: {
struct msgbuf *mp;
mp = (name[0] == KERN_MSGBUFSIZE) ? msgbufp : consbufp;
/*
* deal with cases where the message buffer has
* become corrupted.
*/
if (!mp || mp->msg_magic != MSG_MAGIC)
return (ENXIO);
return (sysctl_rdint(oldp, oldlenp, newp, mp->msg_bufs));
}
case KERN_OSREV:
case KERN_NFILES:
case KERN_TTYCOUNT:
@ -614,20 +628,6 @@ kern_sysctl_locked(int *name, u_int namelen, void *oldp, size_t *oldlenp,
error = sysctl_int(oldp, oldlenp, newp, newlen, &inthostid);
hostid = inthostid;
return (error);
case KERN_CLOCKRATE:
return (sysctl_clockrate(oldp, oldlenp, newp));
case KERN_MSGBUFSIZE:
case KERN_CONSBUFSIZE: {
struct msgbuf *mp;
mp = (name[0] == KERN_MSGBUFSIZE) ? msgbufp : consbufp;
/*
* deal with cases where the message buffer has
* become corrupted.
*/
if (!mp || mp->msg_magic != MSG_MAGIC)
return (ENXIO);
return (sysctl_rdint(oldp, oldlenp, newp, mp->msg_bufs));
}
case KERN_CONSBUF:
if ((error = suser(p)))
return (error);
@ -635,7 +635,10 @@ kern_sysctl_locked(int *name, u_int namelen, void *oldp, size_t *oldlenp,
case KERN_MSGBUF: {
struct msgbuf *mp;
mp = (name[0] == KERN_MSGBUF) ? msgbufp : consbufp;
/* see note above */
/*
* deal with cases where the message buffer has
* become corrupted.
*/
if (!mp || mp->msg_magic != MSG_MAGIC)
return (ENXIO);
return (sysctl_rdstruct(oldp, oldlenp, newp, mp,
@ -1679,7 +1682,7 @@ sysctl_file(int *name, u_int namelen, char *where, size_t *sizep,
*/
if (pr->ps_flags & (PS_SYSTEM | PS_EMBRYO | PS_EXITING))
continue;
if (arg > 0 && pr->ps_pid != (pid_t)arg) {
if (arg >= 0 && pr->ps_pid != (pid_t)arg) {
/* not the pid we are looking for */
continue;
}
@ -1699,6 +1702,9 @@ sysctl_file(int *name, u_int namelen, char *where, size_t *sizep,
FILLIT(fp, fdp, i, NULL, pr);
FRELE(fp, p);
}
/* pid is unique, stop searching */
if (arg >= 0)
break;
}
if (!matched)
error = ESRCH;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: uipc_socket.c,v 1.341 2024/08/01 17:19:01 bluhm Exp $ */
/* $OpenBSD: uipc_socket.c,v 1.342 2024/08/06 20:14:56 mvs Exp $ */
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
/*
@ -234,8 +234,8 @@ sobind(struct socket *so, struct mbuf *nam, struct proc *p)
int
solisten(struct socket *so, int backlog)
{
int somaxconn_local = READ_ONCE(somaxconn);
int sominconn_local = READ_ONCE(sominconn);
int somaxconn_local = atomic_load_int(&somaxconn);
int sominconn_local = atomic_load_int(&sominconn);
int error;
switch (so->so_type) {

View file

@ -1,4 +1,4 @@
/* $OpenBSD: uipc_usrreq.c,v 1.208 2024/06/28 21:30:24 mvs Exp $ */
/* $OpenBSD: uipc_usrreq.c,v 1.209 2024/08/06 20:13:58 mvs Exp $ */
/* $NetBSD: uipc_usrreq.c,v 1.18 1996/02/09 19:00:50 christos Exp $ */
/*
@ -235,12 +235,12 @@ uipc_setaddr(const struct unpcb *unp, struct mbuf *nam)
* be large enough for at least one max-size datagram plus address.
*/
#define PIPSIZ 8192
u_int unpst_sendspace = PIPSIZ;
u_int unpst_recvspace = PIPSIZ;
u_int unpsq_sendspace = PIPSIZ;
u_int unpsq_recvspace = PIPSIZ;
u_int unpdg_sendspace = 2*1024; /* really max datagram size */
u_int unpdg_recvspace = 16*1024;
u_int unpst_sendspace = PIPSIZ; /* [a] */
u_int unpst_recvspace = PIPSIZ; /* [a] */
u_int unpsq_sendspace = PIPSIZ; /* [a] */
u_int unpsq_recvspace = PIPSIZ; /* [a] */
u_int unpdg_sendspace = 2*1024; /* [a] really max datagram size */
u_int unpdg_recvspace = 16*1024; /* [a] */
const struct sysctl_bounded_args unpstctl_vars[] = {
{ UNPCTL_RECVSPACE, &unpst_recvspace, 0, SB_MAX },
@ -267,15 +267,21 @@ uipc_attach(struct socket *so, int proto, int wait)
switch (so->so_type) {
case SOCK_STREAM:
error = soreserve(so, unpst_sendspace, unpst_recvspace);
error = soreserve(so,
atomic_load_int(&unpst_sendspace),
atomic_load_int(&unpst_recvspace));
break;
case SOCK_SEQPACKET:
error = soreserve(so, unpsq_sendspace, unpsq_recvspace);
error = soreserve(so,
atomic_load_int(&unpsq_sendspace),
atomic_load_int(&unpsq_recvspace));
break;
case SOCK_DGRAM:
error = soreserve(so, unpdg_sendspace, unpdg_recvspace);
error = soreserve(so,
atomic_load_int(&unpdg_sendspace),
atomic_load_int(&unpdg_recvspace));
break;
default:

View file

@ -1,4 +1,4 @@
/* $OpenBSD: pf.c,v 1.1203 2024/07/14 18:53:39 bluhm Exp $ */
/* $OpenBSD: pf.c,v 1.1204 2024/08/06 16:56:09 bluhm Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@ -7978,7 +7978,7 @@ done:
action = PF_DROP;
goto out;
}
if (ip_directedbcast)
if (atomic_load_int(&ip_directedbcast))
SET(flags, IP_ALLOWBROADCAST);
ip_forward(pd.m, ifp, NULL, flags);
} else

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ip_input.c,v 1.400 2024/07/19 16:58:31 bluhm Exp $ */
/* $OpenBSD: ip_input.c,v 1.401 2024/08/06 16:56:09 bluhm Exp $ */
/* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */
/*
@ -99,7 +99,7 @@ int ip_dosourceroute = 0;
int ip_defttl = IPDEFTTL;
int ip_mtudisc = 1;
int ip_mtudisc_timeout = IPMTUDISCTIMEOUT;
int ip_directedbcast = 0;
int ip_directedbcast = 0; /* [a] */
/* Protects `ipq' and `ip_frags'. */
struct mutex ipq_mutex = MUTEX_INITIALIZER(IPL_SOFTNET);
@ -114,6 +114,7 @@ int ip_frags = 0;
const struct sysctl_bounded_args ipctl_vars_unlocked[] = {
{ IPCTL_FORWARDING, &ip_forwarding, 0, 2 },
{ IPCTL_SENDREDIRECTS, &ip_sendredirects, 0, 1 },
{ IPCTL_DIRECTEDBCAST, &ip_directedbcast, 0, 1 },
};
const struct sysctl_bounded_args ipctl_vars[] = {
@ -121,7 +122,6 @@ const struct sysctl_bounded_args ipctl_vars[] = {
{ IPCTL_MRTPROTO, &ip_mrtproto, SYSCTL_INT_READONLY },
#endif
{ IPCTL_DEFTTL, &ip_defttl, 0, 255 },
{ IPCTL_DIRECTEDBCAST, &ip_directedbcast, 0, 1 },
{ IPCTL_IPPORT_FIRSTAUTO, &ipport_firstauto, 0, 65535 },
{ IPCTL_IPPORT_LASTAUTO, &ipport_lastauto, 0, 65535 },
{ IPCTL_IPPORT_HIFIRSTAUTO, &ipport_hifirstauto, 0, 65535 },
@ -483,7 +483,7 @@ ip_input_if(struct mbuf **mp, int *offp, int nxt, int af, struct ifnet *ifp)
SET(flags, IP_FORWARDING);
break;
}
if (ip_directedbcast)
if (atomic_load_int(&ip_directedbcast))
SET(flags, IP_ALLOWBROADCAST);
hlen = ip->ip_hl << 2;
@ -1805,6 +1805,7 @@ ip_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
return (error);
case IPCTL_FORWARDING:
case IPCTL_SENDREDIRECTS:
case IPCTL_DIRECTEDBCAST:
return (sysctl_bounded_arr(
ipctl_vars_unlocked, nitems(ipctl_vars_unlocked),
name, namelen, oldp, oldlenp, newp, newlen));

View file

@ -1,4 +1,4 @@
/* $OpenBSD: udp_usrreq.c,v 1.323 2024/07/20 17:26:19 mvs Exp $ */
/* $OpenBSD: udp_usrreq.c,v 1.324 2024/08/06 20:15:53 mvs Exp $ */
/* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */
/*
@ -112,15 +112,20 @@
#include <net/pipex.h>
#endif
/*
* Locks used to protect data:
* a atomic
*/
/*
* UDP protocol implementation.
* Per RFC 768, August, 1980.
*/
int udpcksum = 1;
int udpcksum = 1; /* [a] */
u_int udp_sendspace = 9216; /* really max datagram size */
u_int udp_sendspace = 9216; /* [a] really max datagram size */
u_int udp_recvspace = 40 * (1024 + sizeof(struct sockaddr_in));
/* 40 1K datagrams */
/* [a] 40 1K datagrams */
const struct pr_usrreqs udp_usrreqs = {
.pru_attach = udp_attach,
@ -1063,7 +1068,7 @@ udp_output(struct inpcb *inp, struct mbuf *m, struct mbuf *addr,
((struct ip *)ui)->ip_len = htons(sizeof (struct udpiphdr) + len);
((struct ip *)ui)->ip_ttl = inp->inp_ip.ip_ttl;
((struct ip *)ui)->ip_tos = inp->inp_ip.ip_tos;
if (udpcksum)
if (atomic_load_int(&udpcksum))
m->m_pkthdr.csum_flags |= M_UDP_CSUM_OUT;
udpstat_inc(udps_opackets);
@ -1098,7 +1103,8 @@ udp_attach(struct socket *so, int proto, int wait)
if (so->so_pcb != NULL)
return EINVAL;
if ((error = soreserve(so, udp_sendspace, udp_recvspace)))
if ((error = soreserve(so, atomic_load_int(&udp_sendspace),
atomic_load_int(&udp_recvspace))))
return error;
NET_ASSERT_LOCKED();
@ -1285,10 +1291,8 @@ udp_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
return (udp_sysctl_udpstat(oldp, oldlenp, newp));
default:
NET_LOCK();
error = sysctl_bounded_arr(udpctl_vars, nitems(udpctl_vars),
name, namelen, oldp, oldlenp, newp, newlen);
NET_UNLOCK();
return (error);
}
/* NOTREACHED */

View file

@ -1,4 +1,4 @@
/* $OpenBSD: event.h,v 1.72 2024/07/29 12:42:53 claudio Exp $ */
/* $OpenBSD: event.h,v 1.73 2024/08/06 08:44:54 claudio Exp $ */
/*-
* Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org>
@ -294,6 +294,7 @@ extern void knote(struct klist *list, long hint);
extern void knote_locked(struct klist *list, long hint);
extern void knote_fdclose(struct proc *p, int fd);
extern void knote_processexit(struct process *);
extern void knote_processfork(struct process *, pid_t);
extern void knote_assign(const struct kevent *, struct knote *);
extern void knote_submit(struct knote *, struct kevent *);
extern void kqueue_init(void);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: param.h,v 1.142 2024/02/17 16:13:24 deraadt Exp $ */
/* $OpenBSD: param.h,v 1.143 2024/08/07 15:59:25 deraadt Exp $ */
/*-
* Copyright (c) 1982, 1986, 1989, 1993
@ -41,8 +41,8 @@
#define BSD4_3 1
#define BSD4_4 1
#define SecBSD 202404 /* SecBSD version (year & month). */
#define SecBSD1_5 1 /* SecBSD 1.5 */
#define SecBSD 202410 /* SecBSD version (year & month). */
#define SecBSD1_6 1 /* SecBSD 1.6 */
#include <sys/_null.h>

View file

@ -1,4 +1,4 @@
/* $OpenBSD: proc.h,v 1.366 2024/07/29 09:49:49 claudio Exp $ */
/* $OpenBSD: proc.h,v 1.367 2024/08/06 08:44:54 claudio Exp $ */
/* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */
/*-
@ -136,6 +136,7 @@ struct pinsyscall {
* K kernel lock
* m this process' `ps_mtx'
* p this process' `ps_lock'
* Q kqueue_ps_list_lock
* R rlimit_lock
* S scheduler lock
* T itimer_mtx
@ -181,7 +182,7 @@ struct process {
/* The following fields are all zeroed upon creation in process_new. */
#define ps_startzero ps_klist
struct klist ps_klist; /* knotes attached to this process */
struct klist ps_klist; /* [Q,m] knotes attached to process */
u_int ps_flags; /* [a] PS_* flags. */
int ps_siglist; /* Signals pending for the process. */