Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Feb 2008 15:59:44 GMT
From:      "Randall R. Stewart" <rrs@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 135802 for review
Message-ID:  <200802201559.m1KFxiW4057764@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=135802

Change 135802 by rrs@rrs-mips2-jnpr on 2008/02/20 15:58:51

	still need to remove prints and cleanup.. but real
	       memory now used in octeon_board_real() case.

Affected files ...

.. //depot/projects/mips2-jnpr/src/sys/mips/mips32/octeon32/octeon_machdep.c#10 edit

Differences ...

==== //depot/projects/mips2-jnpr/src/sys/mips/mips32/octeon32/octeon_machdep.c#10 (text+ko) ====

@@ -296,15 +296,25 @@
     }
 }
 
-static char progress[8] = { '-', '/', '|', '\\', '-', '/', '|', '\\'};
+static char progress[8] = { 'F', 'R', 'E', 'E', 'B', 'S', 'D', '!'};
+
+int prog_count=0;
 
-void octeon_led_run_wheel (/*int count, */int *prog_count, int led_position)
+void octeon_led_run_wheel (void)
 {
     if (!octeon_board_real()) return;
 
-    octeon_led_write_char(led_position, progress[*prog_count]);
-    *prog_count += 1;
-    *prog_count &= 0x7;
+    if(prog_count > 7) {
+      int i;
+      /* blank display and reset */
+      prog_count = 0;
+      for(i=0; i<8; i++) {
+	octeon_led_write_char(i, ' ');
+      }
+    } else {
+      octeon_led_write_char(prog_count, progress[prog_count]);
+      prog_count += 1;
+    }
 }
 
 #define LSR_DATAREADY        0x01    /* Data ready */
@@ -789,7 +799,7 @@
 
 #define OCTEON_CURRENT_DESC_VERSION     6
 #define OCTEON_ARGV_MAX_ARGS            (64)
-#define OCTOEN_SERIAL_LEN 20
+#define OCTEON_SERIAL_LEN 20
 
 
 typedef struct {
@@ -823,7 +833,7 @@
     uint16_t chip_type;
     uint8_t chip_rev_major;
     uint8_t chip_rev_minor;
-    char board_serial_number[OCTOEN_SERIAL_LEN];
+    char board_serial_number[OCTEON_SERIAL_LEN];
     uint8_t mac_addr_base[6];
     uint8_t mac_addr_count;
     uint64_t cvmx_desc_vaddr;
@@ -857,7 +867,7 @@
     uint16_t chip_type;
     uint8_t chip_rev_major;
     uint8_t chip_rev_minor;
-    char board_serial_number[OCTOEN_SERIAL_LEN];
+    char board_serial_number[OCTEON_SERIAL_LEN];
     uint8_t mac_addr_base[6];
     uint8_t mac_addr_count;
 #if (CVMX_BOOTINFO_MIN_VER >= 1)
@@ -888,7 +898,7 @@
 } cvmx_bootinfo_t;
 
 uint32_t octeon_cpu_clock;
-uint64_t octeon_dram;
+uint64_t octeon_dram=0;
 uint32_t octeon_bd_ver = 0, octeon_cvmx_bd_ver = 0, octeon_board_rev_major, octeon_board_rev_minor, octeon_board_type;
 uint8_t octeon_mac_addr[6] = { 0 };
 int octeon_core_mask, octeon_mac_addr_count;
@@ -1029,7 +1039,8 @@
     int descriptor_not_parsed = 1;
 
     	if ((app_descriptor_addr == 0) || (app_descriptor_addr >= 0xAfffffff)) {
-
+	        printf("address of app_descriptor is %x\n",
+		       app_descriptor_addr);
         } else {
 
             	app_desc_ptr = (octeon_boot_descriptor_t *) app_descriptor_addr;
@@ -1059,6 +1070,7 @@
         printf("  Mac Address %02X.%02X.%02X.%02X.%02X.%02X\n",
                octeon_mac_addr[0], octeon_mac_addr[1], octeon_mac_addr[2],
                octeon_mac_addr[3], octeon_mac_addr[4], octeon_mac_addr[5]);
+	printf("config flags:0x%x\n",cvmx_config_flags);
 }
 
 #define CVMX_BOOTINFO_CFG_FLAG_PCI_HOST                 (1ull << 0)
@@ -1108,14 +1120,15 @@
 extern int	*end;
 extern void _start(void);
 
