root/drivers/gpu/drm/nouveau/include/nvkm/subdev/fb.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /* SPDX-License-Identifier: MIT */
   2 #ifndef __NVKM_FB_H__
   3 #define __NVKM_FB_H__
   4 #include <core/subdev.h>
   5 #include <core/mm.h>
   6 
   7 /* memory type/access flags, do not match hardware values */
   8 #define NV_MEM_ACCESS_RO  1
   9 #define NV_MEM_ACCESS_WO  2
  10 #define NV_MEM_ACCESS_RW (NV_MEM_ACCESS_RO | NV_MEM_ACCESS_WO)
  11 #define NV_MEM_ACCESS_SYS 4
  12 #define NV_MEM_ACCESS_VM  8
  13 #define NV_MEM_ACCESS_NOSNOOP 16
  14 
  15 #define NV_MEM_TARGET_VRAM        0
  16 #define NV_MEM_TARGET_PCI         1
  17 #define NV_MEM_TARGET_PCI_NOSNOOP 2
  18 #define NV_MEM_TARGET_VM          3
  19 #define NV_MEM_TARGET_GART        4
  20 
  21 #define NVKM_RAM_TYPE_VM 0x7f
  22 #define NV_MEM_COMP_VM 0x03
  23 
  24 struct nvkm_fb_tile {
  25         struct nvkm_mm_node *tag;
  26         u32 addr;
  27         u32 limit;
  28         u32 pitch;
  29         u32 zcomp;
  30 };
  31 
  32 struct nvkm_fb {
  33         const struct nvkm_fb_func *func;
  34         struct nvkm_subdev subdev;
  35 
  36         struct nvkm_ram *ram;
  37         struct nvkm_mm tags;
  38 
  39         struct {
  40                 struct nvkm_fb_tile region[16];
  41                 int regions;
  42         } tile;
  43 
  44         u8 page;
  45 
  46         struct nvkm_memory *mmu_rd;
  47         struct nvkm_memory *mmu_wr;
  48 };
  49 
  50 void nvkm_fb_tile_init(struct nvkm_fb *, int region, u32 addr, u32 size,
  51                        u32 pitch, u32 flags, struct nvkm_fb_tile *);
  52 void nvkm_fb_tile_fini(struct nvkm_fb *, int region, struct nvkm_fb_tile *);
  53 void nvkm_fb_tile_prog(struct nvkm_fb *, int region, struct nvkm_fb_tile *);
  54 
  55 int nv04_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
  56 int nv10_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
  57 int nv1a_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
  58 int nv20_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
  59 int nv25_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
  60 int nv30_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
  61 int nv35_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
  62 int nv36_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
  63 int nv40_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
  64 int nv41_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
  65 int nv44_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
  66 int nv46_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
  67 int nv47_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
  68 int nv49_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
  69 int nv4e_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
  70 int nv50_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
  71 int g84_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
  72 int gt215_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
  73 int mcp77_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
  74 int mcp89_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
  75 int gf100_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
  76 int gf108_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
  77 int gk104_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
  78 int gk110_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
  79 int gk20a_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
  80 int gm107_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
  81 int gm200_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
  82 int gm20b_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
  83 int gp100_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
  84 int gp102_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
  85 int gp10b_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
  86 int gv100_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
  87 
  88 #include <subdev/bios.h>
  89 #include <subdev/bios/ramcfg.h>
  90 
  91 struct nvkm_ram_data {
  92         struct list_head head;
  93         struct nvbios_ramcfg bios;
  94         u32 freq;
  95 };
  96 
  97 enum nvkm_ram_type {
  98         NVKM_RAM_TYPE_UNKNOWN = 0,
  99         NVKM_RAM_TYPE_STOLEN,
 100         NVKM_RAM_TYPE_SGRAM,
 101         NVKM_RAM_TYPE_SDRAM,
 102         NVKM_RAM_TYPE_DDR1,
 103         NVKM_RAM_TYPE_DDR2,
 104         NVKM_RAM_TYPE_DDR3,
 105         NVKM_RAM_TYPE_GDDR2,
 106         NVKM_RAM_TYPE_GDDR3,
 107         NVKM_RAM_TYPE_GDDR4,
 108         NVKM_RAM_TYPE_GDDR5,
 109         NVKM_RAM_TYPE_GDDR5X,
 110         NVKM_RAM_TYPE_GDDR6,
 111         NVKM_RAM_TYPE_HBM2,
 112 };
 113 
 114 struct nvkm_ram {
 115         const struct nvkm_ram_func *func;
 116         struct nvkm_fb *fb;
 117         enum nvkm_ram_type type;
 118         u64 size;
 119 
 120 #define NVKM_RAM_MM_SHIFT 12
 121 #define NVKM_RAM_MM_ANY    (NVKM_MM_HEAP_ANY + 0)
 122 #define NVKM_RAM_MM_NORMAL (NVKM_MM_HEAP_ANY + 1)
 123 #define NVKM_RAM_MM_NOMAP  (NVKM_MM_HEAP_ANY + 2)
 124 #define NVKM_RAM_MM_MIXED  (NVKM_MM_HEAP_ANY + 3)
 125         struct nvkm_mm vram;
 126         u64 stolen;
 127 
 128         int ranks;
 129         int parts;
 130         int part_mask;
 131 
 132         u32 freq;
 133         u32 mr[16];
 134         u32 mr1_nuts;
 135 
 136         struct nvkm_ram_data *next;
 137         struct nvkm_ram_data former;
 138         struct nvkm_ram_data xition;
 139         struct nvkm_ram_data target;
 140 };
 141 
 142 int
 143 nvkm_ram_get(struct nvkm_device *, u8 heap, u8 type, u8 page, u64 size,
 144              bool contig, bool back, struct nvkm_memory **);
 145 
 146 struct nvkm_ram_func {
 147         u64 upper;
 148         u32 (*probe_fbp)(const struct nvkm_ram_func *, struct nvkm_device *,
 149                          int fbp, int *pltcs);
 150         u32 (*probe_fbp_amount)(const struct nvkm_ram_func *, u32 fbpao,
 151                                 struct nvkm_device *, int fbp, int *pltcs);
 152         u32 (*probe_fbpa_amount)(struct nvkm_device *, int fbpa);
 153         void *(*dtor)(struct nvkm_ram *);
 154         int (*init)(struct nvkm_ram *);
 155 
 156         int (*calc)(struct nvkm_ram *, u32 freq);
 157         int (*prog)(struct nvkm_ram *);
 158         void (*tidy)(struct nvkm_ram *);
 159 };
 160 #endif

/* [<][>][^][v][top][bottom][index][help] */