Commit c7c039fd authored by Roy Spliet's avatar Roy Spliet Committed by Ben Skeggs

drm/nouveau/pm: implement DDR2/DDR3/GDDR3/GDDR5 MR generation and validation

Roy Spliet:
- Implement according to specs
- Simplify
- Make array for mc latency registers

Martin Peres:
- squash and split all the commits from Roy
- rework following Ben Skeggs comments
- add a form of timings validation
- store the initial timings for later use

Ben Skeggs
- merge slightly modified tidy-up patch with this one
- remove perflvl-dropping logic for the moment
Signed-off-by: default avatarRoy Spliet <r.spliet@student.tudelft.nl>
Signed-off-by: default avatarMartin Peres <martin.peres@labri.fr>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 03ddf04b
...@@ -432,25 +432,26 @@ struct nouveau_pm_voltage { ...@@ -432,25 +432,26 @@ struct nouveau_pm_voltage {
int nr_level; int nr_level;
}; };
/* Exclusive upper limits */
#define NV_MEM_CL_DDR2_MAX 8
#define NV_MEM_WR_DDR2_MAX 9
#define NV_MEM_CL_DDR3_MAX 17
#define NV_MEM_WR_DDR3_MAX 17
#define NV_MEM_CL_GDDR3_MAX 16
#define NV_MEM_WR_GDDR3_MAX 18
#define NV_MEM_CL_GDDR5_MAX 21
#define NV_MEM_WR_GDDR5_MAX 20
struct nouveau_pm_memtiming { struct nouveau_pm_memtiming {
int id; int id;
u32 reg_0; /* 0x10f290 on Fermi, 0x100220 for older */
u32 reg_1; u32 reg[9];
u32 reg_2; u32 mr[4];
u32 reg_3;
u32 reg_4;
u32 reg_5;
u32 reg_6;
u32 reg_7;
u32 reg_8;
/* To be written to 0x1002c0 */
u8 CL;
u8 WR;
u8 tCWL; u8 tCWL;
bool odt; u8 odt;
bool dll_disable; u8 drive_strength;
bool ron_pull;
}; };
struct nouveau_pm_tbl_header { struct nouveau_pm_tbl_header {
...@@ -527,8 +528,10 @@ struct nouveau_pm_threshold_temp { ...@@ -527,8 +528,10 @@ struct nouveau_pm_threshold_temp {
struct nouveau_pm_memtimings { struct nouveau_pm_memtimings {
bool supported; bool supported;
struct nouveau_pm_memtiming boot;
struct nouveau_pm_memtiming *timing; struct nouveau_pm_memtiming *timing;
int nr_timing; int nr_timing;
int nr_timing_valid;
}; };
struct nouveau_pm_fan { struct nouveau_pm_fan {
...@@ -796,6 +799,7 @@ struct drm_nouveau_private { ...@@ -796,6 +799,7 @@ struct drm_nouveau_private {
} vram_type; } vram_type;
uint64_t vram_size; uint64_t vram_size;
uint64_t vram_sys_base; uint64_t vram_sys_base;
bool vram_rank_B;
uint64_t fb_available_size; uint64_t fb_available_size;
uint64_t fb_mappable_pages; uint64_t fb_mappable_pages;
...@@ -927,10 +931,6 @@ extern void nv10_mem_put_tile_region(struct drm_device *dev, ...@@ -927,10 +931,6 @@ extern void nv10_mem_put_tile_region(struct drm_device *dev,
struct nouveau_fence *fence); struct nouveau_fence *fence);
extern const struct ttm_mem_type_manager_func nouveau_vram_manager; extern const struct ttm_mem_type_manager_func nouveau_vram_manager;
extern const struct ttm_mem_type_manager_func nouveau_gart_manager; extern const struct ttm_mem_type_manager_func nouveau_gart_manager;
void nv30_mem_timing_entry(struct drm_device *dev,
struct nouveau_pm_tbl_header *hdr,
struct nouveau_pm_tbl_entry *e, uint8_t magic_number,
struct nouveau_pm_memtiming *timing);
/* nouveau_notifier.c */ /* nouveau_notifier.c */
extern int nouveau_notifier_init_channel(struct nouveau_channel *); extern int nouveau_notifier_init_channel(struct nouveau_channel *);
......
This diff is collapsed.
...@@ -808,6 +808,7 @@ nouveau_pm_init(struct drm_device *dev) ...@@ -808,6 +808,7 @@ nouveau_pm_init(struct drm_device *dev)
ret = nouveau_pm_perflvl_get(dev, &pm->boot); ret = nouveau_pm_perflvl_get(dev, &pm->boot);
if (ret == 0) { if (ret == 0) {
strncpy(pm->boot.name, "boot", 4); strncpy(pm->boot.name, "boot", 4);
pm->boot.timing = &pm->memtimings.boot;
pm->cur = &pm->boot; pm->cur = &pm->boot;
nouveau_pm_perflvl_info(&pm->boot, info, sizeof(info)); nouveau_pm_perflvl_info(&pm->boot, info, sizeof(info));
......
...@@ -207,6 +207,7 @@ nv50_vram_init(struct drm_device *dev) ...@@ -207,6 +207,7 @@ nv50_vram_init(struct drm_device *dev)
break; break;
} }
dev_priv->vram_rank_B = (nv_rd32(dev, NV04_PFB_CFG0) & 0x100) >> 8;
dev_priv->vram_size = nv_rd32(dev, 0x10020c); dev_priv->vram_size = nv_rd32(dev, 0x10020c);
dev_priv->vram_size |= (dev_priv->vram_size & 0xff) << 32; dev_priv->vram_size |= (dev_priv->vram_size & 0xff) << 32;
dev_priv->vram_size &= 0xffffffff00ULL; dev_priv->vram_size &= 0xffffffff00ULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment