summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md32
-rw-r--r--ape/CMakeLists.txt40
-rw-r--r--ape/main.c10
-rw-r--r--libs/NCSI/include/NCSI.h2
-rw-r--r--libs/NCSI/ncsi.c7
-rw-r--r--libs/Network/include/Network.h4
-rw-r--r--libs/Network/ports.c33
7 files changed, 86 insertions, 42 deletions
diff --git a/README.md b/README.md
index 88b3da9..6a61f99 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,7 @@
## Introduction
This library contains a clean-room reimplementation of the BCM5719 firmware based on the [Ortega](https://github.com/hlandau/ortega/blob/master/rtg-spec.md) specification.
-The firmware has been tested on the [Talos II](https://wiki.raptorcs.com/wiki/Talos_II) by [Raptor Computer Systems](https://www.raptorcs.com/).
+The firmware has been tested on the [Talos II](https://wiki.raptorcs.com/wiki/Talos_II) and [Blackbird](https://wiki.raptorcs.com/wiki/Blackbird) made by [Raptor Computer Systems](https://www.raptorcs.com/).
**Note: This firmware is currently in development. Flashing the firmware to a network card can result in a bricked device when either an external programmer is required, or the external flash must be temporarily disabled during boot-up.**
@@ -16,7 +16,7 @@ This repository depends on a number of external tools
### Required Compiler
Due to limitations in the MIPS CPU, this firmware requires a custom compiler to function properly.
-The custom compuler can be built using the following steps:
+The custom compiler can be built using the following steps:
```bash
git clone https://github.com/meklort/llvm-project.git -b meklort-10.0.0
cd llvm-project
@@ -80,18 +80,38 @@ sudo ./utils/bcmflash/bcmflash -t hardware -1 stage1/stage1.bin
### APE Firmware (BMC/NC-SI communication)
The APE firmware can be tested by loading it into ram using the following sequence (Note: this may fail unless if stage1 has been loaded):
+
+#### Testing on the Talos II with port 0 for BMC traffic
+<details>
+
+```bash
+cd build
+sudo ./utils/bcmregtool/bcmregtool --apeboot=ape/ape-port0.bin
+```
+
+Once tested, the APE firmware can be loaded into the device using the following command:
+```bash
+cd build
+sudo ./utils/bcmflash/bcmflash -t hardware -a ape/ape-port0.bin
+```
+</details>
+
+#### Testing on the Blackbird with port 2 for BMC traffic
+<details>
+
```bash
cd build
-sudo ./utils/bcmregtool/bcmregtool --apeboot=ape/ape.bin
+sudo ./utils/bcmregtool/bcmregtool --apeboot=ape/ape-port2.bin
```
-Once tested, the APe firmware can be loaded into the device using the following command:
+Once tested, the APE firmware can be loaded into the device using the following command:
```bash
cd build
-sudo ./utils/bcmflash/bcmflash -t hardware -a ape/ape.bin
+sudo ./utils/bcmflash/bcmflash -t hardware -a ape/ape-port2.bin
```
+</details>
### Firmware Log
-The APE and Stage1 firmwarw are able to print status messages to a log. This can be accessed in one of two ways:
+The APE and Stage1 firmware are able to print status messages to a log. This can be accessed in one of two ways:
* The ./utils/apeconsole/apeconsole utility can be used if no driver is loaded by the host.
* The EM100Pro console can be used if wired to the SPI bus on the BCM5719. This allows for printouts even when the host is off.
diff --git a/ape/CMakeLists.txt b/ape/CMakeLists.txt
index 52dc3ef..a5892df 100644
--- a/ape/CMakeLists.txt
+++ b/ape/CMakeLists.txt
@@ -46,25 +46,33 @@
project(ape)
# Firmware
-set(LINKER_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/ape.ld")
-arm_add_executable(${PROJECT_NAME}
- main.c
- vectors.c
- rmu.c
- )
-arm_linker_script(${PROJECT_NAME} ${LINKER_SCRIPT})
+function(ape_firmware PORT)
+ SET(TARGET ${PROJECT_NAME}-port${PORT})
+ arm_add_executable(${TARGET}
+ main.c
+ vectors.c
+ rmu.c
+ )
+ arm_linker_script(${TARGET} "${CMAKE_CURRENT_SOURCE_DIR}/ape.ld")
-target_link_libraries(${PROJECT_NAME} NVRam-arm MII-arm APE-arm Network-arm NCSI-arm printf-arm)
-target_link_libraries(${PROJECT_NAME} bcm5719-arm)
-target_link_libraries(${PROJECT_NAME}
- --defsym=VERSION_MAJOR=${VERSION_MAJOR}
- --defsym=VERSION_MINOR=${VERSION_MINOR}
- --defsym=VERSION_PATCH=${VERSION_PATCH})
-target_compile_options(${PROJECT_NAME} PRIVATE -nodefaultlibs)
+ target_link_libraries(${TARGET} NVRam-arm MII-arm APE-arm Network-arm NCSI-arm printf-arm)
+ target_link_libraries(${TARGET} bcm5719-arm)
+ target_link_libraries(${TARGET}
+ --defsym=NETWORK_PORT=${PORT}
+ --defsym=VERSION_MAJOR=${VERSION_MAJOR}
+ --defsym=VERSION_MINOR=${VERSION_MINOR}
+ --defsym=VERSION_PATCH=${VERSION_PATCH})
+ target_compile_options(${TARGET} PRIVATE -nodefaultlibs)
+ target_compile_definitions(${TARGET} PRIVATE NETWORK_PORT=${PORT})
-format_target_sources(${PROJECT_NAME})
+ install(TARGETS ${TARGET} DESTINATION fw RESOURCE)
-install(TARGETS ${PROJECT_NAME} DESTINATION fw RESOURCE)
+endfunction()
+
+ape_firmware(0)
+ape_firmware(2)
+
+format_target_sources(${PROJECT_NAME}-port0)
# Simulator add_executable
# simulator_add_executable(sim-${PROJECT_NAME}
diff --git a/ape/main.c b/ape/main.c
index f0e3e21..f4db64a 100644
--- a/ape/main.c
+++ b/ape/main.c
@@ -64,6 +64,8 @@
#include <printf.h>
#endif
+static NetworkPort_t *gPort;
+
void handleCommand(void)
{
uint32_t command = SHM.LoaderCommand.bits.Command;
@@ -187,7 +189,7 @@ void handleBMCPacket(void)
else
{
// Pass through to network
- NetworkPort_t *port = &gPort;
+ NetworkPort_t *port = gPort;
if (port->shm_channel->NcsiChannelInfo.bits.Enabled)
{
if (!Network_TX_transmitPassthroughPacket(bytes, port))
@@ -274,8 +276,7 @@ void __attribute__((noreturn)) loaderLoop(void)
}
}
- NetworkPort_t *port = &gPort;
- Network_checkPortState(port);
+ Network_checkPortState(gPort);
}
}
@@ -346,6 +347,9 @@ void __attribute__((noreturn)) __start()
}
printf("APE v" STRINGIFY(VERSION_MAJOR) "." STRINGIFY(VERSION_MINOR) "." STRINGIFY(VERSION_PATCH) " NCSI Port " STRINGIFY(NETWORK_PORT) "\n");
+ gPort = Network_getPort(NETWORK_PORT);
+
+ NCSI_usePort(gPort);
checkSupply(true);
diff --git a/libs/NCSI/include/NCSI.h b/libs/NCSI/include/NCSI.h
index 9bb3bcd..d59f343 100644
--- a/libs/NCSI/include/NCSI.h
+++ b/libs/NCSI/include/NCSI.h
@@ -73,4 +73,6 @@ void NCSI_init(void);
void NCSI_reload(reload_type_t reset_phy);
+void NCSI_usePort(NetworkPort_t *port);
+
#endif /* NCSI_H */ \ No newline at end of file
diff --git a/libs/NCSI/ncsi.c b/libs/NCSI/ncsi.c
index cbd9063..2805853 100644
--- a/libs/NCSI/ncsi.c
+++ b/libs/NCSI/ncsi.c
@@ -242,10 +242,15 @@ package_state_t gPackageState = {
.selected = false,
.numChannels = NUM_CHANNELS,
.port = {
- [0] = &gPort,
+ [0] = NULL,
},
};
+void NCSI_usePort(NetworkPort_t *port)
+{
+ gPackageState.port[0] = port;
+}
+
void sendNCSIResponse(uint8_t InstanceID, uint8_t channelID, uint16_t controlID, uint16_t response_code, uint16_t reasons_code);
void sendNCSILinkStatusResponse(uint8_t InstanceID, uint8_t channelID, uint32_t LinkStatus, uint32_t OEMLinkStatus, uint32_t OtherIndications);
diff --git a/libs/Network/include/Network.h b/libs/Network/include/Network.h
index 86b62a9..c6aa260 100644
--- a/libs/Network/include/Network.h
+++ b/libs/Network/include/Network.h
@@ -10,7 +10,7 @@
///
////////////////////////////////////////////////////////////////////////////////
///
-/// @copyright Copyright (c) 2019, Evan Lojewski
+/// @copyright Copyright (c) 2019-2020, Evan Lojewski
/// @cond
///
/// All rights reserved.
@@ -107,7 +107,7 @@ typedef enum {
ALWAYS_RESET /* Host was just turned off, reset phy */
} reload_type_t;
-extern NetworkPort_t gPort;
+NetworkPort_t *Network_getPort(int i);
void Network_InitPort(NetworkPort_t *port, reload_type_t force_reset);
diff --git a/libs/Network/ports.c b/libs/Network/ports.c
index db6fcab..be1957a 100644
--- a/libs/Network/ports.c
+++ b/libs/Network/ports.c
@@ -10,7 +10,7 @@
///
////////////////////////////////////////////////////////////////////////////////
///
-/// @copyright Copyright (c) 2018, Evan Lojewski
+/// @copyright Copyright (c) 2018-2020 Evan Lojewski
/// @cond
///
/// All rights reserved.
@@ -68,12 +68,7 @@
#include <printf.h>
#endif
-#ifndef NETWORK_PORT
-#define NETWORK_PORT 0
-#endif
-
-#if NETWORK_PORT == 0
-NetworkPort_t gPort = {
+NetworkPort_t gPort0 = {
.device = &DEVICE,
.filters = &FILTERS0,
.shm_channel = &SHM_CHANNEL0,
@@ -99,8 +94,8 @@ NetworkPort_t gPort = {
},
#endif
};
-#elif NETWORK_PORT == 1
-NetworkPort_t gPort = {
+
+NetworkPort_t gPort1 = {
.device = &DEVICE1,
.filters = &FILTERS1,
.shm_channel = &SHM_CHANNEL1,
@@ -126,8 +121,8 @@ NetworkPort_t gPort = {
},
#endif
};
-#elif NETWORK_PORT == 2
-NetworkPort_t gPort = {
+
+NetworkPort_t gPort2 = {
.device = &DEVICE2,
.filters = &FILTERS2,
.shm_channel = &SHM_CHANNEL2,
@@ -153,8 +148,8 @@ NetworkPort_t gPort = {
},
#endif
};
-#elif NETWORK_PORT == 3
-NetworkPort_t gPort = {
+
+NetworkPort_t gPort3 = {
.device = &DEVICE3,
.filters = &FILTERS3,
.shm_channel = &SHM_CHANNEL3,
@@ -180,8 +175,18 @@ NetworkPort_t gPort = {
},
#endif
};
-#endif
+NetworkPort_t *Network_getPort(int i)
+{
+ switch(i)
+ {
+ default: return &gPort0;
+ case 0: return &gPort0;
+ case 1: return &gPort1;
+ case 2: return &gPort2;
+ case 3: return &gPort3;
+ }
+}
#ifndef CXX_SIMULATOR
typedef struct
{
OpenPOWER on IntegriCloud