sync with OpenBSD -current
This commit is contained in:
parent
2debf29dc6
commit
fa20b4dfa4
29 changed files with 243 additions and 1137 deletions
|
@ -1,4 +1,4 @@
|
|||
# $OpenBSD: GENERIC,v 1.284 2024/03/02 19:53:17 kettenis Exp $
|
||||
# $OpenBSD: GENERIC,v 1.285 2024/03/24 22:34:48 patrick Exp $
|
||||
#
|
||||
# GENERIC machine description file
|
||||
#
|
||||
|
@ -375,6 +375,7 @@ iic* at sxitwi? # I2C bus
|
|||
dwxe* at fdt?
|
||||
|
||||
# Xilinx Zynq UltraScale+ SoCs
|
||||
cad* at fdt? # Ethernet controller
|
||||
cduart* at fdt?
|
||||
|
||||
# PCI
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $OpenBSD: RAMDISK,v 1.214 2024/03/02 19:53:17 kettenis Exp $
|
||||
# $OpenBSD: RAMDISK,v 1.215 2024/03/24 22:34:48 patrick Exp $
|
||||
|
||||
machine arm64
|
||||
maxusers 4
|
||||
|
@ -292,6 +292,7 @@ iic* at sxitwi? # I2C bus
|
|||
dwxe* at fdt?
|
||||
|
||||
# Xilinx Zynq UltraScale+ SoCs
|
||||
cad* at fdt? # Ethernet controller
|
||||
cduart* at fdt?
|
||||
|
||||
# PCI
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: if_cad.c,v 1.13 2023/08/15 08:27:30 miod Exp $ */
|
||||
/* $OpenBSD: if_cad.c,v 1.14 2024/03/24 22:34:06 patrick Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2021-2022 Visa Hankala
|
||||
|
@ -54,6 +54,7 @@
|
|||
#include <dev/ofw/fdt.h>
|
||||
#include <dev/ofw/openfirm.h>
|
||||
#include <dev/ofw/ofw_clock.h>
|
||||
#include <dev/ofw/ofw_gpio.h>
|
||||
|
||||
#define GEM_NETCTL 0x0000
|
||||
#define GEM_NETCTL_DPRAM (1 << 18)
|
||||
|
@ -388,6 +389,8 @@ cad_attach(struct device *parent, struct device *self, void *aux)
|
|||
struct fdt_attach_args *faa = aux;
|
||||
struct cad_softc *sc = (struct cad_softc *)self;
|
||||
struct ifnet *ifp = &sc->sc_ac.ac_if;
|
||||
uint32_t phy_reset_gpio[3];
|
||||
uint32_t phy_reset_duration;
|
||||
uint32_t hi, lo;
|
||||
uint32_t rev, ver;
|
||||
uint32_t val;
|
||||
|
@ -427,6 +430,20 @@ cad_attach(struct device *parent, struct device *self, void *aux)
|
|||
ether_fakeaddr(ifp);
|
||||
}
|
||||
|
||||
if (OF_getpropintarray(faa->fa_node, "phy-reset-gpios", phy_reset_gpio,
|
||||
sizeof(phy_reset_gpio)) == sizeof(phy_reset_gpio)) {
|
||||
phy_reset_duration = OF_getpropint(faa->fa_node,
|
||||
"phy-reset-duration", 1);
|
||||
if (phy_reset_duration > 1000)
|
||||
phy_reset_duration = 1;
|
||||
|
||||
gpio_controller_config_pin(phy_reset_gpio, GPIO_CONFIG_OUTPUT);
|
||||
gpio_controller_set_pin(phy_reset_gpio, 1);
|
||||
delay((phy_reset_duration + 1) * 1000);
|
||||
gpio_controller_set_pin(phy_reset_gpio, 0);
|
||||
delay(1000);
|
||||
}
|
||||
|
||||
phy = OF_getpropint(faa->fa_node, "phy-handle", 0);
|
||||
node = OF_getnodebyphandle(phy);
|
||||
if (node != 0)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: softraid.c,v 1.5 2022/08/12 20:17:46 stsp Exp $ */
|
||||
/* $OpenBSD: softraid.c,v 1.6 2024/03/24 05:50:20 jsg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012 Joel Sing <jsing@openbsd.org>
|
||||
|
@ -63,7 +63,7 @@ void
|
|||
sr_clear_keys(void)
|
||||
{
|
||||
struct sr_boot_volume *bv;
|
||||
struct sr_boot_keydisk *kd;
|
||||
struct sr_boot_keydisk *kd, *nkd;
|
||||
|
||||
SLIST_FOREACH(bv, &sr_volumes, sbv_link) {
|
||||
if (bv->sbv_level != 'C' && bv->sbv_level != 0x1C)
|
||||
|
@ -79,7 +79,7 @@ sr_clear_keys(void)
|
|||
bv->sbv_maskkey = NULL;
|
||||
}
|
||||
}
|
||||
SLIST_FOREACH(kd, &sr_keydisks, kd_link) {
|
||||
SLIST_FOREACH_SAFE(kd, &sr_keydisks, kd_link, nkd) {
|
||||
explicit_bzero(kd, sizeof(*kd));
|
||||
free(kd, sizeof(*kd));
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: uvm_pdaemon.c,v 1.109 2023/10/27 19:18:53 mpi Exp $ */
|
||||
/* $OpenBSD: uvm_pdaemon.c,v 1.110 2024/03/24 10:29:35 mpi Exp $ */
|
||||
/* $NetBSD: uvm_pdaemon.c,v 1.23 2000/08/20 10:24:14 bjh21 Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -165,33 +165,27 @@ uvm_wait(const char *wmsg)
|
|||
|
||||
/*
|
||||
* uvmpd_tune: tune paging parameters
|
||||
*
|
||||
* => called whenever memory is added to (or removed from?) the system
|
||||
* => caller must call with page queues locked
|
||||
*/
|
||||
|
||||
void
|
||||
uvmpd_tune(void)
|
||||
{
|
||||
int val;
|
||||
|
||||
uvmexp.freemin = uvmexp.npages / 30;
|
||||
val = uvmexp.npages / 30;
|
||||
|
||||
/* between 16k and 512k */
|
||||
/* XXX: what are these values good for? */
|
||||
uvmexp.freemin = max(uvmexp.freemin, (16*1024) >> PAGE_SHIFT);
|
||||
#if 0
|
||||
uvmexp.freemin = min(uvmexp.freemin, (512*1024) >> PAGE_SHIFT);
|
||||
#endif
|
||||
val = max(val, (16*1024) >> PAGE_SHIFT);
|
||||
|
||||
/* Make sure there's always a user page free. */
|
||||
if (uvmexp.freemin < uvmexp.reserve_kernel + 1)
|
||||
uvmexp.freemin = uvmexp.reserve_kernel + 1;
|
||||
if (val < uvmexp.reserve_kernel + 1)
|
||||
val = uvmexp.reserve_kernel + 1;
|
||||
uvmexp.freemin = val;
|
||||
|
||||
uvmexp.freetarg = (uvmexp.freemin * 4) / 3;
|
||||
if (uvmexp.freetarg <= uvmexp.freemin)
|
||||
uvmexp.freetarg = uvmexp.freemin + 1;
|
||||
|
||||
/* uvmexp.inactarg: computed in main daemon loop */
|
||||
/* Calculate free target. */
|
||||
val = (uvmexp.freemin * 4) / 3;
|
||||
if (val <= uvmexp.freemin)
|
||||
val = uvmexp.freemin + 1;
|
||||
uvmexp.freetarg = val;
|
||||
|
||||
uvmexp.wiredmax = uvmexp.npages / 3;
|
||||
}
|
||||
|
@ -211,15 +205,12 @@ uvm_pageout(void *arg)
|
|||
{
|
||||
struct uvm_constraint_range constraint;
|
||||
struct uvm_pmalloc *pma;
|
||||
int npages = 0;
|
||||
int free;
|
||||
|
||||
/* ensure correct priority and set paging parameters... */
|
||||
uvm.pagedaemon_proc = curproc;
|
||||
(void) spl0();
|
||||
uvm_lock_pageq();
|
||||
npages = uvmexp.npages;
|
||||
uvmpd_tune();
|
||||
uvm_unlock_pageq();
|
||||
|
||||
for (;;) {
|
||||
long size;
|
||||
|
@ -245,44 +236,38 @@ uvm_pageout(void *arg)
|
|||
} else
|
||||
constraint = no_constraint;
|
||||
}
|
||||
|
||||
free = uvmexp.free - BUFPAGES_DEFICIT;
|
||||
uvm_unlock_fpageq();
|
||||
|
||||
/*
|
||||
* now lock page queues and recompute inactive count
|
||||
*/
|
||||
uvm_lock_pageq();
|
||||
if (npages != uvmexp.npages) { /* check for new pages? */
|
||||
npages = uvmexp.npages;
|
||||
uvmpd_tune();
|
||||
}
|
||||
|
||||
uvmexp.inactarg = (uvmexp.active + uvmexp.inactive) / 3;
|
||||
if (uvmexp.inactarg <= uvmexp.freetarg) {
|
||||
uvmexp.inactarg = uvmexp.freetarg + 1;
|
||||
}
|
||||
uvm_unlock_pageq();
|
||||
|
||||
/* Reclaim pages from the buffer cache if possible. */
|
||||
size = 0;
|
||||
if (pma != NULL)
|
||||
size += pma->pm_size >> PAGE_SHIFT;
|
||||
if (uvmexp.free - BUFPAGES_DEFICIT < uvmexp.freetarg)
|
||||
size += uvmexp.freetarg - (uvmexp.free -
|
||||
BUFPAGES_DEFICIT);
|
||||
if (free < uvmexp.freetarg)
|
||||
size += uvmexp.freetarg - free;
|
||||
if (size == 0)
|
||||
size = 16; /* XXX */
|
||||
uvm_unlock_pageq();
|
||||
|
||||
(void) bufbackoff(&constraint, size * 2);
|
||||
#if NDRM > 0
|
||||
drmbackoff(size * 2);
|
||||
#endif
|
||||
uvm_lock_pageq();
|
||||
|
||||
/*
|
||||
* scan if needed
|
||||
*/
|
||||
if (pma != NULL ||
|
||||
((uvmexp.free - BUFPAGES_DEFICIT) < uvmexp.freetarg) ||
|
||||
uvm_lock_pageq();
|
||||
free = uvmexp.free - BUFPAGES_DEFICIT;
|
||||
if (pma != NULL || (free < uvmexp.freetarg) ||
|
||||
((uvmexp.inactive + BUFPAGES_INACT) < uvmexp.inactarg)) {
|
||||
uvmpd_scan(pma, &constraint);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: uvmexp.h,v 1.11 2023/10/27 19:18:53 mpi Exp $ */
|
||||
/* $OpenBSD: uvmexp.h,v 1.12 2024/03/24 10:29:35 mpi Exp $ */
|
||||
|
||||
#ifndef _UVM_UVMEXP_
|
||||
#define _UVM_UVMEXP_
|
||||
|
@ -45,7 +45,9 @@
|
|||
* I immutable after creation
|
||||
* K kernel lock
|
||||
* F uvm_lock_fpageq
|
||||
* L uvm_lock_pageq
|
||||
* S uvm_swap_data_lock
|
||||
* p copy of per-CPU counters, used only by userland.
|
||||
*/
|
||||
struct uvmexp {
|
||||
/* vm_page constants */
|
||||
|
@ -56,8 +58,8 @@ struct uvmexp {
|
|||
/* vm_page counters */
|
||||
int npages; /* [I] number of pages we manage */
|
||||
int free; /* [F] number of free pages */
|
||||
int active; /* number of active pages */
|
||||
int inactive; /* number of pages that we free'd but may want back */
|
||||
int active; /* [L] # of active pages */
|
||||
int inactive; /* [L] # of pages that we free'd but may want back */
|
||||
int paging; /* number of pages in the process of being paged out */
|
||||
int wired; /* number of wired pages */
|
||||
|
||||
|
@ -69,10 +71,10 @@ struct uvmexp {
|
|||
int vtextpages; /* XXX # of pages used by vtext vnodes */
|
||||
|
||||
/* pageout params */
|
||||
int freemin; /* min number of free pages */
|
||||
int freetarg; /* target number of free pages */
|
||||
int freemin; /* [I] min number of free pages */
|
||||
int freetarg; /* [I] target number of free pages */
|
||||
int inactarg; /* target number of inactive pages */
|
||||
int wiredmax; /* max number of wired pages */
|
||||
int wiredmax; /* [I] max number of wired pages */
|
||||
int anonmin; /* min threshold for anon pages */
|
||||
int vtextmin; /* min threshold for vtext pages */
|
||||
int vnodemin; /* min threshold for vnode pages */
|
||||
|
@ -91,16 +93,16 @@ struct uvmexp {
|
|||
int unused06; /* formerly nfreeanon */
|
||||
|
||||
/* stat counters */
|
||||
int faults; /* page fault count */
|
||||
int faults; /* [p] page fault count */
|
||||
int traps; /* trap count */
|
||||
int intrs; /* interrupt count */
|
||||
int swtch; /* context switch count */
|
||||
int softs; /* software interrupt count */
|
||||
int syscalls; /* system calls */
|
||||
int pageins; /* pagein operation count */
|
||||
int pageins; /* [p] pagein operation count */
|
||||
/* pageouts are in pdpageouts below */
|
||||
int unused07; /* formerly obsolete_swapins */
|
||||
int unused08; /* formerly obsolete_swapouts */
|
||||
int unused07; /* formerly obsolete_swapins */
|
||||
int unused08; /* formerly obsolete_swapouts */
|
||||
int pgswapin; /* pages swapped in */
|
||||
int pgswapout; /* pages swapped out */
|
||||
int forks; /* forks */
|
||||
|
@ -113,28 +115,28 @@ struct uvmexp {
|
|||
int unused09; /* formerly zeroaborts */
|
||||
|
||||
/* fault subcounters */
|
||||
int fltnoram; /* number of times fault was out of ram */
|
||||
int fltnoanon; /* number of times fault was out of anons */
|
||||
int fltnoamap; /* number of times fault was out of amap chunks */
|
||||
int fltpgwait; /* number of times fault had to wait on a page */
|
||||
int fltpgrele; /* number of times fault found a released page */
|
||||
int fltrelck; /* number of times fault relock called */
|
||||
int fltrelckok; /* number of times fault relock is a success */
|
||||
int fltanget; /* number of times fault gets anon page */
|
||||
int fltanretry; /* number of times fault retrys an anon get */
|
||||
int fltamcopy; /* number of times fault clears "needs copy" */
|
||||
int fltnamap; /* number of times fault maps a neighbor anon page */
|
||||
int fltnomap; /* number of times fault maps a neighbor obj page */
|
||||
int fltlget; /* number of times fault does a locked pgo_get */
|
||||
int fltget; /* number of times fault does an unlocked get */
|
||||
int flt_anon; /* number of times fault anon (case 1a) */
|
||||
int flt_acow; /* number of times fault anon cow (case 1b) */
|
||||
int flt_obj; /* number of times fault is on object page (2a) */
|
||||
int flt_prcopy; /* number of times fault promotes with copy (2b) */
|
||||
int flt_przero; /* number of times fault promotes with zerofill (2b) */
|
||||
int fltnoram; /* [p] # of times fault was out of ram */
|
||||
int fltnoanon; /* [p] # of times fault was out of anons */
|
||||
int fltnoamap; /* [p] # of times fault was out of amap chunks */
|
||||
int fltpgwait; /* [p] # of times fault had to wait on a page */
|
||||
int fltpgrele; /* [p] # of times fault found a released page */
|
||||
int fltrelck; /* [p] # of times fault relock called */
|
||||
int fltrelckok; /* [p] # of times fault relock is a success */
|
||||
int fltanget; /* [p] # of times fault gets anon page */
|
||||
int fltanretry; /* [p] # of times fault retrys an anon get */
|
||||
int fltamcopy; /* [p] # of times fault clears "needs copy" */
|
||||
int fltnamap; /* [p] # of times fault maps a neighbor anon page */
|
||||
int fltnomap; /* [p] # of times fault maps a neighbor obj page */
|
||||
int fltlget; /* [p] # of times fault does a locked pgo_get */
|
||||
int fltget; /* [p] # of times fault does an unlocked get */
|
||||
int flt_anon; /* [p] # of times fault anon (case 1a) */
|
||||
int flt_acow; /* [p] # of times fault anon cow (case 1b) */
|
||||
int flt_obj; /* [p] # of times fault is on object page (2a) */
|
||||
int flt_prcopy; /* [p] # of times fault promotes with copy (2b) */
|
||||
int flt_przero; /* [p] # of times fault promotes with zerofill (2b) */
|
||||
|
||||
/* daemon counters */
|
||||
int pdwoke; /* number of times daemon woke up */
|
||||
int pdwoke; /* [F] # of times daemon woke up */
|
||||
int pdrevs; /* number of times daemon rev'd clock hand */
|
||||
int pdswout; /* number of times daemon called for swapout */
|
||||
int pdfreed; /* number of pages daemon freed since boot */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue