Sat Jun 17 11:57:49 2023 UTC ()
Rework microcode for IXP425 npe(4).
Instead of using objcopy(1), which cannot handle EABI version
embedded in e_flags of ELF header, add a dedicated asm file.
If proprietary microcode binary is present, it is incbin'ed
from that asm file.
(rin)
diff -r1.12 -r1.13 src/sys/arch/arm/xscale/files.ixp425
diff -r1.2 -r1.3 src/sys/arch/arm/xscale/ixp425-fw.mk
diff -r1.16 -r1.17 src/sys/arch/arm/xscale/ixp425_npe.c
diff -r0 -r1.1 src/sys/arch/arm/xscale/ixp425_npe_fw.S
--- src/sys/arch/arm/xscale/files.ixp425 2018/07/12 10:46:42 1.12
+++ src/sys/arch/arm/xscale/files.ixp425 2023/06/17 11:57:49 1.13
@@ -1,4 +1,4 @@
-# $NetBSD: files.ixp425,v 1.12 2018/07/12 10:46:42 maxv Exp $
+# $NetBSD: files.ixp425,v 1.13 2023/06/17 11:57:49 rin Exp $
#
# Configuration info for Intel IXP4xx CPU support
#
@@ -50,6 +50,7 @@
device ixpnpe { [phy=-1] }
attach ixpnpe at ixme
file arch/arm/xscale/ixp425_npe.c ixpnpe
+file arch/arm/xscale/ixp425_npe_fw.S ixpnpe
# NPE Ethernet
device npe: ether, ifnet, arp, mii
--- src/sys/arch/arm/xscale/ixp425-fw.mk 2010/03/26 15:55:33 1.2
+++ src/sys/arch/arm/xscale/ixp425-fw.mk 2023/06/17 11:57:49 1.3
@@ -1,4 +1,4 @@
-# $NetBSD: ixp425-fw.mk,v 1.2 2010/03/26 15:55:33 jakllsch Exp $
+# $NetBSD: ixp425-fw.mk,v 1.3 2023/06/17 11:57:49 rin Exp $
#
# For IXP425 NE support, this file must be included by the board-specific
@@ -10,12 +10,7 @@
# a suitable microcode image for IXP425 Ethernet support.
#
-.if exists($S/arch/arm/xscale/IxNpeMicrocode.dat)
-MD_OBJS+= ixp425_fw.o
-CPPFLAGS+= -DIXP425_NPE_MICROCODE
-
-ixp425_fw.o: $S/arch/arm/xscale/IxNpeMicrocode.dat
- -rm -f ${.OBJDIR}/IxNpeMicrocode.dat
- -ln -s $S/arch/arm/xscale/IxNpeMicrocode.dat ${.OBJDIR}
- ${OBJCOPY} -I binary -O default -B arm IxNpeMicrocode.dat ${.TARGET}
+NPE_MICROCODE= $S/arch/arm/xscale/IxNpeMicrocode.dat
+.if exists(${MICROCODE})
+CPPFLAGS+= -DIXP425_NPE_MICROCODE=\"${NPE_MICROCODE}\"
.endif
--- src/sys/arch/arm/xscale/ixp425_npe.c 2022/09/27 06:36:43 1.16
+++ src/sys/arch/arm/xscale/ixp425_npe.c 2023/06/17 11:57:49 1.17
@@ -1,4 +1,4 @@
-/* $NetBSD: ixp425_npe.c,v 1.16 2022/09/27 06:36:43 skrll Exp $ */
+/* $NetBSD: ixp425_npe.c,v 1.17 2023/06/17 11:57:49 rin Exp $ */
/*-
* Copyright (c) 2006 Sam Leffler, Errno Consulting
@@ -62,7 +62,7 @@
#if 0
__FBSDID("$FreeBSD: src/sys/arm/xscale/ixp425/ixp425_npe.c,v 1.1 2006/11/19 23:55:23 sam Exp $");
#endif
-__KERNEL_RCSID(0, "$NetBSD: ixp425_npe.c,v 1.16 2022/09/27 06:36:43 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixp425_npe.c,v 1.17 2023/06/17 11:57:49 rin Exp $");
/*
* Intel XScale Network Processing Engine (NPE) support.
@@ -105,21 +105,7 @@
#include "locators.h"
-/*
- * IXP425_NPE_MICROCODE will be defined by ixp425-fw.mk IFF the
- * microcode object file exists in sys/arch/arm/xscale.
- *
- * To permit building the NPE drivers without microcode (so they
- * don't bitrot due to lack of use), we use "empty" microcode so
- * that the NPE drivers will simply fail to start at runtime.
- */
-#ifdef IXP425_NPE_MICROCODE
-extern char _binary_IxNpeMicrocode_dat_start[];
-#else
-static char _binary_IxNpeMicrocode_dat_start[] = {
- 0xfe, 0xed, 0xf0, 0x0d, 0xfe, 0xed, 0xf0, 0x0d
-};
-#endif
+extern char _binary_IxNpeMicrocode_dat_start[];
#define IX_NPEDL_NPEIMAGE_FIELD_MASK 0xff
/* $NetBSD: ixp425_npe_fw.S,v 1.1 2023/06/17 11:57:49 rin Exp $ */
/*-
* Copyright (c) 2006 Sam Leffler, Errno Consulting
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
* redistribution must be conditioned upon including a substantially
* similar Disclaimer requirement for further binary redistribution.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGES.
*/
/*-
* Copyright (c) 2001-2005, Intel Corporation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Intel Corporation nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <arm/asm.h>
/*
* IXP425_NPE_MICROCODE will be defined by ixp425-fw.mk IFF the
* microcode object file exists in sys/arch/arm/xscale.
*
* To permit building the NPE drivers without microcode (so they
* don't bitrot due to lack of use), we use "empty" microcode so
* that the NPE drivers will simply fail to start at runtime.
*/
.align 2
.section .data
.global _C_LABEL(_binary_IxNpeMicrocode_dat_start)
_C_LABEL(_binary_IxNpeMicrocode_dat_start):
#ifdef IXP425_NPE_MICROCODE
.incbin IXP425_NPE_MICROCODE
#else
.word 0xfeedf00d
.word 0xfeedf00d
#endif