15 #include <linux/errno.h>
17 #include <linux/types.h>
18 #include <linux/slab.h>
20 #include <asm/uaccess.h>
23 #define IDA_SIZE_LOG 12
25 #define IDA_SIZE_LOG 11
27 #define IDA_BLOCK_SIZE (1L<<IDA_SIZE_LOG)
36 return ((
__pa(vaddr) + length - 1) >> 31) != 0;
46 static inline unsigned int idal_nr_words(
void *
vaddr,
unsigned int length)
55 static inline unsigned long *idal_create_words(
unsigned long *idaws,
56 void *vaddr,
unsigned int length)
78 set_normalized_cda(
struct ccw1 *
ccw,
void *vaddr)
86 nridaws = idal_nr_words(vaddr, ccw->
count);
88 idal =
kmalloc(nridaws *
sizeof(
unsigned long),
92 idal_create_words(idal, vaddr, ccw->
count);
105 clear_normalized_cda(
struct ccw1 * ccw)
109 kfree((
void *)(
unsigned long) ccw->
cda);
132 int nr_chunks, nr_ptrs,
i;
142 for (i = 0; i < nr_ptrs; i++) {
143 if ((i & (nr_chunks - 1)) != 0) {
147 ib->
data[
i] = (
void *)
152 while (i >= nr_chunks) {
169 int nr_chunks, nr_ptrs,
i;
173 for (i = 0; i < nr_ptrs; i += nr_chunks)
186 idal_is_needed(ib->
data[0], ib->
size);
198 if (__idal_buffer_is_needed(ib)) {
222 to = (
void __user *) to + IDA_BLOCK_SIZE;
232 idal_buffer_from_user(
struct idal_buffer *ib,
const void __user *
from,
size_t count)
242 from = (
void __user *) from + IDA_BLOCK_SIZE;