diff options
Diffstat (limited to 'drivers/scsi/aacraid')
-rw-r--r-- | drivers/scsi/aacraid/linit.c | 129 |
1 files changed, 129 insertions, 0 deletions
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 6f05d86c7bb3..c2be8380dad5 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c | |||
@@ -533,6 +533,134 @@ static long aac_compat_cfg_ioctl(struct file *file, unsigned cmd, unsigned long | |||
533 | } | 533 | } |
534 | #endif | 534 | #endif |
535 | 535 | ||
536 | static ssize_t aac_show_model(struct class_device *class_dev, | ||
537 | char *buf) | ||
538 | { | ||
539 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; | ||
540 | int len; | ||
541 | |||
542 | len = snprintf(buf, PAGE_SIZE, "%s\n", | ||
543 | aac_drivers[dev->cardtype].model); | ||
544 | return len; | ||
545 | } | ||
546 | |||
547 | static ssize_t aac_show_vendor(struct class_device *class_dev, | ||
548 | char *buf) | ||
549 | { | ||
550 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; | ||
551 | int len; | ||
552 | |||
553 | len = snprintf(buf, PAGE_SIZE, "%s\n", | ||
554 | aac_drivers[dev->cardtype].vname); | ||
555 | return len; | ||
556 | } | ||
557 | |||
558 | static ssize_t aac_show_kernel_version(struct class_device *class_dev, | ||
559 | char *buf) | ||
560 | { | ||
561 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; | ||
562 | int len, tmp; | ||
563 | |||
564 | tmp = le32_to_cpu(dev->adapter_info.kernelrev); | ||
565 | len = snprintf(buf, PAGE_SIZE, "%d.%d-%d[%d]\n", | ||
566 | tmp >> 24, (tmp >> 16) & 0xff, tmp & 0xff, | ||
567 | le32_to_cpu(dev->adapter_info.kernelbuild)); | ||
568 | return len; | ||
569 | } | ||
570 | |||
571 | static ssize_t aac_show_monitor_version(struct class_device *class_dev, | ||
572 | char *buf) | ||
573 | { | ||
574 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; | ||
575 | int len, tmp; | ||
576 | |||
577 | tmp = le32_to_cpu(dev->adapter_info.monitorrev); | ||
578 | len = snprintf(buf, PAGE_SIZE, "%d.%d-%d[%d]\n", | ||
579 | tmp >> 24, (tmp >> 16) & 0xff, tmp & 0xff, | ||
580 | le32_to_cpu(dev->adapter_info.monitorbuild)); | ||
581 | return len; | ||
582 | } | ||
583 | |||
584 | static ssize_t aac_show_bios_version(struct class_device *class_dev, | ||
585 | char *buf) | ||
586 | { | ||
587 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; | ||
588 | int len, tmp; | ||
589 | |||
590 | tmp = le32_to_cpu(dev->adapter_info.biosrev); | ||
591 | len = snprintf(buf, PAGE_SIZE, "%d.%d-%d[%d]\n", | ||
592 | tmp >> 24, (tmp >> 16) & 0xff, tmp & 0xff, | ||
593 | le32_to_cpu(dev->adapter_info.biosbuild)); | ||
594 | return len; | ||
595 | } | ||
596 | |||
597 | static ssize_t aac_show_serial_number(struct class_device *class_dev, | ||
598 | char *buf) | ||
599 | { | ||
600 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; | ||
601 | int len = 0; | ||
602 | |||
603 | if (le32_to_cpu(dev->adapter_info.serial[0]) != 0xBAD0) | ||
604 | len = snprintf(buf, PAGE_SIZE, "%x\n", | ||
605 | le32_to_cpu(dev->adapter_info.serial[0])); | ||
606 | return len; | ||
607 | } | ||
608 | |||
609 | |||
610 | static struct class_device_attribute aac_model = { | ||
611 | .attr = { | ||
612 | .name = "model", | ||
613 | .mode = S_IRUGO, | ||
614 | }, | ||
615 | .show = aac_show_model, | ||
616 | }; | ||
617 | static struct class_device_attribute aac_vendor = { | ||
618 | .attr = { | ||
619 | .name = "vendor", | ||
620 | .mode = S_IRUGO, | ||
621 | }, | ||
622 | .show = aac_show_vendor, | ||
623 | }; | ||
624 | static struct class_device_attribute aac_kernel_version = { | ||
625 | .attr = { | ||
626 | .name = "hba_kernel_version", | ||
627 | .mode = S_IRUGO, | ||
628 | }, | ||
629 | .show = aac_show_kernel_version, | ||
630 | }; | ||
631 | static struct class_device_attribute aac_monitor_version = { | ||
632 | .attr = { | ||
633 | .name = "hba_monitor_version", | ||
634 | .mode = S_IRUGO, | ||
635 | }, | ||
636 | .show = aac_show_monitor_version, | ||
637 | }; | ||
638 | static struct class_device_attribute aac_bios_version = { | ||
639 | .attr = { | ||
640 | .name = "hba_bios_version", | ||
641 | .mode = S_IRUGO, | ||
642 | }, | ||
643 | .show = aac_show_bios_version, | ||
644 | }; | ||
645 | static struct class_device_attribute aac_serial_number = { | ||
646 | .attr = { | ||
647 | .name = "serial_number", | ||
648 | .mode = S_IRUGO, | ||
649 | }, | ||
650 | .show = aac_show_serial_number, | ||
651 | }; | ||
652 | |||
653 | static struct class_device_attribute *aac_attrs[] = { | ||
654 | &aac_model, | ||
655 | &aac_vendor, | ||
656 | &aac_kernel_version, | ||
657 | &aac_monitor_version, | ||
658 | &aac_bios_version, | ||
659 | &aac_serial_number, | ||
660 | NULL | ||
661 | }; | ||
662 | |||
663 | |||
536 | static struct file_operations aac_cfg_fops = { | 664 | static struct file_operations aac_cfg_fops = { |
537 | .owner = THIS_MODULE, | 665 | .owner = THIS_MODULE, |
538 | .ioctl = aac_cfg_ioctl, | 666 | .ioctl = aac_cfg_ioctl, |
@@ -553,6 +681,7 @@ static struct scsi_host_template aac_driver_template = { | |||
553 | #endif | 681 | #endif |
554 | .queuecommand = aac_queuecommand, | 682 | .queuecommand = aac_queuecommand, |
555 | .bios_param = aac_biosparm, | 683 | .bios_param = aac_biosparm, |
684 | .shost_attrs = aac_attrs, | ||
556 | .slave_configure = aac_slave_configure, | 685 | .slave_configure = aac_slave_configure, |
557 | .eh_abort_handler = aac_eh_abort, | 686 | .eh_abort_handler = aac_eh_abort, |
558 | .eh_host_reset_handler = aac_eh_reset, | 687 | .eh_host_reset_handler = aac_eh_reset, |