-extern int Maxmem;
+/*extern int Maxmem;*/
 
 static void
 mips_init(void)
 {
-	int i;
+    
         u_int64_t cvm_mem_ctl;
-
+        uint32_t realmem_bytes;
+	
 	printf("entry: mips_init()\n");
 	bootverbose = 0;
 
@@ -1139,51 +1152,64 @@
         printf("mips_rd_ebase %x\n", mips_rd_ebase());
         printf("mips_rd_config %x\n", mips_rd_config());
 
-        int realmem_bytes;
 
 	/* XXX: Override. Temporary hard-code */
-        realmem_bytes = (((octeon_board_real())?256:96) << 20);	
-	/* phys_avail regions are in bytes */
-	phys_avail[0] = (MIPS_KSEG0_TO_PHYS((vm_offset_t)&end) + PAGE_SIZE) & ~(PAGE_SIZE - 1);
-	phys_avail[1] = realmem_bytes - 64 - 1;
-	phys_avail[2] = phys_avail[3] = 0;
+	if(octeon_board_real()) {
+	  printf("octeon_dram == %llx\n", octeon_dram);
+	  printf("reduced to ram: %u MB", (uint32_t)octeon_dram >> 20);
 
-#ifdef MEM_EXTEND
-
+	  realmem_bytes = (octeon_dram - PAGE_SIZE);
+	  realmem_bytes &= ~(PAGE_SIZE - 1);
+	  printf("Real memory bytes is %x\n", realmem_bytes);
+	} else {
+	  /* Simulator we limit to 96 meg */
+	  realmem_bytes = (96 << 20);	
+	}
 	/* phys_avail regions are in bytes */
 	phys_avail[0] = (MIPS_KSEG0_TO_PHYS((vm_offset_t)&end) + PAGE_SIZE) & ~(PAGE_SIZE - 1);
         if (octeon_board_real()) {
-                phys_avail[1] = OCTEON_DRAM_FIRST_256_END;
+	  if (realmem_bytes > OCTEON_DRAM_FIRST_256_END) 
+	    phys_avail[1] = OCTEON_DRAM_FIRST_256_END;
+	  else
+	    phys_avail[1] = realmem_bytes;
+	  realmem_bytes -= OCTEON_DRAM_FIRST_256_END;
+	  realmem_bytes &= ~(PAGE_SIZE - 1);
+	  printf("phys_avail[0] = %x phys_avail[1] = %x\n",
+		 phys_avail[0] , phys_avail[1]);
         } else {
-            	phys_avail[1] = (96 << 20);
+	  /* Simulator gets 96Meg period. */
+	  phys_avail[1] = (96 << 20);
         }
-        phys_avail[2] = phys_avail[3] = 0;
-
-        realmem_bytes = (phys_avail[1] - phys_avail[0] + 1);
-
-#define DONT_USE_3RD_BANK 1		// This will enable use of mem above 512M mark.
-
-#ifndef DONT_USE_3RD_BANK
-        if (octeon_board_real()) {
-            phys_avail[2] = OCTEON_DRAM_ABOVE_512_START;
-            phys_avail[3] = OCTEON_DRAM_ABOVE_512_START + (128 * 1024 * 1024) - 1;
-            phys_avail[4] = phys_avail[5] = 0;
-            realmem_bytes +=  (128 * 1024 * 1024);
-        }
-
-#endif	/* DONT_USE_3RD_BANK */
-
-#endif	/* MEM_EXTEND */
-
-
-        realmem = btoc(realmem_bytes);
-
-	for (i=0; i<10; i+=2) {
-		if (phys_avail[i]) 
-			physmem += btoc(phys_avail[i+1] - phys_avail[i]);
-		else 
-			break;
+	/*-
+	 * Octeon Memory looks as follows:
+         *   PA
+	 * 0000 0000 to                                       0x0 0000 0000 0000
+	 * 0FFF FFFF      First 256 MB memory   Maps to       0x0 0000 0FFF FFFF
+	 *
+	 * 1000 0000 to                                       0x1 0000 1000 0000
+	 * 1FFF FFFF      Uncached Bu I/O space.converted to  0x1 0000 1FFF FFFF
+	 *
+	 * 2FFF FFFF to            Cached                     0x0 0000 2000 0000
+	 * FFFF FFFF      all dram mem above the first 512M   0x3 FFFF FFFF FFFF
+	 *
+	 */
+	physmem = btoc(phys_avail[1] - phys_avail[0]);
+        if ((octeon_board_real()) &&
+	    (realmem_bytes > OCTEON_DRAM_FIRST_256_END)){
+	  /* take out the upper non-cached 1/2 */
+	  realmem_bytes -= OCTEON_DRAM_FIRST_256_END;
+	  realmem_bytes &= ~(PAGE_SIZE - 1);
+	  /* Now map the rest of the memory */
+	  phys_avail[2] = 0x20000000;
+	  printf("realmem_bytes is now at %x\n", realmem_bytes);
+	  phys_avail[3] = ((uint32_t)0x20000000 + realmem_bytes);
+	  printf("Next block of memory goes from %x to %x\n",
+		 phys_avail[2], phys_avail[3]);
+	  physmem += btoc(phys_avail[3] - phys_avail[2]);
+        } else {
+	  printf("realmem_bytes is %d\n", realmem_bytes);
 	}
+        realmem = physmem;
 
         printf("\nCode: _start 0x%X  _end 0x%X", (uint32_t) (&_start), (uint32_t) (&end));
         printf("\nTotal DRAM Size 0x%X", (uint32_t)octeon_dram);
@@ -1200,7 +1226,6 @@
 	pmap_bootstrap();
 	mips_proc0_init();
 	mutex_init();
-
 #ifdef DDB
 	kdb_init();
 #endif



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200802201559.m1KFxiW4057764>