Erich Chen | 1c57e86 | 2006-07-12 08:59:32 -0700 | [diff] [blame] | 1 | /* |
| 2 | ******************************************************************************* |
| 3 | ** O.S : Linux |
| 4 | ** FILE NAME : arcmsr_attr.c |
| 5 | ** BY : Erich Chen |
| 6 | ** Description: attributes exported to sysfs and device host |
| 7 | ******************************************************************************* |
| 8 | ** Copyright (C) 2002 - 2005, Areca Technology Corporation All rights reserved |
| 9 | ** |
| 10 | ** Web site: www.areca.com.tw |
Nick Cheng | 1a4f550 | 2007-09-13 17:26:40 +0800 | [diff] [blame^] | 11 | ** E-mail: support@areca.com.tw |
Erich Chen | 1c57e86 | 2006-07-12 08:59:32 -0700 | [diff] [blame] | 12 | ** |
| 13 | ** This program is free software; you can redistribute it and/or modify |
| 14 | ** it under the terms of the GNU General Public License version 2 as |
| 15 | ** published by the Free Software Foundation. |
| 16 | ** This program is distributed in the hope that it will be useful, |
| 17 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | ** GNU General Public License for more details. |
| 20 | ******************************************************************************* |
| 21 | ** Redistribution and use in source and binary forms, with or without |
| 22 | ** modification, are permitted provided that the following conditions |
| 23 | ** are met: |
| 24 | ** 1. Redistributions of source code must retain the above copyright |
| 25 | ** notice, this list of conditions and the following disclaimer. |
| 26 | ** 2. Redistributions in binary form must reproduce the above copyright |
| 27 | ** notice, this list of conditions and the following disclaimer in the |
| 28 | ** documentation and/or other materials provided with the distribution. |
| 29 | ** 3. The name of the author may not be used to endorse or promote products |
| 30 | ** derived from this software without specific prior written permission. |
| 31 | ** |
| 32 | ** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| 33 | ** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| 34 | ** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 35 | ** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 36 | ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING,BUT |
| 37 | ** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 38 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION)HOWEVER CAUSED AND ON ANY |
| 39 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 40 | ** (INCLUDING NEGLIGENCE OR OTHERWISE)ARISING IN ANY WAY OUT OF THE USE OF |
| 41 | ** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 42 | ******************************************************************************* |
| 43 | ** For history of changes, see Documentation/scsi/ChangeLog.arcmsr |
| 44 | ** Firmware Specification, see Documentation/scsi/arcmsr_spec.txt |
| 45 | ******************************************************************************* |
| 46 | */ |
| 47 | #include <linux/module.h> |
| 48 | #include <linux/kernel.h> |
| 49 | #include <linux/init.h> |
| 50 | #include <linux/errno.h> |
| 51 | #include <linux/delay.h> |
Nick Cheng | 1a4f550 | 2007-09-13 17:26:40 +0800 | [diff] [blame^] | 52 | #include <linux/pci.h> |
Erich Chen | 1c57e86 | 2006-07-12 08:59:32 -0700 | [diff] [blame] | 53 | |
| 54 | #include <scsi/scsi_cmnd.h> |
| 55 | #include <scsi/scsi_device.h> |
| 56 | #include <scsi/scsi_host.h> |
| 57 | #include <scsi/scsi_transport.h> |
| 58 | #include "arcmsr.h" |
| 59 | |
| 60 | struct class_device_attribute *arcmsr_host_attrs[]; |
| 61 | |
Nick Cheng | 1a4f550 | 2007-09-13 17:26:40 +0800 | [diff] [blame^] | 62 | static ssize_t arcmsr_sysfs_iop_message_read(struct kobject *kobj, char *buf, loff_t off, size_t count) |
Erich Chen | 1c57e86 | 2006-07-12 08:59:32 -0700 | [diff] [blame] | 63 | { |
| 64 | struct class_device *cdev = container_of(kobj,struct class_device,kobj); |
| 65 | struct Scsi_Host *host = class_to_shost(cdev); |
| 66 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; |
Erich Chen | 1c57e86 | 2006-07-12 08:59:32 -0700 | [diff] [blame] | 67 | uint8_t *pQbuffer,*ptmpQbuffer; |
| 68 | int32_t allxfer_len = 0; |
| 69 | |
| 70 | if (!capable(CAP_SYS_ADMIN)) |
| 71 | return -EACCES; |
| 72 | |
| 73 | /* do message unit read. */ |
| 74 | ptmpQbuffer = (uint8_t *)buf; |
| 75 | while ((acb->rqbuf_firstindex != acb->rqbuf_lastindex) |
| 76 | && (allxfer_len < 1031)) { |
| 77 | pQbuffer = &acb->rqbuffer[acb->rqbuf_firstindex]; |
| 78 | memcpy(ptmpQbuffer, pQbuffer, 1); |
| 79 | acb->rqbuf_firstindex++; |
| 80 | acb->rqbuf_firstindex %= ARCMSR_MAX_QBUFFER; |
| 81 | ptmpQbuffer++; |
| 82 | allxfer_len++; |
| 83 | } |
| 84 | if (acb->acb_flags & ACB_F_IOPDATA_OVERFLOW) { |
Nick Cheng | 1a4f550 | 2007-09-13 17:26:40 +0800 | [diff] [blame^] | 85 | struct QBUFFER *prbuffer; |
| 86 | uint8_t *iop_data; |
Erich Chen | 1c57e86 | 2006-07-12 08:59:32 -0700 | [diff] [blame] | 87 | int32_t iop_len; |
| 88 | |
| 89 | acb->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW; |
Nick Cheng | 1a4f550 | 2007-09-13 17:26:40 +0800 | [diff] [blame^] | 90 | prbuffer = arcmsr_get_iop_rqbuffer(acb); |
| 91 | iop_data = (uint8_t *)prbuffer->data; |
Erich Chen | 1c57e86 | 2006-07-12 08:59:32 -0700 | [diff] [blame] | 92 | iop_len = readl(&prbuffer->data_len); |
| 93 | while (iop_len > 0) { |
| 94 | acb->rqbuffer[acb->rqbuf_lastindex] = readb(iop_data); |
| 95 | acb->rqbuf_lastindex++; |
| 96 | acb->rqbuf_lastindex %= ARCMSR_MAX_QBUFFER; |
| 97 | iop_data++; |
| 98 | iop_len--; |
| 99 | } |
Nick Cheng | 1a4f550 | 2007-09-13 17:26:40 +0800 | [diff] [blame^] | 100 | arcmsr_iop_message_read(acb); |
Erich Chen | 1c57e86 | 2006-07-12 08:59:32 -0700 | [diff] [blame] | 101 | } |
| 102 | return (allxfer_len); |
| 103 | } |
| 104 | |
Nick Cheng | 1a4f550 | 2007-09-13 17:26:40 +0800 | [diff] [blame^] | 105 | static ssize_t arcmsr_sysfs_iop_message_write(struct kobject *kobj, char *buf, loff_t off, size_t count) |
Erich Chen | 1c57e86 | 2006-07-12 08:59:32 -0700 | [diff] [blame] | 106 | { |
| 107 | struct class_device *cdev = container_of(kobj,struct class_device,kobj); |
| 108 | struct Scsi_Host *host = class_to_shost(cdev); |
| 109 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; |
| 110 | int32_t my_empty_len, user_len, wqbuf_firstindex, wqbuf_lastindex; |
| 111 | uint8_t *pQbuffer, *ptmpuserbuffer; |
| 112 | |
| 113 | if (!capable(CAP_SYS_ADMIN)) |
| 114 | return -EACCES; |
| 115 | if (count > 1032) |
| 116 | return -EINVAL; |
| 117 | /* do message unit write. */ |
| 118 | ptmpuserbuffer = (uint8_t *)buf; |
| 119 | user_len = (int32_t)count; |
| 120 | wqbuf_lastindex = acb->wqbuf_lastindex; |
| 121 | wqbuf_firstindex = acb->wqbuf_firstindex; |
| 122 | if (wqbuf_lastindex != wqbuf_firstindex) { |
Nick Cheng | 1a4f550 | 2007-09-13 17:26:40 +0800 | [diff] [blame^] | 123 | arcmsr_post_ioctldata2iop(acb); |
Erich Chen | 1c57e86 | 2006-07-12 08:59:32 -0700 | [diff] [blame] | 124 | return 0; /*need retry*/ |
| 125 | } else { |
| 126 | my_empty_len = (wqbuf_firstindex-wqbuf_lastindex - 1) |
| 127 | &(ARCMSR_MAX_QBUFFER - 1); |
| 128 | if (my_empty_len >= user_len) { |
| 129 | while (user_len > 0) { |
| 130 | pQbuffer = |
| 131 | &acb->wqbuffer[acb->wqbuf_lastindex]; |
| 132 | memcpy(pQbuffer, ptmpuserbuffer, 1); |
| 133 | acb->wqbuf_lastindex++; |
| 134 | acb->wqbuf_lastindex %= ARCMSR_MAX_QBUFFER; |
| 135 | ptmpuserbuffer++; |
| 136 | user_len--; |
| 137 | } |
| 138 | if (acb->acb_flags & ACB_F_MESSAGE_WQBUFFER_CLEARED) { |
| 139 | acb->acb_flags &= |
| 140 | ~ACB_F_MESSAGE_WQBUFFER_CLEARED; |
Nick Cheng | 1a4f550 | 2007-09-13 17:26:40 +0800 | [diff] [blame^] | 141 | arcmsr_post_ioctldata2iop(acb); |
Erich Chen | 1c57e86 | 2006-07-12 08:59:32 -0700 | [diff] [blame] | 142 | } |
| 143 | return count; |
| 144 | } else { |
| 145 | return 0; /*need retry*/ |
| 146 | } |
| 147 | } |
| 148 | } |
| 149 | |
Nick Cheng | 1a4f550 | 2007-09-13 17:26:40 +0800 | [diff] [blame^] | 150 | static ssize_t arcmsr_sysfs_iop_message_clear(struct kobject *kobj, char *buf, loff_t off, size_t count) |
Erich Chen | 1c57e86 | 2006-07-12 08:59:32 -0700 | [diff] [blame] | 151 | { |
| 152 | struct class_device *cdev = container_of(kobj,struct class_device,kobj); |
| 153 | struct Scsi_Host *host = class_to_shost(cdev); |
| 154 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; |
Erich Chen | 1c57e86 | 2006-07-12 08:59:32 -0700 | [diff] [blame] | 155 | uint8_t *pQbuffer; |
| 156 | |
| 157 | if (!capable(CAP_SYS_ADMIN)) |
| 158 | return -EACCES; |
| 159 | |
| 160 | if (acb->acb_flags & ACB_F_IOPDATA_OVERFLOW) { |
| 161 | acb->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW; |
Nick Cheng | 1a4f550 | 2007-09-13 17:26:40 +0800 | [diff] [blame^] | 162 | arcmsr_iop_message_read(acb); |
Erich Chen | 1c57e86 | 2006-07-12 08:59:32 -0700 | [diff] [blame] | 163 | } |
| 164 | acb->acb_flags |= |
| 165 | (ACB_F_MESSAGE_WQBUFFER_CLEARED |
| 166 | | ACB_F_MESSAGE_RQBUFFER_CLEARED |
| 167 | | ACB_F_MESSAGE_WQBUFFER_READED); |
| 168 | acb->rqbuf_firstindex = 0; |
| 169 | acb->rqbuf_lastindex = 0; |
| 170 | acb->wqbuf_firstindex = 0; |
| 171 | acb->wqbuf_lastindex = 0; |
| 172 | pQbuffer = acb->rqbuffer; |
| 173 | memset(pQbuffer, 0, sizeof (struct QBUFFER)); |
| 174 | pQbuffer = acb->wqbuffer; |
| 175 | memset(pQbuffer, 0, sizeof (struct QBUFFER)); |
| 176 | return 1; |
| 177 | } |
| 178 | |
| 179 | static struct bin_attribute arcmsr_sysfs_message_read_attr = { |
| 180 | .attr = { |
| 181 | .name = "mu_read", |
| 182 | .mode = S_IRUSR , |
Nick Cheng | 1a4f550 | 2007-09-13 17:26:40 +0800 | [diff] [blame^] | 183 | .owner = THIS_MODULE, |
Erich Chen | 1c57e86 | 2006-07-12 08:59:32 -0700 | [diff] [blame] | 184 | }, |
| 185 | .size = 1032, |
| 186 | .read = arcmsr_sysfs_iop_message_read, |
| 187 | }; |
| 188 | |
| 189 | static struct bin_attribute arcmsr_sysfs_message_write_attr = { |
| 190 | .attr = { |
| 191 | .name = "mu_write", |
| 192 | .mode = S_IWUSR, |
Nick Cheng | 1a4f550 | 2007-09-13 17:26:40 +0800 | [diff] [blame^] | 193 | .owner = THIS_MODULE, |
Erich Chen | 1c57e86 | 2006-07-12 08:59:32 -0700 | [diff] [blame] | 194 | }, |
| 195 | .size = 1032, |
| 196 | .write = arcmsr_sysfs_iop_message_write, |
| 197 | }; |
| 198 | |
| 199 | static struct bin_attribute arcmsr_sysfs_message_clear_attr = { |
| 200 | .attr = { |
| 201 | .name = "mu_clear", |
| 202 | .mode = S_IWUSR, |
Nick Cheng | 1a4f550 | 2007-09-13 17:26:40 +0800 | [diff] [blame^] | 203 | .owner = THIS_MODULE, |
Erich Chen | 1c57e86 | 2006-07-12 08:59:32 -0700 | [diff] [blame] | 204 | }, |
| 205 | .size = 1, |
| 206 | .write = arcmsr_sysfs_iop_message_clear, |
| 207 | }; |
| 208 | |
| 209 | int arcmsr_alloc_sysfs_attr(struct AdapterControlBlock *acb) |
| 210 | { |
| 211 | struct Scsi_Host *host = acb->host; |
| 212 | int error; |
| 213 | |
Nick Cheng | 1a4f550 | 2007-09-13 17:26:40 +0800 | [diff] [blame^] | 214 | error = sysfs_create_bin_file(&host->shost_classdev.kobj, &arcmsr_sysfs_message_read_attr); |
Erich Chen | 1c57e86 | 2006-07-12 08:59:32 -0700 | [diff] [blame] | 215 | if (error) { |
| 216 | printk(KERN_ERR "arcmsr: alloc sysfs mu_read failed\n"); |
| 217 | goto error_bin_file_message_read; |
| 218 | } |
Nick Cheng | 1a4f550 | 2007-09-13 17:26:40 +0800 | [diff] [blame^] | 219 | error = sysfs_create_bin_file(&host->shost_classdev.kobj, &arcmsr_sysfs_message_write_attr); |
Erich Chen | 1c57e86 | 2006-07-12 08:59:32 -0700 | [diff] [blame] | 220 | if (error) { |
| 221 | printk(KERN_ERR "arcmsr: alloc sysfs mu_write failed\n"); |
| 222 | goto error_bin_file_message_write; |
| 223 | } |
Nick Cheng | 1a4f550 | 2007-09-13 17:26:40 +0800 | [diff] [blame^] | 224 | error = sysfs_create_bin_file(&host->shost_classdev.kobj, &arcmsr_sysfs_message_clear_attr); |
Erich Chen | 1c57e86 | 2006-07-12 08:59:32 -0700 | [diff] [blame] | 225 | if (error) { |
| 226 | printk(KERN_ERR "arcmsr: alloc sysfs mu_clear failed\n"); |
| 227 | goto error_bin_file_message_clear; |
| 228 | } |
| 229 | return 0; |
| 230 | error_bin_file_message_clear: |
Nick Cheng | 1a4f550 | 2007-09-13 17:26:40 +0800 | [diff] [blame^] | 231 | sysfs_remove_bin_file(&host->shost_classdev.kobj, &arcmsr_sysfs_message_write_attr); |
Erich Chen | 1c57e86 | 2006-07-12 08:59:32 -0700 | [diff] [blame] | 232 | error_bin_file_message_write: |
Nick Cheng | 1a4f550 | 2007-09-13 17:26:40 +0800 | [diff] [blame^] | 233 | sysfs_remove_bin_file(&host->shost_classdev.kobj, &arcmsr_sysfs_message_read_attr); |
Erich Chen | 1c57e86 | 2006-07-12 08:59:32 -0700 | [diff] [blame] | 234 | error_bin_file_message_read: |
| 235 | return error; |
| 236 | } |
| 237 | |
| 238 | void |
| 239 | arcmsr_free_sysfs_attr(struct AdapterControlBlock *acb) { |
| 240 | struct Scsi_Host *host = acb->host; |
Erich Chen | 1c57e86 | 2006-07-12 08:59:32 -0700 | [diff] [blame] | 241 | |
Nick Cheng | 1a4f550 | 2007-09-13 17:26:40 +0800 | [diff] [blame^] | 242 | sysfs_remove_bin_file(&host->shost_classdev.kobj, &arcmsr_sysfs_message_clear_attr); |
| 243 | sysfs_remove_bin_file(&host->shost_classdev.kobj, &arcmsr_sysfs_message_write_attr); |
| 244 | sysfs_remove_bin_file(&host->shost_classdev.kobj, &arcmsr_sysfs_message_read_attr); |
Erich Chen | 1c57e86 | 2006-07-12 08:59:32 -0700 | [diff] [blame] | 245 | } |
| 246 | |
| 247 | |
| 248 | static ssize_t |
| 249 | arcmsr_attr_host_driver_version(struct class_device *cdev, char *buf) { |
| 250 | return snprintf(buf, PAGE_SIZE, |
James Bottomley | d67a70a | 2006-07-28 17:36:46 -0500 | [diff] [blame] | 251 | "%s\n", |
Erich Chen | 1c57e86 | 2006-07-12 08:59:32 -0700 | [diff] [blame] | 252 | ARCMSR_DRIVER_VERSION); |
| 253 | } |
| 254 | |
| 255 | static ssize_t |
| 256 | arcmsr_attr_host_driver_posted_cmd(struct class_device *cdev, char *buf) { |
| 257 | struct Scsi_Host *host = class_to_shost(cdev); |
| 258 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; |
| 259 | return snprintf(buf, PAGE_SIZE, |
James Bottomley | d67a70a | 2006-07-28 17:36:46 -0500 | [diff] [blame] | 260 | "%4d\n", |
Erich Chen | 1c57e86 | 2006-07-12 08:59:32 -0700 | [diff] [blame] | 261 | atomic_read(&acb->ccboutstandingcount)); |
| 262 | } |
| 263 | |
| 264 | static ssize_t |
| 265 | arcmsr_attr_host_driver_reset(struct class_device *cdev, char *buf) { |
| 266 | struct Scsi_Host *host = class_to_shost(cdev); |
| 267 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; |
| 268 | return snprintf(buf, PAGE_SIZE, |
James Bottomley | d67a70a | 2006-07-28 17:36:46 -0500 | [diff] [blame] | 269 | "%4d\n", |
Erich Chen | 1c57e86 | 2006-07-12 08:59:32 -0700 | [diff] [blame] | 270 | acb->num_resets); |
| 271 | } |
| 272 | |
| 273 | static ssize_t |
| 274 | arcmsr_attr_host_driver_abort(struct class_device *cdev, char *buf) { |
| 275 | struct Scsi_Host *host = class_to_shost(cdev); |
| 276 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; |
| 277 | return snprintf(buf, PAGE_SIZE, |
James Bottomley | d67a70a | 2006-07-28 17:36:46 -0500 | [diff] [blame] | 278 | "%4d\n", |
Erich Chen | 1c57e86 | 2006-07-12 08:59:32 -0700 | [diff] [blame] | 279 | acb->num_aborts); |
| 280 | } |
| 281 | |
| 282 | static ssize_t |
| 283 | arcmsr_attr_host_fw_model(struct class_device *cdev, char *buf) { |
| 284 | struct Scsi_Host *host = class_to_shost(cdev); |
| 285 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; |
| 286 | return snprintf(buf, PAGE_SIZE, |
James Bottomley | d67a70a | 2006-07-28 17:36:46 -0500 | [diff] [blame] | 287 | "%s\n", |
Erich Chen | 1c57e86 | 2006-07-12 08:59:32 -0700 | [diff] [blame] | 288 | acb->firm_model); |
| 289 | } |
| 290 | |
| 291 | static ssize_t |
| 292 | arcmsr_attr_host_fw_version(struct class_device *cdev, char *buf) { |
| 293 | struct Scsi_Host *host = class_to_shost(cdev); |
| 294 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; |
| 295 | |
| 296 | return snprintf(buf, PAGE_SIZE, |
James Bottomley | d67a70a | 2006-07-28 17:36:46 -0500 | [diff] [blame] | 297 | "%s\n", |
Erich Chen | 1c57e86 | 2006-07-12 08:59:32 -0700 | [diff] [blame] | 298 | acb->firm_version); |
| 299 | } |
| 300 | |
| 301 | static ssize_t |
| 302 | arcmsr_attr_host_fw_request_len(struct class_device *cdev, char *buf) { |
| 303 | struct Scsi_Host *host = class_to_shost(cdev); |
| 304 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; |
| 305 | |
| 306 | return snprintf(buf, PAGE_SIZE, |
James Bottomley | d67a70a | 2006-07-28 17:36:46 -0500 | [diff] [blame] | 307 | "%4d\n", |
Erich Chen | 1c57e86 | 2006-07-12 08:59:32 -0700 | [diff] [blame] | 308 | acb->firm_request_len); |
| 309 | } |
| 310 | |
| 311 | static ssize_t |
| 312 | arcmsr_attr_host_fw_numbers_queue(struct class_device *cdev, char *buf) { |
| 313 | struct Scsi_Host *host = class_to_shost(cdev); |
| 314 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; |
| 315 | |
| 316 | return snprintf(buf, PAGE_SIZE, |
James Bottomley | d67a70a | 2006-07-28 17:36:46 -0500 | [diff] [blame] | 317 | "%4d\n", |
Erich Chen | 1c57e86 | 2006-07-12 08:59:32 -0700 | [diff] [blame] | 318 | acb->firm_numbers_queue); |
| 319 | } |
| 320 | |
| 321 | static ssize_t |
| 322 | arcmsr_attr_host_fw_sdram_size(struct class_device *cdev, char *buf) { |
| 323 | struct Scsi_Host *host = class_to_shost(cdev); |
| 324 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; |
| 325 | |
| 326 | return snprintf(buf, PAGE_SIZE, |
James Bottomley | d67a70a | 2006-07-28 17:36:46 -0500 | [diff] [blame] | 327 | "%4d\n", |
Erich Chen | 1c57e86 | 2006-07-12 08:59:32 -0700 | [diff] [blame] | 328 | acb->firm_sdram_size); |
| 329 | } |
| 330 | |
| 331 | static ssize_t |
| 332 | arcmsr_attr_host_fw_hd_channels(struct class_device *cdev, char *buf) { |
| 333 | struct Scsi_Host *host = class_to_shost(cdev); |
| 334 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; |
| 335 | |
| 336 | return snprintf(buf, PAGE_SIZE, |
James Bottomley | d67a70a | 2006-07-28 17:36:46 -0500 | [diff] [blame] | 337 | "%4d\n", |
Erich Chen | 1c57e86 | 2006-07-12 08:59:32 -0700 | [diff] [blame] | 338 | acb->firm_hd_channels); |
| 339 | } |
| 340 | |
| 341 | static CLASS_DEVICE_ATTR(host_driver_version, S_IRUGO, arcmsr_attr_host_driver_version, NULL); |
| 342 | static CLASS_DEVICE_ATTR(host_driver_posted_cmd, S_IRUGO, arcmsr_attr_host_driver_posted_cmd, NULL); |
| 343 | static CLASS_DEVICE_ATTR(host_driver_reset, S_IRUGO, arcmsr_attr_host_driver_reset, NULL); |
| 344 | static CLASS_DEVICE_ATTR(host_driver_abort, S_IRUGO, arcmsr_attr_host_driver_abort, NULL); |
| 345 | static CLASS_DEVICE_ATTR(host_fw_model, S_IRUGO, arcmsr_attr_host_fw_model, NULL); |
| 346 | static CLASS_DEVICE_ATTR(host_fw_version, S_IRUGO, arcmsr_attr_host_fw_version, NULL); |
| 347 | static CLASS_DEVICE_ATTR(host_fw_request_len, S_IRUGO, arcmsr_attr_host_fw_request_len, NULL); |
| 348 | static CLASS_DEVICE_ATTR(host_fw_numbers_queue, S_IRUGO, arcmsr_attr_host_fw_numbers_queue, NULL); |
| 349 | static CLASS_DEVICE_ATTR(host_fw_sdram_size, S_IRUGO, arcmsr_attr_host_fw_sdram_size, NULL); |
| 350 | static CLASS_DEVICE_ATTR(host_fw_hd_channels, S_IRUGO, arcmsr_attr_host_fw_hd_channels, NULL); |
| 351 | |
| 352 | struct class_device_attribute *arcmsr_host_attrs[] = { |
| 353 | &class_device_attr_host_driver_version, |
| 354 | &class_device_attr_host_driver_posted_cmd, |
| 355 | &class_device_attr_host_driver_reset, |
| 356 | &class_device_attr_host_driver_abort, |
| 357 | &class_device_attr_host_fw_model, |
| 358 | &class_device_attr_host_fw_version, |
| 359 | &class_device_attr_host_fw_request_len, |
| 360 | &class_device_attr_host_fw_numbers_queue, |
| 361 | &class_device_attr_host_fw_sdram_size, |
| 362 | &class_device_attr_host_fw_hd_channels, |
| 363 | NULL, |
| 364 | }; |