tools/power/x86/intel-speed-select/isst-core-mbox.c
Source file repositories/reference/linux-study-clean/tools/power/x86/intel-speed-select/isst-core-mbox.c
File Facts
- System
- Linux kernel
- Corpus path
tools/power/x86/intel-speed-select/isst-core-mbox.c- Extension
.c- Size
- 26404 bytes
- Lines
- 1068
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
isst.h
Detected Declarations
function mbox_get_disp_freq_multiplierfunction mbox_get_trl_max_levelsfunction mbox_update_platform_paramfunction mbox_is_punit_validfunction _send_mmio_commandfunction _send_mbox_commandfunction mbox_read_pm_configfunction mbox_get_config_levelsfunction mbox_get_ctdp_controlfunction _get_uncore_p0_p1_infofunction _set_uncore_min_maxfunction mbox_adjust_uncore_freqfunction _get_p1_infofunction _get_uncore_mem_freqfunction mbox_get_tdp_infofunction mbox_get_pwr_infofunction mbox_get_coremask_infofunction mbox_get_get_trlfunction mbox_get_get_trlsfunction mbox_get_trl_bucket_infofunction mbox_set_tdp_levelfunction mbox_get_pbf_infofunction mbox_set_pbf_fact_statusfunction _get_fact_bucket_infofunction mbox_get_fact_infofunction mbox_get_clos_informationfunction _write_pm_configfunction mbox_pm_qos_configfunction mbox_pm_get_closfunction mbox_set_closfunction mbox_clos_get_assoc_statusfunction mbox_clos_associate
Annotated Snippet
switch (level) {
case 0:
return "sse";
case 1:
return "avx2";
case 2:
return "avx512";
default:
return NULL;
}
}
static void mbox_update_platform_param(enum isst_platform_param param, int value)
{
switch (param) {
case ISST_PARAM_MBOX_DELAY:
mbox_delay = value;
break;
case ISST_PARAM_MBOX_RETRIES:
mbox_retries = value;
break;
default:
break;
}
}
static int mbox_is_punit_valid(struct isst_id *id)
{
if (id->cpu < 0)
return 0;
if (id->pkg < 0 || id->die < 0 || id->punit)
return 0;
return 1;
}
static int _send_mmio_command(unsigned int cpu, unsigned int reg, int write,
unsigned int *value)
{
struct isst_if_io_regs io_regs;
const char *pathname = "/dev/isst_interface";
int cmd;
FILE *outf = get_output_file();
int fd;
debug_printf("mmio_cmd cpu:%d reg:%d write:%d\n", cpu, reg, write);
fd = open(pathname, O_RDWR);
if (fd < 0)
err(-1, "%s open failed", pathname);
io_regs.req_count = 1;
io_regs.io_reg[0].logical_cpu = cpu;
io_regs.io_reg[0].reg = reg;
cmd = ISST_IF_IO_CMD;
if (write) {
io_regs.io_reg[0].read_write = 1;
io_regs.io_reg[0].value = *value;
} else {
io_regs.io_reg[0].read_write = 0;
}
if (ioctl(fd, cmd, &io_regs) == -1) {
if (errno == ENOTTY) {
perror("ISST_IF_IO_COMMAND\n");
fprintf(stderr, "Check presence of kernel modules: isst_if_mmio\n");
exit(0);
}
fprintf(outf, "Error: mmio_cmd cpu:%d reg:%x read_write:%x\n",
cpu, reg, write);
} else {
if (!write)
*value = io_regs.io_reg[0].value;
debug_printf(
"mmio_cmd response: cpu:%d reg:%x rd_write:%x resp:%x\n",
cpu, reg, write, *value);
}
close(fd);
return 0;
}
int _send_mbox_command(unsigned int cpu, unsigned char command,
unsigned char sub_command, unsigned int parameter,
unsigned int req_data, unsigned int *resp)
{
const char *pathname = "/dev/isst_interface";
Annotation
- Immediate include surface: `isst.h`.
- Detected declarations: `function mbox_get_disp_freq_multiplier`, `function mbox_get_trl_max_levels`, `function mbox_update_platform_param`, `function mbox_is_punit_valid`, `function _send_mmio_command`, `function _send_mbox_command`, `function mbox_read_pm_config`, `function mbox_get_config_levels`, `function mbox_get_ctdp_control`, `function _get_uncore_p0_p1_info`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
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.