summaryrefslogtreecommitdiff
path: root/linux/dev
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2012-03-23 02:19:44 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2012-03-24 02:54:49 +0100
commit264b750cc2d576beadfd74bcde45ac75edc4aab9 (patch)
treecd1b50f73e31c9dc577083c49062d695c836933a /linux/dev
parent7effecf87173a122c95427dafa971abbbdba3493 (diff)
Add missing phystokv/kvtophys calls
* i386/i386/vm_param.h [!MACH_XEN]: Do not include <xen/public/xen.h>. * i386/i386at/model_dep.c (init_alloc_aligned): Use phystokv to compare physical memory addresses with kernel start, end, and symbol table. * i386/intel/pmap.c (pmap_enter): Use kvtophys to convert ptp pointer to pte entry. * linux/dev/init/main.c (alloc_contig_mem, linux_init): Use phystokv to convert allocated pages to virtual pointer. * linux/src/include/asm-i386/io.h: Include <machine/vm_param.h>. (virt_to_phys): Call _kvtophys. (phys_to_virt): Call phystokv. * linux/src/include/linux/compatmac.h: Include <asm/io.h>. (ioremap): Use phys_to_virt to convert physical address to virtual pointer. (my_iounmap): Likewise. * linux/dev/include/asm-i386/page.h: Include <mach/vm_param.h>. (PAGE_SHIFT, PAGE_SIZE, PAGE_MASK): Remove macros. * linux/src/drivers/scsi/ncr53c8xx.c (vm_size_t): Remove type. * linux/dev/glue/net.c: Include <machine/vm_param.h> (device_write): Call phystokv to convert from physical page address to virtual pointer. * linux/dev/glue/block.c (alloc_buffer, free_buffer, rdwr_full): Likewise.
Diffstat (limited to 'linux/dev')
-rw-r--r--linux/dev/glue/block.c8
-rw-r--r--linux/dev/glue/net.c7
-rw-r--r--linux/dev/include/asm-i386/page.h7
-rw-r--r--linux/dev/init/main.c4
4 files changed, 11 insertions, 15 deletions
diff --git a/linux/dev/glue/block.c b/linux/dev/glue/block.c
index c7b3873..63bc766 100644
--- a/linux/dev/glue/block.c
+++ b/linux/dev/glue/block.c
@@ -307,7 +307,7 @@ alloc_buffer (int size)
d = current_thread ()->pcb->data;
assert (d);
queue_enter (&d->pages, m, vm_page_t, pageq);
- return (void *) m->phys_addr;
+ return (void *) phystokv(m->phys_addr);
}
return (void *) __get_free_pages (GFP_KERNEL, 0, ~0UL);
}
@@ -327,7 +327,7 @@ free_buffer (void *p, int size)
assert (d);
queue_iterate (&d->pages, m, vm_page_t, pageq)
{
- if (m->phys_addr == (vm_offset_t) p)
+ if (phystokv(m->phys_addr) == (vm_offset_t) p)
{
queue_remove (&d->pages, m, vm_page_t, pageq);
VM_PAGE_FREE (m);
@@ -600,9 +600,9 @@ rdwr_full (int rw, kdev_t dev, loff_t *off, char **buf, int *resid, int bshift)
if (cc > ((nbuf - nb) << bshift))
cc = (nbuf - nb) << bshift;
if (! test_bit (BH_Bounce, &bh->b_state))
- bh->b_data = (char *) pmap_extract (vm_map_pmap (device_io_map),
+ bh->b_data = (char *) phystokv(pmap_extract (vm_map_pmap (device_io_map),
(((vm_offset_t) *buf)
- + (nb << bshift)));
+ + (nb << bshift))));
else
{
bh->b_data = alloc_buffer (cc);
diff --git a/linux/dev/glue/net.c b/linux/dev/glue/net.c
index a60275f..1573273 100644
--- a/linux/dev/glue/net.c
+++ b/linux/dev/glue/net.c
@@ -61,6 +61,7 @@
#include <sys/types.h>
#include <machine/spl.h>
+#include <machine/vm_param.h>
#include <mach/mach_types.h>
#include <mach/kern_return.h>
@@ -449,7 +450,7 @@ device_write (void *d, ipc_port_t reply_port,
assert (copy->cpy_npages == 1);
skb->copy = copy;
- skb->data = ((void *) copy->cpy_page_list[0]->phys_addr
+ skb->data = ((void *) phystokv(copy->cpy_page_list[0]->phys_addr)
+ (copy->offset & PAGE_MASK));
skb->len = count;
skb->head = skb->data;
@@ -463,7 +464,7 @@ device_write (void *d, ipc_port_t reply_port,
skb->end = skb->tail;
memcpy (skb->data,
- ((void *) copy->cpy_page_list[0]->phys_addr
+ ((void *) phystokv(copy->cpy_page_list[0]->phys_addr)
+ (copy->offset & PAGE_MASK)),
amt);
count -= amt;
@@ -473,7 +474,7 @@ device_write (void *d, ipc_port_t reply_port,
amt = PAGE_SIZE;
if (amt > count)
amt = count;
- memcpy (p, (void *) copy->cpy_page_list[i]->phys_addr, amt);
+ memcpy (p, (void *) phystokv(copy->cpy_page_list[i]->phys_addr), amt);
count -= amt;
p += amt;
}
diff --git a/linux/dev/include/asm-i386/page.h b/linux/dev/include/asm-i386/page.h
index 2bb6837..be81848 100644
--- a/linux/dev/include/asm-i386/page.h
+++ b/linux/dev/include/asm-i386/page.h
@@ -1,12 +1,7 @@
#ifndef _I386_PAGE_H
#define _I386_PAGE_H
-#ifndef MACH_INCLUDE
-/* PAGE_SHIFT determines the page size */
-#define PAGE_SHIFT 12
-#define PAGE_SIZE (1UL << PAGE_SHIFT)
-#define PAGE_MASK (~(PAGE_SIZE-1))
-#endif
+#include <mach/vm_param.h>
#ifdef __KERNEL__
diff --git a/linux/dev/init/main.c b/linux/dev/init/main.c
index f5c4832..ecbd0b6 100644
--- a/linux/dev/init/main.c
+++ b/linux/dev/init/main.c
@@ -149,7 +149,7 @@ linux_init (void)
/*
* Free unused memory.
*/
- while (pages && pages->phys_addr < round_page (memory_start))
+ while (pages && phystokv(pages->phys_addr) < round_page (memory_start))
pages = (vm_page_t) pages->pageq.next;
if (pages)
free_contig_mem (pages);
@@ -296,7 +296,7 @@ alloc_contig_mem (unsigned size, unsigned limit,
kfree ((vm_offset_t) bits, bits_len);
if (pages)
*pages = page_list;
- return (m);
+ return phystokv(m);
}
/*