summaryrefslogtreecommitdiff
path: root/linux-core/drm_hashtab.c
diff options
context:
space:
mode:
authorThomas Hellstrom <thomas@tungstengraphics.com>2006-07-11 14:37:37 +0000
committerThomas Hellstrom <thomas@tungstengraphics.com>2006-07-11 14:37:37 +0000
commit126673d62afad6da84e833daa644a352d88a5e37 (patch)
tree360d6186280ab586fe748bb9bccc7db298117841 /linux-core/drm_hashtab.c
parenta392349691ec2aa3f83d8a9fc4a485e4dbef4bbe (diff)
Keep hashed user tokens, with the following changes:
32-bit physical device addresses are mapped directly to user-tokens. No duplicate maps are allowed, and the addresses are assumed to be outside of the range 0x10000000 through 0x30000000. The user-token is identical to the 32-bit physical start-address of the map. 64-bit physical device addressed are mapped to user-tokens in the range 0x10000000 to 0x30000000 with page-size increments. The user_token should not be interpreted as an address. Other map types, like upcoming TTM maps are mapped to user-tokens in the range 0x10000000 to 0x30000000 with page-size increments. The user_token should not be interpreted as an address. This keeps compatibility with buggy drivers, while still implementing a hashed map lookup. The SiS and via device driver major bumps are reverted.
Diffstat (limited to 'linux-core/drm_hashtab.c')
-rw-r--r--linux-core/drm_hashtab.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/linux-core/drm_hashtab.c b/linux-core/drm_hashtab.c
index 3be781df..d8c4549e 100644
--- a/linux-core/drm_hashtab.c
+++ b/linux-core/drm_hashtab.c
@@ -128,19 +128,21 @@ drm_ht_insert_item(drm_open_hash_t *ht, drm_hash_item_t *item)
int
drm_ht_just_insert_please(drm_open_hash_t *ht, drm_hash_item_t *item,
- unsigned long seed, int bits)
+ unsigned long seed, int bits, int shift,
+ unsigned long add)
{
int ret;
unsigned long mask = (1 << bits) - 1;
- unsigned long first;
+ unsigned long first, unshifted_key;
- item->key = hash_long(seed, bits);
- first = item->key;
+ unshifted_key = hash_long(seed, bits);
+ first = unshifted_key;
do{
+ item->key = (unshifted_key << shift) + add;
ret = drm_ht_insert_item(ht, item);
if (ret)
- item->key = (item->key + 1) & mask;
- } while(ret && (item->key != first));
+ unshifted_key = (unshifted_key + 1) & mask;
+ } while(ret && (unshifted_key != first));
if (ret) {
DRM_ERROR("Available key bit space exhausted\n");