Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / openbios / utils / devbios / flashchips.c
1 /*
2  *                     OpenBIOS - free your system! 
3  *              ( firmware/flash device driver for Linux )
4  *                          
5  *  flashchips.c - contains all information about supported flash devices. 
6  *  
7  *  This program is part of a free implementation of the IEEE 1275-1994 
8  *  Standard for Boot (Initialization Configuration) Firmware.
9  *
10  *  Copyright (C) 1998-2004  Stefan Reinauer, <stepan@openbios.org>
11  *
12  *  This program is free software; you can redistribute it and/or modify
13  *  it under the terms of the GNU General Public License as published by
14  *  the Free Software Foundation; version 2 of the License.
15  *
16  *  This program is distributed in the hope that it will be useful,
17  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  *  GNU General Public License for more details.
20  *
21  *  You should have received a copy of the GNU General Public License
22  *  along with this program; if not, write to the Free Software
23  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
24  *
25  */
26 // <-- C++ style comments are for experimental comments only.
27 // They will disappear as soon as I fixed all the stuff.
28
29 #include "bios.h"
30 #include "flashchips.h"
31
32 unsigned int currflash=0;
33
34 const manufacturer_t manufacturers[] =
35 {
36         { "AMD",                0x01 },
37         { "AMI",                0x02 },
38         { "Fairchild",          0x83 },
39         { "Fujitsu",            0x04 },
40         { "GTE",                0x85 },
41         { "Harris",             0x86 },
42         { "Hitachi",            0x07 },
43         { "Inmos",              0x08 },
44         { "Intel",              0x89 },
45         { "I.T.T.",             0x8A },
46         { "Intersil",           0x0B },
47         { "Monolithic Memories",0x8C },
48         { "Mostek",             0x0D },
49         { "Motorola",           0x0E },
50         { "National",           0x8F },
51         { "NEC",                0x10 },
52         { "RCA",                0x91 },
53         { "Raytheon",           0x92 },
54         { "Rockwell",           0x13 },
55         { "Seeq",               0x94 },
56         { "Philips Semi.",      0x15 },
57         { "Synertek",           0x16 },
58         { "Texas Instruments",  0x97 },
59         { "Toshiba",            0x98 },
60         { "Xicor",              0x19 },
61         { "Zilog",              0x1A },
62         { "Eurotechnique",      0x9B },
63         { "Mitsubishi",         0x1C },
64         { "PMC Flash",          0x9D },
65         { "Exel",               0x9E },
66         { "Atmel",              0x1F },
67         { "SGS/Thomson",        0x20 },
68         { "Lattice Semi.",      0xA1 },
69         { "NCR",                0xA2 },
70         { "Wafer Scale Integr.",0x23 },
71         { "IBM",                0xA4 },
72         { "Tristar",            0x25 },
73         { "Visic",              0x26 },
74         { "Intl. CMOS Tech.",   0xA7 },
75         { "SSSI",               0xA8 },
76         { "MicrochipTech.",     0x29 },
77         { "Ricoh Ltd.",         0x2A },
78         { "VLSI",               0xAB },
79         { "Micron Technology",  0x2C },
80         { "Hyundai Elect.",     0xAD },
81         { "OKI Semiconductor",  0xAE },
82         { "ACTEL",              0x2F },
83         { "Sharp",              0xB0 },
84         { "Catalyst",           0x31 },
85         { "Panasonic",          0x32 },
86         { "IDT",                0xB3 },
87         { "Cypress",            0x34 },
88         { "DEC",                0xB5 },
89         { "LSI Logic",          0xB6 },
90         { "Plessey",            0x37 },
91         { "UTMC",               0x38 },
92         { "Thinking Machine",   0xB9 },
93         { "Thomson CSF",        0xBA },
94         { "Integ. CMOS(Vertex)",0x3B },
95         { "Honeywell",          0xBC },
96         { "Tektronix",          0x3D },
97         { "Sun Microsystems",   0x3E },
98         { "SST",                0xBF },
99         { "MOSEL",              0x40 },
100         { "Siemens",            0xC1 },
101         { "Macronix",           0xC2 },
102         { "Xerox",              0x43 },
103         { "Plus Logic",         0xC4 },
104         { "SunDisk",            0x45 },
105         { "Elan Circuit Tech.", 0x46 },
106         { "Europ. Silicon Str.",0xC7 },
107         { "Apple Computer",     0xC8 },
108         { "Xilinx",             0xC9 },
109         { "Compaq",             0x4A },
110         { "Protocol Engines",   0xCB },
111         { "SCI",                0x4C },
112         { "Seiko Instruments",  0xCD },
113         { "Samsung",            0xCE },
114         { "I3 Design System",   0x4F },
115         { "Klic",               0xD0 },
116         { "Crosspoint Sol.",    0x51 },
117         { "Alliance Semicond.", 0x52 },
118         { "Tandem",             0xD3 },
119         { "Hewlett-Packard",    0x54 },
120         { "Intg. Silicon Sol.", 0xD5 },
121         { "Brooktree",          0xD6 },
122         { "New Media",          0x57 },
123         { "MHS Electronic",     0x58 },
124         { "Performance Semi.",  0xD9 },
125         { "Winbond",            0xDA },
126         { "Kawasaki Steel",     0x5B },
127         { "Bright Micro",       0xDC },
128         { "TECMAR",             0x5D },
129         { "Exar",               0x5E },
130         { "PCMCIA",             0xDF },
131         { "Goldstar",           0xE0 },
132         { "Northern Telecom",   0x61 },
133         { "Sanyo",              0x62 },
134         { "Array Microsystems", 0xE3 },
135         { "Crystal Semicond.",  0x64 },
136         { "Analog Devices",     0xE5 },
137         { "PMC-Sierra",         0xE6 },
138         { "Asparix",            0x67 },
139         { "Convex Computer",    0x68 },
140         { "Quality Semicond.",  0xE9 },
141         { "Nimbus Technology",  0xEA },
142         { "Transwitch",         0x6B },
143         { "ITT Intermetall",    0xEC },
144         { "Cannon",             0x6D },
145         { "Altera",             0x6E },
146         { "NEXCOM",             0xEF },
147         { "QUALCOMM",           0x70 },
148         { "Sony",               0xF1 },
149         { "Cray Research",      0xF2 },
150         { "AMS(Austria Micro)", 0x73 },
151         { "Vitesse",            0xF4 },
152         { "Aster Electronics",  0x75 },
153         { "Bay Networks(Synoptic)",     0x76 },
154         { "Zentrum Mikroelec.", 0xF7 },
155         { "TRW",                0xF8 },
156         { "Thesys",             0x79 },
157         { "Solbourne Computer", 0x7A },
158         { "Allied-Signal",      0xFB },
159         { "Dialog",             0x7C },
160         { "Media Vision",       0xFD },
161         { "Level One Commun.",  0xFE },
162         { "Eon",                0x7F },
163
164         { "Unknown",            0x00 }
165 };
166
167 const flashchip_t flashchips[] =
168 {
169         /* AMD */
170         { "29F016B",    0xad01,  5, 2048, 0,   1, 1, (int []) { 0,2048 } },
171         { "29F080B",    0xd501,  5, 1024, 0,   1, 1, (int []) { 0,1024 } },
172         { "29F800BT",   0xd601,  5, 1024, 0,   1, 1, (int []) { 0,1024 } },
173         { "29F800BB",   0x5801,  5, 1024, 0,   1, 1, (int []) { 0,1024 } },
174         { "29F040B",    0xa401,  5,  512, 0,   1, 1, (int []) { 0, 512 } },
175         { "29F400T",    0x2301,  5,  512, 0,   1, 1, (int []) { 0, 512 } },
176         { "29LV004T",   0xb501,  3,  512, 0,   1, 1, (int []) { 0, 512 } },
177         { "29LV400T",   0xb901,  3,  512, 0,   1, 1, (int []) { 0, 512 } },
178         { "29F400B",    0xab01,  5,  512, 0,   1, 1, (int []) { 0, 512 } },
179         { "29LV004B",   0xb601,  3,  512, 0,   1, 1, (int []) { 0, 512 } },
180         { "29LV400B",   0xba01,  3,  512, 0,   1, 1, (int []) { 0, 512 } },
181         { "28F020A",    0x2901, 12,  256, 0,   1, 1, (int []) { 0, 256 } },
182         { "28F020",     0x2a01, 12,  256, 0,   1, 1, (int []) { 0, 256 } },
183         { "29F002T",    0xb001,  5,  256, 0,   1, 1, (int []) { 0, 256 } },
184         { "29LV002T",   0x4001,  3,  256, 0,   1, 1, (int []) { 0, 256 } },
185         { "29LV200T",   0x3b01,  3,  256, 0,   1, 1, (int []) { 0, 256 } },
186         { "29F200T",    0x5101,  5,  256, 0,   1, 1, (int []) { 0, 256 } },
187         { "29F002B",    0x3401,  5,  256, 0,   1, 1, (int []) { 0, 256 } },
188         { "29LV002B",   0xc201,  3,  256, 0,   1, 1, (int []) { 0, 256 } },
189         { "29LV200B",   0xbf01,  3,  256, 0,   1, 1, (int []) { 0, 256 } },
190         { "29F200B",    0x5701,  5,  256, 0,   1, 1, (int []) { 0, 256 } },
191         { "29F010",     0x2001,  5,  128, 0,   1, 1, (int []) { 0, 128 } },
192         { "28F010A",    0xa201, 12,  128, 0,   1, 1, (int []) { 0, 128 } },
193         { "28F010",     0xa701, 12,  128, 0,   1, 1, (int []) { 0, 128 } },
194         { "29F100T",    0xd901,  5,   64, 0,   1, 1, (int []) { 0,  64 } },
195         { "29F100B",    0xdf01,  5,   64, 0,   1, 1, (int []) { 0,  64 } },
196         { "28F512A",    0xae01, 12,   64, 0,   1, 1, (int []) { 0,  64 } },
197         { "28F512",     0x2501, 12,   64, 0,   1, 1, (int []) { 0,  64 } },
198         { "28F256A",    0x2f01, 12,   32, 0,   1, 1, (int []) { 0,  32 } },
199         { "28F256",     0xa101, 12,   32, 0, 128, 1, (int []) { 0,  32 } },
200
201         /* Atmel */
202         { "AT49BV010",  0x851f,  3,  128, 0, 128, 1, (int []) { 0, 128 } },
203 //Word  { "AT49F1025",  0x851f,  5,  128, 0, 256, 1, (int []) { 0, 128 } },
204         { "AT49x020",   0x0b1f,  5,  256, 0, 128, 1, (int []) { 0, 256 } },
205         { "AT49F040",   0x131f,  5,  512, 0, 128, 1, (int []) { 0, 512 } },
206         { "AT49F010",   0x171f,  5,  128, 0, 128, 1, (int []) { 0, 128 } },
207         { "AT49F080",   0x231f,  5, 1024, 0, 128, 1, (int []) { 0,1024 } },
208         { "AT29C040A",  0xa41f,  5,  512, 1, 256, 4, (int []) { 0, 512 } },
209 //Word  { "AT29C1024",  0x251f,  3,  128, 0, 128, 0, (int []) { 0, 128 } },
210 //Word  { "AT29LV1024", 0x261f,  3,  128, 0, 128, 0, (int []) { 0, 128 } },
211         { "AT49F080T",  0xa71f,  5, 1024, 0, 128, 1, (int []) { 0,1024 } },
212         { "AT29BV010A", 0x351f,  3,  128, 1, 128, 4, (int []) { 0, 128 } },
213         { "AT29BV020",  0xba1f,  3,  256, 1, 256, 4, (int []) { 0, 256 } },
214         { "AT29LV256",  0xbc1f,  3,   32, 1,  64, 4, (int []) { 0,  32 } },
215         { "AT29LV512",  0x3d1f,  3,   64, 1, 128, 4, (int []) { 0,  64 } },
216         { "AT29BV040A", 0xc41f,  3,  512, 1, 256, 4, (int []) { 0, 512 } },
217         { "AT29C010A",  0xd51f,  5,  128, 1, 128, 4, (int []) { 0, 128 } },
218         { "AT29C020",   0xda1f,  5,  256, 1, 256, 4, (int []) { 0, 256 } },
219         { "AT29C256",   0xdc1f,  3,   32, 1,  64, 4, (int []) { 0,  32 } },
220         { "AT29C512",   0x5d1f,  5,   64, 1, 128, 4, (int []) { 0,  64 } },
221
222         /* Catalyst */
223         { "CAT28F150T", 0x0431, 12,  192, 1, 128, 3, (int []) { 0, 64,160,168,176,192 } },
224         { "CAT28F150B", 0x8531, 12,  192, 1, 128, 3, (int []) { 0, 16, 24, 32,128, 192 } },
225         { "CAT28F001T", 0x9431, 12,  128, 1, 128, 3, (int []) { 0,112,116,120,128 } },
226         { "CAT28F001B", 0x1531, 12,  128, 1, 128, 3, (int []) { 0,  8, 12, 16,128 } },
227         { "CAT29F002T", 0xb031,  5,  256, 0, 128, 1, (int []) { 0, 64,128,192,224,232,240,256 } },
228         { "CAT29F002B", 0x3431,  5,  256, 0, 128, 1, (int []) { 0, 16, 24, 32, 64,128,192,256 } },
229         { "CAT28F002T", 0x7c31, 12,  256, 1, 128, 3, (int []) { 0,128,224,232,240,256 } },
230         { "CAT28F002B", 0xfd31, 12,  256, 1, 128, 3, (int []) { 0, 16, 24, 32,128,256 } },
231         { "CAT28F020" , 0xbd31, 12,  256, 0,   1, 1, (int []) { 0,256 } },
232 //Word  { "CAT28F102" , 0x5131, 12,  128, 0,   0, 0, (int []) { 0,128 } },
233         { "CAT28F010" , 0xb431, 12,  128, 0,   1, 1, (int []) { 0,128 } },
234         { "CAT28F512" , 0xb831, 12,   64, 0,   1, 1, (int []) { 0, 64 } },
235         
236         { "29F040",     0xa404,  5,  512, 1,   1, 1, (int []) { 0, 64, 128, 192, 256, 320, 384, 448, 512 } }, /* Fujitsu */
237         
238         
239         /* Intel */
240         { "28F010",     0x3489, 12,  128, 0, 128, 1, (int []) { 0,128 } },
241         { "28F020",     0x3d89, 12,  256, 0, 128, 1, (int []) { 0,256 } },
242         { "28F001BX-T", 0x9489, 12,  128, 1, 128, 3, (int []) { 0,112,116,120,128 } },
243         { "28F001BX-B", 0x9589, 12,  128, 1, 128, 3, (int []) { 0,  8, 12, 16,128 } },
244 //Word  { "28F400BX-T", 0x7089, 12,  512, 0, 256, 3, (int []) { 0,128,256,384,480,488,496,512 } },
245 //Word  { "28F400BX-B", 0xF189, 12,  512, 0, 256, 3, (int []) { 0, 16, 24, 32,128,256,384,512 } },
246 //Word  { "28F200-T",   0xF489, 12,  256, 0, 256, 3, (int []) { 0,128,224,232,240,256} },
247 //Word  { "28F200-B",   0x7589, 12,  256, 0, 256, 3, (int []) { 0, 16, 24, 32,128,256 } },
248         { "28F016B3-T", 0xd089,  3, 1024, 0,   1, 3, (int []) { 0, 2048 } },
249         { "28F016B3-B", 0xd189,  3, 1024, 0,   1, 3, (int []) { 0, 2048 } },
250         { "28F008B3-T", 0xd289,  3, 1024, 0,   1, 3, (int []) { 0, 1024 } },
251         { "28F008B3-B", 0xd389,  3, 1024, 0,   1, 3, (int []) { 0, 1024 } },
252         { "28F004B3-T", 0xd489,  3,  512, 0, 128, 3, (int []) { 0,128,256,384,480,488,496,512 } },
253         { "28F004B3-B", 0xd589,  3,  512, 0, 128, 3, (int []) { 0, 16, 24, 32,128,256,384,512 } },
254         { "28F004BX-T", 0xF889, 12,  512, 1, 128, 3, (int []) { 0,128,256,384,480,488,496,512 } },
255         { "28F004BX-B", 0x7989, 12,  512, 1, 128, 3, (int []) { 0, 16, 24, 32,128,256,384,512 } },
256         { "28F002-T",   0x7c89, 12,  256, 1, 128, 3, (int []) { 0,128,224,232,240,256 } },
257         { "28F002-B",   0xfd89, 12,  256, 1, 256, 3, (int []) { 0, 16, 24, 32,128,256 } },
258         { "28F008??",   0xa289, 12, 1024, 1,   1, 3, (int []) { 0, 64,128,192,256,320,384,448,512,576,640,704,768,832,896,960,1024 } },
259         { "28F008SA",   0xa189, 12, 1024, 1,   1, 3, (int []) { 0, 64,128,192,256,320,384,448,512,576,640,704,768,832,896,960,1024 } },
260         { "28F004??",   0xad89,  5,  512, 0,   1, 3, (int []) { 0, 512} },
261         { "28F008??",   0xac89,  5, 1024, 0,   1, 3, (int []) { 0,1024} },
262
263         /* Eon */
264         { "E28F004S5",  0x7f8f,  5,  512, 1,   1, 3, (int []) { 0, 64,128,192,256,320,384,448,512 } },
265         { "EN29F002B",  0x977f,  5,  256, 1,   1, 1, (int []) { 0, 16, 24, 32,128,256 } },
266         { "EN29F002T",  0x927f,  5,  256, 1,   1, 1, (int []) { 0,128,224,232,240,256 } },
267         
268         /* SST */
269         { "28EE011",    0x01bf,  5,  128, 0, 128, 0, (int []) { 0, 128 } },
270         { "28EE040",    0x04bf,  5,  512, 0, 128, 0, (int []) { 0, 512 } },
271         { "29EE010",    0x07bf,  5,  128, 1, 128, 0, (int []) { 0, 128 } },
272         { "29x010",     0x08bf,  3,  128, 0, 128, 0, (int []) { 0, 128 } },
273         { "29EE020",    0x10bf,  5,  256, 0, 128, 0, (int []) { 0, 256 } },
274         { "29x020",     0x92bf,  3,  256, 0, 128, 0, (int []) { 0, 256 } },
275         { "29x512",     0x3dbf,  3,   64, 0, 128, 0, (int []) { 0,  64 } },
276         { "29EE512",    0x5dbf,  5,   64, 0, 128, 0, (int []) { 0,  64 } },
277         { "29x020",     0x92bf,  3,  256, 0, 128, 0, (int []) { 0, 256 } },
278         { "39SF020",    0xb6bf,  5,  256, 1, 1, 0x81, (int []) { 0,4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100,104,108,112,116,120,124,128,132,136,140,144,148,152,156,160,164,168,172,176,180,184,188,192,196,200,204,208,212,216,220,224,228,232,236,240,244,248,252,256 } },
279         { "49LF002A",   0x57bf,  3,  256, 0, 1, 0x81, (int[]) {0,256} },
280         { "49LF003A",   0x1bbf,  3,  384, 0, 1, 0x81, (int[]) {0,384} },
281         { "49LF004A",   0x60bf,  3,  512, 1, 1, 0x09, (int[]) {0, 4, 8, 12, 16, 24,28, 32, 512} },
282         { "49LF008A",   0x5abf,  3, 1024, 0, 1, 0x81, (int[]) {0,1024} },
283         { "49LF020",    0x61bf,  3,  256, 1, 4096, 0, (int[]) {0,256} },
284         { "49LF040",    0x51bf,  3,  512, 1, 4096, 0, (int[]) {0,512} },
285         { "49LF080A",   0x5bbf,  3, 1024, 1, 4096, 0, (int[]) {0,1024} },
286         
287         /* Macronix */
288         { "MX28F1000AP",0x1ac2, 12,  128, 0,   1, 1, (int []) { 0, 16, 32, 48, 64, 80, 96,112,116,120,124,128 } },
289         { "MX28F1000P", 0x91c2, 12,  128, 0,   1, 1, (int []) { 0, 16, 32, 48, 64, 80, 96,112,128 } },
290         { "MX28F1000PC",0xf7c2, 12,  128, 0,   1, 1, (int []) { 0, 16, 32, 48, 64, 80, 96,112,128 } },
291 //id?   { "MX28F1000PPC",0x7fc2,12,  128, 0,   1, 1, (int []) { 0, 16, 32, 48, 64, 80, 96,112,116,120,124,128 } },
292         { "MX29F1610A", 0xfac2,  5, 2048, 1, 128, 0, (int []) { 0, 2048} },
293
294         /* Winbond */
295         { "W29EE011",   0xc1da,  5,  128, 1, 128, 0, (int []) { 0, 128 } },
296         { "W29C020",    0x45da,  5,  256, 1, 128, 0, (int []) { 0, 256 } },
297         { "W29C040/042",0x46da,  5,  512, 1, 256, 0, (int []) { 0, 512 } },
298         { "W29EE512",   0xc8da,  5,   64, 1, 128, 0, (int []) { 0,  64 } },
299         { "W29C101",    0x4fda,  5,  128, 1, 256, 0, (int []) { 0, 128 } },
300         { "W49V002",    0xb0da,  3,  256, 1,   1, 1, (int []) { 0, 64, 128, 192, 224, 232, 240, 256 } },
301         //{ "W49F002",    0x0bda,  5,  256, 1,   1, 1, (int []) { 0, 64, 128, 192, 224, 232, 240, 256 } },
302         { "W49F002U",   0x0bda,  5,  256, 1, 1,0x09, (int []) { 0, 128, 224, 232, 240, 256 } }, /* Winbond */
303
304         /* SGS/Thomson */
305         { "M29F002B(N)T", 0xb020,  5,  256, 0,   1, 0,    (int[]) {0, 64, 128, 256 } },
306         { "M29F002B(N)B", 0x3420,  5,  256, 0,   1, 0,    (int[]) {0, 256 } },
307         { "M50FW040",   0x2c20,  3,  512, 1, 128, 0x0b, (int []) { 0, 64, 128, 192, 256, 320, 384, 448, 512 } },
308
309         { "Pm29F002T",  0x1d9d,  5,  256, 1, 1, 0x1, (int []) { 0,128,224,232,240,256 } },
310         /* default entry */
311         { "Unknown",    0x0000,  0,    0, 0,   0, 0, (int []) { 0 } }
312 };
313