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_AES_CCM_EXTSHA_ETH
56 // #define IX_NPEDL_NPEIMAGE_NPEC_CRYPTO_ETH_LEARN_FILTER_SPAN_FIREWALL
57 // #define IX_NPEDL_NPEIMAGE_NPEC_ETH_SPAN_FIREWALL_VLAN_QOS_HDR_CONV
58 // #define IX_NPEDL_NPEIMAGE_NPEC_ETH_LEARN_FILTER_SPAN_FIREWALL_VLAN_QOS
59 // #define IX_NPEDL_NPEIMAGE_NPEC_ETH_LEARN_FILTER_SPAN_FIREWALL
65 #include <netinet/in.h>
66 #include <sys/types.h>
74 #if __BYTE_ORDER == __LITTLE_ENDIAN
75 #define to_le32(x) (x)
76 #define to_be32(x) bswap_32(x)
78 #define to_be32(x) (x)
79 #define to_le32(x) bswap_32(x)
89 const unsigned IxNpeMicrocode_array
[];
91 int main(int argc
, char *argv
[])
93 struct dl_image
*image
= (struct dl_image
*)IxNpeMicrocode_array
;
94 int imgsiz
, i
, fd
, cnt
;
95 const unsigned *arrayptr
= IxNpeMicrocode_array
;
96 const char *names
[] = { "IXP425", "IXP465", "unknown" };
100 if (!strcmp(argv
[1], "-le"))
102 else if (!strcmp(argv
[1], "-be"))
105 printf("Usage: %s <-le|-be>\n", argv
[0]);
110 for (image
= (struct dl_image
*)arrayptr
, cnt
=0;
111 (image
->id
!= 0xfeedf00d) && (image
->magic
== 0xfeedf00d);
112 image
= (struct dl_image
*)(arrayptr
), cnt
++)
114 unsigned char field
[4];
115 imgsiz
= image
->size
+ 3;
116 *(unsigned*)field
= to_be32(image
->id
);
117 char filename
[40], slnk
[10];
119 sprintf(filename
, "NPE-%c.%08x", (field
[0] & 0xf) + 'A',
121 sprintf(slnk
, "NPE-%c", (field
[0] & 0xf) + 'A');
122 printf("Writing image: %s.NPE_%c Func: %2x Rev: %02x.%02x "
123 "Size: %5d to: '%s'\n",
124 names
[field
[0] >> 4], (field
[0] & 0xf) + 'A',
125 field
[1], field
[2], field
[3], imgsiz
*4, filename
);
126 fd
= open(filename
, O_CREAT
| O_RDWR
| O_TRUNC
, 0644);
128 for (i
=0; i
<imgsiz
; i
++) {
129 *(unsigned*)field
= bigendian
?
130 to_be32(arrayptr
[i
]) :
131 to_le32(arrayptr
[i
]);
132 write(fd
, field
, sizeof(field
));
136 symlink(filename
, slnk
);
This page took 0.059112 seconds and 5 git commands to generate.