summaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-08-08 22:17:26 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-08-08 22:17:26 +0000
commit984760dbf5e48f6224dfe9e26e03536b3d38b6cd (patch)
treea99674322e524c4c90009b3bdae5fab0eebf2094 /drivers/char
parenta7ce7d5e94c98ef5b867f61b2ebecd563f4b6ec9 (diff)
Merge with Linux 2.4.0-test6-pre8.
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/agp/agpgart_be.c34
-rw-r--r--drivers/char/bttv-driver.c4
-rw-r--r--drivers/char/buz.c12
-rw-r--r--drivers/char/cpia.c4
-rw-r--r--drivers/char/drm/i810_dma.c10
-rw-r--r--drivers/char/drm/memory.c4
-rw-r--r--drivers/char/drm/mga_dma.c10
-rw-r--r--drivers/char/drm/vm.c8
-rw-r--r--drivers/char/ftape/lowlevel/ftape-buffer.c16
-rw-r--r--drivers/char/planb.c8
-rw-r--r--drivers/char/zr36120_mem.c4
11 files changed, 54 insertions, 60 deletions
diff --git a/drivers/char/agp/agpgart_be.c b/drivers/char/agp/agpgart_be.c
index 573419a28..a31a6acf7 100644
--- a/drivers/char/agp/agpgart_be.c
+++ b/drivers/char/agp/agpgart_be.c
@@ -141,8 +141,8 @@ static unsigned long agp_alloc_page(void)
if (pt == NULL) {
return 0;
}
- atomic_inc(&mem_map[MAP_NR(pt)].count);
- set_bit(PG_locked, &mem_map[MAP_NR(pt)].flags);
+ atomic_inc(&virt_to_page(pt)->count);
+ set_bit(PG_locked, &virt_to_page(pt)->flags);
atomic_inc(&agp_bridge.current_memory_agp);
return (unsigned long) pt;
}
@@ -154,9 +154,9 @@ static void agp_destroy_page(unsigned long page)
if (pt == NULL) {
return;
}
- atomic_dec(&mem_map[MAP_NR(pt)].count);
- clear_bit(PG_locked, &mem_map[MAP_NR(pt)].flags);
- wake_up(&mem_map[MAP_NR(pt)].wait);
+ atomic_dec(&virt_to_page(pt)->count);
+ clear_bit(PG_locked, &virt_to_page(pt)->flags);
+ wake_up(&virt_to_page(pt)->wait);
free_page((unsigned long) pt);
atomic_dec(&agp_bridge.current_memory_agp);
}
@@ -541,6 +541,7 @@ static int agp_generic_create_gatt_table(void)
int num_entries;
int i;
void *temp;
+ struct page *page;
/* The generic routines can't handle 2 level gatt's */
if (agp_bridge.size_type == LVL2_APER_SIZE) {
@@ -622,9 +623,8 @@ static int agp_generic_create_gatt_table(void)
}
table_end = table + ((PAGE_SIZE * (1 << page_order)) - 1);
- for (i = MAP_NR(table); i < MAP_NR(table_end); i++) {
- set_bit(PG_reserved, &mem_map[i].flags);
- }
+ for (page = virt_to_page(table); page < get_mem_map(table_end); page++)
+ set_bit(PG_reserved, &page->flags);
agp_bridge.gatt_table_real = (unsigned long *) table;
CACHE_FLUSH();
@@ -633,9 +633,8 @@ static int agp_generic_create_gatt_table(void)
CACHE_FLUSH();
if (agp_bridge.gatt_table == NULL) {
- for (i = MAP_NR(table); i < MAP_NR(table_end); i++) {
- clear_bit(PG_reserved, &mem_map[i].flags);
- }
+ for (page = virt_to_page(table); page < get_mem_map(table_end); page++)
+ clear_bit(PG_reserved, &page->flags);
free_pages((unsigned long) table, page_order);
@@ -653,10 +652,10 @@ static int agp_generic_create_gatt_table(void)
static int agp_generic_free_gatt_table(void)
{
- int i;
int page_order;
char *table, *table_end;
void *temp;
+ struct page *page;
temp = agp_bridge.current_size;
@@ -691,9 +690,8 @@ static int agp_generic_free_gatt_table(void)
table = (char *) agp_bridge.gatt_table_real;
table_end = table + ((PAGE_SIZE * (1 << page_order)) - 1);
- for (i = MAP_NR(table); i < MAP_NR(table_end); i++) {
- clear_bit(PG_reserved, &mem_map[i].flags);
- }
+ for (page = virt_to_page(table); page < get_mem_map(table_end); page++)
+ clear_bit(PG_reserved, &page->flags);
free_pages((unsigned long) agp_bridge.gatt_table_real, page_order);
return 0;
@@ -1500,13 +1498,13 @@ static int amd_create_page_map(amd_page_map *page_map)
if (page_map->real == NULL) {
return -ENOMEM;
}
- set_bit(PG_reserved, &mem_map[MAP_NR(page_map->real)].flags);
+ set_bit(PG_reserved, &virt_to_page(page_map->real)->flags);
CACHE_FLUSH();
page_map->remapped = ioremap_nocache(virt_to_phys(page_map->real),
PAGE_SIZE);
if (page_map->remapped == NULL) {
clear_bit(PG_reserved,
- &mem_map[MAP_NR(page_map->real)].flags);
+ &virt_to_page(page_map->real)->flags);
free_page((unsigned long) page_map->real);
page_map->real = NULL;
return -ENOMEM;
@@ -1524,7 +1522,7 @@ static void amd_free_page_map(amd_page_map *page_map)
{
iounmap(page_map->remapped);
clear_bit(PG_reserved,
- &mem_map[MAP_NR(page_map->real)].flags);
+ &virt_to_page(page_map->real)->flags);
free_page((unsigned long) page_map->real);
}
diff --git a/drivers/char/bttv-driver.c b/drivers/char/bttv-driver.c
index 74d4188a2..6c88a757e 100644
--- a/drivers/char/bttv-driver.c
+++ b/drivers/char/bttv-driver.c
@@ -191,7 +191,7 @@ static void * rvmalloc(signed long size)
while (size > 0)
{
page = kvirt_to_pa(adr);
- mem_map_reserve(MAP_NR(__va(page)));
+ mem_map_reserve(virt_to_page(__va(page)));
adr+=PAGE_SIZE;
size-=PAGE_SIZE;
}
@@ -209,7 +209,7 @@ static void rvfree(void * mem, signed long size)
while (size > 0)
{
page = kvirt_to_pa(adr);
- mem_map_unreserve(MAP_NR(__va(page)));
+ mem_map_unreserve(virt_to_page(__va(page)));
adr+=PAGE_SIZE;
size-=PAGE_SIZE;
}
diff --git a/drivers/char/buz.c b/drivers/char/buz.c
index 299a4f8ca..ca3cb4f47 100644
--- a/drivers/char/buz.c
+++ b/drivers/char/buz.c
@@ -199,7 +199,7 @@ static int v4l_fbuffer_alloc(struct zoran *zr)
zr->v4l_gbuf[i].fbuffer_phys = virt_to_phys(mem);
zr->v4l_gbuf[i].fbuffer_bus = virt_to_bus(mem);
for (off = 0; off < v4l_bufsize; off += PAGE_SIZE)
- mem_map_reserve(MAP_NR(mem + off));
+ mem_map_reserve(virt_to_page(mem + off));
DEBUG(printk(BUZ_INFO ": V4L frame %d mem 0x%x (bus: 0x%x=%d)\n", i, mem, virt_to_bus(mem), virt_to_bus(mem)));
} else {
return -ENOBUFS;
@@ -221,7 +221,7 @@ static void v4l_fbuffer_free(struct zoran *zr)
mem = zr->v4l_gbuf[i].fbuffer;
for (off = 0; off < v4l_bufsize; off += PAGE_SIZE)
- mem_map_unreserve(MAP_NR(mem + off));
+ mem_map_unreserve(virt_to_page(mem + off));
kfree((void *) zr->v4l_gbuf[i].fbuffer);
zr->v4l_gbuf[i].fbuffer = NULL;
}
@@ -286,7 +286,7 @@ static int jpg_fbuffer_alloc(struct zoran *zr)
zr->jpg_gbuf[i].frag_tab[0] = virt_to_bus((void *) mem);
zr->jpg_gbuf[i].frag_tab[1] = ((zr->jpg_bufsize / 4) << 1) | 1;
for (off = 0; off < zr->jpg_bufsize; off += PAGE_SIZE)
- mem_map_reserve(MAP_NR(mem + off));
+ mem_map_reserve(virt_to_page(mem + off));
} else {
/* jpg_bufsize is alreay page aligned */
for (j = 0; j < zr->jpg_bufsize / PAGE_SIZE; j++) {
@@ -297,7 +297,7 @@ static int jpg_fbuffer_alloc(struct zoran *zr)
}
zr->jpg_gbuf[i].frag_tab[2 * j] = virt_to_bus((void *) mem);
zr->jpg_gbuf[i].frag_tab[2 * j + 1] = (PAGE_SIZE / 4) << 1;
- mem_map_reserve(MAP_NR(mem));
+ mem_map_reserve(virt_to_page(mem));
}
zr->jpg_gbuf[i].frag_tab[2 * j - 1] |= 1;
@@ -329,7 +329,7 @@ static void jpg_fbuffer_free(struct zoran *zr)
if (zr->jpg_gbuf[i].frag_tab[0]) {
mem = (unsigned char *) bus_to_virt(zr->jpg_gbuf[i].frag_tab[0]);
for (off = 0; off < zr->jpg_bufsize; off += PAGE_SIZE)
- mem_map_unreserve(MAP_NR(mem + off));
+ mem_map_unreserve(virt_to_page(mem + off));
kfree((void *) mem);
zr->jpg_gbuf[i].frag_tab[0] = 0;
zr->jpg_gbuf[i].frag_tab[1] = 0;
@@ -338,7 +338,7 @@ static void jpg_fbuffer_free(struct zoran *zr)
for (j = 0; j < zr->jpg_bufsize / PAGE_SIZE; j++) {
if (!zr->jpg_gbuf[i].frag_tab[2 * j])
break;
- mem_map_unreserve(MAP_NR(bus_to_virt(zr->jpg_gbuf[i].frag_tab[2 * j])));
+ mem_map_unreserve(virt_to_page(bus_to_virt(zr->jpg_gbuf[i].frag_tab[2 * j])));
free_page((unsigned long) bus_to_virt(zr->jpg_gbuf[i].frag_tab[2 * j]));
zr->jpg_gbuf[i].frag_tab[2 * j] = 0;
zr->jpg_gbuf[i].frag_tab[2 * j + 1] = 0;
diff --git a/drivers/char/cpia.c b/drivers/char/cpia.c
index c9ec988d1..d7d007f01 100644
--- a/drivers/char/cpia.c
+++ b/drivers/char/cpia.c
@@ -239,7 +239,7 @@ static void *rvmalloc(unsigned long size)
adr = (unsigned long) mem;
while (size > 0) {
page = kvirt_to_pa(adr);
- mem_map_reserve(MAP_NR(__va(page)));
+ mem_map_reserve(virt_to_page(__va(page)));
adr += PAGE_SIZE;
if (size > PAGE_SIZE)
size -= PAGE_SIZE;
@@ -263,7 +263,7 @@ static void rvfree(void *mem, unsigned long size)
adr = (unsigned long) mem;
while (size > 0) {
page = kvirt_to_pa(adr);
- mem_map_unreserve(MAP_NR(__va(page)));
+ mem_map_unreserve(virt_to_page(__va(page)));
adr += PAGE_SIZE;
if (size > PAGE_SIZE)
size -= PAGE_SIZE;
diff --git a/drivers/char/drm/i810_dma.c b/drivers/char/drm/i810_dma.c
index f3d9db43e..19b7bd928 100644
--- a/drivers/char/drm/i810_dma.c
+++ b/drivers/char/drm/i810_dma.c
@@ -282,8 +282,8 @@ static unsigned long i810_alloc_page(drm_device_t *dev)
if(address == 0UL)
return 0;
- atomic_inc(&mem_map[MAP_NR((void *) address)].count);
- set_bit(PG_locked, &mem_map[MAP_NR((void *) address)].flags);
+ atomic_inc(&virt_to_page(address)->count);
+ set_bit(PG_locked, &virt_to_page(address)->flags);
return address;
}
@@ -293,9 +293,9 @@ static void i810_free_page(drm_device_t *dev, unsigned long page)
if(page == 0UL)
return;
- atomic_dec(&mem_map[MAP_NR((void *) page)].count);
- clear_bit(PG_locked, &mem_map[MAP_NR((void *) page)].flags);
- wake_up(&mem_map[MAP_NR((void *) page)].wait);
+ atomic_dec(&virt_to_page(page)->count);
+ clear_bit(PG_locked, &virt_to_page(page)->flags);
+ wake_up(&virt_to_page(page)->wait);
free_page(page);
return;
}
diff --git a/drivers/char/drm/memory.c b/drivers/char/drm/memory.c
index 5023de808..43e46f1d6 100644
--- a/drivers/char/drm/memory.c
+++ b/drivers/char/drm/memory.c
@@ -246,7 +246,7 @@ unsigned long drm_alloc_pages(int order, int area)
for (addr = address, sz = bytes;
sz > 0;
addr += PAGE_SIZE, sz -= PAGE_SIZE) {
- mem_map_reserve(MAP_NR(addr));
+ mem_map_reserve(virt_to_page(addr));
}
return address;
@@ -267,7 +267,7 @@ void drm_free_pages(unsigned long address, int order, int area)
for (addr = address, sz = bytes;
sz > 0;
addr += PAGE_SIZE, sz -= PAGE_SIZE) {
- mem_map_unreserve(MAP_NR(addr));
+ mem_map_unreserve(virt_to_page(addr));
}
free_pages(address, order);
}
diff --git a/drivers/char/drm/mga_dma.c b/drivers/char/drm/mga_dma.c
index 28e8811c8..d02c3b581 100644
--- a/drivers/char/drm/mga_dma.c
+++ b/drivers/char/drm/mga_dma.c
@@ -57,8 +57,8 @@ static unsigned long mga_alloc_page(drm_device_t *dev)
if(address == 0UL) {
return 0;
}
- atomic_inc(&mem_map[MAP_NR((void *) address)].count);
- set_bit(PG_locked, &mem_map[MAP_NR((void *) address)].flags);
+ atomic_inc(&virt_to_page(address)->count);
+ set_bit(PG_locked, &virt_to_page(address)->flags);
return address;
}
@@ -70,9 +70,9 @@ static void mga_free_page(drm_device_t *dev, unsigned long page)
if(page == 0UL) {
return;
}
- atomic_dec(&mem_map[MAP_NR((void *) page)].count);
- clear_bit(PG_locked, &mem_map[MAP_NR((void *) page)].flags);
- wake_up(&mem_map[MAP_NR((void *) page)].wait);
+ atomic_dec(&virt_to_page(page)->count);
+ clear_bit(PG_locked, &virt_to_page(page)->flags);
+ wake_up(&virt_to_page(page)->wait);
free_page(page);
return;
}
diff --git a/drivers/char/drm/vm.c b/drivers/char/drm/vm.c
index 5ee9e3242..1386bd172 100644
--- a/drivers/char/drm/vm.c
+++ b/drivers/char/drm/vm.c
@@ -89,13 +89,13 @@ struct page *drm_vm_shm_nopage(struct vm_area_struct *vma,
offset = address - vma->vm_start;
page = offset >> PAGE_SHIFT;
physical = (unsigned long)dev->lock.hw_lock + offset;
- atomic_inc(&mem_map[MAP_NR(physical)].count); /* Dec. by kernel */
+ atomic_inc(&virt_to_page(physical)->count); /* Dec. by kernel */
DRM_DEBUG("0x%08lx (page %lu) => 0x%08lx\n", address, page, physical);
#if LINUX_VERSION_CODE < 0x020317
return physical;
#else
- return mem_map + MAP_NR(physical);
+ return (virt_to_page(physical));
#endif
}
@@ -124,13 +124,13 @@ struct page *drm_vm_dma_nopage(struct vm_area_struct *vma,
offset = address - vma->vm_start; /* vm_[pg]off[set] should be 0 */
page = offset >> PAGE_SHIFT;
physical = dma->pagelist[page] + (offset & (~PAGE_MASK));
- atomic_inc(&mem_map[MAP_NR(physical)].count); /* Dec. by kernel */
+ atomic_inc(&virt_to_page(physical)->count); /* Dec. by kernel */
DRM_DEBUG("0x%08lx (page %lu) => 0x%08lx\n", address, page, physical);
#if LINUX_VERSION_CODE < 0x020317
return physical;
#else
- return mem_map + MAP_NR(physical);
+ return (virt_to_page(physical));
#endif
}
diff --git a/drivers/char/ftape/lowlevel/ftape-buffer.c b/drivers/char/ftape/lowlevel/ftape-buffer.c
index d7d31dbbb..bf3addcf4 100644
--- a/drivers/char/ftape/lowlevel/ftape-buffer.c
+++ b/drivers/char/ftape/lowlevel/ftape-buffer.c
@@ -48,11 +48,10 @@ static inline void *dmaalloc(size_t size)
}
addr = __get_dma_pages(GFP_KERNEL, get_order(size));
if (addr) {
- int i;
+ struct page *page;
- for (i = MAP_NR(addr); i < MAP_NR(addr+size); i++) {
- mem_map_reserve(i);
- }
+ for (page = virt_to_page(addr); page < get_mem_map(addr+size); page++)
+ mem_map_reserve(page);
}
return (void *)addr;
}
@@ -60,12 +59,11 @@ static inline void *dmaalloc(size_t size)
static inline void dmafree(void *addr, size_t size)
{
if (size > 0) {
- int i;
+ struct page *page;
- for (i = MAP_NR((unsigned long)addr);
- i < MAP_NR((unsigned long)addr+size); i++) {
- mem_map_unreserve (i);
- }
+ for (page = virt_to_page((unsigned long)addr);
+ page < virt_to_page((unsigned long)addr+size); page++)
+ mem_map_unreserve(page);
free_pages((unsigned long) addr, get_order(size));
}
}
diff --git a/drivers/char/planb.c b/drivers/char/planb.c
index fe5f905e9..94707619d 100644
--- a/drivers/char/planb.c
+++ b/drivers/char/planb.c
@@ -136,13 +136,12 @@ static int grabbuf_alloc(struct planb *pb)
|GFP_DMA, 0);
if (!pb->rawbuf[i])
break;
- set_bit(PG_reserved, &mem_map[MAP_NR(pb->rawbuf[i])].flags);
+ mem_map_reserve(virt_to_page(pb->rawbuf[i]));
}
if (i-- < npage) {
printk(KERN_DEBUG "PlanB: init_grab: grab buffer not allocated\n");
for (; i > 0; i--) {
- clear_bit(PG_reserved,
- &mem_map[MAP_NR(pb->rawbuf[i])].flags);
+ mem_map_unreserve(virt_to_page(pb->rawbuf[i]));
free_pages((unsigned long)pb->rawbuf[i], 0);
}
kfree(pb->rawbuf);
@@ -435,8 +434,7 @@ static void planb_prepare_close(struct planb *pb)
}
if(pb->rawbuf) {
for (i = 0; i < pb->rawbuf_size; i++) {
- clear_bit(PG_reserved,
- &mem_map[MAP_NR(pb->rawbuf[i])].flags);
+ mem_map_unreserve(virt_to_page(pb->rawbuf[i]));
free_pages((unsigned long)pb->rawbuf[i], 0);
}
kfree(pb->rawbuf);
diff --git a/drivers/char/zr36120_mem.c b/drivers/char/zr36120_mem.c
index 082cfee06..b4c6078d3 100644
--- a/drivers/char/zr36120_mem.c
+++ b/drivers/char/zr36120_mem.c
@@ -50,7 +50,7 @@ void* bmalloc(unsigned long size)
if (mem) {
unsigned long adr = (unsigned long)mem;
while (size > 0) {
- mem_map_reserve(MAP_NR(phys_to_virt(adr)));
+ mem_map_reserve(virt_to_page(phys_to_virt(adr)));
adr += PAGE_SIZE;
size -= PAGE_SIZE;
}
@@ -64,7 +64,7 @@ void bfree(void* mem, unsigned long size)
unsigned long adr = (unsigned long)mem;
unsigned long siz = size;
while (siz > 0) {
- mem_map_unreserve(MAP_NR(phys_to_virt(adr)));
+ mem_map_unreserve(virt_to_page(phys_to_virt(adr)));
adr += PAGE_SIZE;
siz -= PAGE_SIZE;
}