aic94xx_sds.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. enum {
  29. FLASH_METHOD_UNKNOWN,
  30. FLASH_METHOD_A,
  31. FLASH_METHOD_B
  32. };
  33. #define FLASH_MANUF_ID_AMD 0x01
  34. #define FLASH_MANUF_ID_ST 0x20
  35. #define FLASH_MANUF_ID_FUJITSU 0x04
  36. #define FLASH_MANUF_ID_MACRONIX 0xC2
  37. #define FLASH_MANUF_ID_INTEL 0x89
  38. #define FLASH_MANUF_ID_UNKNOWN 0xFF
  39. #define FLASH_DEV_ID_AM29LV008BT 0x3E
  40. #define FLASH_DEV_ID_AM29LV800DT 0xDA
  41. #define FLASH_DEV_ID_STM29W800DT 0xD7
  42. #define FLASH_DEV_ID_STM29LV640 0xDE
  43. #define FLASH_DEV_ID_STM29008 0xEA
  44. #define FLASH_DEV_ID_MBM29LV800TE 0xDA
  45. #define FLASH_DEV_ID_MBM29DL800TA 0x4A
  46. #define FLASH_DEV_ID_MBM29LV008TA 0x3E
  47. #define FLASH_DEV_ID_AM29LV640MT 0x7E
  48. #define FLASH_DEV_ID_AM29F800B 0xD6
  49. #define FLASH_DEV_ID_MX29LV800BT 0xDA
  50. #define FLASH_DEV_ID_MX29LV008CT 0xDA
  51. #define FLASH_DEV_ID_I28LV00TAT 0x3E
  52. #define FLASH_DEV_ID_UNKNOWN 0xFF
  53. /* status bit mask values */
  54. #define FLASH_STATUS_BIT_MASK_DQ6 0x40
  55. #define FLASH_STATUS_BIT_MASK_DQ5 0x20
  56. #define FLASH_STATUS_BIT_MASK_DQ2 0x04
  57. /* minimum value in micro seconds needed for checking status */
  58. #define FLASH_STATUS_ERASE_DELAY_COUNT 50
  59. #define FLASH_STATUS_WRITE_DELAY_COUNT 25
  60. #define FLASH_SECTOR_SIZE 0x010000
  61. #define FLASH_SECTOR_SIZE_MASK 0xffff0000
  62. #define FLASH_OK 0x000000
  63. #define FAIL_OPEN_BIOS_FILE 0x000100
  64. #define FAIL_CHECK_PCI_ID 0x000200
  65. #define FAIL_CHECK_SUM 0x000300
  66. #define FAIL_UNKNOWN 0x000400
  67. #define FAIL_VERIFY 0x000500
  68. #define FAIL_RESET_FLASH 0x000600
  69. #define FAIL_FIND_FLASH_ID 0x000700
  70. #define FAIL_ERASE_FLASH 0x000800
  71. #define FAIL_WRITE_FLASH 0x000900
  72. #define FAIL_FILE_SIZE 0x000a00
  73. #define FAIL_PARAMETERS 0x000b00
  74. #define FAIL_OUT_MEMORY 0x000c00
  75. #define FLASH_IN_PROGRESS 0x001000
  76. struct controller_id {
  77. u32 vendor; /* PCI Vendor ID */
  78. u32 device; /* PCI Device ID */
  79. u32 sub_vendor; /* PCI Subvendor ID */
  80. u32 sub_device; /* PCI Subdevice ID */
  81. };
  82. struct image_info {
  83. u32 ImageId; /* Identifies the image */
  84. u32 ImageOffset; /* Offset the beginning of the file */
  85. u32 ImageLength; /* length of the image */
  86. u32 ImageChecksum; /* Image checksum */
  87. u32 ImageVersion; /* Version of the image, could be build number */
  88. };
  89. struct bios_file_header {
  90. u8 signature[32]; /* Signature/Cookie to identify the file */
  91. u32 checksum; /*Entire file checksum with this field zero */
  92. u32 antidote; /* Entire file checksum with this field 0xFFFFFFFF */
  93. struct controller_id contrl_id; /*PCI id to identify the controller */
  94. u32 filelen; /*Length of the entire file*/
  95. u32 chunk_num; /*The chunk/part number for multiple Image files */
  96. u32 total_chunks; /*Total number of chunks/parts in the image file */
  97. u32 num_images; /* Number of images in the file */
  98. u32 build_num; /* Build number of this image */
  99. struct image_info image_header;
  100. };
  101. int asd_verify_flash_seg(struct asd_ha_struct *asd_ha,
  102. const void *src, u32 dest_offset, u32 bytes_to_verify);
  103. int asd_write_flash_seg(struct asd_ha_struct *asd_ha,
  104. const void *src, u32 dest_offset, u32 bytes_to_write);
  105. int asd_chk_write_status(struct asd_ha_struct *asd_ha,
  106. u32 sector_addr, u8 erase_flag);
  107. int asd_check_flash_type(struct asd_ha_struct *asd_ha);
  108. int asd_erase_nv_sector(struct asd_ha_struct *asd_ha,
  109. u32 flash_addr, u32 size);
  110. #endif