arch/x86/kernel/apm_32.c

Source file repositories/reference/linux-study-clean/arch/x86/kernel/apm_32.c

File Facts

System
Linux kernel
Corpus path
arch/x86/kernel/apm_32.c
Extension
.c
Size
69702 bytes
Lines
2410
Domain
Architecture Layer
Bucket
arch/x86
Inferred role
Architecture Layer: operation-table or driver-model contract
Status
pattern implementation candidate

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

static const struct file_operations apm_bios_fops = {
	.owner		= THIS_MODULE,
	.read		= do_read,
	.poll		= do_poll,
	.unlocked_ioctl	= do_ioctl,
	.open		= do_open,
	.release	= do_release,
	.llseek		= noop_llseek,
};

static struct miscdevice apm_device = {
	APM_MINOR_DEV,
	"apm_bios",
	&apm_bios_fops
};


/* Simple "print if true" callback */
static int __init print_if_true(const struct dmi_system_id *d)
{
	printk("%s\n", d->ident);
	return 0;
}

/*
 * Some Bioses enable the PS/2 mouse (touchpad) at resume, even if it was
 * disabled before the suspend. Linux used to get terribly confused by that.
 */
static int __init broken_ps2_resume(const struct dmi_system_id *d)
{
	printk(KERN_INFO "%s machine detected. Mousepad Resume Bug "
	       "workaround hopefully not needed.\n", d->ident);
	return 0;
}

/* Some bioses have a broken protected mode poweroff and need to use realmode */
static int __init set_realmode_power_off(const struct dmi_system_id *d)
{
	if (apm_info.realmode_power_off == 0) {
		apm_info.realmode_power_off = 1;
		printk(KERN_INFO "%s bios detected. "
		       "Using realmode poweroff only.\n", d->ident);
	}
	return 0;
}

/* Some laptops require interrupts to be enabled during APM calls */
static int __init set_apm_ints(const struct dmi_system_id *d)
{
	if (apm_info.allow_ints == 0) {
		apm_info.allow_ints = 1;
		printk(KERN_INFO "%s machine detected. "
		       "Enabling interrupts during APM calls.\n", d->ident);
	}
	return 0;
}

/* Some APM bioses corrupt memory or just plain do not work */
static int __init apm_is_horked(const struct dmi_system_id *d)
{
	if (apm_info.disabled == 0) {
		apm_info.disabled = 1;
		printk(KERN_INFO "%s machine detected. "
		       "Disabling APM.\n", d->ident);
	}
	return 0;
}

static int __init apm_is_horked_d850md(const struct dmi_system_id *d)
{
	if (apm_info.disabled == 0) {
		apm_info.disabled = 1;
		printk(KERN_INFO "%s machine detected. "
		       "Disabling APM.\n", d->ident);
		printk(KERN_INFO "This bug is fixed in bios P15 which is available for\n");
		printk(KERN_INFO "download from support.intel.com\n");
	}
	return 0;
}

/* Some APM bioses hang on APM idle calls */
static int __init apm_likes_to_melt(const struct dmi_system_id *d)
{
	if (apm_info.forbid_idle == 0) {
		apm_info.forbid_idle = 1;
		printk(KERN_INFO "%s machine detected. "
		       "Disabling APM idle calls.\n", d->ident);
	}
	return 0;
}

Annotation

Implementation Notes