Another round of whack-a-mole with nouveau.

This commit is contained in:
riastradh 2015-02-25 17:29:42 +00:00
parent af4dc18490
commit 5b8aff708e
16 changed files with 374 additions and 39 deletions

View File

@ -13,6 +13,9 @@ struct nouveau_mc {
struct nouveau_subdev base;
bool use_msi;
unsigned int irq;
#ifdef __NetBSD__
void *irq_cookie;
#endif
};
static inline struct nouveau_mc *

View File

@ -32,7 +32,6 @@ struct nouveau_pwr {
struct work_struct work;
#ifdef __NetBSD__
struct mutex lock;
drm_waitqueue_t wait;
#else
wait_queue_head_t wait;

View File

@ -27,6 +27,11 @@
#include <linux/kref.h>
#include <linux/list.h>
#include <linux/spinlock.h>
#include <linux/math64.h>
#include <linux/io-mapping.h>
#include <linux/jiffies.h>
#include <linux/errno.h>
#include <linux/workqueue.h>
#include <asm/byteorder.h>
#include <asm/io.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: nouveau_subdev_bios_pll.c,v 1.1.1.1 2014/08/06 12:36:29 riastradh Exp $ */
/* $NetBSD: nouveau_subdev_bios_pll.c,v 1.2 2015/02/25 17:29:43 riastradh Exp $ */
/*
* Copyright 2005-2006 Erik Waling
@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_bios_pll.c,v 1.1.1.1 2014/08/06 12:36:29 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_bios_pll.c,v 1.2 2015/02/25 17:29:43 riastradh Exp $");
#include <subdev/vga.h>
#include <subdev/bios.h>
@ -44,7 +44,7 @@ nv04_pll_mapping[] = {
{ PLL_MEMORY, 0x680504 },
{ PLL_VPLL0 , 0x680508 },
{ PLL_VPLL1 , 0x680520 },
{}
{ }
};
static struct pll_mapping
@ -53,7 +53,7 @@ nv40_pll_mapping[] = {
{ PLL_MEMORY, 0x004020 },
{ PLL_VPLL0 , 0x680508 },
{ PLL_VPLL1 , 0x680520 },
{}
{ }
};
static struct pll_mapping
@ -67,7 +67,7 @@ nv50_pll_mapping[] = {
{ PLL_UNK42 , 0x00e824 },
{ PLL_VPLL0 , 0x614100 },
{ PLL_VPLL1 , 0x614900 },
{}
{ }
};
static struct pll_mapping
@ -79,7 +79,7 @@ nv84_pll_mapping[] = {
{ PLL_UNK41 , 0x00e818 },
{ PLL_VPLL0 , 0x614100 },
{ PLL_VPLL1 , 0x614900 },
{}
{ }
};
static u16

View File

@ -1,4 +1,4 @@
/* $NetBSD: nouveau_subdev_clock_base.c,v 1.1.1.1 2014/08/06 12:36:29 riastradh Exp $ */
/* $NetBSD: nouveau_subdev_clock_base.c,v 1.2 2015/02/25 17:29:43 riastradh Exp $ */
/*
* Copyright 2013 Red Hat Inc.
@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_clock_base.c,v 1.1.1.1 2014/08/06 12:36:29 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_clock_base.c,v 1.2 2015/02/25 17:29:43 riastradh Exp $");
#include <core/option.h>
@ -488,13 +488,12 @@ nouveau_clock_create_(struct nouveau_object *parent,
if (!strncasecmpz(mode, "disabled", arglen)) {
clk->ustate = -1;
} else {
char save = mode[arglen];
char *m = kstrndup(mode, arglen, GFP_KERNEL);
long v;
((char *)mode)[arglen] = '\0';
if (!kstrtol(mode, 0, &v))
if (!kstrtol(m, 0, &v))
nouveau_clock_ustate_update(clk, v);
((char *)mode)[arglen] = save;
kfree(m);
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: nouveau_subdev_clock_nv50.c,v 1.1.1.1 2014/08/06 12:36:29 riastradh Exp $ */
/* $NetBSD: nouveau_subdev_clock_nv50.c,v 1.2 2015/02/25 17:29:43 riastradh Exp $ */
/*
* Copyright 2012 Red Hat Inc.
@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_clock_nv50.c,v 1.1.1.1 2014/08/06 12:36:29 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_clock_nv50.c,v 1.2 2015/02/25 17:29:43 riastradh Exp $");
#include <subdev/bios.h>
#include <subdev/bios/pll.h>
@ -117,6 +117,9 @@ read_pll_src(struct nv50_clock_priv *priv, u32 base)
break;
default:
BUG_ON(1);
M = 0; /* XXX GCC is stupid */
N = 0; /* XXX GCC is stupid */
N = P; /* XXX GCC is stupid */
}
if (M)

