Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:arch\x86\kernel\apm_32.c Create Date:2022-07-28 08:22:53
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Just start the APM thread. We do NOT want to do APM BIOS* calls from anything but the APM thread, if for no other reason* than the fact that we don't trust the APM BIOS. This way,* most common APM BIOS problems that lead to protection errors

Proto:static int __init apm_init(void)

Type:int

Parameter:Nothing

2257  dmi_check_system(apm_dmi_table)
2259  If version == 0 || machine_is_olpc() Then
2260  printk(formational "apm: BIOS not found.\n")
2261  Return -ENODEV
2263  printk(formational "apm: BIOS version %d.%d Flags 0x%02x (Driver version %s)\n", ((version >> 8) & 0xff), (version & 0xff), flags, spaces )
2269  If (flags & APM_32_BIT_SUPPORT) == 0 Then
2270  printk(formational "apm: no 32 bit BIOS support\n")
2271  Return -ENODEV
2274  If allow_ints Then allow_ints = 1
2276  If broken_psr Then get_power_status_broken = 1
2278  If realmode_power_off Then realmode_power_off = 1
2281  If apm_disabled != -1 Then disabled = apm_disabled
2288  If version == 0x001 Then version = 0x100
2292  If version < 0x102 Then cseg_16_len = 0
2295  If debug Then
2296  printk(formational "apm: entry %x:%x cseg16 %x dseg %x", cseg, offset, cseg_16, dseg)
2299  If version > 0x100 Then printk(" cseg len %x, dseg len %x", cseg_len, dseg_len)
2303  If version > 0x101 Then printk(" cseg16 len %x", cseg_16_len)
2305  printk("\n")
2308  If disabled Then
2309  pr_notice("disabled on user request.\n")
2310  Return -ENODEV
2312  If num_online_cpus() > 1 && Not power_off && Not smp Then
2313  pr_notice("disabled - APM is not SMP safe.\n")
2314  disabled = 1
2315  Return -ENODEV
2317  If Not acpi_disabled Then
2318  pr_notice("overridden by ACPI.\n")
2319  disabled = 1
2320  Return -ENODEV
2327  offset = offset
2328  segment = APM_CS
2340  gdt = Provide the original GDT
2341  set_desc_base( & gdt[APM_CS >> 3], (unsignedlong)__va((unsignedlong)cseg << 4))
2343  set_desc_base( & gdt[APM_CS_16 >> 3], (unsignedlong)__va((unsignedlong)cseg_16 << 4))
2345  set_desc_base( & gdt[APM_DS >> 3], (unsignedlong)__va((unsignedlong)dseg << 4))
2348  proc_create_single("apm", 0, NULL, proc_apm_show)
2350  kapmd_task = Create kernel thread(apm, NULL, "kapmd")
2351  If IS_ERR(kapmd_task) Then
2352  pr_err("disabled - Unable to start kernel thread\n")
2353  err = PTR_ERR(kapmd_task)
2354  kapmd_task = NULL
2355  remove_proc_entry("apm", NULL)
2356  Return err
2358  wake_up_process(kapmd_task)
2360  If num_online_cpus() > 1 && Not smp Then
2361  printk(rmal but significant condition "apm: disabled - APM is not SMP safe (power off active).\n")
2363  Return 0
2371  If register a miscellaneous device Then printk(warning conditions "apm: Could not register misc device.\n")
2374  If HZ != 100 Then idle_period = idle_period * HZ / 100
2376  If idle_threshold < 100 Then
2377  cpuidle_poll_state_init( & apm_idle_driver)
2378  If Not cpuidle_register_driver( & apm_idle_driver) Then If cpuidle_register_device( & apm_cpuidle_device) Then
2380  cpuidle_unregister_driver( & apm_idle_driver)
2383  Return 0