Compare commits

..

4 Commits

Author SHA1 Message Date
6d1d28a4cc [realtek] Explicitly disable VLAN offload
Some cards seem to have the receive VLAN tag stripping feature enabled
by default, which causes received VLAN packets to be misinterpreted as
being received by the trunk device.

Fix by disabling VLAN tag stripping in the C+ Command Register.

Debugged-by: ?????? <yiyihu@gmail.com>
Tested-by: ?????? <yiyihu@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2023-02-01 18:25:33 +00:00
aa85c2918a [efi] Update to current EDK2 headers
Update to pick up the upstream commit bda715b ("MdePkg: Fix UINT64 and
INT64 word length for LoongArch64").

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2023-02-01 10:50:47 +00:00
66a2ff442d [tests] Verify ability to sleep the CPU
The self-test suite does not currently ever attempt to sleep the CPU.
This is an operation that may fail (e.g. by attempting to execute a
privileged instruction while running as a Linux userspace binary, or
by halting the CPU with all interrupts disabled).

Add a trivial self-test to exercise the ability to sleep the CPU
without crashing or halting forever.

Inspired-by: Xiaotian Wu <wuxiaotian@loongson.cn>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2023-01-31 10:17:57 +00:00
3bcd0d3271 [dhcp] Add IANA-defined values for all current EFI client architectures
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2023-01-31 02:00:12 +00:00
7 changed files with 92 additions and 14 deletions

View File

@ -1067,11 +1067,15 @@ static void realtek_detect ( struct realtek_nic *rtl ) {
* Note that enabling DAC seems to cause bizarre behaviour
* (lockups, garbage data on the wire) on some systems, even
* if only 32-bit addresses are used.
*
* Disable VLAN offload, since some cards seem to have it
* enabled by default.
*/
cpcr = readw ( rtl->regs + RTL_CPCR );
cpcr |= ( RTL_CPCR_MULRW | RTL_CPCR_CPRX | RTL_CPCR_CPTX );
if ( sizeof ( physaddr_t ) > sizeof ( uint32_t ) )
cpcr |= RTL_CPCR_DAC;
cpcr &= ~RTL_CPCR_VLAN;
writew ( cpcr, rtl->regs + RTL_CPCR );
check_cpcr = readw ( rtl->regs + RTL_CPCR );

View File

@ -230,6 +230,7 @@ enum realtek_legacy_status {
#define RTL_CPCR 0xe0
#define RTL_CPCR_DAC 0x0010 /**< PCI Dual Address Cycle Enable */
#define RTL_CPCR_MULRW 0x0008 /**< PCI Multiple Read/Write Enable */
#define RTL_CPCR_VLAN 0x0040 /**< VLAN tag stripping enable */
#define RTL_CPCR_CPRX 0x0002 /**< C+ receive enable */
#define RTL_CPCR_CPTX 0x0001 /**< C+ transmit enable */

View File

@ -274,8 +274,9 @@ struct dhcp_client_architecture {
/** DHCP client architecture values
*
* These are defined by the PXE specification and redefined by
* RFC4578.
* These are originally defined by the PXE specification, redefined by
* RFC4578, redefined again by RFC5970, and now maintained in the IANA
* DHCPv6 parameters registry.
*/
enum dhcp_client_architecture_values {
/** Intel x86 PC */
@ -302,6 +303,24 @@ enum dhcp_client_architecture_values {
DHCP_CLIENT_ARCHITECTURE_ARM32 = 0x000a,
/** EFI 64-bit ARM */
DHCP_CLIENT_ARCHITECTURE_ARM64 = 0x000b,
/** EFI 32-bit RISC-V */
DHCP_CLIENT_ARCHITECTURE_RISCV32 = 0x0019,
/** EFI 64-bit RISC-V */
DHCP_CLIENT_ARCHITECTURE_RISCV64 = 0x001b,
/** EFI 128-bit RISC-V */
DHCP_CLIENT_ARCHITECTURE_RISCV128 = 0x001d,
/** EFI 32-bit MIPS */
DHCP_CLIENT_ARCHITECTURE_MIPS32 = 0x0021,
/** EFI 64-bit MIPS */
DHCP_CLIENT_ARCHITECTURE_MIPS64 = 0x0022,
/** EFI 32-bit Sunway */
DHCP_CLIENT_ARCHITECTURE_SUNWAY32 = 0x0023,
/** EFI 64-bit Sunway */
DHCP_CLIENT_ARCHITECTURE_SUNWAY64 = 0x0024,
/** EFI 32-bit LoongArch */
DHCP_CLIENT_ARCHITECTURE_LOONG32 = 0x0025,
/** EFI 64-bit LoongArch */
DHCP_CLIENT_ARCHITECTURE_LOONG64 = 0x0027,
};
/** Client network device interface */

View File

@ -30,17 +30,17 @@ FILE_LICENCE ( BSD2_PATENT );
// Assume standard LoongArch 64-bit alignment.
// Need to check portability of long long
//
typedef unsigned long UINT64;
typedef long INT64;
typedef unsigned int UINT32;
typedef int INT32;
typedef unsigned short UINT16;
typedef unsigned short CHAR16;
typedef short INT16;
typedef unsigned char BOOLEAN;
typedef unsigned char UINT8;
typedef char CHAR8;
typedef char INT8;
typedef unsigned long long UINT64;
typedef long long INT64;
typedef unsigned int UINT32;
typedef int INT32;
typedef unsigned short UINT16;
typedef unsigned short CHAR16;
typedef short INT16;
typedef unsigned char BOOLEAN;
typedef unsigned char UINT8;
typedef char CHAR8;
typedef char INT8;
//
// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions,

View File

@ -66,7 +66,7 @@ typedef enum {
// /// EfiGcdMemoryTypeUnaccepted is defined in PrePiDxeCis.h because it has not been
// /// defined in PI spec.
// EfiGcdMemoryTypeUnaccepted,
EfiGcdMemoryTypeMaximum = 8
EfiGcdMemoryTypeMaximum = 7
} EFI_GCD_MEMORY_TYPE;
///

53
src/tests/nap_test.c Normal file
View File

@ -0,0 +1,53 @@
/*
* Copyright (C) 2023 Michael Brown <mbrown@fensystems.co.uk>.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*
* You can also choose to distribute this program under the terms of
* the Unmodified Binary Distribution Licence (as given in the file
* COPYING.UBDL), provided that you have satisfied its requirements.
*/
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
/** @file
*
* CPU sleeping test
*
*/
/* Forcibly enable assertions */
#undef NDEBUG
#include <ipxe/nap.h>
#include <ipxe/test.h>
/**
* Perform CPU sleeping self-test
*
*/
static void nap_test_exec ( void ) {
/* Check that we can sleep without crashing or halting forever */
cpu_nap();
ok ( 1 );
}
/** CPU sleeping self-test */
struct self_test nap_test __self_test = {
.name = "nap",
.exec = nap_test_exec,
};

View File

@ -80,3 +80,4 @@ REQUIRE_OBJECT ( acpi_test );
REQUIRE_OBJECT ( hmac_test );
REQUIRE_OBJECT ( dhe_test );
REQUIRE_OBJECT ( gcm_test );
REQUIRE_OBJECT ( nap_test );