#include <linux/vmalloc.h>
#include <linux/uaccess.h>
qla2x00_lock_nvram_access(struct qla_hw_data *ha)
struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
if (!IS_QLA2100(ha) && !IS_QLA2200(ha) && !IS_QLA2300(ha)) {
data = RD_REG_WORD(®->nvram);
while (data & NVR_BUSY) {
data = RD_REG_WORD(®->nvram);
WRT_REG_WORD(®->u.isp2300.host_semaphore, 0x1);
RD_REG_WORD(®->u.isp2300.host_semaphore);
data = RD_REG_WORD(®->u.isp2300.host_semaphore);
while ((data & BIT_0) == 0) {
WRT_REG_WORD(®->u.isp2300.host_semaphore, 0x1);
RD_REG_WORD(®->u.isp2300.host_semaphore);
data = RD_REG_WORD(®->u.isp2300.host_semaphore);
qla2x00_unlock_nvram_access(struct qla_hw_data *ha)
struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
if (!IS_QLA2100(ha) && !IS_QLA2200(ha) && !IS_QLA2300(ha)) {
WRT_REG_WORD(®->u.isp2300.host_semaphore, 0);
RD_REG_WORD(®->u.isp2300.host_semaphore);
qla2x00_nv_write(struct qla_hw_data *ha, uint16_t data)
struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
WRT_REG_WORD(®->nvram, data | NVR_SELECT | NVR_WRT_ENABLE);
RD_REG_WORD(®->nvram);
WRT_REG_WORD(®->nvram, data | NVR_SELECT | NVR_CLOCK |
RD_REG_WORD(®->nvram);
WRT_REG_WORD(®->nvram, data | NVR_SELECT | NVR_WRT_ENABLE);
RD_REG_WORD(®->nvram);