Add the rt linux 4.1.3-rt3 as base
[kvmfornfv.git] / kernel / drivers / scsi / aic94xx / aic94xx_sds.h
1 /*
2  * Aic94xx SAS/SATA driver hardware interface header file.
3  *
4  * Copyright (C) 2005 Adaptec, Inc.  All rights reserved.
5  * Copyright (C) 2005 Gilbert Wu <gilbert_wu@adaptec.com>
6  *
7  * This file is licensed under GPLv2.
8  *
9  * This file is part of the aic94xx driver.
10  *
11  * The aic94xx driver is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License as
13  * published by the Free Software Foundation; version 2 of the
14  * License.
15  *
16  * The aic94xx driver 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 GNU
19  * General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with the aic94xx driver; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
24  *
25  */
26 #ifndef _AIC94XX_SDS_H_
27 #define _AIC94XX_SDS_H_
28
29 enum {
30         FLASH_METHOD_UNKNOWN,
31         FLASH_METHOD_A,
32         FLASH_METHOD_B
33 };
34
35 #define FLASH_MANUF_ID_AMD              0x01
36 #define FLASH_MANUF_ID_ST               0x20
37 #define FLASH_MANUF_ID_FUJITSU          0x04
38 #define FLASH_MANUF_ID_MACRONIX         0xC2
39 #define FLASH_MANUF_ID_INTEL            0x89
40 #define FLASH_MANUF_ID_UNKNOWN          0xFF
41
42 #define FLASH_DEV_ID_AM29LV008BT        0x3E
43 #define FLASH_DEV_ID_AM29LV800DT        0xDA
44 #define FLASH_DEV_ID_STM29W800DT        0xD7
45 #define FLASH_DEV_ID_STM29LV640         0xDE
46 #define FLASH_DEV_ID_STM29008           0xEA
47 #define FLASH_DEV_ID_MBM29LV800TE       0xDA
48 #define FLASH_DEV_ID_MBM29DL800TA       0x4A
49 #define FLASH_DEV_ID_MBM29LV008TA       0x3E
50 #define FLASH_DEV_ID_AM29LV640MT        0x7E
51 #define FLASH_DEV_ID_AM29F800B          0xD6
52 #define FLASH_DEV_ID_MX29LV800BT        0xDA
53 #define FLASH_DEV_ID_MX29LV008CT        0xDA
54 #define FLASH_DEV_ID_I28LV00TAT         0x3E
55 #define FLASH_DEV_ID_UNKNOWN            0xFF
56
57 /* status bit mask values */
58 #define FLASH_STATUS_BIT_MASK_DQ6       0x40
59 #define FLASH_STATUS_BIT_MASK_DQ5       0x20
60 #define FLASH_STATUS_BIT_MASK_DQ2       0x04
61
62 /* minimum value in micro seconds needed for checking status */
63 #define FLASH_STATUS_ERASE_DELAY_COUNT  50
64 #define FLASH_STATUS_WRITE_DELAY_COUNT  25
65
66 #define FLASH_SECTOR_SIZE               0x010000
67 #define FLASH_SECTOR_SIZE_MASK          0xffff0000
68
69 #define FLASH_OK                        0x000000
70 #define FAIL_OPEN_BIOS_FILE             0x000100
71 #define FAIL_CHECK_PCI_ID               0x000200
72 #define FAIL_CHECK_SUM                  0x000300
73 #define FAIL_UNKNOWN                    0x000400
74 #define FAIL_VERIFY                     0x000500
75 #define FAIL_RESET_FLASH                0x000600
76 #define FAIL_FIND_FLASH_ID              0x000700
77 #define FAIL_ERASE_FLASH                0x000800
78 #define FAIL_WRITE_FLASH                0x000900
79 #define FAIL_FILE_SIZE                  0x000a00
80 #define FAIL_PARAMETERS                 0x000b00
81 #define FAIL_OUT_MEMORY                 0x000c00
82 #define FLASH_IN_PROGRESS               0x001000
83
84 struct controller_id {
85         u32 vendor;     /* PCI Vendor ID */
86         u32 device;     /* PCI Device ID */
87         u32 sub_vendor; /* PCI Subvendor ID */
88         u32 sub_device; /* PCI Subdevice ID */
89 };
90
91 struct image_info {
92         u32 ImageId;       /* Identifies the image */
93         u32 ImageOffset;   /* Offset the beginning of the file */
94         u32 ImageLength;   /* length of the image */
95         u32 ImageChecksum; /* Image checksum */
96         u32 ImageVersion;  /* Version of the image, could be build number */
97 };
98
99 struct bios_file_header {
100         u8 signature[32]; /* Signature/Cookie to identify the file */
101         u32 checksum;     /*Entire file checksum with this field zero */
102         u32 antidote;     /* Entire file checksum with this field 0xFFFFFFFF */
103         struct controller_id contrl_id; /*PCI id to identify the controller */
104         u32 filelen;      /*Length of the entire file*/
105         u32 chunk_num;    /*The chunk/part number for multiple Image files */
106         u32 total_chunks; /*Total number of chunks/parts in the image file */
107         u32 num_images;   /* Number of images in the file */
108         u32 build_num;    /* Build number of this image */
109         struct image_info image_header;
110 };
111
112 int asd_verify_flash_seg(struct asd_ha_struct *asd_ha,
113                 const void *src, u32 dest_offset, u32 bytes_to_verify);
114 int asd_write_flash_seg(struct asd_ha_struct *asd_ha,
115                 const void *src, u32 dest_offset, u32 bytes_to_write);
116 int asd_chk_write_status(struct asd_ha_struct *asd_ha,
117                 u32 sector_addr, u8 erase_flag);
118 int asd_check_flash_type(struct asd_ha_struct *asd_ha);
119 int asd_erase_nv_sector(struct asd_ha_struct *asd_ha,
120                 u32 flash_addr, u32 size);
121 #endif