qla_ioctl.c (227064) | qla_ioctl.c (250340) |
---|---|
1/* | 1/* |
2 * Copyright (c) 2010-2011 Qlogic Corporation | 2 * Copyright (c) 2011-2013 Qlogic Corporation |
3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. --- 14 unchanged lines hidden (view full) --- 25 * POSSIBILITY OF SUCH DAMAGE. 26 */ 27/* 28 * File: qla_ioctl.c 29 * Author : David C Somayajulu, Qlogic Corporation, Aliso Viejo, CA 92656. 30 */ 31 32#include <sys/cdefs.h> | 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. --- 14 unchanged lines hidden (view full) --- 25 * POSSIBILITY OF SUCH DAMAGE. 26 */ 27/* 28 * File: qla_ioctl.c 29 * Author : David C Somayajulu, Qlogic Corporation, Aliso Viejo, CA 92656. 30 */ 31 32#include <sys/cdefs.h> |
33__FBSDID("$FreeBSD: head/sys/dev/qlxgb/qla_ioctl.c 227064 2011-11-03 21:20:22Z bz $"); | 33__FBSDID("$FreeBSD: head/sys/dev/qlxgb/qla_ioctl.c 250340 2013-05-07 22:58:42Z davidcs $"); |
34 35#include "qla_os.h" 36#include "qla_reg.h" 37#include "qla_hw.h" 38#include "qla_def.h" 39#include "qla_reg.h" 40#include "qla_inline.h" 41#include "qla_glbl.h" --- 35 unchanged lines hidden (view full) --- 77int 78qla_eioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, 79 struct thread *td) 80{ 81 qla_host_t *ha; 82 int rval = 0; 83 qla_reg_val_t *rv; 84 qla_rd_flash_t *rdf; | 34 35#include "qla_os.h" 36#include "qla_reg.h" 37#include "qla_hw.h" 38#include "qla_def.h" 39#include "qla_reg.h" 40#include "qla_inline.h" 41#include "qla_glbl.h" --- 35 unchanged lines hidden (view full) --- 77int 78qla_eioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, 79 struct thread *td) 80{ 81 qla_host_t *ha; 82 int rval = 0; 83 qla_reg_val_t *rv; 84 qla_rd_flash_t *rdf; |
85 qla_wr_flash_t *wrf; 86 qla_rd_pci_ids_t *pci_ids; 87 device_t pci_dev; |
|
85 86 if ((ha = (qla_host_t *)dev->si_drv1) == NULL) 87 return ENXIO; 88 | 88 89 if ((ha = (qla_host_t *)dev->si_drv1) == NULL) 90 return ENXIO; 91 |
92 pci_dev= ha->pci_dev; 93 |
|
89 switch(cmd) { 90 91 case QLA_RDWR_REG: 92 93 rv = (qla_reg_val_t *)data; 94 95 if (rv->direct) { 96 if (rv->rd) { --- 8 unchanged lines hidden (view full) --- 105 } 106 break; 107 108 case QLA_RD_FLASH: 109 rdf = (qla_rd_flash_t *)data; 110 if ((rval = qla_rd_flash32(ha, rdf->off, &rdf->data))) 111 rval = ENXIO; 112 break; | 94 switch(cmd) { 95 96 case QLA_RDWR_REG: 97 98 rv = (qla_reg_val_t *)data; 99 100 if (rv->direct) { 101 if (rv->rd) { --- 8 unchanged lines hidden (view full) --- 110 } 111 break; 112 113 case QLA_RD_FLASH: 114 rdf = (qla_rd_flash_t *)data; 115 if ((rval = qla_rd_flash32(ha, rdf->off, &rdf->data))) 116 rval = ENXIO; 117 break; |
118 119 case QLA_WR_FLASH: 120 wrf = (qla_wr_flash_t *)data; 121 if ((rval = qla_wr_flash_buffer(ha, wrf->off, wrf->size, 122 wrf->buffer, wrf->pattern))) 123 rval = ENXIO; 124 break; 125 126 127 case QLA_ERASE_FLASH: 128 if (qla_erase_flash(ha, ((qla_erase_flash_t *)data)->off, 129 ((qla_erase_flash_t *)data)->size)) 130 rval = ENXIO; 131 break; 132 133 case QLA_RD_PCI_IDS: 134 pci_ids = (qla_rd_pci_ids_t *)data; 135 pci_ids->ven_id = pci_get_vendor(pci_dev); 136 pci_ids->dev_id = pci_get_device(pci_dev); 137 pci_ids->subsys_ven_id = pci_get_subvendor(pci_dev); 138 pci_ids->subsys_dev_id = pci_get_subdevice(pci_dev); 139 pci_ids->rev_id = pci_read_config(pci_dev, PCIR_REVID, 1); 140 break; 141 |
|
113 default: 114 break; 115 } 116 117 return rval; 118} 119 | 142 default: 143 break; 144 } 145 146 return rval; 147} 148 |