Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/xscale Rework microcode for IXP425 npe(4).



details:   https://anonhg.NetBSD.org/src/rev/06f594b3db01
branches:  trunk
changeset: 376428:06f594b3db01
user:      rin <rin%NetBSD.org@localhost>
date:      Sat Jun 17 11:57:49 2023 +0000

description:
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.

diffstat:

 sys/arch/arm/xscale/files.ixp425    |   3 +-
 sys/arch/arm/xscale/ixp425-fw.mk    |  13 +----
 sys/arch/arm/xscale/ixp425_npe.c    |  20 +-------
 sys/arch/arm/xscale/ixp425_npe_fw.S |  82 +++++++++++++++++++++++++++++++++++++
 4 files changed, 91 insertions(+), 27 deletions(-)

diffs (169 lines):

diff -r a4a9c4587005 -r 06f594b3db01 sys/arch/arm/xscale/files.ixp425
--- a/sys/arch/arm/xscale/files.ixp425  Sat Jun 17 11:41:11 2023 +0000
+++ b/sys/arch/arm/xscale/files.ixp425  Sat Jun 17 11:57:49 2023 +0000
@@ -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 @@ file  arch/arm/xscale/ixp425_qmgr.c           ixme
 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
diff -r a4a9c4587005 -r 06f594b3db01 sys/arch/arm/xscale/ixp425-fw.mk
--- a/sys/arch/arm/xscale/ixp425-fw.mk  Sat Jun 17 11:41:11 2023 +0000
+++ b/sys/arch/arm/xscale/ixp425-fw.mk  Sat Jun 17 11:57:49 2023 +0000
@@ -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
diff -r a4a9c4587005 -r 06f594b3db01 sys/arch/arm/xscale/ixp425_npe.c
--- a/sys/arch/arm/xscale/ixp425_npe.c  Sat Jun 17 11:41:11 2023 +0000
+++ b/sys/arch/arm/xscale/ixp425_npe.c  Sat Jun 17 11:57:49 2023 +0000
@@ -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
 
diff -r a4a9c4587005 -r 06f594b3db01 sys/arch/arm/xscale/ixp425_npe_fw.S
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/arm/xscale/ixp425_npe_fw.S       Sat Jun 17 11:57:49 2023 +0000
@@ -0,0 +1,82 @@
+/*     $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



Home | Main Index | Thread Index | Old Index