View File

@ -64,8 +64,14 @@
static inline struct io_mapping *
fbmem_init(struct nouveau_device *dev)
{
#ifdef __NetBSD__
return bus_space_io_mapping_create_wc(nv_device_resource_tag(dev, 1),
nv_device_resource_start(dev, 1),
nv_device_resource_len(dev, 1));
#else
return io_mapping_create_wc(nv_device_resource_start(dev, 1),
nv_device_resource_len(dev, 1));
#endif
}
static inline void
@ -74,12 +80,45 @@ fbmem_fini(struct io_mapping *fb)
io_mapping_free(fb);
}
#ifdef __NetBSD__
/*
* XXX Consider using bus_space_reserve/map instead. Don't want to use
* bus_space_map because presumably that will eat too much KVA.
*/
# define __iomem volatile
# define ioread32 fake_ioread32
# define iowrite32 fake_iowrite32
static inline uint32_t
fake_ioread32(const void __iomem *p)
{
const uint32_t v = *(const uint32_t __iomem *)p;
membar_consumer();
return v;
}
static inline void
fake_iowrite32(uint32_t v, void __iomem *p)
{
membar_producer();
*(uint32_t __iomem *)p = v;
}
#endif
static inline u32
fbmem_peek(struct io_mapping *fb, u32 off)
{
u8 __iomem *p = io_mapping_map_atomic_wc(fb, off & PAGE_MASK);
u32 val = ioread32(p + (off & ~PAGE_MASK));
#ifdef __NetBSD__
io_mapping_unmap_atomic(fb, __UNVOLATILE(p));
#else
io_mapping_unmap_atomic(p);
#endif
return val;
}
@ -88,8 +127,13 @@ fbmem_poke(struct io_mapping *fb, u32 off, u32 val)
{
u8 __iomem *p = io_mapping_map_atomic_wc(fb, off & PAGE_MASK);
iowrite32(val, p + (off & ~PAGE_MASK));
#ifdef __NetBSD__
membar_producer();
io_mapping_unmap_atomic(fb, __UNVOLATILE(p));
#else
wmb();
io_mapping_unmap_atomic(p);
#endif
}
static inline bool
@ -98,3 +142,9 @@ fbmem_readback(struct io_mapping *fb, u32 off, u32 val)
fbmem_poke(fb, off, val);
return val == fbmem_peek(fb, off);
}
#ifdef __NetBSD__
# undef __iomem
# undef ioread32
# undef iowrite32
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: nouveau_subdev_devinit_nv04.c,v 1.1.1.1 2014/08/06 12:36:30 riastradh Exp $ */
/* $NetBSD: nouveau_subdev_devinit_nv04.c,v 1.2 2015/02/25 17:29:43 riastradh Exp $ */
/*
* Copyright (C) 2010 Francisco Jerez.
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_devinit_nv04.c,v 1.1.1.1 2014/08/06 12:36:30 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_devinit_nv04.c,v 1.2 2015/02/25 17:29:43 riastradh Exp $");
#include <subdev/vga.h>
@ -403,8 +403,10 @@ nv04_devinit_fini(struct nouveau_object *object, bool suspend)
return ret;
/* unslave crtcs */
#if 0 /* XXX Can't happen: priv->owner is unsigned. */
if (priv->owner < 0)
priv->owner = nv_rdvgaowner(priv);
#endif
nv_wrvgaowner(priv, 0);
return 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: nouveau_subdev_fb_nv50.c,v 1.1.1.1 2014/08/06 12:36:30 riastradh Exp $ */
/* $NetBSD: nouveau_subdev_fb_nv50.c,v 1.2 2015/02/25 17:29:43 riastradh Exp $ */
/*
* Copyright 2012 Red Hat Inc.
@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_fb_nv50.c,v 1.1.1.1 2014/08/06 12:36:30 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_fb_nv50.c,v 1.2 2015/02/25 17:29:43 riastradh Exp $");
#include <core/client.h>
#include <core/enum.h>
@ -253,6 +253,52 @@ nv50_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
if (ret)
return ret;
#ifdef __NetBSD__
{
/* XXX pa_dmat or pa_dmat64? */
const bus_dma_tag_t dmat = device->pdev->pd_pa.pa_dmat64;
int nsegs;
priv->r100c08_map = NULL; /* paranoia */
priv->r100c08_kva = NULL;
/* XXX errno NetBSD->Linux */
ret = -bus_dmamem_alloc(dmat, PAGE_SIZE, PAGE_SIZE, 0,
&priv->r100c08_seg, 1, &nsegs, BUS_DMA_WAITOK);
if (ret) {
fail0: nouveau_fb_destroy(&priv->base);
return ret;
}
KASSERT(nsegs == 1);
/* XXX errno NetBSD->Linux */
ret = -bus_dmamap_create(dmat, PAGE_SIZE, 1, PAGE_SIZE, 0,
BUS_DMA_WAITOK, &priv->r100c08_map);
if (ret) {
fail1: bus_dmamem_free(dmat, &priv->r100c08_seg, 1);
goto fail0;
}
/* XXX errno NetBSD->Linux */
ret = -bus_dmamem_map(dmat, &priv->r100c08_seg, 1, PAGE_SIZE,
&priv->r100c08_kva, BUS_DMA_WAITOK);
if (ret) {
fail2: bus_dmamap_destroy(dmat, priv->r100c08_map);
goto fail1;
}
(void)memset(priv->r100c08_kva, 0, PAGE_SIZE);
/* XXX errno NetBSD->Linux */
ret = -bus_dmamap_load(dmat, priv->r100c08_map, priv->r100c08_kva,
PAGE_SIZE, NULL, BUS_DMA_WAITOK);
if (ret) {
fail3: __unused bus_dmamem_unmap(dmat, priv->r100c08_kva, PAGE_SIZE);
goto fail2;
}
priv->r100c08 = priv->r100c08_map->dm_segs[0].ds_addr;
}
#else
priv->r100c08_page = alloc_page(GFP_KERNEL | __GFP_ZERO);
if (priv->r100c08_page) {
priv->r100c08 = nv_device_map_page(device, priv->r100c08_page);
@ -261,6 +307,7 @@ nv50_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
} else {
nv_warn(priv, "failed 0x100c08 page alloc\n");
}
#endif
nv_subdev(priv)->intr = nv50_fb_intr;
return 0;
@ -272,10 +319,21 @@ nv50_fb_dtor(struct nouveau_object *object)
struct nouveau_device *device = nv_device(object);
struct nv50_fb_priv *priv = (void *)object;
#ifdef __NetBSD__
if (priv->r100c08_map) {
const bus_dma_tag_t dmat = device->pdev->pd_pa.pa_dmat64;
bus_dmamap_unload(dmat, priv->r100c08_map);
bus_dmamem_unmap(dmat, priv->r100c08_kva, PAGE_SIZE);
bus_dmamap_destroy(dmat, priv->r100c08_map);
bus_dmamem_free(dmat, &priv->r100c08_seg, 1);
}
#else
if (priv->r100c08_page) {
nv_device_unmap_page(device, priv->r100c08);
__free_page(priv->r100c08_page);
}
#endif
nouveau_fb_destroy(&priv->base);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: nouveau_subdev_fb_nvc0.c,v 1.1.1.1 2014/08/06 12:36:30 riastradh Exp $ */
/* $NetBSD: nouveau_subdev_fb_nvc0.c,v 1.2 2015/02/25 17:29:43 riastradh Exp $ */
/*
* Copyright 2012 Red Hat Inc.
@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_fb_nvc0.c,v 1.1.1.1 2014/08/06 12:36:30 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_fb_nvc0.c,v 1.2 2015/02/25 17:29:43 riastradh Exp $");
#include "nvc0.h"
@ -63,8 +63,13 @@ nvc0_fb_init(struct nouveau_object *object)
if (ret)
return ret;
#ifdef __NetBSD__
if (priv->r100c10_map)
nv_wr32(priv, 0x100c10, priv->r100c10 >> 8);
#else
if (priv->r100c10_page)
nv_wr32(priv, 0x100c10, priv->r100c10 >> 8);
#endif
return 0;
}
@ -74,10 +79,21 @@ nvc0_fb_dtor(struct nouveau_object *object)
struct nouveau_device *device = nv_device(object);
struct nvc0_fb_priv *priv = (void *)object;
#ifdef __NetBSD__
if (priv->r100c10_map) {
const bus_dma_tag_t dmat = device->pdev->pd_pa.pa_dmat64;
bus_dmamap_unload(dmat, priv->r100c10_map);
bus_dmamem_unmap(dmat, priv->r100c10_kva, PAGE_SIZE);
bus_dmamap_destroy(dmat, priv->r100c10_map);
bus_dmamem_free(dmat, &priv->r100c10_seg, 1);
}
#else
if (priv->r100c10_page) {
nv_device_unmap_page(device, priv->r100c10);
__free_page(priv->r100c10_page);
}
#endif
nouveau_fb_destroy(&priv->base);
}
@ -96,12 +112,59 @@ nvc0_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
if (ret)
return ret;
#ifdef __NetBSD__
{
/* XXX pa_dmat or pa_dmat64? */
const bus_dma_tag_t dmat = device->pdev->pd_pa.pa_dmat64;
int nsegs;
priv->r100c10_map = NULL; /* paranoia */
priv->r100c10_kva = NULL;
/* XXX errno NetBSD->Linux */
ret = -bus_dmamem_alloc(dmat, PAGE_SIZE, PAGE_SIZE, 0,
&priv->r100c10_seg, 1, &nsegs, BUS_DMA_WAITOK);
if (ret) {
fail0: nouveau_fb_destroy(&priv->base);
return ret;
}
KASSERT(nsegs == 1);
/* XXX errno NetBSD->Linux */
ret = -bus_dmamap_create(dmat, PAGE_SIZE, 1, PAGE_SIZE, 0,
BUS_DMA_WAITOK, &priv->r100c10_map);
if (ret) {
fail1: bus_dmamem_free(dmat, &priv->r100c10_seg, 1);
goto fail0;
}
/* XXX errno NetBSD->Linux */
ret = -bus_dmamem_map(dmat, &priv->r100c10_seg, 1, PAGE_SIZE,
&priv->r100c10_kva, BUS_DMA_WAITOK);
if (ret) {
fail2: bus_dmamap_destroy(dmat, priv->r100c10_map);
goto fail1;
}
(void)memset(priv->r100c10_kva, 0, PAGE_SIZE);
/* XXX errno NetBSD->Linux */
ret = -bus_dmamap_load(dmat, priv->r100c10_map, priv->r100c10_kva,
PAGE_SIZE, NULL, BUS_DMA_WAITOK);
if (ret) {
fail3: __unused bus_dmamem_unmap(dmat, priv->r100c10_kva, PAGE_SIZE);
goto fail2;
}
priv->r100c10 = priv->r100c10_map->dm_segs[0].ds_addr;
}
#else
priv->r100c10_page = alloc_page(GFP_KERNEL | __GFP_ZERO);
if (priv->r100c10_page) {
priv->r100c10 = nv_device_map_page(device, priv->r100c10_page);
if (!priv->r100c10)
return -EFAULT;
}
#endif
nv_subdev(priv)->intr = nvc0_fb_intr;
return 0;

