mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-08-21 16:31:14 +02:00

Starting from the Lunar Lake generation, the ISH firmware has been divided into two components for better space optimization and increased flexibility. These components include a bootloader that is integrated into the BIOS, and a main firmware that is stored within the operating system's file system. Introduce support for loading ISH main firmware from host. This feature is applicable for Lunar Lake and later generation. Current intel-ishtp-loader, is designed for Chrome OS based systems which uses core boot and has different firmware loading method. For non chrome systems the ISH firmware loading uses different method. Key differences include: 1. The new method utilizes ISHTP capability/fixed client to enumerate the firmware loader function. It does not require a connection or flow control, unlike the method used in Chrome OS, which is enumerated as an ISHTP dynamic client driver, necessitating connect/disconnect operations and flow control. 2. The new method employs a table to describe firmware fragments, which are sent to ISH in a single operation. Conversely, the Chrome OS method sends firmware fragments in multiple operations within a loop, sending only one fragment at a time. Additionally, address potential error scenarios to ensure graceful failure handling. - Firmware Not Found: Triggers if request_firmware() fails, leaving ISH in a waiting state. Recovery: Re-insmod the ISH drivers to retry. - DMA Buffer Allocation Failure: Occurs during prepare_dma_bufs(), leading to ISH waiting state. Allocated resources are released. Recovery: Re-insmod the ISH drivers to retry. - Incorrect Firmware Image: Causes ISH to refuse loading after three failed attempts. Recovery: A platform reset is required. Please refer to the [Documentation](Documentation/hid/intel-ish-hid.rst) for the details on flows. Signed-off-by: Zhang Lixu <lixu.zhang@intel.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
115 lines
2.8 KiB
C
115 lines
2.8 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* Initialization protocol for ISHTP driver
|
|
*
|
|
* Copyright (c) 2003-2016, Intel Corporation.
|
|
*/
|
|
|
|
#include <linux/devm-helpers.h>
|
|
#include <linux/export.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/sched.h>
|
|
#include "ishtp-dev.h"
|
|
#include "hbm.h"
|
|
#include "client.h"
|
|
#include "loader.h"
|
|
|
|
/**
|
|
* ishtp_dev_state_str() -Convert to string format
|
|
* @state: state to convert
|
|
*
|
|
* Convert state to string for prints
|
|
*
|
|
* Return: character pointer to converted string
|
|
*/
|
|
const char *ishtp_dev_state_str(int state)
|
|
{
|
|
switch (state) {
|
|
case ISHTP_DEV_INITIALIZING:
|
|
return "INITIALIZING";
|
|
case ISHTP_DEV_INIT_CLIENTS:
|
|
return "INIT_CLIENTS";
|
|
case ISHTP_DEV_ENABLED:
|
|
return "ENABLED";
|
|
case ISHTP_DEV_RESETTING:
|
|
return "RESETTING";
|
|
case ISHTP_DEV_DISABLED:
|
|
return "DISABLED";
|
|
case ISHTP_DEV_POWER_DOWN:
|
|
return "POWER_DOWN";
|
|
case ISHTP_DEV_POWER_UP:
|
|
return "POWER_UP";
|
|
default:
|
|
return "unknown";
|
|
}
|
|
}
|
|
|
|
/**
|
|
* ishtp_device_init() - ishtp device init
|
|
* @dev: ISHTP device instance
|
|
*
|
|
* After ISHTP device is alloacted, this function is used to initialize
|
|
* each field which includes spin lock, work struct and lists
|
|
*/
|
|
void ishtp_device_init(struct ishtp_device *dev)
|
|
{
|
|
int ret;
|
|
|
|
dev->dev_state = ISHTP_DEV_INITIALIZING;
|
|
INIT_LIST_HEAD(&dev->cl_list);
|
|
INIT_LIST_HEAD(&dev->device_list);
|
|
dev->rd_msg_fifo_head = 0;
|
|
dev->rd_msg_fifo_tail = 0;
|
|
spin_lock_init(&dev->rd_msg_spinlock);
|
|
|
|
init_waitqueue_head(&dev->wait_hbm_recvd_msg);
|
|
init_waitqueue_head(&dev->wait_loader_recvd_msg);
|
|
spin_lock_init(&dev->read_list_spinlock);
|
|
spin_lock_init(&dev->device_lock);
|
|
spin_lock_init(&dev->device_list_lock);
|
|
spin_lock_init(&dev->cl_list_lock);
|
|
spin_lock_init(&dev->fw_clients_lock);
|
|
INIT_WORK(&dev->bh_hbm_work, bh_hbm_work_fn);
|
|
|
|
bitmap_zero(dev->host_clients_map, ISHTP_CLIENTS_MAX);
|
|
dev->open_handle_count = 0;
|
|
|
|
/*
|
|
* Reserving client ID 0 for ISHTP Bus Message communications
|
|
*/
|
|
bitmap_set(dev->host_clients_map, 0, 1);
|
|
|
|
INIT_LIST_HEAD(&dev->read_list.list);
|
|
|
|
ret = devm_work_autocancel(dev->devc, &dev->work_fw_loader, ishtp_loader_work);
|
|
if (ret)
|
|
dev_err_probe(dev->devc, ret, "Failed to initialise FW loader work\n");
|
|
}
|
|
EXPORT_SYMBOL(ishtp_device_init);
|
|
|
|
/**
|
|
* ishtp_start() - Start ISH processing
|
|
* @dev: ISHTP device instance
|
|
*
|
|
* Start ISHTP processing by sending query subscriber message
|
|
*
|
|
* Return: 0 on success else -ENODEV
|
|
*/
|
|
int ishtp_start(struct ishtp_device *dev)
|
|
{
|
|
if (ishtp_hbm_start_wait(dev)) {
|
|
dev_err(dev->devc, "HBM haven't started");
|
|
goto err;
|
|
}
|
|
|
|
/* suspend & resume notification - send QUERY_SUBSCRIBERS msg */
|
|
ishtp_query_subscribers(dev);
|
|
|
|
return 0;
|
|
err:
|
|
dev_err(dev->devc, "link layer initialization failed.\n");
|
|
dev->dev_state = ISHTP_DEV_DISABLED;
|
|
return -ENODEV;
|
|
}
|
|
EXPORT_SYMBOL(ishtp_start);
|