misc: mic: Remove COSM functionality from the MIC host driver
Since COSM functionality is now moved into a separate COSM driver drivers, this patch removes this functionality from the base MIC host driver. The MIC host driver now implements cosm_hw_ops and registers a COSM device which allows the COSM driver to trigger boot/shutdown/reset of the MIC devices via the cosm_hw_ops. Reviewed-by: Nikhil Rao <nikhil.rao@intel.com> Reviewed-by: Sudeep Dutt <sudeep.dutt@intel.com> Signed-off-by: Dasaratharaman Chandramouli <dasaratharaman.chandramouli@intel.com> Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

부모
7cb46d9bff
커밋
1da2b3eeef
@@ -43,7 +43,7 @@
|
||||
static void
|
||||
mic_x100_write_spad(struct mic_device *mdev, unsigned int idx, u32 val)
|
||||
{
|
||||
dev_dbg(mdev->sdev->parent, "Writing 0x%x to scratch pad index %d\n",
|
||||
dev_dbg(&mdev->pdev->dev, "Writing 0x%x to scratch pad index %d\n",
|
||||
val, idx);
|
||||
mic_mmio_write(&mdev->mmio, val,
|
||||
MIC_X100_SBOX_BASE_ADDRESS +
|
||||
@@ -66,7 +66,7 @@ mic_x100_read_spad(struct mic_device *mdev, unsigned int idx)
|
||||
MIC_X100_SBOX_BASE_ADDRESS +
|
||||
MIC_X100_SBOX_SPAD0 + idx * 4);
|
||||
|
||||
dev_dbg(mdev->sdev->parent,
|
||||
dev_dbg(&mdev->pdev->dev,
|
||||
"Reading 0x%x from scratch pad index %d\n", val, idx);
|
||||
return val;
|
||||
}
|
||||
@@ -126,7 +126,7 @@ static void mic_x100_disable_interrupts(struct mic_device *mdev)
|
||||
* @mdev: pointer to mic_device instance
|
||||
*/
|
||||
static void mic_x100_send_sbox_intr(struct mic_device *mdev,
|
||||
int doorbell)
|
||||
int doorbell)
|
||||
{
|
||||
struct mic_mw *mw = &mdev->mmio;
|
||||
u64 apic_icr_offset = MIC_X100_SBOX_APICICR0 + doorbell * 8;
|
||||
@@ -147,7 +147,7 @@ static void mic_x100_send_sbox_intr(struct mic_device *mdev,
|
||||
* @mdev: pointer to mic_device instance
|
||||
*/
|
||||
static void mic_x100_send_rdmasr_intr(struct mic_device *mdev,
|
||||
int doorbell)
|
||||
int doorbell)
|
||||
{
|
||||
int rdmasr_offset = MIC_X100_SBOX_RDMASR0 + (doorbell << 2);
|
||||
/* Ensure that the interrupt is ordered w.r.t. previous stores. */
|
||||
@@ -359,15 +359,14 @@ mic_x100_load_command_line(struct mic_device *mdev, const struct firmware *fw)
|
||||
|
||||
boot_mem = mdev->aper.len >> 20;
|
||||
buf = kzalloc(CMDLINE_SIZE, GFP_KERNEL);
|
||||
if (!buf) {
|
||||
dev_err(mdev->sdev->parent,
|
||||
"%s %d allocation failed\n", __func__, __LINE__);
|
||||
if (!buf)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
len += snprintf(buf, CMDLINE_SIZE - len,
|
||||
" mem=%dM", boot_mem);
|
||||
if (mdev->cmdline)
|
||||
snprintf(buf + len, CMDLINE_SIZE - len, " %s", mdev->cmdline);
|
||||
if (mdev->cosm_dev->cmdline)
|
||||
snprintf(buf + len, CMDLINE_SIZE - len, " %s",
|
||||
mdev->cosm_dev->cmdline);
|
||||
memcpy_toio(cmd_line_va, buf, strlen(buf) + 1);
|
||||
kfree(buf);
|
||||
return 0;
|
||||
@@ -386,12 +385,11 @@ mic_x100_load_ramdisk(struct mic_device *mdev)
|
||||
int rc;
|
||||
struct boot_params __iomem *bp = mdev->aper.va + mdev->bootaddr;
|
||||
|
||||
rc = request_firmware(&fw,
|
||||
mdev->ramdisk, mdev->sdev->parent);
|
||||
rc = request_firmware(&fw, mdev->cosm_dev->ramdisk, &mdev->pdev->dev);
|
||||
if (rc < 0) {
|
||||
dev_err(mdev->sdev->parent,
|
||||
dev_err(&mdev->pdev->dev,
|
||||
"ramdisk request_firmware failed: %d %s\n",
|
||||
rc, mdev->ramdisk);
|
||||
rc, mdev->cosm_dev->ramdisk);
|
||||
goto error;
|
||||
}
|
||||
/*
|
||||
@@ -423,10 +421,10 @@ mic_x100_get_boot_addr(struct mic_device *mdev)
|
||||
|
||||
scratch2 = mdev->ops->read_spad(mdev, MIC_X100_DOWNLOAD_INFO);
|
||||
boot_addr = MIC_X100_SPAD2_DOWNLOAD_ADDR(scratch2);
|
||||
dev_dbg(mdev->sdev->parent, "%s %d boot_addr 0x%x\n",
|
||||
dev_dbg(&mdev->pdev->dev, "%s %d boot_addr 0x%x\n",
|
||||
__func__, __LINE__, boot_addr);
|
||||
if (boot_addr > (1 << 31)) {
|
||||
dev_err(mdev->sdev->parent,
|
||||
dev_err(&mdev->pdev->dev,
|
||||
"incorrect bootaddr 0x%x\n",
|
||||
boot_addr);
|
||||
rc = -EINVAL;
|
||||
@@ -454,37 +452,37 @@ mic_x100_load_firmware(struct mic_device *mdev, const char *buf)
|
||||
if (rc)
|
||||
goto error;
|
||||
/* load OS */
|
||||
rc = request_firmware(&fw, mdev->firmware, mdev->sdev->parent);
|
||||
rc = request_firmware(&fw, mdev->cosm_dev->firmware, &mdev->pdev->dev);
|
||||
if (rc < 0) {
|
||||
dev_err(mdev->sdev->parent,
|
||||
dev_err(&mdev->pdev->dev,
|
||||
"ramdisk request_firmware failed: %d %s\n",
|
||||
rc, mdev->firmware);
|
||||
rc, mdev->cosm_dev->firmware);
|
||||
goto error;
|
||||
}
|
||||
if (mdev->bootaddr > mdev->aper.len - fw->size) {
|
||||
rc = -EINVAL;
|
||||
dev_err(mdev->sdev->parent, "%s %d rc %d bootaddr 0x%x\n",
|
||||
dev_err(&mdev->pdev->dev, "%s %d rc %d bootaddr 0x%x\n",
|
||||
__func__, __LINE__, rc, mdev->bootaddr);
|
||||
release_firmware(fw);
|
||||
goto error;
|
||||
}
|
||||
memcpy_toio(mdev->aper.va + mdev->bootaddr, fw->data, fw->size);
|
||||
mdev->ops->write_spad(mdev, MIC_X100_FW_SIZE, fw->size);
|
||||
if (!strcmp(mdev->bootmode, "elf"))
|
||||
if (!strcmp(mdev->cosm_dev->bootmode, "flash"))
|
||||
goto done;
|
||||
/* load command line */
|
||||
rc = mic_x100_load_command_line(mdev, fw);
|
||||
if (rc) {
|
||||
dev_err(mdev->sdev->parent, "%s %d rc %d\n",
|
||||
dev_err(&mdev->pdev->dev, "%s %d rc %d\n",
|
||||
__func__, __LINE__, rc);
|
||||
goto error;
|
||||
}
|
||||
release_firmware(fw);
|
||||
/* load ramdisk */
|
||||
if (mdev->ramdisk)
|
||||
if (mdev->cosm_dev->ramdisk)
|
||||
rc = mic_x100_load_ramdisk(mdev);
|
||||
error:
|
||||
dev_dbg(mdev->sdev->parent, "%s %d rc %d\n", __func__, __LINE__, rc);
|
||||
dev_dbg(&mdev->pdev->dev, "%s %d rc %d\n", __func__, __LINE__, rc);
|
||||
done:
|
||||
return rc;
|
||||
}
|
||||
|
Reference in New Issue
Block a user