This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
MOAB - improve ESA calculations
- From: Gary Thomas <gary at mlbassoc dot com>
- To: eCos patches <ecos-patches at sources dot redhat dot com>
- Date: 03 Oct 2003 17:11:05 -0600
- Subject: MOAB - improve ESA calculations
- Organization: MLB Associates
--
Gary Thomas <gary@mlbassoc.com>
MLB Associates
Index: hal/powerpc/moab/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/hal/powerpc/moab/current/ChangeLog,v
retrieving revision 1.10
diff -u -5 -p -r1.10 ChangeLog
--- hal/powerpc/moab/current/ChangeLog 2 Oct 2003 20:12:40 -0000 1.10
+++ hal/powerpc/moab/current/ChangeLog 3 Oct 2003 19:55:16 -0000
@@ -1,5 +1,10 @@
+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:
* cdl/hal_powerpc_moab.cdl: Add code to set and check ethernet station
addresses, based on CPU serial number. Force RedBoot to validate them.
Index: hal/powerpc/moab/current/src/hal_aux.c
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/hal/powerpc/moab/current/src/hal_aux.c,v
retrieving revision 1.2
diff -u -5 -p -r1.2 hal_aux.c
--- hal/powerpc/moab/current/src/hal_aux.c 2 Oct 2003 20:12:41 -0000 1.2
+++ hal/powerpc/moab/current/src/hal_aux.c 3 Oct 2003 23:04:12 -0000
@@ -87,26 +87,26 @@ CYGARC_MEMDESC_TABLE CYGBLD_ATTRIB_WEAK
//--------------------------------------------------------------------------
// Platform init code.
// 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
}