patch-2.1.110 linux/arch/arm/mm/mm-ebsa285.c
Next file: linux/arch/arm/mm/mm-nexuspci.c
Previous file: linux/arch/arm/mm/mm-ebsa110.c
Back to the patch index
Back to the overall index
- Lines: 148
- Date:
Sun Jul 19 20:45:45 1998
- Orig file:
v2.1.109/linux/arch/arm/mm/mm-ebsa285.c
- Orig date:
Tue Apr 14 14:29:20 1998
diff -u --recursive --new-file v2.1.109/linux/arch/arm/mm/mm-ebsa285.c linux/arch/arm/mm/mm-ebsa285.c
@@ -3,16 +3,48 @@
*
* Extra MM routines for the EBSA285 architecture
*
- * Copyright (C) 1998 Russell King
+ * Copyright (C) 1998 Russell King, Dave Gilbert.
*/
+#include <linux/config.h>
#include <linux/sched.h>
#include <linux/mm.h>
+#include <linux/init.h>
#include <asm/pgtable.h>
#include <asm/page.h>
#include <asm/io.h>
#include <asm/proc/mm-init.h>
-
+
+/*
+ * These two functions convert PCI bus addresses to virtual addresses
+ * and back again.
+ */
+unsigned long __virt_to_bus(unsigned long res)
+{
+ if (res < PAGE_OFFSET || res >= 0xD0000000) {
+ printk("__virt_to_bus: invalid address 0x%08lx\n", res);
+#ifdef CONFIG_DEBUG_ERRORS
+ __backtrace();
+#endif
+ } else
+ res = (res - PAGE_OFFSET) + 0x10000000;
+
+ return res;
+}
+
+unsigned long __bus_to_virt(unsigned long res)
+{
+ if (res < 0x10000000 || res >= 0x20000000) {
+ printk("__bus_to_virt: invalid address 0x%08lx\n", res);
+#ifdef CONFIG_DEBUG_ERRORS
+ __backtrace();
+#endif
+ } else
+ res = (res - 0x10000000) + PAGE_OFFSET;
+
+ return res;
+}
+
/* Logical Physical
* 0xfff00000 0x40000000 X-Bus
* 0xffe00000 0x7c000000 PCI I/O space
@@ -23,75 +55,25 @@
* 0xf8000000 0x7b000000 PCI Config type 0
*/
-static struct mapping {
- unsigned long virtual;
- unsigned long physical;
- unsigned long length;
-} io_mapping[] = {
- /*
- * This is to allow us to fiddle with the EEPROM
- * This entry will go away in time
- */
- { 0xd8000000, 0x41000000, 0x00400000 },
-
- /*
- * These ones are so that we can fiddle
- * with the various cards (eg VGA)
- * until we're happy with them...
- */
- { 0xdc000000, 0x7c000000, 0x00100000 },
- { 0xe0000000, 0x80000000, 0x10000000 },
-
- { 0xf8000000, 0x7b000000, 0x01000000 }, /* Type 0 Config */
-
- { 0xf9000000, 0x7a000000, 0x01000000 }, /* Type 1 Config */
-
- { 0xfc000000, 0x79000000, 0x01000000 }, /* PCI IACK */
- { 0xfd000000, 0x78000000, 0x01000000 }, /* Outbound wflsh*/
- { 0xfe000000, 0x42000000, 0x01000000 }, /* CSR */
- { 0xffe00000, 0x7c000000, 0x00100000 }, /* PCI I/O */
- { 0xfff00000, 0x40000000, 0x00100000 }, /* X-Bus */
-};
-
-#define SIZEOFIO (sizeof(io_mapping) / sizeof(io_mapping[0]))
-
-/* map in IO */
-unsigned long setup_io_pagetables(unsigned long start_mem)
-{
- struct mapping *mp;
- int i;
-
- for (i = 0, mp = io_mapping; i < SIZEOFIO; i++, mp++) {
- while ((mp->virtual & 1048575 || mp->physical & 1048575) && mp->length >= PAGE_SIZE) {
- alloc_init_page(&start_mem, mp->virtual, mp->physical, DOMAIN_IO,
- PTE_AP_WRITE);
-
- mp->length -= PAGE_SIZE;
- mp->virtual += PAGE_SIZE;
- mp->physical += PAGE_SIZE;
- }
-
- while (mp->length >= 1048576) {
-if (mp->virtual > 0xf0000000)
- alloc_init_section(&start_mem, mp->virtual, mp->physical, DOMAIN_IO,
- PMD_SECT_AP_WRITE);
-else
-alloc_init_section(&start_mem, mp->virtual, mp->physical, DOMAIN_USER, PMD_SECT_AP_WRITE | PMD_SECT_AP_READ);
-
- mp->length -= 1048576;
- mp->virtual += 1048576;
- mp->physical += 1048576;
- }
-
- while (mp->length >= PAGE_SIZE) {
- alloc_init_page(&start_mem, mp->virtual, mp->physical, DOMAIN_IO,
- PTE_AP_WRITE);
-
- mp->length -= PAGE_SIZE;
- mp->virtual += PAGE_SIZE;
- mp->physical += PAGE_SIZE;
- }
- }
- return start_mem;
-}
+/*
+ * This is to allow us to fiddle with the EEPROM
+ * This entry will go away in time, once the fmu
+ * can mmap() the flash.
+ *
+ * These ones are so that we can fiddle
+ * with the various cards (eg VGA)
+ * until we're happy with them...
+ */
+#define MAPPING \
+ { 0xd8000000, 0x41000000, 0x00400000, DOMAIN_USER, 1, 1 }, /* EEPROM */ \
+ { 0xdc000000, 0x7c000000, 0x00100000, DOMAIN_USER, 1, 1 }, /* VGA */ \
+ { 0xe0000000, 0x80000000, 0x10000000, DOMAIN_USER, 1, 1 }, /* VGA */ \
+ { 0xf8000000, 0x7b000000, 0x01000000, DOMAIN_IO , 0, 1 }, /* Type 0 Config */ \
+ { 0xf9000000, 0x7a000000, 0x01000000, DOMAIN_IO , 0, 1 }, /* Type 1 Config */ \
+ { 0xfc000000, 0x79000000, 0x01000000, DOMAIN_IO , 0, 1 }, /* PCI IACK */ \
+ { 0xfd000000, 0x78000000, 0x01000000, DOMAIN_IO , 0, 1 }, /* Outbound wflsh*/ \
+ { 0xfe000000, 0x42000000, 0x01000000, DOMAIN_IO , 0, 1 }, /* CSR */ \
+ { 0xffe00000, 0x7c000000, 0x00100000, DOMAIN_IO , 0, 1 }, /* PCI I/O */ \
+ { 0xfff00000, 0x40000000, 0x00100000, DOMAIN_IO , 0, 1 }, /* X-Bus */
+#include "mm-armv.c"
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov