aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nouveau_drv.h
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2012-07-09 00:14:48 -0400
committerBen Skeggs <bskeggs@redhat.com>2012-10-02 23:12:44 -0400
commit586c55f6ade73f8672d1eaf598237a6f49b28443 (patch)
tree8126db70ecd98917344c8d772ad9b16eb4dd1a05 /drivers/gpu/drm/nouveau/nouveau_drv.h
parent9458029940ffc64bca0c5a30ea626c377205842e (diff)
drm/nouveau: have non-core mmio accesses go through device object
Adds an extra layer of indirection to each register access, but it's not too bad, and will also go away as pieces are ported. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_drv.h')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drv.h38
1 files changed, 6 insertions, 32 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h
index d1bade37fcc6..2395032f5171 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
@@ -673,8 +673,6 @@ struct drm_nouveau_private {
673 int flags; 673 int flags;
674 u32 crystal; 674 u32 crystal;
675 675
676 void __iomem *mmio;
677
678 spinlock_t ramin_lock; 676 spinlock_t ramin_lock;
679 void __iomem *ramin; 677 void __iomem *ramin;
680 u32 ramin_size; 678 u32 ramin_size;
@@ -1428,36 +1426,12 @@ static inline void nvchan_wr32(struct nouveau_channel *chan,
1428} 1426}
1429 1427
1430/* register access */ 1428/* register access */
1431static inline u32 nv_rd32(struct drm_device *dev, unsigned reg) 1429#include "nouveau_compat.h"
1432{ 1430#define nv_rd08 _nv_rd08
1433 struct drm_nouveau_private *dev_priv = dev->dev_private; 1431#define nv_wr08 _nv_wr08
1434 return ioread32_native(dev_priv->mmio + reg); 1432#define nv_rd32 _nv_rd32
1435} 1433#define nv_wr32 _nv_wr32
1436 1434#define nv_mask _nv_mask
1437static inline void nv_wr32(struct drm_device *dev, unsigned reg, u32 val)
1438{
1439 struct drm_nouveau_private *dev_priv = dev->dev_private;
1440 iowrite32_native(val, dev_priv->mmio + reg);
1441}
1442
1443static inline u32 nv_mask(struct drm_device *dev, u32 reg, u32 mask, u32 val)
1444{
1445 u32 tmp = nv_rd32(dev, reg);
1446 nv_wr32(dev, reg, (tmp & ~mask) | val);
1447 return tmp;
1448}
1449
1450static inline u8 nv_rd08(struct drm_device *dev, unsigned reg)
1451{
1452 struct drm_nouveau_private *dev_priv = dev->dev_private;
1453 return ioread8(dev_priv->mmio + reg);
1454}
1455
1456static inline void nv_wr08(struct drm_device *dev, unsigned reg, u8 val)
1457{
1458 struct drm_nouveau_private *dev_priv = dev->dev_private;
1459 iowrite8(val, dev_priv->mmio + reg);
1460}
1461 1435
1462#define nv_wait(dev, reg, mask, val) \ 1436#define nv_wait(dev, reg, mask, val) \
1463 nouveau_wait_eq(dev, 2000000000ULL, (reg), (mask), (val)) 1437 nouveau_wait_eq(dev, 2000000000ULL, (reg), (mask), (val))