diff options
author | Luca Barbieri <luca@luca-barbieri.com> | 2010-03-28 19:50:22 +0200 |
---|---|---|
committer | Luca Barbieri <luca@luca-barbieri.com> | 2010-03-28 19:59:31 +0200 |
commit | 39a7b13e5bbbefbdfa7713c89896bad589338a46 (patch) | |
tree | a70d2e12e39149bc1e8792dfdc312b1d08134dea | |
parent | ac6dd980feff0e435bdca3d7d38909c50974a101 (diff) |
support pre-nv40 and nv50 ramht entries
-rw-r--r-- | nvlib.h | 38 |
1 files changed, 31 insertions, 7 deletions
@@ -326,20 +326,45 @@ struct nv_device : public nv_region uint32_t ctx; entry.handle = rd32(i * 8); ctx = rd32(i * 8 + 4); - if(ramin->dev->card_type < NV_40) + + if(ramin->dev->card_type < NV_40) { entry.valid = (ctx & (1 << 31)) != 0; - else + entry.engine = (ctx >> 16) & 3; + entry.channel = (ctx >> 24) & (ramin->dev->channels - 1); + entry.instance = (ctx & 0xffff) << 4; + } else if(ramin->dev->card_type < NV_50) { entry.valid = ctx != 0; - entry.instance = (ctx & 0xfffff) << 4; - entry.engine = (ctx >> 20) & 7; - entry.channel = (ctx >> 23) & (ramin->dev->channels - 1); + entry.engine = (ctx >> 20) & 3; + entry.channel = (ctx >> 23) & (ramin->dev->channels - 1);; + entry.instance = (ctx & 0xfffff) << 4; + } else { + entry.valid = ctx != 0; + if((ctx & 3) == 2) { + entry.instance = (ctx & 0xfffff) >> 10; + entry.engine = 2; + } else { + entry.instance = (ctx & 0xfffff) << 4; + entry.engine = (ctx >> 20) & 3; + } + entry.channel = -1; /* TODO: set to the ramht channel */ + } + return entry; } void set_at(unsigned i, const nv_ramht_entry& entry) { + uint32_t ctx; wr32(i * 8, entry.handle); - wr32(i * 8 + 4, (entry.instance >> 4) | (entry.engine << 20) | (entry.channel << 23)); + if(ramin->dev->card_type < NV_40) + ctx = (entry.instance >> 4) | (entry.engine << 16) | (entry.channel << 23); + else if(ramin->dev->card_type < NV_50) + ctx = (entry.instance >> 4) | (entry.engine << 20) | (entry.channel << 24); + else if(entry.engine == 2) + ctx = (entry.instance << 10) | 2; + else + ctx = (entry.instance >> 4) | (entry.engine << 20); + wr32(i * 8 + 4, ctx); } void clear_at(unsigned i) @@ -812,7 +837,6 @@ int nv_find_idle_channel(struct nv_device* dev) } for(unsigned i = 0; i < dev->channels; ++i) { - printf("%i %x %x %x %x\n", enabled[i], gets1[i], puts1[i], gets2[i], puts2[i]); if(enabled[i] && gets1[i] && gets1[i] == puts1[i] && gets2[i] == puts2[i] && gets1[i] == gets2[i]) { idle = i; } |