提交 11b75249 编写于 作者: J John Garry 提交者: Martin K. Petersen

scsi: hisi_sas: add pci_dev in hisi_hba struct

Since hip08 SAS controller is based on pci device, add hisi_hba.pci_dev
for hip08 (will be v3), and also rename hisi_hba.pdev to .platform_dev
for clarity.

In addition, for common code which wants to reference the controller
device struct, add hisi_hba.dev, and change the common code to use it.
Signed-off-by: NJohn Garry <john.garry@huawei.com>
Signed-off-by: NXiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
上级 318913c6
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <linux/mfd/syscon.h> #include <linux/mfd/syscon.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of_address.h> #include <linux/of_address.h>
#include <linux/pci.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/property.h> #include <linux/property.h>
#include <linux/regmap.h> #include <linux/regmap.h>
...@@ -196,7 +197,10 @@ struct hisi_hba { ...@@ -196,7 +197,10 @@ struct hisi_hba {
/* This must be the first element, used by SHOST_TO_SAS_HA */ /* This must be the first element, used by SHOST_TO_SAS_HA */
struct sas_ha_struct *p; struct sas_ha_struct *p;
struct platform_device *pdev; struct platform_device *platform_dev;
struct pci_dev *pci_dev;
struct device *dev;
void __iomem *regs; void __iomem *regs;
struct regmap *ctrl; struct regmap *ctrl;
u32 ctrl_reset_reg; u32 ctrl_reset_reg;
......
...@@ -168,7 +168,7 @@ void hisi_sas_slot_task_free(struct hisi_hba *hisi_hba, struct sas_task *task, ...@@ -168,7 +168,7 @@ void hisi_sas_slot_task_free(struct hisi_hba *hisi_hba, struct sas_task *task,
{ {
if (task) { if (task) {
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
struct domain_device *device = task->dev; struct domain_device *device = task->dev;
struct hisi_sas_device *sas_dev = device->lldd_dev; struct hisi_sas_device *sas_dev = device->lldd_dev;
...@@ -245,7 +245,7 @@ static void hisi_sas_slot_abort(struct work_struct *work) ...@@ -245,7 +245,7 @@ static void hisi_sas_slot_abort(struct work_struct *work)
struct scsi_cmnd *cmnd = task->uldd_task; struct scsi_cmnd *cmnd = task->uldd_task;
struct hisi_sas_tmf_task tmf_task; struct hisi_sas_tmf_task tmf_task;
struct scsi_lun lun; struct scsi_lun lun;
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
int tag = abort_slot->idx; int tag = abort_slot->idx;
unsigned long flags; unsigned long flags;
...@@ -279,7 +279,7 @@ static int hisi_sas_task_prep(struct sas_task *task, struct hisi_sas_dq ...@@ -279,7 +279,7 @@ static int hisi_sas_task_prep(struct sas_task *task, struct hisi_sas_dq
struct hisi_sas_slot *slot; struct hisi_sas_slot *slot;
struct hisi_sas_cmd_hdr *cmd_hdr_base; struct hisi_sas_cmd_hdr *cmd_hdr_base;
struct asd_sas_port *sas_port = device->port; struct asd_sas_port *sas_port = device->port;
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
int dlvry_queue_slot, dlvry_queue, n_elem = 0, rc, slot_idx; int dlvry_queue_slot, dlvry_queue, n_elem = 0, rc, slot_idx;
unsigned long flags; unsigned long flags;
...@@ -451,7 +451,7 @@ static int hisi_sas_task_exec(struct sas_task *task, gfp_t gfp_flags, ...@@ -451,7 +451,7 @@ static int hisi_sas_task_exec(struct sas_task *task, gfp_t gfp_flags,
u32 pass = 0; u32 pass = 0;
unsigned long flags; unsigned long flags;
struct hisi_hba *hisi_hba = dev_to_hisi_hba(task->dev); struct hisi_hba *hisi_hba = dev_to_hisi_hba(task->dev);
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
struct domain_device *device = task->dev; struct domain_device *device = task->dev;
struct hisi_sas_device *sas_dev = device->lldd_dev; struct hisi_sas_device *sas_dev = device->lldd_dev;
struct hisi_sas_dq *dq = sas_dev->dq; struct hisi_sas_dq *dq = sas_dev->dq;
...@@ -546,7 +546,7 @@ static int hisi_sas_dev_found(struct domain_device *device) ...@@ -546,7 +546,7 @@ static int hisi_sas_dev_found(struct domain_device *device)
struct hisi_hba *hisi_hba = dev_to_hisi_hba(device); struct hisi_hba *hisi_hba = dev_to_hisi_hba(device);
struct domain_device *parent_dev = device->parent; struct domain_device *parent_dev = device->parent;
struct hisi_sas_device *sas_dev; struct hisi_sas_device *sas_dev;
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
if (hisi_hba->hw->alloc_dev) if (hisi_hba->hw->alloc_dev)
sas_dev = hisi_hba->hw->alloc_dev(device); sas_dev = hisi_hba->hw->alloc_dev(device);
...@@ -731,7 +731,7 @@ static void hisi_sas_dev_gone(struct domain_device *device) ...@@ -731,7 +731,7 @@ static void hisi_sas_dev_gone(struct domain_device *device)
{ {
struct hisi_sas_device *sas_dev = device->lldd_dev; struct hisi_sas_device *sas_dev = device->lldd_dev;
struct hisi_hba *hisi_hba = dev_to_hisi_hba(device); struct hisi_hba *hisi_hba = dev_to_hisi_hba(device);
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
int dev_id = sas_dev->device_id; int dev_id = sas_dev->device_id;
dev_info(dev, "found dev[%d:%x] is gone\n", dev_info(dev, "found dev[%d:%x] is gone\n",
...@@ -814,7 +814,7 @@ static int hisi_sas_exec_internal_tmf_task(struct domain_device *device, ...@@ -814,7 +814,7 @@ static int hisi_sas_exec_internal_tmf_task(struct domain_device *device,
{ {
struct hisi_sas_device *sas_dev = device->lldd_dev; struct hisi_sas_device *sas_dev = device->lldd_dev;
struct hisi_hba *hisi_hba = sas_dev->hisi_hba; struct hisi_hba *hisi_hba = sas_dev->hisi_hba;
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
struct sas_task *task; struct sas_task *task;
int res, retry; int res, retry;
...@@ -931,7 +931,7 @@ static int hisi_sas_softreset_ata_disk(struct domain_device *device) ...@@ -931,7 +931,7 @@ static int hisi_sas_softreset_ata_disk(struct domain_device *device)
struct ata_link *link; struct ata_link *link;
int rc = TMF_RESP_FUNC_FAILED; int rc = TMF_RESP_FUNC_FAILED;
struct hisi_hba *hisi_hba = dev_to_hisi_hba(device); struct hisi_hba *hisi_hba = dev_to_hisi_hba(device);
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
int s = sizeof(struct host_to_dev_fis); int s = sizeof(struct host_to_dev_fis);
unsigned long flags; unsigned long flags;
...@@ -989,7 +989,7 @@ static int hisi_sas_controller_reset(struct hisi_hba *hisi_hba) ...@@ -989,7 +989,7 @@ static int hisi_sas_controller_reset(struct hisi_hba *hisi_hba)
return -1; return -1;
if (!test_and_set_bit(HISI_SAS_RESET_BIT, &hisi_hba->flags)) { if (!test_and_set_bit(HISI_SAS_RESET_BIT, &hisi_hba->flags)) {
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
struct sas_ha_struct *sas_ha = &hisi_hba->sha; struct sas_ha_struct *sas_ha = &hisi_hba->sha;
unsigned long flags; unsigned long flags;
...@@ -1022,7 +1022,7 @@ static int hisi_sas_abort_task(struct sas_task *task) ...@@ -1022,7 +1022,7 @@ static int hisi_sas_abort_task(struct sas_task *task)
struct domain_device *device = task->dev; struct domain_device *device = task->dev;
struct hisi_sas_device *sas_dev = device->lldd_dev; struct hisi_sas_device *sas_dev = device->lldd_dev;
struct hisi_hba *hisi_hba = dev_to_hisi_hba(task->dev); struct hisi_hba *hisi_hba = dev_to_hisi_hba(task->dev);
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
int rc = TMF_RESP_FUNC_FAILED; int rc = TMF_RESP_FUNC_FAILED;
unsigned long flags; unsigned long flags;
...@@ -1151,7 +1151,7 @@ static int hisi_sas_lu_reset(struct domain_device *device, u8 *lun) ...@@ -1151,7 +1151,7 @@ static int hisi_sas_lu_reset(struct domain_device *device, u8 *lun)
{ {
struct hisi_sas_device *sas_dev = device->lldd_dev; struct hisi_sas_device *sas_dev = device->lldd_dev;
struct hisi_hba *hisi_hba = dev_to_hisi_hba(device); struct hisi_hba *hisi_hba = dev_to_hisi_hba(device);
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
unsigned long flags; unsigned long flags;
int rc = TMF_RESP_FUNC_FAILED; int rc = TMF_RESP_FUNC_FAILED;
...@@ -1240,7 +1240,7 @@ hisi_sas_internal_abort_task_exec(struct hisi_hba *hisi_hba, int device_id, ...@@ -1240,7 +1240,7 @@ hisi_sas_internal_abort_task_exec(struct hisi_hba *hisi_hba, int device_id,
{ {
struct domain_device *device = task->dev; struct domain_device *device = task->dev;
struct hisi_sas_device *sas_dev = device->lldd_dev; struct hisi_sas_device *sas_dev = device->lldd_dev;
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
struct hisi_sas_port *port; struct hisi_sas_port *port;
struct hisi_sas_slot *slot; struct hisi_sas_slot *slot;
struct asd_sas_port *sas_port = device->port; struct asd_sas_port *sas_port = device->port;
...@@ -1337,7 +1337,7 @@ hisi_sas_internal_task_abort(struct hisi_hba *hisi_hba, ...@@ -1337,7 +1337,7 @@ hisi_sas_internal_task_abort(struct hisi_hba *hisi_hba,
{ {
struct sas_task *task; struct sas_task *task;
struct hisi_sas_device *sas_dev = device->lldd_dev; struct hisi_sas_device *sas_dev = device->lldd_dev;
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
int res; int res;
if (!hisi_hba->hw->prep_abort) if (!hisi_hba->hw->prep_abort)
...@@ -1547,8 +1547,7 @@ EXPORT_SYMBOL_GPL(hisi_sas_init_mem); ...@@ -1547,8 +1547,7 @@ EXPORT_SYMBOL_GPL(hisi_sas_init_mem);
static int hisi_sas_alloc(struct hisi_hba *hisi_hba, struct Scsi_Host *shost) static int hisi_sas_alloc(struct hisi_hba *hisi_hba, struct Scsi_Host *shost)
{ {
struct platform_device *pdev = hisi_hba->pdev; struct device *dev = hisi_hba->dev;
struct device *dev = &pdev->dev;
int i, s, max_command_entries = hisi_hba->hw->max_command_entries; int i, s, max_command_entries = hisi_hba->hw->max_command_entries;
spin_lock_init(&hisi_hba->lock); spin_lock_init(&hisi_hba->lock);
...@@ -1668,7 +1667,7 @@ static int hisi_sas_alloc(struct hisi_hba *hisi_hba, struct Scsi_Host *shost) ...@@ -1668,7 +1667,7 @@ static int hisi_sas_alloc(struct hisi_hba *hisi_hba, struct Scsi_Host *shost)
static void hisi_sas_free(struct hisi_hba *hisi_hba) static void hisi_sas_free(struct hisi_hba *hisi_hba)
{ {
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
int i, s, max_command_entries = hisi_hba->hw->max_command_entries; int i, s, max_command_entries = hisi_hba->hw->max_command_entries;
for (i = 0; i < hisi_hba->queue_count; i++) { for (i = 0; i < hisi_hba->queue_count; i++) {
...@@ -1749,7 +1748,8 @@ static struct Scsi_Host *hisi_sas_shost_alloc(struct platform_device *pdev, ...@@ -1749,7 +1748,8 @@ static struct Scsi_Host *hisi_sas_shost_alloc(struct platform_device *pdev,
INIT_WORK(&hisi_hba->rst_work, hisi_sas_rst_work_handler); INIT_WORK(&hisi_hba->rst_work, hisi_sas_rst_work_handler);
hisi_hba->hw = hw; hisi_hba->hw = hw;
hisi_hba->pdev = pdev; hisi_hba->platform_dev = pdev;
hisi_hba->dev = dev;
hisi_hba->shost = shost; hisi_hba->shost = shost;
SHOST_TO_SAS_HA(shost) = &hisi_hba->sha; SHOST_TO_SAS_HA(shost) = &hisi_hba->sha;
...@@ -1866,7 +1866,7 @@ int hisi_sas_probe(struct platform_device *pdev, ...@@ -1866,7 +1866,7 @@ int hisi_sas_probe(struct platform_device *pdev,
shost->cmd_per_lun = hisi_hba->hw->max_command_entries; shost->cmd_per_lun = hisi_hba->hw->max_command_entries;
sha->sas_ha_name = DRV_NAME; sha->sas_ha_name = DRV_NAME;
sha->dev = &hisi_hba->pdev->dev; sha->dev = hisi_hba->dev;
sha->lldd_module = THIS_MODULE; sha->lldd_module = THIS_MODULE;
sha->sas_addr = &hisi_hba->sas_addr[0]; sha->sas_addr = &hisi_hba->sas_addr[0];
sha->num_phys = hisi_hba->n_phy; sha->num_phys = hisi_hba->n_phy;
......
...@@ -505,7 +505,7 @@ static void setup_itct_v1_hw(struct hisi_hba *hisi_hba, ...@@ -505,7 +505,7 @@ static void setup_itct_v1_hw(struct hisi_hba *hisi_hba,
struct hisi_sas_device *sas_dev) struct hisi_sas_device *sas_dev)
{ {
struct domain_device *device = sas_dev->sas_device; struct domain_device *device = sas_dev->sas_device;
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
u64 qw0, device_id = sas_dev->device_id; u64 qw0, device_id = sas_dev->device_id;
struct hisi_sas_itct *itct = &hisi_hba->itct[device_id]; struct hisi_sas_itct *itct = &hisi_hba->itct[device_id];
struct asd_sas_port *sas_port = device->port; struct asd_sas_port *sas_port = device->port;
...@@ -571,7 +571,7 @@ static int reset_hw_v1_hw(struct hisi_hba *hisi_hba) ...@@ -571,7 +571,7 @@ static int reset_hw_v1_hw(struct hisi_hba *hisi_hba)
int i; int i;
unsigned long end_time; unsigned long end_time;
u32 val; u32 val;
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
for (i = 0; i < hisi_hba->n_phy; i++) { for (i = 0; i < hisi_hba->n_phy; i++) {
u32 phy_ctrl = hisi_sas_phy_read32(hisi_hba, i, PHY_CTRL); u32 phy_ctrl = hisi_sas_phy_read32(hisi_hba, i, PHY_CTRL);
...@@ -756,7 +756,7 @@ static void init_reg_v1_hw(struct hisi_hba *hisi_hba) ...@@ -756,7 +756,7 @@ static void init_reg_v1_hw(struct hisi_hba *hisi_hba)
static int hw_init_v1_hw(struct hisi_hba *hisi_hba) static int hw_init_v1_hw(struct hisi_hba *hisi_hba)
{ {
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
int rc; int rc;
rc = reset_hw_v1_hw(hisi_hba); rc = reset_hw_v1_hw(hisi_hba);
...@@ -907,7 +907,7 @@ static int get_wideport_bitmap_v1_hw(struct hisi_hba *hisi_hba, int port_id) ...@@ -907,7 +907,7 @@ static int get_wideport_bitmap_v1_hw(struct hisi_hba *hisi_hba, int port_id)
static int static int
get_free_slot_v1_hw(struct hisi_hba *hisi_hba, struct hisi_sas_dq *dq) get_free_slot_v1_hw(struct hisi_hba *hisi_hba, struct hisi_sas_dq *dq)
{ {
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
int queue = dq->id; int queue = dq->id;
u32 r, w; u32 r, w;
...@@ -939,7 +939,7 @@ static int prep_prd_sge_v1_hw(struct hisi_hba *hisi_hba, ...@@ -939,7 +939,7 @@ static int prep_prd_sge_v1_hw(struct hisi_hba *hisi_hba,
struct scatterlist *scatter, struct scatterlist *scatter,
int n_elem) int n_elem)
{ {
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
struct scatterlist *sg; struct scatterlist *sg;
int i; int i;
...@@ -976,7 +976,7 @@ static int prep_smp_v1_hw(struct hisi_hba *hisi_hba, ...@@ -976,7 +976,7 @@ static int prep_smp_v1_hw(struct hisi_hba *hisi_hba,
struct sas_task *task = slot->task; struct sas_task *task = slot->task;
struct hisi_sas_cmd_hdr *hdr = slot->cmd_hdr; struct hisi_sas_cmd_hdr *hdr = slot->cmd_hdr;
struct domain_device *device = task->dev; struct domain_device *device = task->dev;
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
struct hisi_sas_port *port = slot->port; struct hisi_sas_port *port = slot->port;
struct scatterlist *sg_req, *sg_resp; struct scatterlist *sg_req, *sg_resp;
struct hisi_sas_device *sas_dev = device->lldd_dev; struct hisi_sas_device *sas_dev = device->lldd_dev;
...@@ -1148,7 +1148,7 @@ static void slot_err_v1_hw(struct hisi_hba *hisi_hba, ...@@ -1148,7 +1148,7 @@ static void slot_err_v1_hw(struct hisi_hba *hisi_hba,
{ {
struct task_status_struct *ts = &task->task_status; struct task_status_struct *ts = &task->task_status;
struct hisi_sas_err_record_v1 *err_record = slot->status_buffer; struct hisi_sas_err_record_v1 *err_record = slot->status_buffer;
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
switch (task->task_proto) { switch (task->task_proto) {
case SAS_PROTOCOL_SSP: case SAS_PROTOCOL_SSP:
...@@ -1274,7 +1274,7 @@ static int slot_complete_v1_hw(struct hisi_hba *hisi_hba, ...@@ -1274,7 +1274,7 @@ static int slot_complete_v1_hw(struct hisi_hba *hisi_hba,
{ {
struct sas_task *task = slot->task; struct sas_task *task = slot->task;
struct hisi_sas_device *sas_dev; struct hisi_sas_device *sas_dev;
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
struct task_status_struct *ts; struct task_status_struct *ts;
struct domain_device *device; struct domain_device *device;
enum exec_status sts; enum exec_status sts;
...@@ -1423,7 +1423,7 @@ static irqreturn_t int_phyup_v1_hw(int irq_no, void *p) ...@@ -1423,7 +1423,7 @@ static irqreturn_t int_phyup_v1_hw(int irq_no, void *p)
{ {
struct hisi_sas_phy *phy = p; struct hisi_sas_phy *phy = p;
struct hisi_hba *hisi_hba = phy->hisi_hba; struct hisi_hba *hisi_hba = phy->hisi_hba;
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
struct asd_sas_phy *sas_phy = &phy->sas_phy; struct asd_sas_phy *sas_phy = &phy->sas_phy;
int i, phy_no = sas_phy->id; int i, phy_no = sas_phy->id;
u32 irq_value, context, port_id, link_rate; u32 irq_value, context, port_id, link_rate;
...@@ -1504,7 +1504,7 @@ static irqreturn_t int_bcast_v1_hw(int irq, void *p) ...@@ -1504,7 +1504,7 @@ static irqreturn_t int_bcast_v1_hw(int irq, void *p)
struct hisi_hba *hisi_hba = phy->hisi_hba; struct hisi_hba *hisi_hba = phy->hisi_hba;
struct asd_sas_phy *sas_phy = &phy->sas_phy; struct asd_sas_phy *sas_phy = &phy->sas_phy;
struct sas_ha_struct *sha = &hisi_hba->sha; struct sas_ha_struct *sha = &hisi_hba->sha;
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
int phy_no = sas_phy->id; int phy_no = sas_phy->id;
u32 irq_value; u32 irq_value;
irqreturn_t res = IRQ_HANDLED; irqreturn_t res = IRQ_HANDLED;
...@@ -1531,7 +1531,7 @@ static irqreturn_t int_abnormal_v1_hw(int irq, void *p) ...@@ -1531,7 +1531,7 @@ static irqreturn_t int_abnormal_v1_hw(int irq, void *p)
{ {
struct hisi_sas_phy *phy = p; struct hisi_sas_phy *phy = p;
struct hisi_hba *hisi_hba = phy->hisi_hba; struct hisi_hba *hisi_hba = phy->hisi_hba;
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
struct asd_sas_phy *sas_phy = &phy->sas_phy; struct asd_sas_phy *sas_phy = &phy->sas_phy;
u32 irq_value, irq_mask_old; u32 irq_value, irq_mask_old;
int phy_no = sas_phy->id; int phy_no = sas_phy->id;
...@@ -1634,7 +1634,7 @@ static irqreturn_t cq_interrupt_v1_hw(int irq, void *p) ...@@ -1634,7 +1634,7 @@ static irqreturn_t cq_interrupt_v1_hw(int irq, void *p)
static irqreturn_t fatal_ecc_int_v1_hw(int irq, void *p) static irqreturn_t fatal_ecc_int_v1_hw(int irq, void *p)
{ {
struct hisi_hba *hisi_hba = p; struct hisi_hba *hisi_hba = p;
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
u32 ecc_int = hisi_sas_read32(hisi_hba, SAS_ECC_INTR); u32 ecc_int = hisi_sas_read32(hisi_hba, SAS_ECC_INTR);
if (ecc_int & SAS_ECC_INTR_DQ_ECC1B_MSK) { if (ecc_int & SAS_ECC_INTR_DQ_ECC1B_MSK) {
...@@ -1693,7 +1693,7 @@ static irqreturn_t fatal_ecc_int_v1_hw(int irq, void *p) ...@@ -1693,7 +1693,7 @@ static irqreturn_t fatal_ecc_int_v1_hw(int irq, void *p)
static irqreturn_t fatal_axi_int_v1_hw(int irq, void *p) static irqreturn_t fatal_axi_int_v1_hw(int irq, void *p)
{ {
struct hisi_hba *hisi_hba = p; struct hisi_hba *hisi_hba = p;
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
u32 axi_int = hisi_sas_read32(hisi_hba, ENT_INT_SRC2); u32 axi_int = hisi_sas_read32(hisi_hba, ENT_INT_SRC2);
u32 axi_info = hisi_sas_read32(hisi_hba, HGC_AXI_FIFO_ERR_INFO); u32 axi_info = hisi_sas_read32(hisi_hba, HGC_AXI_FIFO_ERR_INFO);
...@@ -1731,7 +1731,7 @@ static irq_handler_t fatal_interrupts[HISI_SAS_MAX_QUEUES] = { ...@@ -1731,7 +1731,7 @@ static irq_handler_t fatal_interrupts[HISI_SAS_MAX_QUEUES] = {
static int interrupt_init_v1_hw(struct hisi_hba *hisi_hba) static int interrupt_init_v1_hw(struct hisi_hba *hisi_hba)
{ {
struct platform_device *pdev = hisi_hba->pdev; struct platform_device *pdev = hisi_hba->platform_dev;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
int i, j, irq, rc, idx; int i, j, irq, rc, idx;
......
...@@ -653,7 +653,7 @@ slot_index_alloc_quirk_v2_hw(struct hisi_hba *hisi_hba, int *slot_idx, ...@@ -653,7 +653,7 @@ slot_index_alloc_quirk_v2_hw(struct hisi_hba *hisi_hba, int *slot_idx,
static bool sata_index_alloc_v2_hw(struct hisi_hba *hisi_hba, int *idx) static bool sata_index_alloc_v2_hw(struct hisi_hba *hisi_hba, int *idx)
{ {
unsigned int index; unsigned int index;
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
void *bitmap = hisi_hba->sata_dev_bitmap; void *bitmap = hisi_hba->sata_dev_bitmap;
index = find_first_zero_bit(bitmap, HISI_MAX_SATA_SUPPORT_V2_HW); index = find_first_zero_bit(bitmap, HISI_MAX_SATA_SUPPORT_V2_HW);
...@@ -754,7 +754,7 @@ static void setup_itct_v2_hw(struct hisi_hba *hisi_hba, ...@@ -754,7 +754,7 @@ static void setup_itct_v2_hw(struct hisi_hba *hisi_hba,
struct hisi_sas_device *sas_dev) struct hisi_sas_device *sas_dev)
{ {
struct domain_device *device = sas_dev->sas_device; struct domain_device *device = sas_dev->sas_device;
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
u64 qw0, device_id = sas_dev->device_id; u64 qw0, device_id = sas_dev->device_id;
struct hisi_sas_itct *itct = &hisi_hba->itct[device_id]; struct hisi_sas_itct *itct = &hisi_hba->itct[device_id];
struct domain_device *parent_dev = device->parent; struct domain_device *parent_dev = device->parent;
...@@ -807,7 +807,7 @@ static void free_device_v2_hw(struct hisi_hba *hisi_hba, ...@@ -807,7 +807,7 @@ static void free_device_v2_hw(struct hisi_hba *hisi_hba,
struct hisi_sas_device *sas_dev) struct hisi_sas_device *sas_dev)
{ {
u64 dev_id = sas_dev->device_id; u64 dev_id = sas_dev->device_id;
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
struct hisi_sas_itct *itct = &hisi_hba->itct[dev_id]; struct hisi_sas_itct *itct = &hisi_hba->itct[dev_id];
u32 reg_val = hisi_sas_read32(hisi_hba, ENT_INT_SRC3); u32 reg_val = hisi_sas_read32(hisi_hba, ENT_INT_SRC3);
int i; int i;
...@@ -851,7 +851,7 @@ static int reset_hw_v2_hw(struct hisi_hba *hisi_hba) ...@@ -851,7 +851,7 @@ static int reset_hw_v2_hw(struct hisi_hba *hisi_hba)
int i, reset_val; int i, reset_val;
u32 val; u32 val;
unsigned long end_time; unsigned long end_time;
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
/* The mask needs to be set depending on the number of phys */ /* The mask needs to be set depending on the number of phys */
if (hisi_hba->n_phy == 9) if (hisi_hba->n_phy == 9)
...@@ -987,7 +987,7 @@ static void phys_try_accept_stp_links_v2_hw(struct hisi_hba *hisi_hba) ...@@ -987,7 +987,7 @@ static void phys_try_accept_stp_links_v2_hw(struct hisi_hba *hisi_hba)
static void init_reg_v2_hw(struct hisi_hba *hisi_hba) static void init_reg_v2_hw(struct hisi_hba *hisi_hba)
{ {
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
int i; int i;
/* Global registers init */ /* Global registers init */
...@@ -1168,7 +1168,7 @@ static void set_link_timer_quirk(struct hisi_hba *hisi_hba) ...@@ -1168,7 +1168,7 @@ static void set_link_timer_quirk(struct hisi_hba *hisi_hba)
static int hw_init_v2_hw(struct hisi_hba *hisi_hba) static int hw_init_v2_hw(struct hisi_hba *hisi_hba)
{ {
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
int rc; int rc;
rc = reset_hw_v2_hw(hisi_hba); rc = reset_hw_v2_hw(hisi_hba);
...@@ -1217,7 +1217,7 @@ static bool tx_fifo_is_empty_v2_hw(struct hisi_hba *hisi_hba, int phy_no) ...@@ -1217,7 +1217,7 @@ static bool tx_fifo_is_empty_v2_hw(struct hisi_hba *hisi_hba, int phy_no)
static bool axi_bus_is_idle_v2_hw(struct hisi_hba *hisi_hba, int phy_no) static bool axi_bus_is_idle_v2_hw(struct hisi_hba *hisi_hba, int phy_no)
{ {
int i, max_loop = 1000; int i, max_loop = 1000;
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
u32 status, axi_status, dfx_val, dfx_tx_val; u32 status, axi_status, dfx_val, dfx_tx_val;
for (i = 0; i < max_loop; i++) { for (i = 0; i < max_loop; i++) {
...@@ -1243,7 +1243,7 @@ static bool axi_bus_is_idle_v2_hw(struct hisi_hba *hisi_hba, int phy_no) ...@@ -1243,7 +1243,7 @@ static bool axi_bus_is_idle_v2_hw(struct hisi_hba *hisi_hba, int phy_no)
static bool wait_io_done_v2_hw(struct hisi_hba *hisi_hba, int phy_no) static bool wait_io_done_v2_hw(struct hisi_hba *hisi_hba, int phy_no)
{ {
int i, max_loop = 1000; int i, max_loop = 1000;
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
u32 status, tx_dfx0; u32 status, tx_dfx0;
for (i = 0; i < max_loop; i++) { for (i = 0; i < max_loop; i++) {
...@@ -1281,7 +1281,7 @@ static bool allowed_disable_phy_v2_hw(struct hisi_hba *hisi_hba, int phy_no) ...@@ -1281,7 +1281,7 @@ static bool allowed_disable_phy_v2_hw(struct hisi_hba *hisi_hba, int phy_no)
static void disable_phy_v2_hw(struct hisi_hba *hisi_hba, int phy_no) static void disable_phy_v2_hw(struct hisi_hba *hisi_hba, int phy_no)
{ {
u32 cfg, axi_val, dfx0_val, txid_auto; u32 cfg, axi_val, dfx0_val, txid_auto;
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
/* Close axi bus. */ /* Close axi bus. */
axi_val = hisi_sas_read32(hisi_hba, AXI_MASTER_CFG_BASE + axi_val = hisi_sas_read32(hisi_hba, AXI_MASTER_CFG_BASE +
...@@ -1459,7 +1459,7 @@ static int get_wideport_bitmap_v2_hw(struct hisi_hba *hisi_hba, int port_id) ...@@ -1459,7 +1459,7 @@ static int get_wideport_bitmap_v2_hw(struct hisi_hba *hisi_hba, int port_id)
static int static int
get_free_slot_v2_hw(struct hisi_hba *hisi_hba, struct hisi_sas_dq *dq) get_free_slot_v2_hw(struct hisi_hba *hisi_hba, struct hisi_sas_dq *dq)
{ {
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
int queue = dq->id; int queue = dq->id;
u32 r, w; u32 r, w;
...@@ -1492,7 +1492,7 @@ static int prep_prd_sge_v2_hw(struct hisi_hba *hisi_hba, ...@@ -1492,7 +1492,7 @@ static int prep_prd_sge_v2_hw(struct hisi_hba *hisi_hba,
struct scatterlist *scatter, struct scatterlist *scatter,
int n_elem) int n_elem)
{ {
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
struct scatterlist *sg; struct scatterlist *sg;
int i; int i;
...@@ -1529,7 +1529,7 @@ static int prep_smp_v2_hw(struct hisi_hba *hisi_hba, ...@@ -1529,7 +1529,7 @@ static int prep_smp_v2_hw(struct hisi_hba *hisi_hba,
struct sas_task *task = slot->task; struct sas_task *task = slot->task;
struct hisi_sas_cmd_hdr *hdr = slot->cmd_hdr; struct hisi_sas_cmd_hdr *hdr = slot->cmd_hdr;
struct domain_device *device = task->dev; struct domain_device *device = task->dev;
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
struct hisi_sas_port *port = slot->port; struct hisi_sas_port *port = slot->port;
struct scatterlist *sg_req, *sg_resp; struct scatterlist *sg_req, *sg_resp;
struct hisi_sas_device *sas_dev = device->lldd_dev; struct hisi_sas_device *sas_dev = device->lldd_dev;
...@@ -2188,7 +2188,7 @@ slot_complete_v2_hw(struct hisi_hba *hisi_hba, struct hisi_sas_slot *slot) ...@@ -2188,7 +2188,7 @@ slot_complete_v2_hw(struct hisi_hba *hisi_hba, struct hisi_sas_slot *slot)
{ {
struct sas_task *task = slot->task; struct sas_task *task = slot->task;
struct hisi_sas_device *sas_dev; struct hisi_sas_device *sas_dev;
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
struct task_status_struct *ts; struct task_status_struct *ts;
struct domain_device *device; struct domain_device *device;
enum exec_status sts; enum exec_status sts;
...@@ -2486,7 +2486,7 @@ static int phy_up_v2_hw(int phy_no, struct hisi_hba *hisi_hba) ...@@ -2486,7 +2486,7 @@ static int phy_up_v2_hw(int phy_no, struct hisi_hba *hisi_hba)
u32 port_id, link_rate, hard_phy_linkrate; u32 port_id, link_rate, hard_phy_linkrate;
struct hisi_sas_phy *phy = &hisi_hba->phy[phy_no]; struct hisi_sas_phy *phy = &hisi_hba->phy[phy_no];
struct asd_sas_phy *sas_phy = &phy->sas_phy; struct asd_sas_phy *sas_phy = &phy->sas_phy;
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
u32 *frame_rcvd = (u32 *)sas_phy->frame_rcvd; u32 *frame_rcvd = (u32 *)sas_phy->frame_rcvd;
struct sas_identify_frame *id = (struct sas_identify_frame *)frame_rcvd; struct sas_identify_frame *id = (struct sas_identify_frame *)frame_rcvd;
...@@ -2673,7 +2673,7 @@ static void phy_bcast_v2_hw(int phy_no, struct hisi_hba *hisi_hba) ...@@ -2673,7 +2673,7 @@ static void phy_bcast_v2_hw(int phy_no, struct hisi_hba *hisi_hba)
static irqreturn_t int_chnl_int_v2_hw(int irq_no, void *p) static irqreturn_t int_chnl_int_v2_hw(int irq_no, void *p)
{ {
struct hisi_hba *hisi_hba = p; struct hisi_hba *hisi_hba = p;
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
u32 ent_msk, ent_tmp, irq_msk; u32 ent_msk, ent_tmp, irq_msk;
int phy_no = 0; int phy_no = 0;
...@@ -2733,7 +2733,7 @@ static irqreturn_t int_chnl_int_v2_hw(int irq_no, void *p) ...@@ -2733,7 +2733,7 @@ static irqreturn_t int_chnl_int_v2_hw(int irq_no, void *p)
static void static void
one_bit_ecc_error_process_v2_hw(struct hisi_hba *hisi_hba, u32 irq_value) one_bit_ecc_error_process_v2_hw(struct hisi_hba *hisi_hba, u32 irq_value)
{ {
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
u32 reg_val; u32 reg_val;
if (irq_value & BIT(SAS_ECC_INTR_DQE_ECC_1B_OFF)) { if (irq_value & BIT(SAS_ECC_INTR_DQE_ECC_1B_OFF)) {
...@@ -2822,7 +2822,7 @@ static void multi_bit_ecc_error_process_v2_hw(struct hisi_hba *hisi_hba, ...@@ -2822,7 +2822,7 @@ static void multi_bit_ecc_error_process_v2_hw(struct hisi_hba *hisi_hba,
u32 irq_value) u32 irq_value)
{ {
u32 reg_val; u32 reg_val;
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
if (irq_value & BIT(SAS_ECC_INTR_DQE_ECC_MB_OFF)) { if (irq_value & BIT(SAS_ECC_INTR_DQE_ECC_MB_OFF)) {
reg_val = hisi_sas_read32(hisi_hba, HGC_DQE_ECC_ADDR); reg_val = hisi_sas_read32(hisi_hba, HGC_DQE_ECC_ADDR);
...@@ -2972,7 +2972,7 @@ static irqreturn_t fatal_axi_int_v2_hw(int irq_no, void *p) ...@@ -2972,7 +2972,7 @@ static irqreturn_t fatal_axi_int_v2_hw(int irq_no, void *p)
{ {
struct hisi_hba *hisi_hba = p; struct hisi_hba *hisi_hba = p;
u32 irq_value, irq_msk, err_value; u32 irq_value, irq_msk, err_value;
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
irq_msk = hisi_sas_read32(hisi_hba, ENT_INT_SRC_MSK3); irq_msk = hisi_sas_read32(hisi_hba, ENT_INT_SRC_MSK3);
hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK3, irq_msk | 0xfffffffe); hisi_sas_write32(hisi_hba, ENT_INT_SRC_MSK3, irq_msk | 0xfffffffe);
...@@ -3148,7 +3148,7 @@ static irqreturn_t sata_int_v2_hw(int irq_no, void *p) ...@@ -3148,7 +3148,7 @@ static irqreturn_t sata_int_v2_hw(int irq_no, void *p)
struct hisi_sas_phy *phy = p; struct hisi_sas_phy *phy = p;
struct hisi_hba *hisi_hba = phy->hisi_hba; struct hisi_hba *hisi_hba = phy->hisi_hba;
struct asd_sas_phy *sas_phy = &phy->sas_phy; struct asd_sas_phy *sas_phy = &phy->sas_phy;
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
struct hisi_sas_initial_fis *initial_fis; struct hisi_sas_initial_fis *initial_fis;
struct dev_to_host_fis *fis; struct dev_to_host_fis *fis;
u32 ent_tmp, ent_msk, ent_int, port_id, link_rate, hard_phy_linkrate; u32 ent_tmp, ent_msk, ent_int, port_id, link_rate, hard_phy_linkrate;
...@@ -3250,7 +3250,7 @@ static irq_handler_t fatal_interrupts[HISI_SAS_FATAL_INT_NR] = { ...@@ -3250,7 +3250,7 @@ static irq_handler_t fatal_interrupts[HISI_SAS_FATAL_INT_NR] = {
*/ */
static int interrupt_init_v2_hw(struct hisi_hba *hisi_hba) static int interrupt_init_v2_hw(struct hisi_hba *hisi_hba)
{ {
struct platform_device *pdev = hisi_hba->pdev; struct platform_device *pdev = hisi_hba->platform_dev;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
int i, irq, rc, irq_map[128]; int i, irq, rc, irq_map[128];
...@@ -3364,7 +3364,7 @@ static int hisi_sas_v2_init(struct hisi_hba *hisi_hba) ...@@ -3364,7 +3364,7 @@ static int hisi_sas_v2_init(struct hisi_hba *hisi_hba)
static void interrupt_disable_v2_hw(struct hisi_hba *hisi_hba) static void interrupt_disable_v2_hw(struct hisi_hba *hisi_hba)
{ {
struct platform_device *pdev = hisi_hba->pdev; struct platform_device *pdev = hisi_hba->platform_dev;
int i; int i;
for (i = 0; i < hisi_hba->queue_count; i++) for (i = 0; i < hisi_hba->queue_count; i++)
...@@ -3386,7 +3386,7 @@ static void interrupt_disable_v2_hw(struct hisi_hba *hisi_hba) ...@@ -3386,7 +3386,7 @@ static void interrupt_disable_v2_hw(struct hisi_hba *hisi_hba)
static int soft_reset_v2_hw(struct hisi_hba *hisi_hba) static int soft_reset_v2_hw(struct hisi_hba *hisi_hba)
{ {
struct device *dev = &hisi_hba->pdev->dev; struct device *dev = hisi_hba->dev;
u32 old_state, state; u32 old_state, state;
int rc, cnt; int rc, cnt;
int phy_no; int phy_no;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册