changeset 1265:734edfe6c859

Allow platform to provide routine to validate ethernet addresses
author gthomas
date Thu, 02 Oct 2003 20:13:29 +0000
parents 9c01b964bb31
children 26196bf9b414
files packages/redboot/current/ChangeLog packages/redboot/current/cdl/redboot.cdl packages/redboot/current/src/fconfig.c
diffstat 3 files changed, 27 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/packages/redboot/current/ChangeLog
+++ b/packages/redboot/current/ChangeLog
@@ -1,3 +1,9 @@
+2003-10-02  Gary Thomas  <gary@mlbassoc.com>
+
+	* src/fconfig.c: 
+	* cdl/redboot.cdl: Allow platforms to provide a function to validate
+	ethernet station addresses.
+
 2003-09-30  Gary Thomas  <gary@mlbassoc.com>
 
 	* src/fconfig.c (do_flash_config): Fix typo in error message.
--- a/packages/redboot/current/cdl/redboot.cdl
+++ b/packages/redboot/current/cdl/redboot.cdl
@@ -461,6 +461,17 @@ cdl_package CYGPKG_REDBOOT {
               RedBoot environment will already be initialized at this point."
         }
     
+        cdl_option CYGSEM_REDBOOT_PLF_ESA_VALIDATE {
+            display       "Run a platform specific ESA validation function."
+            flavor        bool
+            default_value 0
+            description   "
+              If this option is enabled then RedBoot will execute a platform
+              specific function to validate an ethernet ESA.  This would be
+              useful if the address must conform to standards set by the
+              hardware manufacturer, etc."
+        }
+    
         cdl_option CYGPKG_REDBOOT_MAX_CMD_LINE {
             display       "Maximum command line length"
             flavor        data
--- a/packages/redboot/current/src/fconfig.c
+++ b/packages/redboot/current/src/fconfig.c
@@ -67,6 +67,10 @@ externC void write_eeprom(void *buf, int
 externC void read_eeprom(void *buf, int len);
 #endif
 
+#ifdef CYGSEM_REDBOOT_PLF_ESA_VALIDATE
+externC bool cyg_plf_redboot_esa_validate(unsigned char *val);
+#endif
+
 // Round a quantity up
 #define _rup(n,s) ((((n)+(s-1))/s)*s)
 
@@ -342,6 +346,12 @@ get_config(unsigned char *dp, char *titl
             }
             ((unsigned char *)val_ptr)[esa_ptr] = esa_byte;
         }
+#ifdef CYGSEM_REDBOOT_PLF_ESA_VALIDATE
+        if (!cyg_plf_redboot_esa_validate(val_ptr)) {
+            memcpy(val_ptr, &hold_esa_val, sizeof(enet_addr_t));
+            return CONFIG_BAD;
+        }
+#endif
         return CONFIG_CHANGED;
         break;
 #if defined(CYGHWR_NET_DRIVERS) && (CYGHWR_NET_DRIVERS > 1)