Network Switch support

Co-Authored-By: Alexander Babikov <2708460+lemondrops@users.noreply.github.com>
Co-Authored-By: cold-brewed <47337035+cold-brewed@users.noreply.github.com>
This commit is contained in:
Jasmine Iwanek
2025-06-26 20:53:17 -04:00
parent be8dc5f488
commit 2dc28d39b1
20 changed files with 6846 additions and 5 deletions

View File

@@ -503,6 +503,11 @@ network_attach(void *card_drv, uint8_t *mac, NETRXCB rx, NETSETLINKSTATE set_lin
card->host_drv.priv = card->host_drv.init(card, mac, net_cards_conf[net_card_current].host_dev_name, net_drv_error);
break;
#endif
case NET_TYPE_NMSWITCH:
case NET_TYPE_NRSWITCH:
card->host_drv = net_netswitch_drv;
card->host_drv.priv = card->host_drv.init(card, mac, &net_cards_conf[net_card_current], net_drv_error);
break;
default:
card->host_drv.priv = NULL;
break;
@@ -514,6 +519,12 @@ network_attach(void *card_drv, uint8_t *mac, NETRXCB rx, NETSETLINKSTATE set_lin
if (!card->host_drv.priv) {
if(net_cards_conf[net_card_current].net_type != NET_TYPE_NONE) {
// FIXME: Hardcoded during dev
// FIXME: Remove when done!
if((net_cards_conf[net_card_current].net_type == NET_TYPE_NMSWITCH) ||
(net_cards_conf[net_card_current].net_type == NET_TYPE_NRSWITCH))
fatal("%s", net_drv_error);
// We're here because of a failure
swprintf(tempmsg, sizeof_w(tempmsg), L"%ls:\n\n%s\n\n%ls", plat_get_string(STRING_NET_ERROR), net_drv_error, plat_get_string(STRING_NET_ERROR_DESC));
ui_msgbox(MBX_ERROR, tempmsg);