From: Arun Thomas Date: Mon, 13 Aug 2012 15:21:47 +0000 (+0200) Subject: Make memory driver arch-neutral X-Git-Tag: v3.2.1~377 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/man.rndc-confgen.html?a=commitdiff_plain;h=93eadc7040ad53d777ee0b40d85bc73acf945541;p=minix.git Make memory driver arch-neutral -Use PAGE_SIZE instead of I386_PAGE_SIZE -No need to grant ioport access for ARM --- diff --git a/drivers/memory/memory.c b/drivers/memory/memory.c index ff76595ed..e1bfec0c9 100644 --- a/drivers/memory/memory.c +++ b/drivers/memory/memory.c @@ -307,7 +307,7 @@ static int m_transfer( count = dv_size - position; mem_phys = position; - page_off = mem_phys % I386_PAGE_SIZE; + page_off = mem_phys % PAGE_SIZE; pagestart = mem_phys - page_off; /* All memory to the map call has to be page-aligned. @@ -315,11 +315,11 @@ static int m_transfer( */ if(!any_mapped || pagestart_mapped != pagestart) { if(any_mapped) { - if(vm_unmap_phys(SELF, vaddr, I386_PAGE_SIZE) != OK) + if(vm_unmap_phys(SELF, vaddr, PAGE_SIZE) != OK) panic("vm_unmap_phys failed"); any_mapped = 0; } - vaddr = vm_map_phys(SELF, (void *) pagestart, I386_PAGE_SIZE); + vaddr = vm_map_phys(SELF, (void *) pagestart, PAGE_SIZE); if(vaddr == MAP_FAILED) r = ENOMEM; else @@ -333,7 +333,7 @@ static int m_transfer( } /* how much to be done within this page. */ - subcount = I386_PAGE_SIZE-page_off; + subcount = PAGE_SIZE-page_off; if(subcount > count) subcount = count; @@ -388,6 +388,7 @@ static int m_do_open(message *m_ptr) /* Check device number on open. */ if (m_prepare(m_ptr->DEVICE) == NULL) return(ENXIO); +#if defined(__i386__) if (m_device == MEM_DEV) { r = sys_enable_iop(m_ptr->USER_ENDPT); @@ -398,6 +399,7 @@ static int m_do_open(message *m_ptr) return r; } } +#endif openct[m_device]++;