Hint added.
[AROS.git] / workbench / hidds / nouveau / drm / drm.diff
blobe8c5d3647fd801f6e8f4fc4b566b7dde65b40e6e
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
4 @@ -32,12 +32,16 @@
5 */
7 #include "drmP.h"
8 +#if !defined(__AROS__)
9 #include <linux/module.h>
10 #include <linux/slab.h>
11 +#endif
13 #if __OS_HAS_AGP
15 +#if !defined(__AROS__)
16 #include <asm/agp.h>
17 +#endif
19 /**
20 * Get AGP information.
21 @@ -59,15 +63,19 @@
22 return -EINVAL;
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;
28 +#endif
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;
37 +#endif
39 return 0;
41 @@ -110,6 +118,7 @@
43 EXPORT_SYMBOL(drm_agp_acquire);
45 +#if !defined(__AROS__)
46 /**
47 * Acquire the AGP device (ioctl).
49 @@ -127,6 +136,7 @@
51 return drm_agp_acquire((struct drm_device *) file_priv->minor->dev);
53 +#endif
55 /**
56 * Release the AGP device.
57 @@ -183,6 +193,7 @@
58 return drm_agp_enable(dev, *mode);
61 +#if !defined(__AROS__)
62 /**
63 * Allocate AGP memory.
65 @@ -384,6 +395,7 @@
67 return drm_agp_free(dev, request);
69 +#endif
71 /**
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
76 @@ -91,6 +91,9 @@
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 */
82 + CacheClearU();
83 #else
84 printk(KERN_ERR "Architecture has no drm_cache.c support\n");
85 WARN_ON_ONCE(1);
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
89 @@ -29,8 +29,10 @@
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>
96 +#endif
97 #include "drm.h"
98 #include "drmP.h"
99 #include "drm_crtc.h"
100 @@ -814,6 +816,7 @@
102 EXPORT_SYMBOL(drm_mode_create_dithering_property);
104 +#if !defined(__AROS__)
106 * drm_mode_create_dirty_property - create dirty property
107 * @dev: DRM device
108 @@ -843,6 +846,7 @@
109 return 0;
111 EXPORT_SYMBOL(drm_mode_create_dirty_info_property);
112 +#endif
115 * drm_mode_config_init - initialize DRM mode_configuration structure
116 @@ -878,6 +882,7 @@
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;
124 @@ -920,6 +925,7 @@
126 return 0;
128 +#endif
131 * drm_mode_config_cleanup - free up DRM mode_config info
132 @@ -1082,8 +1088,12 @@
133 list_for_each(lh, &file_priv->fbs)
134 fb_count++;
136 +#if !defined(__AROS__)
137 mode_group = &file_priv->master->minor->mode_group;
138 if (file_priv->master->minor->type == DRM_MINOR_CONTROL) {
139 +#else
140 + if (1) {
141 +#endif
143 list_for_each(lh, &dev->mode_config.crtc_list)
144 crtc_count++;
145 @@ -1124,7 +1134,11 @@
146 if (card_res->count_crtcs >= crtc_count) {
147 copied = 0;
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) {
151 +#else
152 + if (1) {
153 +#endif
154 list_for_each_entry(crtc, &dev->mode_config.crtc_list,
155 head) {
156 DRM_DEBUG_KMS("[CRTC:%d]\n", crtc->base.id);
157 @@ -1151,7 +1165,11 @@
158 if (card_res->count_encoders >= encoder_count) {
159 copied = 0;
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) {
163 +#else
164 + if (1) {
165 +#endif
166 list_for_each_entry(encoder,
167 &dev->mode_config.encoder_list,
168 head) {
169 @@ -1182,7 +1200,11 @@
170 if (card_res->count_connectors >= connector_count) {
171 copied = 0;
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) {
175 +#else
176 + if (1) {
177 +#endif
178 list_for_each_entry(connector,
179 &dev->mode_config.connector_list,
180 head) {
181 @@ -1776,6 +1798,7 @@
182 return ret;
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);
191 return ret;
193 +#endif
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);
207 return ret;
209 +#endif
211 static struct drm_property_blob *drm_property_create_blob(struct drm_device *dev, int length,
212 void *data)
213 @@ -2360,6 +2386,7 @@
214 kfree(blob);
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);
223 return ret;
225 +#endif
227 int drm_mode_connector_update_edid_property(struct drm_connector *connector,
228 struct edid *edid)
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);
239 return ret;
241 +#endif
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);
257 +#endif
259 bool drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc,
260 int gamma_size)
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);
273 +#endif
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
277 @@ -25,12 +25,16 @@
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>
288 +#else
289 +#include "drm_linux_list.h"
290 +#endif
292 struct drm_device;
293 struct drm_mode_set;
294 @@ -484,7 +488,9 @@
296 struct drm_connector {
297 struct drm_device *dev;
298 +#if !defined(__AROS__)
299 struct device kdev;
300 +#endif
301 struct device_attribute *attr;
302 struct list_head head;
304 @@ -593,7 +599,9 @@
306 /* output poll support */
307 bool poll_enabled;
308 +#if !defined(__AROS__)
309 struct delayed_work output_poll_work;
310 +#endif
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
317 @@ -32,10 +32,12 @@
318 #include "drmP.h"
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);
326 +#endif
328 static void drm_mode_validate_flag(struct drm_connector *connector,
329 int flags)
330 @@ -104,7 +106,9 @@
331 connector->funcs->force(connector);
332 } else {
333 connector->status = connector->funcs->detect(connector, true);
334 +#if !defined(__AROS__)
335 drm_kms_helper_poll_enable(dev);
336 +#endif
339 if (connector->status == connector_status_disconnected) {
340 @@ -217,6 +221,7 @@
341 (*encoder_funcs->dpms)(encoder, DRM_MODE_DPMS_OFF);
344 +#if !defined(__AROS__)
346 * drm_helper_disable_unused_functions - disable unused objects
347 * @dev: DRM device
348 @@ -261,6 +266,7 @@
351 EXPORT_SYMBOL(drm_helper_disable_unused_functions);
352 +#endif
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);
366 +#endif
368 /* FIXME: add subpixel order */
369 done:
370 @@ -678,7 +686,9 @@
371 set->connectors[i]->dpms = DRM_MODE_DPMS_ON;
374 +#if !defined(__AROS__)
375 drm_helper_disable_unused_functions(dev);
376 +#endif
377 } else if (fb_changed) {
378 set->crtc->x = set->x;
379 set->crtc->y = set->y;
380 @@ -818,6 +828,7 @@
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;
388 @@ -967,3 +978,4 @@
389 queue_delayed_work(system_nrt_wq, &dev->mode_config.output_poll_work, 0);
391 EXPORT_SYMBOL(drm_helper_hpd_irq_event);
392 +#endif
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
396 @@ -33,11 +33,15 @@
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>
406 +#else
407 +#include "drm_compat_funcs.h"
408 +#endif
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
415 @@ -23,8 +23,12 @@
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>
422 +#else
423 +#include "drm_compat_types.h"
424 +#endif
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
431 @@ -27,9 +27,11 @@
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>
439 +#endif
440 #include "drmP.h"
441 #include "drm_edid.h"
442 #include "drm_edid_modes.h"
443 @@ -197,8 +199,10 @@
444 bad:
445 if (raw_edid) {
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);
450 +#endif
452 return 0;
454 @@ -286,6 +290,9 @@
456 int i, j = 0, valid_extensions = 0;
457 u8 *block, *new;
458 +#if defined(__AROS__)
459 + int allocsize = EDID_LENGTH;
460 +#endif
462 if ((block = kmalloc(EDID_LENGTH, GFP_KERNEL)) == NULL)
463 return NULL;
464 @@ -308,7 +315,14 @@
465 if (block[0x7e] == 0)
466 return block;
468 +#if !defined(__AROS__)
469 new = krealloc(block, (block[0x7e] + 1) * EDID_LENGTH, GFP_KERNEL);
470 +#else
471 + new = kzalloc((block[0x7e] + 1) * EDID_LENGTH, GFP_KERNEL);
472 + memcpy(new, block, allocsize);
473 + allocsize = (block[0x7e] + 1) * EDID_LENGTH;
474 + kfree(block);
475 +#endif
476 if (!new)
477 goto out;
478 block = new;
479 @@ -333,7 +347,14 @@
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);
485 +#else
486 + new = kzalloc((valid_extensions + 1) * EDID_LENGTH, GFP_KERNEL);
487 + memcpy(new, block, allocsize);
488 + allocsize = (valid_extensions + 1) * EDID_LENGTH;
489 + kfree(block);
490 +#endif
491 if (!new)
492 goto out;
493 block = new;
494 @@ -1607,3 +1628,4 @@
495 return num_modes;
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
502 @@ -23,7 +23,11 @@
503 #ifndef __DRM_EDID_H__
504 #define __DRM_EDID_H__
506 +#if !defined(__AROS__)
507 #include <linux/types.h>
508 +#else
509 +#include "drm_compat_types.h"
510 +#endif
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
517 @@ -23,7 +23,9 @@
518 * DEALINGS IN THE SOFTWARE.
521 +#if !defined(__AROS__)
522 #include <linux/kernel.h>
523 +#endif
524 #include "drmP.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
530 @@ -145,7 +145,9 @@
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);
536 +IMPLEMENT("\n");
537 +return 0;
541 @@ -154,7 +156,8 @@
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);
547 +IMPLEMENT("\n");
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
554 @@ -25,6 +25,7 @@
558 +#if !defined(__AROS__)
559 #include <linux/types.h>
560 #include <linux/slab.h>
561 #include <linux/mm.h>
562 @@ -35,6 +36,7 @@
563 #include <linux/mman.h>
564 #include <linux/pagemap.h>
565 #include <linux/shmem_fs.h>
566 +#endif
567 #include "drmP.h"
569 /** @file drm_gem.c
570 @@ -89,11 +91,14 @@
572 drm_gem_init(struct drm_device *dev)
574 +#if !defined(__AROS__)
575 struct drm_gem_mm *mm;
576 +#endif
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);
583 if (!mm) {
584 DRM_ERROR("out of memory\n");
585 @@ -113,10 +118,12 @@
586 kfree(mm);
587 return -ENOMEM;
589 +#endif
591 return 0;
594 +#if !defined(__AROS__)
595 void
596 drm_gem_destroy(struct drm_device *dev)
598 @@ -127,6 +134,7 @@
599 kfree(mm);
600 dev->mm_private = NULL;
602 +#endif
605 * Initialize an already allocated GEM object of the specified size with
606 @@ -138,9 +146,14 @@
607 BUG_ON((size & (PAGE_SIZE - 1)) != 0);
609 obj->dev = dev;
610 +#if !defined(__AROS__)
611 obj->filp = shmem_file_setup("drm mm object", size, VM_NORESERVE);
612 if (IS_ERR(obj->filp))
613 return -ENOMEM;
614 +#else
615 + /* No swapping under AROS. Set to NULL to detect any problems */
616 + obj->filp = NULL;
617 +#endif
619 kref_init(&obj->refcount);
620 atomic_set(&obj->handle_count, 0);
621 @@ -192,8 +205,10 @@
623 return obj;
624 fput:
625 +#if !defined(__AROS__)
626 /* Object_init mangles the global counters - readjust them. */
627 fput(obj->filp);
628 +#endif
629 free:
630 kfree(obj);
631 return NULL;
632 @@ -417,6 +432,7 @@
633 return 0;
636 +#if !defined(__AROS__)
638 * Called at device open time, sets up the structure for handling refcounting
639 * of mm objects.
640 @@ -461,12 +477,15 @@
641 idr_remove_all(&file_private->object_idr);
642 idr_destroy(&file_private->object_idr);
644 +#endif
646 void
647 drm_gem_object_release(struct drm_gem_object *obj)
649 +#if !defined(__AROS__)
650 if (obj->filp)
651 fput(obj->filp);
652 +#endif
654 EXPORT_SYMBOL(drm_gem_object_release);
656 @@ -482,7 +501,7 @@
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);
665 @@ -524,6 +543,7 @@
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;
673 @@ -621,3 +641,4 @@
674 return ret;
676 EXPORT_SYMBOL(drm_gem_mmap);
677 +#endif
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
681 @@ -28,9 +28,13 @@
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>
689 +#else
690 +#include "drm_compat_funcs.h"
691 +#endif
692 #include "drm_global.h"
694 struct drm_global_item {
695 @@ -67,7 +71,6 @@
697 int ret;
698 struct drm_global_item *item = &glob[ref->global_type];
699 - void *object;
701 mutex_lock(&item->mutex);
702 if (item->refcount == 0) {
703 @@ -85,7 +88,6 @@
705 ++item->refcount;
706 ref->object = item->object;
707 - object = item->object;
708 mutex_unlock(&item->mutex);
709 return 0;
710 out_err:
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
714 @@ -37,11 +37,15 @@
715 #define _DRM_H_
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
734 @@ -35,17 +35,21 @@
735 #ifndef DRM_HASHTAB_H
736 #define DRM_HASHTAB_H
738 +#if !defined(__AROS__)
739 #include <linux/list.h>
740 +#else
741 +#include "drm_compat_types.h"
742 +#endif
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;
749 unsigned long key;
752 struct drm_open_hash {
753 - struct hlist_head *table;
754 +//FIXME: struct hlist_head *table;
755 u8 order;
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
761 @@ -34,13 +34,21 @@
764 #include "drmP.h"
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>
772 +#else
773 +#include "drm_aros.h"
775 +#include <proto/oop.h>
776 +#include <hidd/pci.h>
777 +#endif
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 + \
783 @@ -301,6 +309,7 @@
784 dev->driver->irq_postinstall(dev);
787 +#endif
790 * Install IRQ handler.
791 @@ -311,6 +320,7 @@
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)
798 int ret = 0;
799 @@ -382,7 +392,59 @@
800 return ret;
802 EXPORT_SYMBOL(drm_irq_install);
803 +#else
804 +static AROS_INTH1(interrupt_handler, struct drm_device *, dev)
806 + AROS_INTFUNC_INIT
807 + if (dev->driver->irq_handler)
808 + dev->driver->irq_handler(dev);
809 + return FALSE;
810 + AROS_INTFUNC_EXIT
813 +int drm_irq_install(struct drm_device *dev)
815 + IPTR INTLine = 0;
816 + int retval = 0;
818 + ObtainSemaphore(&dev->struct_mutex.semaphore);
819 + if (dev->irq_enabled) {
820 + ReleaseSemaphore(&dev->struct_mutex.semaphore);
821 + return -EBUSY;
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);
843 + if (retval < 0)
845 + ObtainSemaphore(&dev->struct_mutex.semaphore);
846 + dev->irq_enabled = 0;
847 + ReleaseSemaphore(&dev->struct_mutex.semaphore);
851 + return retval;
853 +#endif
855 +#if !defined(__AROS__)
857 * Uninstall the IRQ handler.
859 @@ -433,7 +495,34 @@
860 return 0;
862 EXPORT_SYMBOL(drm_irq_uninstall);
863 +#else
864 +int drm_irq_uninstall(struct drm_device *dev)
866 + int irq_enabled;
867 + int retval = -EINVAL;
868 + IPTR INTLine;
870 + ObtainSemaphore(&dev->struct_mutex.semaphore);
871 + irq_enabled = dev->irq_enabled;
872 + dev->irq_enabled = 0;
873 + ReleaseSemaphore(&dev->struct_mutex.semaphore);
875 + if (!irq_enabled)
876 + return retval;
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);
886 + return 0;
888 +#endif
890 +#if !defined(__AROS__)
892 * IRQ control ioctl.
894 @@ -1349,3 +1438,4 @@
895 return true;
897 EXPORT_SYMBOL(drm_handle_vblank);
898 +#endif
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
902 @@ -33,7 +33,9 @@
903 * OTHER DEALINGS IN THE SOFTWARE.
906 +#if !defined(__AROS__)
907 #include <linux/highmem.h>
908 +#endif
909 #include "drmP.h"
912 @@ -56,6 +58,7 @@
915 #if __OS_HAS_AGP
916 +#if !defined(__AROS__)
917 static void *agp_remap(unsigned long offset, unsigned long size,
918 struct drm_device * dev)
920 @@ -98,6 +101,7 @@
922 return addr;
924 +#endif
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);
938 +#endif
940 /** Wrapper around agp_unbind_memory() */
941 int drm_unbind_agp(DRM_AGP_MEM * handle)
942 @@ -119,6 +125,13 @@
944 EXPORT_SYMBOL(drm_unbind_agp);
946 +static inline void *agp_remap(unsigned long offset, unsigned long size,
947 + struct drm_device * dev)
949 + IMPLEMENT("\n");
950 + return NULL;
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
959 @@ -43,8 +43,12 @@
961 #include "drmP.h"
962 #include "drm_mm.h"
963 +#if !defined(__AROS__)
964 #include <linux/slab.h>
965 #include <linux/seq_file.h>
966 +#else
967 +#include "drm_compat_funcs.h"
968 +#endif
970 #define MM_UNUSED_TARGET 4
972 @@ -714,3 +718,19 @@
974 EXPORT_SYMBOL(drm_mm_dump_table);
975 #endif
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);
988 + return total_free;
990 +EXPORT_SYMBOL(drm_mm_get_free_space);
991 +#endif
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
995 @@ -36,10 +36,15 @@
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>
1003 #endif
1004 +#else
1005 +#include "drm_compat_types.h"
1006 +#include "drm_linux_list.h"
1007 +#endif
1009 struct drm_mm_node {
1010 struct list_head node_list;
1011 @@ -185,4 +190,8 @@
1012 int drm_mm_dump_table(struct seq_file *m, struct drm_mm *mm);
1013 #endif
1015 +#if defined(__AROS__)
1016 +int drm_mm_get_free_space_size(const struct drm_mm *mm);
1017 +#endif
1019 #endif
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
1023 @@ -30,8 +30,10 @@
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>
1030 +#endif
1031 #include "drmP.h"
1032 #include "drm.h"
1033 #include "drm_crtc.h"
1034 @@ -907,6 +909,7 @@
1035 struct drm_display_mode *b = list_entry(lh_b, struct drm_display_mode, head);
1036 int diff;
1038 +#if !defined(__AROS__)
1039 diff = ((b->type & DRM_MODE_TYPE_PREFERRED) != 0) -
1040 ((a->type & DRM_MODE_TYPE_PREFERRED) != 0);
1041 if (diff)
1042 @@ -914,6 +917,16 @@
1043 diff = b->hdisplay * b->vdisplay - a->hdisplay * a->vdisplay;
1044 if (diff)
1045 return diff;
1046 +#else
1047 + diff = b->hdisplay - a->hdisplay;
1048 + if (diff)
1049 + return diff;
1051 + diff = b->vdisplay - a->vdisplay;
1052 + if (diff)
1053 + return diff;
1054 +#endif
1056 diff = b->clock - a->clock;
1057 return diff;
1059 @@ -975,6 +988,7 @@
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 @@
1068 return mode;
1070 EXPORT_SYMBOL(drm_mode_create_from_cmdline_mode);
1071 +#endif
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
1075 @@ -28,7 +28,9 @@
1076 #include "nouveau_hw.h"
1077 #include "nouveau_encoder.h"
1079 +#if !defined(__AROS__)
1080 #include <linux/io-mapping.h>
1081 +#endif
1083 /* these defines are made up */
1084 #define NV_CIO_CRE_44_HEADA 0x0
1085 @@ -160,6 +162,7 @@
1087 static void load_vbios_pci(struct drm_device *dev, uint8_t *data)
1089 +#if !defined(__AROS__)
1090 void __iomem *rom = NULL;
1091 size_t rom_len;
1092 int ret;
1093 @@ -176,10 +179,14 @@
1095 out:
1096 pci_disable_rom(dev->pdev);
1097 +#else
1098 +IMPLEMENT("\n");
1099 +#endif
1102 static void load_vbios_acpi(struct drm_device *dev, uint8_t *data)
1104 +#if !defined(__AROS__)
1105 int i;
1106 int ret;
1107 int size = 64 * 1024;
1108 @@ -195,6 +202,9 @@
1109 break;
1111 return;
1112 +#else
1113 +IMPLEMENT("\n");
1114 +#endif
1117 struct methods {
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;
1126 +#endif
1127 uint8_t count = bios->data[offset + 3];
1128 +#if !defined(__AROS__)
1129 struct nouveau_i2c_chan *chan;
1130 +#endif
1131 int len = 4 + count * 3;
1132 +#if !defined(__AROS__)
1133 int ret, i;
1134 +#endif
1136 if (!iexec->execute)
1137 return len;
1139 +#if !defined(__AROS__)
1140 BIOSLOG(bios, "0x%04X: DCBI2CIndex: 0x%02X, I2CAddress: 0x%02X, "
1141 "Count: 0x%02X\n",
1142 offset, i2c_index, i2c_address, count);
1143 @@ -1506,6 +1523,10 @@
1146 return len;
1147 +#else
1148 +IMPLEMENT("\n");
1149 +return 0;
1150 +#endif
1153 static int
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;
1162 +#endif
1163 uint8_t count = bios->data[offset + 3];
1164 +#if !defined(__AROS__)
1165 struct nouveau_i2c_chan *chan;
1166 +#endif
1167 int len = 4 + count * 2;
1168 +#if !defined(__AROS__)
1169 int ret, i;
1170 +#endif
1172 if (!iexec->execute)
1173 return len;
1175 +#if !defined(__AROS__)
1176 BIOSLOG(bios, "0x%04X: DCBI2CIndex: 0x%02X, I2CAddress: 0x%02X, "
1177 "Count: 0x%02X\n",
1178 offset, i2c_index, i2c_address, count);
1179 @@ -1570,6 +1598,10 @@
1182 return len;
1183 +#else
1184 +IMPLEMENT("\n");
1185 +return 0;
1186 +#endif
1189 static int
1190 @@ -2037,6 +2069,7 @@
1191 static int
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);
1202 +#else
1203 +IMPLEMENT("\n");
1204 +#endif
1206 return 6;
1208 @@ -6918,11 +6954,16 @@
1209 int ret;
1211 if (!NVInitVBIOS(dev))
1212 +#if !defined(MOCK_HARDWARE)
1213 return -ENODEV;
1215 ret = nouveau_parse_vbios_struct(dev);
1216 if (ret)
1217 return ret;
1218 +#else
1220 + bios->major_version = 6;
1221 +#endif
1223 ret = parse_dcb_table(dev, bios);
1224 if (ret)
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
1228 @@ -32,11 +32,13 @@
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>
1239 +#endif
1241 static void
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
1246 @@ -53,8 +53,8 @@
1247 static void
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;
1257 @@ -65,11 +65,9 @@
1258 nvclk_freq = arb->nvclk_khz;
1259 pagemiss = arb->mem_page_miss;
1260 cas = arb->mem_latency;
1261 - width = arb->memory_width >> 6;
1262 bpp = arb->bpp;
1263 cbs = 128;
1265 - pclks = 2;
1266 nvclks = 10;
1267 mclks = 13 + cas;
1268 mclk_extra = 3;
1269 @@ -211,7 +209,7 @@
1270 (dev->pci_device & 0xffff) == 0x01f0 /*CHIPSET_NFORCE2*/) {
1271 uint32_t type;
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
1281 @@ -24,7 +24,9 @@
1285 +#if !defined(__AROS__)
1286 #include <acpi/button.h>
1287 +#endif
1289 #include "drmP.h"
1290 #include "drm_edid.h"
1291 @@ -117,7 +119,9 @@
1294 kfree(nv_connector->edid);
1295 +#if !defined(__AROS__)
1296 drm_sysfs_connector_remove(connector);
1297 +#endif
1298 drm_connector_cleanup(connector);
1299 kfree(connector);
1301 @@ -296,6 +300,7 @@
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;
1313 +#else
1314 + nouveau_connector_set_encoder(connector, nv_encoder);
1315 + return connector_status_connected;
1316 +#endif
1320 @@ -892,7 +901,9 @@
1321 connector->polled = DRM_CONNECTOR_POLL_CONNECT;
1324 +#if !defined(__AROS__)
1325 drm_sysfs_connector_add(connector);
1326 +#endif
1328 dcb->drm = connector;
1329 return dcb->drm;
1330 @@ -918,5 +929,8 @@
1331 else
1332 drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF);
1334 +#if !defined(__AROS__)
1335 drm_helper_hpd_irq_event(dev);
1336 +#endif
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
1342 @@ -28,7 +28,9 @@
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"
1348 +#endif
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__)
1357 +void
1358 +nouveau_fbcon_output_poll_changed(struct drm_device *dev)
1360 + IMPLEMENT("\n");
1362 +#endif
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,
1367 @@ -179,6 +189,7 @@
1368 NVWriteCRTC(dev, crtc, NV_PCRTC_INTR_EN_0, 0);
1371 +#if !defined(__AROS__)
1372 static int
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);
1377 return ret;
1379 +#endif
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 @@
1390 fail_free:
1391 kfree(s);
1392 return ret;
1393 +#else
1394 + /* No-op under AROS */
1395 + return 0;
1396 +#endif
1399 +#if !defined(__AROS__)
1401 nouveau_finish_page_flip(struct nouveau_channel *chan,
1402 struct nouveau_page_flip_state *ps)
1403 @@ -369,3 +387,4 @@
1404 spin_unlock_irqrestore(&dev->event_lock, flags);
1405 return 0;
1407 +#endif
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
1411 @@ -195,6 +195,7 @@
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) {
1418 prev_get = 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;
1423 +#else
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;
1427 +#endif
1430 return 0;
1431 @@ -226,6 +232,7 @@
1432 return ret;
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)) {
1438 if (get == -EINVAL)
1439 @@ -253,6 +260,12 @@
1442 chan->dma.free = get - chan->dma.cur - 1;
1443 +#else
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;
1448 +#endif
1451 return 0;
1452 @@ -268,6 +281,7 @@
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))
1459 return -EBUSY;
1460 @@ -336,6 +350,13 @@
1461 * here, so this is safe.
1463 chan->dma.free = get - chan->dma.cur - 1;
1464 +#else
1465 + (void)get;(void)cnt;(void)prev_get;
1466 + chan->dma.cur =
1467 + chan->dma.put = NOUVEAU_DMA_SKIPS;
1469 + chan->dma.free = chan->dma.max - chan->dma.cur - 1;
1470 +#endif
1473 return 0;
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
1477 @@ -687,6 +687,7 @@
1478 return auxch_tx(auxch->dev, auxch->rd, cmd, addr, data, data_nr);
1481 +#if !defined(__AROS__)
1482 static int
1483 nouveau_dp_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
1485 @@ -734,3 +735,4 @@
1486 .master_xfer = nouveau_dp_i2c_xfer,
1487 .functionality = nouveau_dp_i2c_func
1489 +#endif
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
1493 @@ -39,10 +39,20 @@
1494 #define NOUVEAU_FAMILY 0x0000FFFF
1495 #define NOUVEAU_FLAGS 0xFFFF0000
1497 +#if defined(__AROS__)
1498 +struct drm_encoder;
1499 +struct drm_minor;
1500 +struct drm_connector;
1501 +#include "drm_compat_types.h"
1502 +#include "drm_compat_funcs.h"
1503 +#endif
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"
1510 +#endif
1511 #include "ttm/ttm_module.h"
1513 struct nouveau_fpriv {
1514 @@ -148,7 +158,7 @@
1515 bool is_iomem;
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);
1520 return ioptr;
1523 @@ -305,11 +315,11 @@
1524 struct list_head flip;
1525 } nvsw;
1527 - struct {
1528 +/*FIXME:COMMENT struct {
1529 bool active;
1530 char name[32];
1531 struct drm_info_list info;
1532 - } debugfs;
1533 + } debugfs;*/
1536 struct nouveau_exec_engine {
1537 @@ -476,7 +486,7 @@
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;
1543 char name[32];
1544 int id;
1546 @@ -541,7 +551,7 @@
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);
1562 +#endif
1564 /* nouveau_state.c */
1565 extern int nouveau_open(struct drm_device *, struct drm_file *);
1566 @@ -1058,7 +1070,7 @@
1567 #else
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; }
1574 #endif
1575 @@ -1105,7 +1117,7 @@
1576 /* nouveau_ttm.c */
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 *);
1582 /* nouveau_dp.c */
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);
1588 +/* nv50_gpio.c */
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
1593 #ifdef __BIG_ENDIAN
1594 #define ioread16_native ioread16be
1595 @@ -1553,6 +1569,7 @@
1596 * Logging
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;
1611 +#else
1612 + return dev->driver->ProductID == device &&
1613 + dev->driver->SubSystemVendorID == sub_vendor &&
1614 + dev->driver->SubSystemProductID == sub_device;
1615 +#endif
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
1622 @@ -27,8 +27,10 @@
1623 #include "drmP.h"
1624 #include "drm.h"
1626 +#if !defined(__AROS__)
1627 #include <linux/ktime.h>
1628 #include <linux/hrtimer.h>
1629 +#endif
1631 #include "nouveau_drv.h"
1632 #include "nouveau_ramht.h"
1633 @@ -82,10 +84,16 @@
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 */
1639 + (void)dev;
1640 + sequence = chan->fence.sequence;
1641 +#else
1642 if (USE_REFCNT(dev))
1643 sequence = nvchan_rd32(chan, 0x48);
1644 else
1645 sequence = atomic_read(&chan->fence.last_sequence_irq);
1646 +#endif
1648 if (chan->fence.sequence_ack == sequence)
1649 goto out;
1650 @@ -231,6 +239,7 @@
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;
1657 ktime_t t;
1658 @@ -264,6 +273,26 @@
1659 __set_current_state(TASK_RUNNING);
1661 return ret;
1662 +#else
1663 + int ret = 0;
1664 + LONG counter = 0;
1665 + while (1)
1667 + if (__nouveau_fence_signalled(sync_obj, sync_arg))
1668 + break;
1670 + udelay(100);
1671 + counter++;
1672 + if (counter > 10000)
1674 + NV_INFO(nouveau_fence(sync_obj)->channel->dev, "Waited too long!\n");
1675 + ret = -EBUSY;
1676 + break;
1680 + return ret;
1681 +#endif
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
1688 @@ -487,7 +487,7 @@
1689 (dev->pci_device & 0x0ff0) == CHIPSET_NFORCE) {
1690 uint32_t mpllP;
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);
1694 if (!mpllP)
1695 mpllP = 4;
1697 @@ -497,7 +497,7 @@
1698 (dev->pci_device & 0xff0) == CHIPSET_NFORCE2) {
1699 uint32_t clock;
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);
1703 return 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);
1715 +#endif
1718 static void
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
1722 @@ -27,6 +27,22 @@
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;
1740 +#endif
1742 static void
1743 nv04_i2c_setscl(void *data, int state)
1745 @@ -227,22 +243,52 @@
1746 return -EINVAL;
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;
1754 +#endif
1755 i2c->dev = dev;
1756 +#if !defined(__AROS__)
1757 i2c_set_adapdata(&i2c->adapter, i2c);
1758 +#endif
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);
1767 +#else
1768 + ret = 0;
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 },
1776 + { TAG_DONE, 0UL }
1777 + };
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");
1783 + kfree(i2c);
1784 + return -EINVAL;
1786 +#endif
1787 } else {
1788 +#if !defined(__AROS__)
1789 i2c->adapter.algo = &nouveau_dp_i2c_algo;
1790 ret = i2c_add_adapter(&i2c->adapter);
1791 +#else
1792 + ret = -EINVAL;
1793 +IMPLEMENT("Handling for (entry->port_type >= 6)\n");
1794 +#endif
1797 if (ret) {
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
1801 @@ -23,8 +23,10 @@
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>
1808 +#endif
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__)
1820 int ret;
1821 +#endif
1823 if (nouveau_msi != 0 && dev_priv->card_type >= NV_50) {
1824 +#if !defined(__AROS__)
1825 ret = pci_enable_msi(dev->pdev);
1826 if (ret == 0) {
1827 NV_INFO(dev, "enabled MSI\n");
1828 dev_priv->msi_enabled = true;
1830 +#else
1831 +IMPLEMENT("Enabling MSI\n");
1832 +#endif
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);
1842 +#else
1843 +IMPLEMENT("Disabling MSI\n");
1844 +#endif
1847 void
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
1851 @@ -36,9 +36,13 @@
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
1861 +#endif
1864 * NV10-NV40 tiling helpers
1866 @@ -393,6 +397,7 @@
1867 int ret, dma_bits;
1869 dma_bits = 32;
1870 +#if !defined(__AROS__)
1871 if (dev_priv->card_type >= NV_50) {
1872 if (pci_dma_supported(dev->pdev, DMA_BIT_MASK(40)))
1873 dma_bits = 40;
1874 @@ -407,6 +412,7 @@
1875 ret = pci_set_dma_mask(dev->pdev, DMA_BIT_MASK(dma_bits));
1876 if (ret)
1877 return ret;
1878 +#endif
1880 ret = nouveau_ttm_global_init(dev_priv);
1881 if (ret)
1882 @@ -811,12 +817,32 @@
1883 prefix, mm->block_size << 12);
1886 +#if defined(__AROS__)
1887 +static int
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;
1892 + int size;
1894 + mutex_lock(&mm->mutex);
1895 + size = nouveau_mm_get_free_space_size(mm);
1896 + mutex_unlock(&mm->mutex);
1898 + return size;
1900 +#endif
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
1911 +#endif
1914 static int
1915 @@ -868,10 +894,22 @@
1919 +#if defined(__AROS__)
1920 +static int
1921 +nouveau_gart_manager_free_space(struct ttm_mem_type_manager *man)
1923 + return 0;
1925 +#endif
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
1936 +#endif
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
1941 @@ -24,7 +24,7 @@
1943 #include "drmP.h"
1944 #include "nouveau_drv.h"
1945 -#include "nouveau_mm.h"
1946 +#include "nouveau_mm_renamed.h"
1948 static inline void
1949 region_put(struct nouveau_mm *mm, struct nouveau_mm_node *a)
1950 @@ -173,3 +173,18 @@
1951 kfree(heap);
1952 return 0;
1955 +#if defined(__AROS__)
1956 +int
1957 +nouveau_mm_get_free_space_size(struct nouveau_mm *mm)
1959 + struct nouveau_mm_node *this;
1960 + int size = 0;
1962 + list_for_each_entry(this, &mm->free, fl_entry) {
1963 + size += this->length;
1966 + return size;
1968 +#endif
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
1972 @@ -51,6 +51,9 @@
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 *);
1978 +#endif
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
1985 @@ -1,7 +1,9 @@
1986 #include "drmP.h"
1987 #include "nouveau_drv.h"
1988 +#if !defined(__AROS__)
1989 #include <linux/pagemap.h>
1990 #include <linux/slab.h>
1991 +#endif
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);
2001 +#else
2002 + dev_priv->gart_info.dummy.page = create_page_helper();
2003 +#endif
2004 if (!dev_priv->gart_info.dummy.page)
2005 return -ENOMEM;
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
2010 @@ -23,18 +23,26 @@
2011 * DEALINGS IN THE SOFTWARE.
2014 +#if !defined(__AROS__)
2015 #include <linux/swab.h>
2016 #include <linux/slab.h>
2017 +#endif
2018 #include "drmP.h"
2019 #include "drm.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>
2025 +#endif
2027 #include "nouveau_drv.h"
2028 #include "nouveau_drm.h"
2029 +#if !defined(__AROS__)
2030 #include "nouveau_fbcon.h"
2031 +#else
2032 +#include "nouveau_fb.h"
2033 +#endif
2034 #include "nouveau_ramht.h"
2035 #include "nouveau_pm.h"
2036 #include "nv50_display.h"
2037 @@ -500,6 +508,7 @@
2038 return 1;
2041 +#if !defined(__AROS__)
2042 /* headless mode */
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;
2049 +#endif
2051 return 0;
2054 +#if !defined(__AROS__)
2055 static unsigned int
2056 nouveau_vga_set_decode(void *priv, bool state)
2058 @@ -529,7 +540,9 @@
2059 else
2060 return VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM;
2062 +#endif
2064 +#if !defined(__AROS__)
2065 static void nouveau_switcheroo_set_state(struct pci_dev *pdev,
2066 enum vga_switcheroo_state state)
2068 @@ -566,6 +579,7 @@
2069 spin_unlock(&dev->count_lock);
2070 return can_switch;
2072 +#endif
2075 nouveau_card_init(struct drm_device *dev)
2076 @@ -574,10 +588,12 @@
2077 struct nouveau_engine *engine;
2078 int ret, e = 0;
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);
2085 +#endif
2087 /* Initialise internal driver API hooks */
2088 ret = nouveau_init_engine_ptrs(dev);
2089 @@ -599,7 +615,9 @@
2090 if (ret)
2091 goto out_display_early;
2093 +#if !defined(__AROS__)
2094 nouveau_pm_init(dev);
2095 +#endif
2097 ret = engine->vram.init(dev);
2098 if (ret)
2099 @@ -778,6 +796,7 @@
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);
2106 if (ret)
2107 @@ -786,11 +805,14 @@
2108 nouveau_fbcon_init(dev);
2109 drm_kms_helper_poll_init(dev);
2111 +#endif
2113 return 0;
2115 +#if !defined(__AROS__)
2116 out_chan:
2117 nouveau_channel_put_unlocked(&dev_priv->channel);
2118 +#endif
2119 out_fence:
2120 nouveau_fence_fini(dev);
2121 out_disp:
2122 @@ -829,12 +851,16 @@
2123 out_vram:
2124 engine->vram.takedown(dev);
2125 out_bios:
2126 +#if !defined(__AROS__)
2127 nouveau_pm_fini(dev);
2128 +#endif
2129 nouveau_bios_takedown(dev);
2130 out_display_early:
2131 engine->display.late_takedown(dev);
2132 out:
2133 +#if !defined(__AROS__)
2134 vga_client_register(dev->pdev, NULL, NULL, NULL);
2135 +#endif
2136 return ret;
2139 @@ -844,11 +870,13 @@
2140 struct nouveau_engine *engine = &dev_priv->engine;
2141 int e;
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);
2149 +#endif
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);
2159 +#endif
2160 nouveau_bios_takedown(dev);
2162 +#if !defined(__AROS__)
2163 vga_client_register(dev->pdev, NULL, NULL, NULL);
2164 +#endif
2168 @@ -978,6 +1010,7 @@
2169 #endif
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);
2178 return 0;
2180 +#endif
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);
2190 if (ret)
2191 goto err_mmio;
2192 +#endif
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();
2202 +#endif
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 @@
2215 kfree(dev_priv);
2216 dev->dev_private = NULL;
2217 +#else
2218 + if (dev_priv)
2220 + nouveau_card_takedown(dev);
2222 + iounmap(dev_priv->mmio);
2223 + iounmap(dev_priv->ramin);
2225 + kfree(dev_priv);
2226 + dev->dev_private = NULL;
2228 +#endif
2229 return 0;
2232 @@ -1266,6 +1317,40 @@
2233 case NOUVEAU_GETPARAM_HAS_PAGEFLIP:
2234 getparam->value = dev_priv->card_type < NV_D0;
2235 break;
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;
2244 + break;
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;
2249 + if (man)
2250 + getparam->value = man->size * 4096;
2252 + break;
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;
2260 + break;
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;
2268 + break;
2269 +#endif
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);
2284 return false;
2285 +#else
2286 + return true;
2287 +#endif
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);
2302 return false;
2303 +#else
2304 + return true;
2305 +#endif
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
2312 @@ -261,6 +261,7 @@
2313 temps->fan_boost = 40;
2316 +#if !defined(__AROS__)
2317 static bool
2318 probe_monitoring_device(struct nouveau_i2c_chan *i2c,
2319 struct i2c_board_info *info)
2320 @@ -300,6 +301,7 @@
2321 nouveau_i2c_identify(dev, "monitoring device", info,
2322 probe_monitoring_device, idx);
2324 +#endif
2326 void
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);
2334 +#else
2335 +IMPLEMENT("Calling nouveau_temp_probe_i2c(dev);\n");
2336 +#endif
2339 void
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
2343 @@ -28,6 +28,7 @@
2345 #include "nouveau_drv.h"
2347 +#if !defined(__AROS__)
2349 nouveau_ttm_mmap(struct file *filp, struct vm_area_struct *vma)
2351 @@ -40,19 +41,32 @@
2353 return ttm_bo_mmap(filp, vma, &dev_priv->ttm.bdev);
2355 +#endif
2357 static int
2358 nouveau_ttm_mem_global_init(struct drm_global_reference *ref)
2360 +#if !defined(__AROS__)
2361 return ttm_mem_global_init(ref->object);
2362 +#else
2363 + return 0;
2364 +#endif
2367 static void
2368 nouveau_ttm_mem_global_release(struct drm_global_reference *ref)
2370 +#if !defined(__AROS__)
2371 ttm_mem_global_release(ref->object);
2372 +#endif
2375 +#if defined(__AROS__)
2376 +struct ttm_mem_global
2378 + ULONG dummy;
2380 +#endif
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
2388 @@ -25,11 +25,17 @@
2392 +#if !defined(__AROS__)
2393 #include <linux/ratelimit.h>
2394 +#else
2395 +#include "drm_compat_funcs.h"
2396 +#endif
2398 #include "nouveau_util.h"
2400 +#if !defined(__AROS__)
2401 static DEFINE_RATELIMIT_STATE(nouveau_ratelimit_state, 3 * HZ, 20);
2402 +#endif
2404 void
2405 nouveau_bitfield_print(const struct nouveau_bitfield *bf, u32 value)
2406 @@ -74,5 +80,10 @@
2408 nouveau_ratelimit(void)
2410 +#if !defined(__AROS__)
2411 return __ratelimit(&nouveau_ratelimit_state);
2412 +#else
2413 +static unsigned int counter = 0;
2414 +return !(counter++ % 50);
2415 +#endif
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
2420 @@ -24,7 +24,7 @@
2422 #include "drmP.h"
2423 #include "nouveau_drv.h"
2424 -#include "nouveau_mm.h"
2425 +#include "nouveau_mm_renamed.h"
2426 #include "nouveau_vm.h"
2428 void
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
2432 @@ -28,7 +28,7 @@
2433 #include "drmP.h"
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
2444 @@ -101,6 +101,7 @@
2445 return -ENOENT;
2448 +#if !defined(__AROS__)
2449 void
2450 nouveau_volt_init(struct drm_device *dev)
2452 @@ -237,6 +238,7 @@
2454 voltage->supported = true;
2456 +#endif
2458 void
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
2463 @@ -33,7 +33,9 @@
2464 #include "nouveau_fb.h"
2465 #include "nouveau_hw.h"
2466 #include "nvreg.h"
2467 +#if !defined(__AROS__)
2468 #include "nouveau_fbcon.h"
2469 +#endif
2471 static int
2472 nv04_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
2473 @@ -675,7 +677,9 @@
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);
2479 +#endif
2480 funcs->dpms(crtc, DRM_MODE_DPMS_OFF);
2482 NVBlankScreen(dev, nv_crtc->index, true);
2483 @@ -708,7 +712,9 @@
2484 #endif
2486 funcs->dpms(crtc, DRM_MODE_DPMS_ON);
2487 +#if !defined(__AROS__)
2488 drm_vblank_post_modeset(dev, nv_crtc->index);
2489 +#endif
2492 static void nv_crtc_destroy(struct drm_crtc *crtc)
2493 @@ -878,6 +884,7 @@
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;
2501 @@ -885,6 +892,7 @@
2502 nouveau_fbcon_save_disable_accel(dev);
2503 else
2504 nouveau_fbcon_restore_accel(dev);
2505 +#endif
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
2512 @@ -34,7 +34,9 @@
2513 #include "nouveau_hw.h"
2514 #include "nvreg.h"
2516 +#if !defined(__AROS__)
2517 #include "i2c/sil164.h"
2518 +#endif
2520 #define FP_TG_CONTROL_ON (NV_PRAMDAC_FP_TG_CONTROL_DISPEN_POS | \
2521 NV_PRAMDAC_FP_TG_CONTROL_HSYNC_POS | \
2522 @@ -614,6 +616,7 @@
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);
2530 @@ -639,6 +642,9 @@
2532 drm_i2c_encoder_init(dev, to_encoder_slave(encoder),
2533 &i2c->adapter, &info[type]);
2534 +#else
2535 +IMPLEMENT("\n");
2536 +#endif
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);
2549 +#endif
2552 static void
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);
2558 +#endif
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);
2574 +#endif
2576 return 0;
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
2581 @@ -32,6 +32,7 @@
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[] = {
2589 @@ -46,6 +47,12 @@
2593 +#else
2594 +static struct i2c_board_info nv04_tv_encoder_info[] = {
2595 + { .type = "ch7006", .addr = 0x75 },
2596 + { }
2598 +#endif
2600 int nv04_tv_identify(struct drm_device *dev, int i2c_index)
2602 @@ -61,6 +68,7 @@
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,
2614 +#endif
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;
2623 @@ -251,4 +261,8 @@
2624 fail_free:
2625 kfree(nv_encoder);
2626 return ret;
2627 +#else
2628 + IMPLEMENT("\n");
2629 + return 0;
2630 +#endif
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
2635 @@ -37,8 +37,8 @@
2637 struct nv31_mpeg_engine *pmpeg = nv_engine(chan->dev, engine);
2639 - if (!atomic_add_unless(&pmpeg->refcount, 1, 1))
2640 - return -EBUSY;
2641 +//FIXME if (!atomic_add_unless(&pmpeg->refcount, 1, 1))
2642 +//FIXME return -EBUSY;
2644 chan->engctx[engine] = (void *)0xdeadcafe;
2645 return 0;
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);
2652 do {
2653 +#if !defined(MOCK_HARDWARE)
2654 if (nv_ro32(disp->ntfy, 0x000))
2655 return 0;
2656 +#else
2657 + return 0;
2658 +#endif
2659 } while (ptimer->read(dev) - start < 2000000000ULL);
2661 return -EBUSY;
2662 @@ -483,7 +487,9 @@
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);
2668 +#endif
2669 nv50_crtc_blank(nv_crtc, true);
2672 @@ -496,7 +502,9 @@
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);
2678 +#endif
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
2685 @@ -30,7 +30,9 @@
2686 #include "nouveau_encoder.h"
2687 #include "nouveau_connector.h"
2688 #include "nouveau_fb.h"
2689 +#if !defined(__AROS__)
2690 #include "nouveau_fbcon.h"
2691 +#endif
2692 #include "nouveau_ramht.h"
2693 #include "drm_crtc_helper.h"
2695 @@ -338,7 +340,9 @@
2699 +#if !defined(__AROS__)
2700 tasklet_init(&priv->tasklet, nv50_display_bh, (unsigned long)dev);
2701 +#endif
2702 nouveau_irq_register(dev, 26, nv50_display_isr);
2704 ret = nv50_display_init(dev);
2705 @@ -365,6 +369,7 @@
2706 void
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);
2716 FIRE_RING (evo);
2717 +#else
2718 + /* No-op under AROS */
2719 +#endif
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);
2730 @@ -486,6 +495,9 @@
2732 dispc->sem.offset ^= 0x10;
2733 dispc->sem.value++;
2734 +#else
2735 + /* No-op under AROS */
2736 +#endif
2737 return 0;
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);
2746 +#endif
2749 +#if !defined(__AROS__)
2750 drm_handle_vblank(dev, crtc);
2751 +#endif
2754 static void
2755 @@ -930,7 +946,9 @@
2756 static void
2757 nv50_display_isr(struct drm_device *dev)
2759 +#if !defined(__AROS__)
2760 struct nv50_display *disp = nv50_display(dev);
2761 +#endif
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));
2767 if (clock) {
2768 nv_wr32(dev, NV03_PMC_INTR_EN_0, 0);
2769 +#if !defined(__AROS__)
2770 tasklet_schedule(&disp->tasklet);
2771 +#else
2772 + /* Kind of hackish call but it does its job. */
2773 + nv50_display_bh((unsigned long)dev);
2774 +#endif
2775 delayed |= clock;
2776 intr1 &= ~clock;
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
2781 @@ -50,7 +50,9 @@
2783 struct nv50_display_crtc crtc[2];
2785 +#if !defined(__AROS__)
2786 struct tasklet_struct tasklet;
2787 +#endif
2788 struct {
2789 struct dcb_entry *dcb;
2790 u16 script;
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
2794 @@ -42,7 +42,11 @@
2795 return -ENOMEM;
2796 pfb->priv = priv;
2798 +#if !defined(__AROS__)
2799 priv->r100c08_page = alloc_page(GFP_KERNEL | __GFP_ZERO);
2800 +#else
2801 + priv->r100c08_page = create_page_helper();
2802 +#endif
2803 if (!priv->r100c08_page) {
2804 nv50_fb_destroy(dev);
2805 return -ENOMEM;
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
2809 @@ -29,7 +29,12 @@
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);
2815 +#else
2816 +struct nv50_gpio_handler;
2817 +static void nv50_gpio_isr_bh(struct nv50_gpio_handler *gpioh);
2818 +#endif
2820 struct nv50_gpio_priv {
2821 struct list_head handlers;
2822 @@ -39,7 +44,9 @@
2823 struct nv50_gpio_handler {
2824 struct drm_device *dev;
2825 struct list_head head;
2826 +#if !defined(__AROS__)
2827 struct work_struct work;
2828 +#endif
2829 bool inhibit;
2831 struct dcb_gpio_entry *gpio;
2832 @@ -147,7 +154,9 @@
2833 if (!gpioh)
2834 return -ENOMEM;
2836 +#if !defined(__AROS__)
2837 INIT_WORK(&gpioh->work, nv50_gpio_isr_bh);
2838 +#endif
2839 gpioh->dev = dev;
2840 gpioh->gpio = gpio;
2841 gpioh->handler = handler;
2842 @@ -181,14 +190,18 @@
2843 gpioh->handler != handler ||
2844 gpioh->data != data)
2845 continue;
2846 +#if !defined(__AROS__)
2847 list_move(&gpioh->head, &tofree);
2848 +#endif
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);
2855 kfree(gpioh);
2857 +#endif
2860 bool
2861 @@ -274,11 +287,17 @@
2862 nv50_gpio_destroy(dev);
2865 +#if !defined(__AROS__)
2866 static void
2867 nv50_gpio_isr_bh(struct work_struct *work)
2869 struct nv50_gpio_handler *gpioh =
2870 container_of(work, struct nv50_gpio_handler, work);
2871 +#else
2872 +static void
2873 +nv50_gpio_isr_bh(struct nv50_gpio_handler *gpioh)
2875 +#endif
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 @@
2880 continue;
2881 gpioh->inhibit = true;
2883 +#if !defined(__AROS__)
2884 schedule_work(&gpioh->work);
2885 +#else
2886 + /* Kind of hackish call but it does its job. */
2887 + nv50_gpio_isr_bh(gpioh);
2888 +#endif
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
2895 @@ -386,7 +386,9 @@
2896 if (!chan->nvsw.vblsem || chan->nvsw.vblsem_offset == ~0 || data > 1)
2897 return -EINVAL;
2899 +#if !defined(__AROS__)
2900 drm_vblank_get(dev, data);
2901 +#endif
2903 chan->nvsw.vblsem_head = data;
2904 list_add(&chan->nvsw.vbl_wait, &dev_priv->vbl_waiting);
2905 @@ -398,7 +400,9 @@
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);
2911 +#endif
2912 return 0;
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
2918 @@ -24,7 +24,7 @@
2920 #include "drmP.h"
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,
2927 @@ -95,6 +95,15 @@
2928 align >>= 12;
2929 size_nc >>= 12;
2931 +#ifdef __AROS__
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
2935 + reason. */
2937 + if (size_nc < size) size_nc = size;
2938 +#endif
2940 mem = kzalloc(sizeof(*mem), GFP_KERNEL);
2941 if (!mem)
2942 return -ENOMEM;
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
2946 @@ -22,7 +22,9 @@
2947 * Authors: Ben Skeggs
2950 +#if !defined(__AROS__)
2951 #include <linux/firmware.h>
2952 +#endif
2953 #include "drmP.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
2959 @@ -22,7 +22,9 @@
2960 * Authors: Ben Skeggs
2963 +#if !defined(__AROS__)
2964 #include <linux/firmware.h>
2965 +#endif
2966 #include "drmP.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
2972 @@ -87,7 +87,11 @@
2973 return -ENOMEM;
2974 pfb->priv = priv;
2976 +#if !defined(__AROS__)
2977 priv->r100c10_page = alloc_page(GFP_KERNEL | __GFP_ZERO);
2978 +#else
2979 + priv->r100c10_page = create_page_helper();
2980 +#endif
2981 if (!priv->r100c10_page) {
2982 nvc0_fb_destroy(dev);
2983 return -ENOMEM;
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
2987 @@ -25,7 +25,7 @@
2988 #include "drmP.h"
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
2999 @@ -22,12 +22,14 @@
3000 * Authors: Ben Skeggs
3003 +#if !defined(__AROS__)
3004 #include <linux/firmware.h>
3005 +#endif
3007 #include "drmP.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"
3015 @@ -313,7 +315,9 @@
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);
3021 +#endif
3022 return 0;
3025 @@ -700,6 +704,7 @@
3026 nv_wr32(dev, 0x400500, 0x00010001);
3029 +#if !defined(__AROS__)
3030 static int
3031 nvc0_graph_create_fw(struct drm_device *dev, const char *fwname,
3032 struct nvc0_graph_fuc *fuc)
3033 @@ -734,18 +739,21 @@
3034 fuc->data = NULL;
3037 +#endif
3039 static void
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);
3051 +#endif
3053 nouveau_irq_unregister(dev, 12);
3055 @@ -787,6 +795,7 @@
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) ||
3063 @@ -797,6 +806,7 @@
3064 goto error;
3067 +#endif
3069 ret = nouveau_gpuobj_new(dev, NULL, 0x1000, 256, 0, &priv->unk4188b4);
3070 if (ret)
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
3074 @@ -24,7 +24,7 @@
3076 #include "drmP.h"
3077 #include "nouveau_drv.h"
3078 -#include "nouveau_mm.h"
3079 +#include "nouveau_mm_renamed.h"
3080 #include "nvc0_graph.h"
3082 static void
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
3086 @@ -24,7 +24,7 @@
3088 #include "drmP.h"
3089 #include "nouveau_drv.h"
3090 -#include "nouveau_mm.h"
3091 +#include "nouveau_mm_renamed.h"
3093 /* 0 = unsupported
3094 * 1 = non-compressed
3095 @@ -70,6 +70,14 @@
3096 align >>= 12;
3097 ncmin >>= 12;
3099 +#ifdef __AROS__
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
3103 + reason. */
3105 + if (ncmin < size) ncmin = size;
3106 +#endif
3107 mem = kzalloc(sizeof(*mem), GFP_KERNEL);
3108 if (!mem)
3109 return -ENOMEM;
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
3113 @@ -22,7 +22,9 @@
3114 * Authors: Ben Skeggs
3117 +#if !defined(__AROS__)
3118 #include <linux/dma-mapping.h>
3119 +#endif
3121 #include "drmP.h"
3122 #include "drm_crtc_helper.h"
3123 @@ -42,7 +44,7 @@
3124 u32 *ptr;
3125 } evo[1];
3127 - struct tasklet_struct tasklet;
3128 +//FIXME struct tasklet_struct tasklet;
3129 u32 modeset;
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);
3163 +#if 0 //FIXME
3164 /* push buffers for evo channels */
3165 disp->evo[0].ptr =
3166 pci_alloc_consistent(pdev, PAGE_SIZE, &disp->evo[0].handle);
3167 @@ -1461,6 +1464,7 @@
3168 ret = -ENOMEM;
3169 goto out;
3171 +#endif
3173 ret = nvd0_display_init(dev);
3174 if (ret)
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
3178 @@ -79,6 +79,12 @@
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
3187 +#endif
3188 struct drm_nouveau_getparam {
3189 uint64_t param;
3190 uint64_t value;
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
3194 @@ -33,11 +33,15 @@
3195 #include "ttm/ttm_bo_driver.h"
3196 #ifdef TTM_HAS_AGP
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>
3204 +#else
3205 +#include "drm_compat_funcs.h"
3206 +#endif
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
3213 @@ -32,6 +32,7 @@
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>
3221 @@ -39,6 +40,10 @@
3222 #include <linux/mm.h>
3223 #include <linux/rbtree.h>
3224 #include <linux/bitmap.h>
3225 +#else
3226 +#include "drm_linux_list.h"
3227 +#include "drm_compat_funcs.h"
3228 +#endif
3230 struct ttm_bo_device;
3232 @@ -264,7 +269,9 @@
3233 * Members protected by the bdev::vm_lock
3236 +#if !defined(__AROS__)
3237 struct rb_node vm_rb;
3238 +#endif
3239 struct drm_mm_node *vm_node;
3242 @@ -662,6 +669,7 @@
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.
3250 @@ -714,6 +722,7 @@
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);
3254 +#endif
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
3261 @@ -31,6 +31,7 @@
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>
3269 @@ -38,12 +39,14 @@
3270 #include <linux/file.h>
3271 #include <linux/module.h>
3272 #include <linux/atomic.h>
3273 +#endif
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);
3284 @@ -51,6 +54,7 @@
3285 .name = "bo_count",
3286 .mode = S_IRUGO
3288 +#endif
3290 static inline int ttm_mem_type_from_flags(uint32_t flags, uint32_t *mem_type)
3292 @@ -100,6 +104,7 @@
3296 +#if !defined(__AROS__)
3297 static ssize_t ttm_bo_global_show(struct kobject *kobj,
3298 struct attribute *attr,
3299 char *buffer)
3300 @@ -125,6 +130,7 @@
3301 .sysfs_ops = &ttm_bo_global_ops,
3302 .default_attrs = ttm_bo_global_attrs
3304 +#endif
3307 static inline uint32_t ttm_bo_type_flags(unsigned type)
3308 @@ -136,7 +142,9 @@
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;
3314 +#endif
3316 BUG_ON(atomic_read(&bo->list_kref.refcount));
3317 BUG_ON(atomic_read(&bo->kref.refcount));
3318 @@ -152,7 +160,9 @@
3319 if (bo->destroy)
3320 bo->destroy(bo);
3321 else {
3322 +#if !defined(__AROS__)
3323 ttm_mem_global_free(bdev->glob->mem_glob, bo->acc_size);
3324 +#endif
3325 kfree(bo);
3328 @@ -351,8 +361,12 @@
3329 break;
3332 +#if !defined(__AROS__)
3333 ret = ttm_tt_set_user(bo->ttm, current,
3334 bo->buffer_start, bo->num_pages);
3335 +#else
3336 +IMPLEMENT("Calling ttm_tt_set_user\n");
3337 +#endif
3338 if (unlikely(ret != 0))
3339 ttm_tt_destroy(bo->ttm);
3340 break;
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();
3350 +#endif
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);
3356 +#endif
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);
3374 +#else
3375 + ttm_bo_delayed_delete(bdev, false);
3376 +#endif
3380 @@ -654,6 +684,7 @@
3381 return ret;
3384 +#if !defined(__AROS__)
3385 static void ttm_bo_delayed_workqueue(struct work_struct *work)
3387 struct ttm_bo_device *bdev =
3388 @@ -664,6 +695,7 @@
3389 ((HZ / 100) < 1) ? 1 : HZ / 100);
3392 +#endif
3394 static void ttm_bo_release(struct kref *kref)
3396 @@ -673,7 +705,9 @@
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);
3402 +#endif
3403 drm_mm_put_block(bo->vm_node);
3404 bo->vm_node = NULL;
3406 @@ -698,6 +732,7 @@
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);
3414 @@ -711,6 +746,7 @@
3415 ((HZ / 100) < 1) ? 1 : HZ / 100);
3417 EXPORT_SYMBOL(ttm_bo_unlock_delayed_workqueue);
3418 +#endif
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 @@
3432 return ret;
3434 +#endif
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);
3450 +#endif
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);
3464 kfree(glob);
3466 +#endif
3468 +#if defined(__AROS__)
3469 +size_t ttm_round_pot(size_t size)
3471 + if ((size & (size - 1)) == 0)
3472 + return size;
3473 + else if (size > PAGE_SIZE)
3474 + return (size_t)PAGE_ALIGN(size);
3475 + else {
3476 + size_t tmp_size = 4;
3478 + while (tmp_size < size)
3479 + tmp_size <<= 1;
3481 + return tmp_size;
3483 + return 0;
3485 +#endif
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);
3504 +#endif
3505 struct ttm_bo_global *glob = ref->object;
3506 - int ret;
3507 + int ret = 0;
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);
3514 +#else
3515 + glob->dummy_read_page = create_page_helper();
3516 +#endif
3518 if (unlikely(glob->dummy_read_page == NULL)) {
3519 ret = -ENOMEM;
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");
3530 goto out_no_shrink;
3532 +#endif
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);
3549 return ret;
3550 +#if !defined(__AROS__)
3551 out_no_shrink:
3552 __free_page(glob->dummy_read_page);
3553 +#endif
3554 out_no_drp:
3555 kfree(glob);
3556 return ret;
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);
3563 +#endif
3565 while (ttm_bo_delayed_delete(bdev, true))
3567 @@ -1544,12 +1618,16 @@
3568 if (unlikely(ret != 0))
3569 goto out_no_sys;
3571 +#if !defined(__AROS__)
3572 bdev->addr_space_rb = RB_ROOT;
3573 +#endif
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);
3580 +#endif
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)
3594 return;
3595 unmap_mapping_range(bdev->dev_mapping, offset, holelen, 1);
3596 +#else
3597 + /* This is no-op under AROS */
3598 +#endif
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);
3614 +#endif
3617 * ttm_bo_setup_vm:
3618 @@ -1678,7 +1762,9 @@
3619 goto retry_pre_get;
3622 +#if !defined(__AROS__)
3623 ttm_bo_vm_insert_rb(bo);
3624 +#endif
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);
3640 +#endif
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
3644 @@ -31,13 +31,19 @@
3645 #define _TTM_BO_DRIVER_H_
3647 #include "ttm/ttm_bo_api.h"
3648 +#if !defined(__AROS__)
3649 #include "ttm/ttm_memory.h"
3650 +#endif
3651 #include "ttm/ttm_module.h"
3652 #include "drm_mm.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"
3658 +#else
3659 +#include "drm_compat_types.h"
3660 +#endif
3662 struct ttm_backend;
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)
3671 +#endif
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;
3681 +#endif
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;
3689 +#endif
3690 enum ttm_caching_state caching_state;
3691 enum {
3692 tt_bound,
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);
3700 +#endif
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;
3714 +#else
3715 + struct page *dummy_read_page;
3716 +#endif
3717 size_t ttm_bo_extra_size;
3718 size_t ttm_bo_size;
3719 struct mutex device_list_mutex;
3720 @@ -557,7 +578,9 @@
3722 * Protected by the vm lock.
3724 +#if !defined(__AROS__)
3725 struct rb_root addr_space_rb;
3726 +#endif
3727 struct drm_mm addr_space_mm;
3730 @@ -577,7 +600,9 @@
3731 * Internal protection.
3734 +#if !defined(__AROS__)
3735 struct delayed_work wq;
3736 +#endif
3738 bool need_dma32;
3740 @@ -1028,6 +1053,7 @@
3741 bool evict, bool no_wait_reserve,
3742 bool no_wait_gpu,
3743 struct ttm_mem_reg *new_mem);
3744 +#if !defined(__AROS__)
3746 * ttm_io_prot
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);
3752 +#endif
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__))
3758 #define TTM_HAS_AGP
3759 +#if !defined(__AROS__)
3760 #include <linux/agp_backend.h>
3761 +#endif
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
3768 @@ -32,9 +32,11 @@
3769 #include "ttm/ttm_bo_driver.h"
3770 #include "ttm/ttm_placement.h"
3771 #include "drm_mm.h"
3772 +#if !defined(__AROS__)
3773 #include <linux/slab.h>
3774 #include <linux/spinlock.h>
3775 #include <linux/module.h>
3776 +#endif
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;
3789 + int size;
3791 + spin_lock(&rman->lock);
3792 + size = drm_mm_get_free_space_size(mm);
3793 + spin_unlock(&rman->lock);
3795 + return size;
3797 +#endif
3799 const struct ttm_mem_type_manager_func ttm_bo_manager_func = {
3800 ttm_bo_man_init,
3801 ttm_bo_man_takedown,
3802 ttm_bo_man_get_node,
3803 ttm_bo_man_put_node,
3804 ttm_bo_man_debug
3805 +#if defined(__AROS__)
3807 + ttm_bo_man_free_space
3808 +#endif
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
3814 @@ -30,12 +30,14 @@
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>
3825 +#endif
3827 void ttm_bo_free_old_node(struct ttm_buffer_object *bo)
3829 @@ -80,8 +82,10 @@
3830 if (likely(man->io_reserve_fastpath))
3831 return 0;
3833 +#if !defined(__AROS__)
3834 if (interruptible)
3835 return mutex_lock_interruptible(&man->io_reserve_mutex);
3836 +#endif
3838 mutex_lock(&man->io_reserve_mutex);
3839 return 0;
3840 @@ -252,6 +256,7 @@
3842 src = (void *)((unsigned long)src + (page << PAGE_SHIFT));
3844 +#if !defined(__AROS__)
3845 #ifdef CONFIG_X86
3846 dst = kmap_atomic_prot(d, prot);
3847 #else
3848 @@ -260,11 +265,15 @@
3849 else
3850 dst = kmap(d);
3851 #endif
3852 +#else
3853 + dst = kmap(d);
3854 +#endif
3855 if (!dst)
3856 return -ENOMEM;
3858 memcpy_fromio(dst, src, PAGE_SIZE);
3860 +#if !defined(__AROS__)
3861 #ifdef CONFIG_X86
3862 kunmap_atomic(dst);
3863 #else
3864 @@ -273,6 +282,9 @@
3865 else
3866 kunmap(d);
3867 #endif
3868 +#else
3869 + kunmap(d);
3870 +#endif
3872 return 0;
3874 @@ -288,6 +300,7 @@
3875 return -ENOMEM;
3877 dst = (void *)((unsigned long)dst + (page << PAGE_SHIFT));
3878 +#if !defined(__AROS__)
3879 #ifdef CONFIG_X86
3880 src = kmap_atomic_prot(s, prot);
3881 #else
3882 @@ -296,11 +309,15 @@
3883 else
3884 src = kmap(s);
3885 #endif
3886 +#else
3887 + src = kmap(s);
3888 +#endif
3889 if (!src)
3890 return -ENOMEM;
3892 memcpy_toio(dst, src, PAGE_SIZE);
3894 +#if !defined(__AROS__)
3895 #ifdef CONFIG_X86
3896 kunmap_atomic(src);
3897 #else
3898 @@ -309,6 +326,9 @@
3899 else
3900 kunmap(s);
3901 #endif
3902 +#else
3903 + kunmap(s);
3904 +#endif
3906 return 0;
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,
3914 PAGE_KERNEL);
3915 +#else
3916 + pgprot_t prot = 0;
3917 +#endif
3918 ret = ttm_copy_ttm_io_page(ttm, new_iomap, page,
3919 prot);
3920 } else if (new_iomap == NULL) {
3921 +#if !defined(__AROS__)
3922 pgprot_t prot = ttm_io_prot(new_mem->placement,
3923 PAGE_KERNEL);
3924 +#else
3925 + pgprot_t prot = 0;
3926 +#endif
3927 ret = ttm_copy_io_ttm_page(ttm, old_iomap, page,
3928 prot);
3929 } else
3930 @@ -444,6 +472,7 @@
3931 return 0;
3934 +#if !defined(__AROS__)
3935 pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp)
3937 #if defined(__i386__) || defined(__x86_64__)
3938 @@ -472,6 +501,7 @@
3939 return tmp;
3941 EXPORT_SYMBOL(ttm_io_prot);
3942 +#endif
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__)
3953 + pgprot_t prot;
3954 +#endif
3955 struct ttm_tt *ttm = bo->ttm;
3956 struct page *d;
3957 int i;
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) ?
3964 PAGE_KERNEL :
3965 ttm_io_prot(mem->placement, PAGE_KERNEL);
3966 +#endif
3967 map->bo_kmap_type = ttm_bo_map_vmap;
3968 map->virtual = vmap(ttm->pages + start_page, num_pages,
3969 0, prot);
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
3973 @@ -31,8 +31,12 @@
3974 #ifndef _TTM_MODULE_H_
3975 #define _TTM_MODULE_H_
3977 +#if !defined(__AROS__)
3978 #include <linux/kernel.h>
3979 struct kobject;
3980 +#else
3981 +#include "drm_compat_types.h"
3982 +#endif
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
3989 @@ -28,6 +28,7 @@
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>
3997 @@ -35,14 +36,19 @@
3998 #include <linux/file.h>
3999 #include <linux/swap.h>
4000 #include <linux/slab.h>
4001 +#else
4002 +#include "drm_compat_types.h"
4003 +#endif
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);
4013 +#endif
4016 * Allocates storage for pointers to the pages that back the ttm.
4017 @@ -52,6 +58,9 @@
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);
4023 +#endif
4026 static void ttm_tt_free_page_directory(struct ttm_tt *ttm)
4027 @@ -60,6 +69,10 @@
4028 ttm->pages = NULL;
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;
4034 +#endif
4037 static void ttm_tt_free_user_pages(struct ttm_tt *ttm)
4038 @@ -87,11 +100,17 @@
4039 continue;
4042 +#if !defined(__AROS__)
4043 if (write && dirty && !PageReserved(page))
4044 set_page_dirty_lock(page);
4045 +#else
4046 + (void)write; (void)dirty;
4047 +#endif
4049 ttm->pages[i] = NULL;
4050 +#if !defined(__AROS__)
4051 ttm_mem_global_free(ttm->glob->mem_glob, PAGE_SIZE);
4052 +#endif
4053 put_page(page);
4055 ttm->state = tt_unpopulated;
4056 @@ -101,6 +120,7 @@
4058 static struct page *__ttm_tt_get_page(struct ttm_tt *ttm, int index)
4060 +#if !defined(__AROS__)
4061 struct page *p;
4062 struct list_head h;
4063 struct ttm_mem_global *mem_glob = ttm->glob->mem_glob;
4064 @@ -131,10 +151,29 @@
4065 out_err:
4066 put_page(p);
4067 return NULL;
4068 +#else
4069 + struct page *p;
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));
4076 + if (!p)
4077 + return NULL;
4079 + if (PageHighMem(p))
4080 + ttm->pages[--ttm->first_himem_page] = p;
4081 + else
4082 + ttm->pages[++ttm->last_lomem_page] = p;
4084 + return p;
4085 +#endif
4088 struct page *ttm_tt_get_page(struct ttm_tt *ttm, int index)
4090 +#if !defined(__AROS__)
4091 int ret;
4093 if (unlikely(ttm->page_flags & TTM_PAGE_FLAG_SWAPPED)) {
4094 @@ -142,6 +181,7 @@
4095 if (unlikely(ret != 0))
4096 return NULL;
4098 +#endif
4099 return __ttm_tt_get_page(ttm, index);
4102 @@ -150,16 +190,20 @@
4103 struct page *page;
4104 unsigned long i;
4105 struct ttm_backend *be;
4106 +#if !defined(__AROS__)
4107 int ret;
4108 +#endif
4110 if (ttm->state != tt_unpopulated)
4111 return 0;
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))
4117 return ret;
4119 +#endif
4121 be = ttm->be;
4123 @@ -279,6 +323,7 @@
4125 static void ttm_tt_free_alloced_pages(struct ttm_tt *ttm)
4127 +#if !defined(__AROS__)
4128 int i;
4129 unsigned count = 0;
4130 struct list_head h;
4131 @@ -309,6 +354,25 @@
4132 ttm->state = tt_unpopulated;
4133 ttm->first_himem_page = ttm->num_pages;
4134 ttm->last_lomem_page = -1;
4135 +#else
4136 + int i;
4137 + struct page *cur_page;
4138 + struct ttm_backend *be = ttm->be;
4140 + if (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;
4146 + if (cur_page) {
4147 + __free_page(cur_page);
4150 + ttm->state = tt_unpopulated;
4151 + ttm->first_himem_page = ttm->num_pages;
4152 + ttm->last_lomem_page = -1;
4153 +#endif
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) &&
4163 ttm->swap_storage)
4164 fput(ttm->swap_storage);
4165 +#endif
4167 kfree(ttm);
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)
4174 @@ -378,6 +445,7 @@
4176 return 0;
4178 +#endif
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)
4182 @@ -458,6 +526,7 @@
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;
4190 @@ -588,3 +657,4 @@
4192 return ret;
4194 +#endif