drivers/platform/x86/dell/dcdbas.c
Source file repositories/reference/linux-study-clean/drivers/platform/x86/dell/dcdbas.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/platform/x86/dell/dcdbas.c- Extension
.c- Size
- 19189 bytes
- Lines
- 782
- Domain
- Driver Families
- Bucket
- drivers/platform
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/platform_device.hlinux/acpi.hlinux/dma-mapping.hlinux/dmi.hlinux/errno.hlinux/cpu.hlinux/gfp.hlinux/init.hlinux/io.hlinux/kernel.hlinux/mc146818rtc.hlinux/module.hlinux/reboot.hlinux/sched.hlinux/smp.hlinux/spinlock.hlinux/string.hlinux/sysfs.hlinux/types.hlinux/mutex.hdcdbas.h
Detected Declarations
function dcdbas_smi_allocfunction dcdbas_smi_freefunction smi_data_buf_freefunction smi_data_buf_reallocfunction smi_data_buf_phys_addr_showfunction smi_data_buf_size_showfunction smi_data_buf_size_storefunction smi_data_readfunction smi_data_writefunction host_control_action_showfunction host_control_action_storefunction host_control_smi_type_showfunction host_control_smi_type_storefunction host_control_on_shutdown_showfunction host_control_on_shutdown_storefunction raise_smifunction dcdbas_smi_requestfunction smi_request_storefunction host_control_smifunction dcdbas_host_controlfunction checksumfunction dcdbas_check_wsmtfunction dcdbas_reboot_notifyfunction dcdbas_probefunction dcdbas_removefunction dcdbas_initfunction dcdbas_exitexport dcdbas_smi_allocexport dcdbas_smi_freeexport dcdbas_smi_request
Annotated Snippet
while ((s8)inb(PCAT_APM_STATUS_PORT) == ESM_STATUS_CMD_UNSUCCESSFUL) {
num_ticks--;
if (num_ticks == EXPIRED_TIMER)
return -ETIME;
}
break;
case HC_SMITYPE_TYPE2:
case HC_SMITYPE_TYPE3:
spin_lock_irqsave(&rtc_lock, flags);
/* write SMI data buffer physical address */
data = (u8 *)&smi_buf.dma;
for (index = PE1400_CMOS_CMD_STRUCT_PTR;
index < (PE1400_CMOS_CMD_STRUCT_PTR + 4);
index++, data++) {
outb(index, (CMOS_BASE_PORT + CMOS_PAGE1_INDEX_PORT));
outb(*data, (CMOS_BASE_PORT + CMOS_PAGE1_DATA_PORT));
}
/* generate SMM call */
if (host_control_smi_type == HC_SMITYPE_TYPE3)
outb(ESM_APM_CMD, PCAT_APM_CONTROL_PORT);
else
outb(ESM_APM_CMD, PE1400_APM_CONTROL_PORT);
/* restore RTC index pointer since it was written to above */
CMOS_READ(RTC_REG_C);
spin_unlock_irqrestore(&rtc_lock, flags);
/* read control port back to serialize write */
cmd_status = inb(PE1400_APM_CONTROL_PORT);
/* wait a few to see if it executed */
num_ticks = TIMEOUT_USEC_SHORT_SEMA_BLOCKING;
while (apm_cmd->status == ESM_STATUS_CMD_UNSUCCESSFUL) {
num_ticks--;
if (num_ticks == EXPIRED_TIMER)
return -ETIME;
}
break;
default:
dev_dbg(&dcdbas_pdev->dev, "%s: invalid SMI type %u\n",
__func__, host_control_smi_type);
return -ENOSYS;
}
return 0;
}
/**
* dcdbas_host_control: initiate host control
*
* This function is called by the driver after the system has
* finished shutting down if the user application specified a
* host control action to perform on shutdown. It is safe to
* use smi_buf.virt at this point because the system has finished
* shutting down and no userspace apps are running.
*/
static void dcdbas_host_control(void)
{
struct apm_cmd *apm_cmd;
u8 action;
if (host_control_action == HC_ACTION_NONE)
return;
action = host_control_action;
host_control_action = HC_ACTION_NONE;
if (!smi_buf.virt) {
dev_dbg(&dcdbas_pdev->dev, "%s: no SMI buffer\n", __func__);
return;
}
if (smi_buf.size < sizeof(struct apm_cmd)) {
dev_dbg(&dcdbas_pdev->dev, "%s: SMI buffer too small\n",
__func__);
return;
}
apm_cmd = (struct apm_cmd *)smi_buf.virt;
/* power off takes precedence */
if (action & HC_ACTION_HOST_CONTROL_POWEROFF) {
apm_cmd->command = ESM_APM_POWER_CYCLE;
apm_cmd->reserved = 0;
*((s16 *)&apm_cmd->parameters.shortreq.parm[0]) = (s16) 0;
host_control_smi();
} else if (action & HC_ACTION_HOST_CONTROL_POWERCYCLE) {
Annotation
- Immediate include surface: `linux/platform_device.h`, `linux/acpi.h`, `linux/dma-mapping.h`, `linux/dmi.h`, `linux/errno.h`, `linux/cpu.h`, `linux/gfp.h`, `linux/init.h`.
- Detected declarations: `function dcdbas_smi_alloc`, `function dcdbas_smi_free`, `function smi_data_buf_free`, `function smi_data_buf_realloc`, `function smi_data_buf_phys_addr_show`, `function smi_data_buf_size_show`, `function smi_data_buf_size_store`, `function smi_data_read`, `function smi_data_write`, `function host_control_action_show`.
- Atlas domain: Driver Families / drivers/platform.
- Implementation status: integration 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.