sync with OpenBSD -current
This commit is contained in:
parent
ed28f347da
commit
cc6742f14d
20 changed files with 315 additions and 155 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: vmmvar.h,v 1.97 2024/01/10 04:13:59 dv Exp $ */
|
||||
/* $OpenBSD: vmmvar.h,v 1.98 2024/01/20 20:11:24 mlarkin Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
|
||||
*
|
||||
|
@ -28,7 +28,7 @@
|
|||
#define VMM_MAX_NAME_LEN 64
|
||||
#define VMM_MAX_VCPUS 512
|
||||
#define VMM_MAX_VCPUS_PER_VM 64
|
||||
#define VMM_MAX_VM_MEM_SIZE 32L * 1024 * 1024 * 1024 /* 32 GiB */
|
||||
#define VMM_MAX_VM_MEM_SIZE 128L * 1024 * 1024 * 1024
|
||||
#define VMM_MAX_NICS_PER_VM 4
|
||||
|
||||
#define VMM_PCI_MMIO_BAR_BASE 0xF0000000ULL
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: apldart.c,v 1.19 2023/12/23 18:28:38 kettenis Exp $ */
|
||||
/* $OpenBSD: apldart.c,v 1.20 2024/01/20 11:22:46 kettenis Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2021 Mark Kettenis <kettenis@openbsd.org>
|
||||
*
|
||||
|
@ -61,6 +61,10 @@
|
|||
#define DART_T8020_TTBR_BASE 0x0200
|
||||
#define DART_T8020_TTBR_VALID (1U << 31)
|
||||
|
||||
#define DART_T8110_PARAMS3 0x0008
|
||||
#define DART_T8110_PARAMS3_REV_MIN(x) (((x) >> 0) & 0xff)
|
||||
#define DART_T8110_PARAMS3_REV_MAJ(x) (((x) >> 8) & 0xff)
|
||||
#define DART_T8110_PARAMS3_VA_WIDTH(x) (((x) >> 16) & 0x3f)
|
||||
#define DART_T8110_PARAMS4 0x000c
|
||||
#define DART_T8110_PARAMS4_NSID_MASK (0x1ff << 0)
|
||||
#define DART_T8110_TLB_CMD 0x0080
|
||||
|
@ -155,6 +159,7 @@ struct apldart_softc {
|
|||
bus_dma_tag_t sc_dmat;
|
||||
int sc_node;
|
||||
|
||||
int sc_ias;
|
||||
int sc_nsid;
|
||||
int sc_nttbr;
|
||||
int sc_shift;
|
||||
|
@ -168,6 +173,7 @@ struct apldart_softc {
|
|||
|
||||
bus_addr_t sc_dvabase;
|
||||
bus_addr_t sc_dvaend;
|
||||
bus_addr_t sc_dvamask;
|
||||
|
||||
struct apldart_stream **sc_as;
|
||||
struct iommu_device sc_id;
|
||||
|
@ -219,7 +225,7 @@ int apldart_t8110_intr(void *);
|
|||
|
||||
void apldart_t8020_flush_tlb(struct apldart_softc *, int);
|
||||
void apldart_t8110_flush_tlb(struct apldart_softc *, int);
|
||||
int apldart_load_map(struct apldart_stream *, bus_dmamap_t);
|
||||
int apldart_load_map(struct apldart_stream *, bus_dmamap_t, int);
|
||||
void apldart_unload_map(struct apldart_stream *, bus_dmamap_t);
|
||||
|
||||
int apldart_dmamap_create(bus_dma_tag_t, bus_size_t, int, bus_size_t,
|
||||
|
@ -252,7 +258,8 @@ apldart_attach(struct device *parent, struct device *self, void *aux)
|
|||
{
|
||||
struct apldart_softc *sc = (struct apldart_softc *)self;
|
||||
struct fdt_attach_args *faa = aux;
|
||||
uint32_t config, params2, params4, tcr, ttbr;
|
||||
uint64_t dva_range[2];
|
||||
uint32_t config, maj, min, params2, params3, params4, tcr, ttbr;
|
||||
int sid, idx;
|
||||
|
||||
if (faa->fa_nreg < 1) {
|
||||
|
@ -273,7 +280,9 @@ apldart_attach(struct device *parent, struct device *self, void *aux)
|
|||
power_domain_enable(sc->sc_node);
|
||||
|
||||
if (OF_is_compatible(sc->sc_node, "apple,t8110-dart")) {
|
||||
params3 = HREAD4(sc, DART_T8110_PARAMS3);
|
||||
params4 = HREAD4(sc, DART_T8110_PARAMS4);
|
||||
sc->sc_ias = DART_T8110_PARAMS3_VA_WIDTH(params3);
|
||||
sc->sc_nsid = params4 & DART_T8110_PARAMS4_NSID_MASK;
|
||||
sc->sc_nttbr = 1;
|
||||
sc->sc_sid_enable_base = DART_T8110_SID_ENABLE_BASE;
|
||||
|
@ -284,7 +293,10 @@ apldart_attach(struct device *parent, struct device *self, void *aux)
|
|||
sc->sc_ttbr_base = DART_T8110_TTBR_BASE;
|
||||
sc->sc_ttbr_valid = DART_T8110_TTBR_VALID;
|
||||
sc->sc_flush_tlb = apldart_t8110_flush_tlb;
|
||||
maj = DART_T8110_PARAMS3_REV_MAJ(params3);
|
||||
min = DART_T8110_PARAMS3_REV_MIN(params3);
|
||||
} else {
|
||||
sc->sc_ias = 32;
|
||||
sc->sc_nsid = 16;
|
||||
sc->sc_nttbr = 4;
|
||||
sc->sc_sid_enable_base = DART_T8020_SID_ENABLE;
|
||||
|
@ -295,6 +307,7 @@ apldart_attach(struct device *parent, struct device *self, void *aux)
|
|||
sc->sc_ttbr_base = DART_T8020_TTBR_BASE;
|
||||
sc->sc_ttbr_valid = DART_T8020_TTBR_VALID;
|
||||
sc->sc_flush_tlb = apldart_t8020_flush_tlb;
|
||||
maj = min = 0;
|
||||
}
|
||||
|
||||
if (OF_is_compatible(sc->sc_node, "apple,t6000-dart") ||
|
||||
|
@ -312,6 +325,19 @@ apldart_attach(struct device *parent, struct device *self, void *aux)
|
|||
sc->sc_locked = 1;
|
||||
}
|
||||
|
||||
if (maj != 0 || min != 0)
|
||||
printf(" rev %d.%d", maj, min);
|
||||
|
||||
printf(": %d bits", sc->sc_ias);
|
||||
|
||||
/*
|
||||
* Anything over 36 bits requires 4-level page tables which we
|
||||
* don't implement yet. So limit to 36 bits.
|
||||
*/
|
||||
if (sc->sc_ias > 36)
|
||||
sc->sc_ias = 36;
|
||||
sc->sc_dvamask = (1ULL << sc->sc_ias) - 1;
|
||||
|
||||
/*
|
||||
* Resetting the DART used for the display controller will
|
||||
* kill the framebuffer. This should be the only DART that
|
||||
|
@ -346,25 +372,33 @@ apldart_attach(struct device *parent, struct device *self, void *aux)
|
|||
!sc->sc_locked && !sc->sc_translating) {
|
||||
for (sid = 0; sid < sc->sc_nsid; sid++)
|
||||
HWRITE4(sc, DART_TCR(sc, sid), sc->sc_tcr_bypass);
|
||||
printf(": bypass\n");
|
||||
printf(", bypass\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (sc->sc_locked)
|
||||
printf(": locked\n");
|
||||
printf(", locked\n");
|
||||
else if (sc->sc_translating)
|
||||
printf(": translating\n");
|
||||
printf(", translating\n");
|
||||
else
|
||||
printf("\n");
|
||||
|
||||
/*
|
||||
* Skip the first page to help catching bugs where a device is
|
||||
* doing DMA to/from address zero because we didn't properly
|
||||
* set up the DMA transfer. Skip the last page to avoid using
|
||||
* the address reserved for MSIs.
|
||||
*/
|
||||
sc->sc_dvabase = DART_PAGE_SIZE;
|
||||
sc->sc_dvaend = 0xffffffff - DART_PAGE_SIZE;
|
||||
if (OF_getpropint64array(sc->sc_node, "apple,dma-range",
|
||||
dva_range, sizeof(dva_range)) == sizeof(dva_range)) {
|
||||
sc->sc_dvabase = dva_range[0];
|
||||
sc->sc_dvaend = dva_range[0] + dva_range[1] - 1;
|
||||
} else {
|
||||
/*
|
||||
* Restrict ourselves to 32-bit addresses to cater for
|
||||
* devices that don't do 64-bit DMA. Skip the first
|
||||
* page to help catching bugs where a device is doing
|
||||
* DMA to/from address zero because we didn't properly
|
||||
* set up the DMA transfer. Skip the last page to
|
||||
* avoid using the address reserved for MSIs.
|
||||
*/
|
||||
sc->sc_dvabase = DART_PAGE_SIZE;
|
||||
sc->sc_dvaend = 0xffffffff - DART_PAGE_SIZE;
|
||||
}
|
||||
|
||||
if (!sc->sc_locked && !sc->sc_translating) {
|
||||
/* Disable translations. */
|
||||
|
@ -430,7 +464,7 @@ apldart_resume(struct apldart_softc *sc)
|
|||
return;
|
||||
}
|
||||
|
||||
ntte = howmany(sc->sc_dvaend, DART_PAGE_SIZE);
|
||||
ntte = howmany((sc->sc_dvaend & sc->sc_dvamask), DART_PAGE_SIZE);
|
||||
nl2 = howmany(ntte, DART_PAGE_SIZE / sizeof(uint64_t));
|
||||
nl1 = howmany(nl2, DART_PAGE_SIZE / sizeof(uint64_t));
|
||||
|
||||
|
@ -495,7 +529,7 @@ apldart_init_locked_stream(struct apldart_stream *as)
|
|||
uint32_t ttbr;
|
||||
vaddr_t startva, endva, va;
|
||||
paddr_t pa;
|
||||
bus_addr_t dva, dvaend;
|
||||
bus_addr_t dva, dvaend, dvabase;
|
||||
volatile uint64_t *l1;
|
||||
int nl1, nl2, ntte;
|
||||
int idx;
|
||||
|
@ -510,15 +544,23 @@ apldart_init_locked_stream(struct apldart_stream *as)
|
|||
nl2 = idx * (DART_PAGE_SIZE / sizeof(uint64_t));
|
||||
ntte = nl2 * (DART_PAGE_SIZE / sizeof(uint64_t));
|
||||
|
||||
dvaend = (bus_addr_t)ntte * DART_PAGE_SIZE;
|
||||
dvabase = sc->sc_dvabase & ~sc->sc_dvamask;
|
||||
dvaend = dvabase + (bus_addr_t)ntte * DART_PAGE_SIZE;
|
||||
if (dvaend < sc->sc_dvaend)
|
||||
sc->sc_dvaend = dvaend;
|
||||
|
||||
as->as_dvamap = extent_create(sc->sc_dev.dv_xname,
|
||||
sc->sc_dvabase, sc->sc_dvaend, M_DEVBUF,
|
||||
NULL, 0, EX_WAITOK | EX_NOCOALESCE);
|
||||
as->as_dvamap = extent_create(sc->sc_dev.dv_xname, 0, ULONG_MAX,
|
||||
M_DEVBUF, NULL, 0, EX_WAITOK | EX_NOCOALESCE);
|
||||
if (sc->sc_dvabase > 0) {
|
||||
extent_alloc_region(as->as_dvamap, 0, sc->sc_dvabase,
|
||||
EX_WAITOK);
|
||||
}
|
||||
if (sc->sc_dvaend < ULONG_MAX) {
|
||||
extent_alloc_region(as->as_dvamap, sc->sc_dvaend + 1,
|
||||
ULONG_MAX - sc->sc_dvaend, EX_WAITOK);
|
||||
}
|
||||
|
||||
ntte = howmany(sc->sc_dvaend, DART_PAGE_SIZE);
|
||||
ntte = howmany((sc->sc_dvaend & sc->sc_dvamask), DART_PAGE_SIZE);
|
||||
nl2 = howmany(ntte, DART_PAGE_SIZE / sizeof(uint64_t));
|
||||
nl1 = howmany(nl2, DART_PAGE_SIZE / sizeof(uint64_t));
|
||||
|
||||
|
@ -545,12 +587,8 @@ apldart_init_locked_stream(struct apldart_stream *as)
|
|||
dva = idx * (DART_PAGE_SIZE / sizeof(uint64_t)) *
|
||||
DART_PAGE_SIZE;
|
||||
dvaend = dva + DART_PAGE_SIZE * DART_PAGE_SIZE - 1;
|
||||
if (dva < sc->sc_dvabase)
|
||||
dva = sc->sc_dvabase;
|
||||
if (dvaend > sc->sc_dvaend)
|
||||
dvaend = sc->sc_dvaend;
|
||||
extent_alloc_region(as->as_dvamap, dva,
|
||||
dvaend - dva + 1, EX_CONFLICTOK);
|
||||
extent_alloc_region(as->as_dvamap, dvabase + dva,
|
||||
dvaend - dva + 1, EX_WAITOK | EX_CONFLICTOK);
|
||||
} else {
|
||||
as->as_l2[idx] = apldart_dmamem_alloc(sc->sc_dmat,
|
||||
DART_PAGE_SIZE, DART_PAGE_SIZE);
|
||||
|
@ -593,9 +631,16 @@ apldart_alloc_stream(struct apldart_softc *sc, int sid)
|
|||
return as;
|
||||
}
|
||||
|
||||
as->as_dvamap = extent_create(sc->sc_dev.dv_xname,
|
||||
sc->sc_dvabase, sc->sc_dvaend, M_DEVBUF,
|
||||
NULL, 0, EX_WAITOK | EX_NOCOALESCE);
|
||||
as->as_dvamap = extent_create(sc->sc_dev.dv_xname, 0, ULONG_MAX,
|
||||
M_DEVBUF, NULL, 0, EX_WAITOK | EX_NOCOALESCE);
|
||||
if (sc->sc_dvabase > 0) {
|
||||
extent_alloc_region(as->as_dvamap, 0, sc->sc_dvabase,
|
||||
EX_WAITOK);
|
||||
}
|
||||
if (sc->sc_dvaend < ULONG_MAX) {
|
||||
extent_alloc_region(as->as_dvamap, sc->sc_dvaend + 1,
|
||||
ULONG_MAX - sc->sc_dvaend, EX_WAITOK);
|
||||
}
|
||||
|
||||
/*
|
||||
* Build translation tables. We pre-allocate the translation
|
||||
|
@ -603,7 +648,7 @@ apldart_alloc_stream(struct apldart_softc *sc, int sid)
|
|||
* worry about growing them in an mpsafe manner later.
|
||||
*/
|
||||
|
||||
ntte = howmany(sc->sc_dvaend, DART_PAGE_SIZE);
|
||||
ntte = howmany((sc->sc_dvaend & sc->sc_dvamask), DART_PAGE_SIZE);
|
||||
nl2 = howmany(ntte, DART_PAGE_SIZE / sizeof(uint64_t));
|
||||
nl1 = howmany(nl2, DART_PAGE_SIZE / sizeof(uint64_t));
|
||||
|
||||
|
@ -730,7 +775,7 @@ apldart_t8110_flush_tlb(struct apldart_softc *sc, int sid)
|
|||
volatile uint64_t *
|
||||
apldart_lookup_tte(struct apldart_stream *as, bus_addr_t dva)
|
||||
{
|
||||
int idx = dva / DART_PAGE_SIZE;
|
||||
int idx = (dva & as->as_sc->sc_dvamask) / DART_PAGE_SIZE;
|
||||
int l2_idx = idx / (DART_PAGE_SIZE / sizeof(uint64_t));
|
||||
int tte_idx = idx % (DART_PAGE_SIZE / sizeof(uint64_t));
|
||||
volatile uint64_t *l2;
|
||||
|
@ -740,7 +785,7 @@ apldart_lookup_tte(struct apldart_stream *as, bus_addr_t dva)
|
|||
}
|
||||
|
||||
int
|
||||
apldart_load_map(struct apldart_stream *as, bus_dmamap_t map)
|
||||
apldart_load_map(struct apldart_stream *as, bus_dmamap_t map, int flags)
|
||||
{
|
||||
struct apldart_softc *sc = as->as_sc;
|
||||
struct apldart_map_state *ams = map->_dm_cookie;
|
||||
|
@ -757,8 +802,18 @@ apldart_load_map(struct apldart_stream *as, bus_dmamap_t map)
|
|||
len = apldart_round_page(map->dm_segs[seg].ds_len + off);
|
||||
|
||||
mtx_enter(&as->as_dvamap_mtx);
|
||||
error = extent_alloc_with_descr(as->as_dvamap, len,
|
||||
DART_PAGE_SIZE, 0, 0, EX_NOWAIT, &ams[seg].ams_er, &dva);
|
||||
if (flags & BUS_DMA_FIXED) {
|
||||
dva = apldart_trunc_page(map->dm_segs[seg].ds_addr);
|
||||
/* XXX truncate because "apple,dma-range" mismatch */
|
||||
if (dva > sc->sc_dvaend)
|
||||
dva &= sc->sc_dvamask;
|
||||
error = extent_alloc_region_with_descr(as->as_dvamap,
|
||||
dva, len, EX_NOWAIT, &ams[seg].ams_er);
|
||||
} else {
|
||||
error = extent_alloc_with_descr(as->as_dvamap, len,
|
||||
DART_PAGE_SIZE, 0, 0, EX_NOWAIT, &ams[seg].ams_er,
|
||||
&dva);
|
||||
}
|
||||
mtx_leave(&as->as_dvamap_mtx);
|
||||
if (error) {
|
||||
apldart_unload_map(as, map);
|
||||
|
@ -887,7 +942,7 @@ apldart_dmamap_load(bus_dma_tag_t t, bus_dmamap_t map, void *buf,
|
|||
if (error)
|
||||
return error;
|
||||
|
||||
error = apldart_load_map(as, map);
|
||||
error = apldart_load_map(as, map, flags);
|
||||
if (error)
|
||||
sc->sc_dmat->_dmamap_unload(sc->sc_dmat, map);
|
||||
|
||||
|
@ -907,7 +962,7 @@ apldart_dmamap_load_mbuf(bus_dma_tag_t t, bus_dmamap_t map,
|
|||
if (error)
|
||||
return error;
|
||||
|
||||
error = apldart_load_map(as, map);
|
||||
error = apldart_load_map(as, map, flags);
|
||||
if (error)
|
||||
sc->sc_dmat->_dmamap_unload(sc->sc_dmat, map);
|
||||
|
||||
|
@ -927,7 +982,7 @@ apldart_dmamap_load_uio(bus_dma_tag_t t, bus_dmamap_t map,
|
|||
if (error)
|
||||
return error;
|
||||
|
||||
error = apldart_load_map(as, map);
|
||||
error = apldart_load_map(as, map, flags);
|
||||
if (error)
|
||||
sc->sc_dmat->_dmamap_unload(sc->sc_dmat, map);
|
||||
|
||||
|
@ -940,14 +995,25 @@ apldart_dmamap_load_raw(bus_dma_tag_t t, bus_dmamap_t map,
|
|||
{
|
||||
struct apldart_stream *as = t->_cookie;
|
||||
struct apldart_softc *sc = as->as_sc;
|
||||
int error;
|
||||
int i, error;
|
||||
|
||||
error = sc->sc_dmat->_dmamap_load_raw(sc->sc_dmat, map,
|
||||
segs, nsegs, size, flags);
|
||||
if (error)
|
||||
return error;
|
||||
if (flags & BUS_DMA_FIXED) {
|
||||
if (map->dm_nsegs != nsegs)
|
||||
return EINVAL;
|
||||
for (i = 0; i < nsegs; i++) {
|
||||
if (map->dm_segs[i].ds_len != segs[i].ds_len)
|
||||
return EINVAL;
|
||||
map->dm_segs[i]._ds_paddr = segs[i].ds_addr;
|
||||
map->dm_segs[i]._ds_vaddr = segs[i]._ds_vaddr;
|
||||
}
|
||||
} else {
|
||||
error = sc->sc_dmat->_dmamap_load_raw(sc->sc_dmat, map,
|
||||
segs, nsegs, size, flags);
|
||||
if (error)
|
||||
return error;
|
||||
}
|
||||
|
||||
error = apldart_load_map(as, map);
|
||||
error = apldart_load_map(as, map, flags);
|
||||
if (error)
|
||||
sc->sc_dmat->_dmamap_unload(sc->sc_dmat, map);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: apldc.c,v 1.11 2023/09/22 01:10:43 jsg Exp $ */
|
||||
/* $OpenBSD: apldc.c,v 1.12 2024/01/20 08:00:59 kettenis Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2022 Mark Kettenis <kettenis@openbsd.org>
|
||||
*
|
||||
|
@ -299,6 +299,12 @@ struct apldchidev_softc {
|
|||
uint8_t sc_mtdesc[APLDCHIDEV_DESC_MAX];
|
||||
size_t sc_mtdesclen;
|
||||
int sc_mt_ready;
|
||||
int sc_x_min;
|
||||
int sc_x_max;
|
||||
int sc_y_min;
|
||||
int sc_y_max;
|
||||
int sc_h_res;
|
||||
int sc_v_res;
|
||||
|
||||
struct apldchidev_gpio sc_gpio[APLDCHIDEV_NUM_GPIOS];
|
||||
u_int sc_ngpios;
|
||||
|
@ -307,6 +313,8 @@ struct apldchidev_softc {
|
|||
|
||||
uint8_t sc_cmd_iface;
|
||||
uint8_t sc_cmd_seq;
|
||||
uint8_t sc_data[APLDCHIDEV_DESC_MAX];
|
||||
size_t sc_data_len;
|
||||
uint32_t sc_retcode;
|
||||
int sc_busy;
|
||||
};
|
||||
|
@ -555,10 +563,20 @@ struct mtp_gpio_ack {
|
|||
uint8_t cmd[512];
|
||||
} __packed;
|
||||
|
||||
struct mtp_dim {
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
int16_t x_min;
|
||||
int16_t y_min;
|
||||
int16_t x_max;
|
||||
int16_t y_max;
|
||||
};
|
||||
|
||||
#define MTP_CMD_RESET_INTERFACE 0x40
|
||||
#define MTP_CMD_SEND_FIRMWARE 0x95
|
||||
#define MTP_CMD_ENABLE_INTERFACE 0xb4
|
||||
#define MTP_CMD_ACK_GPIO_CMD 0xa1
|
||||
#define MTP_CMD_GET_DIMENSIONS 0xd9
|
||||
|
||||
void
|
||||
apldchidev_handle_gpio_req(struct apldchidev_softc *sc, uint8_t iface,
|
||||
|
@ -770,6 +788,13 @@ apldchidev_rx_intr(void *arg)
|
|||
printf("%s: got ack with unexpected seq\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
}
|
||||
if (MTP_REQ(shdr->flags) == MTP_REQ_GET_REPORT &&
|
||||
shdr->len <= sizeof(sc->sc_data)) {
|
||||
memcpy(sc->sc_data, (shdr + 1), shdr->len);
|
||||
sc->sc_data_len = shdr->len;
|
||||
} else {
|
||||
sc->sc_data_len = 0;
|
||||
}
|
||||
sc->sc_retcode = shdr->retcode;
|
||||
sc->sc_busy = 0;
|
||||
wakeup(sc);
|
||||
|
@ -1021,6 +1046,30 @@ apldchidev_load_firmware(struct apldchidev_softc *sc, const char *name)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
apldchidev_get_dimensions(struct apldchidev_softc *sc)
|
||||
{
|
||||
uint8_t cmd[1] = { MTP_CMD_GET_DIMENSIONS };
|
||||
struct mtp_dim dim;
|
||||
uint8_t flags;
|
||||
|
||||
flags = MTP_GROUP_CMD << MTP_GROUP_SHIFT;
|
||||
flags |= MTP_REQ_GET_REPORT << MTP_REQ_SHIFT;
|
||||
apldchidev_cmd(sc, sc->sc_iface_mt, flags, cmd, sizeof(cmd));
|
||||
apldchidev_wait(sc);
|
||||
|
||||
if (sc->sc_retcode == 0 && sc->sc_data_len == sizeof(dim) + 1 &&
|
||||
sc->sc_data[0] == MTP_CMD_GET_DIMENSIONS) {
|
||||
memcpy(&dim, &sc->sc_data[1], sizeof(dim));
|
||||
sc->sc_x_min = dim.x_min;
|
||||
sc->sc_x_max = dim.x_max;
|
||||
sc->sc_y_min = dim.y_min;
|
||||
sc->sc_y_max = dim.y_max;
|
||||
sc->sc_h_res = (100 * (dim.x_max - dim.x_min)) / dim.width;
|
||||
sc->sc_v_res = (100 * (dim.y_max - dim.y_min)) / dim.height;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
apldchidev_attachhook(struct device *self)
|
||||
{
|
||||
|
@ -1059,6 +1108,8 @@ apldchidev_attachhook(struct device *self)
|
|||
if (error)
|
||||
goto out;
|
||||
|
||||
apldchidev_get_dimensions(sc);
|
||||
|
||||
aa.aa_name = "multi-touch";
|
||||
aa.aa_desc = sc->sc_mtdesc;
|
||||
aa.aa_desclen = sc->sc_mtdesclen;
|
||||
|
@ -1277,17 +1328,18 @@ struct ubcmtp_finger {
|
|||
#define DEFAULT_PRESSURE 40
|
||||
|
||||
struct apldcms_softc {
|
||||
struct device sc_dev;
|
||||
struct device *sc_wsmousedev;
|
||||
struct device sc_dev;
|
||||
struct apldchidev_softc *sc_hidev;
|
||||
struct device *sc_wsmousedev;
|
||||
|
||||
int sc_enabled;
|
||||
int sc_enabled;
|
||||
|
||||
int tp_offset;
|
||||
int tp_fingerpad;
|
||||
int tp_offset;
|
||||
int tp_fingerpad;
|
||||
|
||||
struct mtpoint frame[UBCMTP_MAX_FINGERS];
|
||||
int contacts;
|
||||
int btn;
|
||||
struct mtpoint frame[UBCMTP_MAX_FINGERS];
|
||||
int contacts;
|
||||
int btn;
|
||||
};
|
||||
|
||||
int apldcms_enable(void *);
|
||||
|
@ -1331,6 +1383,8 @@ apldcms_attach(struct device *parent, struct device *self, void *aux)
|
|||
struct apldcms_softc *sc = (struct apldcms_softc *)self;
|
||||
struct wsmousedev_attach_args aa;
|
||||
|
||||
sc->sc_hidev = (struct apldchidev_softc *)parent;
|
||||
|
||||
printf("\n");
|
||||
|
||||
sc->tp_offset = UBCMTP_TYPE4_TPOFF;
|
||||
|
@ -1349,13 +1403,14 @@ apldcms_configure(struct apldcms_softc *sc)
|
|||
{
|
||||
struct wsmousehw *hw = wsmouse_get_hw(sc->sc_wsmousedev);
|
||||
|
||||
/* The values below are for the MacBookPro17,1 */
|
||||
hw->type = WSMOUSE_TYPE_TOUCHPAD;
|
||||
hw->hw_type = WSMOUSEHW_CLICKPAD;
|
||||
hw->x_min = -6046;
|
||||
hw->x_max = 6536;
|
||||
hw->y_min = -164;
|
||||
hw->y_max = 7439;
|
||||
hw->x_min = sc->sc_hidev->sc_x_min;
|
||||
hw->x_max = sc->sc_hidev->sc_x_max;
|
||||
hw->y_min = sc->sc_hidev->sc_y_min;
|
||||
hw->y_max = sc->sc_hidev->sc_y_max;
|
||||
hw->h_res = sc->sc_hidev->sc_h_res;
|
||||
hw->v_res = sc->sc_hidev->sc_v_res;
|
||||
hw->mt_slots = UBCMTP_MAX_FINGERS;
|
||||
hw->flags = WSMOUSEHW_MT_TRACKING;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: bus.h,v 1.9 2023/01/21 10:30:11 kettenis Exp $ */
|
||||
/* $OpenBSD: bus.h,v 1.10 2024/01/20 11:22:46 kettenis Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2003-2004 Opsycon AB Sweden. All rights reserved.
|
||||
*
|
||||
|
@ -335,6 +335,7 @@ bus_space_barrier(bus_space_tag_t t, bus_space_handle_t h, bus_size_t offset,
|
|||
#define BUS_DMA_ZERO 0x0800 /* zero memory in dmamem_alloc */
|
||||
#define BUS_DMA_NOCACHE 0x1000
|
||||
#define BUS_DMA_64BIT 0x2000 /* device handles 64bit dva */
|
||||
#define BUS_DMA_FIXED 0x4000 /* place mapping at specified dva */
|
||||
|
||||
/* Forwards needed by prototypes below. */
|
||||
struct mbuf;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: acct.h,v 1.14 2023/12/11 00:39:43 deraadt Exp $ */
|
||||
/* $OpenBSD: acct.h,v 1.15 2024/01/20 12:16:55 deraadt Exp $ */
|
||||
/* $NetBSD: acct.h,v 1.16 1995/03/26 20:23:52 jtc Exp $ */
|
||||
|
||||
/*-
|
||||
|
@ -66,7 +66,6 @@ struct acct {
|
|||
#define APLEDGE 0x00000020 /* killed due to pledge violation */
|
||||
#define ATRAP 0x00000040 /* memory access violation */
|
||||
#define AUNVEIL 0x00000080 /* unveil access violation */
|
||||
#define AEXECVE 0x00000100 /* execve from wrong libc stub */
|
||||
#define APINSYS 0x00000200 /* syscall pin violation */
|
||||
u_int32_t ac_flag; /* accounting flags */
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: uvm_map.c,v 1.320 2024/01/16 19:05:01 deraadt Exp $ */
|
||||
/* $OpenBSD: uvm_map.c,v 1.323 2024/01/21 00:26:14 deraadt Exp $ */
|
||||
/* $NetBSD: uvm_map.c,v 1.86 2000/11/27 08:40:03 chs Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -3144,13 +3144,15 @@ uvm_map_protect(struct vm_map *map, vaddr_t start, vaddr_t end,
|
|||
if (iter->start == iter->end || UVM_ET_ISHOLE(iter))
|
||||
continue;
|
||||
|
||||
if (checkimmutable &&
|
||||
(iter->etype & UVM_ET_IMMUTABLE)) {
|
||||
if (checkimmutable && (iter->etype & UVM_ET_IMMUTABLE)) {
|
||||
#ifdef SMALL_KERNEL
|
||||
if (iter->protection == (PROT_READ | PROT_WRITE) &&
|
||||
new_prot == PROT_READ) {
|
||||
/* Permit RW to R as a data-locking mechanism */
|
||||
;
|
||||
} else {
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
error = EPERM;
|
||||
goto out;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue