1 diff -ur /data/deadwood/source/drm-orig/drm_agpsupport.c drm/drm_agpsupport.c
2 --- /data/deadwood/source/drm-orig/drm_agpsupport.c 2011-02-13 19:09:47.000000000 +0100
3 +++ drm/drm_agpsupport.c 2011-09-18 12:14:00.000000000 +0200
8 +#if !defined(__AROS__)
9 #include <linux/module.h>
10 #include <linux/slab.h>
15 +#if !defined(__AROS__)
20 * Get AGP information.
24 kern = &dev->agp->agp_info;
25 +#if !defined(__AROS__)
26 info->agp_version_major = kern->version.major;
27 info->agp_version_minor = kern->version.minor;
29 info->mode = kern->mode;
30 info->aperture_base = kern->aper_base;
31 info->aperture_size = kern->aper_size * 1024 * 1024;
32 +#if !defined(__AROS__)
33 info->memory_allowed = kern->max_memory << PAGE_SHIFT;
34 info->memory_used = kern->current_memory << PAGE_SHIFT;
35 info->id_vendor = kern->device->vendor;
36 info->id_device = kern->device->device;
43 EXPORT_SYMBOL(drm_agp_acquire);
45 +#if !defined(__AROS__)
47 * Acquire the AGP device (ioctl).
51 return drm_agp_acquire((struct drm_device *) file_priv->minor->dev);
56 * Release the AGP device.
58 return drm_agp_enable(dev, *mode);
61 +#if !defined(__AROS__)
63 * Allocate AGP memory.
67 return drm_agp_free(dev, request);
72 * Initialize the AGP resources.
73 diff -ur /data/deadwood/source/drm-orig/drm_cache.c drm/drm_cache.c
74 --- /data/deadwood/source/drm-orig/drm_cache.c 2011-02-13 19:09:47.000000000 +0100
75 +++ drm/drm_cache.c 2011-09-18 10:54:20.000000000 +0200
77 (unsigned long)page_virtual + PAGE_SIZE);
78 kunmap_atomic(page_virtual, KM_USER0);
80 +#elif defined(__AROS__)
81 + /* TODO: Detect if cpu has clflush. If yes, use ClearCacheE on each page */
84 printk(KERN_ERR "Architecture has no drm_cache.c support\n");
86 diff -ur /data/deadwood/source/drm-orig/drm_crtc.c drm/drm_crtc.c
87 --- /data/deadwood/source/drm-orig/drm_crtc.c 2011-09-08 21:07:54.000000000 +0200
88 +++ drm/drm_crtc.c 2011-09-17 08:03:13.000000000 +0200
90 * Dave Airlie <airlied@linux.ie>
91 * Jesse Barnes <jesse.barnes@intel.com>
93 +#if !defined(__AROS__)
94 #include <linux/list.h>
95 #include <linux/slab.h>
102 EXPORT_SYMBOL(drm_mode_create_dithering_property);
104 +#if !defined(__AROS__)
106 * drm_mode_create_dirty_property - create dirty property
111 EXPORT_SYMBOL(drm_mode_create_dirty_info_property);
115 * drm_mode_config_init - initialize DRM mode_configuration structure
118 EXPORT_SYMBOL(drm_mode_config_init);
120 +#if !defined(__AROS__)
121 int drm_mode_group_init(struct drm_device *dev, struct drm_mode_group *group)
123 uint32_t total_objects = 0;
131 * drm_mode_config_cleanup - free up DRM mode_config info
132 @@ -1082,8 +1088,12 @@
133 list_for_each(lh, &file_priv->fbs)
136 +#if !defined(__AROS__)
137 mode_group = &file_priv->master->minor->mode_group;
138 if (file_priv->master->minor->type == DRM_MINOR_CONTROL) {
143 list_for_each(lh, &dev->mode_config.crtc_list)
145 @@ -1124,7 +1134,11 @@
146 if (card_res->count_crtcs >= crtc_count) {
148 crtc_id = (uint32_t __user *)(unsigned long)card_res->crtc_id_ptr;
149 +#if !defined(__AROS__)
150 if (file_priv->master->minor->type == DRM_MINOR_CONTROL) {
154 list_for_each_entry(crtc, &dev->mode_config.crtc_list,
156 DRM_DEBUG_KMS("[CRTC:%d]\n", crtc->base.id);
157 @@ -1151,7 +1165,11 @@
158 if (card_res->count_encoders >= encoder_count) {
160 encoder_id = (uint32_t __user *)(unsigned long)card_res->encoder_id_ptr;
161 +#if !defined(__AROS__)
162 if (file_priv->master->minor->type == DRM_MINOR_CONTROL) {
166 list_for_each_entry(encoder,
167 &dev->mode_config.encoder_list,
169 @@ -1182,7 +1200,11 @@
170 if (card_res->count_connectors >= connector_count) {
172 connector_id = (uint32_t __user *)(unsigned long)card_res->connector_id_ptr;
173 +#if !defined(__AROS__)
174 if (file_priv->master->minor->type == DRM_MINOR_CONTROL) {
178 list_for_each_entry(connector,
179 &dev->mode_config.connector_list,
181 @@ -1776,6 +1798,7 @@
185 +#if !defined(__AROS__)
187 * drm_mode_getfb - get FB info
188 * @inode: inode from the ioctl
189 @@ -2090,6 +2113,7 @@
190 mutex_unlock(&dev->mode_config.mutex);
195 struct drm_property *drm_property_create(struct drm_device *dev, int flags,
196 const char *name, int num_values)
197 @@ -2208,6 +2232,7 @@
199 EXPORT_SYMBOL(drm_connector_property_set_value);
201 +#if !defined(__AROS__)
202 int drm_connector_property_get_value(struct drm_connector *connector,
203 struct drm_property *property, uint64_t *val)
205 @@ -2328,6 +2353,7 @@
206 mutex_unlock(&dev->mode_config.mutex);
211 static struct drm_property_blob *drm_property_create_blob(struct drm_device *dev, int length,
213 @@ -2360,6 +2386,7 @@
217 +#if !defined(__AROS__)
218 int drm_mode_getblob_ioctl(struct drm_device *dev,
219 void *data, struct drm_file *file_priv)
221 @@ -2393,6 +2420,7 @@
222 mutex_unlock(&dev->mode_config.mutex);
227 int drm_mode_connector_update_edid_property(struct drm_connector *connector,
229 @@ -2422,6 +2450,7 @@
231 EXPORT_SYMBOL(drm_mode_connector_update_edid_property);
233 +#if !defined(__AROS__)
234 int drm_mode_connector_property_set_ioctl(struct drm_device *dev,
235 void *data, struct drm_file *file_priv)
237 @@ -2495,6 +2524,7 @@
238 mutex_unlock(&dev->mode_config.mutex);
243 int drm_mode_connector_attach_encoder(struct drm_connector *connector,
244 struct drm_encoder *encoder)
245 @@ -2511,6 +2541,7 @@
247 EXPORT_SYMBOL(drm_mode_connector_attach_encoder);
249 +#if !defined(__AROS__)
250 void drm_mode_connector_detach_encoder(struct drm_connector *connector,
251 struct drm_encoder *encoder)
253 @@ -2525,6 +2556,7 @@
256 EXPORT_SYMBOL(drm_mode_connector_detach_encoder);
259 bool drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc,
261 @@ -2541,6 +2573,7 @@
263 EXPORT_SYMBOL(drm_mode_crtc_set_gamma_size);
265 +#if !defined(__AROS__)
266 int drm_mode_gamma_set_ioctl(struct drm_device *dev,
267 void *data, struct drm_file *file_priv)
269 @@ -2775,3 +2808,4 @@
271 return dev->driver->dumb_destroy(file_priv, dev, args->handle);
274 diff -ur /data/deadwood/source/drm-orig/drm_crtc.h drm/drm_crtc.h
275 --- /data/deadwood/source/drm-orig/drm_crtc.h 2011-09-08 21:08:06.000000000 +0200
276 +++ drm/drm_crtc.h 2011-09-17 08:03:13.000000000 +0200
278 #ifndef __DRM_CRTC_H__
279 #define __DRM_CRTC_H__
281 +#if !defined(__AROS__)
282 #include <linux/i2c.h>
283 #include <linux/spinlock.h>
284 #include <linux/types.h>
285 #include <linux/idr.h>
287 #include <linux/fb.h>
289 +#include "drm_linux_list.h"
296 struct drm_connector {
297 struct drm_device *dev;
298 +#if !defined(__AROS__)
301 struct device_attribute *attr;
302 struct list_head head;
306 /* output poll support */
308 +#if !defined(__AROS__)
309 struct delayed_work output_poll_work;
312 /* pointers to standard properties */
313 struct list_head property_blob_list;
314 diff -ur /data/deadwood/source/drm-orig/drm_crtc_helper.c drm/drm_crtc_helper.c
315 --- /data/deadwood/source/drm-orig/drm_crtc_helper.c 2011-09-08 21:07:54.000000000 +0200
316 +++ drm/drm_crtc_helper.c 2011-09-17 08:03:13.000000000 +0200
319 #include "drm_crtc.h"
320 #include "drm_crtc_helper.h"
321 +#if !defined(__AROS__)
322 #include "drm_fb_helper.h"
324 static bool drm_kms_helper_poll = true;
325 module_param_named(poll, drm_kms_helper_poll, bool, 0600);
328 static void drm_mode_validate_flag(struct drm_connector *connector,
331 connector->funcs->force(connector);
333 connector->status = connector->funcs->detect(connector, true);
334 +#if !defined(__AROS__)
335 drm_kms_helper_poll_enable(dev);
339 if (connector->status == connector_status_disconnected) {
341 (*encoder_funcs->dpms)(encoder, DRM_MODE_DPMS_OFF);
344 +#if !defined(__AROS__)
346 * drm_helper_disable_unused_functions - disable unused objects
351 EXPORT_SYMBOL(drm_helper_disable_unused_functions);
355 * drm_encoder_crtc_ok - can a given crtc drive a given encoder?
356 @@ -430,11 +436,13 @@
357 /* Store real post-adjustment hardware mode. */
358 crtc->hwmode = *adjusted_mode;
360 +#if !defined(__AROS__)
361 /* Calculate and store various constants which
362 * are later needed by vblank and swap-completion
363 * timestamping. They are derived from true hwmode.
365 drm_calc_timestamping_constants(crtc);
368 /* FIXME: add subpixel order */
371 set->connectors[i]->dpms = DRM_MODE_DPMS_ON;
374 +#if !defined(__AROS__)
375 drm_helper_disable_unused_functions(dev);
377 } else if (fb_changed) {
378 set->crtc->x = set->x;
379 set->crtc->y = set->y;
382 EXPORT_SYMBOL(drm_helper_mode_fill_fb_struct);
384 +#if !defined(__AROS__)
385 int drm_helper_resume_force_mode(struct drm_device *dev)
387 struct drm_crtc *crtc;
389 queue_delayed_work(system_nrt_wq, &dev->mode_config.output_poll_work, 0);
391 EXPORT_SYMBOL(drm_helper_hpd_irq_event);
393 diff -ur /data/deadwood/source/drm-orig/drm_crtc_helper.h drm/drm_crtc_helper.h
394 --- /data/deadwood/source/drm-orig/drm_crtc_helper.h 2011-02-13 19:09:51.000000000 +0100
395 +++ drm/drm_crtc_helper.h 2011-09-12 20:46:05.000000000 +0200
397 #ifndef __DRM_CRTC_HELPER_H__
398 #define __DRM_CRTC_HELPER_H__
400 +#if !defined(__AROS__)
401 #include <linux/spinlock.h>
402 #include <linux/types.h>
403 #include <linux/idr.h>
405 #include <linux/fb.h>
407 +#include "drm_compat_funcs.h"
410 enum mode_set_atomic {
411 LEAVE_ATOMIC_MODE_SET,
412 diff -ur /data/deadwood/source/drm-orig/drm_dp_helper.h drm/drm_dp_helper.h
413 --- /data/deadwood/source/drm-orig/drm_dp_helper.h 2011-09-08 21:08:06.000000000 +0200
414 +++ drm/drm_dp_helper.h 2011-09-17 08:03:13.000000000 +0200
416 #ifndef _DRM_DP_HELPER_H_
417 #define _DRM_DP_HELPER_H_
419 +#if !defined(__AROS__)
420 #include <linux/types.h>
421 #include <linux/i2c.h>
423 +#include "drm_compat_types.h"
426 /* From the VESA DisplayPort spec */
428 diff -ur /data/deadwood/source/drm-orig/drm_edid.c drm/drm_edid.c
429 --- /data/deadwood/source/drm-orig/drm_edid.c 2011-09-08 21:07:54.000000000 +0200
430 +++ drm/drm_edid.c 2011-09-17 08:03:13.000000000 +0200
432 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
433 * DEALINGS IN THE SOFTWARE.
435 +#if !defined(__AROS__)
436 #include <linux/kernel.h>
437 #include <linux/slab.h>
438 #include <linux/i2c.h>
441 #include "drm_edid.h"
442 #include "drm_edid_modes.h"
446 printk(KERN_ERR "Raw EDID:\n");
447 +#if !defined(__AROS__)
448 print_hex_dump(KERN_ERR, " \t", DUMP_PREFIX_NONE, 16, 1,
449 raw_edid, EDID_LENGTH, false);
456 int i, j = 0, valid_extensions = 0;
458 +#if defined(__AROS__)
459 + int allocsize = EDID_LENGTH;
462 if ((block = kmalloc(EDID_LENGTH, GFP_KERNEL)) == NULL)
465 if (block[0x7e] == 0)
468 +#if !defined(__AROS__)
469 new = krealloc(block, (block[0x7e] + 1) * EDID_LENGTH, GFP_KERNEL);
471 + new = kzalloc((block[0x7e] + 1) * EDID_LENGTH, GFP_KERNEL);
472 + memcpy(new, block, allocsize);
473 + allocsize = (block[0x7e] + 1) * EDID_LENGTH;
480 if (valid_extensions != block[0x7e]) {
481 block[EDID_LENGTH-1] += block[0x7e] - valid_extensions;
482 block[0x7e] = valid_extensions;
483 +#if !defined(__AROS__)
484 new = krealloc(block, (valid_extensions + 1) * EDID_LENGTH, GFP_KERNEL);
486 + new = kzalloc((valid_extensions + 1) * EDID_LENGTH, GFP_KERNEL);
487 + memcpy(new, block, allocsize);
488 + allocsize = (valid_extensions + 1) * EDID_LENGTH;
494 @@ -1607,3 +1628,4 @@
497 EXPORT_SYMBOL(drm_add_modes_noedid);
499 diff -ur /data/deadwood/source/drm-orig/drm_edid.h drm/drm_edid.h
500 --- /data/deadwood/source/drm-orig/drm_edid.h 2011-09-08 21:08:06.000000000 +0200
501 +++ drm/drm_edid.h 2011-09-17 08:03:13.000000000 +0200
503 #ifndef __DRM_EDID_H__
504 #define __DRM_EDID_H__
506 +#if !defined(__AROS__)
507 #include <linux/types.h>
509 +#include "drm_compat_types.h"
512 #define EDID_LENGTH 128
513 #define DDC_ADDR 0x50
514 diff -ur /data/deadwood/source/drm-orig/drm_edid_modes.h drm/drm_edid_modes.h
515 --- /data/deadwood/source/drm-orig/drm_edid_modes.h 2011-09-08 21:07:54.000000000 +0200
516 +++ drm/drm_edid_modes.h 2011-09-17 08:03:13.000000000 +0200
518 * DEALINGS IN THE SOFTWARE.
521 +#if !defined(__AROS__)
522 #include <linux/kernel.h>
525 #include "drm_edid.h"
527 diff -ur /data/deadwood/source/drm-orig/drm_encoder_slave.h drm/drm_encoder_slave.h
528 --- /data/deadwood/source/drm-orig/drm_encoder_slave.h 2011-02-13 19:09:51.000000000 +0100
529 +++ drm/drm_encoder_slave.h 2011-09-12 20:46:05.000000000 +0200
531 static inline int drm_i2c_encoder_register(struct module *owner,
532 struct drm_i2c_encoder_driver *driver)
534 - return i2c_register_driver(owner, &driver->i2c_driver);
535 +//FIXME return i2c_register_driver(owner, &driver->i2c_driver);
543 static inline void drm_i2c_encoder_unregister(struct drm_i2c_encoder_driver *driver)
545 - i2c_del_driver(&driver->i2c_driver);
546 +//FIXME i2c_del_driver(&driver->i2c_driver);
550 void drm_i2c_encoder_destroy(struct drm_encoder *encoder);
551 diff -ur /data/deadwood/source/drm-orig/drm_gem.c drm/drm_gem.c
552 --- /data/deadwood/source/drm-orig/drm_gem.c 2011-09-08 21:07:54.000000000 +0200
553 +++ drm/drm_gem.c 2011-09-17 08:03:13.000000000 +0200
558 +#if !defined(__AROS__)
559 #include <linux/types.h>
560 #include <linux/slab.h>
561 #include <linux/mm.h>
563 #include <linux/mman.h>
564 #include <linux/pagemap.h>
565 #include <linux/shmem_fs.h>
572 drm_gem_init(struct drm_device *dev)
574 +#if !defined(__AROS__)
575 struct drm_gem_mm *mm;
578 spin_lock_init(&dev->object_name_lock);
579 idr_init(&dev->object_name_idr);
581 +#if !defined(__AROS__)
582 mm = kzalloc(sizeof(struct drm_gem_mm), GFP_KERNEL);
584 DRM_ERROR("out of memory\n");
585 @@ -113,10 +118,12 @@
594 +#if !defined(__AROS__)
596 drm_gem_destroy(struct drm_device *dev)
600 dev->mm_private = NULL;
605 * Initialize an already allocated GEM object of the specified size with
607 BUG_ON((size & (PAGE_SIZE - 1)) != 0);
610 +#if !defined(__AROS__)
611 obj->filp = shmem_file_setup("drm mm object", size, VM_NORESERVE);
612 if (IS_ERR(obj->filp))
615 + /* No swapping under AROS. Set to NULL to detect any problems */
619 kref_init(&obj->refcount);
620 atomic_set(&obj->handle_count, 0);
625 +#if !defined(__AROS__)
626 /* Object_init mangles the global counters - readjust them. */
636 +#if !defined(__AROS__)
638 * Called at device open time, sets up the structure for handling refcounting
640 @@ -461,12 +477,15 @@
641 idr_remove_all(&file_private->object_idr);
642 idr_destroy(&file_private->object_idr);
647 drm_gem_object_release(struct drm_gem_object *obj)
649 +#if !defined(__AROS__)
654 EXPORT_SYMBOL(drm_gem_object_release);
657 struct drm_gem_object *obj = (struct drm_gem_object *) kref;
658 struct drm_device *dev = obj->dev;
660 - BUG_ON(!mutex_is_locked(&dev->struct_mutex));
661 +//FIXME BUG_ON(!mutex_is_locked(&dev->struct_mutex));
663 if (dev->driver->gem_free_object != NULL)
664 dev->driver->gem_free_object(obj);
667 EXPORT_SYMBOL(drm_gem_object_handle_free);
669 +#if !defined(__AROS__)
670 void drm_gem_vm_open(struct vm_area_struct *vma)
672 struct drm_gem_object *obj = vma->vm_private_data;
676 EXPORT_SYMBOL(drm_gem_mmap);
678 diff -ur /data/deadwood/source/drm-orig/drm_global.c drm/drm_global.c
679 --- /data/deadwood/source/drm-orig/drm_global.c 2011-02-13 19:09:47.000000000 +0100
680 +++ drm/drm_global.c 2011-09-17 08:03:13.000000000 +0200
682 * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
685 +#if !defined(__AROS__)
686 #include <linux/mutex.h>
687 #include <linux/slab.h>
688 #include <linux/module.h>
690 +#include "drm_compat_funcs.h"
692 #include "drm_global.h"
694 struct drm_global_item {
698 struct drm_global_item *item = &glob[ref->global_type];
701 mutex_lock(&item->mutex);
702 if (item->refcount == 0) {
706 ref->object = item->object;
707 - object = item->object;
708 mutex_unlock(&item->mutex);
711 diff -ur /data/deadwood/source/drm-orig/drm.h drm/drm.h
712 --- /data/deadwood/source/drm-orig/drm.h 2011-09-08 21:08:06.000000000 +0200
713 +++ drm/drm.h 2011-09-17 08:03:13.000000000 +0200
717 #if defined(__linux__)
719 #include <linux/types.h>
720 #include <asm/ioctl.h>
721 typedef unsigned int drm_handle_t;
723 +#elif defined(__AROS__)
724 +#include <sys/ioctl.h>
725 +#include "drm_compat_types.h"
726 +typedef unsigned int drm_handle_t;
728 #else /* One of the BSDs */
730 #include <sys/ioccom.h>
731 diff -ur /data/deadwood/source/drm-orig/drm_hashtab.h drm/drm_hashtab.h
732 --- /data/deadwood/source/drm-orig/drm_hashtab.h 2011-09-08 21:08:06.000000000 +0200
733 +++ drm/drm_hashtab.h 2011-09-17 08:03:13.000000000 +0200
735 #ifndef DRM_HASHTAB_H
736 #define DRM_HASHTAB_H
738 +#if !defined(__AROS__)
739 #include <linux/list.h>
741 +#include "drm_compat_types.h"
744 #define drm_hash_entry(_ptr, _type, _member) container_of(_ptr, _type, _member)
746 struct drm_hash_item {
747 - struct hlist_node head;
748 +//FIXME: struct hlist_node head;
752 struct drm_open_hash {
753 - struct hlist_head *table;
754 +//FIXME: struct hlist_head *table;
758 diff -ur /data/deadwood/source/drm-orig/drm_irq.c drm/drm_irq.c
759 --- /data/deadwood/source/drm-orig/drm_irq.c 2011-09-08 21:07:54.000000000 +0200
760 +++ drm/drm_irq.c 2011-09-23 18:31:47.000000000 +0200
765 +#if !defined(__AROS__)
766 #include "drm_trace.h"
768 #include <linux/interrupt.h> /* For task queue support */
769 #include <linux/slab.h>
771 #include <linux/vgaarb.h>
773 +#include "drm_aros.h"
775 +#include <proto/oop.h>
776 +#include <hidd/pci.h>
779 +#if !defined(__AROS__)
780 /* Access macro for slots in vblank timestamp ringbuffer. */
781 #define vblanktimestamp(dev, crtc, count) ( \
782 (dev)->_vblank_time[(crtc) * DRM_VBLANKTIME_RBSIZE + \
784 dev->driver->irq_postinstall(dev);
790 * Install IRQ handler.
792 * \c drm_driver_irq_preinstall() and \c drm_driver_irq_postinstall() functions
793 * before and after the installation.
795 +#if !defined(__AROS__)
796 int drm_irq_install(struct drm_device *dev)
802 EXPORT_SYMBOL(drm_irq_install);
804 +static AROS_INTH1(interrupt_handler, struct drm_device *, dev)
807 + if (dev->driver->irq_handler)
808 + dev->driver->irq_handler(dev);
813 +int drm_irq_install(struct drm_device *dev)
818 + ObtainSemaphore(&dev->struct_mutex.semaphore);
819 + if (dev->irq_enabled) {
820 + ReleaseSemaphore(&dev->struct_mutex.semaphore);
823 + dev->irq_enabled = 1;
824 + ReleaseSemaphore(&dev->struct_mutex.semaphore);
826 + if (dev->driver->irq_preinstall)
827 + dev->driver->irq_preinstall(dev);
829 + dev->IntHandler.is_Node.ln_Type = NT_INTERRUPT;
830 + dev->IntHandler.is_Node.ln_Pri = 10;
831 + dev->IntHandler.is_Node.ln_Name = "Gallium3D INT Handler";
832 + dev->IntHandler.is_Code = (VOID_FUNC)interrupt_handler;
833 + dev->IntHandler.is_Data = dev;
835 + OOP_GetAttr((OOP_Object *)dev->pdev->oopdev, aHidd_PCIDevice_INTLine, &INTLine);
836 + DRM_DEBUG("INTLine: %d\n", INTLine);
838 + AddIntServer(INTB_KERNEL + INTLine, &dev->IntHandler);
840 + if (dev->driver->irq_postinstall)
842 + retval = dev->driver->irq_postinstall(dev);
845 + ObtainSemaphore(&dev->struct_mutex.semaphore);
846 + dev->irq_enabled = 0;
847 + ReleaseSemaphore(&dev->struct_mutex.semaphore);
855 +#if !defined(__AROS__)
857 * Uninstall the IRQ handler.
862 EXPORT_SYMBOL(drm_irq_uninstall);
864 +int drm_irq_uninstall(struct drm_device *dev)
867 + int retval = -EINVAL;
870 + ObtainSemaphore(&dev->struct_mutex.semaphore);
871 + irq_enabled = dev->irq_enabled;
872 + dev->irq_enabled = 0;
873 + ReleaseSemaphore(&dev->struct_mutex.semaphore);
878 + if (dev->driver->irq_uninstall)
879 + dev->driver->irq_uninstall(dev);
881 + OOP_GetAttr((OOP_Object *)dev->pdev->oopdev, aHidd_PCIDevice_INTLine, &INTLine);
882 + DRM_DEBUG("INTLine: %d\n", INTLine);
884 + RemIntServer(INTB_KERNEL + INTLine, &dev->IntHandler);
890 +#if !defined(__AROS__)
894 @@ -1349,3 +1438,4 @@
897 EXPORT_SYMBOL(drm_handle_vblank);
899 diff -ur /data/deadwood/source/drm-orig/drm_memory.c drm/drm_memory.c
900 --- /data/deadwood/source/drm-orig/drm_memory.c 2011-02-13 19:09:47.000000000 +0100
901 +++ drm/drm_memory.c 2011-09-17 08:03:13.000000000 +0200
903 * OTHER DEALINGS IN THE SOFTWARE.
906 +#if !defined(__AROS__)
907 #include <linux/highmem.h>
916 +#if !defined(__AROS__)
917 static void *agp_remap(unsigned long offset, unsigned long size,
918 struct drm_device * dev)
926 /** Wrapper around agp_free_memory() */
927 void drm_free_agp(DRM_AGP_MEM * handle, int pages)
928 @@ -106,11 +110,13 @@
930 EXPORT_SYMBOL(drm_free_agp);
932 +#if !defined(__AROS__)
933 /** Wrapper around agp_bind_memory() */
934 int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start)
936 return agp_bind_memory(handle, start);
940 /** Wrapper around agp_unbind_memory() */
941 int drm_unbind_agp(DRM_AGP_MEM * handle)
944 EXPORT_SYMBOL(drm_unbind_agp);
946 +static inline void *agp_remap(unsigned long offset, unsigned long size,
947 + struct drm_device * dev)
953 #else /* __OS_HAS_AGP */
954 static inline void *agp_remap(unsigned long offset, unsigned long size,
955 struct drm_device * dev)
956 diff -ur /data/deadwood/source/drm-orig/drm_mm.c drm/drm_mm.c
957 --- /data/deadwood/source/drm-orig/drm_mm.c 2011-09-08 21:07:54.000000000 +0200
958 +++ drm/drm_mm.c 2011-09-18 15:10:34.000000000 +0200
963 +#if !defined(__AROS__)
964 #include <linux/slab.h>
965 #include <linux/seq_file.h>
967 +#include "drm_compat_funcs.h"
970 #define MM_UNUSED_TARGET 4
974 EXPORT_SYMBOL(drm_mm_dump_table);
977 +#if defined(__AROS__)
978 +int drm_mm_get_free_space_size(const struct drm_mm *mm)
980 + struct drm_mm_node *entry;
981 + int total_free = 0;
983 + list_for_each_entry(entry, &mm->hole_stack, hole_stack) {
984 + BUG_ON(!entry->hole_follows);
985 + total_free += drm_mm_hole_node_end(entry) - drm_mm_hole_node_start(entry);
990 +EXPORT_SYMBOL(drm_mm_get_free_space);
992 diff -ur /data/deadwood/source/drm-orig/drm_mm.h drm/drm_mm.h
993 --- /data/deadwood/source/drm-orig/drm_mm.h 2011-09-08 21:08:06.000000000 +0200
994 +++ drm/drm_mm.h 2011-09-18 15:10:41.000000000 +0200
997 * Generic range manager structs
999 +#if !defined(__AROS__)
1000 #include <linux/list.h>
1001 #ifdef CONFIG_DEBUG_FS
1002 #include <linux/seq_file.h>
1005 +#include "drm_compat_types.h"
1006 +#include "drm_linux_list.h"
1009 struct drm_mm_node {
1010 struct list_head node_list;
1012 int drm_mm_dump_table(struct seq_file *m, struct drm_mm *mm);
1015 +#if defined(__AROS__)
1016 +int drm_mm_get_free_space_size(const struct drm_mm *mm);
1020 diff -ur /data/deadwood/source/drm-orig/drm_modes.c drm/drm_modes.c
1021 --- /data/deadwood/source/drm-orig/drm_modes.c 2011-09-08 21:07:54.000000000 +0200
1022 +++ drm/drm_modes.c 2011-09-17 08:03:13.000000000 +0200
1024 * authorization from the copyright holder(s) and author(s).
1027 +#if !defined(__AROS__)
1028 #include <linux/list.h>
1029 #include <linux/list_sort.h>
1033 #include "drm_crtc.h"
1035 struct drm_display_mode *b = list_entry(lh_b, struct drm_display_mode, head);
1038 +#if !defined(__AROS__)
1039 diff = ((b->type & DRM_MODE_TYPE_PREFERRED) != 0) -
1040 ((a->type & DRM_MODE_TYPE_PREFERRED) != 0);
1042 @@ -914,6 +917,16 @@
1043 diff = b->hdisplay * b->vdisplay - a->hdisplay * a->vdisplay;
1047 + diff = b->hdisplay - a->hdisplay;
1051 + diff = b->vdisplay - a->vdisplay;
1056 diff = b->clock - a->clock;
1061 EXPORT_SYMBOL(drm_mode_connector_list_update);
1063 +#if !defined(__AROS__)
1065 * drm_mode_parse_command_line_for_connector - parse command line for connector
1066 * @mode_option - per connector mode option
1067 @@ -1163,3 +1177,4 @@
1070 EXPORT_SYMBOL(drm_mode_create_from_cmdline_mode);
1072 diff -ur /data/deadwood/source/drm-orig/nouveau/nouveau_bios.c drm/nouveau/nouveau_bios.c
1073 --- /data/deadwood/source/drm-orig/nouveau/nouveau_bios.c 2011-09-08 21:07:54.000000000 +0200
1074 +++ drm/nouveau/nouveau_bios.c 2011-09-18 12:14:49.000000000 +0200
1076 #include "nouveau_hw.h"
1077 #include "nouveau_encoder.h"
1079 +#if !defined(__AROS__)
1080 #include <linux/io-mapping.h>
1083 /* these defines are made up */
1084 #define NV_CIO_CRE_44_HEADA 0x0
1087 static void load_vbios_pci(struct drm_device *dev, uint8_t *data)
1089 +#if !defined(__AROS__)
1090 void __iomem *rom = NULL;
1093 @@ -176,10 +179,14 @@
1096 pci_disable_rom(dev->pdev);
1102 static void load_vbios_acpi(struct drm_device *dev, uint8_t *data)
1104 +#if !defined(__AROS__)
1107 int size = 64 * 1024;
1118 @@ -1452,17 +1462,24 @@
1119 * "mask n" and OR it with "data n" before writing it back to the device
1122 +#if !defined(__AROS__)
1123 struct drm_device *dev = bios->dev;
1124 uint8_t i2c_index = bios->data[offset + 1];
1125 uint8_t i2c_address = bios->data[offset + 2] >> 1;
1127 uint8_t count = bios->data[offset + 3];
1128 +#if !defined(__AROS__)
1129 struct nouveau_i2c_chan *chan;
1131 int len = 4 + count * 3;
1132 +#if !defined(__AROS__)
1136 if (!iexec->execute)
1139 +#if !defined(__AROS__)
1140 BIOSLOG(bios, "0x%04X: DCBI2CIndex: 0x%02X, I2CAddress: 0x%02X, "
1142 offset, i2c_index, i2c_address, count);
1143 @@ -1506,6 +1523,10 @@
1154 @@ -1527,17 +1548,24 @@
1155 * "DCB I2C table entry index", set the register to "data n"
1158 +#if !defined(__AROS__)
1159 struct drm_device *dev = bios->dev;
1160 uint8_t i2c_index = bios->data[offset + 1];
1161 uint8_t i2c_address = bios->data[offset + 2] >> 1;
1163 uint8_t count = bios->data[offset + 3];
1164 +#if !defined(__AROS__)
1165 struct nouveau_i2c_chan *chan;
1167 int len = 4 + count * 2;
1168 +#if !defined(__AROS__)
1172 if (!iexec->execute)
1175 +#if !defined(__AROS__)
1176 BIOSLOG(bios, "0x%04X: DCBI2CIndex: 0x%02X, I2CAddress: 0x%02X, "
1178 offset, i2c_index, i2c_address, count);
1179 @@ -1570,6 +1598,10 @@
1190 @@ -2037,6 +2069,7 @@
1192 init_i2c_if(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1194 +#if !defined(__AROS__)
1196 * INIT_I2C_IF opcode: 0x5E ('^')
1198 @@ -2088,6 +2121,9 @@
1199 offset, reg, val.byte, mask, data);
1201 iexec->execute = ((val.byte & mask) == data);
1208 @@ -6918,11 +6954,16 @@
1211 if (!NVInitVBIOS(dev))
1212 +#if !defined(MOCK_HARDWARE)
1215 ret = nouveau_parse_vbios_struct(dev);
1220 + bios->major_version = 6;
1223 ret = parse_dcb_table(dev, bios);
1225 diff -ur /data/deadwood/source/drm-orig/nouveau/nouveau_bo_renamed.c drm/nouveau/nouveau_bo_renamed.c
1226 --- /data/deadwood/source/drm-orig/nouveau/nouveau_bo_renamed.c 2011-09-08 21:07:54.000000000 +0200
1227 +++ drm/nouveau/nouveau_bo_renamed.c 2011-09-18 16:36:19.000000000 +0200
1229 #include "nouveau_drm.h"
1230 #include "nouveau_drv.h"
1231 #include "nouveau_dma.h"
1232 -#include "nouveau_mm.h"
1233 +#include "nouveau_mm_renamed.h"
1234 #include "nouveau_vm.h"
1236 +#if !defined(__AROS__)
1237 #include <linux/log2.h>
1238 #include <linux/slab.h>
1242 nouveau_bo_del_ttm(struct ttm_buffer_object *bo)
1243 diff -ur /data/deadwood/source/drm-orig/nouveau/nouveau_calc.c drm/nouveau/nouveau_calc.c
1244 --- /data/deadwood/source/drm-orig/nouveau/nouveau_calc.c 2011-02-13 19:09:48.000000000 +0100
1245 +++ drm/nouveau/nouveau_calc.c 2011-09-17 08:03:13.000000000 +0200
1248 nv04_calc_arb(struct nv_fifo_info *fifo, struct nv_sim_state *arb)
1250 - int pagemiss, cas, width, bpp;
1251 - int nvclks, mclks, pclks, crtpagemiss;
1252 + int pagemiss, cas, bpp;
1253 + int nvclks, mclks, crtpagemiss;
1254 int found, mclk_extra, mclk_loop, cbs, m1, p1;
1255 int mclk_freq, pclk_freq, nvclk_freq;
1256 int us_m, us_n, us_p, crtc_drain_rate;
1258 nvclk_freq = arb->nvclk_khz;
1259 pagemiss = arb->mem_page_miss;
1260 cas = arb->mem_latency;
1261 - width = arb->memory_width >> 6;
1270 (dev->pci_device & 0xffff) == 0x01f0 /*CHIPSET_NFORCE2*/) {
1273 - pci_read_config_dword(pci_get_bus_and_slot(0, 1), 0x7c, &type);
1274 + pci_read_config_dword(pci_get_bus_and_slot(0, PCI_DEVFN(0, 1)), 0x7c, &type);
1276 sim_data.memory_type = (type >> 12) & 1;
1277 sim_data.memory_width = 64;
1278 diff -ur /data/deadwood/source/drm-orig/nouveau/nouveau_connector.c drm/nouveau/nouveau_connector.c
1279 --- /data/deadwood/source/drm-orig/nouveau/nouveau_connector.c 2011-09-08 21:07:54.000000000 +0200
1280 +++ drm/nouveau/nouveau_connector.c 2011-09-17 08:03:16.000000000 +0200
1285 +#if !defined(__AROS__)
1286 #include <acpi/button.h>
1290 #include "drm_edid.h"
1294 kfree(nv_connector->edid);
1295 +#if !defined(__AROS__)
1296 drm_sysfs_connector_remove(connector);
1298 drm_connector_cleanup(connector);
1302 if (!nv_encoder && !nouveau_tv_disable)
1303 nv_encoder = find_encoder(connector, OUTPUT_TV);
1304 if (nv_encoder && force) {
1305 +#if !defined(MOCK_HARDWARE)
1306 struct drm_encoder *encoder = to_drm_encoder(nv_encoder);
1307 struct drm_encoder_helper_funcs *helper =
1308 encoder->helper_private;
1309 @@ -305,6 +310,10 @@
1310 nouveau_connector_set_encoder(connector, nv_encoder);
1311 return connector_status_connected;
1314 + nouveau_connector_set_encoder(connector, nv_encoder);
1315 + return connector_status_connected;
1321 connector->polled = DRM_CONNECTOR_POLL_CONNECT;
1324 +#if !defined(__AROS__)
1325 drm_sysfs_connector_add(connector);
1328 dcb->drm = connector;
1332 drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF);
1334 +#if !defined(__AROS__)
1335 drm_helper_hpd_irq_event(dev);
1339 diff -ur /data/deadwood/source/drm-orig/nouveau/nouveau_display.c drm/nouveau/nouveau_display.c
1340 --- /data/deadwood/source/drm-orig/nouveau/nouveau_display.c 2011-09-08 21:07:54.000000000 +0200
1341 +++ drm/nouveau/nouveau_display.c 2011-09-17 08:03:13.000000000 +0200
1343 #include "drm_crtc_helper.h"
1344 #include "nouveau_drv.h"
1345 #include "nouveau_fb.h"
1346 +#if !defined(__AROS__)
1347 #include "nouveau_fbcon.h"
1349 #include "nouveau_hw.h"
1350 #include "nouveau_crtc.h"
1351 #include "nouveau_dma.h"
1352 @@ -147,6 +149,14 @@
1353 return &nouveau_fb->base;
1356 +#if defined(__AROS__)
1358 +nouveau_fbcon_output_poll_changed(struct drm_device *dev)
1364 const struct drm_mode_config_funcs nouveau_mode_config_funcs = {
1365 .fb_create = nouveau_user_framebuffer_create,
1366 .output_poll_changed = nouveau_fbcon_output_poll_changed,
1368 NVWriteCRTC(dev, crtc, NV_PCRTC_INTR_EN_0, 0);
1371 +#if !defined(__AROS__)
1373 nouveau_page_flip_reserve(struct nouveau_bo *old_bo,
1374 struct nouveau_bo *new_bo)
1375 @@ -265,11 +276,13 @@
1376 spin_unlock_irqrestore(&dev->event_lock, flags);
1382 nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb,
1383 struct drm_pending_vblank_event *event)
1385 +#if !defined(__AROS__)
1386 struct drm_device *dev = crtc->dev;
1387 struct drm_nouveau_private *dev_priv = dev->dev_private;
1388 struct nouveau_bo *old_bo = nouveau_framebuffer(crtc->fb)->nvbo;
1389 @@ -329,8 +342,13 @@
1394 + /* No-op under AROS */
1399 +#if !defined(__AROS__)
1401 nouveau_finish_page_flip(struct nouveau_channel *chan,
1402 struct nouveau_page_flip_state *ps)
1404 spin_unlock_irqrestore(&dev->event_lock, flags);
1408 diff -ur /data/deadwood/source/drm-orig/nouveau/nouveau_dma.c drm/nouveau/nouveau_dma.c
1409 --- /data/deadwood/source/drm-orig/nouveau/nouveau_dma.c 2011-09-08 21:07:54.000000000 +0200
1410 +++ drm/nouveau/nouveau_dma.c 2011-09-22 20:17:09.000000000 +0200
1412 uint32_t cnt = 0, prev_get = 0;
1414 while (chan->dma.ib_free < count) {
1415 +#if !defined(MOCK_HARDWARE)
1416 uint32_t get = nvchan_rd32(chan, 0x88);
1417 if (get != prev_get) {
1419 @@ -210,6 +211,11 @@
1420 chan->dma.ib_free = get - chan->dma.ib_put;
1421 if (chan->dma.ib_free <= 0)
1422 chan->dma.ib_free += chan->dma.ib_max;
1424 + (void)cnt;(void)prev_get;
1425 + chan->dma.ib_put = 0;
1426 + chan->dma.ib_free = chan->dma.ib_max - chan->dma.ib_put;
1434 while (chan->dma.free < count) {
1435 +#if !defined(MOCK_HARDWARE)
1436 int get = READ_GET(chan, &prev_get, &cnt);
1437 if (unlikely(get < 0)) {
1439 @@ -253,6 +260,12 @@
1442 chan->dma.free = get - chan->dma.cur - 1;
1444 + (void)cnt;(void)prev_get;
1445 + chan->dma.cur = 0;
1446 + chan->dma.put = 0;
1447 + chan->dma.free = chan->dma.max - chan->dma.cur - 1;
1453 return nv50_dma_wait(chan, slots, size);
1455 while (chan->dma.free < size) {
1456 +#if !defined(MOCK_HARDWARE)
1457 get = READ_GET(chan, &prev_get, &cnt);
1458 if (unlikely(get == -EBUSY))
1460 @@ -336,6 +350,13 @@
1461 * here, so this is safe.
1463 chan->dma.free = get - chan->dma.cur - 1;
1465 + (void)get;(void)cnt;(void)prev_get;
1467 + chan->dma.put = NOUVEAU_DMA_SKIPS;
1469 + chan->dma.free = chan->dma.max - chan->dma.cur - 1;
1474 diff -ur /data/deadwood/source/drm-orig/nouveau/nouveau_dp.c drm/nouveau/nouveau_dp.c
1475 --- /data/deadwood/source/drm-orig/nouveau/nouveau_dp.c 2011-09-08 21:07:54.000000000 +0200
1476 +++ drm/nouveau/nouveau_dp.c 2011-09-17 08:03:13.000000000 +0200
1478 return auxch_tx(auxch->dev, auxch->rd, cmd, addr, data, data_nr);
1481 +#if !defined(__AROS__)
1483 nouveau_dp_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
1486 .master_xfer = nouveau_dp_i2c_xfer,
1487 .functionality = nouveau_dp_i2c_func
1490 diff -ur /data/deadwood/source/drm-orig/nouveau/nouveau_drv.h drm/nouveau/nouveau_drv.h
1491 --- /data/deadwood/source/drm-orig/nouveau/nouveau_drv.h 2011-09-08 21:07:54.000000000 +0200
1492 +++ drm/nouveau/nouveau_drv.h 2011-09-18 12:09:51.000000000 +0200
1494 #define NOUVEAU_FAMILY 0x0000FFFF
1495 #define NOUVEAU_FLAGS 0xFFFF0000
1497 +#if defined(__AROS__)
1498 +struct drm_encoder;
1500 +struct drm_connector;
1501 +#include "drm_compat_types.h"
1502 +#include "drm_compat_funcs.h"
1505 #include "ttm/ttm_bo_api.h"
1506 #include "ttm/ttm_bo_driver.h"
1507 #include "ttm/ttm_placement.h"
1508 +#if !defined(__AROS__)
1509 #include "ttm/ttm_memory.h"
1511 #include "ttm/ttm_module.h"
1513 struct nouveau_fpriv {
1516 void __iomem *ioptr = (void __force __iomem *)ttm_kmap_obj_virtual(
1517 &nvbo->kmap, &is_iomem);
1518 - WARN_ON_ONCE(ioptr && !is_iomem);
1519 +//FIXME: WARN_ON_ONCE(ioptr && !is_iomem);
1523 @@ -305,11 +315,11 @@
1524 struct list_head flip;
1528 +/*FIXME:COMMENT struct {
1531 struct drm_info_list info;
1536 struct nouveau_exec_engine {
1539 #define NOUVEAU_PM_MAX_LEVEL 8
1540 struct nouveau_pm_level {
1541 - struct device_attribute dev_attr;
1542 +//FIXME struct device_attribute dev_attr;
1547 struct nouveau_pm_level *cur;
1549 struct device *hwmon;
1550 - struct notifier_block acpi_nb;
1551 +//FIXME struct notifier_block acpi_nb;
1553 int (*clock_get)(struct drm_device *, u32 id);
1554 void *(*clock_pre)(struct drm_device *, struct nouveau_pm_level *,
1555 @@ -862,8 +872,10 @@
1556 extern int nouveau_msi;
1557 extern int nouveau_ctxfw;
1559 +#if !defined(__AROS__)
1560 extern int nouveau_pci_suspend(struct pci_dev *pdev, pm_message_t pm_state);
1561 extern int nouveau_pci_resume(struct pci_dev *pdev);
1564 /* nouveau_state.c */
1565 extern int nouveau_open(struct drm_device *, struct drm_file *);
1566 @@ -1058,7 +1070,7 @@
1568 static inline void nouveau_register_dsm_handler(void) {}
1569 static inline void nouveau_unregister_dsm_handler(void) {}
1570 -static inline bool nouveau_acpi_rom_supported(struct pci_dev *pdev) { return false; }
1571 +//FIXME static inline bool nouveau_acpi_rom_supported(struct pci_dev *pdev) { return false; }
1572 static inline int nouveau_acpi_get_bios_chunk(uint8_t *bios, int offset, int len) { return -EINVAL; }
1573 static inline int nouveau_acpi_edid(struct drm_device *dev, struct drm_connector *connector) { return -EINVAL; }
1575 @@ -1105,7 +1117,7 @@
1577 int nouveau_ttm_global_init(struct drm_nouveau_private *);
1578 void nouveau_ttm_global_release(struct drm_nouveau_private *);
1579 -int nouveau_ttm_mmap(struct file *, struct vm_area_struct *);
1580 +//FIXME:TTM int nouveau_ttm_mmap(struct file *, struct vm_area_struct *);
1583 int nouveau_dp_auxch(struct nouveau_i2c_chan *auxch, int cmd, int addr,
1584 @@ -1467,6 +1479,10 @@
1585 int nva3_calc_pll(struct drm_device *, struct pll_lims *,
1586 int clk, int *N, int *fN, int *M, int *P);
1589 +int nv50_gpio_get(struct drm_device *dev, enum dcb_gpio_tag tag);
1590 +int nv50_gpio_set(struct drm_device *dev, enum dcb_gpio_tag tag, int state);
1592 #ifndef ioread32_native
1594 #define ioread16_native ioread16be
1595 @@ -1553,6 +1569,7 @@
1597 * Argument d is (struct drm_device *).
1600 #define NV_PRINTK(level, d, fmt, arg...) \
1601 printk(level "[" DRM_NAME "] " DRIVER_NAME " %s: " fmt, \
1602 pci_name(d->pdev), ##arg)
1603 @@ -1639,9 +1656,15 @@
1604 nv_match_device(struct drm_device *dev, unsigned device,
1605 unsigned sub_vendor, unsigned sub_device)
1607 +#if !defined(__AROS__)
1608 return dev->pdev->device == device &&
1609 dev->pdev->subsystem_vendor == sub_vendor &&
1610 dev->pdev->subsystem_device == sub_device;
1612 + return dev->driver->ProductID == device &&
1613 + dev->driver->SubSystemVendorID == sub_vendor &&
1614 + dev->driver->SubSystemProductID == sub_device;
1618 static inline void *
1619 diff -ur /data/deadwood/source/drm-orig/nouveau/nouveau_fence_renamed.c drm/nouveau/nouveau_fence_renamed.c
1620 --- /data/deadwood/source/drm-orig/nouveau/nouveau_fence_renamed.c 2011-09-08 21:07:54.000000000 +0200
1621 +++ drm/nouveau/nouveau_fence_renamed.c 2011-09-22 19:03:27.000000000 +0200
1626 +#if !defined(__AROS__)
1627 #include <linux/ktime.h>
1628 #include <linux/hrtimer.h>
1631 #include "nouveau_drv.h"
1632 #include "nouveau_ramht.h"
1635 /* Fetch the last sequence if the channel is still up and running */
1636 if (likely(!list_empty(&chan->fence.pending))) {
1637 +#if defined(MOCK_HARDWARE)
1638 + /* For purpose of simulation, assume all fences are signalled */
1640 + sequence = chan->fence.sequence;
1642 if (USE_REFCNT(dev))
1643 sequence = nvchan_rd32(chan, 0x48);
1645 sequence = atomic_read(&chan->fence.last_sequence_irq);
1648 if (chan->fence.sequence_ack == sequence)
1652 __nouveau_fence_wait(void *sync_obj, void *sync_arg, bool lazy, bool intr)
1654 +#if !defined(__AROS__)
1655 unsigned long timeout = jiffies + (3 * DRM_HZ);
1656 unsigned long sleep_time = NSEC_PER_MSEC / 1000;
1658 @@ -264,6 +273,26 @@
1659 __set_current_state(TASK_RUNNING);
1667 + if (__nouveau_fence_signalled(sync_obj, sync_arg))
1672 + if (counter > 10000)
1674 + NV_INFO(nouveau_fence(sync_obj)->channel->dev, "Waited too long!\n");
1684 static struct nouveau_semaphore *
1685 diff -ur /data/deadwood/source/drm-orig/nouveau/nouveau_hw.c drm/nouveau/nouveau_hw.c
1686 --- /data/deadwood/source/drm-orig/nouveau/nouveau_hw.c 2011-09-08 21:07:54.000000000 +0200
1687 +++ drm/nouveau/nouveau_hw.c 2011-09-18 12:09:51.000000000 +0200
1689 (dev->pci_device & 0x0ff0) == CHIPSET_NFORCE) {
1692 - pci_read_config_dword(pci_get_bus_and_slot(0, 3), 0x6c, &mpllP);
1693 + pci_read_config_dword(pci_get_bus_and_slot(0, PCI_DEVFN(0, 3)), 0x6c, &mpllP);
1698 (dev->pci_device & 0xff0) == CHIPSET_NFORCE2) {
1701 - pci_read_config_dword(pci_get_bus_and_slot(0, 5), 0x4c, &clock);
1702 + pci_read_config_dword(pci_get_bus_and_slot(0, PCI_DEVFN(0, 5)), 0x4c, &clock);
1706 @@ -1019,10 +1019,12 @@
1708 NVWriteCRTC(dev, head, NV_PCRTC_START, regp->fb_start);
1710 +#if !defined(__AROS__)
1711 /* Enable vblank interrupts. */
1712 NVWriteCRTC(dev, head, NV_PCRTC_INTR_EN_0,
1713 (dev->vblank_enabled[head] ? 1 : 0));
1714 NVWriteCRTC(dev, head, NV_PCRTC_INTR_0, NV_PCRTC_INTR_0_VBLANK);
1719 diff -ur /data/deadwood/source/drm-orig/nouveau/nouveau_i2c.c drm/nouveau/nouveau_i2c.c
1720 --- /data/deadwood/source/drm-orig/nouveau/nouveau_i2c.c 2011-09-08 21:07:54.000000000 +0200
1721 +++ drm/nouveau/nouveau_i2c.c 2011-09-17 08:03:13.000000000 +0200
1723 #include "nouveau_i2c.h"
1724 #include "nouveau_hw.h"
1726 +#if defined(__AROS__)
1727 +#include <proto/oop.h>
1728 +#include <oop/oop.h>
1730 +/* FIXME: Duplicate defines here. Don't include nouveau_intern.h */
1731 +/* Ugly hack actually */
1732 +#define CLID_Hidd_I2C_Nouveau "hidd.i2c.nouveau"
1733 +#define IID_Hidd_I2C_Nouveau "hidd.i2c.nouveau"
1735 +#define HiddI2CNouveauAttrBase __IHidd_I2C_Nouveau
1736 +#define aoHidd_I2C_Nouveau_Chan 0
1737 +#define aHidd_I2C_Nouveau_Chan (HiddI2CNouveauAttrBase + aoHidd_I2C_Nouveau_Chan)
1739 +OOP_AttrBase HiddI2CNouveauAttrBase = 0;
1743 nv04_i2c_setscl(void *data, int state)
1745 @@ -227,22 +243,52 @@
1749 +#if !defined(__AROS__)
1750 snprintf(i2c->adapter.name, sizeof(i2c->adapter.name),
1751 "nouveau-%s-%d", pci_name(dev->pdev), index);
1752 i2c->adapter.owner = THIS_MODULE;
1753 i2c->adapter.dev.parent = &dev->pdev->dev;
1756 +#if !defined(__AROS__)
1757 i2c_set_adapdata(&i2c->adapter, i2c);
1760 if (entry->port_type < 6) {
1761 +#if !defined(__AROS__)
1762 i2c->adapter.algo_data = &i2c->bit;
1763 i2c->bit.udelay = 40;
1764 i2c->bit.timeout = usecs_to_jiffies(5000);
1765 i2c->bit.data = i2c;
1766 ret = i2c_bit_add_bus(&i2c->adapter);
1770 + if (HiddI2CNouveauAttrBase == 0)
1771 + HiddI2CNouveauAttrBase = OOP_ObtainAttrBase((STRPTR)IID_Hidd_I2C_Nouveau);
1773 + struct TagItem i2c_attrs[] =
1775 + { aHidd_I2C_Nouveau_Chan, (IPTR)i2c },
1779 + i2c->adapter.i2cdriver = (IPTR)OOP_NewObject(NULL, CLID_Hidd_I2C_Nouveau, i2c_attrs);
1780 + if (i2c->adapter.i2cdriver == (IPTR)0)
1782 + NV_ERROR(dev, "Failed to create CLID_Hidd_I2C_Nouveau object\n");
1788 +#if !defined(__AROS__)
1789 i2c->adapter.algo = &nouveau_dp_i2c_algo;
1790 ret = i2c_add_adapter(&i2c->adapter);
1793 +IMPLEMENT("Handling for (entry->port_type >= 6)\n");
1798 diff -ur /data/deadwood/source/drm-orig/nouveau/nouveau_i2c.h drm/nouveau/nouveau_i2c.h
1799 --- /data/deadwood/source/drm-orig/nouveau/nouveau_i2c.h 2011-02-13 19:09:48.000000000 +0100
1800 +++ drm/nouveau/nouveau_i2c.h 2011-09-12 20:46:05.000000000 +0200
1802 #ifndef __NOUVEAU_I2C_H__
1803 #define __NOUVEAU_I2C_H__
1805 +#if !defined(__AROS__)
1806 #include <linux/i2c.h>
1807 #include <linux/i2c-algo-bit.h>
1809 #include "drm_dp_helper.h"
1811 struct dcb_i2c_entry;
1812 diff -ur /data/deadwood/source/drm-orig/nouveau/nouveau_irq.c drm/nouveau/nouveau_irq.c
1813 --- /data/deadwood/source/drm-orig/nouveau/nouveau_irq.c 2011-09-08 21:07:54.000000000 +0200
1814 +++ drm/nouveau/nouveau_irq.c 2011-09-17 08:03:13.000000000 +0200
1815 @@ -104,14 +104,20 @@
1816 nouveau_irq_init(struct drm_device *dev)
1818 struct drm_nouveau_private *dev_priv = dev->dev_private;
1819 +#if !defined(__AROS__)
1823 if (nouveau_msi != 0 && dev_priv->card_type >= NV_50) {
1824 +#if !defined(__AROS__)
1825 ret = pci_enable_msi(dev->pdev);
1827 NV_INFO(dev, "enabled MSI\n");
1828 dev_priv->msi_enabled = true;
1831 +IMPLEMENT("Enabling MSI\n");
1835 return drm_irq_install(dev);
1836 @@ -124,7 +130,11 @@
1838 drm_irq_uninstall(dev);
1839 if (dev_priv->msi_enabled)
1840 +#if !defined(__AROS__)
1841 pci_disable_msi(dev->pdev);
1843 +IMPLEMENT("Disabling MSI\n");
1848 diff -ur /data/deadwood/source/drm-orig/nouveau/nouveau_mem.c drm/nouveau/nouveau_mem.c
1849 --- /data/deadwood/source/drm-orig/nouveau/nouveau_mem.c 2011-09-08 21:07:54.000000000 +0200
1850 +++ drm/nouveau/nouveau_mem.c 2011-09-19 22:57:21.000000000 +0200
1853 #include "nouveau_drv.h"
1854 #include "nouveau_pm.h"
1855 -#include "nouveau_mm.h"
1856 +#include "nouveau_mm_renamed.h"
1857 #include "nouveau_vm.h"
1859 +#if defined(__AROS__)
1860 +#define PCI_AGP_COMMAND_FW 0x0010
1864 * NV10-NV40 tiling helpers
1870 +#if !defined(__AROS__)
1871 if (dev_priv->card_type >= NV_50) {
1872 if (pci_dma_supported(dev->pdev, DMA_BIT_MASK(40)))
1875 ret = pci_set_dma_mask(dev->pdev, DMA_BIT_MASK(dma_bits));
1880 ret = nouveau_ttm_global_init(dev_priv);
1882 @@ -811,12 +817,32 @@
1883 prefix, mm->block_size << 12);
1886 +#if defined(__AROS__)
1888 +nouveau_vram_manager_free_space(struct ttm_mem_type_manager *man)
1890 + struct drm_nouveau_private *dev_priv = nouveau_bdev(man->bdev);
1891 + struct nouveau_mm *mm = &dev_priv->engine.vram.mm;
1894 + mutex_lock(&mm->mutex);
1895 + size = nouveau_mm_get_free_space_size(mm);
1896 + mutex_unlock(&mm->mutex);
1902 const struct ttm_mem_type_manager_func nouveau_vram_manager = {
1903 nouveau_vram_manager_init,
1904 nouveau_vram_manager_fini,
1905 nouveau_vram_manager_new,
1906 nouveau_vram_manager_del,
1907 nouveau_vram_manager_debug
1908 +#if defined(__AROS__)
1910 + nouveau_vram_manager_free_space
1915 @@ -868,10 +894,22 @@
1919 +#if defined(__AROS__)
1921 +nouveau_gart_manager_free_space(struct ttm_mem_type_manager *man)
1927 const struct ttm_mem_type_manager_func nouveau_gart_manager = {
1928 nouveau_gart_manager_init,
1929 nouveau_gart_manager_fini,
1930 nouveau_gart_manager_new,
1931 nouveau_gart_manager_del,
1932 nouveau_gart_manager_debug
1933 +#if defined(__AROS__)
1935 + nouveau_gart_manager_free_space
1938 diff -ur /data/deadwood/source/drm-orig/nouveau/nouveau_mm_renamed.c drm/nouveau/nouveau_mm_renamed.c
1939 --- /data/deadwood/source/drm-orig/nouveau/nouveau_mm_renamed.c 2011-09-08 21:07:54.000000000 +0200
1940 +++ drm/nouveau/nouveau_mm_renamed.c 2011-09-19 22:58:04.000000000 +0200
1944 #include "nouveau_drv.h"
1945 -#include "nouveau_mm.h"
1946 +#include "nouveau_mm_renamed.h"
1949 region_put(struct nouveau_mm *mm, struct nouveau_mm_node *a)
1950 @@ -173,3 +173,18 @@
1955 +#if defined(__AROS__)
1957 +nouveau_mm_get_free_space_size(struct nouveau_mm *mm)
1959 + struct nouveau_mm_node *this;
1962 + list_for_each_entry(this, &mm->free, fl_entry) {
1963 + size += this->length;
1969 diff -ur /data/deadwood/source/drm-orig/nouveau/nouveau_mm_renamed.h drm/nouveau/nouveau_mm_renamed.h
1970 --- /data/deadwood/source/drm-orig/nouveau/nouveau_mm_renamed.h 2011-09-08 21:07:54.000000000 +0200
1971 +++ drm/nouveau/nouveau_mm_renamed.h 2011-09-19 22:18:19.000000000 +0200
1973 int nouveau_mm_get(struct nouveau_mm *, int type, u32 size, u32 size_nc,
1974 u32 align, struct nouveau_mm_node **);
1975 void nouveau_mm_put(struct nouveau_mm *, struct nouveau_mm_node *);
1976 +#if defined(__AROS__)
1977 +int nouveau_mm_get_free_space_size(struct nouveau_mm *);
1980 int nv50_vram_init(struct drm_device *);
1981 void nv50_vram_fini(struct drm_device *);
1982 diff -ur /data/deadwood/source/drm-orig/nouveau/nouveau_sgdma.c drm/nouveau/nouveau_sgdma.c
1983 --- /data/deadwood/source/drm-orig/nouveau/nouveau_sgdma.c 2011-09-08 21:07:54.000000000 +0200
1984 +++ drm/nouveau/nouveau_sgdma.c 2011-09-18 12:09:51.000000000 +0200
1987 #include "nouveau_drv.h"
1988 +#if !defined(__AROS__)
1989 #include <linux/pagemap.h>
1990 #include <linux/slab.h>
1993 #define NV_CTXDMA_PAGE_SHIFT 12
1994 #define NV_CTXDMA_PAGE_SIZE (1 << NV_CTXDMA_PAGE_SHIFT)
1995 @@ -417,7 +419,11 @@
1996 * christmas. The cards before it have them, the cards after
1997 * it have them, why is NV44 so unloved?
1999 +#if !defined(__AROS__)
2000 dev_priv->gart_info.dummy.page = alloc_page(GFP_DMA32 | GFP_KERNEL);
2002 + dev_priv->gart_info.dummy.page = create_page_helper();
2004 if (!dev_priv->gart_info.dummy.page)
2007 diff -ur /data/deadwood/source/drm-orig/nouveau/nouveau_state.c drm/nouveau/nouveau_state.c
2008 --- /data/deadwood/source/drm-orig/nouveau/nouveau_state.c 2011-09-08 21:07:54.000000000 +0200
2009 +++ drm/nouveau/nouveau_state.c 2011-09-24 10:31:41.000000000 +0200
2011 * DEALINGS IN THE SOFTWARE.
2014 +#if !defined(__AROS__)
2015 #include <linux/swab.h>
2016 #include <linux/slab.h>
2020 #include "drm_sarea.h"
2021 #include "drm_crtc_helper.h"
2022 +#if !defined(__AROS__)
2023 #include <linux/vgaarb.h>
2024 #include <linux/vga_switcheroo.h>
2027 #include "nouveau_drv.h"
2028 #include "nouveau_drm.h"
2029 +#if !defined(__AROS__)
2030 #include "nouveau_fbcon.h"
2032 +#include "nouveau_fb.h"
2034 #include "nouveau_ramht.h"
2035 #include "nouveau_pm.h"
2036 #include "nv50_display.h"
2041 +#if !defined(__AROS__)
2043 if (nouveau_modeset == 2) {
2044 engine->display.early_init = nouveau_stub_init;
2045 @@ -508,10 +517,12 @@
2046 engine->display.init = nouveau_stub_init;
2047 engine->display.destroy = nouveau_stub_takedown;
2054 +#if !defined(__AROS__)
2056 nouveau_vga_set_decode(void *priv, bool state)
2060 return VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM;
2064 +#if !defined(__AROS__)
2065 static void nouveau_switcheroo_set_state(struct pci_dev *pdev,
2066 enum vga_switcheroo_state state)
2069 spin_unlock(&dev->count_lock);
2075 nouveau_card_init(struct drm_device *dev)
2076 @@ -574,10 +588,12 @@
2077 struct nouveau_engine *engine;
2080 +#if !defined(__AROS__)
2081 vga_client_register(dev->pdev, dev, NULL, nouveau_vga_set_decode);
2082 vga_switcheroo_register_client(dev->pdev, nouveau_switcheroo_set_state,
2083 nouveau_switcheroo_reprobe,
2084 nouveau_switcheroo_can_switch);
2087 /* Initialise internal driver API hooks */
2088 ret = nouveau_init_engine_ptrs(dev);
2091 goto out_display_early;
2093 +#if !defined(__AROS__)
2094 nouveau_pm_init(dev);
2097 ret = engine->vram.init(dev);
2100 mutex_unlock(&dev_priv->channel->mutex);
2103 +#if !defined(__AROS__)
2104 if (dev->mode_config.num_crtc) {
2105 ret = drm_vblank_init(dev, dev->mode_config.num_crtc);
2107 @@ -786,11 +805,14 @@
2108 nouveau_fbcon_init(dev);
2109 drm_kms_helper_poll_init(dev);
2115 +#if !defined(__AROS__)
2117 nouveau_channel_put_unlocked(&dev_priv->channel);
2120 nouveau_fence_fini(dev);
2122 @@ -829,12 +851,16 @@
2124 engine->vram.takedown(dev);
2126 +#if !defined(__AROS__)
2127 nouveau_pm_fini(dev);
2129 nouveau_bios_takedown(dev);
2131 engine->display.late_takedown(dev);
2133 +#if !defined(__AROS__)
2134 vga_client_register(dev->pdev, NULL, NULL, NULL);
2139 @@ -844,11 +870,13 @@
2140 struct nouveau_engine *engine = &dev_priv->engine;
2143 +#if !defined(__AROS__)
2144 if (dev->mode_config.num_crtc) {
2145 drm_kms_helper_poll_fini(dev);
2146 nouveau_fbcon_fini(dev);
2147 drm_vblank_cleanup(dev);
2151 if (dev_priv->channel) {
2152 nouveau_channel_put_unlocked(&dev_priv->channel);
2153 @@ -892,10 +920,14 @@
2155 nouveau_irq_fini(dev);
2157 +#if !defined(__AROS__)
2158 nouveau_pm_fini(dev);
2160 nouveau_bios_takedown(dev);
2162 +#if !defined(__AROS__)
2163 vga_client_register(dev->pdev, NULL, NULL, NULL);
2168 @@ -978,6 +1010,7 @@
2172 +#if !defined(__AROS__)
2173 static struct apertures_struct *nouveau_get_apertures(struct drm_device *dev)
2175 struct pci_dev *pdev = dev->pdev;
2176 @@ -1019,6 +1052,7 @@
2177 remove_conflicting_framebuffers(dev_priv->apertures, "nouveaufb", primary);
2182 int nouveau_load(struct drm_device *dev, unsigned long flags)
2184 @@ -1149,9 +1183,11 @@
2188 +#if !defined(__AROS__)
2189 ret = nouveau_remove_conflicting_drivers(dev);
2194 /* Map PRAMIN BAR, or on older cards, the aperture within BAR0 */
2195 if (dev_priv->card_type >= NV_40) {
2196 @@ -1207,13 +1243,16 @@
2198 void nouveau_lastclose(struct drm_device *dev)
2200 +#if !defined(__AROS__)
2201 vga_switcheroo_process_delayed_switch();
2205 int nouveau_unload(struct drm_device *dev)
2207 struct drm_nouveau_private *dev_priv = dev->dev_private;
2209 +#if !defined(__AROS__)
2210 nouveau_card_takedown(dev);
2212 iounmap(dev_priv->mmio);
2213 @@ -1221,6 +1260,18 @@
2216 dev->dev_private = NULL;
2220 + nouveau_card_takedown(dev);
2222 + iounmap(dev_priv->mmio);
2223 + iounmap(dev_priv->ramin);
2226 + dev->dev_private = NULL;
2232 @@ -1266,6 +1317,40 @@
2233 case NOUVEAU_GETPARAM_HAS_PAGEFLIP:
2234 getparam->value = dev_priv->card_type < NV_D0;
2236 +#if defined(__AROS__)
2237 + case NOUVEAU_GETPARAM_VRAM_SIZE:
2239 + struct ttm_mem_type_manager * man = &dev_priv->ttm.bdev.man[TTM_PL_VRAM];
2240 + getparam->value = 0;
2241 + if (man && man->func)
2242 + getparam->value = man->size * 4096;
2245 + case NOUVEAU_GETPARAM_GART_SIZE:
2247 + struct ttm_mem_type_manager * man = &dev_priv->ttm.bdev.man[TTM_PL_TT];
2248 + getparam->value = 0;
2250 + getparam->value = man->size * 4096;
2253 + case NOUVEAU_GETPARAM_VRAM_FREE:
2255 + struct ttm_mem_type_manager * man = &dev_priv->ttm.bdev.man[TTM_PL_VRAM];
2256 + getparam->value = 0;
2257 + if (man && man->func)
2258 + getparam->value = man->func->get_free_space_size(man) * 4096;
2261 + case NOUVEAU_GETPARAM_GART_FREE:
2263 + struct ttm_mem_type_manager * man = &dev_priv->ttm.bdev.man[TTM_PL_TT];
2264 + getparam->value = 0;
2265 + if (man && man->func)
2266 + getparam->value = man->func->get_free_space_size(man) * 4096;
2270 case NOUVEAU_GETPARAM_GRAPH_UNITS:
2271 /* NV40 and NV50 versions are quite different, but register
2272 * address is the same. User is supposed to know the card
2273 @@ -1303,6 +1388,7 @@
2274 nouveau_wait_eq(struct drm_device *dev, uint64_t timeout,
2275 uint32_t reg, uint32_t mask, uint32_t val)
2277 +#if !defined(MOCK_HARDWARE) /* Needed by NV50 and up */
2278 struct drm_nouveau_private *dev_priv = dev->dev_private;
2279 struct nouveau_timer_engine *ptimer = &dev_priv->engine.timer;
2280 uint64_t start = ptimer->read(dev);
2281 @@ -1313,6 +1399,9 @@
2282 } while (ptimer->read(dev) - start < timeout);
2290 /* Wait until (value(reg) & mask) != val, up until timeout has hit */
2291 @@ -1320,6 +1409,7 @@
2292 nouveau_wait_ne(struct drm_device *dev, uint64_t timeout,
2293 uint32_t reg, uint32_t mask, uint32_t val)
2295 +#if !defined(MOCK_HARDWARE) /* Needed by NV50 and up */
2296 struct drm_nouveau_private *dev_priv = dev->dev_private;
2297 struct nouveau_timer_engine *ptimer = &dev_priv->engine.timer;
2298 uint64_t start = ptimer->read(dev);
2299 @@ -1330,6 +1420,9 @@
2300 } while (ptimer->read(dev) - start < timeout);
2308 /* Wait until cond(data) == true, up until timeout has hit */
2309 diff -ur /data/deadwood/source/drm-orig/nouveau/nouveau_temp.c drm/nouveau/nouveau_temp.c
2310 --- /data/deadwood/source/drm-orig/nouveau/nouveau_temp.c 2011-09-08 21:07:54.000000000 +0200
2311 +++ drm/nouveau/nouveau_temp.c 2011-09-17 08:03:13.000000000 +0200
2313 temps->fan_boost = 40;
2316 +#if !defined(__AROS__)
2318 probe_monitoring_device(struct nouveau_i2c_chan *i2c,
2319 struct i2c_board_info *info)
2321 nouveau_i2c_identify(dev, "monitoring device", info,
2322 probe_monitoring_device, idx);
2327 nouveau_temp_init(struct drm_device *dev)
2328 @@ -323,7 +325,11 @@
2329 nouveau_temp_vbios_parse(dev, temp);
2332 +#if !defined(__AROS__)
2333 nouveau_temp_probe_i2c(dev);
2335 +IMPLEMENT("Calling nouveau_temp_probe_i2c(dev);\n");
2340 diff -ur /data/deadwood/source/drm-orig/nouveau/nouveau_ttm.c drm/nouveau/nouveau_ttm.c
2341 --- /data/deadwood/source/drm-orig/nouveau/nouveau_ttm.c 2011-02-13 19:09:48.000000000 +0100
2342 +++ drm/nouveau/nouveau_ttm.c 2011-09-12 20:46:05.000000000 +0200
2345 #include "nouveau_drv.h"
2347 +#if !defined(__AROS__)
2349 nouveau_ttm_mmap(struct file *filp, struct vm_area_struct *vma)
2353 return ttm_bo_mmap(filp, vma, &dev_priv->ttm.bdev);
2358 nouveau_ttm_mem_global_init(struct drm_global_reference *ref)
2360 +#if !defined(__AROS__)
2361 return ttm_mem_global_init(ref->object);
2368 nouveau_ttm_mem_global_release(struct drm_global_reference *ref)
2370 +#if !defined(__AROS__)
2371 ttm_mem_global_release(ref->object);
2375 +#if defined(__AROS__)
2376 +struct ttm_mem_global
2383 nouveau_ttm_global_init(struct drm_nouveau_private *dev_priv)
2385 diff -ur /data/deadwood/source/drm-orig/nouveau/nouveau_util.c drm/nouveau/nouveau_util.c
2386 --- /data/deadwood/source/drm-orig/nouveau/nouveau_util.c 2011-03-22 19:10:26.000000000 +0100
2387 +++ drm/nouveau/nouveau_util.c 2011-09-12 20:46:05.000000000 +0200
2392 +#if !defined(__AROS__)
2393 #include <linux/ratelimit.h>
2395 +#include "drm_compat_funcs.h"
2398 #include "nouveau_util.h"
2400 +#if !defined(__AROS__)
2401 static DEFINE_RATELIMIT_STATE(nouveau_ratelimit_state, 3 * HZ, 20);
2405 nouveau_bitfield_print(const struct nouveau_bitfield *bf, u32 value)
2408 nouveau_ratelimit(void)
2410 +#if !defined(__AROS__)
2411 return __ratelimit(&nouveau_ratelimit_state);
2413 +static unsigned int counter = 0;
2414 +return !(counter++ % 50);
2417 diff -ur /data/deadwood/source/drm-orig/nouveau/nouveau_vm.c drm/nouveau/nouveau_vm.c
2418 --- /data/deadwood/source/drm-orig/nouveau/nouveau_vm.c 2011-09-08 21:07:54.000000000 +0200
2419 +++ drm/nouveau/nouveau_vm.c 2011-09-17 08:03:13.000000000 +0200
2423 #include "nouveau_drv.h"
2424 -#include "nouveau_mm.h"
2425 +#include "nouveau_mm_renamed.h"
2426 #include "nouveau_vm.h"
2429 diff -ur /data/deadwood/source/drm-orig/nouveau/nouveau_vm.h drm/nouveau/nouveau_vm.h
2430 --- /data/deadwood/source/drm-orig/nouveau/nouveau_vm.h 2011-09-08 21:07:54.000000000 +0200
2431 +++ drm/nouveau/nouveau_vm.h 2011-09-17 08:03:13.000000000 +0200
2435 #include "nouveau_drv.h"
2436 -#include "nouveau_mm.h"
2437 +#include "nouveau_mm_renamed.h"
2439 struct nouveau_vm_pgt {
2440 struct nouveau_gpuobj *obj[2];
2441 diff -ur /data/deadwood/source/drm-orig/nouveau/nouveau_volt.c drm/nouveau/nouveau_volt.c
2442 --- /data/deadwood/source/drm-orig/nouveau/nouveau_volt.c 2011-09-08 21:07:54.000000000 +0200
2443 +++ drm/nouveau/nouveau_volt.c 2011-09-17 08:03:13.000000000 +0200
2448 +#if !defined(__AROS__)
2450 nouveau_volt_init(struct drm_device *dev)
2454 voltage->supported = true;
2459 nouveau_volt_fini(struct drm_device *dev)
2460 diff -ur /data/deadwood/source/drm-orig/nouveau/nv04_crtc.c drm/nouveau/nv04_crtc.c
2461 --- /data/deadwood/source/drm-orig/nouveau/nv04_crtc.c 2011-09-08 21:07:54.000000000 +0200
2462 +++ drm/nouveau/nv04_crtc.c 2011-09-17 08:03:13.000000000 +0200
2464 #include "nouveau_fb.h"
2465 #include "nouveau_hw.h"
2467 +#if !defined(__AROS__)
2468 #include "nouveau_fbcon.h"
2472 nv04_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
2474 if (nv_two_heads(dev))
2475 NVSetOwner(dev, nv_crtc->index);
2477 +#if !defined(__AROS__)
2478 drm_vblank_pre_modeset(dev, nv_crtc->index);
2480 funcs->dpms(crtc, DRM_MODE_DPMS_OFF);
2482 NVBlankScreen(dev, nv_crtc->index, true);
2486 funcs->dpms(crtc, DRM_MODE_DPMS_ON);
2487 +#if !defined(__AROS__)
2488 drm_vblank_post_modeset(dev, nv_crtc->index);
2492 static void nv_crtc_destroy(struct drm_crtc *crtc)
2494 struct drm_framebuffer *fb,
2495 int x, int y, enum mode_set_atomic state)
2497 +#if !defined(__AROS__)
2498 struct drm_nouveau_private *dev_priv = crtc->dev->dev_private;
2499 struct drm_device *dev = dev_priv->dev;
2502 nouveau_fbcon_save_disable_accel(dev);
2504 nouveau_fbcon_restore_accel(dev);
2507 return nv04_crtc_do_mode_set_base(crtc, fb, x, y, true);
2509 diff -ur /data/deadwood/source/drm-orig/nouveau/nv04_dfp.c drm/nouveau/nv04_dfp.c
2510 --- /data/deadwood/source/drm-orig/nouveau/nv04_dfp.c 2011-03-22 19:10:26.000000000 +0100
2511 +++ drm/nouveau/nv04_dfp.c 2011-09-12 20:46:05.000000000 +0200
2513 #include "nouveau_hw.h"
2516 +#if !defined(__AROS__)
2517 #include "i2c/sil164.h"
2520 #define FP_TG_CONTROL_ON (NV_PRAMDAC_FP_TG_CONTROL_DISPEN_POS | \
2521 NV_PRAMDAC_FP_TG_CONTROL_HSYNC_POS | \
2524 static void nv04_tmds_slave_init(struct drm_encoder *encoder)
2526 +#if !defined(__AROS__)
2527 struct drm_device *dev = encoder->dev;
2528 struct dcb_entry *dcb = nouveau_encoder(encoder)->dcb;
2529 struct nouveau_i2c_chan *i2c = nouveau_i2c_find(dev, 2);
2532 drm_i2c_encoder_init(dev, to_encoder_slave(encoder),
2533 &i2c->adapter, &info[type]);
2539 static const struct drm_encoder_helper_funcs nv04_lvds_helper_funcs = {
2540 diff -ur /data/deadwood/source/drm-orig/nouveau/nv04_display.c drm/nouveau/nv04_display.c
2541 --- /data/deadwood/source/drm-orig/nouveau/nv04_display.c 2011-09-08 21:07:54.000000000 +0200
2542 +++ drm/nouveau/nv04_display.c 2011-09-17 08:03:13.000000000 +0200
2543 @@ -247,12 +247,16 @@
2544 nv04_vblank_crtc0_isr(struct drm_device *dev)
2546 nv_wr32(dev, NV_CRTC0_INTSTAT, NV_CRTC_INTR_VBLANK);
2547 +#if !defined(__AROS__)
2548 drm_handle_vblank(dev, 0);
2553 nv04_vblank_crtc1_isr(struct drm_device *dev)
2555 nv_wr32(dev, NV_CRTC1_INTSTAT, NV_CRTC_INTR_VBLANK);
2556 +#if !defined(__AROS__)
2557 drm_handle_vblank(dev, 1);
2560 diff -ur /data/deadwood/source/drm-orig/nouveau/nv04_graph.c drm/nouveau/nv04_graph.c
2561 --- /data/deadwood/source/drm-orig/nouveau/nv04_graph.c 2011-09-08 21:07:54.000000000 +0200
2562 +++ drm/nouveau/nv04_graph.c 2011-09-17 08:03:13.000000000 +0200
2563 @@ -562,12 +562,14 @@
2564 nv04_graph_mthd_page_flip(struct nouveau_channel *chan,
2565 u32 class, u32 mthd, u32 data)
2567 +#if !defined(__AROS__)
2568 struct drm_device *dev = chan->dev;
2569 struct nouveau_page_flip_state s;
2571 if (!nouveau_finish_page_flip(chan, &s))
2572 nv_set_crtc_base(dev, s.crtc,
2573 s.offset + s.y * s.pitch + s.x * s.bpp / 8);
2578 diff -ur /data/deadwood/source/drm-orig/nouveau/nv04_tv.c drm/nouveau/nv04_tv.c
2579 --- /data/deadwood/source/drm-orig/nouveau/nv04_tv.c 2011-02-13 19:09:48.000000000 +0100
2580 +++ drm/nouveau/nv04_tv.c 2011-09-17 08:03:17.000000000 +0200
2582 #include "nouveau_hw.h"
2583 #include "drm_crtc_helper.h"
2585 +#if !defined(__AROS__)
2586 #include "i2c/ch7006.h"
2588 static struct i2c_board_info nv04_tv_encoder_info[] = {
2594 +static struct i2c_board_info nv04_tv_encoder_info[] = {
2595 + { .type = "ch7006", .addr = 0x75 },
2600 int nv04_tv_identify(struct drm_device *dev, int i2c_index)
2603 (NV_PRAMDAC_PLL_COEFF_SELECT_TV_VSCLK2 \
2604 | NV_PRAMDAC_PLL_COEFF_SELECT_TV_PCLK2)
2606 +#if !defined(__AROS__)
2607 static void nv04_tv_dpms(struct drm_encoder *encoder, int mode)
2609 struct drm_device *dev = encoder->dev;
2610 @@ -179,10 +187,12 @@
2611 static const struct drm_encoder_funcs nv04_tv_funcs = {
2612 .destroy = nv04_tv_destroy,
2617 nv04_tv_create(struct drm_connector *connector, struct dcb_entry *entry)
2619 +#if !defined(__AROS__)
2620 struct nouveau_encoder *nv_encoder;
2621 struct drm_encoder *encoder;
2622 struct drm_device *dev = connector->dev;
2632 diff -ur /data/deadwood/source/drm-orig/nouveau/nv31_mpeg.c drm/nouveau/nv31_mpeg.c
2633 --- /data/deadwood/source/drm-orig/nouveau/nv31_mpeg.c 2011-09-08 21:07:54.000000000 +0200
2634 +++ drm/nouveau/nv31_mpeg.c 2011-09-17 08:03:13.000000000 +0200
2637 struct nv31_mpeg_engine *pmpeg = nv_engine(chan->dev, engine);
2639 - if (!atomic_add_unless(&pmpeg->refcount, 1, 1))
2641 +//FIXME if (!atomic_add_unless(&pmpeg->refcount, 1, 1))
2642 +//FIXME return -EBUSY;
2644 chan->engctx[engine] = (void *)0xdeadcafe;
2646 diff -ur /data/deadwood/source/drm-orig/nouveau/nv50_crtc.c drm/nouveau/nv50_crtc.c
2647 --- /data/deadwood/source/drm-orig/nouveau/nv50_crtc.c 2011-09-08 21:07:54.000000000 +0200
2648 +++ drm/nouveau/nv50_crtc.c 2011-09-19 21:55:53.000000000 +0200
2649 @@ -467,8 +467,12 @@
2651 start = ptimer->read(dev);
2653 +#if !defined(MOCK_HARDWARE)
2654 if (nv_ro32(disp->ntfy, 0x000))
2659 } while (ptimer->read(dev) - start < 2000000000ULL);
2663 NV_DEBUG_KMS(dev, "index %d\n", nv_crtc->index);
2665 nv50_display_flip_stop(crtc);
2666 +#if !defined(__AROS__)
2667 drm_vblank_pre_modeset(dev, nv_crtc->index);
2669 nv50_crtc_blank(nv_crtc, true);
2673 NV_DEBUG_KMS(dev, "index %d\n", nv_crtc->index);
2675 nv50_crtc_blank(nv_crtc, false);
2676 +#if !defined(__AROS__)
2677 drm_vblank_post_modeset(dev, nv_crtc->index);
2679 nv50_crtc_wait_complete(crtc);
2680 nv50_display_flip_next(crtc, crtc->fb, NULL);
2682 diff -ur /data/deadwood/source/drm-orig/nouveau/nv50_display.c drm/nouveau/nv50_display.c
2683 --- /data/deadwood/source/drm-orig/nouveau/nv50_display.c 2011-09-08 21:07:54.000000000 +0200
2684 +++ drm/nouveau/nv50_display.c 2011-09-17 08:03:13.000000000 +0200
2686 #include "nouveau_encoder.h"
2687 #include "nouveau_connector.h"
2688 #include "nouveau_fb.h"
2689 +#if !defined(__AROS__)
2690 #include "nouveau_fbcon.h"
2692 #include "nouveau_ramht.h"
2693 #include "drm_crtc_helper.h"
2699 +#if !defined(__AROS__)
2700 tasklet_init(&priv->tasklet, nv50_display_bh, (unsigned long)dev);
2702 nouveau_irq_register(dev, 26, nv50_display_isr);
2704 ret = nv50_display_init(dev);
2707 nv50_display_flip_stop(struct drm_crtc *crtc)
2709 +#if !defined(__AROS__)
2710 struct nv50_display *disp = nv50_display(crtc->dev);
2711 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
2712 struct nv50_display_crtc *dispc = &disp->crtc[nv_crtc->index];
2713 @@ -386,12 +391,16 @@
2714 BEGIN_RING(evo, 0, 0x0080, 1);
2715 OUT_RING (evo, 0x00000000);
2718 + /* No-op under AROS */
2723 nv50_display_flip_next(struct drm_crtc *crtc, struct drm_framebuffer *fb,
2724 struct nouveau_channel *chan)
2726 +#if !defined(__AROS__)
2727 struct drm_nouveau_private *dev_priv = crtc->dev->dev_private;
2728 struct nouveau_framebuffer *nv_fb = nouveau_framebuffer(fb);
2729 struct nv50_display *disp = nv50_display(crtc->dev);
2732 dispc->sem.offset ^= 0x10;
2735 + /* No-op under AROS */
2740 @@ -592,10 +604,14 @@
2741 nouveau_bo_wr32(chan->notifier_bo, chan->nvsw.vblsem_offset,
2742 chan->nvsw.vblsem_rval);
2743 list_del(&chan->nvsw.vbl_wait);
2744 +#if !defined(__AROS__)
2745 drm_vblank_put(dev, crtc);
2749 +#if !defined(__AROS__)
2750 drm_handle_vblank(dev, crtc);
2757 nv50_display_isr(struct drm_device *dev)
2759 +#if !defined(__AROS__)
2760 struct nv50_display *disp = nv50_display(dev);
2762 uint32_t delayed = 0;
2764 while (nv_rd32(dev, NV50_PMC_INTR_0) & NV50_PMC_INTR_0_DISPLAY) {
2765 @@ -958,7 +976,12 @@
2766 NV50_PDISPLAY_INTR_1_CLK_UNK40));
2768 nv_wr32(dev, NV03_PMC_INTR_EN_0, 0);
2769 +#if !defined(__AROS__)
2770 tasklet_schedule(&disp->tasklet);
2772 + /* Kind of hackish call but it does its job. */
2773 + nv50_display_bh((unsigned long)dev);
2778 diff -ur /data/deadwood/source/drm-orig/nouveau/nv50_display.h drm/nouveau/nv50_display.h
2779 --- /data/deadwood/source/drm-orig/nouveau/nv50_display.h 2011-02-13 19:09:48.000000000 +0100
2780 +++ drm/nouveau/nv50_display.h 2011-09-12 20:46:05.000000000 +0200
2783 struct nv50_display_crtc crtc[2];
2785 +#if !defined(__AROS__)
2786 struct tasklet_struct tasklet;
2789 struct dcb_entry *dcb;
2791 diff -ur /data/deadwood/source/drm-orig/nouveau/nv50_fb.c drm/nouveau/nv50_fb.c
2792 --- /data/deadwood/source/drm-orig/nouveau/nv50_fb.c 2011-09-08 21:07:54.000000000 +0200
2793 +++ drm/nouveau/nv50_fb.c 2011-09-17 08:03:13.000000000 +0200
2798 +#if !defined(__AROS__)
2799 priv->r100c08_page = alloc_page(GFP_KERNEL | __GFP_ZERO);
2801 + priv->r100c08_page = create_page_helper();
2803 if (!priv->r100c08_page) {
2804 nv50_fb_destroy(dev);
2806 diff -ur /data/deadwood/source/drm-orig/nouveau/nv50_gpio.c drm/nouveau/nv50_gpio.c
2807 --- /data/deadwood/source/drm-orig/nouveau/nv50_gpio.c 2011-09-08 21:07:54.000000000 +0200
2808 +++ drm/nouveau/nv50_gpio.c 2011-09-17 08:03:13.000000000 +0200
2810 #include "nv50_display.h"
2812 static void nv50_gpio_isr(struct drm_device *dev);
2813 +#if !defined(__AROS__)
2814 static void nv50_gpio_isr_bh(struct work_struct *work);
2816 +struct nv50_gpio_handler;
2817 +static void nv50_gpio_isr_bh(struct nv50_gpio_handler *gpioh);
2820 struct nv50_gpio_priv {
2821 struct list_head handlers;
2823 struct nv50_gpio_handler {
2824 struct drm_device *dev;
2825 struct list_head head;
2826 +#if !defined(__AROS__)
2827 struct work_struct work;
2831 struct dcb_gpio_entry *gpio;
2836 +#if !defined(__AROS__)
2837 INIT_WORK(&gpioh->work, nv50_gpio_isr_bh);
2841 gpioh->handler = handler;
2842 @@ -181,14 +190,18 @@
2843 gpioh->handler != handler ||
2844 gpioh->data != data)
2846 +#if !defined(__AROS__)
2847 list_move(&gpioh->head, &tofree);
2850 spin_unlock_irqrestore(&priv->lock, flags);
2852 +#if !defined(__AROS__)
2853 list_for_each_entry_safe(gpioh, tmp, &tofree, head) {
2854 flush_work_sync(&gpioh->work);
2861 @@ -274,11 +287,17 @@
2862 nv50_gpio_destroy(dev);
2865 +#if !defined(__AROS__)
2867 nv50_gpio_isr_bh(struct work_struct *work)
2869 struct nv50_gpio_handler *gpioh =
2870 container_of(work, struct nv50_gpio_handler, work);
2873 +nv50_gpio_isr_bh(struct nv50_gpio_handler *gpioh)
2876 struct drm_nouveau_private *dev_priv = gpioh->dev->dev_private;
2877 struct nouveau_gpio_engine *pgpio = &dev_priv->engine.gpio;
2878 struct nv50_gpio_priv *priv = pgpio->priv;
2879 @@ -327,7 +346,12 @@
2881 gpioh->inhibit = true;
2883 +#if !defined(__AROS__)
2884 schedule_work(&gpioh->work);
2886 + /* Kind of hackish call but it does its job. */
2887 + nv50_gpio_isr_bh(gpioh);
2890 spin_unlock(&priv->lock);
2892 diff -ur /data/deadwood/source/drm-orig/nouveau/nv50_graph.c drm/nouveau/nv50_graph.c
2893 --- /data/deadwood/source/drm-orig/nouveau/nv50_graph.c 2011-09-08 21:07:54.000000000 +0200
2894 +++ drm/nouveau/nv50_graph.c 2011-09-17 08:03:13.000000000 +0200
2896 if (!chan->nvsw.vblsem || chan->nvsw.vblsem_offset == ~0 || data > 1)
2899 +#if !defined(__AROS__)
2900 drm_vblank_get(dev, data);
2903 chan->nvsw.vblsem_head = data;
2904 list_add(&chan->nvsw.vbl_wait, &dev_priv->vbl_waiting);
2906 nv50_graph_nvsw_mthd_page_flip(struct nouveau_channel *chan,
2907 u32 class, u32 mthd, u32 data)
2909 +#if !defined(__AROS__)
2910 nouveau_finish_page_flip(chan, NULL);
2915 diff -ur /data/deadwood/source/drm-orig/nouveau/nv50_vram.c drm/nouveau/nv50_vram.c
2916 --- /data/deadwood/source/drm-orig/nouveau/nv50_vram.c 2011-09-08 21:07:54.000000000 +0200
2917 +++ drm/nouveau/nv50_vram.c 2013-09-28 19:35:37.000000000 +0200
2921 #include "nouveau_drv.h"
2922 -#include "nouveau_mm.h"
2923 +#include "nouveau_mm_renamed.h"
2925 static int types[0x80] = {
2926 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2932 + /* Workaround which forces allocation to be contiguous in VRAM.
2933 + Without this some gfx cards cause display corruption, because
2934 + displaying of non contiguous bitmap does not work for whatever
2937 + if (size_nc < size) size_nc = size;
2940 mem = kzalloc(sizeof(*mem), GFP_KERNEL);
2943 diff -ur /data/deadwood/source/drm-orig/nouveau/nva3_copy.c drm/nouveau/nva3_copy.c
2944 --- /data/deadwood/source/drm-orig/nouveau/nva3_copy.c 2011-09-08 21:07:54.000000000 +0200
2945 +++ drm/nouveau/nva3_copy.c 2011-09-17 08:03:13.000000000 +0200
2947 * Authors: Ben Skeggs
2950 +#if !defined(__AROS__)
2951 #include <linux/firmware.h>
2954 #include "nouveau_drv.h"
2955 #include "nouveau_util.h"
2956 diff -ur /data/deadwood/source/drm-orig/nouveau/nvc0_copy.c drm/nouveau/nvc0_copy.c
2957 --- /data/deadwood/source/drm-orig/nouveau/nvc0_copy.c 2011-09-08 21:07:54.000000000 +0200
2958 +++ drm/nouveau/nvc0_copy.c 2011-09-17 08:03:13.000000000 +0200
2960 * Authors: Ben Skeggs
2963 +#if !defined(__AROS__)
2964 #include <linux/firmware.h>
2967 #include "nouveau_drv.h"
2968 #include "nouveau_util.h"
2969 diff -ur /data/deadwood/source/drm-orig/nouveau/nvc0_fb.c drm/nouveau/nvc0_fb.c
2970 --- /data/deadwood/source/drm-orig/nouveau/nvc0_fb.c 2011-09-08 21:07:54.000000000 +0200
2971 +++ drm/nouveau/nvc0_fb.c 2011-09-17 08:03:13.000000000 +0200
2976 +#if !defined(__AROS__)
2977 priv->r100c10_page = alloc_page(GFP_KERNEL | __GFP_ZERO);
2979 + priv->r100c10_page = create_page_helper();
2981 if (!priv->r100c10_page) {
2982 nvc0_fb_destroy(dev);
2984 diff -ur /data/deadwood/source/drm-orig/nouveau/nvc0_fifo.c drm/nouveau/nvc0_fifo.c
2985 --- /data/deadwood/source/drm-orig/nouveau/nvc0_fifo.c 2011-09-08 21:07:54.000000000 +0200
2986 +++ drm/nouveau/nvc0_fifo.c 2011-09-18 12:09:35.000000000 +0200
2990 #include "nouveau_drv.h"
2991 -#include "nouveau_mm.h"
2992 +#include "nouveau_mm_renamed.h"
2994 static void nvc0_fifo_isr(struct drm_device *);
2996 diff -ur /data/deadwood/source/drm-orig/nouveau/nvc0_graph.c drm/nouveau/nvc0_graph.c
2997 --- /data/deadwood/source/drm-orig/nouveau/nvc0_graph.c 2011-09-08 21:07:54.000000000 +0200
2998 +++ drm/nouveau/nvc0_graph.c 2011-09-24 10:51:14.000000000 +0200
3000 * Authors: Ben Skeggs
3003 +#if !defined(__AROS__)
3004 #include <linux/firmware.h>
3009 #include "nouveau_drv.h"
3010 -#include "nouveau_mm.h"
3011 +#include "nouveau_mm_renamed.h"
3013 #include "nvc0_graph.h"
3014 #include "nvc0_grhub.fuc.h"
3016 nvc0_graph_mthd_page_flip(struct nouveau_channel *chan,
3017 u32 class, u32 mthd, u32 data)
3019 +#if !defined(__AROS__)
3020 nouveau_finish_page_flip(chan, NULL);
3026 nv_wr32(dev, 0x400500, 0x00010001);
3029 +#if !defined(__AROS__)
3031 nvc0_graph_create_fw(struct drm_device *dev, const char *fwname,
3032 struct nvc0_graph_fuc *fuc)
3033 @@ -734,18 +739,21 @@
3040 nvc0_graph_destroy(struct drm_device *dev, int engine)
3042 struct nvc0_graph_priv *priv = nv_engine(dev, engine);
3044 +#if !defined(__AROS__)
3045 if (nouveau_ctxfw) {
3046 nvc0_graph_destroy_fw(&priv->fuc409c);
3047 nvc0_graph_destroy_fw(&priv->fuc409d);
3048 nvc0_graph_destroy_fw(&priv->fuc41ac);
3049 nvc0_graph_destroy_fw(&priv->fuc41ad);
3053 nouveau_irq_unregister(dev, 12);
3056 NVOBJ_ENGINE_ADD(dev, GR, &priv->base);
3057 nouveau_irq_register(dev, 12, nvc0_graph_isr);
3059 +#if !defined(__AROS__)
3060 if (nouveau_ctxfw) {
3061 NV_INFO(dev, "PGRAPH: using external firmware\n");
3062 if (nvc0_graph_create_fw(dev, "fuc409c", &priv->fuc409c) ||
3069 ret = nouveau_gpuobj_new(dev, NULL, 0x1000, 256, 0, &priv->unk4188b4);
3071 diff -ur /data/deadwood/source/drm-orig/nouveau/nvc0_grctx.c drm/nouveau/nvc0_grctx.c
3072 --- /data/deadwood/source/drm-orig/nouveau/nvc0_grctx.c 2011-09-08 21:07:54.000000000 +0200
3073 +++ drm/nouveau/nvc0_grctx.c 2011-09-17 08:03:13.000000000 +0200
3077 #include "nouveau_drv.h"
3078 -#include "nouveau_mm.h"
3079 +#include "nouveau_mm_renamed.h"
3080 #include "nvc0_graph.h"
3083 diff -ur /data/deadwood/source/drm-orig/nouveau/nvc0_vram.c drm/nouveau/nvc0_vram.c
3084 --- /data/deadwood/source/drm-orig/nouveau/nvc0_vram.c 2011-09-08 21:07:54.000000000 +0200
3085 +++ drm/nouveau/nvc0_vram.c 2013-09-28 19:35:37.000000000 +0200
3089 #include "nouveau_drv.h"
3090 -#include "nouveau_mm.h"
3091 +#include "nouveau_mm_renamed.h"
3094 * 1 = non-compressed
3100 + /* Workaround which forces allocation to be contiguous in VRAM.
3101 + Without this some gfx cards cause display corruption, because
3102 + displaying of non contiguous bitmap does not work for whatever
3105 + if (ncmin < size) ncmin = size;
3107 mem = kzalloc(sizeof(*mem), GFP_KERNEL);
3110 diff -ur /data/deadwood/source/drm-orig/nouveau/nvd0_display.c drm/nouveau/nvd0_display.c
3111 --- /data/deadwood/source/drm-orig/nouveau/nvd0_display.c 2011-09-08 21:07:54.000000000 +0200
3112 +++ drm/nouveau/nvd0_display.c 2011-09-17 08:03:13.000000000 +0200
3114 * Authors: Ben Skeggs
3117 +#if !defined(__AROS__)
3118 #include <linux/dma-mapping.h>
3122 #include "drm_crtc_helper.h"
3127 - struct tasklet_struct tasklet;
3128 +//FIXME struct tasklet_struct tasklet;
3132 @@ -1182,7 +1184,7 @@
3134 if (stat & 0x00000007) {
3135 disp->modeset = stat;
3136 - tasklet_schedule(&disp->tasklet);
3137 +//FIXME tasklet_schedule(&disp->tasklet);
3139 nv_wr32(dev, 0x6100ac, (stat & 0x00000007));
3140 stat &= ~0x00000007;
3141 @@ -1337,7 +1339,7 @@
3143 nvd0_display_fini(dev);
3145 - pci_free_consistent(pdev, PAGE_SIZE, disp->evo[0].ptr, disp->evo[0].handle);
3146 +//FIXME pci_free_consistent(pdev, PAGE_SIZE, disp->evo[0].ptr, disp->evo[0].handle);
3147 nouveau_gpuobj_ref(NULL, &disp->mem);
3148 nouveau_irq_unregister(dev, 26);
3150 @@ -1407,7 +1409,7 @@
3153 /* setup interrupt handling */
3154 - tasklet_init(&disp->tasklet, nvd0_display_bh, (unsigned long)dev);
3155 +//FIXME tasklet_init(&disp->tasklet, nvd0_display_bh, (unsigned long)dev);
3156 nouveau_irq_register(dev, 26, nvd0_display_intr);
3158 /* hash table and dma objects for the memory areas we care about */
3159 @@ -1454,6 +1456,7 @@
3161 pinstmem->flush(dev);
3164 /* push buffers for evo channels */
3166 pci_alloc_consistent(pdev, PAGE_SIZE, &disp->evo[0].handle);
3167 @@ -1461,6 +1464,7 @@
3173 ret = nvd0_display_init(dev);
3175 diff -ur /data/deadwood/source/drm-orig/nouveau_drm.h drm/nouveau_drm.h
3176 --- /data/deadwood/source/drm-orig/nouveau_drm.h 2011-02-25 17:58:10.000000000 +0100
3177 +++ drm/nouveau_drm.h 2011-09-19 21:03:02.000000000 +0200
3179 #define NOUVEAU_GETPARAM_PTIMER_TIME 14
3180 #define NOUVEAU_GETPARAM_HAS_BO_USAGE 15
3181 #define NOUVEAU_GETPARAM_HAS_PAGEFLIP 16
3182 +#if defined(__AROS__)
3183 +#define NOUVEAU_GETPARAM_VRAM_SIZE 128
3184 +#define NOUVEAU_GETPARAM_GART_SIZE 129
3185 +#define NOUVEAU_GETPARAM_VRAM_FREE 130
3186 +#define NOUVEAU_GETPARAM_GART_FREE 131
3188 struct drm_nouveau_getparam {
3191 diff -ur /data/deadwood/source/drm-orig/ttm/ttm_agp_backend.c drm/ttm/ttm_agp_backend.c
3192 --- /data/deadwood/source/drm-orig/ttm/ttm_agp_backend.c 2011-09-08 21:07:54.000000000 +0200
3193 +++ drm/ttm/ttm_agp_backend.c 2011-09-17 08:03:13.000000000 +0200
3195 #include "ttm/ttm_bo_driver.h"
3197 #include "ttm/ttm_placement.h"
3198 +#if !defined(__AROS__)
3199 #include <linux/agp_backend.h>
3200 #include <linux/module.h>
3201 #include <linux/slab.h>
3202 #include <linux/io.h>
3203 #include <asm/agp.h>
3205 +#include "drm_compat_funcs.h"
3208 struct ttm_agp_backend {
3209 struct ttm_backend backend;
3210 diff -ur /data/deadwood/source/drm-orig/ttm/ttm_bo_api.h drm/ttm/ttm_bo_api.h
3211 --- /data/deadwood/source/drm-orig/ttm/ttm_bo_api.h 2011-09-08 21:08:06.000000000 +0200
3212 +++ drm/ttm/ttm_bo_api.h 2011-09-17 08:03:13.000000000 +0200
3214 #define _TTM_BO_API_H_
3216 #include "drm_hashtab.h"
3217 +#if !defined(__AROS__)
3218 #include <linux/kref.h>
3219 #include <linux/list.h>
3220 #include <linux/wait.h>
3222 #include <linux/mm.h>
3223 #include <linux/rbtree.h>
3224 #include <linux/bitmap.h>
3226 +#include "drm_linux_list.h"
3227 +#include "drm_compat_funcs.h"
3230 struct ttm_bo_device;
3233 * Members protected by the bdev::vm_lock
3236 +#if !defined(__AROS__)
3237 struct rb_node vm_rb;
3239 struct drm_mm_node *vm_node;
3244 extern void ttm_bo_kunmap(struct ttm_bo_kmap_obj *map);
3246 +#if !defined(__AROS__)
3248 * ttm_fbdev_mmap - mmap fbdev memory backed by a ttm buffer object.
3251 extern ssize_t ttm_bo_io(struct ttm_bo_device *bdev, struct file *filp,
3252 const char __user *wbuf, char __user *rbuf,
3253 size_t count, loff_t *f_pos, bool write);
3256 extern void ttm_bo_swapout_all(struct ttm_bo_device *bdev);
3258 diff -ur /data/deadwood/source/drm-orig/ttm/ttm_bo.c drm/ttm/ttm_bo.c
3259 --- /data/deadwood/source/drm-orig/ttm/ttm_bo.c 2011-09-08 21:07:54.000000000 +0200
3260 +++ drm/ttm/ttm_bo.c 2011-09-22 19:14:46.000000000 +0200
3262 #include "ttm/ttm_module.h"
3263 #include "ttm/ttm_bo_driver.h"
3264 #include "ttm/ttm_placement.h"
3265 +#if !defined(__AROS__)
3266 #include <linux/jiffies.h>
3267 #include <linux/slab.h>
3268 #include <linux/sched.h>
3270 #include <linux/file.h>
3271 #include <linux/module.h>
3272 #include <linux/atomic.h>
3275 #define TTM_ASSERT_LOCKED(param)
3276 #define TTM_DEBUG(fmt, arg...)
3277 #define TTM_BO_HASH_ORDER 13
3279 static int ttm_bo_setup_vm(struct ttm_buffer_object *bo);
3280 +#if !defined(__AROS__)
3281 static int ttm_bo_swapout(struct ttm_mem_shrink *shrink);
3282 static void ttm_bo_global_kobj_release(struct kobject *kobj);
3290 static inline int ttm_mem_type_from_flags(uint32_t flags, uint32_t *mem_type)
3296 +#if !defined(__AROS__)
3297 static ssize_t ttm_bo_global_show(struct kobject *kobj,
3298 struct attribute *attr,
3301 .sysfs_ops = &ttm_bo_global_ops,
3302 .default_attrs = ttm_bo_global_attrs
3307 static inline uint32_t ttm_bo_type_flags(unsigned type)
3310 struct ttm_buffer_object *bo =
3311 container_of(list_kref, struct ttm_buffer_object, list_kref);
3312 +#if !defined(__AROS__)
3313 struct ttm_bo_device *bdev = bo->bdev;
3316 BUG_ON(atomic_read(&bo->list_kref.refcount));
3317 BUG_ON(atomic_read(&bo->kref.refcount));
3322 +#if !defined(__AROS__)
3323 ttm_mem_global_free(bdev->glob->mem_glob, bo->acc_size);
3328 @@ -351,8 +361,12 @@
3332 +#if !defined(__AROS__)
3333 ret = ttm_tt_set_user(bo->ttm, current,
3334 bo->buffer_start, bo->num_pages);
3336 +IMPLEMENT("Calling ttm_tt_set_user\n");
3338 if (unlikely(ret != 0))
3339 ttm_tt_destroy(bo->ttm);
3341 @@ -476,13 +490,19 @@
3343 atomic_set(&bo->reserved, 0);
3345 +#if !defined(__AROS__)
3347 * Make processes trying to reserve really pick it up.
3349 smp_mb__after_atomic_dec();
3351 wake_up_all(&bo->event_queue);
3354 +#if defined(__AROS__)
3355 +static int ttm_bo_delayed_delete(struct ttm_bo_device *bdev, bool remove_all);
3358 static void ttm_bo_cleanup_refs_or_queue(struct ttm_buffer_object *bo)
3360 struct ttm_bo_device *bdev = bo->bdev;
3361 @@ -536,8 +556,18 @@
3362 driver->sync_obj_flush(sync_obj, sync_obj_arg);
3363 driver->sync_obj_unref(&sync_obj);
3365 +/* NOTE: this call is supposed to start a work process which in some
3366 + time will try clean up refs again (ttm_bo_delayed_delete). This is needed
3367 + if ttm_bo_wait "fails" - meaning the fence is not signalled in time
3368 + In AROS version, the function is called immediatelly. This is not compatible,
3369 + but seems to do the job. The other option is to force ttm_bo_wait to always
3370 + wait until fence is signalled. */
3371 +#if !defined(__AROS__)
3372 schedule_delayed_work(&bdev->wq,
3373 ((HZ / 100) < 1) ? 1 : HZ / 100);
3375 + ttm_bo_delayed_delete(bdev, false);
3384 +#if !defined(__AROS__)
3385 static void ttm_bo_delayed_workqueue(struct work_struct *work)
3387 struct ttm_bo_device *bdev =
3389 ((HZ / 100) < 1) ? 1 : HZ / 100);
3394 static void ttm_bo_release(struct kref *kref)
3397 struct ttm_mem_type_manager *man = &bdev->man[bo->mem.mem_type];
3399 if (likely(bo->vm_node != NULL)) {
3400 +#if !defined(__AROS__)
3401 rb_erase(&bo->vm_rb, &bdev->addr_space_rb);
3403 drm_mm_put_block(bo->vm_node);
3408 EXPORT_SYMBOL(ttm_bo_unref);
3410 +#if !defined(__AROS__)
3411 int ttm_bo_lock_delayed_workqueue(struct ttm_bo_device *bdev)
3413 return cancel_delayed_work_sync(&bdev->wq);
3415 ((HZ / 100) < 1) ? 1 : HZ / 100);
3417 EXPORT_SYMBOL(ttm_bo_unlock_delayed_workqueue);
3420 static int ttm_bo_evict(struct ttm_buffer_object *bo, bool interruptible,
3421 bool no_wait_reserve, bool no_wait_gpu)
3422 @@ -1244,6 +1280,7 @@
3424 EXPORT_SYMBOL(ttm_bo_init);
3426 +#if !defined(__AROS__)
3427 static inline size_t ttm_bo_size(struct ttm_bo_global *glob,
3428 unsigned long num_pages)
3430 @@ -1288,6 +1325,7 @@
3436 static int ttm_bo_force_list_clean(struct ttm_bo_device *bdev,
3437 unsigned mem_type, bool allow_errors)
3438 @@ -1349,6 +1387,7 @@
3440 EXPORT_SYMBOL(ttm_bo_clean_mm);
3442 +#if !defined(__AROS__)
3443 int ttm_bo_evict_mm(struct ttm_bo_device *bdev, unsigned mem_type)
3445 struct ttm_mem_type_manager *man = &bdev->man[mem_type];
3446 @@ -1370,6 +1409,7 @@
3447 return ttm_bo_force_list_clean(bdev, mem_type, true);
3449 EXPORT_SYMBOL(ttm_bo_evict_mm);
3452 int ttm_bo_init_mm(struct ttm_bo_device *bdev, unsigned type,
3453 unsigned long p_size)
3454 @@ -1406,6 +1446,7 @@
3456 EXPORT_SYMBOL(ttm_bo_init_mm);
3458 +#if !defined(__AROS__)
3459 static void ttm_bo_global_kobj_release(struct kobject *kobj)
3461 struct ttm_bo_global *glob =
3462 @@ -1415,27 +1456,53 @@
3463 __free_page(glob->dummy_read_page);
3468 +#if defined(__AROS__)
3469 +size_t ttm_round_pot(size_t size)
3471 + if ((size & (size - 1)) == 0)
3473 + else if (size > PAGE_SIZE)
3474 + return (size_t)PAGE_ALIGN(size);
3476 + size_t tmp_size = 4;
3478 + while (tmp_size < size)
3487 void ttm_bo_global_release(struct drm_global_reference *ref)
3489 - struct ttm_bo_global *glob = ref->object;
3490 +//FIXME struct ttm_bo_global *glob = ref->object;
3492 - kobject_del(&glob->kobj);
3493 - kobject_put(&glob->kobj);
3494 +//FIXME kobject_del(&glob->kobj);
3495 +//FIXME kobject_put(&glob->kobj);
3497 EXPORT_SYMBOL(ttm_bo_global_release);
3499 int ttm_bo_global_init(struct drm_global_reference *ref)
3501 +#if !defined(__AROS__)
3502 struct ttm_bo_global_ref *bo_ref =
3503 container_of(ref, struct ttm_bo_global_ref, ref);
3505 struct ttm_bo_global *glob = ref->object;
3509 mutex_init(&glob->device_list_mutex);
3510 spin_lock_init(&glob->lru_lock);
3511 +#if !defined(__AROS__)
3512 glob->mem_glob = bo_ref->mem_glob;
3513 glob->dummy_read_page = alloc_page(__GFP_ZERO | GFP_DMA32);
3515 + glob->dummy_read_page = create_page_helper();
3518 if (unlikely(glob->dummy_read_page == NULL)) {
3520 @@ -1445,6 +1512,7 @@
3521 INIT_LIST_HEAD(&glob->swap_lru);
3522 INIT_LIST_HEAD(&glob->device_list);
3524 +#if !defined(__AROS__)
3525 ttm_mem_init_shrink(&glob->shrink, ttm_bo_swapout);
3526 ret = ttm_mem_register_shrink(glob->mem_glob, &glob->shrink);
3527 if (unlikely(ret != 0)) {
3528 @@ -1452,6 +1520,7 @@
3529 "Could not register buffer object swapout.\n");
3534 glob->ttm_bo_extra_size =
3535 ttm_round_pot(sizeof(struct ttm_tt)) +
3536 @@ -1462,13 +1531,16 @@
3538 atomic_set(&glob->bo_count, 0);
3540 - ret = kobject_init_and_add(
3541 - &glob->kobj, &ttm_bo_glob_kobj_type, ttm_get_kobj(), "buffer_objects");
3542 - if (unlikely(ret != 0))
3543 - kobject_put(&glob->kobj);
3544 +//FIXME ret = kobject_init_and_add(
3545 +//FIXME &glob->kobj, &ttm_bo_glob_kobj_type, ttm_get_kobj(), "buffer_objects");
3546 +//FIXME if (unlikely(ret != 0))
3547 +//FIXME kobject_put(&glob->kobj);
3550 +#if !defined(__AROS__)
3552 __free_page(glob->dummy_read_page);
3557 @@ -1501,7 +1573,9 @@
3558 list_del(&bdev->device_list);
3559 mutex_unlock(&glob->device_list_mutex);
3561 +#if !defined(__AROS__)
3562 cancel_delayed_work_sync(&bdev->wq);
3565 while (ttm_bo_delayed_delete(bdev, true))
3567 @@ -1544,12 +1618,16 @@
3568 if (unlikely(ret != 0))
3571 +#if !defined(__AROS__)
3572 bdev->addr_space_rb = RB_ROOT;
3574 ret = drm_mm_init(&bdev->addr_space_mm, file_page_offset, 0x10000000);
3575 if (unlikely(ret != 0))
3576 goto out_no_addr_mm;
3578 +#if !defined(__AROS__)
3579 INIT_DELAYED_WORK(&bdev->wq, ttm_bo_delayed_workqueue);
3581 bdev->nice_mode = true;
3582 INIT_LIST_HEAD(&bdev->ddestroy);
3583 bdev->dev_mapping = NULL;
3584 @@ -1592,6 +1670,7 @@
3586 void ttm_bo_unmap_virtual_locked(struct ttm_buffer_object *bo)
3588 +#if !defined(__AROS__)
3589 struct ttm_bo_device *bdev = bo->bdev;
3590 loff_t offset = (loff_t) bo->addr_space_offset;
3591 loff_t holelen = ((loff_t) bo->mem.num_pages) << PAGE_SHIFT;
3592 @@ -1599,6 +1678,9 @@
3593 if (!bdev->dev_mapping)
3595 unmap_mapping_range(bdev->dev_mapping, offset, holelen, 1);
3597 + /* This is no-op under AROS */
3599 ttm_mem_io_free_vm(bo);
3602 @@ -1615,6 +1697,7 @@
3604 EXPORT_SYMBOL(ttm_bo_unmap_virtual);
3606 +#if !defined(__AROS__)
3607 static void ttm_bo_vm_insert_rb(struct ttm_buffer_object *bo)
3609 struct ttm_bo_device *bdev = bo->bdev;
3610 @@ -1639,6 +1722,7 @@
3611 rb_link_node(&bo->vm_rb, parent, cur);
3612 rb_insert_color(&bo->vm_rb, &bdev->addr_space_rb);
3618 @@ -1678,7 +1762,9 @@
3622 +#if !defined(__AROS__)
3623 ttm_bo_vm_insert_rb(bo);
3625 write_unlock(&bdev->vm_lock);
3626 bo->addr_space_offset = ((uint64_t) bo->vm_node->start) << PAGE_SHIFT;
3628 @@ -1775,6 +1861,7 @@
3630 EXPORT_SYMBOL(ttm_bo_synccpu_write_release);
3632 +#if !defined(__AROS__)
3634 * A buffer object shrink method that tries to swap out the first
3635 * buffer object on the bo_global::swap_lru list.
3636 @@ -1884,3 +1971,4 @@
3639 EXPORT_SYMBOL(ttm_bo_swapout_all);
3641 diff -ur /data/deadwood/source/drm-orig/ttm/ttm_bo_driver.h drm/ttm/ttm_bo_driver.h
3642 --- /data/deadwood/source/drm-orig/ttm/ttm_bo_driver.h 2011-09-08 21:08:06.000000000 +0200
3643 +++ drm/ttm/ttm_bo_driver.h 2011-09-18 15:13:08.000000000 +0200
3645 #define _TTM_BO_DRIVER_H_
3647 #include "ttm/ttm_bo_api.h"
3648 +#if !defined(__AROS__)
3649 #include "ttm/ttm_memory.h"
3651 #include "ttm/ttm_module.h"
3653 #include "drm_global.h"
3654 +#if !defined(__AROS__)
3655 #include "linux/workqueue.h"
3656 #include "linux/fs.h"
3657 #include "linux/spinlock.h"
3659 +#include "drm_compat_types.h"
3664 @@ -121,8 +127,10 @@
3665 #define TTM_PAGE_FLAG_USER (1 << 1)
3666 #define TTM_PAGE_FLAG_USER_DIRTY (1 << 2)
3667 #define TTM_PAGE_FLAG_WRITE (1 << 3)
3668 +#if !defined(__AROS__)
3669 #define TTM_PAGE_FLAG_SWAPPED (1 << 4)
3670 #define TTM_PAGE_FLAG_PERSISTENT_SWAP (1 << 5)
3672 #define TTM_PAGE_FLAG_ZERO_ALLOC (1 << 6)
3673 #define TTM_PAGE_FLAG_DMA32 (1 << 7)
3675 @@ -164,12 +172,17 @@
3676 long first_himem_page;
3677 long last_lomem_page;
3678 uint32_t page_flags;
3679 +#if defined(__AROS__)
3680 + APTR allocated_buffer;
3682 unsigned long num_pages;
3683 struct ttm_bo_global *glob;
3684 struct ttm_backend *be;
3685 struct task_struct *tsk;
3686 unsigned long start;
3687 +#if !defined(__AROS__)
3688 struct file *swap_storage;
3690 enum ttm_caching_state caching_state;
3693 @@ -265,6 +278,10 @@
3694 * It may not be called from within atomic context.
3696 void (*debug)(struct ttm_mem_type_manager *man, const char *prefix);
3698 +#if defined(__AROS__)
3699 + int (*get_free_space_size)(struct ttm_mem_type_manager *man);
3704 @@ -493,10 +510,14 @@
3705 * Constant after init.
3708 - struct kobject kobj;
3709 +//FIXME struct kobject kobj;
3710 +#if !defined(__AROS__)
3711 struct ttm_mem_global *mem_glob;
3712 struct page *dummy_read_page;
3713 struct ttm_mem_shrink shrink;
3715 + struct page *dummy_read_page;
3717 size_t ttm_bo_extra_size;
3719 struct mutex device_list_mutex;
3722 * Protected by the vm lock.
3724 +#if !defined(__AROS__)
3725 struct rb_root addr_space_rb;
3727 struct drm_mm addr_space_mm;
3731 * Internal protection.
3734 +#if !defined(__AROS__)
3735 struct delayed_work wq;
3740 @@ -1028,6 +1053,7 @@
3741 bool evict, bool no_wait_reserve,
3743 struct ttm_mem_reg *new_mem);
3744 +#if !defined(__AROS__)
3748 @@ -1038,12 +1064,15 @@
3749 * setting up a PTE with the caching model indicated by @c_state.
3751 extern pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp);
3754 extern const struct ttm_mem_type_manager_func ttm_bo_manager_func;
3756 -#if (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE)))
3757 +#if (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE)) || defined(__AROS__))
3759 +#if !defined(__AROS__)
3760 #include <linux/agp_backend.h>
3764 * ttm_agp_backend_init
3765 diff -ur /data/deadwood/source/drm-orig/ttm/ttm_bo_manager.c drm/ttm/ttm_bo_manager.c
3766 --- /data/deadwood/source/drm-orig/ttm/ttm_bo_manager.c 2011-02-13 19:09:48.000000000 +0100
3767 +++ drm/ttm/ttm_bo_manager.c 2011-09-19 22:57:56.000000000 +0200
3769 #include "ttm/ttm_bo_driver.h"
3770 #include "ttm/ttm_placement.h"
3772 +#if !defined(__AROS__)
3773 #include <linux/slab.h>
3774 #include <linux/spinlock.h>
3775 #include <linux/module.h>
3779 * Currently we use a spinlock for the lock, but a mutex *may* be
3780 @@ -147,11 +149,30 @@
3781 spin_unlock(&rman->lock);
3784 +#if defined(__AROS__)
3785 +static int ttm_bo_man_free_space(struct ttm_mem_type_manager *man)
3787 + struct ttm_range_manager *rman = (struct ttm_range_manager *) man->priv;
3788 + struct drm_mm *mm = &rman->mm;
3791 + spin_lock(&rman->lock);
3792 + size = drm_mm_get_free_space_size(mm);
3793 + spin_unlock(&rman->lock);
3799 const struct ttm_mem_type_manager_func ttm_bo_manager_func = {
3801 ttm_bo_man_takedown,
3802 ttm_bo_man_get_node,
3803 ttm_bo_man_put_node,
3805 +#if defined(__AROS__)
3807 + ttm_bo_man_free_space
3810 EXPORT_SYMBOL(ttm_bo_manager_func);
3811 diff -ur /data/deadwood/source/drm-orig/ttm/ttm_bo_util.c drm/ttm/ttm_bo_util.c
3812 --- /data/deadwood/source/drm-orig/ttm/ttm_bo_util.c 2011-02-13 19:09:48.000000000 +0100
3813 +++ drm/ttm/ttm_bo_util.c 2011-09-23 19:58:46.000000000 +0200
3816 #include "ttm/ttm_bo_driver.h"
3817 #include "ttm/ttm_placement.h"
3818 +#if !defined(__AROS__)
3819 #include <linux/io.h>
3820 #include <linux/highmem.h>
3821 #include <linux/wait.h>
3822 #include <linux/slab.h>
3823 #include <linux/vmalloc.h>
3824 #include <linux/module.h>
3827 void ttm_bo_free_old_node(struct ttm_buffer_object *bo)
3830 if (likely(man->io_reserve_fastpath))
3833 +#if !defined(__AROS__)
3835 return mutex_lock_interruptible(&man->io_reserve_mutex);
3838 mutex_lock(&man->io_reserve_mutex);
3842 src = (void *)((unsigned long)src + (page << PAGE_SHIFT));
3844 +#if !defined(__AROS__)
3846 dst = kmap_atomic_prot(d, prot);
3848 @@ -260,11 +265,15 @@
3858 memcpy_fromio(dst, src, PAGE_SIZE);
3860 +#if !defined(__AROS__)
3877 dst = (void *)((unsigned long)dst + (page << PAGE_SHIFT));
3878 +#if !defined(__AROS__)
3880 src = kmap_atomic_prot(s, prot);
3882 @@ -296,11 +309,15 @@
3892 memcpy_toio(dst, src, PAGE_SIZE);
3894 +#if !defined(__AROS__)
3908 @@ -354,13 +374,21 @@
3909 for (i = 0; i < new_mem->num_pages; ++i) {
3910 page = i * dir + add;
3911 if (old_iomap == NULL) {
3912 +#if !defined(__AROS__)
3913 pgprot_t prot = ttm_io_prot(old_mem->placement,
3916 + pgprot_t prot = 0;
3918 ret = ttm_copy_ttm_io_page(ttm, new_iomap, page,
3920 } else if (new_iomap == NULL) {
3921 +#if !defined(__AROS__)
3922 pgprot_t prot = ttm_io_prot(new_mem->placement,
3925 + pgprot_t prot = 0;
3927 ret = ttm_copy_io_ttm_page(ttm, old_iomap, page,
3934 +#if !defined(__AROS__)
3935 pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp)
3937 #if defined(__i386__) || defined(__x86_64__)
3941 EXPORT_SYMBOL(ttm_io_prot);
3944 static int ttm_bo_ioremap(struct ttm_buffer_object *bo,
3945 unsigned long offset,
3946 @@ -500,7 +530,10 @@
3947 unsigned long num_pages,
3948 struct ttm_bo_kmap_obj *map)
3950 - struct ttm_mem_reg *mem = &bo->mem; pgprot_t prot;
3951 + struct ttm_mem_reg *mem = &bo->mem;
3952 +#if !defined(__AROS__)
3955 struct ttm_tt *ttm = bo->ttm;
3958 @@ -529,9 +562,11 @@
3959 * We need to use vmap to get the desired page protection
3960 * or to make the buffer object look contiguous.
3962 +#if !defined(__AROS__)
3963 prot = (mem->placement & TTM_PL_FLAG_CACHED) ?
3965 ttm_io_prot(mem->placement, PAGE_KERNEL);
3967 map->bo_kmap_type = ttm_bo_map_vmap;
3968 map->virtual = vmap(ttm->pages + start_page, num_pages,
3970 diff -ur /data/deadwood/source/drm-orig/ttm/ttm_module.h drm/ttm/ttm_module.h
3971 --- /data/deadwood/source/drm-orig/ttm/ttm_module.h 2011-02-13 19:09:51.000000000 +0100
3972 +++ drm/ttm/ttm_module.h 2011-09-12 20:46:05.000000000 +0200
3974 #ifndef _TTM_MODULE_H_
3975 #define _TTM_MODULE_H_
3977 +#if !defined(__AROS__)
3978 #include <linux/kernel.h>
3981 +#include "drm_compat_types.h"
3984 #define TTM_PFX "[TTM] "
3985 extern struct kobject *ttm_get_kobj(void);
3986 diff -ur /data/deadwood/source/drm-orig/ttm/ttm_tt.c drm/ttm/ttm_tt.c
3987 --- /data/deadwood/source/drm-orig/ttm/ttm_tt.c 2011-09-08 21:07:54.000000000 +0200
3988 +++ drm/ttm/ttm_tt.c 2011-09-23 18:33:43.000000000 +0200
3990 * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
3993 +#if !defined(__AROS__)
3994 #include <linux/sched.h>
3995 #include <linux/highmem.h>
3996 #include <linux/pagemap.h>
3998 #include <linux/file.h>
3999 #include <linux/swap.h>
4000 #include <linux/slab.h>
4002 +#include "drm_compat_types.h"
4004 #include "drm_cache.h"
4005 #include "drm_mem_util.h"
4006 #include "ttm/ttm_module.h"
4007 #include "ttm/ttm_bo_driver.h"
4008 #include "ttm/ttm_placement.h"
4009 +#if !defined(__AROS__)
4010 #include "ttm/ttm_page_alloc.h"
4012 static int ttm_tt_swapin(struct ttm_tt *ttm);
4016 * Allocates storage for pointers to the pages that back the ttm.
4018 ttm->pages = drm_calloc_large(ttm->num_pages, sizeof(*ttm->pages));
4019 ttm->dma_address = drm_calloc_large(ttm->num_pages,
4020 sizeof(*ttm->dma_address));
4021 +#if defined(__AROS__)
4022 + ttm->allocated_buffer = HIDDNouveauAlloc((ttm->num_pages * PAGE_SIZE) + PAGE_SIZE - 1);
4026 static void ttm_tt_free_page_directory(struct ttm_tt *ttm)
4029 drm_free_large(ttm->dma_address);
4030 ttm->dma_address = NULL;
4031 +#if defined(__AROS__)
4032 + HIDDNouveauFree(ttm->allocated_buffer);
4033 + ttm->allocated_buffer = NULL;
4037 static void ttm_tt_free_user_pages(struct ttm_tt *ttm)
4038 @@ -87,11 +100,17 @@
4042 +#if !defined(__AROS__)
4043 if (write && dirty && !PageReserved(page))
4044 set_page_dirty_lock(page);
4046 + (void)write; (void)dirty;
4049 ttm->pages[i] = NULL;
4050 +#if !defined(__AROS__)
4051 ttm_mem_global_free(ttm->glob->mem_glob, PAGE_SIZE);
4055 ttm->state = tt_unpopulated;
4058 static struct page *__ttm_tt_get_page(struct ttm_tt *ttm, int index)
4060 +#if !defined(__AROS__)
4063 struct ttm_mem_global *mem_glob = ttm->glob->mem_glob;
4064 @@ -131,10 +151,29 @@
4071 + while (NULL == (p = ttm->pages[index])) {
4072 + p = HIDDNouveauAlloc(sizeof(*p));
4073 + p->allocated_buffer = NULL;
4074 + p->address = (APTR)((IPTR)PAGE_ALIGN(ttm->allocated_buffer) + (IPTR)(PAGE_SIZE * index));
4079 + if (PageHighMem(p))
4080 + ttm->pages[--ttm->first_himem_page] = p;
4082 + ttm->pages[++ttm->last_lomem_page] = p;
4088 struct page *ttm_tt_get_page(struct ttm_tt *ttm, int index)
4090 +#if !defined(__AROS__)
4093 if (unlikely(ttm->page_flags & TTM_PAGE_FLAG_SWAPPED)) {
4095 if (unlikely(ret != 0))
4099 return __ttm_tt_get_page(ttm, index);
4102 @@ -150,16 +190,20 @@
4105 struct ttm_backend *be;
4106 +#if !defined(__AROS__)
4110 if (ttm->state != tt_unpopulated)
4113 +#if !defined(__AROS__)
4114 if (unlikely(ttm->page_flags & TTM_PAGE_FLAG_SWAPPED)) {
4115 ret = ttm_tt_swapin(ttm);
4116 if (unlikely(ret != 0))
4125 static void ttm_tt_free_alloced_pages(struct ttm_tt *ttm)
4127 +#if !defined(__AROS__)
4131 @@ -309,6 +354,25 @@
4132 ttm->state = tt_unpopulated;
4133 ttm->first_himem_page = ttm->num_pages;
4134 ttm->last_lomem_page = -1;
4137 + struct page *cur_page;
4138 + struct ttm_backend *be = ttm->be;
4141 + be->func->clear(be);
4142 + (void)ttm_tt_set_caching(ttm, tt_cached);
4143 + for (i = 0; i < ttm->num_pages; ++i) {
4144 + cur_page = ttm->pages[i];
4145 + ttm->pages[i] = NULL;
4147 + __free_page(cur_page);
4150 + ttm->state = tt_unpopulated;
4151 + ttm->first_himem_page = ttm->num_pages;
4152 + ttm->last_lomem_page = -1;
4156 void ttm_tt_destroy(struct ttm_tt *ttm)
4157 @@ -333,13 +397,16 @@
4158 ttm_tt_free_page_directory(ttm);
4161 +#if !defined(__AROS__)
4162 if (!(ttm->page_flags & TTM_PAGE_FLAG_PERSISTENT_SWAP) &&
4164 fput(ttm->swap_storage);
4170 +#if !defined(__AROS__)
4171 int ttm_tt_set_user(struct ttm_tt *ttm,
4172 struct task_struct *tsk,
4173 unsigned long start, unsigned long num_pages)
4180 struct ttm_tt *ttm_tt_create(struct ttm_bo_device *bdev, unsigned long size,
4181 uint32_t page_flags, struct page *dummy_read_page)
4184 EXPORT_SYMBOL(ttm_tt_bind);
4186 +#if !defined(__AROS__)
4187 static int ttm_tt_swapin(struct ttm_tt *ttm)
4189 struct address_space *swap_space;