Initial commit
authorBrad Griffis <bgriffis@ti.com>
Thu, 19 Jan 2017 21:16:29 +0000 (15:16 -0600)
committerBrad Griffis <bgriffis@ti.com>
Thu, 19 Jan 2017 21:16:29 +0000 (15:16 -0600)
am57xx-ipu-mmu-analysis.dss [new file with mode: 0755]

diff --git a/am57xx-ipu-mmu-analysis.dss b/am57xx-ipu-mmu-analysis.dss
new file mode 100755 (executable)
index 0000000..c9ddb18
--- /dev/null
@@ -0,0 +1,421 @@
+/*
+ * Copyright (c) 2006-2014, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+function d2h(d) {return ("00000000" + (d).toString(16)).slice(-8);}
+
+var newline = "\n";
+
+function printRegisterValue(ds, name, addr)
+{
+       value = debugSessionDAP.memory.readWord(0,addr,false);
+       value_string = d2h(value);
+       file.write(name + " = 0x" + value_string + newline);
+       return value; // return the register value for interrogation
+}
+
+// Build a filename that includes date/time
+var today = new Date();
+var year4digit = today.getFullYear();
+var month2digit = ("0" + (today.getMonth()+1)).slice(-2);
+var day2digit = ("0" + today.getDate()).slice(-2);
+var hour2digit = ("0" + today.getHours()).slice(-2);
+var minutes2digit = ("0" + today.getMinutes()).slice(-2);
+var seconds2digit = ("0" + today.getSeconds()).slice(-2);
+var filename_date = '_' + year4digit + '-' + month2digit + '-' + day2digit + '_' + hour2digit + minutes2digit + seconds2digit; 
+var userHomeFolder = System.getProperty("user.home");
+var filename = userHomeFolder + '/Desktop/' + 'am57xx-ipu-mmu-analysis' + filename_date + '.txt';
+
+debugSessionDAP = ds.openSession("*","CS_DAP_DebugSS");
+
+try {
+       debugSessionDAP.target.connect();
+} catch (ex) {
+       print(newline + " ERROR: Could not connect to DAP_DebugSS." + newline);
+}
+
+file = new java.io.FileWriter(filename);
+
+
+var reg_val;
+
+reg_val = printRegisterValue(debugSessionDAP, "CM_IPU1_IPU1_CLKCTRL", 0x4A005520);
+if ( (reg_val & 0x30000) == 0<<16 ) { file.write("  * IPU1 is fully functional." + newline); }
+if ( (reg_val & 0x30000) == (1<<16) ) { file.write("  * IPU1 is transitioning." + newline); }
+if ( (reg_val & 0x30000) == 2<<16 ) { file.write("  * IPU1 is in idle." + newline); }
+if ( (reg_val & 0x30000) == 3<<16 ) { file.write("  * IPU1 is disabled." + newline); }
+
+decodeLargePages(debugSessionDAP, 0x58880800);
+decodeMediumPages(debugSessionDAP, 0x58880860);
+decodeSmallPages(debugSessionDAP, 0x58880920);
+
+function decodeLargePages(ds, addr)
+{
+
+       decodeLargePage(ds, addr, 0);
+       decodeLargePage(ds, addr, 1);
+       decodeLargePage(ds, addr, 2);
+       decodeLargePage(ds, addr, 3);
+}
+
+function decodeMediumPages(ds, addr)
+{
+
+       decodeMediumPage(ds, addr, 0);
+       decodeMediumPage(ds, addr, 1);
+}
+
+function decodeSmallPages(ds, addr)
+{
+       decodeSmallPage(ds, addr, 0);
+       decodeSmallPage(ds, addr, 1);
+       decodeSmallPage(ds, addr, 2);
+       decodeSmallPage(ds, addr, 3);
+       decodeSmallPage(ds, addr, 4);
+       decodeSmallPage(ds, addr, 5);
+       decodeSmallPage(ds, addr, 6);
+       decodeSmallPage(ds, addr, 7);
+       decodeSmallPage(ds, addr, 8);
+       decodeSmallPage(ds, addr, 9);
+}
+
+
+
+function decodeLargePage(ds, addr, page)
+{
+       var phys_addr, logical_addr, policy_reg, size;
+
+       file.write(newline + "***** Decoding Large Page " + page + " *****" + newline + newline);
+       var reg_name = "CACHE_MMU_LARGE_ADDR_" + page;
+       logical_addr = printRegisterValue(ds, reg_name, addr+page*4);
+
+       addr = addr + 0x20;
+       reg_name = "CACHE_MMU_LARGE_XLTE_" + page;
+       physical_addr = printRegisterValue(ds, reg_name, addr+page*4);
+       
+       addr = addr + 0x20;
+       reg_name = "CACHE_MMU_LARGE_POLICY_" + page;
+       policy = printRegisterValue(ds, reg_name, addr+page*4);
+
+       file.write(newline);
+
+       if( (policy&1) == 0 ) {
+               file.write("PAGE NOT ENABLED" + newline);
+       } else {
+               file.write("PAGE ENABLED" + newline);
+
+               file.write("Logical Address  = 0x" + d2h(logical_addr) + " - 0x");
+               if( (policy & 1<<1) == 1<<1 ) { 
+                       size = 512 * 1024 * 1024; // 512 MB
+               } else {
+                       size = 32 * 1024 * 1024; // 32MB
+               }
+               file.write(d2h(logical_addr+size-1) + newline);
+
+               if ( (physical_addr&1) == 1 ) { // "ignore" bit
+                       physical_addr = logical_addr;
+               }
+               file.write("Physical address = 0x" + d2h(physical_addr) + " - 0x");
+               file.write(d2h(physical_addr+size-1) + newline);
+
+               file.write("Policy" + newline);
+
+               if( (policy & 1<<19) == 1<<19 ) { 
+                       file.write(" * L1 write policy is writeback" + newline);
+               } else { 
+                       file.write(" * L1 write policy is writethrough" + newline);
+               }
+
+               if( (policy & 1<<18) == 1<<18 ) { 
+                       file.write(" * L1 allocate policy: follow sideband" + newline);
+               } else { 
+                       file.write(" * L1 allocate policy: no writes allocated" + newline);
+               }
+
+               if( (policy & 1<<17) == 1<<17 ) { 
+                       file.write(" * L1 writes posted" + newline);
+               } else { 
+                       file.write(" * L1 writes non-posted" + newline);
+               }
+
+               if( (policy & 1<<16) == 1<<16 ) { 
+                       file.write(" * L1 cacheable" + newline);
+               } else { 
+                       file.write(" * L1 noncacheable" + newline);
+               }
+
+               if( (policy & 1<<7) == 1<<7 ) { 
+                       file.write(" * Send cache exclusion sideband" + newline);
+               } else { 
+                       file.write(" * Do not send cache exclusion sideband" + newline);
+               }
+
+               if( (policy & 1<<6) == 1<<6 ) { 
+                       file.write(" * Preload enabled" + newline);
+               } else { 
+                       file.write(" * Preload disabled" + newline);
+               }
+
+               if( (policy & 1<<5) == 1<<5 ) { 
+                       file.write(" * Read-only" + newline);
+               } else { 
+                       file.write(" * Read/Write" + newline);
+               }
+
+               if( (policy & 1<<4) == 1<<4 ) { 
+                       file.write(" * Execute-only" + newline);
+               } else { 
+                       file.write(" * Read/Write/Execute" + newline);
+               }
+
+               if( (policy & 1<<3) == 1<<3 ) { 
+                       file.write(" * Follow volatile qualifier" + newline);
+               } else { 
+                       file.write(" * Do not follow volatile qualifier" + newline);
+               }
+
+               if( (policy & 1<<1) == 1<<1 ) { 
+                       file.write(" * 512 MB page" + newline);
+               } else { 
+                       file.write(" * 32 MB page" + newline);
+               }
+       }
+}
+
+
+function decodeMediumPage(ds, addr, page)
+{
+       var phys_addr, logical_addr, policy_reg, size;
+
+       file.write(newline + "***** Decoding Medium Page " + page + " *****" + newline + newline);
+       var reg_name = "CACHE_MMU_MED_ADDR_" + page;
+       logical_addr = printRegisterValue(ds, reg_name, addr+page*4);
+
+       addr = addr + 0x40;
+       reg_name = "CACHE_MMU_MED_XLTE_" + page;
+       physical_addr = printRegisterValue(ds, reg_name, addr+page*4);
+       
+       addr = addr + 0x40;
+       reg_name = "CACHE_MMU_MED_POLICY_" + page;
+       policy = printRegisterValue(ds, reg_name, addr+page*4);
+
+       file.write(newline);
+
+       if( (policy&1) == 0 ) {
+               file.write("PAGE NOT ENABLED" + newline);
+       } else {
+               file.write("PAGE ENABLED" + newline);
+
+               file.write("Logical Address  = 0x" + d2h(logical_addr) + " - 0x");
+               if( (policy & 1<<1) == 1<<1 ) { 
+                       size = 256 * 1024; // 256 KB
+               } else {
+                       size = 128 * 1024; // 128 KB
+               }
+               file.write(d2h(logical_addr+size-1) + newline);
+
+               if ( (physical_addr&1) == 1 ) { // "ignore" bit
+                       physical_addr = logical_addr;
+               }
+               file.write("Physical address = 0x" + d2h(physical_addr) + " - 0x");
+               file.write(d2h(physical_addr+size-1) + newline);
+
+               file.write("Policy" + newline);
+
+               if( (policy & 1<<19) == 1<<19 ) { 
+                       file.write(" * L1 write policy is writeback" + newline);
+               } else { 
+                       file.write(" * L1 write policy is writethrough" + newline);
+               }
+
+               if( (policy & 1<<18) == 1<<18 ) { 
+                       file.write(" * L1 allocate policy: follow sideband" + newline);
+               } else { 
+                       file.write(" * L1 allocate policy: no writes allocated" + newline);
+               }
+
+               if( (policy & 1<<17) == 1<<17 ) { 
+                       file.write(" * L1 writes posted" + newline);
+               } else { 
+                       file.write(" * L1 writes non-posted" + newline);
+               }
+
+               if( (policy & 1<<16) == 1<<16 ) { 
+                       file.write(" * L1 cacheable" + newline);
+               } else { 
+                       file.write(" * L1 noncacheable" + newline);
+               }
+
+               if( (policy & 1<<7) == 1<<7 ) { 
+                       file.write(" * Send cache exclusion sideband" + newline);
+               } else { 
+                       file.write(" * Do not send cache exclusion sideband" + newline);
+               }
+
+               if( (policy & 1<<6) == 1<<6 ) { 
+                       file.write(" * Preload enabled" + newline);
+               } else { 
+                       file.write(" * Preload disabled" + newline);
+               }
+
+               if( (policy & 1<<5) == 1<<5 ) { 
+                       file.write(" * Read-only" + newline);
+               } else { 
+                       file.write(" * Read/Write" + newline);
+               }
+
+               if( (policy & 1<<4) == 1<<4 ) { 
+                       file.write(" * Execute-only" + newline);
+               } else { 
+                       file.write(" * Read/Write/Execute" + newline);
+               }
+
+               if( (policy & 1<<3) == 1<<3 ) { 
+                       file.write(" * Follow volatile qualifier" + newline);
+               } else { 
+                       file.write(" * Do not follow volatile qualifier" + newline);
+               }
+
+               if( (policy & 1<<1) == 1<<1 ) { 
+                       file.write(" * 256 KB page" + newline);
+               } else { 
+                       file.write(" * 128 KB page" + newline);
+               }
+       }
+}
+
+function decodeSmallPage(ds, addr, page)
+{
+       var phys_addr, logical_addr, policy_reg, size;
+
+       file.write(newline + "***** Decoding Small Page " + page + " *****" + newline + newline);
+       var reg_name = "CACHE_MMU_SMALL_ADDR_" + page;
+       logical_addr = printRegisterValue(ds, reg_name, addr+page*4);
+
+       addr = addr + 0x80;
+       reg_name = "CACHE_MMU_SMALL_XLTE_" + page;
+       physical_addr = printRegisterValue(ds, reg_name, addr+page*4);
+       
+       addr = addr + 0x80;
+       reg_name = "CACHE_MMU_SMALL_POLICY_" + page;
+       policy = printRegisterValue(ds, reg_name, addr+page*4);
+
+       file.write(newline);
+
+       if( (policy&1) == 0 ) {
+               file.write("PAGE NOT ENABLED" + newline);
+       } else {
+               file.write("PAGE ENABLED" + newline);
+
+               file.write("Logical Address  = 0x" + d2h(logical_addr) + " - 0x");
+               if( (policy & 1<<1) == 1<<1 ) { 
+                       size = 16 * 1024; // 16 KB
+               } else {
+                       size = 4 * 1024; // 4 KB
+               }
+               file.write(d2h(logical_addr+size-1) + newline);
+
+               if ( (physical_addr&1) == 1 ) { // "ignore" bit
+                       physical_addr = logical_addr;
+               }
+               file.write("Physical address = 0x" + d2h(physical_addr) + " - 0x");
+               file.write(d2h(physical_addr+size-1) + newline);
+
+               file.write("Policy" + newline);
+
+               if( (policy & 1<<19) == 1<<19 ) { 
+                       file.write(" * L1 write policy is writeback" + newline);
+               } else { 
+                       file.write(" * L1 write policy is writethrough" + newline);
+               }
+
+               if( (policy & 1<<18) == 1<<18 ) { 
+                       file.write(" * L1 allocate policy: follow sideband" + newline);
+               } else { 
+                       file.write(" * L1 allocate policy: no writes allocated" + newline);
+               }
+
+               if( (policy & 1<<17) == 1<<17 ) { 
+                       file.write(" * L1 writes posted" + newline);
+               } else { 
+                       file.write(" * L1 writes non-posted" + newline);
+               }
+
+               if( (policy & 1<<16) == 1<<16 ) { 
+                       file.write(" * L1 cacheable" + newline);
+               } else { 
+                       file.write(" * L1 noncacheable" + newline);
+               }
+
+               if( (policy & 1<<7) == 1<<7 ) { 
+                       file.write(" * Send cache exclusion sideband" + newline);
+               } else { 
+                       file.write(" * Do not send cache exclusion sideband" + newline);
+               }
+
+               if( (policy & 1<<6) == 1<<6 ) { 
+                       file.write(" * Preload enabled" + newline);
+               } else { 
+                       file.write(" * Preload disabled" + newline);
+               }
+
+               if( (policy & 1<<5) == 1<<5 ) { 
+                       file.write(" * Read-only" + newline);
+               } else { 
+                       file.write(" * Read/Write" + newline);
+               }
+
+               if( (policy & 1<<4) == 1<<4 ) { 
+                       file.write(" * Execute-only" + newline);
+               } else { 
+                       file.write(" * Read/Write/Execute" + newline);
+               }
+
+               if( (policy & 1<<3) == 1<<3 ) { 
+                       file.write(" * Follow volatile qualifier" + newline);
+               } else { 
+                       file.write(" * Do not follow volatile qualifier" + newline);
+               }
+
+               if( (policy & 1<<1) == 1<<1 ) { 
+                       file.write(" * 16 KB page" + newline);
+               } else { 
+                       file.write(" * 4 KB page" + newline);
+               }
+       }
+}
+
+
+file.close();
+print("Created file " + filename);
+debugSessionDAP.target.disconnect();
+