summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/drivers/intel/i210/i210.h5
-rw-r--r--src/mainboard/siemens/mc_apl1/mainboard.c8
2 files changed, 7 insertions, 6 deletions
diff --git a/src/drivers/intel/i210/i210.h b/src/drivers/intel/i210/i210.h
index 718992e477..1cc6a28a0b 100644
--- a/src/drivers/intel/i210/i210.h
+++ b/src/drivers/intel/i210/i210.h
@@ -27,9 +27,10 @@
#define I210_CHECKSUM_ERROR 0x00000010
#define I210_FLASH_UPDATE_ERROR 0x00000020
+#define MAC_ADDR_LEN 6
+
/* We need one function we can call to get a MAC address to use */
/* This function can be coded somewhere else but must exist. */
-extern enum cb_err mainboard_get_mac_address(struct device *dev,
- uint8_t mac[6]);
+extern enum cb_err mainboard_get_mac_address(struct device *dev, uint8_t mac[MAC_ADDR_LEN]);
#endif /* _INTEL_I210_H_ */
diff --git a/src/mainboard/siemens/mc_apl1/mainboard.c b/src/mainboard/siemens/mc_apl1/mainboard.c
index 5b8f70f353..ff0cc597bc 100644
--- a/src/mainboard/siemens/mc_apl1/mainboard.c
+++ b/src/mainboard/siemens/mc_apl1/mainboard.c
@@ -33,9 +33,9 @@
* @param mac Buffer to the MAC address to check
* @return 0 if address is not valid, otherwise 1
*/
-static uint8_t is_mac_adr_valid(uint8_t mac[6])
+static uint8_t is_mac_adr_valid(uint8_t mac[MAC_ADDR_LEN])
{
- uint8_t buf[6];
+ uint8_t buf[MAC_ADDR_LEN];
memset(buf, 0, sizeof(buf));
if (!memcmp(buf, mac, sizeof(buf)))
@@ -52,7 +52,7 @@ static uint8_t is_mac_adr_valid(uint8_t mac[6])
* @param mac buffer where to store the MAC address
* @return cb_err CB_ERR or CB_SUCCESS
*/
-enum cb_err mainboard_get_mac_address(struct device *dev, uint8_t mac[6])
+enum cb_err mainboard_get_mac_address(struct device *dev, uint8_t mac[MAC_ADDR_LEN])
{
struct bus *parent = dev->bus;
uint8_t buf[16], mapping[16], i = 0, chain_len = 0;
@@ -92,7 +92,7 @@ enum cb_err mainboard_get_mac_address(struct device *dev, uint8_t mac[6])
if (memcmp(buf, mapping, chain_len + 4))
continue;
/* There is a matching mapping available, get MAC address. */
- if (hwilib_get_field(XMac1 + i, mac, 6) == 6) {
+ if (hwilib_get_field(XMac1 + i, mac, MAC_ADDR_LEN) == MAC_ADDR_LEN) {
if (is_mac_adr_valid(mac))
return CB_SUCCESS;
}