summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorEvan Lojewski <github@meklort.com>2020-02-24 19:15:50 -0700
committerGitHub <noreply@github.com>2020-02-24 19:15:50 -0700
commit3e7384db84d3874da1803fe3cced6cf3a87a5c63 (patch)
treef11ec180efccc7f56f88abcec7f94fb67236afcd /libs
parent386395007c279216b0f5cfe24649e3b9ade5e393 (diff)
downloadbcm5719-ortega-3e7384db84d3874da1803fe3cced6cf3a87a5c63.tar.gz
bcm5719-ortega-3e7384db84d3874da1803fe3cced6cf3a87a5c63.zip
ncsi: Record MAC addresses to SHM. (#40)
Diffstat (limited to 'libs')
-rw-r--r--libs/NCSI/ncsi.c7
-rw-r--r--libs/Network/generic.c55
2 files changed, 42 insertions, 20 deletions
diff --git a/libs/NCSI/ncsi.c b/libs/NCSI/ncsi.c
index da90346..f29a13d 100644
--- a/libs/NCSI/ncsi.c
+++ b/libs/NCSI/ncsi.c
@@ -536,6 +536,13 @@ static void setMACAddressHandler(NetworkFrame_t *frame)
// TODO: Handle AT.
+ // NC-SI has the mac starting at 1, reindex based at 0.
+ if(frame->setMACAddr.MACNumber > 0)
+ {
+ frame->setMACAddr.MACNumber--;
+ }
+
+
uint32_t low = (frame->setMACAddr.MAC32 << 16) | frame->setMACAddr.MAC10;
Network_SetMACAddr(port, frame->setMACAddr.MAC54, low, frame->setMACAddr.MACNumber, frame->setMACAddr.Enable);
diff --git a/libs/Network/generic.c b/libs/Network/generic.c
index dbdae95..3c5c62e 100644
--- a/libs/Network/generic.c
+++ b/libs/Network/generic.c
@@ -50,26 +50,41 @@ void Network_SetMACAddr(NetworkPort_t *port, uint16_t high, uint32_t low, uint32
uint32_t match_high = (high << 16) | (low >> 16);
uint16_t match_low = (low << 16);
- APE_PERI.BmcToNcSourceMacMatch0High.r32 = match_high;
- APE_PERI.BmcToNcSourceMacMatch1High.r32 = match_high;
- APE_PERI.BmcToNcSourceMacMatch2High.r32 = match_high;
- APE_PERI.BmcToNcSourceMacMatch3High.r32 = match_high;
- APE_PERI.BmcToNcSourceMacMatch4High.r32 = match_high;
- APE_PERI.BmcToNcSourceMacMatch5High.r32 = match_high;
- APE_PERI.BmcToNcSourceMacMatch6High.r32 = match_high;
- APE_PERI.BmcToNcSourceMacMatch7High.r32 = match_high;
- APE_PERI.BmcToNcSourceMacMatch0Low.r32 = match_low;
- APE_PERI.BmcToNcSourceMacMatch1Low.r32 = match_low;
- APE_PERI.BmcToNcSourceMacMatch2Low.r32 = match_low;
- APE_PERI.BmcToNcSourceMacMatch3Low.r32 = match_low;
- APE_PERI.BmcToNcSourceMacMatch4Low.r32 = match_low;
- APE_PERI.BmcToNcSourceMacMatch5Low.r32 = match_low;
- APE_PERI.BmcToNcSourceMacMatch6Low.r32 = match_low;
- APE_PERI.BmcToNcSourceMacMatch7Low.r32 = match_low;
-
- if (port)
+ switch(index)
{
- port->device->PerfectMatch1High.r32 = high;
- port->device->PerfectMatch1Low.r32 = low;
+ case 0:
+ APE_PERI.BmcToNcSourceMacMatch0High.r32 = match_high;
+ APE_PERI.BmcToNcSourceMacMatch0Low.r32 = match_low;
+ port->shm_channel->NcsiChannelMac0High.r32 = high;
+ port->shm_channel->NcsiChannelMac0Mid.r32 = low >> 16;
+ port->shm_channel->NcsiChannelMac0Low.r32 = low & 0xff;
+ break;
+
+ case 1:
+ APE_PERI.BmcToNcSourceMacMatch1High.r32 = match_high;
+ APE_PERI.BmcToNcSourceMacMatch1Low.r32 = match_low;
+ port->shm_channel->NcsiChannelMac1High.r32 = high;
+ port->shm_channel->NcsiChannelMac1Mid.r32 = low >> 16;
+ port->shm_channel->NcsiChannelMac1Low.r32 = low & 0xff;
+ break;
+
+ case 2:
+ APE_PERI.BmcToNcSourceMacMatch2High.r32 = match_high;
+ APE_PERI.BmcToNcSourceMacMatch2Low.r32 = match_low;
+ port->shm_channel->NcsiChannelMac2High.r32 = high;
+ port->shm_channel->NcsiChannelMac2Mid.r32 = low >> 16;
+ port->shm_channel->NcsiChannelMac2Low.r32 = low & 0xff;
+ break;
+
+ case 3:
+ APE_PERI.BmcToNcSourceMacMatch3High.r32 = match_high;
+ APE_PERI.BmcToNcSourceMacMatch3Low.r32 = match_low;
+ port->shm_channel->NcsiChannelMac3High.r32 = high;
+ port->shm_channel->NcsiChannelMac3Mid.r32 = low >> 16;
+ port->shm_channel->NcsiChannelMac3Low.r32 = low & 0xff;
+ break;
}
+
+ port->device->PerfectMatch1High.r32 = high;
+ port->device->PerfectMatch1Low.r32 = low;
}
OpenPOWER on IntegriCloud