Re: [PATCH 2.6] Allow platforms to override mem_types[] defa…

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Deepak Saxena
Date:  
To: rmk
CC: linux-arm-kernel
Subject: Re: [PATCH 2.6] Allow platforms to override mem_types[] default
On Sep 10 2004, at 19:15, Russell King - ARM Linux was caught saying:
> Alternatively, define a new MT_IXP_DEVICE type and throw the required
> bits in the table.


Patch follows. If OK, I'll push next week. Using IXP2000_DEVICE
b/c of IXP4xx and other future IXPs.

===== include/asm-arm/mach/map.h 1.2 vs edited =====
--- 1.2/include/asm-arm/mach/map.h    Tue Jun  4 16:19:07 2002
+++ edited/include/asm-arm/mach/map.h    Fri Sep 10 13:24:34 2004
@@ -18,11 +18,12 @@


struct meminfo;

-#define MT_DEVICE    0
-#define MT_CACHECLEAN    1
-#define MT_MINICLEAN    2
-#define MT_VECTORS    3
-#define MT_MEMORY    4
+#define MT_DEVICE        0
+#define MT_CACHECLEAN        1
+#define MT_MINICLEAN        2
+#define MT_VECTORS        3
+#define MT_MEMORY        4
+#define MT_IXP2000_DEVICE    5


 extern void create_memmap_holes(struct meminfo *);
 extern void memtable_init(struct meminfo *);
===== arch/arm/mm/mm-armv.c 1.29 vs edited =====
--- 1.29/arch/arm/mm/mm-armv.c    Sat May 22 14:56:23 2004
+++ edited/arch/arm/mm/mm-armv.c    Fri Sep 10 13:13:32 2004
@@ -326,7 +326,16 @@
     [MT_MEMORY] = {
         .prot_sect = PMD_TYPE_SECT | PMD_SECT_AP_WRITE,
         .domain    = DOMAIN_KERNEL,
-    }
+    },
+    [MT_IXP2000_DEVICE] = {
+        .prot_pte  = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY |
+                L_PTE_WRITE,
+        .prot_l1   = PMD_TYPE_TABLE,
+        .prot_sect = PMD_TYPE_SECT | PMD_SECT_UNCACHED |
+                PMD_SECT_AP_WRITE | PMD_SECT_BUFFERABLE |
+                PMD_SECT_TEX(1),
+        .domain    = DOMAIN_IO,
+    },
 };


 /*
===== arch/arm/mach-ixp2000/core.c 1.3 vs edited =====
--- 1.3/arch/arm/mach-ixp2000/core.c    Thu Sep  2 00:34:32 2004
+++ edited/arch/arm/mach-ixp2000/core.c    Fri Sep 10 13:21:36 2004
@@ -81,66 +81,51 @@
 /*************************************************************************
  * Chip specific mappings shared by all IXP2000 systems
  *************************************************************************/
-static struct map_desc ixp2000_small_io_desc[] __initdata = {
+static struct map_desc ixp2000_io_desc[] __initdata = {
     {
         .virtual    = IXP2000_GLOBAL_REG_VIRT_BASE,
         .physical    = IXP2000_GLOBAL_REG_PHYS_BASE,
         .length        = IXP2000_GLOBAL_REG_SIZE,
-        .type        = MT_DEVICE
     }, {
         .virtual    = IXP2000_GPIO_VIRT_BASE,
         .physical    = IXP2000_GPIO_PHYS_BASE,
         .length        = IXP2000_GPIO_SIZE,
-        .type        = MT_DEVICE
     }, {
         .virtual    = IXP2000_TIMER_VIRT_BASE,
         .physical    = IXP2000_TIMER_PHYS_BASE,
         .length        = IXP2000_TIMER_SIZE,
-        .type        = MT_DEVICE
     }, {
         .virtual    = IXP2000_UART_VIRT_BASE,
         .physical    = IXP2000_UART_PHYS_BASE,
         .length        = IXP2000_UART_SIZE,
-        .type        = MT_DEVICE
     }, {
         .virtual    = IXP2000_SLOWPORT_CSR_VIRT_BASE,
         .physical    = IXP2000_SLOWPORT_CSR_PHYS_BASE,
         .length        = IXP2000_SLOWPORT_CSR_SIZE,
-        .type        = MT_DEVICE
     }, {
         .virtual    = IXP2000_INTCTL_VIRT_BASE,
         .physical    = IXP2000_INTCTL_PHYS_BASE,
         .length        = IXP2000_INTCTL_SIZE,
-        .type        = MT_DEVICE
     }, {
         .virtual    = IXP2000_PCI_CREG_VIRT_BASE,
         .physical    = IXP2000_PCI_CREG_PHYS_BASE,
         .length        = IXP2000_PCI_CREG_SIZE,
-        .type        = MT_DEVICE
-    }
-};
-
-static struct map_desc ixp2000_large_io_desc[] __initdata = {
-    {
+    }, {
         .virtual    = IXP2000_PCI_CSR_VIRT_BASE,
         .physical    = IXP2000_PCI_CSR_PHYS_BASE,
         .length        = IXP2000_PCI_CSR_SIZE,
-        .type        = MT_DEVICE
     }, {
         .virtual    = IXP2000_PCI_IO_VIRT_BASE,
         .physical    = IXP2000_PCI_IO_PHYS_BASE,
         .length        = IXP2000_PCI_IO_SIZE,
-        .type        = MT_DEVICE
     }, {
         .virtual    = IXP2000_PCI_CFG0_VIRT_BASE,
         .physical    = IXP2000_PCI_CFG0_PHYS_BASE,
         .length        = IXP2000_PCI_CFG0_SIZE,
-        .type        = MT_DEVICE
     }, {
         .virtual    = IXP2000_PCI_CFG1_VIRT_BASE,
         .physical    = IXP2000_PCI_CFG1_PHYS_BASE,
         .length        = IXP2000_PCI_CFG1_SIZE,
-        .type        = MT_DEVICE
     }
 };


@@ -159,8 +144,22 @@

 void __init ixp2000_map_io(void)
 {
-    iotable_init(ixp2000_small_io_desc, ARRAY_SIZE(ixp2000_small_io_desc));
-    iotable_init(ixp2000_large_io_desc, ARRAY_SIZE(ixp2000_large_io_desc));
+    int i;
+    extern unsigned int processor_id;
+
+    /*
+     * On IXP2400 CPUs we need to use MT_IXP2000_DEVICE for
+     * the PMD tweaking. On IXP2800s we use the normal 
+     * PMD flags.
+     */
+    for(i = 0; i < ARRAY_SIZE(ixp2000_io_desc); i++) {
+        if ((processor_id & 0xfffffff0) == 0x69054190)
+            ixp2000_io_desc[i].type = MT_IXP2000_DEVICE;
+        else
+            ixp2000_io_desc[i].type = MT_DEVICE;
+    }
+
+    iotable_init(ixp2000_io_desc, ARRAY_SIZE(ixp2000_io_desc));
     early_serial_setup(&ixp2000_serial_port);
 }




--
Deepak Saxena - dsaxena at plexity dot net - http://www.plexity.net/

"Unlike me, many of you have accepted the situation of your imprisonment
and will die here like rotten cabbages." - Number 6