Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / openbios / utils / devbios / flashchips.h
1 /*
2  *                     OpenBIOS - free your system! 
3  *              ( firmware/flash device driver for Linux )
4  *                          
5  *  flashchips.h - flash device structures.
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
27 /*
28  *   flags structure
29  *   bit 0 = needs erase before write (f_needs_erase)
30  *   bit 1-3 flash manu type
31  *   bit 4-6 probably needed for more manu
32  *   bit 7 = sector erase happens one sector at a time
33  *           (f_slow_sector_erase)
34  */
35
36 #define f_needs_erase   0x01
37
38 /* 3 bit for flashtype */
39 #define f_manuf_compl   0x0e /* Mask out bits 1-3 */
40 #define f_intel_compl   0x02 /* 001 */
41 #define f_atmel_compl   0x04 /* 010 */
42 #define f_fwh_compl     0x08 /* 100 */
43
44 #define f_slow_sector_erase 0x80
45
46 #define FLASH_UNKNOWN   0
47 #define FLASH_CFI       1
48 #define FLASH_JEDEC     2
49
50 typedef struct flashdevice {
51         unsigned long   mapped;
52         unsigned long   physical;
53         unsigned long   offset;
54         unsigned int    flashnum, manufnum;
55         unsigned short  id;
56         unsigned int    size, sectors;
57         unsigned int    idx;
58         void            *data;
59         int             open_mode, open_cnt;
60 } flashdevice_t;
61
62 typedef struct flashchip {
63         char            *name;
64         unsigned short  id;
65         unsigned int    voltage;
66         unsigned int    size;           /* KBytes */
67         unsigned int    supported;
68         unsigned int    pagesize;       /* Bytes */
69         unsigned int    flags;
70         unsigned int    *sectors;       /* Kbytes[] including end of last sector */
71 } flashchip_t;
72
73 typedef struct manufacturer {
74         char            *name;
75         unsigned short  id;
76 } manufacturer_t;
77
78 extern unsigned int currflash;
79 extern flashdevice_t  flashdevices[BIOS_MAXDEV];
80 extern const flashchip_t flashchips[];
81 extern const manufacturer_t manufacturers[];