sync with OpenBSD -current

This commit is contained in:
purplerain 2024-04-10 21:48:14 +00:00
parent fe31ca4724
commit 2d743fc5aa
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
189 changed files with 3737 additions and 1337 deletions

View file

@ -288,7 +288,6 @@ static int intelfb_create(struct drm_fb_helper *helper,
info->fbops = &intelfb_ops;
#ifdef __linux__
obj = intel_fb_obj(&intel_fb->base);
if (i915_gem_object_is_lmem(obj)) {
struct intel_memory_region *mem = obj->mm.region;
@ -336,21 +335,18 @@ static int intelfb_create(struct drm_fb_helper *helper,
memset_io(info->screen_base, 0, info->screen_size);
/* Use default scratch pixmap (info->pixmap.flags = FB_PIXMAP_SYSTEM) */
#else
drm_dbg_kms(&dev_priv->drm, "allocated %dx%d fb: 0x%08x\n",
ifbdev->fb->base.width, ifbdev->fb->base.height,
i915_ggtt_offset(vma));
ifbdev->vma = vma;
ifbdev->vma_flags = flags;
intel_runtime_pm_put(&dev_priv->runtime_pm, wakeref);
vga_switcheroo_client_fb_set(pdev, info);
{
struct drm_framebuffer *fb = ifbdev->helper.fb;
struct rasops_info *ri = &dev_priv->ro;
bus_space_handle_t bsh;
int err;
vaddr = i915_vma_pin_iomap(vma);
if (IS_ERR(vaddr)) {
DRM_ERROR("Failed to remap framebuffer into virtual memory\n");
ret = PTR_ERR(vaddr);
goto out_unpin;
}
drm_fb_helper_fill_info(info, &ifbdev->helper, sizes);
ri->ri_bits = vaddr;
ri->ri_depth = fb->format->cpp[0] * 8;
@ -376,20 +372,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
ri->ri_bpos = 0;
break;
}
if (vma->obj->stolen && !prealloc)
memset(ri->ri_bits, 0, vma->node.size);
}
#endif
drm_dbg_kms(&dev_priv->drm, "allocated %dx%d fb: 0x%08x\n",
ifbdev->fb->base.width, ifbdev->fb->base.height,
i915_ggtt_offset(vma));
ifbdev->vma = vma;
ifbdev->vma_flags = flags;
intel_runtime_pm_put(&dev_priv->runtime_pm, wakeref);
vga_switcheroo_client_fb_set(pdev, info);
return 0;
out_unpin:

View file

@ -1,4 +1,4 @@
# $OpenBSD: files.pci,v 1.364 2024/02/21 10:48:10 claudio Exp $
# $OpenBSD: files.pci,v 1.365 2024/04/09 14:58:41 mglocker Exp $
# $NetBSD: files.pci,v 1.20 1996/09/24 17:47:15 christos Exp $
#
# Config file and device description for machine-independent PCI code.
@ -872,5 +872,9 @@ device mwx: ifnet, wlan, firmload
attach mwx at pci
file dev/pci/if_mwx.c mwx
# UFS HC
attach ufshci at pci with ufshci_pci
file dev/pci/ufshci_pci.c ufshci_pci
include "dev/pci/files.agp"
include "dev/pci/drm/files.drm"

109
sys/dev/pci/ufshci_pci.c Normal file
View file

@ -0,0 +1,109 @@
/* $OpenBSD: ufshci_pci.c,v 1.2 2024/04/10 10:40:27 mglocker Exp $ */
/*
* Copyright (c) 2024 Marcus Glocker <mglocker@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
#include <scsi/scsi_all.h>
#include <scsi/scsiconf.h>
#include <dev/ic/ufshcivar.h>
#define UFSHCI_PCI_BAR 0x10
#define UFSHCI_PCI_INTERFACE 0x01
struct ufshci_pci_softc {
struct ufshci_softc psc_ufshci;
pci_chipset_tag_t psc_pc;
void *psc_ih;
};
int ufshci_pci_match(struct device *, void *, void *);
void ufshci_pci_attach(struct device *, struct device *, void *);
int ufshci_pci_detach(struct device *, int);
int ufshci_pci_activate(struct device *, int);
const struct cfattach ufshci_pci_ca = {
sizeof(struct ufshci_pci_softc),
ufshci_pci_match,
ufshci_pci_attach,
ufshci_pci_detach
};
int
ufshci_pci_match(struct device *parent, void *match, void *aux)
{
struct pci_attach_args *pa = (struct pci_attach_args *)aux;
if (PCI_CLASS(pa->pa_class) == PCI_CLASS_MASS_STORAGE &&
PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_MASS_STORAGE_UFS &&
PCI_INTERFACE(pa->pa_class) == UFSHCI_PCI_INTERFACE)
return 1;
return 0;
}
void
ufshci_pci_attach(struct device *parent, struct device *self, void *aux)
{
struct ufshci_pci_softc *psc = (struct ufshci_pci_softc *)self;
struct ufshci_softc *sc = &psc->psc_ufshci;
struct pci_attach_args *pa = aux;
pcireg_t maptype;
pci_intr_handle_t ih;
psc->psc_pc = pa->pa_pc;
sc->sc_dmat = pa->pa_dmat;
/* Map registers */
maptype = pci_mapreg_type(pa->pa_pc, pa->pa_tag, UFSHCI_PCI_BAR);
if (pci_mapreg_map(pa, UFSHCI_PCI_BAR, maptype, 0, &sc->sc_iot,
&sc->sc_ioh, NULL, &sc->sc_ios, 0) != 0) {
printf(": can't map registers\n");
return;
}
/* Map interrupt */
if (pci_intr_map(pa, &ih) != 0) {
printf(": can't map interrupt\n");
return;
}
printf(": %s", pci_intr_string(pa->pa_pc, ih));
/* Establish interrupt */
psc->psc_ih = pci_intr_establish(psc->psc_pc, ih, IPL_BIO, ufshci_intr,
sc, sc->sc_dev.dv_xname);
if (psc->psc_ih == NULL) {
printf(": can't establish interrupt\n");
return;
}
/* Call the driver attach */
ufshci_attach(sc);
}
int
ufshci_pci_detach(struct device *self, int flags)
{
return 0;
}