2 * IxNpeMicrocode.h - Headerfile for compiling the Intel microcode C file
4 * Copyright (C) 2006 Christian Hohnstaedt <chohnstaedt@innominate.com>
6 * This file is released under the GPLv2
11 * gcc -Wall IxNpeMicrocode.c -o IxNpeMicrocode
13 * Executing the resulting binary on your build-host creates the
14 * "NPE-[ABC].xxxxxxxx" files containing the selected microcode
16 * fetch the IxNpeMicrocode.c from the Intel Access Library.
17 * It will include this header.
19 * select Images for every NPE from the following
20 * (used C++ comments for easy uncommenting ....)
23 // #define IX_NPEDL_NPEIMAGE_NPEA_ETH_SPAN_MASK_FIREWALL_VLAN_QOS_HDR_CONV_EXTMIB
24 // #define IX_NPEDL_NPEIMAGE_NPEA_ETH_SPAN_VLAN_QOS_HDR_CONV_EXTMIB
25 // #define IX_NPEDL_NPEIMAGE_NPEA_ETH_LEARN_FILTER_SPAN_MASK_FIREWALL_VLAN_QOS_EXTMIB
26 // #define IX_NPEDL_NPEIMAGE_NPEA_HSS_TSLOT_SWITCH
27 // #define IX_NPEDL_NPEIMAGE_NPEA_ETH_SPAN_FIREWALL_VLAN_QOS_HDR_CONV
28 // #define IX_NPEDL_NPEIMAGE_NPEA_ETH_LEARN_FILTER_SPAN_FIREWALL_VLAN_QOS
29 // #define IX_NPEDL_NPEIMAGE_NPEA_ETH_LEARN_FILTER_SPAN_FIREWALL
30 // #define IX_NPEDL_NPEIMAGE_NPEA_HSS_2_PORT
31 // #define IX_NPEDL_NPEIMAGE_NPEA_DMA
32 // #define IX_NPEDL_NPEIMAGE_NPEA_ATM_MPHY_12_PORT
33 // #define IX_NPEDL_NPEIMAGE_NPEA_HSS0_ATM_MPHY_1_PORT
34 // #define IX_NPEDL_NPEIMAGE_NPEA_HSS0_ATM_SPHY_1_PORT
35 // #define IX_NPEDL_NPEIMAGE_NPEA_HSS0
36 // #define IX_NPEDL_NPEIMAGE_NPEA_WEP
39 // #define IX_NPEDL_NPEIMAGE_NPEB_ETH_SPAN_MASK_FIREWALL_VLAN_QOS_HDR_CONV_EXTMIB
40 // #define IX_NPEDL_NPEIMAGE_NPEB_ETH_SPAN_VLAN_QOS_HDR_CONV_EXTMIB
41 // #define IX_NPEDL_NPEIMAGE_NPEB_ETH_LEARN_FILTER_SPAN_MASK_FIREWALL_VLAN_QOS_EXTMIB
42 // #define IX_NPEDL_NPEIMAGE_NPEB_DMA
43 #define IX_NPEDL_NPEIMAGE_NPEB_ETH_SPAN_FIREWALL_VLAN_QOS_HDR_CONV
44 // #define IX_NPEDL_NPEIMAGE_NPEB_ETH_LEARN_FILTER_SPAN_FIREWALL_VLAN_QOS
45 // #define IX_NPEDL_NPEIMAGE_NPEB_ETH_LEARN_FILTER_SPAN_FIREWALL
48 // #define IX_NPEDL_NPEIMAGE_NPEC_ETH_SPAN_MASK_FIREWALL_VLAN_QOS_HDR_CONV_EXTMIB
49 // #define IX_NPEDL_NPEIMAGE_NPEC_ETH_SPAN_VLAN_QOS_HDR_CONV_EXTMIB
50 // #define IX_NPEDL_NPEIMAGE_NPEC_ETH_LEARN_FILTER_SPAN_MASK_FIREWALL_VLAN_QOS_EXTMIB
51 // #define IX_NPEDL_NPEIMAGE_NPEC_DMA
52 // #define IX_NPEDL_NPEIMAGE_NPEC_CRYPTO_AES_ETH_LEARN_FILTER_SPAN
53 // #define IX_NPEDL_NPEIMAGE_NPEC_CRYPTO_AES_ETH_LEARN_FILTER_FIREWALL
54 #define IX_NPEDL_NPEIMAGE_NPEC_CRYPTO_AES_CCM_ETH
55 // #define IX_NPEDL_NPEIMAGE_NPEC_CRYPTO_ETH_LEARN_FILTER_SPAN_FIREWALL
56 #define IX_NPEDL_NPEIMAGE_NPEC_ETH_SPAN_FIREWALL_VLAN_QOS_HDR_CONV
57 // #define IX_NPEDL_NPEIMAGE_NPEC_ETH_LEARN_FILTER_SPAN_FIREWALL_VLAN_QOS
58 // #define IX_NPEDL_NPEIMAGE_NPEC_ETH_LEARN_FILTER_SPAN_FIREWALL
64 #include <netinet/in.h>
65 #include <sys/types.h>
73 #if __BYTE_ORDER == __LITTLE_ENDIAN
74 #define to_le32(x) (x)
75 #define to_be32(x) bswap_32(x)
77 #define to_be32(x) (x)
78 #define to_le32(x) bswap_32(x)
88 const unsigned IxNpeMicrocode_array
[];
90 int main(int argc
, char *argv
[])
92 struct dl_image
*image
= (struct dl_image
*)IxNpeMicrocode_array
;
93 int imgsiz
, i
, fd
, cnt
;
94 const unsigned *arrayptr
= IxNpeMicrocode_array
;
95 const char *names
[] = { "IXP425", "IXP465", "unknown" };
99 if (!strcmp(argv
[1], "-le"))
101 else if (!strcmp(argv
[1], "-be"))
104 printf("Usage: %s <-le|-be>\n", argv
[0]);
109 for (image
= (struct dl_image
*)arrayptr
, cnt
=0;
110 (image
->id
!= 0xfeedf00d) && (image
->magic
== 0xfeedf00d);
111 image
= (struct dl_image
*)(arrayptr
), cnt
++)
113 unsigned char field
[4];
114 imgsiz
= image
->size
+ 3;
115 *(unsigned*)field
= to_be32(image
->id
);
116 char filename
[40], slnk
[10];
118 sprintf(filename
, "NPE-%c.%08x", (field
[0] & 0xf) + 'A',
120 sprintf(slnk
, "NPE-%c", (field
[0] & 0xf) + 'A');
121 printf("Writing image: %s.NPE_%c Func: %2x Rev: %02x.%02x "
122 "Size: %5d to: '%s'\n",
123 names
[field
[0] >> 4], (field
[0] & 0xf) + 'A',
124 field
[1], field
[2], field
[3], imgsiz
*4, filename
);
125 fd
= open(filename
, O_CREAT
| O_RDWR
| O_TRUNC
, 0644);
127 for (i
=0; i
<imgsiz
; i
++) {
128 *(unsigned*)field
= bigendian
?
129 to_be32(arrayptr
[i
]) :
130 to_le32(arrayptr
[i
]);
131 write(fd
, field
, sizeof(field
));
135 symlink(filename
, slnk
);
This page took 0.068735 seconds and 5 git commands to generate.