Module Name: src
Committed By: riastradh
Date: Wed Jul 24 02:00:07 UTC 2013
Modified Files:
src/sys/external/bsd/drm2/dist/drm [riastradh-drm2]: drm_agpsupport.c
Log Message:
Hack up drm_agpsupport.c.
It's a miserable bastard hybrid of NetBSD's and Linux's AGP KPIs, but
it's good enough to make drm_agpsupport.o the first successfully
compiled file in this drm2 mess!
To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.2.4 -r1.1.1.1.2.5 \
src/sys/external/bsd/drm2/dist/drm/drm_agpsupport.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/external/bsd/drm2/dist/drm/drm_agpsupport.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_agpsupport.c:1.1.1.1.2.4 src/sys/external/bsd/drm2/dist/drm/drm_agpsupport.c:1.1.1.1.2.5
--- src/sys/external/bsd/drm2/dist/drm/drm_agpsupport.c:1.1.1.1.2.4 Wed Jul 24 01:58:51 2013
+++ src/sys/external/bsd/drm2/dist/drm/drm_agpsupport.c Wed Jul 24 02:00:07 2013
@@ -61,6 +61,17 @@ int drm_agp_info(struct drm_device *dev,
return -EINVAL;
kern = &dev->agp->agp_info;
+#if __NetBSD__
+ info->agp_version_major = 1;
+ info->agp_version_minor = 0;
+ info->mode = kern->ai_mode;
+ info->aperture_base = kern->ai_aperture_base;
+ info->aperture_size = kern->ai_aperture_size;
+ info->memory_allowed = kern->ai_memory_allowed;
+ info->memory_used = kern->ai_memory_used;
+ info->id_vendor = PCI_VENDOR(kern->ai_devid);
+ info->id_device = PCI_PRODUCT(kern->ai_devid);
+#else
info->agp_version_major = kern->version.major;
info->agp_version_minor = kern->version.minor;
info->mode = kern->mode;
@@ -70,6 +81,7 @@ int drm_agp_info(struct drm_device *dev,
info->memory_used = kern->current_memory << PAGE_SHIFT;
info->id_vendor = kern->device->vendor;
info->id_device = kern->device->device;
+#endif
return 0;
}
@@ -218,14 +230,27 @@ int drm_agp_alloc(struct drm_device *dev
return -ENOMEM;
}
+#ifdef __NetBSD__
+ /* I presume the `+ 1' is there to avoid an id of 0 or something. */
+ entry->handle = (unsigned long)memory->am_id + 1;
+#else
entry->handle = (unsigned long)memory->key + 1;
+#endif
entry->memory = memory;
entry->bound = 0;
entry->pages = pages;
list_add(&entry->head, &dev->agp->memory);
request->handle = entry->handle;
+#ifdef __NetBSD__
+ {
+ struct agp_memory_info info;
+ agp_memory_info(dev->agp->bridge, memory, &info);
+ request->physical = info.ami_physical;
+ }
+#else
request->physical = memory->physical;
+#endif
return 0;
}
@@ -414,17 +439,27 @@ struct drm_agp_head *drm_agp_init(struct
} else {
agp_copy_info(head->bridge, &head->agp_info);
}
+#ifndef __NetBSD__
+ /* Why would anything even attach in this case? */
if (head->agp_info.chipset == NOT_SUPPORTED) {
kfree(head);
return NULL;
}
+#endif
INIT_LIST_HEAD(&head->memory);
+#ifdef __NetBSD__
+ /* Not sure what the other fields are used for... */
+ head->base = head->agp_info.ai_aperture_base;
+#else
head->cant_use_aperture = head->agp_info.cant_use_aperture;
head->page_mask = head->agp_info.page_mask;
head->base = head->agp_info.aper_base;
+#endif
return head;
}
+#ifndef __NetBSD__
+
/**
* Binds a collection of pages into AGP memory at the given offset, returning
* the AGP memory structure containing them.
@@ -468,4 +503,6 @@ drm_agp_bind_pages(struct drm_device *de
}
EXPORT_SYMBOL(drm_agp_bind_pages);
+#endif /* __NetBSD__ */
+
#endif /* __OS_HAS_AGP */