summaryrefslogtreecommitdiff
path: root/usr/src/uts/intel/io/i915/i915_io32.c
blob: 89e37c4a7670d9888a509db63ee52cdd35c04d05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/*
 * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice (including the next
 * paragraph) shall be included in all copies or substantial portions of the
 * Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 */

/*
 * Copyright (c) 2012 Intel Corporation.  All rights reserved.
 */

#include "drm.h"
#include "drmP.h"
#include "i915_drm.h"

int 
copyin32_i915_batchbuffer(void * dest, void * src)
{
	struct drm_i915_batchbuffer *dest64 = dest;
	struct drm_i915_batchbuffer32 dest32;

	DRM_COPYFROM_WITH_RETURN(&dest32, (void *)src, sizeof (dest32));

	dest64->start = dest32.start;
	dest64->used = dest32.used;
	dest64->DR1 = dest32.DR1;
	dest64->DR4 = dest32.DR4;
	dest64->num_cliprects = dest32.num_cliprects;
	dest64->cliprects = (drm_clip_rect_t __user *)(uintptr_t)dest32.cliprects;
	
	return (0);
}

int 
copyin32_i915_irq_emit(void *dest, void *src)
{
	struct drm_i915_irq_emit *dest64 = dest;
	struct drm_i915_irq_emit32 dest32;

	DRM_COPYFROM_WITH_RETURN(&dest32, (void *)src, sizeof (dest32));
	
	dest64->irq_seq = (int __user *)(uintptr_t)dest32.irq_seq;

	return (0);
}

int 
copyin32_i915_getparam(void *dest, void *src)
{
	struct drm_i915_getparam *dest64 = dest;
	struct drm_i915_getparam32 dest32;

	DRM_COPYFROM_WITH_RETURN(&dest32, (void *)src, sizeof (dest32));

	dest64->param = dest32.param;
	dest64->value = (int __user *)(uintptr_t)dest32.value;

	return (0);
}

int 
copyin32_i915_cmdbuffer(void * dest, void * src)
{
	struct _drm_i915_cmdbuffer *dest64 = dest;
	struct drm_i915_cmdbuffer32 dest32;

	DRM_COPYFROM_WITH_RETURN(&dest32, (void *)src, sizeof (dest32));
	
	dest64->buf = (char __user *)(uintptr_t)dest32.buf;
	dest64->sz = dest32.sz;
	dest64->DR1 = dest32.DR1;
	dest64->DR4 = dest32.DR4;
	dest64->num_cliprects = dest32.num_cliprects;
	dest64->cliprects = (drm_clip_rect_t __user *)(uintptr_t)dest32.cliprects;
	
	return (0);
}

int 
copyin32_i915_mem_alloc(void *dest, void *src)
{
	struct drm_i915_mem_alloc *dest64 = dest;
	struct drm_i915_mem_alloc32 dest32;

	DRM_COPYFROM_WITH_RETURN(&dest32, (void *)src, sizeof (dest32));

	dest64->region = dest32.region;
	dest64->alignment = dest32.alignment;
	dest64->size = dest32.size;
	dest64->region_offset = (int *)(uintptr_t)dest32.region_offset;

	return (0);
}