drivers/misc/mei/hw-txe.c
Source file repositories/reference/linux-study-clean/drivers/misc/mei/hw-txe.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/misc/mei/hw-txe.c- Extension
.c- Size
- 29784 bytes
- Lines
- 1212
- Domain
- Driver Families
- Bucket
- drivers/misc
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/pci.hlinux/jiffies.hlinux/ktime.hlinux/delay.hlinux/kthread.hlinux/interrupt.hlinux/pm_runtime.hlinux/mei.hmei_dev.hhw-txe.hclient.hhbm.hmei-trace.h
Detected Declarations
function Copyrightfunction mei_txe_reg_writefunction mei_txe_sec_reg_read_silentfunction mei_txe_sec_reg_readfunction mei_txe_sec_reg_write_silentfunction mei_txe_sec_reg_writefunction mei_txe_br_reg_readfunction mei_txe_br_reg_writefunction mei_txe_aliveness_setfunction mei_txe_aliveness_req_getfunction mei_txe_aliveness_getfunction mei_txe_aliveness_pollfunction mei_txe_aliveness_waitfunction mei_txe_aliveness_set_syncfunction mei_txe_pg_in_transitionfunction mei_txe_pg_is_enabledfunction mei_txe_pg_statefunction mei_txe_input_ready_interrupt_enablefunction mei_txe_input_doorbell_setfunction mei_txe_output_ready_setfunction mei_txe_is_input_readyfunction mei_txe_intr_clearfunction mei_txe_intr_disablefunction mei_txe_intr_enablefunction mei_txe_synchronize_irqfunction mei_txe_pending_interruptsfunction mei_txe_input_payload_writefunction mei_txe_out_data_readfunction mei_txe_readiness_set_host_rdyfunction mei_txe_readiness_clearfunction mei_txe_readiness_getfunction mei_txe_readiness_is_sec_rdyfunction mei_txe_hw_is_readyfunction mei_txe_host_is_readyfunction mei_txe_readiness_waitfunction mei_txe_fw_statusfunction mei_txe_hw_configfunction mei_txe_writefunction mei_txe_hbuf_depthfunction mei_txe_hbuf_empty_slotsfunction mei_txe_count_full_read_slotsfunction mei_txe_read_hdrfunction mei_txe_readfunction mei_txe_hw_resetfunction mei_txe_hw_startfunction mei_txe_check_and_ack_intrsfunction mei_txe_irq_quick_handlerfunction mei_txe_irq_thread_handler
Annotated Snippet
if (hw->aliveness == expected) {
dev->pg_event = MEI_PG_EVENT_IDLE;
dev_dbg(&dev->dev, "aliveness settled after %lld usecs\n",
ktime_to_us(ktime_sub(ktime_get(), start)));
return 0;
}
usleep_range(20, 50);
} while (ktime_before(ktime_get(), stop));
dev->pg_event = MEI_PG_EVENT_IDLE;
dev_err(&dev->dev, "aliveness timed out\n");
return -ETIME;
}
/**
* mei_txe_aliveness_wait - waits for aliveness to settle
*
* @dev: the device structure
* @expected: expected aliveness value
*
* Waits for HICR_HOST_ALIVENESS_RESP.ALIVENESS_RESP to be set
*
* Return: 0 on success and < 0 otherwise
*/
static int mei_txe_aliveness_wait(struct mei_device *dev, u32 expected)
{
struct mei_txe_hw *hw = to_txe_hw(dev);
const unsigned long timeout =
msecs_to_jiffies(SEC_ALIVENESS_WAIT_TIMEOUT);
long err;
int ret;
hw->aliveness = mei_txe_aliveness_get(dev);
if (hw->aliveness == expected)
return 0;
mutex_unlock(&dev->device_lock);
err = wait_event_timeout(hw->wait_aliveness_resp,
dev->pg_event == MEI_PG_EVENT_RECEIVED, timeout);
mutex_lock(&dev->device_lock);
hw->aliveness = mei_txe_aliveness_get(dev);
ret = hw->aliveness == expected ? 0 : -ETIME;
if (ret)
dev_warn(&dev->dev, "aliveness timed out = %ld aliveness = %d event = %d\n",
err, hw->aliveness, dev->pg_event);
else
dev_dbg(&dev->dev, "aliveness settled after = %d msec aliveness = %d event = %d\n",
jiffies_to_msecs(timeout - err),
hw->aliveness, dev->pg_event);
dev->pg_event = MEI_PG_EVENT_IDLE;
return ret;
}
/**
* mei_txe_aliveness_set_sync - sets an wait for aliveness to complete
*
* @dev: the device structure
* @req: requested aliveness value
*
* Return: 0 on success and < 0 otherwise
*/
int mei_txe_aliveness_set_sync(struct mei_device *dev, u32 req)
{
if (mei_txe_aliveness_set(dev, req))
return mei_txe_aliveness_wait(dev, req);
return 0;
}
/**
* mei_txe_pg_in_transition - is device now in pg transition
*
* @dev: the device structure
*
* Return: true if in pg transition, false otherwise
*/
static bool mei_txe_pg_in_transition(struct mei_device *dev)
{
return dev->pg_event == MEI_PG_EVENT_WAIT;
}
/**
* mei_txe_pg_is_enabled - detect if PG is supported by HW
*
* @dev: the device structure
*
* Return: true is pg supported, false otherwise
*/
Annotation
- Immediate include surface: `linux/pci.h`, `linux/jiffies.h`, `linux/ktime.h`, `linux/delay.h`, `linux/kthread.h`, `linux/interrupt.h`, `linux/pm_runtime.h`, `linux/mei.h`.
- Detected declarations: `function Copyright`, `function mei_txe_reg_write`, `function mei_txe_sec_reg_read_silent`, `function mei_txe_sec_reg_read`, `function mei_txe_sec_reg_write_silent`, `function mei_txe_sec_reg_write`, `function mei_txe_br_reg_read`, `function mei_txe_br_reg_write`, `function mei_txe_aliveness_set`, `function mei_txe_aliveness_req_get`.
- Atlas domain: Driver Families / drivers/misc.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.