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.diff -r1.12 -r1.13 src/sys/arch/arm/xscale/files.ixp425
(rin)
--- 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,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | # $NetBSD: files.ixp425,v 1.12 2018/07/12 10:46:42 maxv Exp $ | 1 | # $NetBSD: files.ixp425,v 1.13 2023/06/17 11:57:49 rin Exp $ | |
2 | # | 2 | # | |
3 | # Configuration info for Intel IXP4xx CPU support | 3 | # Configuration info for Intel IXP4xx CPU support | |
4 | # | 4 | # | |
5 | 5 | |||
6 | defparam opt_ixp425.h IXP425_CLOCK_FREQ | 6 | defparam opt_ixp425.h IXP425_CLOCK_FREQ | |
7 | 7 | |||
8 | file arch/arm/xscale/ixp425_intr.c | 8 | file arch/arm/xscale/ixp425_intr.c | |
9 | file arch/arm/xscale/ixp425_mem.c | 9 | file arch/arm/xscale/ixp425_mem.c | |
10 | file arch/arm/arm32/irq_dispatch.S | 10 | file arch/arm/arm32/irq_dispatch.S | |
11 | 11 | |||
12 | # IXP425 Slow peripheral devices | 12 | # IXP425 Slow peripheral devices | |
13 | device ixpsip { [addr=-1], [size=0], [index=-1], [intr=-1] }: bus_space_generic | 13 | device ixpsip { [addr=-1], [size=0], [index=-1], [intr=-1] }: bus_space_generic | |
14 | file arch/arm/xscale/ixp425_sip.c ixpsip | 14 | file arch/arm/xscale/ixp425_sip.c ixpsip | |
@@ -40,18 +40,19 @@ file arch/arm/xscale/ixp425_com.c ixsip | @@ -40,18 +40,19 @@ file arch/arm/xscale/ixp425_com.c ixsip | |||
40 | file arch/arm/xscale/ixp425_a4x_space.c ixsipcom | 40 | file arch/arm/xscale/ixp425_a4x_space.c ixsipcom | |
41 | file arch/arm/xscale/ixp425_a4x_io.S ixsipcom | 41 | file arch/arm/xscale/ixp425_a4x_io.S ixsipcom | |
42 | 42 | |||
43 | # Micro-engine support | 43 | # Micro-engine support | |
44 | device ixme { npe }: bus_space_generic | 44 | device ixme { npe }: bus_space_generic | |
45 | attach ixme at mainbus | 45 | attach ixme at mainbus | |
46 | file arch/arm/xscale/ixp425_ixme.c ixme | 46 | file arch/arm/xscale/ixp425_ixme.c ixme | |
47 | file arch/arm/xscale/ixp425_qmgr.c ixme | 47 | file arch/arm/xscale/ixp425_qmgr.c ixme | |
48 | 48 | |||
49 | # NPE support | 49 | # NPE support | |
50 | device ixpnpe { [phy=-1] } | 50 | device ixpnpe { [phy=-1] } | |
51 | attach ixpnpe at ixme | 51 | attach ixpnpe at ixme | |
52 | file arch/arm/xscale/ixp425_npe.c ixpnpe | 52 | file arch/arm/xscale/ixp425_npe.c ixpnpe | |
53 | file arch/arm/xscale/ixp425_npe_fw.S ixpnpe | |||
53 | 54 | |||
54 | # NPE Ethernet | 55 | # NPE Ethernet | |
55 | device npe: ether, ifnet, arp, mii | 56 | device npe: ether, ifnet, arp, mii | |
56 | attach npe at ixpnpe | 57 | attach npe at ixpnpe | |
57 | file arch/arm/xscale/ixp425_if_npe.c npe | 58 | file arch/arm/xscale/ixp425_if_npe.c npe |
--- 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,21 +1,16 @@ | @@ -1,21 +1,16 @@ | |||
1 | # $NetBSD: ixp425-fw.mk,v 1.2 2010/03/26 15:55:33 jakllsch Exp $ | 1 | # $NetBSD: ixp425-fw.mk,v 1.3 2023/06/17 11:57:49 rin Exp $ | |
2 | 2 | |||
3 | # | 3 | # | |
4 | # For IXP425 NE support, this file must be included by the board-specific | 4 | # For IXP425 NE support, this file must be included by the board-specific | |
5 | # Makefile stub. | 5 | # Makefile stub. | |
6 | # | 6 | # | |
7 | 7 | |||
8 | # | 8 | # | |
9 | # See ixp425-fw.README for instructions on how to download and generate | 9 | # See ixp425-fw.README for instructions on how to download and generate | |
10 | # a suitable microcode image for IXP425 Ethernet support. | 10 | # a suitable microcode image for IXP425 Ethernet support. | |
11 | # | 11 | # | |
12 | 12 | |||
13 | .if exists($S/arch/arm/xscale/IxNpeMicrocode.dat) | 13 | NPE_MICROCODE= $S/arch/arm/xscale/IxNpeMicrocode.dat | |
14 | MD_OBJS+= ixp425_fw.o | 14 | .if exists(${MICROCODE}) | |
15 | CPPFLAGS+= -DIXP425_NPE_MICROCODE | 15 | CPPFLAGS+= -DIXP425_NPE_MICROCODE=\"${NPE_MICROCODE}\" | |
16 | ||||
17 | ixp425_fw.o: $S/arch/arm/xscale/IxNpeMicrocode.dat | |||
18 | -rm -f ${.OBJDIR}/IxNpeMicrocode.dat | |||
19 | -ln -s $S/arch/arm/xscale/IxNpeMicrocode.dat ${.OBJDIR} | |||
20 | ${OBJCOPY} -I binary -O default -B arm IxNpeMicrocode.dat ${.TARGET} | |||
21 | .endif | 16 | .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,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ixp425_npe.c,v 1.16 2022/09/27 06:36:43 skrll Exp $ */ | 1 | /* $NetBSD: ixp425_npe.c,v 1.17 2023/06/17 11:57:49 rin Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2006 Sam Leffler, Errno Consulting | 4 | * Copyright (c) 2006 Sam Leffler, Errno Consulting | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer, | 11 | * notice, this list of conditions and the following disclaimer, | |
12 | * without modification. | 12 | * without modification. | |
13 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | 13 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | |
14 | * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any | 14 | * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any | |
@@ -52,27 +52,27 @@ | @@ -52,27 +52,27 @@ | |||
52 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE | 52 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE | |
53 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 53 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
54 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 54 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
55 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 55 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
56 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 56 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
57 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 57 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
58 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 58 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
59 | * SUCH DAMAGE. | 59 | * SUCH DAMAGE. | |
60 | */ | 60 | */ | |
61 | #include <sys/cdefs.h> | 61 | #include <sys/cdefs.h> | |
62 | #if 0 | 62 | #if 0 | |
63 | __FBSDID("$FreeBSD: src/sys/arm/xscale/ixp425/ixp425_npe.c,v 1.1 2006/11/19 23:55:23 sam Exp $"); | 63 | __FBSDID("$FreeBSD: src/sys/arm/xscale/ixp425/ixp425_npe.c,v 1.1 2006/11/19 23:55:23 sam Exp $"); | |
64 | #endif | 64 | #endif | |
65 | __KERNEL_RCSID(0, "$NetBSD: ixp425_npe.c,v 1.16 2022/09/27 06:36:43 skrll Exp $"); | 65 | __KERNEL_RCSID(0, "$NetBSD: ixp425_npe.c,v 1.17 2023/06/17 11:57:49 rin Exp $"); | |
66 | 66 | |||
67 | /* | 67 | /* | |
68 | * Intel XScale Network Processing Engine (NPE) support. | 68 | * Intel XScale Network Processing Engine (NPE) support. | |
69 | * | 69 | * | |
70 | * Each NPE has an ixpnpeX device associated with it that is | 70 | * Each NPE has an ixpnpeX device associated with it that is | |
71 | * attached at boot. Depending on the microcode loaded into | 71 | * attached at boot. Depending on the microcode loaded into | |
72 | * an NPE there may be an Ethernet interface (npeX) or some | 72 | * an NPE there may be an Ethernet interface (npeX) or some | |
73 | * other network interface (e.g. for ATM). This file has support | 73 | * other network interface (e.g. for ATM). This file has support | |
74 | * for loading microcode images and the associated NPE CPU | 74 | * for loading microcode images and the associated NPE CPU | |
75 | * manipulations (start, stop, reset). | 75 | * manipulations (start, stop, reset). | |
76 | * | 76 | * | |
77 | * The code here basically replaces the npeDl and npeMh classes | 77 | * The code here basically replaces the npeDl and npeMh classes | |
78 | * in the Intel Access Library (IAL). | 78 | * in the Intel Access Library (IAL). | |
@@ -95,41 +95,27 @@ __KERNEL_RCSID(0, "$NetBSD: ixp425_npe.c | @@ -95,41 +95,27 @@ __KERNEL_RCSID(0, "$NetBSD: ixp425_npe.c | |||
95 | #include <machine/cpu.h> | 95 | #include <machine/cpu.h> | |
96 | #include <machine/intr.h> | 96 | #include <machine/intr.h> | |
97 | 97 | |||
98 | #include <arm/xscale/ixp425reg.h> | 98 | #include <arm/xscale/ixp425reg.h> | |
99 | #include <arm/xscale/ixp425var.h> | 99 | #include <arm/xscale/ixp425var.h> | |
100 | #include <arm/xscale/ixp425_ixmevar.h> | 100 | #include <arm/xscale/ixp425_ixmevar.h> | |
101 | 101 | |||
102 | #include <arm/xscale/ixp425_npereg.h> | 102 | #include <arm/xscale/ixp425_npereg.h> | |
103 | #include <arm/xscale/ixp425_npevar.h> | 103 | #include <arm/xscale/ixp425_npevar.h> | |
104 | #include <arm/xscale/ixp425_if_npereg.h> | 104 | #include <arm/xscale/ixp425_if_npereg.h> | |
105 | 105 | |||
106 | #include "locators.h" | 106 | #include "locators.h" | |
107 | 107 | |||
108 | /* | 108 | extern char _binary_IxNpeMicrocode_dat_start[]; | |
109 | * IXP425_NPE_MICROCODE will be defined by ixp425-fw.mk IFF the | |||
110 | * microcode object file exists in sys/arch/arm/xscale. | |||
111 | * | |||
112 | * To permit building the NPE drivers without microcode (so they | |||
113 | * don't bitrot due to lack of use), we use "empty" microcode so | |||
114 | * that the NPE drivers will simply fail to start at runtime. | |||
115 | */ | |||
116 | #ifdef IXP425_NPE_MICROCODE | |||
117 | extern char _binary_IxNpeMicrocode_dat_start[]; | |||
118 | #else | |||
119 | static char _binary_IxNpeMicrocode_dat_start[] = { | |||
120 | 0xfe, 0xed, 0xf0, 0x0d, 0xfe, 0xed, 0xf0, 0x0d | |||
121 | }; | |||
122 | #endif | |||
123 | 109 | |||
124 | #define IX_NPEDL_NPEIMAGE_FIELD_MASK 0xff | 110 | #define IX_NPEDL_NPEIMAGE_FIELD_MASK 0xff | |
125 | 111 | |||
126 | /* used to read download map from version in microcode image */ | 112 | /* used to read download map from version in microcode image */ | |
127 | #define IX_NPEDL_BLOCK_TYPE_INSTRUCTION 0x00000000 | 113 | #define IX_NPEDL_BLOCK_TYPE_INSTRUCTION 0x00000000 | |
128 | #define IX_NPEDL_BLOCK_TYPE_DATA 0x00000001 | 114 | #define IX_NPEDL_BLOCK_TYPE_DATA 0x00000001 | |
129 | #define IX_NPEDL_BLOCK_TYPE_STATE 0x00000002 | 115 | #define IX_NPEDL_BLOCK_TYPE_STATE 0x00000002 | |
130 | #define IX_NPEDL_END_OF_DOWNLOAD_MAP 0x0000000F | 116 | #define IX_NPEDL_END_OF_DOWNLOAD_MAP 0x0000000F | |
131 | 117 | |||
132 | /* | 118 | /* | |
133 | * masks used to extract address info from State information context | 119 | * masks used to extract address info from State information context | |
134 | * register addresses as read from microcode image | 120 | * register addresses as read from microcode image | |
135 | */ | 121 | */ |
/* $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