Fork, and maybe improve tg3 driver for macs
Build / BIOS / i386 (push) Has been cancelled
Build / BIOS / x86_64 (push) Has been cancelled
Build / SBI / riscv32 (push) Has been cancelled
Build / SBI / riscv64 (push) Has been cancelled
Build / UEFI / arm32 (push) Has been cancelled
Build / UEFI / arm64 (push) Has been cancelled
Build / UEFI / i386 (push) Has been cancelled
Build / UEFI / loong64 (push) Has been cancelled
Build / UEFI / riscv32 (push) Has been cancelled
Build / UEFI / riscv64 (push) Has been cancelled
Build / UEFI / x86_64 (push) Has been cancelled
Build / UEFI SB / arm64 (push) Has been cancelled
Build / UEFI SB / x86_64 (push) Has been cancelled
Build / SB Sign / arm64 (push) Has been cancelled
Build / SB Sign / x86_64 (push) Has been cancelled
Build / Linux / arm32 (push) Has been cancelled
Build / Linux / arm64 (push) Has been cancelled
Build / Linux / i386 (push) Has been cancelled
Build / Linux / loong64 (push) Has been cancelled
Build / Linux / riscv32 (push) Has been cancelled
Build / Linux / riscv64 (push) Has been cancelled
Build / Linux / x86_64 (push) Has been cancelled
Build / UEFI shim (push) Has been cancelled
Build / Combine (push) Has been cancelled
Build / Version (push) Has been cancelled
Build / Publish (push) Has been cancelled
Build / Release (push) Has been cancelled
Build / BIOS / i386 (push) Has been cancelled
Build / BIOS / x86_64 (push) Has been cancelled
Build / SBI / riscv32 (push) Has been cancelled
Build / SBI / riscv64 (push) Has been cancelled
Build / UEFI / arm32 (push) Has been cancelled
Build / UEFI / arm64 (push) Has been cancelled
Build / UEFI / i386 (push) Has been cancelled
Build / UEFI / loong64 (push) Has been cancelled
Build / UEFI / riscv32 (push) Has been cancelled
Build / UEFI / riscv64 (push) Has been cancelled
Build / UEFI / x86_64 (push) Has been cancelled
Build / UEFI SB / arm64 (push) Has been cancelled
Build / UEFI SB / x86_64 (push) Has been cancelled
Build / SB Sign / arm64 (push) Has been cancelled
Build / SB Sign / x86_64 (push) Has been cancelled
Build / Linux / arm32 (push) Has been cancelled
Build / Linux / arm64 (push) Has been cancelled
Build / Linux / i386 (push) Has been cancelled
Build / Linux / loong64 (push) Has been cancelled
Build / Linux / riscv32 (push) Has been cancelled
Build / Linux / riscv64 (push) Has been cancelled
Build / Linux / x86_64 (push) Has been cancelled
Build / UEFI shim (push) Has been cancelled
Build / Combine (push) Has been cancelled
Build / Version (push) Has been cancelled
Build / Publish (push) Has been cancelled
Build / Release (push) Has been cancelled
This commit is contained in:
@@ -102,18 +102,18 @@ FILE_SECBOOT ( PERMITTED );
|
||||
//#define IMAGE_CRYPT_CMD /* Image encryption management commands */
|
||||
//#define IMAGE_MEM_CMD /* Read memory command */
|
||||
//#define IMAGE_TRUST_CMD /* Image trust management commands */
|
||||
//#define IPSTAT_CMD /* IP statistics commands */
|
||||
#define IPSTAT_CMD /* IP statistics commands */
|
||||
#define IWMGMT_CMD /* Wireless interface management commands */
|
||||
#define LOGIN_CMD /* Login command */
|
||||
//#define LOTEST_CMD /* Loopback testing commands */
|
||||
#define MENU_CMD /* Menu commands */
|
||||
//#define NEIGHBOUR_CMD /* Neighbour management commands */
|
||||
//#define NSLOOKUP_CMD /* DNS resolving command */
|
||||
#define NSLOOKUP_CMD /* DNS resolving command */
|
||||
#define NTP_CMD /* NTP commands */
|
||||
#define NVO_CMD /* Non-volatile option storage commands */
|
||||
#define PARAM_CMD /* Request parameter commands */
|
||||
#define PCI_CMD /* PCI commands */
|
||||
//#define PING_CMD /* Ping command */
|
||||
#define PING_CMD /* Ping command */
|
||||
//#define PROFSTAT_CMD /* Profiling commands */
|
||||
//#define PXE_CMD /* PXE commands */
|
||||
#define ROUTE_CMD /* Routing table management commands */
|
||||
@@ -124,6 +124,7 @@ FILE_SECBOOT ( PERMITTED );
|
||||
//#define TIME_CMD /* Time commands */
|
||||
#define USB_CMD /* USB commands */
|
||||
#define VLAN_CMD /* VLAN commands */
|
||||
#define SYS_ARCH_CMD /* Show system architecture command */
|
||||
|
||||
/* Commands supported only on systems capable of rebooting */
|
||||
#if ! defined ( REBOOT_NULL )
|
||||
@@ -161,12 +162,12 @@ FILE_SECBOOT ( PERMITTED );
|
||||
|
||||
/* Image types supported on all platforms */
|
||||
#define IMAGE_DER /* ASN.1 DER-encoded image support */
|
||||
//#define IMAGE_GZIP /* GZIP compressed image support */
|
||||
#define IMAGE_GZIP /* GZIP compressed image support */
|
||||
#define IMAGE_PEM /* ASN.1 PEM-encoded image support */
|
||||
//#define IMAGE_PNM /* PNM graphical image support */
|
||||
#define IMAGE_PNG /* PNG graphical image support */
|
||||
#define IMAGE_SCRIPT /* iPXE script image support */
|
||||
//#define IMAGE_ZLIB /* ZLIB compressed image support */
|
||||
#define IMAGE_ZLIB /* ZLIB compressed image support */
|
||||
|
||||
/* Image types supported only on BIOS platforms */
|
||||
#if defined ( PLATFORM_pcbios )
|
||||
|
||||
@@ -163,9 +163,14 @@ static void snpnet_check_link ( struct net_device *netdev ) {
|
||||
struct snp_nic *snp = netdev->priv;
|
||||
EFI_SIMPLE_NETWORK_MODE *mode = snp->snp->Mode;
|
||||
|
||||
/* Do nothing unless media presence detection is supported */
|
||||
if ( ! mode->MediaPresentSupported )
|
||||
/* Assume link up when media presence detection is not supported.
|
||||
* Apple's EFI SNP often reports MediaPresentSupported=FALSE even
|
||||
* on wired NICs; without this, the netdev stays link-down forever.
|
||||
*/
|
||||
if ( ! mode->MediaPresentSupported ) {
|
||||
netdev_link_up ( netdev );
|
||||
return;
|
||||
}
|
||||
|
||||
/* Report any link status change */
|
||||
if ( mode->MediaPresent && ( ! netdev_link_ok ( netdev ) ) ) {
|
||||
@@ -401,16 +406,26 @@ static int snpnet_open ( struct net_device *netdev ) {
|
||||
( ( efirc = snp->snp->Initialize ( snp->snp,
|
||||
0, 0 ) ) != 0 ) ) {
|
||||
rc = -EEFI ( efirc );
|
||||
snpnet_dump_mode ( netdev );
|
||||
DBGC ( snp, "SNP %s could not initialise: %s\n",
|
||||
/* Apple EFI transiently returns EFI_UNSUPPORTED or
|
||||
* EFI_NOT_READY during SNP initialisation; treat these
|
||||
* as retryable rather than failing immediately.
|
||||
*/
|
||||
if ( ( efirc != EFI_UNSUPPORTED ) &&
|
||||
( efirc != EFI_NOT_READY ) ) {
|
||||
snpnet_dump_mode ( netdev );
|
||||
DBGC ( snp, "SNP %s could not initialise: %s\n",
|
||||
netdev->name, strerror ( rc ) );
|
||||
return rc;
|
||||
}
|
||||
DBGC ( snp, "SNP %s initialise returned %s, retrying\n",
|
||||
netdev->name, strerror ( rc ) );
|
||||
return rc;
|
||||
} else {
|
||||
/* Stop if we have link up (or no link detection) */
|
||||
if ( ( ! mode->MediaPresentSupported ) ||
|
||||
mode->MediaPresent )
|
||||
break;
|
||||
}
|
||||
|
||||
/* Stop if we have link up (or no link detection capability) */
|
||||
if ( ( ! mode->MediaPresentSupported ) || mode->MediaPresent )
|
||||
break;
|
||||
|
||||
/* Stop if we have exceeded our retry count. This is
|
||||
* not a failure; it is plausible that we genuinely do
|
||||
* not have link up.
|
||||
@@ -423,12 +438,13 @@ static int snpnet_open ( struct net_device *netdev ) {
|
||||
/* Delay to allow time for link to establish */
|
||||
mdelay ( SNP_INITIALIZE_RETRY_DELAY_MS );
|
||||
|
||||
/* Shut down and retry (unless device is insomniac);
|
||||
* this is sometimes necessary in order to persuade
|
||||
* the underlying SNP driver to actually update the
|
||||
* link state.
|
||||
/* Shut down and retry (unless device is insomniac, or
|
||||
* the NIC was never successfully initialised this round);
|
||||
* this is sometimes necessary in order to persuade the
|
||||
* underlying SNP driver to actually update the link state.
|
||||
*/
|
||||
if ( ( ! netdev_insomniac ( netdev ) ) &&
|
||||
( mode->State == EfiSimpleNetworkInitialized ) &&
|
||||
( ( efirc = snp->snp->Shutdown ( snp->snp ) ) != 0 ) ) {
|
||||
rc = -EEFI ( efirc );
|
||||
snpnet_dump_mode ( netdev );
|
||||
|
||||
+811
-830
File diff suppressed because it is too large
Load Diff
+354
-3459
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,46 @@
|
||||
#include <stdio.h>
|
||||
#include <ipxe/command.h>
|
||||
#include <ipxe/parseopt.h>
|
||||
|
||||
/** "sys_arch" options */
|
||||
struct sys_arch_options {};
|
||||
|
||||
/** "sys_arch" option list */
|
||||
static struct option_descriptor sys_arch_opts[] = {};
|
||||
|
||||
/** "sys_arch" command descriptor */
|
||||
static struct command_descriptor sys_arch_cmd =
|
||||
COMMAND_DESC ( struct sys_arch_options, sys_arch_opts, 0, 0, "" );
|
||||
|
||||
static int sys_arch_exec ( int argc, char **argv ) {
|
||||
struct sys_arch_options opts;
|
||||
const char *arch;
|
||||
int rc;
|
||||
|
||||
if ( ( rc = parse_options ( argc, argv, &sys_arch_cmd, &opts ) ) != 0 )
|
||||
return rc;
|
||||
|
||||
#if defined(__x86_64__) || defined(_M_X64)
|
||||
arch = "amd64";
|
||||
#elif defined(__i386) || defined(_M_IX86)
|
||||
arch = "i386";
|
||||
#elif defined(__aarch64__)
|
||||
arch = "arm64";
|
||||
#elif defined(__arm__)
|
||||
arch = "arm32";
|
||||
#elif defined(__riscv) && __riscv_xlen == 64
|
||||
arch = "riscv64";
|
||||
#elif defined(__riscv) && __riscv_xlen == 32
|
||||
arch = "riscv32";
|
||||
#elif defined(__loongarch64) || defined(__loongarch__)
|
||||
arch = "loong64";
|
||||
#else
|
||||
arch = "unknown";
|
||||
#endif
|
||||
|
||||
printf ( "%s\n", arch );
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** "sys_arch" command */
|
||||
COMMAND ( sys_arch, sys_arch_exec );
|
||||
@@ -0,0 +1,46 @@
|
||||
#include <stdio.h>
|
||||
#include <ipxe/command.h>
|
||||
#include <ipxe/parseopt.h>
|
||||
|
||||
/** "sys_archnum" options */
|
||||
struct sys_archnum_options {};
|
||||
|
||||
/** "sys_archnum" option list */
|
||||
static struct option_descriptor sys_archnum_opts[] = {};
|
||||
|
||||
/** "sys_archnum" command descriptor */
|
||||
static struct command_descriptor sys_archnum_cmd =
|
||||
COMMAND_DESC ( struct sys_archnum_options, sys_archnum_opts, 0, 0, "" );
|
||||
|
||||
static int sys_archnum_exec ( int argc, char **argv ) {
|
||||
struct sys_archnum_options opts;
|
||||
const char *num;
|
||||
int rc;
|
||||
|
||||
if ( ( rc = parse_options ( argc, argv, &sys_archnum_cmd, &opts ) ) != 0 )
|
||||
return rc;
|
||||
|
||||
#if defined(__x86_64__) || defined(_M_X64)
|
||||
num = "64";
|
||||
#elif defined(__i386) || defined(_M_IX86)
|
||||
num = "32";
|
||||
#elif defined(__aarch64__)
|
||||
num = "64";
|
||||
#elif defined(__arm__)
|
||||
num = "32";
|
||||
#elif defined(__riscv) && __riscv_xlen == 64
|
||||
num = "64";
|
||||
#elif defined(__riscv) && __riscv_xlen == 32
|
||||
num = "32";
|
||||
#elif defined(__loongarch64) || defined(__loongarch__)
|
||||
num = "64";
|
||||
#else
|
||||
num = "unknown";
|
||||
#endif
|
||||
|
||||
printf ( "%s\n", num );
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** "sys_archnum" command */
|
||||
COMMAND ( sys_archnum, sys_archnum_exec );
|
||||
@@ -480,6 +480,64 @@ efi_veto_vmware_uefipxebc ( EFI_DRIVER_BINDING_PROTOCOL *binding __unused,
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a wide-character string contains a substring
|
||||
*
|
||||
* @v name Wide-character string to search
|
||||
* @v substr Wide-character substring to find
|
||||
* @ret found Substring was found
|
||||
*/
|
||||
static int efi_name_contains ( const CHAR16 *name, const CHAR16 *substr ) {
|
||||
size_t name_len;
|
||||
size_t substr_len;
|
||||
size_t i;
|
||||
|
||||
for ( name_len = 0 ; name[name_len] ; name_len++ ) {}
|
||||
for ( substr_len = 0 ; substr[substr_len] ; substr_len++ ) {}
|
||||
if ( substr_len > name_len )
|
||||
return 0;
|
||||
for ( i = 0 ; i <= ( name_len - substr_len ) ; i++ ) {
|
||||
if ( memcmp ( &name[i], substr,
|
||||
( substr_len * sizeof ( *substr ) ) ) == 0 )
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Veto Apple Inc. network drivers
|
||||
*
|
||||
* @v binding Driver binding protocol
|
||||
* @v loaded Loaded image protocol
|
||||
* @v manufacturer Manufacturer name, if present
|
||||
* @v name Driver name, if present
|
||||
* @ret vetoed Driver is to be vetoed
|
||||
*
|
||||
* Apple's EFI ships Broadcom and NetBoot drivers that grab the NIC
|
||||
* handle exclusively, preventing iPXE from binding its own driver.
|
||||
* Veto any Apple-manufactured driver whose name contains "Net" or
|
||||
* "Ethernet".
|
||||
*/
|
||||
static int
|
||||
efi_veto_apple_net ( EFI_DRIVER_BINDING_PROTOCOL *binding __unused,
|
||||
EFI_LOADED_IMAGE_PROTOCOL *loaded __unused,
|
||||
const char *manufacturer, const CHAR16 *name ) {
|
||||
static const CHAR16 net[] = L"Net";
|
||||
static const CHAR16 ethernet[] = L"Ethernet";
|
||||
static const char *apple = "Apple Inc.";
|
||||
|
||||
if ( ! manufacturer )
|
||||
return 0;
|
||||
if ( strcmp ( manufacturer, apple ) != 0 )
|
||||
return 0;
|
||||
if ( ! name )
|
||||
return 0;
|
||||
if ( efi_name_contains ( name, net ) ||
|
||||
efi_name_contains ( name, ethernet ) )
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Driver vetoes */
|
||||
static struct efi_veto_candidate efi_vetoes[] = {
|
||||
{
|
||||
@@ -494,6 +552,10 @@ static struct efi_veto_candidate efi_vetoes[] = {
|
||||
.name = "VMware UefiPxeBc",
|
||||
.veto = efi_veto_vmware_uefipxebc,
|
||||
},
|
||||
{
|
||||
.name = "Apple network",
|
||||
.veto = efi_veto_apple_net,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user