aic94xx_sds.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Aic94xx SAS/SATA driver hardware interface header file.
  4. *
  5. * Copyright (C) 2005 Adaptec, Inc. All rights reserved.
  6. * Copyright (C) 2005 Gilbert Wu <[email protected]>
  7. */
  8. #ifndef _AIC94XX_SDS_H_
  9. #define _AIC94XX_SDS_H_
  10. enum {
  11. FLASH_METHOD_UNKNOWN,
  12. FLASH_METHOD_A,
  13. FLASH_METHOD_B
  14. };
  15. #define FLASH_MANUF_ID_AMD 0x01
  16. #define FLASH_MANUF_ID_ST 0x20
  17. #define FLASH_MANUF_ID_FUJITSU 0x04
  18. #define FLASH_MANUF_ID_MACRONIX 0xC2
  19. #define FLASH_MANUF_ID_INTEL 0x89
  20. #define FLASH_MANUF_ID_UNKNOWN 0xFF
  21. #define FLASH_DEV_ID_AM29LV008BT 0x3E
  22. #define FLASH_DEV_ID_AM29LV800DT 0xDA
  23. #define FLASH_DEV_ID_STM29W800DT 0xD7
  24. #define FLASH_DEV_ID_STM29LV640 0xDE
  25. #define FLASH_DEV_ID_STM29008 0xEA
  26. #define FLASH_DEV_ID_MBM29LV800TE 0xDA
  27. #define FLASH_DEV_ID_MBM29DL800TA 0x4A
  28. #define FLASH_DEV_ID_MBM29LV008TA 0x3E
  29. #define FLASH_DEV_ID_AM29LV640MT 0x7E
  30. #define FLASH_DEV_ID_AM29F800B 0xD6
  31. #define FLASH_DEV_ID_MX29LV800BT 0xDA
  32. #define FLASH_DEV_ID_MX29LV008CT 0xDA
  33. #define FLASH_DEV_ID_I28LV00TAT 0x3E
  34. #define FLASH_DEV_ID_UNKNOWN 0xFF
  35. /* status bit mask values */
  36. #define FLASH_STATUS_BIT_MASK_DQ6 0x40
  37. #define FLASH_STATUS_BIT_MASK_DQ5 0x20
  38. #define FLASH_STATUS_BIT_MASK_DQ2 0x04
  39. /* minimum value in micro seconds needed for checking status */
  40. #define FLASH_STATUS_ERASE_DELAY_COUNT 50
  41. #define FLASH_STATUS_WRITE_DELAY_COUNT 25
  42. #define FLASH_SECTOR_SIZE 0x010000
  43. #define FLASH_SECTOR_SIZE_MASK 0xffff0000
  44. #define FLASH_OK 0x000000
  45. #define FAIL_OPEN_BIOS_FILE 0x000100
  46. #define FAIL_CHECK_PCI_ID 0x000200
  47. #define FAIL_CHECK_SUM 0x000300
  48. #define FAIL_UNKNOWN 0x000400
  49. #define FAIL_VERIFY 0x000500
  50. #define FAIL_RESET_FLASH 0x000600
  51. #define FAIL_FIND_FLASH_ID 0x000700
  52. #define FAIL_ERASE_FLASH 0x000800
  53. #define FAIL_WRITE_FLASH 0x000900
  54. #define FAIL_FILE_SIZE 0x000a00
  55. #define FAIL_PARAMETERS 0x000b00
  56. #define FAIL_OUT_MEMORY 0x000c00
  57. #define FLASH_IN_PROGRESS 0x001000
  58. struct controller_id {
  59. u32 vendor; /* PCI Vendor ID */
  60. u32 device; /* PCI Device ID */
  61. u32 sub_vendor; /* PCI Subvendor ID */
  62. u32 sub_device; /* PCI Subdevice ID */
  63. };
  64. struct image_info {
  65. u32 ImageId; /* Identifies the image */
  66. u32 ImageOffset; /* Offset the beginning of the file */
  67. u32 ImageLength; /* length of the image */
  68. u32 ImageChecksum; /* Image checksum */
  69. u32 ImageVersion; /* Version of the image, could be build number */
  70. };
  71. struct bios_file_header {
  72. u8 signature[32]; /* Signature/Cookie to identify the file */
  73. u32 checksum; /*Entire file checksum with this field zero */
  74. u32 antidote; /* Entire file checksum with this field 0xFFFFFFFF */
  75. struct controller_id contrl_id; /*PCI id to identify the controller */
  76. u32 filelen; /*Length of the entire file*/
  77. u32 chunk_num; /*The chunk/part number for multiple Image files */
  78. u32 total_chunks; /*Total number of chunks/parts in the image file */
  79. u32 num_images; /* Number of images in the file */
  80. u32 build_num; /* Build number of this image */
  81. struct image_info image_header;
  82. };
  83. int asd_verify_flash_seg(struct asd_ha_struct *asd_ha,
  84. const void *src, u32 dest_offset, u32 bytes_to_verify);
  85. int asd_write_flash_seg(struct asd_ha_struct *asd_ha,
  86. const void *src, u32 dest_offset, u32 bytes_to_write);
  87. int asd_chk_write_status(struct asd_ha_struct *asd_ha,
  88. u32 sector_addr, u8 erase_flag);
  89. int asd_check_flash_type(struct asd_ha_struct *asd_ha);
  90. int asd_erase_nv_sector(struct asd_ha_struct *asd_ha,
  91. u32 flash_addr, u32 size);
  92. #endif