Permalink
Browse files

and more fixes

  • Loading branch information...
1 parent cf65809 commit df8fa305ea44a3158a600b200ff1677a0db3f487 @mlankhorst mlankhorst committed Apr 5, 2012
View
10 pscnv/TODO.BSD
@@ -1,4 +1,5 @@
-Currently disabled temporarily
+Currently disabled temporarily:
+- anything i2c, probably displayport soon as well
Anything touching i2c:
- i2c methods in nouveau_bios
@@ -9,3 +10,10 @@ Anything touching i2c:
Not implemented at all:
- vga switcheroo / arbiter
+TODO:
+- framebuffer
+- fixup vm
+- fixup io
+- compile failures general
+- Maybe figure out wtf special casing nForce + old nv04 was for in nouveau_calc?
+
View
92 pscnv/bsd_support.h
@@ -51,6 +51,7 @@ typedef DRM_SPINTYPE spinlock_t;
#define kfree(x) drm_free(x, 0, DRM_MEM_DRIVER)
#define kzalloc(x, y) drm_calloc(x, 1, DRM_MEM_DRIVER)
+#define kcalloc(x, y, z) drm_calloc(x, y, DRM_MEM_DRIVER)
#define kmalloc(x, y) drm_alloc(x, DRM_MEM_DRIVER)
struct device_attribute {};
@@ -71,14 +72,29 @@ struct vm_area_struct {};
#define HZ hz
#endif
+#define power_supply_is_system_supplied() 1
+
+/* Dog slow version, but only called once
+ * Linux kernel has a faster software fallback
+ * but I prefer not to GPL this or even worry about it
+ */
+static inline u32 hweight32(u32 val)
+{
+ u32 i, ret = 0;
+ for (i = 1; i; i <<= 1)
+ if (val & i)
+ ++ret;
+ return ret;
+}
+
#define WARN(arg1, args...) do { \
printf("%s:%d/%s " arg1, \
__FILE__, __LINE__, __FUNCTION__, ##args); \
kdb_backtrace(); \
} while (0)
-#define BUG() WARN("")
+#define BUG() panic("BUG()\n");
#define WARN_ON(x,y,z...) do { if ((x)) WARN(y, ##z); } while (0)
-#define BUG_ON(x) WARN_ON(x, "")
+#define BUG_ON(x) do { if ((x)) { panic(#x "triggered\n"); } } while (0)
#ifndef __must_check
#define __must_check
@@ -95,6 +111,8 @@ linux_msleep(int ms)
#undef msleep
#define msleep linux_msleep
+#define udelay(x) DELAY((x))
+#define mdelay(x) DELAY((x) * 1000)
#endif /* _LINUX_DELAY_H_ */
@@ -388,3 +406,73 @@ kref_put(struct kref *kref, void (*rel)(struct kref *kref))
#endif /* _KREF_H_ */
+#ifndef _LINUX_LOG2_H_
+#define _LINUX_LOG2_H_
+
+#include <sys/libkern.h>
+
+static inline unsigned long
+roundup_pow_of_two(unsigned long x)
+{
+ return (1UL << flsl(x - 1));
+}
+
+static inline int
+is_power_of_2(unsigned long n)
+{
+ return (n == roundup_pow_of_two(n));
+}
+
+static inline unsigned long
+rounddown_pow_of_two(unsigned long x)
+{
+ return (1UL << (flsl(x) - 1));
+}
+
+static inline unsigned long
+ilog2(unsigned long x)
+{
+ return (flsl(x) - 1);
+}
+
+#endif /* _LINUX_LOG2_H_ */
+
+#ifndef _LINUX_ERR_H_
+#define _LINUX_ERR_H_
+
+#define MAX_ERRNO 4095
+
+#define IS_ERR_VALUE(x) ((x) >= (unsigned long)-MAX_ERRNO)
+
+static inline void *
+ERR_PTR(long error)
+{
+ return (void *)error;
+}
+
+static inline long
+PTR_ERR(const void *ptr)
+{
+ return (long)ptr;
+}
+
+static inline long
+IS_ERR(const void *ptr)
+{
+ return IS_ERR_VALUE((unsigned long)ptr);
+}
+
+static inline void *
+ERR_CAST(void *ptr)
+{
+ return (void *)ptr;
+}
+
+#endif /* _LINUX_ERR_H_ */
+
+// Not defined inside _LINUX_WORKQUEUE_H_ header
+static inline int
+work_pending(struct work_struct *work)
+{
+ return to_delayed_work(work)->work.work_task.ta_pending;
+}
View
7 pscnv/nouveau_calc.c
@@ -209,11 +209,14 @@ nv04_update_arb(struct drm_device *dev, int VClk, int bpp,
sim_data.two_heads = nv_two_heads(dev);
if ((dev->pci_device & 0xffff) == 0x01a0 /*CHIPSET_NFORCE*/ ||
(dev->pci_device & 0xffff) == 0x01f0 /*CHIPSET_NFORCE2*/) {
+#ifdef __linux__
uint32_t type;
-
pci_read_config_dword(pci_get_bus_and_slot(0, 1), 0x7c, &type);
-
sim_data.memory_type = (type >> 12) & 1;
+#else
+ // TODO: If anyone ever has a nv04 and wants things working? Dno
+ sim_data.memory_type = nvReadFB(dev, NV04_PFB_CFG0) & 0x1;
+#endif
sim_data.memory_width = 64;
sim_data.mem_latency = 3;
sim_data.mem_page_miss = 10;
View
6 pscnv/nouveau_display.c
@@ -237,7 +237,11 @@ nouveau_display_create(struct drm_device *dev)
disp->color_vibrance_property->values[1] = 200; /* -100..+100 */
}
- dev->mode_config.funcs = (void *)&nouveau_mode_config_funcs;
+#ifdef __DECONST
+ dev->mode_config.funcs = __DECONST(struct drm_mode_config_funcs *, &nouveau_mode_config_funcs);
+#else
+ dev->mode_config.funcs = (void*)&nouveau_mode_config_funcs;
+#endif
dev->mode_config.fb_base = dev_priv->fb_phys;
dev->mode_config.min_width = 0;
View
32 pscnv/nouveau_drv.h
@@ -482,8 +482,7 @@ struct drm_nouveau_private {
int chipset;
int flags;
- void __iomem *mmio;
- void __iomem *ramin;
+ struct drm_local_map *mmio, *ramin;
uint32_t ramin_size;
struct workqueue_struct *wq;
@@ -1212,36 +1211,35 @@ static inline void nvchan_wr32(struct nouveau_channel *chan,
}
#endif
-/* register access */
static inline u32 nv_rd32(struct drm_device *dev, unsigned reg)
{
struct drm_nouveau_private *dev_priv = dev->dev_private;
- return ioread32_native(dev_priv->mmio + reg);
+ return DRM_READ32(dev_priv->mmio, reg);
}
-static inline void nv_wr32(struct drm_device *dev, unsigned reg, u32 val)
+static inline u32 nv_rd08(struct drm_device *dev, unsigned reg)
{
struct drm_nouveau_private *dev_priv = dev->dev_private;
- iowrite32_native(val, dev_priv->mmio + reg);
+ return DRM_READ8(dev_priv->mmio, reg);
}
-static inline u32 nv_mask(struct drm_device *dev, u32 reg, u32 mask, u32 val)
+static inline void nv_wr32(struct drm_device *dev, unsigned reg, u32 val)
{
- u32 tmp = nv_rd32(dev, reg);
- nv_wr32(dev, reg, (tmp & ~mask) | val);
- return tmp;
+ struct drm_nouveau_private *dev_priv = dev->dev_private;
+ DRM_WRITE32(dev_priv->mmio, reg, val);
}
-static inline u8 nv_rd08(struct drm_device *dev, unsigned reg)
+static inline void nv_wr08(struct drm_device *dev, unsigned reg, u8 val)
{
struct drm_nouveau_private *dev_priv = dev->dev_private;
- return ioread8(dev_priv->mmio + reg);
+ DRM_WRITE8(dev_priv->mmio, reg, val);
}
-static inline void nv_wr08(struct drm_device *dev, unsigned reg, u8 val)
+static inline u32 nv_mask(struct drm_device *dev, u32 reg, u32 mask, u32 val)
{
- struct drm_nouveau_private *dev_priv = dev->dev_private;
- iowrite8(val, dev_priv->mmio + reg);
+ u32 tmp = nv_rd32(dev, reg);
+ nv_wr32(dev, reg, (tmp & ~mask) | val);
+ return tmp;
}
#define nv_wait(dev, reg, mask, val) \
@@ -1397,7 +1395,7 @@ static inline uint32_t nv_rv32(struct pscnv_bo *bo,
uint32_t res;
uint64_t addr = bo->start + offset;
if (bo->map3 && dev_priv->vm && dev_priv->vm_ok)
- return ioread32_native(dev_priv->ramin + bo->map3->start - dev_priv->vm_ramin_base + offset);
+ return DRM_READ32(dev_priv->ramin, bo->map3->start - dev_priv->vm_ramin_base + offset);
spin_lock(&dev_priv->pramin_lock);
if (addr >> 16 != dev_priv->pramin_start) {
dev_priv->pramin_start = addr >> 16;
@@ -1414,7 +1412,7 @@ static inline void nv_wv32(struct pscnv_bo *bo,
struct drm_nouveau_private *dev_priv = bo->dev->dev_private;
uint64_t addr = bo->start + offset;
if (bo->map3 && dev_priv->vm && dev_priv->vm_ok) {
- iowrite32_native(val, dev_priv->ramin + bo->map3->start - dev_priv->vm_ramin_base + offset);
+ DRM_WRITE32(dev_priv->ramin, bo->map3->start - dev_priv->vm_ramin_base + offset, val);
return;
}
spin_lock(&dev_priv->pramin_lock);
View
16 pscnv/nouveau_irq.c
@@ -34,21 +34,13 @@
#include "pscnv_drm.h"
#include "nouveau_drv.h"
#include "nouveau_reg.h"
-#include <linux/ratelimit.h>
/* needed for hotplug irq */
#include "nouveau_connector.h"
#include "nv50_display.h"
#include "pscnv_engine.h"
#include "pscnv_fifo.h"
-static DEFINE_RATELIMIT_STATE(nouveau_ratelimit_state, 3 * HZ, 20);
-
-static inline int nouveau_ratelimit(void)
-{
- return __ratelimit(&nouveau_ratelimit_state);
-}
-
void
nouveau_irq_preinstall(struct drm_device *dev)
{
@@ -83,6 +75,14 @@ nouveau_irq_uninstall(struct drm_device *dev)
}
#if 0
+#include <linux/ratelimit.h>
+
+static DEFINE_RATELIMIT_STATE(nouveau_ratelimit_state, 3 * HZ, 20);
+
+static inline int nouveau_ratelimit(void)
+{
+ return __ratelimit(&nouveau_ratelimit_state);
+}
static int
nouveau_call_method(struct nouveau_channel *chan, int class, int mthd, int data)
View
5 pscnv/nouveau_pm.c
@@ -28,6 +28,7 @@
#include "nouveau_bios.h"
#include "nouveau_crtc.h"
+#ifdef __linux__
#ifdef CONFIG_ACPI
#include <linux/acpi.h>
#endif
@@ -36,6 +37,7 @@
#include <linux/hwmon-sysfs.h>
#include <asm/div64.h>
+#endif
static int
nouveau_pwmfan_get(struct drm_device *dev)
@@ -844,6 +846,9 @@ static const struct attribute_group hwmon_pwm_fan_attrgroup = {
.attrs = hwmon_pwm_fan_attributes,
};
#endif
+#else
+#define nouveau_sysfs_init(x) do { } while (0)
+#define nouveau_sysfs_fini(x) do { } while (0)
#endif
static int
View
23 pscnv/nouveau_state.c
@@ -564,6 +564,7 @@ int nouveau_load(struct drm_device *dev, unsigned long flags)
struct drm_nouveau_private *dev_priv;
uint32_t reg0, strap;
resource_size_t mmio_start_offs;
+ int ret;
dev_priv = kzalloc(sizeof(*dev_priv), GFP_KERNEL);
if (!dev_priv)
@@ -588,11 +589,13 @@ int nouveau_load(struct drm_device *dev, unsigned long flags)
/* map the mmio regs */
mmio_start_offs = drm_get_resource_start(dev, 0);
- dev_priv->mmio = ioremap(mmio_start_offs, 0x00800000);
- if (!dev_priv->mmio) {
+ ret = drm_addmap(dev, mmio_start_offs, 0x00800000, _DRM_REGISTERS,
+ _DRM_KERNEL | _DRM_DRIVER, &dev_priv->mmio);
+
+ if (ret) {
NV_ERROR(dev, "Unable to initialize the mmio mapping. "
"Please report your setup to " DRIVER_EMAIL "\n");
- return -EINVAL;
+ return ret;
}
NV_DEBUG(dev, "regs mapped ok at 0x%llx\n",
(unsigned long long)mmio_start_offs);
@@ -694,12 +697,12 @@ int nouveau_load(struct drm_device *dev, unsigned long flags)
ramin_bar = 3;
dev_priv->ramin_size = drm_get_resource_len(dev, ramin_bar);
- dev_priv->ramin = ioremap(
- drm_get_resource_start(dev, ramin_bar),
- dev_priv->ramin_size);
- if (!dev_priv->ramin) {
+ ret = drm_addmap(dev, drm_get_resource_start(dev, ramin_bar),
+ dev_priv->ramin_size, _DRM_REGISTERS,
+ _DRM_KERNEL | _DRM_DRIVER, &dev_priv->ramin);
+ if (ret) {
NV_ERROR(dev, "Failed to init RAMIN mapping\n");
- return -ENOMEM;
+ return ret;
}
}
@@ -749,8 +752,8 @@ int nouveau_unload(struct drm_device *dev)
nouveau_close(dev);
}
- iounmap(dev_priv->mmio);
- iounmap(dev_priv->ramin);
+ drm_rmmap(dev, dev_priv->mmio);
+ drm_rmmap(dev, dev_priv->ramin);
kfree(dev_priv);
dev->dev_private = NULL;
View
1 pscnv/nv50_calc.c
@@ -23,7 +23,6 @@
*/
#include "nouveau_drv.h"
-#include "drm_fixed.h"
#include "nouveau_hw.h"
int
View
22 pscnv/nv50_fifo.c
@@ -38,11 +38,11 @@ struct nv50_fifo_engine {
#define nv50_fifo(x) container_of(x, struct nv50_fifo_engine, base)
-void nv50_fifo_takedown(struct drm_device *dev);
-void nv50_fifo_irq_handler(struct drm_device *dev, int irq);
-int nv50_fifo_chan_init_dma (struct pscnv_chan *ch, uint32_t pb_handle, uint32_t flags, uint32_t slimask, uint64_t pb_start);
-int nv50_fifo_chan_init_ib (struct pscnv_chan *ch, uint32_t pb_handle, uint32_t flags, uint32_t slimask, uint64_t ib_start, uint32_t ib_order);
-void nv50_fifo_chan_kill(struct pscnv_chan *ch);
+static void nv50_fifo_takedown(struct drm_device *dev);
+static void nv50_fifo_irq_handler(struct drm_device *dev, int irq);
+static int nv50_fifo_chan_init_dma (struct pscnv_chan *ch, uint32_t pb_handle, uint32_t flags, uint32_t slimask, uint64_t pb_start);
+static int nv50_fifo_chan_init_ib (struct pscnv_chan *ch, uint32_t pb_handle, uint32_t flags, uint32_t slimask, uint64_t ib_start, uint32_t ib_order);
+static void nv50_fifo_chan_kill(struct pscnv_chan *ch);
int nv50_fifo_init(struct drm_device *dev) {
struct drm_nouveau_private *dev_priv = dev->dev_private;
@@ -106,7 +106,7 @@ int nv50_fifo_init(struct drm_device *dev) {
return 0;
}
-void nv50_fifo_takedown(struct drm_device *dev) {
+static void nv50_fifo_takedown(struct drm_device *dev) {
struct drm_nouveau_private *dev_priv = dev->dev_private;
int i;
struct nv50_fifo_engine *fifo = nv50_fifo(dev_priv->fifo);
@@ -122,7 +122,7 @@ void nv50_fifo_takedown(struct drm_device *dev) {
dev_priv->fifo = 0;
}
-void nv50_fifo_playlist_update (struct drm_device *dev) {
+static void nv50_fifo_playlist_update (struct drm_device *dev) {
struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nv50_fifo_engine *fifo = nv50_fifo(dev_priv->fifo);
int i, pos;
@@ -142,7 +142,7 @@ void nv50_fifo_playlist_update (struct drm_device *dev) {
nv_wr32(dev, 0x2500, 0x101);
}
-void nv50_fifo_chan_kill(struct pscnv_chan *ch) {
+static void nv50_fifo_chan_kill(struct pscnv_chan *ch) {
struct drm_device *dev = ch->dev;
struct drm_nouveau_private *dev_priv = dev->dev_private;
uint64_t start;
@@ -174,7 +174,7 @@ void nv50_fifo_chan_kill(struct pscnv_chan *ch) {
spin_unlock_irqrestore(&dev_priv->context_switch_lock, flags);
}
-int nv50_fifo_chan_init_dma (struct pscnv_chan *ch, uint32_t pb_handle, uint32_t flags, uint32_t slimask, uint64_t pb_start) {
+static int nv50_fifo_chan_init_dma (struct pscnv_chan *ch, uint32_t pb_handle, uint32_t flags, uint32_t slimask, uint64_t pb_start) {
struct drm_device *dev = ch->dev;
struct drm_nouveau_private *dev_priv = dev->dev_private;
unsigned long irqflags;
@@ -242,7 +242,7 @@ int nv50_fifo_chan_init_dma (struct pscnv_chan *ch, uint32_t pb_handle, uint32_t
return 0;
}
-int nv50_fifo_chan_init_ib (struct pscnv_chan *ch, uint32_t pb_handle, uint32_t flags, uint32_t slimask, uint64_t ib_start, uint32_t ib_order) {
+static int nv50_fifo_chan_init_ib (struct pscnv_chan *ch, uint32_t pb_handle, uint32_t flags, uint32_t slimask, uint64_t ib_start, uint32_t ib_order) {
struct drm_device *dev = ch->dev;
struct drm_nouveau_private *dev_priv = dev->dev_private;
unsigned long irqflags;
@@ -347,7 +347,7 @@ static struct pscnv_enumval *pscnv_enum_find (struct pscnv_enumval *list, int va
return 0;
}
-void nv50_fifo_irq_handler(struct drm_device *dev, int irq) {
+static void nv50_fifo_irq_handler(struct drm_device *dev, int irq) {
struct drm_nouveau_private *dev_priv = dev->dev_private;
uint32_t status;
int ch;
View
10 pscnv/nv50_graph.c
@@ -479,7 +479,7 @@ static struct pscnv_enumval *pscnv_enum_find (struct pscnv_enumval *list, int va
return 0;
}
-void nv50_graph_tex_trap(struct drm_device *dev, int cid, int tp) {
+static void nv50_graph_tex_trap(struct drm_device *dev, int cid, int tp) {
struct drm_nouveau_private *dev_priv = dev->dev_private;
uint32_t staddr, status;
uint32_t e04, e08, e0c, e10;
@@ -521,7 +521,7 @@ void nv50_graph_tex_trap(struct drm_device *dev, int cid, int tp) {
nv_wr32(dev, staddr, 0xc0000000);
}
-void nv50_graph_mp_trap(struct drm_device *dev, int cid, int tp, int mp) {
+static void nv50_graph_mp_trap(struct drm_device *dev, int cid, int tp, int mp) {
struct drm_nouveau_private *dev_priv = dev->dev_private;
uint32_t mpaddr, mp10, status, pc, oplo, ophi;
if (dev_priv->chipset < 0xa0)
@@ -567,7 +567,7 @@ void nv50_graph_mp_trap(struct drm_device *dev, int cid, int tp, int mp) {
nv_wr32(dev, mpaddr + 0x14, 0);
}
-void nv50_graph_mpc_trap(struct drm_device *dev, int cid, int tp) {
+static void nv50_graph_mpc_trap(struct drm_device *dev, int cid, int tp) {
struct drm_nouveau_private *dev_priv = dev->dev_private;
uint32_t staddr, status;
if (dev_priv->chipset < 0xa0)
@@ -621,7 +621,7 @@ void nv50_graph_mpc_trap(struct drm_device *dev, int cid, int tp) {
nv_wr32(dev, staddr, 0xc0000000);
}
-void nv50_graph_tprop_trap(struct drm_device *dev, int cid, int tp) {
+static void nv50_graph_tprop_trap(struct drm_device *dev, int cid, int tp) {
static const char *const tprop_tnames[14] = {
"RT0",
"RT1",
@@ -711,7 +711,7 @@ void nv50_graph_tprop_trap(struct drm_device *dev, int cid, int tp) {
nv_wr32(dev, staddr, 0xc0000000);
}
-void nv50_graph_trap_handler(struct drm_device *dev, int cid) {
+static void nv50_graph_trap_handler(struct drm_device *dev, int cid) {
struct drm_nouveau_private *dev_priv = dev->dev_private;
uint32_t status = nv_rd32(dev, 0x400108);
uint32_t ustatus;
View
1 pscnv/nv50_pm.c
@@ -120,6 +120,7 @@ read_pll_src(struct drm_device *dev, u32 base)
case 1: return read_clk(dev, clk_src_crystal);
case 2: return read_clk(dev, clk_src_href);
case 3: id = 0; break;
+ default: BUG_ON(1);
}
coef = nv_rd32(dev, 0x00e81c + (id * 0x28));
View
43 pscnv/nvc0_fifo.c
@@ -35,22 +35,22 @@ struct nvc0_fifo_engine {
struct pscnv_bo *playlist[2];
int cur_playlist;
struct pscnv_bo *ctrl_bo;
- volatile uint32_t *fifo_ctl;
+ struct drm_local_map *fifo_ctl;
};
#define nvc0_fifo(x) container_of(x, struct nvc0_fifo_engine, base)
-void nvc0_fifo_takedown(struct drm_device *dev);
-void nvc0_fifo_irq_handler(struct drm_device *dev, int irq);
-int nvc0_fifo_chan_init_ib (struct pscnv_chan *ch, uint32_t pb_handle, uint32_t flags, uint32_t slimask, uint64_t ib_start, uint32_t ib_order);
-void nvc0_fifo_chan_kill(struct pscnv_chan *ch);
+static void nvc0_fifo_takedown(struct drm_device *dev);
+static void nvc0_fifo_irq_handler(struct drm_device *dev, int irq);
+static int nvc0_fifo_chan_init_ib (struct pscnv_chan *ch, uint32_t pb_handle, uint32_t flags, uint32_t slimask, uint64_t ib_start, uint32_t ib_order);
+static void nvc0_fifo_chan_kill(struct pscnv_chan *ch);
int nvc0_fifo_init(struct drm_device *dev)
{
struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nvc0_fifo_engine *res = kzalloc(sizeof *res, GFP_KERNEL);
int subfifo_count;
- int i;
+ int i, ret;
if (!res) {
NV_ERROR(dev, "PFIFO: Couldn't allocate engine!\n");
@@ -96,15 +96,16 @@ int nvc0_fifo_init(struct drm_device *dev)
kfree(res);
return -ENOMEM;
}
- res->fifo_ctl = ioremap(drm_get_resource_start(dev, 1) +
- res->ctrl_bo->map1->start, 128 << 12);
- if (!res->fifo_ctl) {
+ ret = drm_addmap(dev, drm_get_resource_start(dev, 1) +
+ res->ctrl_bo->map1->start, 128 << 12,
+ _DRM_REGISTERS, _DRM_KERNEL | _DRM_DRIVER, &res->fifo_ctl);
+ if (ret) {
NV_ERROR(dev, "PFIFO: Couldn't ioremap control area!\n");
pscnv_mem_free(res->playlist[0]);
pscnv_mem_free(res->playlist[1]);
pscnv_mem_free(res->ctrl_bo);
kfree(res);
- return -ENOMEM;
+ return ret;
}
/* reset PFIFO, enable all available PSUBFIFO areas */
@@ -155,7 +156,7 @@ int nvc0_fifo_init(struct drm_device *dev)
return 0;
}
-void nvc0_fifo_takedown(struct drm_device *dev)
+static void nvc0_fifo_takedown(struct drm_device *dev)
{
struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nvc0_fifo_engine *fifo = nvc0_fifo(dev_priv->fifo);
@@ -164,13 +165,13 @@ void nvc0_fifo_takedown(struct drm_device *dev)
/* XXX */
pscnv_mem_free(fifo->playlist[0]);
pscnv_mem_free(fifo->playlist[1]);
- iounmap(fifo->fifo_ctl);
+ drm_rmmap(dev, fifo->fifo_ctl);
pscnv_mem_free(fifo->ctrl_bo);
kfree(fifo);
dev_priv->fifo = 0;
}
-void nvc0_fifo_playlist_update(struct drm_device *dev)
+static void nvc0_fifo_playlist_update(struct drm_device *dev)
{
struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nvc0_fifo_engine *fifo = nvc0_fifo(dev_priv->fifo);
@@ -195,7 +196,7 @@ void nvc0_fifo_playlist_update(struct drm_device *dev)
nv_rd32(dev, 0x227c));
}
-void nvc0_fifo_chan_kill(struct pscnv_chan *ch)
+static void nvc0_fifo_chan_kill(struct pscnv_chan *ch)
{
struct drm_device *dev = ch->dev;
struct drm_nouveau_private *dev_priv = dev->dev_private;
@@ -222,9 +223,9 @@ void nvc0_fifo_chan_kill(struct pscnv_chan *ch)
}
#define nvchan_wr32(chan, ofst, val) \
- fifo->fifo_ctl[((chan)->cid * 0x1000 + ofst) / 4] = val
+ DRM_WRITE32(fifo->fifo_ctl, ((chan)->cid * 0x1000 + ofst), val)
-int nvc0_fifo_chan_init_ib (struct pscnv_chan *ch, uint32_t pb_handle, uint32_t flags, uint32_t slimask, uint64_t ib_start, uint32_t ib_order) {
+static int nvc0_fifo_chan_init_ib (struct pscnv_chan *ch, uint32_t pb_handle, uint32_t flags, uint32_t slimask, uint64_t ib_start, uint32_t ib_order) {
struct drm_device *dev = ch->dev;
struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nvc0_fifo_engine *fifo = nvc0_fifo(dev_priv->fifo);
@@ -316,7 +317,7 @@ static const char *pgf_cause_str(uint32_t flags)
return "unknown cause";
}
-void nvc0_pfifo_page_fault(struct drm_device *dev, int unit)
+static void nvc0_pfifo_page_fault(struct drm_device *dev, int unit)
{
uint64_t virt;
uint32_t chan, flags;
@@ -331,7 +332,7 @@ void nvc0_pfifo_page_fault(struct drm_device *dev, int unit)
(flags & 0x80) ? 'w' : 'r', pgf_cause_str(flags));
}
-void nvc0_pfifo_subfifo_fault(struct drm_device *dev, int unit)
+static void nvc0_pfifo_subfifo_fault(struct drm_device *dev, int unit)
{
int cid = nv_rd32(dev, 0x40120 + unit * 0x2000) & 0x7f;
int status = nv_rd32(dev, 0x40108 + unit * 0x2000);
@@ -359,7 +360,7 @@ void nvc0_pfifo_subfifo_fault(struct drm_device *dev, int unit)
}
}
-void nvc0_fifo_irq_handler(struct drm_device *dev, int irq)
+static void nvc0_fifo_irq_handler(struct drm_device *dev, int irq)
{
uint32_t status;
@@ -422,9 +423,11 @@ uint64_t nvc0_fifo_ctrl_offs(struct drm_device *dev, int cid)
return fifo->ctrl_bo->map1->start + cid * 0x1000;
}
-volatile uint32_t *nvc0_fifo_ctrl_ptr(struct drm_device *dev, struct pscnv_chan *chan)
+#if 0
+static volatile uint32_t *nvc0_fifo_ctrl_ptr(struct drm_device *dev, struct pscnv_chan *chan)
{
struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nvc0_fifo_engine *fifo = nvc0_fifo(dev_priv->fifo);
return &fifo->fifo_ctl[chan->cid * 0x1000 / 4];
}
+#endif
View
3 pscnv/pscnv_chan.c
@@ -147,9 +147,6 @@ static struct vm_operations_struct pscnv_chan_vm_ops = {
.close = pscnv_chan_vm_close,
};
-/* XXX */
-extern uint64_t nvc0_fifo_ctrl_offs(struct drm_device *dev, int cid);
-
int pscnv_chan_mmap(struct file *filp, struct vm_area_struct *vma)
{
struct drm_file *priv = filp->private_data;
View
3 pscnv/pscnv_chan.h
@@ -31,6 +31,9 @@
#include "pscnv_ramht.h"
#include "pscnv_engine.h"
+/* XXX */
+extern uint64_t nvc0_fifo_ctrl_offs(struct drm_device *dev, int cid);
+
struct pscnv_chan {
struct drm_device *dev;
int cid;

0 comments on commit df8fa30

Please sign in to comment.