41 #include <linux/slab.h>
95 static ssize_t pm8001_ctl_max_out_io_show(
struct device *cdev,
113 static ssize_t pm8001_ctl_max_devices_show(
struct device *cdev,
132 static ssize_t pm8001_ctl_max_sg_list_show(
struct device *cdev,
149 show_sas_spec_support_status(
unsigned int mode,
char *buf)
154 len =
sprintf(buf,
"%s",
"SAS1.1");
156 len +=
sprintf(buf + len,
"%s%s", len ?
", " :
"",
"SAS2.0");
157 len +=
sprintf(buf + len,
"\n");
169 static ssize_t pm8001_ctl_sas_spec_support_show(
struct device *cdev,
176 mode = (pm8001_ha->
main_cfg_tbl.ctrl_cap_flag & 0xfe000000)>>25;
177 return show_sas_spec_support_status(mode, buf);
180 pm8001_ctl_sas_spec_support_show,
NULL);
191 static ssize_t pm8001_ctl_host_sas_address_show(
struct device *cdev,
201 pm8001_ctl_host_sas_address_show,
NULL);
210 static ssize_t pm8001_ctl_logging_level_show(
struct device *cdev,
219 static ssize_t pm8001_ctl_logging_level_store(
struct device *cdev,
227 if (
sscanf(buf,
"%x", &val) != 1)
235 pm8001_ctl_logging_level_show, pm8001_ctl_logging_level_store);
250 #define AAP1_MEMMAP(r, c) \
251 (*(u32 *)((u8*)pm8001_ha->memoryMap.region[AAP1].virt_ptr + (r) * 32 \
256 for (i = 0; i <
max; i++) {
257 str +=
sprintf(str,
"0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x"
285 #define IOP_MEMMAP(r, c) \
286 (*(u32 *)((u8*)pm8001_ha->memoryMap.region[IOP].virt_ptr + (r) * 32 \
291 for (i = 0; i <
max; i++) {
292 str +=
sprintf(str,
"0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x"
308 #define FLASH_CMD_NONE 0x00
309 #define FLASH_CMD_UPDATE 0x01
310 #define FLASH_CMD_SET_NVMD 0x02
329 static struct error_fw flash_error_table[] =
354 length = 1024 * 5 +
sizeof(*payload) - 1;
358 if ((pm8001_ha->
fw_image->size <= 0) ||
359 (pm8001_ha->
fw_image->size > 4096)) {
383 u32 loopNumber, loopcount = 0;
385 u32 partitionSize, partitionSizeTmp;
390 length = 1024 * 16 +
sizeof(*payload) - 1;
395 if (pm8001_ha->
fw_image->size < 28) {
400 while (sizeRead < pm8001_ha->
fw_image->size) {
409 for (loopNumber = 0; loopNumber < loopcount; loopNumber++) {
411 payload->
length = 1024*16;
415 fwControl->
len = IOCTL_BUF_SIZE;
418 fwControl->
offset = loopNumber * IOCTL_BUF_SIZE;
422 if (((loopcount-loopNumber) == 1) &&
425 (partitionSize +
HEADER_LEN) % IOCTL_BUF_SIZE;
428 (partitionSize +
HEADER_LEN) % IOCTL_BUF_SIZE);
430 (partitionSize +
HEADER_LEN) % IOCTL_BUF_SIZE;
458 const char *buf,
size_t count)
463 char *cmd_ptr, *filename_ptr;
477 filename_ptr = cmd_ptr +
count;
478 res =
sscanf(buf,
"%s %s", cmd_ptr, filename_ptr);
486 cmd_ptr,
strlen(cmd_ptr))) {
487 flash_command = flash_command_table[
i].
code;
507 " error %d\n", filename_ptr, err));
512 switch (flash_command) {
515 err = pm8001_update_flash(pm8001_ha);
519 err = pm8001_set_nvmd(pm8001_ha);
546 for (i = 0; flash_error_table[
i].
err_code != 0; i++) {
555 flash_error_table[i].
reason);
559 pm8001_show_update_fw, pm8001_store_update_fw);
561 &dev_attr_interface_rev,
562 &dev_attr_fw_version,
566 &dev_attr_max_out_io,
567 &dev_attr_max_devices,
568 &dev_attr_max_sg_list,
569 &dev_attr_sas_spec_support,
570 &dev_attr_logging_level,
571 &dev_attr_host_sas_address,