drivers/scsi/pm8001/pm80xx_hwi.c

Source file repositories/reference/linux-study-clean/drivers/scsi/pm8001/pm80xx_hwi.c

File Facts

System
Linux kernel
Corpus path
drivers/scsi/pm8001/pm80xx_hwi.c
Extension
.c
Size
165537 bytes
Lines
5007
Domain
Driver Families
Bucket
drivers/scsi
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (offset < (64 * 1024)) {
			value = pm8001_cr32(pm8001_ha, bus_base_number, offset);
			*destination = cpu_to_le32(value);
		}
	}
	return;
}

ssize_t pm80xx_get_fatal_dump(struct device *cdev,
	struct device_attribute *attr, char *buf)
{
	struct Scsi_Host *shost = class_to_shost(cdev);
	struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
	struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
	void __iomem *fatal_table_address = pm8001_ha->fatal_tbl_addr;
	u32 accum_len, reg_val, index, *temp;
	u32 status = 1;
	unsigned long start;
	u8 *direct_data;
	char *fatal_error_data = buf;
	u32 length_to_read;
	u32 offset;

	pm8001_ha->forensic_info.data_buf.direct_data = buf;
	if (pm8001_ha->chip_id == chip_8001) {
		pm8001_ha->forensic_info.data_buf.direct_data +=
			sprintf(pm8001_ha->forensic_info.data_buf.direct_data,
			"Not supported for SPC controller");
		return (char *)pm8001_ha->forensic_info.data_buf.direct_data -
			(char *)buf;
	}
	/* initialize variables for very first call from host application */
	if (pm8001_ha->forensic_info.data_buf.direct_offset == 0) {
		pm8001_dbg(pm8001_ha, IO,
			   "forensic_info TYPE_NON_FATAL..............\n");
		direct_data = (u8 *)fatal_error_data;
		pm8001_ha->forensic_info.data_type = TYPE_NON_FATAL;
		pm8001_ha->forensic_info.data_buf.direct_len = SYSFS_OFFSET;
		pm8001_ha->forensic_info.data_buf.direct_offset = 0;
		pm8001_ha->forensic_info.data_buf.read_len = 0;
		pm8001_ha->forensic_preserved_accumulated_transfer = 0;

		/* Write signature to fatal dump table */
		pm8001_mw32(fatal_table_address,
				MPI_FATAL_EDUMP_TABLE_SIGNATURE, 0x1234abcd);

		pm8001_ha->forensic_info.data_buf.direct_data = direct_data;
		pm8001_dbg(pm8001_ha, IO, "ossaHwCB: status1 %d\n", status);
		pm8001_dbg(pm8001_ha, IO, "ossaHwCB: read_len 0x%x\n",
			   pm8001_ha->forensic_info.data_buf.read_len);
		pm8001_dbg(pm8001_ha, IO, "ossaHwCB: direct_len 0x%x\n",
			   pm8001_ha->forensic_info.data_buf.direct_len);
		pm8001_dbg(pm8001_ha, IO, "ossaHwCB: direct_offset 0x%x\n",
			   pm8001_ha->forensic_info.data_buf.direct_offset);
	}
	if (pm8001_ha->forensic_info.data_buf.direct_offset == 0) {
		/* start to get data */
		/* Program the MEMBASE II Shifting Register with 0x00.*/
		pm8001_cw32(pm8001_ha, 0, MEMBASE_II_SHIFT_REGISTER,
				pm8001_ha->fatal_forensic_shift_offset);
		pm8001_ha->forensic_last_offset = 0;
		pm8001_ha->forensic_fatal_step = 0;
		pm8001_ha->fatal_bar_loc = 0;
	}

	/* Read until accum_len is retrieved */
	accum_len = pm8001_mr32(fatal_table_address,
				MPI_FATAL_EDUMP_TABLE_ACCUM_LEN);
	/* Determine length of data between previously stored transfer length
	 * and current accumulated transfer length
	 */
	length_to_read =
		accum_len - pm8001_ha->forensic_preserved_accumulated_transfer;
	pm8001_dbg(pm8001_ha, IO, "get_fatal_spcv: accum_len 0x%x\n",
		   accum_len);
	pm8001_dbg(pm8001_ha, IO, "get_fatal_spcv: length_to_read 0x%x\n",
		   length_to_read);
	pm8001_dbg(pm8001_ha, IO, "get_fatal_spcv: last_offset 0x%x\n",
		   pm8001_ha->forensic_last_offset);
	pm8001_dbg(pm8001_ha, IO, "get_fatal_spcv: read_len 0x%x\n",
		   pm8001_ha->forensic_info.data_buf.read_len);
	pm8001_dbg(pm8001_ha, IO, "get_fatal_spcv:: direct_len 0x%x\n",
		   pm8001_ha->forensic_info.data_buf.direct_len);
	pm8001_dbg(pm8001_ha, IO, "get_fatal_spcv:: direct_offset 0x%x\n",
		   pm8001_ha->forensic_info.data_buf.direct_offset);

	/* If accumulated length failed to read correctly fail the attempt.*/
	if (accum_len == 0xFFFFFFFF) {
		pm8001_dbg(pm8001_ha, IO,
			   "Possible PCI issue 0x%x not expected\n",

Annotation

Implementation Notes