View File

@ -5,7 +5,13 @@
struct nv50_fb_priv {
struct nouveau_fb base;
#ifdef __NetBSD__
bus_dma_segment_t r100c08_seg;
bus_dmamap_t r100c08_map;
void *r100c08_kva;
#else
struct page *r100c08_page;
#endif
dma_addr_t r100c08;
};

View File

@ -6,7 +6,13 @@
struct nvc0_fb_priv {
struct nouveau_fb base;
#ifdef __NetBSD__
bus_dma_segment_t r100c10_seg;
bus_dmamap_t r100c10_map;
void *r100c10_kva;
#else
struct page *r100c10_page;
#endif
dma_addr_t r100c10;
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: nouveau_subdev_mc_base.c,v 1.1.1.1 2014/08/06 12:36:31 riastradh Exp $ */
/* $NetBSD: nouveau_subdev_mc_base.c,v 1.2 2015/02/25 17:29:43 riastradh Exp $ */
/*
* Copyright 2012 Red Hat Inc.
@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_mc_base.c,v 1.1.1.1 2014/08/06 12:36:31 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_mc_base.c,v 1.2 2015/02/25 17:29:43 riastradh Exp $");
#include <subdev/mc.h>
#include <core/option.h>
@ -39,8 +39,13 @@ nouveau_mc_intr_mask(struct nouveau_mc *pmc)
return intr;
}
#ifdef __NetBSD__
static int
nouveau_mc_intr(void *arg)
#else
static irqreturn_t
nouveau_mc_intr(int irq, void *arg)
#endif
{
struct nouveau_mc *pmc = arg;
const struct nouveau_mc_oclass *oclass = (void *)nv_object(pmc)->oclass;
@ -71,7 +76,11 @@ nouveau_mc_intr(int irq, void *arg)
}
nv_wr32(pmc, 0x000140, 0x00000001);
#ifdef __NetBSD__
return intr ? 1 : 0;
#else
return intr ? IRQ_HANDLED : IRQ_NONE;
#endif
}
int
@ -98,7 +107,11 @@ _nouveau_mc_dtor(struct nouveau_object *object)
{
struct nouveau_device *device = nv_device(object);
struct nouveau_mc *pmc = (void *)object;
#ifdef __NetBSD__
pci_intr_disestablish(device->pdev->pd_pa.pa_pc, pmc->irq_cookie);
#else
free_irq(pmc->irq, pmc);
#endif
if (pmc->use_msi)
pci_disable_msi(device->pdev);
nouveau_subdev_destroy(&pmc->base);
@ -154,11 +167,23 @@ nouveau_mc_create_(struct nouveau_object *parent, struct nouveau_object *engine,
return ret;
pmc->irq = ret;
#ifdef __NetBSD__
if (nv_device_is_pci(device)) {
const pci_chipset_tag_t pc = device->pdev->pd_pa.pa_pc;
__CTASSERT(sizeof(pci_intr_handle_t) <= sizeof pmc->irq);
pmc->irq_cookie = pci_intr_establish(pc, pmc->irq, IPL_VM,
&nouveau_mc_intr, pmc);
if (pmc->irq_cookie == NULL)
return -EIO;
}
#else
ret = request_irq(pmc->irq, nouveau_mc_intr, IRQF_SHARED, "nouveau",
pmc);
if (ret < 0)
return ret;
#endif
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: nouveau_subdev_mxm_nv50.c,v 1.1.1.1 2014/08/06 12:36:31 riastradh Exp $ */
/* $NetBSD: nouveau_subdev_mxm_nv50.c,v 1.2 2015/02/25 17:29:43 riastradh Exp $ */
/*
* Copyright 2011 Red Hat Inc.
@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_mxm_nv50.c,v 1.1.1.1 2014/08/06 12:36:31 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_mxm_nv50.c,v 1.2 2015/02/25 17:29:43 riastradh Exp $");
#include <subdev/mxm.h>
#include <subdev/bios.h>
@ -189,7 +189,7 @@ mxm_show_unmatched(struct nouveau_mxm *mxm, u8 *data, void *info)
{
u64 desc = *(u64 *)data;
if ((desc & 0xf0) != 0xf0)
nv_info(mxm, "unmatched output device 0x%016llx\n", desc);
nv_info(mxm, "unmatched output device 0x%016"PRIx64"\n", desc);
return true;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: nouveau_subdev_pwr_base.c,v 1.2 2014/08/23 08:03:34 riastradh Exp $ */
/* $NetBSD: nouveau_subdev_pwr_base.c,v 1.3 2015/02/25 17:29:43 riastradh Exp $ */
/*
* Copyright 2013 Red Hat Inc.
@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_pwr_base.c,v 1.2 2014/08/23 08:03:34 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_pwr_base.c,v 1.3 2015/02/25 17:29:43 riastradh Exp $");
#include <subdev/pwr.h>
#include <subdev/timer.h>
@ -71,7 +71,15 @@ nouveau_pwr_send(struct nouveau_pwr *ppwr, u32 reply[2],
/* wait for reply, if requested */
if (reply) {
#ifdef __NetBSD__
int ret;
DRM_WAIT_NOINTR_UNTIL(ret, &ppwr->recv.wait, &subdev->mutex,
(ppwr->recv.process == 0));
KASSERT(ret == 0);
#else
wait_event(ppwr->recv.wait, (ppwr->recv.process == 0));
#endif
reply[0] = ppwr->recv.data[0];
reply[1] = ppwr->recv.data[1];
mutex_unlock(&subdev->mutex);
@ -85,6 +93,7 @@ nouveau_pwr_recv(struct work_struct *work)
{
struct nouveau_pwr *ppwr =
container_of(work, struct nouveau_pwr, recv.work);
struct nouveau_subdev *subdev = nv_subdev(ppwr);
u32 process, message, data0, data1;
/* nothing to do if GET == PUT */
@ -110,27 +119,22 @@ nouveau_pwr_recv(struct work_struct *work)
nv_wr32(ppwr, 0x10a580, 0x00000000);
/* wake process if it's waiting on a synchronous reply */
#ifdef __NetBSD__
mutex_lock(&ppwr->recv.lock);
#endif
if (ppwr->recv.process) {
mutex_lock(&subdev->mutex);
if (process == ppwr->recv.process &&
message == ppwr->recv.message) {
ppwr->recv.data[0] = data0;
ppwr->recv.data[1] = data1;
ppwr->recv.process = 0;
#ifdef __NetBSD__
DRM_WAKEUP_ONE(&ppwr->recv.wait, &ppwr->recv.lock);
mutex_unlock(&ppwr->recv.lock);
DRM_WAKEUP_ONE(&ppwr->recv.wait, &subdev->mutex);
#else
wake_up(&ppwr->recv.wait);
#endif
return;
}
mutex_unlock(&subdev->mutex);
}
#ifdef __NetBSD__
mutex_unlock(&ppwr->recv.lock);
#endif
/* right now there's no other expected responses from the engine,
* so assume that any unexpected message is an error.
@ -259,7 +263,6 @@ nouveau_pwr_create_(struct nouveau_object *parent,
INIT_WORK(&ppwr->recv.work, nouveau_pwr_recv);
#ifdef __NetBSD__
linux_mutex_init(&ppwr->recv.lock);
DRM_INIT_WAITQUEUE(&ppwr->recv.wait, "nvppwr");
#else
init_waitqueue_head(&ppwr->recv.wait);
@ -274,7 +277,6 @@ _nouveau_pwr_dtor(struct nouveau_object *object)
struct nouveau_pwr *ppwr = (void *)object;
DRM_DESTROY_WAITQUEUE(&ppwr->recv.wait);
linux_mutex_destroy(&ppwr->recv.lock);
_nouveau_subdev_dtor(object);
}

View File

@ -1,4 +1,4 @@
# $NetBSD: files.nouveau,v 1.5 2015/02/25 14:57:04 riastradh Exp $
# $NetBSD: files.nouveau,v 1.6 2015/02/25 17:29:42 riastradh Exp $
device nouveau: drmkms, drmkms_pci, drmkms_ttm, genfb, wsemuldisplaydev
attach nouveau at pci
@ -116,6 +116,120 @@ makeoptions nouveau "CWARNFLAGS.nouveau_nv50_display.c"+="-Wno-unused-but-set-va
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_bar_base.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_bar_nv50.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_bar_nvc0.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_bios_base.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_bios_pll.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_bus_nv04.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_bus_nv31.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_bus_nv50.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_bus_nv94.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_bus_nvc0.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_clock_base.c"+="-Wno-shadow"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_clock_nv04.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_clock_nv40.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_clock_nv50.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_clock_nv84.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_clock_nvaa.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_clock_nva3.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_clock_nvc0.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_clock_nve0.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_devinit_gm107.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_devinit_nv04.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_devinit_nv05.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_devinit_nv10.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_devinit_nv1a.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_devinit_nv20.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_devinit_nv50.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_devinit_nv84.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_devinit_nv98.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_devinit_nva3.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_devinit_nvaf.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_devinit_nvc0.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_base.c"+="-Wno-shadow"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_gm107.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_nv04.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_nv1a.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_nv10.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_nv20.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_nv25.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_nv30.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_nv35.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_nv36.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_nv40.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_nv41.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_nv44.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_nv46.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_nv47.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_nv49.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_nv4e.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_nv50.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_nv84.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_nva3.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_nvaa.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_nvaf.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_nvc0.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_nve0.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_ramgm107.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_ramnv04.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_ramnv10.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_ramnv1a.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_ramnv20.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_ramnv40.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_ramnv41.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_ramnv44.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_ramnv49.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_ramnv4e.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_ramnv50.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_ramnva3.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_ramnvaa.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_ramnvc0.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_ramnvd0.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_ramnve0.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_ramnve0.c"+="-Wno-shadow"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_fb_sddr3.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_gpio_base.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_gpio_nv10.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_gpio_nv50.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_gpio_nvd0.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_gpio_nve0.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_gpio_nve0.c"+="-Wno-missing-prototypes"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_i2c_anx9805.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_i2c_base.c"+="-Wno-shadow"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_i2c_nv04.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_i2c_nv4e.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_i2c_nv50.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_i2c_nv94.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_i2c_nv94.c"+="-Wno-missing-prototypes"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_i2c_nvd0.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_ibus_nvc0.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_ibus_nve0.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_instmem_nv04.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_instmem_nv40.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_instmem_nv50.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_ltcg_gf100.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_ltcg_gm107.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_mc_nv04.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_mc_nv40.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_mc_nv44.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_mc_nv4c.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_mc_nv50.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_mc_nv94.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_mc_nv98.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_mc_nvc0.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_mc_nvc3.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_mxm_base.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_mxm_base.c"+="-Wno-shadow"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_mxm_mxms.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_mxm_mxms.c"+="-Wno-shadow"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_mxm_nv50.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_pwr_nv108.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_pwr_nva3.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_pwr_nvc0.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_pwr_nvd0.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_therm_ic.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_therm_nv40.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_therm_nv50.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_therm_nv84.c"+="-Wno-missing-field-initializers"
makeoptions nouveau "CWARNFLAGS.nouveau_subdev_therm_nvd0.c"+="-Wno-missing-field-initializers"
file external/bsd/drm2/nouveau/nouveau_module.c nouveau