changeset 1267:b3b9cc536753

Improve ESA computation
author gthomas
date Fri, 03 Oct 2003 23:04:50 +0000
parents 26196bf9b414
children 205922255412
files packages/hal/powerpc/moab/current/ChangeLog packages/hal/powerpc/moab/current/src/hal_aux.c
diffstat 2 files changed, 14 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/packages/hal/powerpc/moab/current/ChangeLog
+++ b/packages/hal/powerpc/moab/current/ChangeLog
@@ -1,3 +1,8 @@
+2003-10-03  Gary Thomas  <gary@mlbassoc.com>
+
+	* src/hal_aux.c (hal_platform_init): Better/different ESA computation,
+	using only 16 unique bits.
+
 2003-10-02  Gary Thomas  <gary@mlbassoc.com>
 
 	* src/hal_aux.c: 
--- a/packages/hal/powerpc/moab/current/src/hal_aux.c
+++ b/packages/hal/powerpc/moab/current/src/hal_aux.c
@@ -89,22 +89,22 @@ CYGARC_MEMDESC_TABLE CYGBLD_ATTRIB_WEAK 
 
 // Board/CPU serial number
 cyg_uint32 _moab_serial_no[2];
-unsigned char _moab_eth0_ESA[] = { 0x00, 0x20, 0xCF, 0x01, 0x11, 0x11}; // Default ESA
-unsigned char _moab_eth1_ESA[] = { 0x00, 0x20, 0xCF, 0x81, 0x11, 0x11}; // Default ESA
+unsigned char _moab_eth0_ESA[] = { 0x00, 0x20, 0xCF, 0x02, 0x11, 0x11}; // Default ESA
+unsigned char _moab_eth1_ESA[] = { 0x00, 0x20, 0xCF, 0x03, 0x11, 0x11}; // Default ESA
 
 void
 hal_platform_init(void)
 {
+    unsigned long munged_serial_no;
 
     CYGARC_MFDCR(DCR_CPC0_ECID0, _moab_serial_no[0]);
     CYGARC_MFDCR(DCR_CPC0_ECID1, _moab_serial_no[1]);
-    // Set default ethernet ESA
-    _moab_eth0_ESA[3] = ((_moab_serial_no[1] & 0x007F0000) >> 16) | 0x00;
-    _moab_eth0_ESA[4] = ((_moab_serial_no[1] & 0x0000FF00) >> 8);
-    _moab_eth0_ESA[5] = ((_moab_serial_no[1] & 0x000000FF) >> 0);
-    _moab_eth1_ESA[3] = ((_moab_serial_no[1] & 0x007F0000) >> 16) | 0x80;
-    _moab_eth1_ESA[4] = ((_moab_serial_no[1] & 0x0000FF00) >> 8);
-    _moab_eth1_ESA[5] = ((_moab_serial_no[1] & 0x000000FF) >> 0);
+    // Set default ethernet ESA - using 16 bits of munged serial number
+    munged_serial_no = ((_moab_serial_no[0] & 0x0000000F) << 12) | (_moab_serial_no[1] & 0x00000FFF);
+    _moab_eth0_ESA[4] = ((munged_serial_no & 0x0000FF00) >> 8);
+    _moab_eth0_ESA[5] = ((munged_serial_no & 0x000000FF) >> 0);
+    _moab_eth1_ESA[4] = ((munged_serial_no & 0x0000FF00) >> 8);
+    _moab_eth1_ESA[5] = ((munged_serial_no & 0x000000FF) >> 0);
 #ifdef CYGPKG_REDBOOT
     diag_printf("CPU serial number: %08x/%08x\n", _moab_serial_no[0], _moab_serial_no[1]);
 #endif