sync with OpenBSD -current
This commit is contained in:
parent
18e54d401d
commit
9394581c89
58 changed files with 711 additions and 763 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: eephy.c,v 1.63 2023/12/28 14:03:21 uwe Exp $ */
|
||||
/* $OpenBSD: eephy.c,v 1.64 2024/01/23 11:51:53 uwe Exp $ */
|
||||
/*
|
||||
* Principal Author: Parag Patel
|
||||
* Copyright (c) 2001
|
||||
|
@ -270,6 +270,7 @@ eephy_reset(struct mii_softc *sc)
|
|||
case MII_MODEL_MARVELL_E1011:
|
||||
case MII_MODEL_MARVELL_E1111:
|
||||
case MII_MODEL_MARVELL_E1112:
|
||||
case MII_MODEL_MARVELL_E1512:
|
||||
case MII_MODEL_MARVELL_PHYG65G:
|
||||
reg &= ~E1000_SCR_EN_DETECT_MASK;
|
||||
break;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only OR MIT
|
||||
/* Copyright 2022 Sven Peter <sven@svenpeter.dev> */
|
||||
|
||||
#include <linux/bitfield.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/workqueue.h>
|
||||
|
@ -136,7 +137,7 @@ static void afk_init_rxtx(struct apple_dcp_afkep *ep, u64 message,
|
|||
u32 bufsz, end;
|
||||
|
||||
if (tag != ep->bfr_tag) {
|
||||
dev_err(ep->dcp->dev, "AFK[ep:%02x]: expected tag 0x%x but got 0x%x",
|
||||
dev_err(ep->dcp->dev, "AFK[ep:%02x]: expected tag 0x%x but got 0x%x\n",
|
||||
ep->endpoint, ep->bfr_tag, tag);
|
||||
return;
|
||||
}
|
||||
|
@ -149,7 +150,7 @@ static void afk_init_rxtx(struct apple_dcp_afkep *ep, u64 message,
|
|||
|
||||
if (base >= ep->bfr_size) {
|
||||
dev_err(ep->dcp->dev,
|
||||
"AFK[ep:%02x]: requested base 0x%x >= max size 0x%lx",
|
||||
"AFK[ep:%02x]: requested base 0x%x >= max size 0x%lx\n",
|
||||
ep->endpoint, base, ep->bfr_size);
|
||||
return;
|
||||
}
|
||||
|
@ -157,7 +158,7 @@ static void afk_init_rxtx(struct apple_dcp_afkep *ep, u64 message,
|
|||
end = base + size;
|
||||
if (end > ep->bfr_size) {
|
||||
dev_err(ep->dcp->dev,
|
||||
"AFK[ep:%02x]: requested end 0x%x > max size 0x%lx",
|
||||
"AFK[ep:%02x]: requested end 0x%x > max size 0x%lx\n",
|
||||
ep->endpoint, end, ep->bfr_size);
|
||||
return;
|
||||
}
|
||||
|
@ -166,7 +167,7 @@ static void afk_init_rxtx(struct apple_dcp_afkep *ep, u64 message,
|
|||
bufsz = le32_to_cpu(bfr->hdr->bufsz);
|
||||
if (bufsz + sizeof(*bfr->hdr) != size) {
|
||||
dev_err(ep->dcp->dev,
|
||||
"AFK[ep:%02x]: ring buffer size 0x%x != expected 0x%lx",
|
||||
"AFK[ep:%02x]: ring buffer size 0x%x != expected 0x%lx\n",
|
||||
ep->endpoint, bufsz, sizeof(*bfr->hdr));
|
||||
return;
|
||||
}
|
||||
|
@ -236,7 +237,7 @@ static void afk_recv_handle_init(struct apple_dcp_afkep *ep, u32 channel,
|
|||
return;
|
||||
}
|
||||
|
||||
strlcpy(name, payload, sizeof(name));
|
||||
strscpy(name, payload, sizeof(name));
|
||||
|
||||
/*
|
||||
* in DCP firmware 13.2 DCP reports interface-name as name which starts
|
||||
|
|
|
@ -195,9 +195,7 @@ static void apple_crtc_atomic_enable(struct drm_crtc *crtc,
|
|||
|
||||
if (crtc_state->active_changed && crtc_state->active) {
|
||||
struct apple_crtc *apple_crtc = to_apple_crtc(crtc);
|
||||
dev_dbg(&apple_crtc->dcp->dev, "%s", __func__);
|
||||
dcp_poweron(apple_crtc->dcp);
|
||||
dev_dbg(&apple_crtc->dcp->dev, "%s finished", __func__);
|
||||
}
|
||||
|
||||
if (crtc_state->active)
|
||||
|
@ -212,9 +210,7 @@ static void apple_crtc_atomic_disable(struct drm_crtc *crtc,
|
|||
|
||||
if (crtc_state->active_changed && !crtc_state->active) {
|
||||
struct apple_crtc *apple_crtc = to_apple_crtc(crtc);
|
||||
dev_dbg(&apple_crtc->dcp->dev, "%s", __func__);
|
||||
dcp_poweroff(apple_crtc->dcp);
|
||||
dev_dbg(&apple_crtc->dcp->dev, "%s finished", __func__);
|
||||
}
|
||||
|
||||
if (crtc->state->event && !crtc->state->active) {
|
||||
|
@ -459,7 +455,7 @@ static int apple_drm_init_dcp(struct device *dev)
|
|||
ret = dcp_wait_ready(dcp[i], wait);
|
||||
/* There is nothing we can do if a dcp/dcpext does not boot
|
||||
* (successfully). Ignoring it should not do any harm now.
|
||||
* Needs to reevaluated whenn adding dcpext support.
|
||||
* Needs to reevaluated when adding dcpext support.
|
||||
*/
|
||||
if (ret)
|
||||
dev_warn(dev, "DCP[%d] not ready: %d\n", i, ret);
|
||||
|
|
|
@ -95,7 +95,7 @@ struct dcp_panel {
|
|||
int width_mm;
|
||||
/// panel height in millimeter
|
||||
int height_mm;
|
||||
/// panel has a mini-LED backllight
|
||||
/// panel has a mini-LED backlight
|
||||
bool has_mini_led;
|
||||
};
|
||||
|
||||
|
@ -212,6 +212,8 @@ struct apple_dcp {
|
|||
/* Workqueue for updating the initial initial brightness */
|
||||
struct work_struct bl_register_wq;
|
||||
struct rwlock bl_register_mutex;
|
||||
/* Workqueue for updating the brightness */
|
||||
struct work_struct bl_update_wq;
|
||||
|
||||
/* integrated panel if present */
|
||||
struct dcp_panel panel;
|
||||
|
@ -241,6 +243,7 @@ struct apple_dcp {
|
|||
};
|
||||
|
||||
int dcp_backlight_register(struct apple_dcp *dcp);
|
||||
int dcp_backlight_update(struct apple_dcp *dcp);
|
||||
bool dcp_has_panel(struct apple_dcp *dcp);
|
||||
|
||||
#define DCP_AUDIO_MAX_CHANS 15
|
||||
|
|
|
@ -129,7 +129,7 @@ static void dcp_recv_msg(void *cookie, u8 endpoint, u64 message)
|
|||
afk_receive_message(dcp->dptxep, message);
|
||||
return;
|
||||
default:
|
||||
WARN(endpoint, "unknown DCP endpoint %hhu", endpoint);
|
||||
WARN(endpoint, "unknown DCP endpoint %hhu\n", endpoint);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ static void dcp_rtk_crashed(void *cookie)
|
|||
struct apple_dcp *dcp = cookie;
|
||||
|
||||
dcp->crashed = true;
|
||||
dev_err(dcp->dev, "DCP has crashed");
|
||||
dev_err(dcp->dev, "DCP has crashed\n");
|
||||
if (dcp->connector) {
|
||||
dcp->connector->connected = 0;
|
||||
schedule_work(&dcp->connector->hotplug_wq);
|
||||
|
@ -170,7 +170,7 @@ static int dcp_rtk_shmem_setup(void *cookie, struct apple_rtkit_shmem *bfr)
|
|||
|
||||
bfr->is_mapped = true;
|
||||
dev_info(dcp->dev,
|
||||
"shmem_setup: iova: %lx -> pa: %lx -> iomem: %lx",
|
||||
"shmem_setup: iova: %lx -> pa: %lx -> iomem: %lx\n",
|
||||
(uintptr_t)bfr->iova, (uintptr_t)phy_addr,
|
||||
(uintptr_t)bfr->buffer);
|
||||
} else {
|
||||
|
@ -179,7 +179,7 @@ static int dcp_rtk_shmem_setup(void *cookie, struct apple_rtkit_shmem *bfr)
|
|||
if (!bfr->buffer)
|
||||
return -ENOMEM;
|
||||
|
||||
dev_info(dcp->dev, "shmem_setup: iova: %lx, buffer: %lx",
|
||||
dev_info(dcp->dev, "shmem_setup: iova: %lx, buffer: %lx\n",
|
||||
(uintptr_t)bfr->iova, (uintptr_t)bfr->buffer);
|
||||
}
|
||||
|
||||
|
@ -227,7 +227,7 @@ int dcp_crtc_atomic_check(struct drm_crtc *crtc, struct drm_atomic_state *state)
|
|||
|
||||
needs_modeset = drm_atomic_crtc_needs_modeset(crtc_state) || !dcp->valid_mode;
|
||||
if (!needs_modeset && !dcp->connector->connected) {
|
||||
dev_err(dcp->dev, "crtc_atomic_check: disconnected but no modeset");
|
||||
dev_err(dcp->dev, "crtc_atomic_check: disconnected but no modeset\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -240,7 +240,7 @@ int dcp_crtc_atomic_check(struct drm_crtc *crtc, struct drm_atomic_state *state)
|
|||
}
|
||||
|
||||
if (plane_count > DCP_MAX_PLANES) {
|
||||
dev_err(dcp->dev, "crtc_atomic_check: Blend supports only 2 layers!");
|
||||
dev_err(dcp->dev, "crtc_atomic_check: Blend supports only 2 layers!\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -356,17 +356,17 @@ int dcp_start(struct platform_device *pdev)
|
|||
/* start RTKit endpoints */
|
||||
ret = systemep_init(dcp);
|
||||
if (ret)
|
||||
dev_warn(dcp->dev, "Failed to start system endpoint: %d", ret);
|
||||
dev_warn(dcp->dev, "Failed to start system endpoint: %d\n", ret);
|
||||
|
||||
if (dcp->phy && dcp->fw_compat >= DCP_FIRMWARE_V_13_5) {
|
||||
ret = ibootep_init(dcp);
|
||||
if (ret)
|
||||
dev_warn(dcp->dev, "Failed to start IBOOT endpoint: %d",
|
||||
dev_warn(dcp->dev, "Failed to start IBOOT endpoint: %d\n",
|
||||
ret);
|
||||
|
||||
ret = dptxep_init(dcp);
|
||||
if (ret)
|
||||
dev_warn(dcp->dev, "Failed to start DPTX endpoint: %d",
|
||||
dev_warn(dcp->dev, "Failed to start DPTX endpoint: %d\n",
|
||||
ret);
|
||||
else if (dcp->dptxport[0].enabled) {
|
||||
bool connected;
|
||||
|
@ -389,7 +389,7 @@ int dcp_start(struct platform_device *pdev)
|
|||
|
||||
ret = iomfb_start_rtkit(dcp);
|
||||
if (ret)
|
||||
dev_err(dcp->dev, "Failed to start IOMFB endpoint: %d", ret);
|
||||
dev_err(dcp->dev, "Failed to start IOMFB endpoint: %d\n", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -516,6 +516,15 @@ out_unlock:
|
|||
mutex_unlock(&dcp->bl_register_mutex);
|
||||
}
|
||||
|
||||
static void dcp_work_update_backlight(struct work_struct *work)
|
||||
{
|
||||
struct apple_dcp *dcp;
|
||||
|
||||
dcp = container_of(work, struct apple_dcp, bl_update_wq);
|
||||
|
||||
dcp_backlight_update(dcp);
|
||||
}
|
||||
|
||||
static int dcp_create_piodma_iommu_dev(struct apple_dcp *dcp)
|
||||
{
|
||||
int ret;
|
||||
|
@ -809,7 +818,7 @@ static int dcp_comp_bind(struct device *dev, struct device *main, void *data)
|
|||
if (dcp->notch_height > 0)
|
||||
dev_info(dev, "Detected display with notch of %u pixel\n", dcp->notch_height);
|
||||
|
||||
/* intialize brightness scale to a sensible default to avoid divide by 0*/
|
||||
/* initialize brightness scale to a sensible default to avoid divide by 0*/
|
||||
dcp->brightness.scale = 65536;
|
||||
panel_np = of_get_compatible_child(dev->of_node, "apple,panel-mini-led");
|
||||
if (panel_np)
|
||||
|
@ -836,6 +845,7 @@ static int dcp_comp_bind(struct device *dev, struct device *main, void *data)
|
|||
dcp->connector_type = DRM_MODE_CONNECTOR_eDP;
|
||||
INIT_WORK(&dcp->bl_register_wq, dcp_work_register_backlight);
|
||||
rw_init(&dcp->bl_register_mutex, "dcpbl");
|
||||
INIT_WORK(&dcp->bl_update_wq, dcp_work_update_backlight);
|
||||
} else if (of_property_match_string(dev->of_node, "apple,connector-type", "HDMI-A") >= 0)
|
||||
dcp->connector_type = DRM_MODE_CONNECTOR_HDMIA;
|
||||
else if (of_property_match_string(dev->of_node, "apple,connector-type", "DP") >= 0)
|
||||
|
@ -878,12 +888,12 @@ static int dcp_comp_bind(struct device *dev, struct device *main, void *data)
|
|||
dcp->rtk = devm_apple_rtkit_init(dev, dcp, "mbox", 0, &rtkit_ops);
|
||||
if (IS_ERR(dcp->rtk))
|
||||
return dev_err_probe(dev, PTR_ERR(dcp->rtk),
|
||||
"Failed to intialize RTKit");
|
||||
"Failed to initialize RTKit\n");
|
||||
|
||||
ret = apple_rtkit_wake(dcp->rtk);
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret,
|
||||
"Failed to boot RTKit: %d", ret);
|
||||
"Failed to boot RTKit: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -951,7 +961,7 @@ static int dcp_platform_probe(struct platform_device *pdev)
|
|||
|
||||
dcp->phy = devm_phy_optional_get(dev, "dp-phy");
|
||||
if (IS_ERR(dcp->phy)) {
|
||||
dev_err(dev, "Failed to get dp-phy: %ld", PTR_ERR(dcp->phy));
|
||||
dev_err(dev, "Failed to get dp-phy: %ld\n", PTR_ERR(dcp->phy));
|
||||
return PTR_ERR(dcp->phy);
|
||||
}
|
||||
if (dcp->phy) {
|
||||
|
@ -978,7 +988,7 @@ static int dcp_platform_probe(struct platform_device *pdev)
|
|||
IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
|
||||
"dp2hdmi-hpd-irq", dcp);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "failed to request HDMI hpd irq %d: %d",
|
||||
dev_err(dev, "failed to request HDMI hpd irq %d: %d\n",
|
||||
irq, ret);
|
||||
return ret;
|
||||
}
|
||||
|
@ -1001,7 +1011,7 @@ static int dcp_platform_probe(struct platform_device *pdev)
|
|||
if (!ret) {
|
||||
dcp->xbar = devm_mux_control_get(dev, "dp-xbar");
|
||||
if (IS_ERR(dcp->xbar)) {
|
||||
dev_err(dev, "Failed to get dp-xbar: %ld", PTR_ERR(dcp->xbar));
|
||||
dev_err(dev, "Failed to get dp-xbar: %ld\n", PTR_ERR(dcp->xbar));
|
||||
return PTR_ERR(dcp->xbar);
|
||||
}
|
||||
ret = mux_control_select(dcp->xbar, mux_index);
|
||||
|
|
|
@ -99,7 +99,7 @@ static u32 interpolate(int val, int min, int max, u32 *tbl, size_t tbl_size)
|
|||
|
||||
size_t index = interpolated / SCALE_FACTOR;
|
||||
|
||||
if (WARN(index + 1 >= tbl_size, "invalid index %zu for brightness %u", index, val))
|
||||
if (WARN(index + 1 >= tbl_size, "invalid index %zu for brightness %u\n", index, val))
|
||||
return tbl[tbl_size / 2];
|
||||
|
||||
frac = interpolated & (SCALE_FACTOR - 1);
|
||||
|
@ -172,20 +172,8 @@ done:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int dcp_set_brightness(struct backlight_device *bd)
|
||||
int dcp_backlight_update(struct apple_dcp *dcp)
|
||||
{
|
||||
int ret = 0;
|
||||
struct apple_dcp *dcp = bl_get_data(bd);
|
||||
struct drm_modeset_acquire_ctx ctx;
|
||||
int brightness = backlight_get_brightness(bd);
|
||||
|
||||
DRM_MODESET_LOCK_ALL_BEGIN(dcp->crtc->base.dev, ctx, 0, ret);
|
||||
|
||||
dcp->brightness.dac = calculate_dac(dcp, brightness);
|
||||
dcp->brightness.update = true;
|
||||
|
||||
DRM_MODESET_LOCK_ALL_END(dcp->crtc->base.dev, ctx, ret);
|
||||
|
||||
/*
|
||||
* Do not actively try to change brightness if no mode is set.
|
||||
* TODO: should this be reflected the in backlight's power property?
|
||||
|
@ -202,6 +190,23 @@ static int dcp_set_brightness(struct backlight_device *bd)
|
|||
return drm_crtc_set_brightness(dcp);
|
||||
}
|
||||
|
||||
static int dcp_set_brightness(struct backlight_device *bd)
|
||||
{
|
||||
int ret = 0;
|
||||
struct apple_dcp *dcp = bl_get_data(bd);
|
||||
struct drm_modeset_acquire_ctx ctx;
|
||||
int brightness = backlight_get_brightness(bd);
|
||||
|
||||
DRM_MODESET_LOCK_ALL_BEGIN(dcp->crtc->base.dev, ctx, 0, ret);
|
||||
|
||||
dcp->brightness.dac = calculate_dac(dcp, brightness);
|
||||
dcp->brightness.update = true;
|
||||
|
||||
DRM_MODESET_LOCK_ALL_END(dcp->crtc->base.dev, ctx, ret);
|
||||
|
||||
return dcp_backlight_update(dcp);
|
||||
}
|
||||
|
||||
static const struct backlight_ops dcp_backlight_ops = {
|
||||
.options = BL_CORE_SUSPENDRESUME,
|
||||
.get_brightness = dcp_get_brightness,
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
/* Copyright 2021 Alyssa Rosenzweig <alyssa@rosenzweig.io> */
|
||||
|
||||
#include <linux/align.h>
|
||||
#include <linux/bitfield.h>
|
||||
#include <linux/bitmap.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/completion.h>
|
||||
|
@ -273,7 +274,7 @@ static void dcpep_handle_cb(struct apple_dcp *dcp, enum dcp_context_id context,
|
|||
out = in + hdr->in_len;
|
||||
|
||||
// TODO: verify that in_len and out_len match our prototypes
|
||||
// for now just clear the out data to have at least consistant results
|
||||
// for now just clear the out data to have at least consistent results
|
||||
if (hdr->out_len)
|
||||
memset(out, 0, hdr->out_len);
|
||||
|
||||
|
@ -325,7 +326,7 @@ static void dcpep_got_msg(struct apple_dcp *dcp, u64 message)
|
|||
channel_offset = dcp_channel_offset(ctx_id);
|
||||
|
||||
if (channel_offset < 0) {
|
||||
dev_warn(dcp->dev, "invalid context received %u", ctx_id);
|
||||
dev_warn(dcp->dev, "invalid context received %u\n", ctx_id);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -481,7 +482,7 @@ void dcp_flush(struct drm_crtc *crtc, struct drm_atomic_state *state)
|
|||
|
||||
if (dcp_channel_busy(&dcp->ch_cmd))
|
||||
{
|
||||
dev_err(dcp->dev, "unexpected busy command channel");
|
||||
dev_err(dcp->dev, "unexpected busy command channel\n");
|
||||
/* HACK: issue a delayed vblank event to avoid timeouts in
|
||||
* drm_atomic_helper_wait_for_vblanks().
|
||||
*/
|
||||
|
|
|
@ -299,7 +299,7 @@ static void dcpep_cb_unmap_piodma(struct apple_dcp *dcp,
|
|||
struct dcp_mem_descriptor *memdesc;
|
||||
|
||||
if (resp->buffer >= ARRAY_SIZE(dcp->memdesc)) {
|
||||
dev_warn(dcp->dev, "unmap request for out of range buffer %llu",
|
||||
dev_warn(dcp->dev, "unmap request for out of range buffer %llu\n",
|
||||
resp->buffer);
|
||||
return;
|
||||
}
|
||||
|
@ -308,14 +308,14 @@ static void dcpep_cb_unmap_piodma(struct apple_dcp *dcp,
|
|||
|
||||
if (!memdesc->buf) {
|
||||
dev_warn(dcp->dev,
|
||||
"unmap for non-mapped buffer %llu iova:0x%08llx",
|
||||
"unmap for non-mapped buffer %llu iova:0x%08llx\n",
|
||||
resp->buffer, resp->dva);
|
||||
return;
|
||||
}
|
||||
|
||||
if (memdesc->dva != resp->dva) {
|
||||
dev_warn(dcp->dev, "unmap buffer %llu address mismatch "
|
||||
"memdesc.dva:%llx dva:%llx", resp->buffer,
|
||||
"memdesc.dva:%llx dva:%llx\n", resp->buffer,
|
||||
memdesc->dva, resp->dva);
|
||||
return;
|
||||
}
|
||||
|
@ -326,7 +326,7 @@ static void dcpep_cb_unmap_piodma(struct apple_dcp *dcp,
|
|||
|
||||
/*
|
||||
* Allocate an IOVA contiguous buffer mapped to the DCP. The buffer need not be
|
||||
* physically contigiuous, however we should save the sgtable in case the
|
||||
* physically contiguous, however we should save the sgtable in case the
|
||||
* buffer needs to be later mapped for PIODMA.
|
||||
*/
|
||||
static struct dcp_allocate_buffer_resp
|
||||
|
@ -343,7 +343,7 @@ dcpep_cb_allocate_buffer(struct apple_dcp *dcp,
|
|||
find_first_zero_bit(dcp->memdesc_map, DCP_MAX_MAPPINGS);
|
||||
|
||||
if (resp.mem_desc_id >= DCP_MAX_MAPPINGS) {
|
||||
dev_warn(dcp->dev, "DCP overflowed mapping table, ignoring");
|
||||
dev_warn(dcp->dev, "DCP overflowed mapping table, ignoring\n");
|
||||
resp.dva_size = 0;
|
||||
resp.mem_desc_id = 0;
|
||||
return resp;
|
||||
|
@ -378,7 +378,7 @@ static u8 dcpep_cb_release_mem_desc(struct apple_dcp *dcp, u32 *mem_desc_id)
|
|||
}
|
||||
|
||||
if (!test_and_clear_bit(id, dcp->memdesc_map)) {
|
||||
dev_warn(dcp->dev, "unmap request for unused mem_desc_id %u",
|
||||
dev_warn(dcp->dev, "unmap request for unused mem_desc_id %u\n",
|
||||
id);
|
||||
return 0;
|
||||
}
|
||||
|
@ -428,7 +428,7 @@ dcpep_cb_map_physical(struct apple_dcp *dcp, struct dcp_map_physical_req *req)
|
|||
u32 id;
|
||||
|
||||
if (!is_disp_register(dcp, req->paddr, req->paddr + size - 1)) {
|
||||
dev_err(dcp->dev, "refusing to map phys address %llx size %llx",
|
||||
dev_err(dcp->dev, "refusing to map phys address %llx size %llx\n",
|
||||
req->paddr, req->size);
|
||||
return (struct dcp_map_physical_resp){};
|
||||
}
|
||||
|
@ -457,7 +457,7 @@ static struct DCP_FW_NAME(dcp_map_reg_resp) dcpep_cb_map_reg(struct apple_dcp *d
|
|||
struct DCP_FW_NAME(dcp_map_reg_req) *req)
|
||||
{
|
||||
if (req->index >= dcp->nr_disp_registers) {
|
||||
dev_warn(dcp->dev, "attempted to read invalid reg index %u",
|
||||
dev_warn(dcp->dev, "attempted to read invalid reg index %u\n",
|
||||
req->index);
|
||||
|
||||
return (struct DCP_FW_NAME(dcp_map_reg_resp)){ .ret = 1 };
|
||||
|
@ -497,6 +497,7 @@ static void iomfbep_cb_enable_backlight_message_ap_gated(struct apple_dcp *dcp,
|
|||
* syslog: "[BrightnessLCD.cpp:743][AFK]nitsToDBV: iDAC out of range"
|
||||
*/
|
||||
dcp->brightness.update = true;
|
||||
schedule_work(&dcp->bl_update_wq);
|
||||
}
|
||||
|
||||
/* Chunked data transfer for property dictionaries */
|
||||
|
@ -601,7 +602,7 @@ static void boot_done(struct apple_dcp *dcp, void *out, void *cookie)
|
|||
{
|
||||
struct dcp_channel *ch = &dcp->ch_cb;
|
||||
u8 *succ = ch->output[ch->depth - 1];
|
||||
dev_dbg(dcp->dev, "boot done");
|
||||
dev_dbg(dcp->dev, "boot done\n");
|
||||
|
||||
*succ = true;
|
||||
dcp_ack(dcp, DCP_CONTEXT_CB);
|
||||
|
@ -716,7 +717,6 @@ static void release_swap_cookie(struct kref *ref)
|
|||
static void dcp_swap_cleared(struct apple_dcp *dcp, void *data, void *cookie)
|
||||
{
|
||||
struct DCP_FW_NAME(dcp_swap_submit_resp) *resp = data;
|
||||
dev_dbg(dcp->dev, "%s", __func__);
|
||||
|
||||
if (cookie) {
|
||||
struct dcp_swap_cookie *info = cookie;
|
||||
|
@ -747,7 +747,6 @@ static void dcp_swap_clear_started(struct apple_dcp *dcp, void *data,
|
|||
void *cookie)
|
||||
{
|
||||
struct dcp_swap_start_resp *resp = data;
|
||||
dev_dbg(dcp->dev, "%s swap_id: %u", __func__, resp->swap_id);
|
||||
DCP_FW_UNION(dcp->swap).swap.swap_id = resp->swap_id;
|
||||
|
||||
if (cookie) {
|
||||
|
@ -761,7 +760,6 @@ static void dcp_swap_clear_started(struct apple_dcp *dcp, void *data,
|
|||
static void dcp_on_final(struct apple_dcp *dcp, void *out, void *cookie)
|
||||
{
|
||||
struct dcp_wait_cookie *wait = cookie;
|
||||
dev_dbg(dcp->dev, "%s", __func__);
|
||||
|
||||
if (wait) {
|
||||
complete(&wait->done);
|
||||
|
@ -774,7 +772,6 @@ static void dcp_on_set_power_state(struct apple_dcp *dcp, void *out, void *cooki
|
|||
struct dcp_set_power_state_req req = {
|
||||
.unklong = 1,
|
||||
};
|
||||
dev_dbg(dcp->dev, "%s", __func__);
|
||||
|
||||
dcp_set_power_state(dcp, false, &req, dcp_on_final, cookie);
|
||||
}
|
||||
|
@ -790,7 +787,6 @@ static void dcp_on_set_parameter(struct apple_dcp *dcp, void *out, void *cookie)
|
|||
.count = 1,
|
||||
#endif
|
||||
};
|
||||
dev_dbg(dcp->dev, "%s", __func__);
|
||||
|
||||
dcp_set_parameter_dcp(dcp, false, ¶m, dcp_on_set_power_state, cookie);
|
||||
}
|
||||
|
@ -802,8 +798,6 @@ void DCP_FW_NAME(iomfb_poweron)(struct apple_dcp *dcp)
|
|||
u32 handle;
|
||||
dev_err(dcp->dev, "dcp_poweron() starting\n");
|
||||
|
||||
dev_dbg(dcp->dev, "%s", __func__);
|
||||
|
||||
cookie = kzalloc(sizeof(*cookie), GFP_KERNEL);
|
||||
if (!cookie)
|
||||
return;
|
||||
|
@ -825,7 +819,7 @@ void DCP_FW_NAME(iomfb_poweron)(struct apple_dcp *dcp)
|
|||
ret = wait_for_completion_timeout(&cookie->done, msecs_to_jiffies(500));
|
||||
|
||||
if (ret == 0)
|
||||
dev_warn(dcp->dev, "wait for power timed out");
|
||||
dev_warn(dcp->dev, "wait for power timed out\n");
|
||||
|
||||
kref_put(&cookie->refcount, release_wait_cookie);;
|
||||
|
||||
|
@ -873,8 +867,6 @@ void DCP_FW_NAME(iomfb_poweroff)(struct apple_dcp *dcp)
|
|||
struct dcp_swap_start_req swap_req = { 0 };
|
||||
struct DCP_FW_NAME(dcp_swap_submit_req) *swap = &DCP_FW_UNION(dcp->swap);
|
||||
|
||||
dev_dbg(dcp->dev, "%s", __func__);
|
||||
|
||||
cookie = kzalloc(sizeof(*cookie), GFP_KERNEL);
|
||||
if (!cookie)
|
||||
return;
|
||||
|
@ -922,7 +914,7 @@ void DCP_FW_NAME(iomfb_poweroff)(struct apple_dcp *dcp)
|
|||
return;
|
||||
}
|
||||
|
||||
dev_dbg(dcp->dev, "%s: clear swap submitted: %u", __func__, swap_id);
|
||||
dev_dbg(dcp->dev, "%s: clear swap submitted: %u\n", __func__, swap_id);
|
||||
|
||||
poff_cookie = kzalloc(sizeof(*poff_cookie), GFP_KERNEL);
|
||||
if (!poff_cookie)
|
||||
|
@ -938,14 +930,13 @@ void DCP_FW_NAME(iomfb_poweroff)(struct apple_dcp *dcp)
|
|||
msecs_to_jiffies(1000));
|
||||
|
||||
if (ret == 0)
|
||||
dev_warn(dcp->dev, "setPowerState(0) timeout %u ms", 1000);
|
||||
dev_warn(dcp->dev, "setPowerState(0) timeout %u ms\n", 1000);
|
||||
else if (ret > 0)
|
||||
dev_dbg(dcp->dev,
|
||||
"setPowerState(0) finished with %d ms to spare",
|
||||
jiffies_to_msecs(ret));
|
||||
|
||||
kref_put(&poff_cookie->refcount, release_wait_cookie);
|
||||
dev_dbg(dcp->dev, "%s: setPowerState(0) done", __func__);
|
||||
|
||||
dev_err(dcp->dev, "dcp_poweroff() done\n");
|
||||
}
|
||||
|
@ -989,11 +980,9 @@ void DCP_FW_NAME(iomfb_sleep)(struct apple_dcp *dcp)
|
|||
msecs_to_jiffies(1000));
|
||||
|
||||
if (ret == 0)
|
||||
dev_warn(dcp->dev, "setDCPPower(0) timeout %u ms", 1000);
|
||||
dev_warn(dcp->dev, "setDCPPower(0) timeout %u ms\n", 1000);
|
||||
|
||||
kref_put(&cookie->refcount, release_wait_cookie);
|
||||
dev_dbg(dcp->dev, "%s: setDCPPower(0) done", __func__);
|
||||
|
||||
dev_err(dcp->dev, "dcp_sleep() done\n");
|
||||
}
|
||||
|
||||
|
@ -1162,7 +1151,6 @@ static void dcp_swap_started(struct apple_dcp *dcp, void *data, void *cookie)
|
|||
static void do_swap(struct apple_dcp *dcp, void *data, void *cookie)
|
||||
{
|
||||
struct dcp_swap_start_req start_req = { 0 };
|
||||
dev_dbg(dcp->dev, "%s", __func__);
|
||||
|
||||
if (dcp->connector && dcp->connector->connected)
|
||||
dcp_swap_start(dcp, false, &start_req, dcp_swap_started, NULL);
|
||||
|
@ -1174,7 +1162,6 @@ static void complete_set_digital_out_mode(struct apple_dcp *dcp, void *data,
|
|||
void *cookie)
|
||||
{
|
||||
struct dcp_wait_cookie *wait = cookie;
|
||||
dev_dbg(dcp->dev, "%s", __func__);
|
||||
|
||||
if (wait) {
|
||||
complete(&wait->done);
|
||||
|
@ -1241,7 +1228,6 @@ int DCP_FW_NAME(iomfb_modeset)(struct apple_dcp *dcp,
|
|||
* modesets. Add an extra 500ms to safe side that the modeset
|
||||
* call has returned.
|
||||
*/
|
||||
dev_dbg(dcp->dev, "%s - wait for modeset", __func__);
|
||||
ret = wait_for_completion_timeout(&cookie->done,
|
||||
msecs_to_jiffies(8500));
|
||||
|
||||
|
@ -1275,7 +1261,6 @@ void DCP_FW_NAME(iomfb_flush)(struct apple_dcp *dcp, struct drm_crtc *crtc, stru
|
|||
struct DCP_FW_NAME(dcp_swap_submit_req) *req = &DCP_FW_UNION(dcp->swap);
|
||||
int plane_idx, l;
|
||||
int has_surface = 0;
|
||||
dev_dbg(dcp->dev, "%s", __func__);
|
||||
|
||||
crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ static const iomfb_cb_handler cb_handlers[IOMFB_MAX_CB] = {
|
|||
[110] = trampoline_true, /* create_pmu_service */
|
||||
[111] = trampoline_true, /* create_iomfb_service */
|
||||
[112] = trampoline_create_backlight_service,
|
||||
[113] = trampoline_true, /* create_nvram_servce? */
|
||||
[113] = trampoline_true, /* create_nvram_service? */
|
||||
[114] = trampoline_get_tiling_state,
|
||||
[115] = trampoline_false, /* set_tiling_state */
|
||||
[120] = dcpep_cb_boot_1,
|
||||
|
|
|
@ -694,7 +694,7 @@ int parse_epic_service_init(struct dcp_parse_ctx *handle, const char **name,
|
|||
return ret;
|
||||
}
|
||||
|
||||
int parse_sample_rate_bit(struct dcp_parse_ctx *handle, unsigned int *ratebit)
|
||||
static int parse_sample_rate_bit(struct dcp_parse_ctx *handle, unsigned int *ratebit)
|
||||
{
|
||||
s64 rate;
|
||||
int ret = parse_int(handle, &rate);
|
||||
|
@ -715,7 +715,7 @@ int parse_sample_rate_bit(struct dcp_parse_ctx *handle, unsigned int *ratebit)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int parse_sample_fmtbit(struct dcp_parse_ctx *handle, u64 *fmtbit)
|
||||
static int parse_sample_fmtbit(struct dcp_parse_ctx *handle, u64 *fmtbit)
|
||||
{
|
||||
s64 sample_size;
|
||||
int ret = parse_int(handle, &sample_size);
|
||||
|
|
|
@ -5,7 +5,14 @@
|
|||
|
||||
#include <sys/param.h>
|
||||
|
||||
#define roundup2(x, y) (((x) + ((y) - 1)) & (~((__typeof(x))(y) - 1)))
|
||||
#define rounddown2(x, y) ((x) & ~((__typeof(x))(y) - 1))
|
||||
|
||||
#undef ALIGN
|
||||
#define ALIGN(x, y) roundup2((x), (y))
|
||||
|
||||
#define IS_ALIGNED(x, y) (((x) & ((y) - 1)) == 0)
|
||||
#define PTR_ALIGN(x, y) ((__typeof(x))roundup2((unsigned long)(x), (y)))
|
||||
#define ALIGN_DOWN(x, y) ((__typeof(x))rounddown2((unsigned long)(x), (y)))
|
||||
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
/* Public domain. */
|
||||
|
||||
#ifndef _LINUX_ARGS_H
|
||||
#define _LINUX_ARGS_H
|
||||
|
||||
#define CONCATENATE(x, y) __CONCAT(x, y)
|
||||
|
||||
#endif
|
|
@ -3,7 +3,6 @@
|
|||
#ifndef _LINUX_KERNEL_H
|
||||
#define _LINUX_KERNEL_H
|
||||
|
||||
#include <sys/stdint.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/stdarg.h>
|
||||
|
@ -19,24 +18,13 @@
|
|||
#include <linux/container_of.h>
|
||||
#include <linux/stddef.h>
|
||||
#include <linux/align.h>
|
||||
#include <linux/math.h>
|
||||
#include <linux/limits.h>
|
||||
#include <asm/byteorder.h>
|
||||
|
||||
#define swap(a, b) \
|
||||
do { __typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while(0)
|
||||
|
||||
#define offsetofend(s, e) (offsetof(s, e) + sizeof((((s *)0)->e)))
|
||||
|
||||
#define S8_MAX INT8_MAX
|
||||
#define S16_MAX INT16_MAX
|
||||
#define S32_MAX INT32_MAX
|
||||
#define S64_MAX INT64_MAX
|
||||
|
||||
#define U8_MAX UINT8_MAX
|
||||
#define U16_MAX UINT16_MAX
|
||||
#define U32_MAX UINT32_MAX
|
||||
#define U64_C(x) UINT64_C(x)
|
||||
#define U64_MAX UINT64_MAX
|
||||
|
||||
#define ARRAY_SIZE nitems
|
||||
|
||||
#define lower_32_bits(n) ((u32)(n))
|
||||
|
@ -65,24 +53,6 @@
|
|||
|
||||
#define min_not_zero(a, b) (a == 0) ? b : ((b == 0) ? a : min(a, b))
|
||||
|
||||
#define mult_frac(x, n, d) (((x) * (n)) / (d))
|
||||
|
||||
#define roundup2(x, y) (((x) + ((y) - 1)) & (~((__typeof(x))(y) - 1)))
|
||||
#define rounddown2(x, y) ((x) & ~((__typeof(x))(y) - 1))
|
||||
#define round_up(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
|
||||
#define round_down(x, y) (((x) / (y)) * (y)) /* y is power of two */
|
||||
#define rounddown(x, y) (((x) / (y)) * (y)) /* arbitrary y */
|
||||
#define DIV_ROUND_UP(x, y) (((x) + ((y) - 1)) / (y))
|
||||
#define DIV_ROUND_UP_ULL(x, y) DIV_ROUND_UP(x, y)
|
||||
#define DIV_ROUND_DOWN(x, y) ((x) / (y))
|
||||
#define DIV_ROUND_DOWN_ULL(x, y) DIV_ROUND_DOWN(x, y)
|
||||
#define DIV_ROUND_CLOSEST(x, y) (((x) + ((y) / 2)) / (y))
|
||||
#define DIV_ROUND_CLOSEST_ULL(x, y) DIV_ROUND_CLOSEST(x, y)
|
||||
|
||||
#define IS_ALIGNED(x, y) (((x) & ((y) - 1)) == 0)
|
||||
#define PTR_ALIGN(x, y) ((__typeof(x))roundup2((unsigned long)(x), (y)))
|
||||
#define ALIGN_DOWN(x, y) ((__typeof(x))rounddown2((unsigned long)(x), (y)))
|
||||
|
||||
static inline char *
|
||||
kvasprintf(int flags, const char *fmt, va_list ap)
|
||||
{
|
||||
|
@ -127,17 +97,6 @@ vscnprintf(char *buf, size_t size, const char *fmt, va_list ap)
|
|||
return nc;
|
||||
}
|
||||
|
||||
static inline int
|
||||
_in_dbg_master(void)
|
||||
{
|
||||
#ifdef DDB
|
||||
return (db_active);
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
#define oops_in_progress _in_dbg_master()
|
||||
|
||||
#define might_sleep() assertwaitok()
|
||||
#define might_sleep_if(x) do { \
|
||||
if (x) \
|
||||
|
@ -155,8 +114,6 @@ _in_dbg_master(void)
|
|||
|
||||
#define STUB() do { printf("%s: stub\n", __func__); } while(0)
|
||||
|
||||
#define CONCATENATE(x, y) __CONCAT(x, y)
|
||||
|
||||
#define PTR_IF(c, p) ((c) ? (p) : NULL)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
/* Public domain. */
|
||||
|
||||
#ifndef _LINUX_LIMITS_H
|
||||
#define _LINUX_LIMITS_H
|
||||
|
||||
#include <sys/stdint.h>
|
||||
|
||||
#define S8_MAX INT8_MAX
|
||||
#define S16_MAX INT16_MAX
|
||||
#define S32_MAX INT32_MAX
|
||||
#define S64_MAX INT64_MAX
|
||||
|
||||
#define U8_MAX UINT8_MAX
|
||||
#define U16_MAX UINT16_MAX
|
||||
#define U32_MAX UINT32_MAX
|
||||
#define U64_C(x) UINT64_C(x)
|
||||
#define U64_MAX UINT64_MAX
|
||||
|
||||
#endif
|
|
@ -3,4 +3,16 @@
|
|||
#ifndef _LINUX_MATH_H
|
||||
#define _LINUX_MATH_H
|
||||
|
||||
#define mult_frac(x, n, d) (((x) * (n)) / (d))
|
||||
|
||||
#define round_up(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
|
||||
#define round_down(x, y) (((x) / (y)) * (y)) /* y is power of two */
|
||||
#define rounddown(x, y) (((x) / (y)) * (y)) /* arbitrary y */
|
||||
#define DIV_ROUND_UP(x, y) (((x) + ((y) - 1)) / (y))
|
||||
#define DIV_ROUND_UP_ULL(x, y) DIV_ROUND_UP(x, y)
|
||||
#define DIV_ROUND_DOWN(x, y) ((x) / (y))
|
||||
#define DIV_ROUND_DOWN_ULL(x, y) DIV_ROUND_DOWN(x, y)
|
||||
#define DIV_ROUND_CLOSEST(x, y) (((x) + ((y) / 2)) / (y))
|
||||
#define DIV_ROUND_CLOSEST_ULL(x, y) DIV_ROUND_CLOSEST(x, y)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -69,4 +69,15 @@ struct va_format {
|
|||
va_list *va;
|
||||
};
|
||||
|
||||
static inline int
|
||||
_in_dbg_master(void)
|
||||
{
|
||||
#ifdef DDB
|
||||
return (db_active);
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
#define oops_in_progress _in_dbg_master()
|
||||
|
||||
#endif
|
||||
|
|
|
@ -6,4 +6,6 @@
|
|||
#define DECLARE_FLEX_ARRAY(t, n) \
|
||||
struct { struct{} n ## __unused; t n[]; }
|
||||
|
||||
#define offsetofend(s, e) (offsetof(s, e) + sizeof((((s *)0)->e)))
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: if_igc.c,v 1.14 2023/11/10 15:51:20 bluhm Exp $ */
|
||||
/* $OpenBSD: if_igc.c,v 1.15 2024/01/23 08:48:12 kevlo Exp $ */
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
|
@ -1523,16 +1523,16 @@ igc_media_change(struct ifnet *ifp)
|
|||
sc->hw.phy.autoneg_advertised = ADVERTISE_1000_FULL;
|
||||
break;
|
||||
case IFM_100_TX:
|
||||
if ((ifm->ifm_media & IFM_GMASK) == IFM_HDX)
|
||||
sc->hw.phy.autoneg_advertised = ADVERTISE_100_HALF;
|
||||
else
|
||||
if ((ifm->ifm_media & IFM_GMASK) == IFM_FDX)
|
||||
sc->hw.phy.autoneg_advertised = ADVERTISE_100_FULL;
|
||||
else
|
||||
sc->hw.phy.autoneg_advertised = ADVERTISE_100_HALF;
|
||||
break;
|
||||
case IFM_10_T:
|
||||
if ((ifm->ifm_media & IFM_GMASK) == IFM_HDX)
|
||||
sc->hw.phy.autoneg_advertised = ADVERTISE_10_HALF;
|
||||
else
|
||||
if ((ifm->ifm_media & IFM_GMASK) == IFM_FDX)
|
||||
sc->hw.phy.autoneg_advertised = ADVERTISE_10_FULL;
|
||||
else
|
||||
sc->hw.phy.autoneg_advertised = ADVERTISE_10_HALF;
|
||||
break;
|
||||
default:
|
||||
return EINVAL;
|
||||
|
@ -2179,6 +2179,8 @@ igc_setup_receive_ring(struct rx_ring *rxr)
|
|||
* Enable receive unit.
|
||||
*
|
||||
**********************************************************************/
|
||||
#define BSIZEPKT_ROUNDUP ((1 << IGC_SRRCTL_BSIZEPKT_SHIFT) - 1)
|
||||
|
||||
void
|
||||
igc_initialize_receive_unit(struct igc_softc *sc)
|
||||
{
|
||||
|
@ -2226,12 +2228,10 @@ igc_initialize_receive_unit(struct igc_softc *sc)
|
|||
if (sc->sc_nqueues > 1)
|
||||
igc_initialize_rss_mapping(sc);
|
||||
|
||||
#if 0
|
||||
srrctl |= 4096 >> IGC_SRRCTL_BSIZEPKT_SHIFT;
|
||||
rctl |= IGC_RCTL_SZ_4096 | IGC_RCTL_BSEX;
|
||||
#endif
|
||||
|
||||
srrctl |= 2048 >> IGC_SRRCTL_BSIZEPKT_SHIFT;
|
||||
/* Set maximum packet buffer len */
|
||||
srrctl |= (sc->rx_mbuf_sz + BSIZEPKT_ROUNDUP) >>
|
||||
IGC_SRRCTL_BSIZEPKT_SHIFT;
|
||||
/* srrctl above overrides this but set the register to a sane value */
|
||||
rctl |= IGC_RCTL_SZ_2048;
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* deflate.c -- compress data using the deflation algorithm
|
||||
* Copyright (C) 1995-2023 Jean-loup Gailly and Mark Adler
|
||||
* Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* deflate.h -- internal compression state
|
||||
* Copyright (C) 1995-2018 Jean-loup Gailly
|
||||
* Copyright (C) 1995-2024 Jean-loup Gailly
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* inftrees.c -- generate Huffman trees for efficient decoding
|
||||
* Copyright (C) 1995-2023 Mark Adler
|
||||
* Copyright (C) 1995-2024 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
|
@ -55,7 +55,7 @@ int ZLIB_INTERNAL inflate_table(codetype type, unsigned short FAR *lens,
|
|||
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
|
||||
static const unsigned short lext[31] = { /* Length codes 257..285 extra */
|
||||
16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
|
||||
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 70, 200};
|
||||
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 73, 200};
|
||||
static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
|
||||
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
|
||||
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* trees.c -- output deflated data using Huffman coding
|
||||
* Copyright (C) 1995-2021 Jean-loup Gailly
|
||||
* Copyright (C) 1995-2024 Jean-loup Gailly
|
||||
* detect_data_type() function provided freely by Cosmin Truta, 2006
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* zconf.h -- configuration of the zlib compression library
|
||||
* Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler
|
||||
* Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* zlib.h -- interface of the 'zlib' general purpose compression library
|
||||
version 1.3.0.1, August xxth, 2023
|
||||
version 1.3.1.1, January xxth, 2024
|
||||
|
||||
Copyright (C) 1995-2023 Jean-loup Gailly and Mark Adler
|
||||
Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
@ -37,11 +37,11 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ZLIB_VERSION "1.3.0.1-motley"
|
||||
#define ZLIB_VERNUM 0x1301
|
||||
#define ZLIB_VERSION "1.3.1.1-motley"
|
||||
#define ZLIB_VERNUM 0x1311
|
||||
#define ZLIB_VER_MAJOR 1
|
||||
#define ZLIB_VER_MINOR 3
|
||||
#define ZLIB_VER_REVISION 0
|
||||
#define ZLIB_VER_REVISION 1
|
||||
#define ZLIB_VER_SUBREVISION 1
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* zutil.h -- internal interface and configuration of the compression library
|
||||
* Copyright (C) 1995-2022 Jean-loup Gailly, Mark Adler
|
||||
* Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: if_sec.c,v 1.9 2023/12/23 10:52:54 bluhm Exp $ */
|
||||
/* $OpenBSD: if_sec.c,v 1.10 2024/01/24 00:17:01 dlg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2022 The University of Queensland
|
||||
|
@ -315,6 +315,14 @@ sec_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
|
|||
}
|
||||
}
|
||||
|
||||
mtag = m_tag_get(PACKET_TAG_GRE, sizeof(ifp->if_index), M_NOWAIT);
|
||||
if (mtag == NULL) {
|
||||
error = ENOBUFS;
|
||||
goto drop;
|
||||
}
|
||||
*(int *)(mtag + 1) = ifp->if_index;
|
||||
m_tag_prepend(m, mtag);
|
||||
|
||||
m->m_pkthdr.ph_family = dst->sa_family;
|
||||
|
||||
error = if_enqueue(ifp, m);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: pipex.c,v 1.151 2023/12/01 20:30:22 mvs Exp $ */
|
||||
/* $OpenBSD: pipex.c,v 1.153 2024/01/23 17:57:21 mvs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2009 Internet Initiative Japan Inc.
|
||||
|
@ -98,7 +98,6 @@ struct pipex_hash_head
|
|||
pipex_id_hashtable[PIPEX_HASH_SIZE]; /* [L] peer id hash */
|
||||
|
||||
struct radix_node_head *pipex_rd_head4 = NULL; /* [L] */
|
||||
struct radix_node_head *pipex_rd_head6 = NULL; /* [L] */
|
||||
struct timeout pipex_timer_ch; /* callout timer context */
|
||||
int pipex_prune = 1; /* [I] walk list every seconds */
|
||||
|
||||
|
@ -152,6 +151,8 @@ pipex_destroy_all_sessions(void *ownersc)
|
|||
|
||||
LIST_FOREACH_SAFE(session, &pipex_session_list, session_list,
|
||||
session_tmp) {
|
||||
if (session->flags & PIPEX_SFLAGS_ITERATOR)
|
||||
continue;
|
||||
if (session->ownersc == ownersc) {
|
||||
KASSERT((session->flags & PIPEX_SFLAGS_PPPX) == 0);
|
||||
pipex_unlink_session_locked(session);
|
||||
|
@ -437,11 +438,6 @@ pipex_link_session(struct pipex_session *session, struct ifnet *ifp,
|
|||
offsetof(struct sockaddr_in, sin_addr)))
|
||||
panic("rn_inithead() failed on pipex_link_session()");
|
||||
}
|
||||
if (pipex_rd_head6 == NULL) {
|
||||
if (!rn_inithead((void **)&pipex_rd_head6,
|
||||
offsetof(struct sockaddr_in6, sin6_addr)))
|
||||
panic("rn_inithead() failed on pipex_link_session()");
|
||||
}
|
||||
if (pipex_lookup_by_session_id_locked(session->protocol,
|
||||
session->session_id)) {
|
||||
error = EEXIST;
|
||||
|
@ -600,6 +596,8 @@ pipex_get_closed(struct pipex_session_list_req *req, void *ownersc)
|
|||
|
||||
LIST_FOREACH_SAFE(session, &pipex_close_wait_list, state_list,
|
||||
session_tmp) {
|
||||
if (session->flags & PIPEX_SFLAGS_ITERATOR)
|
||||
continue;
|
||||
if (session->ownersc != ownersc)
|
||||
continue;
|
||||
req->plr_ppp_id[req->plr_ppp_id_count++] = session->ppp_id;
|
||||
|
@ -736,6 +734,8 @@ pipex_timer(void *ignored_arg)
|
|||
/* walk through */
|
||||
LIST_FOREACH_SAFE(session, &pipex_session_list, session_list,
|
||||
session_tmp) {
|
||||
if (session->flags & PIPEX_SFLAGS_ITERATOR)
|
||||
continue;
|
||||
switch (session->state) {
|
||||
case PIPEX_STATE_OPENED:
|
||||
if (session->timeout_sec == 0)
|
||||
|
@ -775,6 +775,47 @@ pipex_timer(void *ignored_arg)
|
|||
/***********************************************************************
|
||||
* Common network I/O functions. (tunnel protocol independent)
|
||||
***********************************************************************/
|
||||
|
||||
struct pipex_session *
|
||||
pipex_iterator(struct pipex_session *session,
|
||||
struct pipex_session_iterator *iter, void *ownersc)
|
||||
{
|
||||
struct pipex_session *session_tmp;
|
||||
|
||||
mtx_enter(&pipex_list_mtx);
|
||||
|
||||
if (session)
|
||||
session_tmp = LIST_NEXT(session, session_list);
|
||||
else
|
||||
session_tmp = LIST_FIRST(&pipex_session_list);
|
||||
|
||||
while (session_tmp) {
|
||||
if (session_tmp->flags & PIPEX_SFLAGS_ITERATOR)
|
||||
goto next;
|
||||
if (session_tmp->ownersc != ownersc)
|
||||
goto next;
|
||||
break;
|
||||
next:
|
||||
session_tmp = LIST_NEXT(session_tmp, session_list);
|
||||
}
|
||||
|
||||
if (session)
|
||||
LIST_REMOVE(iter, session_list);
|
||||
|
||||
if (session_tmp) {
|
||||
LIST_INSERT_AFTER(session_tmp,
|
||||
(struct pipex_session *)&iter, session_list);
|
||||
refcnt_take(&session_tmp->pxs_refcnt);
|
||||
}
|
||||
|
||||
mtx_leave(&pipex_list_mtx);
|
||||
|
||||
if (session)
|
||||
pipex_rele_session(session);
|
||||
|
||||
return (session_tmp);
|
||||
}
|
||||
|
||||
void
|
||||
pipex_ip_output(struct mbuf *m0, struct pipex_session *session)
|
||||
{
|
||||
|
@ -809,23 +850,17 @@ pipex_ip_output(struct mbuf *m0, struct pipex_session *session)
|
|||
|
||||
pipex_ppp_output(m0, session, PPP_IP);
|
||||
} else {
|
||||
struct pipex_session_iterator iter = {
|
||||
.flags = PIPEX_SFLAGS_ITERATOR,
|
||||
};
|
||||
|
||||
struct pipex_session *session_tmp;
|
||||
struct mbuf *m;
|
||||
|
||||
m0->m_flags &= ~(M_BCAST|M_MCAST);
|
||||
|
||||
mtx_enter(&pipex_list_mtx);
|
||||
|
||||
session_tmp = LIST_FIRST(&pipex_session_list);
|
||||
while (session_tmp != NULL) {
|
||||
struct pipex_session *session_save = NULL;
|
||||
|
||||
if (session_tmp->ownersc != session->ownersc)
|
||||
goto next;
|
||||
|
||||
refcnt_take(&session_tmp->pxs_refcnt);
|
||||
mtx_leave(&pipex_list_mtx);
|
||||
|
||||
session_tmp = pipex_iterator(NULL, &iter, session->ownersc);
|
||||
while (session_tmp) {
|
||||
m = m_copym(m0, 0, M_COPYALL, M_NOWAIT);
|
||||
if (m != NULL)
|
||||
pipex_ppp_output(m, session_tmp, PPP_IP);
|
||||
|
@ -833,16 +868,10 @@ pipex_ip_output(struct mbuf *m0, struct pipex_session *session)
|
|||
counters_inc(session_tmp->stat_counters,
|
||||
pxc_oerrors);
|
||||
|
||||
mtx_enter(&pipex_list_mtx);
|
||||
session_save = session_tmp;
|
||||
next:
|
||||
session_tmp = LIST_NEXT(session_tmp, session_list);
|
||||
if (session_save != NULL)
|
||||
pipex_rele_session(session_save);
|
||||
session_tmp = pipex_iterator(session_tmp,
|
||||
&iter, session->ownersc);
|
||||
}
|
||||
|
||||
mtx_leave(&pipex_list_mtx);
|
||||
|
||||
m_freem(m0);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: pipex_local.h,v 1.49 2022/07/15 22:56:13 mvs Exp $ */
|
||||
/* $OpenBSD: pipex_local.h,v 1.51 2024/01/23 17:57:21 mvs Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Internet Initiative Japan Inc.
|
||||
|
@ -156,21 +156,32 @@ struct pipex_l2tp_session {
|
|||
|
||||
struct cpumem;
|
||||
|
||||
/* special iterator session */
|
||||
struct pipex_session_iterator {
|
||||
/* Fields below should be in sync with pipex_session structure */
|
||||
struct radix_node ps4_rn[2];
|
||||
u_int flags; /* [I] flags, see below */
|
||||
LIST_ENTRY(pipex_session) session_list; /* [L] all session chain */
|
||||
};
|
||||
|
||||
/* pppac ip-extension session table */
|
||||
struct pipex_session {
|
||||
struct radix_node ps4_rn[2];
|
||||
/* [L] tree glue, and other values */
|
||||
struct radix_node ps6_rn[2];
|
||||
/* [L] tree glue, and other values */
|
||||
|
||||
struct refcnt pxs_refcnt;
|
||||
struct mutex pxs_mtx;
|
||||
u_int flags; /* [I] flags, see below */
|
||||
#define PIPEX_SFLAGS_MULTICAST 0x01 /* virtual entry for multicast */
|
||||
#define PIPEX_SFLAGS_PPPX 0x02 /* interface is
|
||||
point2point(pppx) */
|
||||
#define PIPEX_SFLAGS_ITERATOR 0x04 /* iterator session */
|
||||
|
||||
LIST_ENTRY(pipex_session) session_list; /* [L] all session chain */
|
||||
LIST_ENTRY(pipex_session) state_list; /* [L] state list chain */
|
||||
LIST_ENTRY(pipex_session) id_chain; /* [L] id hash chain */
|
||||
LIST_ENTRY(pipex_session) peer_addr_chain;
|
||||
/* [L] peer's address hash chain */
|
||||
struct refcnt pxs_refcnt;
|
||||
struct mutex pxs_mtx;
|
||||
|
||||
u_int state; /* [L] pipex session state */
|
||||
#define PIPEX_STATE_INITIAL 0x0000
|
||||
#define PIPEX_STATE_OPENED 0x0001
|
||||
|
@ -180,11 +191,6 @@ struct pipex_session {
|
|||
|
||||
uint32_t idle_time; /* [L] idle time in seconds */
|
||||
|
||||
u_int flags; /* [I] flags, see below */
|
||||
#define PIPEX_SFLAGS_MULTICAST 0x01 /* virtual entry for multicast */
|
||||
#define PIPEX_SFLAGS_PPPX 0x02 /* interface is
|
||||
point2point(pppx) */
|
||||
|
||||
uint16_t protocol; /* [I] tunnel protocol (PK) */
|
||||
uint16_t session_id; /* [I] session-id (PK) */
|
||||
uint16_t peer_session_id; /* [I] peer's session-id */
|
||||
|
@ -466,3 +472,5 @@ int pipex_ppp_enqueue (struct mbuf *, struct pipex_session *,
|
|||
void pipex_timer_start (void);
|
||||
void pipex_timer_stop (void);
|
||||
void pipex_timer (void *);
|
||||
struct pipex_session *pipex_iterator(struct pipex_session *,
|
||||
struct pipex_session_iterator *, void *);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue