162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Aic94xx SAS/SATA driver hardware interface header file. 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright (C) 2005 Adaptec, Inc. All rights reserved. 662306a36Sopenharmony_ci * Copyright (C) 2005 Gilbert Wu <gilbert_wu@adaptec.com> 762306a36Sopenharmony_ci */ 862306a36Sopenharmony_ci#ifndef _AIC94XX_SDS_H_ 962306a36Sopenharmony_ci#define _AIC94XX_SDS_H_ 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_cienum { 1262306a36Sopenharmony_ci FLASH_METHOD_UNKNOWN, 1362306a36Sopenharmony_ci FLASH_METHOD_A, 1462306a36Sopenharmony_ci FLASH_METHOD_B 1562306a36Sopenharmony_ci}; 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_ci#define FLASH_MANUF_ID_AMD 0x01 1862306a36Sopenharmony_ci#define FLASH_MANUF_ID_ST 0x20 1962306a36Sopenharmony_ci#define FLASH_MANUF_ID_FUJITSU 0x04 2062306a36Sopenharmony_ci#define FLASH_MANUF_ID_MACRONIX 0xC2 2162306a36Sopenharmony_ci#define FLASH_MANUF_ID_INTEL 0x89 2262306a36Sopenharmony_ci#define FLASH_MANUF_ID_UNKNOWN 0xFF 2362306a36Sopenharmony_ci 2462306a36Sopenharmony_ci#define FLASH_DEV_ID_AM29LV008BT 0x3E 2562306a36Sopenharmony_ci#define FLASH_DEV_ID_AM29LV800DT 0xDA 2662306a36Sopenharmony_ci#define FLASH_DEV_ID_STM29W800DT 0xD7 2762306a36Sopenharmony_ci#define FLASH_DEV_ID_STM29LV640 0xDE 2862306a36Sopenharmony_ci#define FLASH_DEV_ID_STM29008 0xEA 2962306a36Sopenharmony_ci#define FLASH_DEV_ID_MBM29LV800TE 0xDA 3062306a36Sopenharmony_ci#define FLASH_DEV_ID_MBM29DL800TA 0x4A 3162306a36Sopenharmony_ci#define FLASH_DEV_ID_MBM29LV008TA 0x3E 3262306a36Sopenharmony_ci#define FLASH_DEV_ID_AM29LV640MT 0x7E 3362306a36Sopenharmony_ci#define FLASH_DEV_ID_AM29F800B 0xD6 3462306a36Sopenharmony_ci#define FLASH_DEV_ID_MX29LV800BT 0xDA 3562306a36Sopenharmony_ci#define FLASH_DEV_ID_MX29LV008CT 0xDA 3662306a36Sopenharmony_ci#define FLASH_DEV_ID_I28LV00TAT 0x3E 3762306a36Sopenharmony_ci#define FLASH_DEV_ID_UNKNOWN 0xFF 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci/* status bit mask values */ 4062306a36Sopenharmony_ci#define FLASH_STATUS_BIT_MASK_DQ6 0x40 4162306a36Sopenharmony_ci#define FLASH_STATUS_BIT_MASK_DQ5 0x20 4262306a36Sopenharmony_ci#define FLASH_STATUS_BIT_MASK_DQ2 0x04 4362306a36Sopenharmony_ci 4462306a36Sopenharmony_ci/* minimum value in micro seconds needed for checking status */ 4562306a36Sopenharmony_ci#define FLASH_STATUS_ERASE_DELAY_COUNT 50 4662306a36Sopenharmony_ci#define FLASH_STATUS_WRITE_DELAY_COUNT 25 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_ci#define FLASH_SECTOR_SIZE 0x010000 4962306a36Sopenharmony_ci#define FLASH_SECTOR_SIZE_MASK 0xffff0000 5062306a36Sopenharmony_ci 5162306a36Sopenharmony_ci#define FLASH_OK 0x000000 5262306a36Sopenharmony_ci#define FAIL_OPEN_BIOS_FILE 0x000100 5362306a36Sopenharmony_ci#define FAIL_CHECK_PCI_ID 0x000200 5462306a36Sopenharmony_ci#define FAIL_CHECK_SUM 0x000300 5562306a36Sopenharmony_ci#define FAIL_UNKNOWN 0x000400 5662306a36Sopenharmony_ci#define FAIL_VERIFY 0x000500 5762306a36Sopenharmony_ci#define FAIL_RESET_FLASH 0x000600 5862306a36Sopenharmony_ci#define FAIL_FIND_FLASH_ID 0x000700 5962306a36Sopenharmony_ci#define FAIL_ERASE_FLASH 0x000800 6062306a36Sopenharmony_ci#define FAIL_WRITE_FLASH 0x000900 6162306a36Sopenharmony_ci#define FAIL_FILE_SIZE 0x000a00 6262306a36Sopenharmony_ci#define FAIL_PARAMETERS 0x000b00 6362306a36Sopenharmony_ci#define FAIL_OUT_MEMORY 0x000c00 6462306a36Sopenharmony_ci#define FLASH_IN_PROGRESS 0x001000 6562306a36Sopenharmony_ci 6662306a36Sopenharmony_cistruct controller_id { 6762306a36Sopenharmony_ci u32 vendor; /* PCI Vendor ID */ 6862306a36Sopenharmony_ci u32 device; /* PCI Device ID */ 6962306a36Sopenharmony_ci u32 sub_vendor; /* PCI Subvendor ID */ 7062306a36Sopenharmony_ci u32 sub_device; /* PCI Subdevice ID */ 7162306a36Sopenharmony_ci}; 7262306a36Sopenharmony_ci 7362306a36Sopenharmony_cistruct image_info { 7462306a36Sopenharmony_ci u32 ImageId; /* Identifies the image */ 7562306a36Sopenharmony_ci u32 ImageOffset; /* Offset the beginning of the file */ 7662306a36Sopenharmony_ci u32 ImageLength; /* length of the image */ 7762306a36Sopenharmony_ci u32 ImageChecksum; /* Image checksum */ 7862306a36Sopenharmony_ci u32 ImageVersion; /* Version of the image, could be build number */ 7962306a36Sopenharmony_ci}; 8062306a36Sopenharmony_ci 8162306a36Sopenharmony_cistruct bios_file_header { 8262306a36Sopenharmony_ci u8 signature[32]; /* Signature/Cookie to identify the file */ 8362306a36Sopenharmony_ci u32 checksum; /*Entire file checksum with this field zero */ 8462306a36Sopenharmony_ci u32 antidote; /* Entire file checksum with this field 0xFFFFFFFF */ 8562306a36Sopenharmony_ci struct controller_id contrl_id; /*PCI id to identify the controller */ 8662306a36Sopenharmony_ci u32 filelen; /*Length of the entire file*/ 8762306a36Sopenharmony_ci u32 chunk_num; /*The chunk/part number for multiple Image files */ 8862306a36Sopenharmony_ci u32 total_chunks; /*Total number of chunks/parts in the image file */ 8962306a36Sopenharmony_ci u32 num_images; /* Number of images in the file */ 9062306a36Sopenharmony_ci u32 build_num; /* Build number of this image */ 9162306a36Sopenharmony_ci struct image_info image_header; 9262306a36Sopenharmony_ci}; 9362306a36Sopenharmony_ci 9462306a36Sopenharmony_ciint asd_verify_flash_seg(struct asd_ha_struct *asd_ha, 9562306a36Sopenharmony_ci const void *src, u32 dest_offset, u32 bytes_to_verify); 9662306a36Sopenharmony_ciint asd_write_flash_seg(struct asd_ha_struct *asd_ha, 9762306a36Sopenharmony_ci const void *src, u32 dest_offset, u32 bytes_to_write); 9862306a36Sopenharmony_ciint asd_chk_write_status(struct asd_ha_struct *asd_ha, 9962306a36Sopenharmony_ci u32 sector_addr, u8 erase_flag); 10062306a36Sopenharmony_ciint asd_check_flash_type(struct asd_ha_struct *asd_ha); 10162306a36Sopenharmony_ciint asd_erase_nv_sector(struct asd_ha_struct *asd_ha, 10262306a36Sopenharmony_ci u32 flash_addr, u32 size); 10362306a36Sopenharmony_ci#endif 104