首页 > 代码库 > debian内核代码执行流程(二)

debian内核代码执行流程(二)

继续上一篇文章《debian内核代码执行流程(一)》未完成部分。

 

acpi_bus_init调用acpi_initialize_objects,经过一系列复杂调用后输出下面信息:

[    0.147393] ACPI: SSDT 7f5e7cc0 0030F (v01  PmRef  Cpu0Ist 00003000 INTL 20060912)[    0.147566] ACPI: Dynamic OEM Table Load:[    0.147569] ACPI: SSDT   (null) 0030F (v01  PmRef  Cpu0Ist 00003000 INTL 20060912)[    0.148012] ACPI: SSDT 7f5e81e0 001B3 (v01  PmRef  Cpu1Ist 00003000 INTL 20060912)[    0.148176] ACPI: Dynamic OEM Table Load:[    0.148178] ACPI: SSDT   (null) 001B3 (v01  PmRef  Cpu1Ist 00003000 INTL 20060912)

acpi_bus_init接着调用acpi_sysfs_init,创建/sys/firmware/acpi/tables/以及/sys/firmware/acpi/tables/dynamic

acpi_bus_init接着输出下面信息:

[    0.148366] ACPI: Interpreter enabled

acpi_bus_init接着调用acpi_sleep_init,输出下面信息:

[    0.148372] ACPI: (supports S0 S1 S4 S5)

acpi_bus_init接着调用acpi_bus_init_irq,输出下面信息:

[    0.148389] ACPI: Using IOAPIC for interrupt routing

 

drivers/acpi/dock.c中有下面代码:

subsys_initcall(dock_init);

此时执行dock_init函数,输出下面信息:

[    0.152327] ACPI: No dock devices found.

 

drivers/acpi/pci_root.c中有下面代码:

subsys_initcall(acpi_pci_root_init);

此时执行acpi_pci_root_init函数,acpi_pci_root_init调用acpi_hest_init,输出下面信息:

[    0.152329] HEST: Table not found.

acpi_pci_root_init调用pci_acpi_crs_quirks函数,输出下面信息:

[    0.152333] PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug

acpi_pci_root_init执行acpi_bus_register_driver(&acpi_pci_root_driver) ,之后经过复杂的过程后调用acpi_pci_root_add,输出下面信息:

[    0.152382] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])

 

acpi_pci_root_add调用pci_acpi_scan_root,pci_acpi_scan_root调用pci_scan_child_bus,pci_scan_child_bus调用 pcibios_fixup_bus,

pcibios_fixup_bus调用pci_read_bridge_bases,pci_read_bridge_bases分别调用pci_read_bridge_io和pci_read_bridge_mmio,输出下面信息:

[    0.152491] pci_root PNP0A08:00: host bridge window [io  0x0000-0x0cf7][    0.152494] pci_root PNP0A08:00: host bridge window [io  0x0d00-0xffff][    0.152496] pci_root PNP0A08:00: host bridge window [mem 0x000a0000-0x000bffff][    0.152498] pci_root PNP0A08:00: host bridge window [mem 0x000c0000-0x000dffff][    0.152501] pci_root PNP0A08:00: host bridge window [mem 0x7f600000-0xfebfffff]

lib/vsprintf.c中有下面的说明:

* - R For decoded struct resource, e.g., [mem 0x0-0x1f 64bit pref]

这个对应于输出信息中使用%pR的情况。

 

pci_scan_child_bus调用pci_scan_slot,pci_scan_slot调用pci_scan_single_device,

pci_scan_single_device调用pci_scan_device,pci_scan_device调用pci_setup_device,输出下面信息:

[    0.152514] pci 0000:00:00.0: [8086:29c0] type 0 class 0x000600

类似地,输出下面信息:

[    0.152556] pci 0000:00:02.0: [8086:29c2] type 0 class 0x000300

pci_setup_device调用pci_read_bases,pci_read_bases循环调用__pci_read_base,输出下面信息:

[    0.152565] pci 0000:00:02.0: reg 10: [mem 0xfdf00000-0xfdf7ffff][    0.152571] pci 0000:00:02.0: reg 14: [io  0xff00-0xff07][    0.152576] pci 0000:00:02.0: reg 18: [mem 0xd0000000-0xdfffffff pref][    0.152582] pci 0000:00:02.0: reg 1c: [mem 0xfd600000-0xfd6fffff]

类似地,输出下面信息:

[    0.152645] pci 0000:00:1b.0: [8086:27d8] type 0 class 0x000403[    0.152660] pci 0000:00:1b.0: reg 10: [mem 0xfdff8000-0xfdffbfff 64bit]

pci_scan_single_devcie调用pci_device_add, pci_device_add调用pci_init_capabilities,输出下面信息:

[    0.152723] pci 0000:00:1b.0: PME# supported from D0 D3hot D3cold

 后续还有很多输出也与前面类似:

[    0.152744] pci 0000:00:1c.0: [8086:27d0] type 1 class 0x000604[    0.152808] pci 0000:00:1c.0: PME# supported from D0 D3hot D3cold[    0.152830] pci 0000:00:1c.1: [8086:27d2] type 1 class 0x000604[    0.152894] pci 0000:00:1c.1: PME# supported from D0 D3hot D3cold[    0.152916] pci 0000:00:1c.2: [8086:27d4] type 1 class 0x000604[    0.152979] pci 0000:00:1c.2: PME# supported from D0 D3hot D3cold[    0.153001] pci 0000:00:1c.3: [8086:27d6] type 1 class 0x000604[    0.153065] pci 0000:00:1c.3: PME# supported from D0 D3hot D3cold[    0.153087] pci 0000:00:1d.0: [8086:27c8] type 0 class 0x000c03[    0.153124] pci 0000:00:1d.0: reg 20: [io  0xfe00-0xfe1f][    0.153154] pci 0000:00:1d.1: [8086:27c9] type 0 class 0x000c03[    0.153192] pci 0000:00:1d.1: reg 20: [io  0xfd00-0xfd1f][    0.153221] pci 0000:00:1d.2: [8086:27ca] type 0 class 0x000c03[    0.153258] pci 0000:00:1d.2: reg 20: [io  0xfc00-0xfc1f][    0.153287] pci 0000:00:1d.3: [8086:27cb] type 0 class 0x000c03[    0.153324] pci 0000:00:1d.3: reg 20: [io  0xfb00-0xfb1f][    0.153362] pci 0000:00:1d.7: [8086:27cc] type 0 class 0x000c03[    0.153379] pci 0000:00:1d.7: reg 10: [mem 0xfdfff000-0xfdfff3ff][    0.153455] pci 0000:00:1d.7: PME# supported from D0 D3hot D3cold[    0.153474] pci 0000:00:1e.0: [8086:244e] type 1 class 0x000604[    0.153532] pci 0000:00:1f.0: [8086:27b8] type 0 class 0x000601[    0.153609] pci 0000:00:1f.0: ICH7 LPC Generic IO decode 1 PIO at 0800 (mask 003f)[    0.153652] pci 0000:00:1f.1: [8086:27df] type 0 class 0x000101[    0.153664] pci 0000:00:1f.1: reg 10: [io  0x0000-0x0007][    0.153673] pci 0000:00:1f.1: reg 14: [io  0x0000-0x0003][    0.153681] pci 0000:00:1f.1: reg 18: [io  0x0000-0x0007][    0.153690] pci 0000:00:1f.1: reg 1c: [io  0x0000-0x0003][    0.153698] pci 0000:00:1f.1: reg 20: [io  0xfa00-0xfa0f][    0.153731] pci 0000:00:1f.2: [8086:27c0] type 0 class 0x000101[    0.153744] pci 0000:00:1f.2: reg 10: [io  0xf900-0xf907][    0.153751] pci 0000:00:1f.2: reg 14: [io  0xf800-0xf803][    0.153759] pci 0000:00:1f.2: reg 18: [io  0xf700-0xf707][    0.153767] pci 0000:00:1f.2: reg 1c: [io  0xf600-0xf603][    0.153774] pci 0000:00:1f.2: reg 20: [io  0xf500-0xf50f][    0.153806] pci 0000:00:1f.2: PME# supported from D3hot[    0.153820] pci 0000:00:1f.3: [8086:27da] type 0 class 0x000c05[    0.153868] pci 0000:00:1f.3: reg 20: [io  0x0500-0x051f][    0.153935] pci 0000:00:1c.0: PCI bridge to [bus 01-01][    0.153939] pci 0000:00:1c.0:   bridge window [io  0xb000-0xbfff][    0.153943] pci 0000:00:1c.0:   bridge window [mem 0xfde00000-0xfdefffff][    0.153949] pci 0000:00:1c.0:   bridge window [mem 0xfdd00000-0xfddfffff 64bit pref][    0.153985] pci 0000:00:1c.1: PCI bridge to [bus 02-02][    0.153988] pci 0000:00:1c.1:   bridge window [io  0xa000-0xafff][    0.153992] pci 0000:00:1c.1:   bridge window [mem 0xfdc00000-0xfdcfffff][    0.153998] pci 0000:00:1c.1:   bridge window [mem 0xfdb00000-0xfdbfffff 64bit pref][    0.154034] pci 0000:00:1c.2: PCI bridge to [bus 03-03][    0.154037] pci 0000:00:1c.2:   bridge window [io  0xe000-0xefff][    0.154041] pci 0000:00:1c.2:   bridge window [mem 0xfda00000-0xfdafffff][    0.154047] pci 0000:00:1c.2:   bridge window [mem 0xfd900000-0xfd9fffff 64bit pref][    0.154099] pci 0000:04:00.0: [10ec:8136] type 0 class 0x000200[    0.154115] pci 0000:04:00.0: reg 10: [io  0xde00-0xdeff][    0.154143] pci 0000:04:00.0: reg 18: [mem 0xfd7ff000-0xfd7fffff 64bit pref][    0.154160] pci 0000:04:00.0: reg 20: [mem 0xfd7e0000-0xfd7effff 64bit pref][    0.154172] pci 0000:04:00.0: reg 30: [mem 0x00000000-0x0001ffff pref][    0.154233] pci 0000:04:00.0: supports D1 D2[    0.154235] pci 0000:04:00.0: PME# supported from D0 D1 D2 D3hot D3cold[    0.160032] pci 0000:00:1c.3: PCI bridge to [bus 04-04][    0.160039] pci 0000:00:1c.3:   bridge window [io  0xd000-0xdfff][    0.160046] pci 0000:00:1c.3:   bridge window [mem 0xfd800000-0xfd8fffff][    0.160056] pci 0000:00:1c.3:   bridge window [mem 0xfd700000-0xfd7fffff 64bit pref][    0.160134] pci 0000:00:1e.0: PCI bridge to [bus 05-05] (subtractive decode)[    0.160141] pci 0000:00:1e.0:   bridge window [io  0xc000-0xcfff][    0.160148] pci 0000:00:1e.0:   bridge window [mem 0xfd500000-0xfd5fffff][    0.160157] pci 0000:00:1e.0:   bridge window [mem 0xfd400000-0xfd4fffff 64bit pref][    0.160162] pci 0000:00:1e.0:   bridge window [io  0x0000-0x0cf7] (subtractive decode)[    0.160167] pci 0000:00:1e.0:   bridge window [io  0x0d00-0xffff] (subtractive decode)[    0.160173] pci 0000:00:1e.0:   bridge window [mem 0x000a0000-0x000bffff] (subtractive decode)[    0.160178] pci 0000:00:1e.0:   bridge window [mem 0x000c0000-0x000dffff] (subtractive decode)[    0.160183] pci 0000:00:1e.0:   bridge window [mem 0x7f600000-0xfebfffff] (subtractive decode

其中[ 0.160134] pci 0000:00:1e.0: PCI bridge to [bus 05-05] (subtractive decode)类似的输出也是在pci_read_bridge_bases中产生的。

 

查看本机pci设备信息:

$ lspci -nn00:00.0 Host bridge [0600]: Intel Corporation 82G33/G31/P35/P31 Express DRAM Controller [8086:29c0] (rev 10)00:02.0 VGA compatible controller [0300]: Intel Corporation 82G33/G31 Express Integrated Graphics Controller [8086:29c2] (rev 10)00:1b.0 Audio device [0403]: Intel Corporation NM10/ICH7 Family High Definition Audio Controller [8086:27d8] (rev 01)00:1c.0 PCI bridge [0604]: Intel Corporation NM10/ICH7 Family PCI Express Port 1 [8086:27d0] (rev 01)00:1c.1 PCI bridge [0604]: Intel Corporation NM10/ICH7 Family PCI Express Port 2 [8086:27d2] (rev 01)00:1c.2 PCI bridge [0604]: Intel Corporation NM10/ICH7 Family PCI Express Port 3 [8086:27d4] (rev 01)00:1c.3 PCI bridge [0604]: Intel Corporation NM10/ICH7 Family PCI Express Port 4 [8086:27d6] (rev 01)00:1d.0 USB controller [0c03]: Intel Corporation NM10/ICH7 Family USB UHCI Controller #1 [8086:27c8] (rev 01)00:1d.1 USB controller [0c03]: Intel Corporation NM10/ICH7 Family USB UHCI Controller #2 [8086:27c9] (rev 01)00:1d.2 USB controller [0c03]: Intel Corporation NM10/ICH7 Family USB UHCI Controller #3 [8086:27ca] (rev 01)00:1d.3 USB controller [0c03]: Intel Corporation NM10/ICH7 Family USB UHCI Controller #4 [8086:27cb] (rev 01)00:1d.7 USB controller [0c03]: Intel Corporation NM10/ICH7 Family USB2 EHCI Controller [8086:27cc] (rev 01)00:1e.0 PCI bridge [0604]: Intel Corporation 82801 PCI Bridge [8086:244e] (rev e1)00:1f.0 ISA bridge [0601]: Intel Corporation 82801GB/GR (ICH7 Family) LPC Interface Bridge [8086:27b8] (rev 01)00:1f.1 IDE interface [0101]: Intel Corporation 82801G (ICH7 Family) IDE Controller [8086:27df] (rev 01)00:1f.2 IDE interface [0101]: Intel Corporation NM10/ICH7 Family SATA Controller [IDE mode] [8086:27c0] (rev 01)00:1f.3 SMBus [0c05]: Intel Corporation NM10/ICH7 Family SMBus Controller [8086:27da] (rev 01)04:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8101E/RTL8102E PCI Express Fast Ethernet controller [10ec:8136] (rev 02)

上面的系统输出信息中与pci相关部分就是对pci上的各种设备执行扫描和相应初始化工作。

 acpi_pci_root_add还调用pci_acpi_scan_root,输出下面信息:

[    0.160216] pci_bus 0000:00: on NUMA node 0

acpi_pci_root_add多次调用acpi_pci_bridge_scan,acpi_pci_bridge_scan调用device->parent->ops.bind,即acpi_pci_bind。

acpi_pci_bind调用acpi_pci_irq_add_prt,因为被调用多次,输出下面信息:

[    0.160219] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0._PRT][    0.160338] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.PEX0._PRT][    0.160373] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.PEX1._PRT][    0.160406] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.PEX2._PRT][    0.160438] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.PEX3._PRT][    0.160475] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.HUB0._PRT]

acpi_pci_root_add接着输出下面信息:

[    0.160616]  pci0000:00: Requesting ACPI _OSC control (0x1d)
[ 0.160619] pci0000:00: ACPI _OSC request failed (AE_NOT_FOUND), returned control mask: 0x1d[ 0.160621] ACPI _OSC control for PCIe not granted, disabling ASPM

 

在drivers/acpi/pci_link.c中有下面代码:

subsys_initcall(acpi_pci_link_init);

此时调用acpi_pci_link_init函数,acpi_pci_link_init调用acpi_bus_register_driver(&acpi_pci_link_driver),

之后会调用acpi_pci_link_driver.ops.add函数,即acpi_pci_link_add函数,输出下面信息(不知为何会产生多次输出):

[    0.167979] ACPI: PCI Interrupt Link [LNKA] (IRQs 3 4 5 7 9 10 *11 12 14 15)[    0.168037] ACPI: PCI Interrupt Link [LNKB] (IRQs 3 4 5 7 9 10 11 12 14 15) *0, disabled.[    0.168081] ACPI: PCI Interrupt Link [LNKC] (IRQs 3 4 *5 7 9 10 11 12 14 15)[    0.168124] ACPI: PCI Interrupt Link [LNKD] (IRQs 3 4 5 7 9 10 11 12 14 *15)[    0.168167] ACPI: PCI Interrupt Link [LNKE] (IRQs 3 4 5 7 9 10 11 12 14 15) *0, disabled.[    0.168210] ACPI: PCI Interrupt Link [LNKF] (IRQs 3 4 5 7 9 10 11 12 14 15) *0, disabled.[    0.168253] ACPI: PCI Interrupt Link [LNK0] (IRQs 3 4 5 7 9 10 11 12 14 15) *0, disabled.[    0.168297] ACPI: PCI Interrupt Link [LNK1] (IRQs 3 4 5 7 9 *10 11 12 14 15)

 

drivers/gpu/vga/vgaarb.c中有下面代码:

subsys_initcall(vga_arb_device_init);

此时执行vga_arb_device_init函数,vga_arb_device_init调用vga_arbiter_add_pci_device,输出下面信息:

[    0.168380] vgaarb: device added: PCI:0000:00:02.0,decodes=io+mem,owns=io+mem,locks=none

vga_arb_device_init中接着输出下面信息:

[    0.168380] vgaarb: loaded[    0.168380] vgaarb: bridge control possible 0000:00:02.0

下面这行输出信息不知道是如何产生的:

[    0.168380] PCI: Using ACPI for IRQ routing

 

 arch/x86/pci/legacy.c中有下面定义:

subsys_initcall(pci_subsys_init);

此时执行pci_subsys_init函数。pci_subsys_init调用pcibios_init,pcibios_init调用pcibios_set_cache_line_size,输出下面信息:

[    0.174067] PCI: pci_cache_line_size set to 64 bytes

 pcibios_init调用pcibios_resource_survey,pcibios_resource_survey调用e820_reserve_resource_late,输出下面信息:

[    0.174129] reserve RAM buffer: 000000000009f800 - 000000000009ffff [    0.174132] reserve RAM buffer: 000000007f590000 - 000000007fffffff 

 

arch/x86/kernel/hpet.c中有下面代码:

fs_initcall(hpet_late_init);

此时会调用hpet_late_init,hpet_late_init调用hpet_msi_capability_lookup,输出下面信息:

[    0.174232] HPET: 3 timers in total, 0 timers will be used for per-cpu timer

hpet_late_init调用hpet_reserve_platform_timers,hpet_reserve_platform_timers调用hpet_alloc,输出下面信息:

[    0.174237] hpet0: at MMIO 0xfed00000, IRQs 2, 8, 0[    0.174241] hpet0: 3 comparators, 64-bit 14.318180 MHz counter

hpet_alloc中调用clocksource_register_hz,clocksource_register_hz调用__clocksource_register_scale,

__clocksource_register_scale调用clocksource_select,输出下面信息:

[    0.180130] Switching to clocksource hpet

 

drivers/pnp/pnpacpi/core.c中有下面代码:

fs_initcall(pnpacpi_init);

此时执行pnpacpi_init函数,输出下面信息:

[    0.181748] pnp: PnP ACPI init

pnpacpi_init调用register_acpi_bus_type(&acpi_bus_type),输出下面信息:

[    0.181760] ACPI: bus type pnp registere

pnpacpi_init接着调用acpi_get_devices,输出下面信息:

[    0.181827] pnp 00:00: [bus 00-ff][    0.181830] pnp 00:00: [io  0x0cf8-0x0cff][    0.181832] pnp 00:00: [io  0x0000-0x0cf7 window][    0.181835] pnp 00:00: [io  0x0d00-0xffff window][    0.181837] pnp 00:00: [mem 0x000a0000-0x000bffff window][    0.181839] pnp 00:00: [mem 0x000c0000-0x000dffff window][    0.181841] pnp 00:00: [mem 0x7f600000-0xfebfffff window][    0.181885] pnp 00:00: Plug and Play ACPI device, IDs PNP0a08 PNP0a03 (active)[    0.181940] pnp 00:01: [io  0x0010-0x001f][    0.181942] pnp 00:01: [io  0x0022-0x003f][    0.181944] pnp 00:01: [io  0x0044-0x005f][    0.181945] pnp 00:01: [io  0x0062-0x0063][    0.181947] pnp 00:01: [io  0x0065-0x006f][    0.181949] pnp 00:01: [io  0x0074-0x007f][    0.181951] pnp 00:01: [io  0x0091-0x0093][    0.181953] pnp 00:01: [io  0x00a2-0x00bf][    0.181954] pnp 00:01: [io  0x00e0-0x00ef][    0.181956] pnp 00:01: [io  0x04d0-0x04d1][    0.181958] pnp 00:01: [io  0x0800-0x087f][    0.181960] pnp 00:01: [io  0x0880-0x088f][    0.182013] system 00:01: [io  0x04d0-0x04d1] has been reserved[    0.182016] system 00:01: [io  0x0800-0x087f] has been reserved[    0.182018] system 00:01: [io  0x0880-0x088f] has been reserved[    0.182021] system 00:01: Plug and Play ACPI device, IDs PNP0c02 (active)[    0.182032] pnp 00:02: [dma 4][    0.182034] pnp 00:02: [io  0x0000-0x000f][    0.182036] pnp 00:02: [io  0x0080-0x0090][    0.182037] pnp 00:02: [io  0x0094-0x009f][    0.182039] pnp 00:02: [io  0x00c0-0x00df][    0.182067] pnp 00:02: Plug and Play ACPI device, IDs PNP0200 (active)[    0.182110] pnp 00:03: [irq 0 disabled][    0.182121] pnp 00:03: [irq 8][    0.182123] pnp 00:03: [mem 0xfed00000-0xfed003ff][    0.182152] pnp 00:03: Plug and Play ACPI device, IDs PNP0103 (active)[    0.182177] pnp 00:04: [io  0x0070-0x0073][    0.182205] pnp 00:04: Plug and Play ACPI device, IDs PNP0b00 (active)[    0.182214] pnp 00:05: [io  0x0061][    0.182240] pnp 00:05: Plug and Play ACPI device, IDs PNP0800 (active)[    0.182249] pnp 00:06: [io  0x00f0-0x00ff][    0.182254] pnp 00:06: [irq 13][    0.182283] pnp 00:06: Plug and Play ACPI device, IDs PNP0c04 (active)[    0.182409] pnp 00:07: [io  0x03f0-0x03f5][    0.182412] pnp 00:07: [io  0x03f7][    0.182416] pnp 00:07: [irq 6][    0.182418] pnp 00:07: [dma 2][    0.182457] pnp 00:07: Plug and Play ACPI device, IDs PNP0700 (active)[    0.182627] pnp 00:08: [io  0x03f8-0x03ff][    0.182632] pnp 00:08: [irq 4][    0.182689] pnp 00:08: Plug and Play ACPI device, IDs PNP0501 (active)[    0.182872] pnp 00:09: [io  0x02f8-0x02ff][    0.182876] pnp 00:09: [irq 3][    0.182933] pnp 00:09: Plug and Play ACPI device, IDs PNP0501 (active)[    0.183180] pnp 00:0a: [io  0x0378-0x037f][    0.183185] pnp 00:0a: [irq 7][    0.183233] pnp 00:0a: Plug and Play ACPI device, IDs PNP0400 (active)[    0.183348] pnp 00:0b: [io  0x0400-0x04bf][    0.183394] system 00:0b: [io  0x0400-0x04bf] has been reserved[    0.183397] system 00:0b: Plug and Play ACPI device, IDs PNP0c02 (active)[    0.183415] pnp 00:0c: [mem 0xffb80000-0xffbfffff][    0.183445] pnp 00:0c: Plug and Play ACPI device, IDs INT0800 (active)[    0.183612] pnp 00:0d: [mem 0xe0000000-0xefffffff][    0.183666] system 00:0d: [mem 0xe0000000-0xefffffff] has been reserved[    0.183669] system 00:0d: Plug and Play ACPI device, IDs PNP0c02 (active)[    0.183732] pnp 00:0e: [mem 0x000f0000-0x000fffff][    0.183734] pnp 00:0e: [mem 0x7f600000-0x7f6fffff][    0.183736] pnp 00:0e: [mem 0xfed00000-0xfed000ff][    0.183739] pnp 00:0e: [mem 0x7f590000-0x7f5fffff][    0.183740] pnp 00:0e: [mem 0x00000000-0x0009ffff][    0.183742] pnp 00:0e: [mem 0x00100000-0x7f58ffff][    0.183744] pnp 00:0e: [mem 0xfec00000-0xfec00fff][    0.183746] pnp 00:0e: [mem 0xfed13000-0xfed1dfff][    0.183748] pnp 00:0e: [mem 0xfed20000-0xfed8ffff][    0.183750] pnp 00:0e: [mem 0xfee00000-0xfee00fff][    0.183752] pnp 00:0e: [mem 0xffb00000-0xffb7ffff][    0.183754] pnp 00:0e: [mem 0xfff00000-0xffffffff][    0.183756] pnp 00:0e: [mem 0x000e0000-0x000effff][    0.183817] system 00:0e: [mem 0x000f0000-0x000fffff] could not be reserved[    0.183820] system 00:0e: [mem 0x7f600000-0x7f6fffff] has been reserved[    0.183823] system 00:0e: [mem 0xfed00000-0xfed000ff] has been reserved[    0.183825] system 00:0e: [mem 0x7f590000-0x7f5fffff] could not be reserved[    0.183828] system 00:0e: [mem 0x00000000-0x0009ffff] could not be reserved[    0.183831] system 00:0e: [mem 0x00100000-0x7f58ffff] could not be reserved[    0.183834] system 00:0e: [mem 0xfec00000-0xfec00fff] could not be reserved[    0.183836] system 00:0e: [mem 0xfed13000-0xfed1dfff] has been reserved[    0.183839] system 00:0e: [mem 0xfed20000-0xfed8ffff] has been reserved[    0.183842] system 00:0e: [mem 0xfee00000-0xfee00fff] has been reserved[    0.183844] system 00:0e: [mem 0xffb00000-0xffb7ffff] has been reserved[    0.183847] system 00:0e: [mem 0xfff00000-0xffffffff] has been reserved[    0.183847] system 00:0e: [mem 0x000e0000-0x000effff] has been reserved[    0.183847] system 00:0e: Plug and Play ACPI device, IDs PNP0c01 (active)

pnpacpi_init接着输出下面信息:

[    0.183847] pnp: PnP ACPI: found 15 devices

pnpacpi_init接着调用unregister_acpi_bus_type,输出下面信息:

[    0.183848] ACPI: ACPI bus type pnp unregistered

 

 drivers/pnp/pnpacpi/core.c中有下面代码:

fs_initcall(pnpbios_init);

此时调用pnpbios_init,输出下面信息:

[    0.183851] PnPBIOS: Disabled by ACPI PNP

 

arch/x86/pci/i386.c中有下面代码:

fs_initcall(pcibios_assign_resources);

此时调用pcibios_assign_resources,pci_assign_resources调用pci_assign_unassigned_resources,输出下面信息:

PCI: max bus depth: 1 pci_try_num: 2

pci_assign_unassigned_resources对pci_root_buses列表中的所有总线调用__pci_bus_assign_resources,

__pci_bus_assign_resources中对于总线上所有PCI_CLASS_BRIDGE_PCI设备调用pci_setup_bridge,

pci_setup_bridge调用__pci_setup_bridge,输出下面信息:

[    0.220656] pci 0000:00:1c.0: PCI bridge to [bus 01-01][    0.220659] pci 0000:00:1c.0:   bridge window [io  0xb000-0xbfff][    0.220664] pci 0000:00:1c.0:   bridge window [mem 0xfde00000-0xfdefffff][    0.220668] pci 0000:00:1c.0:   bridge window [mem 0xfdd00000-0xfddfffff 64bit pref]

 类似地,输出下面信息:

[    0.220674] pci 0000:00:1c.1: PCI bridge to [bus 02-02][    0.220677] pci 0000:00:1c.1:   bridge window [io  0xa000-0xafff][    0.220682] pci 0000:00:1c.1:   bridge window [mem 0xfdc00000-0xfdcfffff][    0.220686] pci 0000:00:1c.1:   bridge window [mem 0xfdb00000-0xfdbfffff 64bit pref][    0.220691] pci 0000:00:1c.2: PCI bridge to [bus 03-03][    0.220694] pci 0000:00:1c.2:   bridge window [io  0xe000-0xefff][    0.220699] pci 0000:00:1c.2:   bridge window [mem 0xfda00000-0xfdafffff][    0.220703] pci 0000:00:1c.2:   bridge window [mem 0xfd900000-0xfd9fffff 64bit pref][    0.220711] pci 0000:04:00.0: BAR 6: assigned [mem 0xfd700000-0xfd71ffff pref][    0.220713] pci 0000:00:1c.3: PCI bridge to [bus 04-04][    0.220716] pci 0000:00:1c.3:   bridge window [io  0xd000-0xdfff][    0.220721] pci 0000:00:1c.3:   bridge window [mem 0xfd800000-0xfd8fffff][    0.220724] pci 0000:00:1c.3:   bridge window [mem 0xfd700000-0xfd7fffff 64bit pref][    0.220730] pci 0000:00:1e.0: PCI bridge to [bus 05-05][    0.220733] pci 0000:00:1e.0:   bridge window [io  0xc000-0xcfff][    0.220738] pci 0000:00:1e.0:   bridge window [mem 0xfd500000-0xfd5fffff][    0.220742] pci 0000:00:1e.0:   bridge window [mem 0xfd400000-0xfd4fffff 64bit pref]

pci_assign_unassigned_resources对pci_root_buses列表中的所有总线调用pci_enable_bridges,

pci_enable_bridges对于总线上所有设备调用pci_set_master, pci_set_master调用pcibios_set_master,因为是多次调用,所以输出下面信息:

[    0.220761] pci 0000:00:1c.0: setting latency timer to 64[    0.220773] pci 0000:00:1c.1: setting latency timer to 64[    0.220784] pci 0000:00:1c.2: setting latency timer to 64[    0.220794] pci 0000:00:1c.3: setting latency timer to 64[    0.220801] pci 0000:00:1e.0: setting latency timer to 64

pci_assign_unassigned_resources对pci_root_buses列表中的所有总线调用pci_bus_dump_resources,

pci_bus_dump_resources调用pci_bus_dump_res,因为多次调用,输出下面信息:

[    0.220804] pci_bus 0000:00: resource 4 [io  0x0000-0x0cf7][    0.220806] pci_bus 0000:00: resource 5 [io  0x0d00-0xffff][    0.220809] pci_bus 0000:00: resource 6 [mem 0x000a0000-0x000bffff][    0.220811] pci_bus 0000:00: resource 7 [mem 0x000c0000-0x000dffff][    0.220813] pci_bus 0000:00: resource 8 [mem 0x7f600000-0xfebfffff][    0.220815] pci_bus 0000:01: resource 0 [io  0xb000-0xbfff][    0.220818] pci_bus 0000:01: resource 1 [mem 0xfde00000-0xfdefffff][    0.220820] pci_bus 0000:01: resource 2 [mem 0xfdd00000-0xfddfffff 64bit pref][    0.220822] pci_bus 0000:02: resource 0 [io  0xa000-0xafff][    0.220824] pci_bus 0000:02: resource 1 [mem 0xfdc00000-0xfdcfffff][    0.220827] pci_bus 0000:02: resource 2 [mem 0xfdb00000-0xfdbfffff 64bit pref][    0.220829] pci_bus 0000:03: resource 0 [io  0xe000-0xefff][    0.220831] pci_bus 0000:03: resource 1 [mem 0xfda00000-0xfdafffff][    0.220833] pci_bus 0000:03: resource 2 [mem 0xfd900000-0xfd9fffff 64bit pref][    0.220835] pci_bus 0000:04: resource 0 [io  0xd000-0xdfff][    0.220837] pci_bus 0000:04: resource 1 [mem 0xfd800000-0xfd8fffff][    0.220840] pci_bus 0000:04: resource 2 [mem 0xfd700000-0xfd7fffff 64bit pref][    0.220842] pci_bus 0000:05: resource 0 [io  0xc000-0xcfff][    0.220844] pci_bus 0000:05: resource 1 [mem 0xfd500000-0xfd5fffff][    0.220847] pci_bus 0000:05: resource 2 [mem 0xfd400000-0xfd4fffff 64bit pref][    0.220849] pci_bus 0000:05: resource 4 [io  0x0000-0x0cf7][    0.220851] pci_bus 0000:05: resource 5 [io  0x0d00-0xffff][    0.220853] pci_bus 0000:05: resource 6 [mem 0x000a0000-0x000bffff][    0.220855] pci_bus 0000:05: resource 7 [mem 0x000c0000-0x000dffff][    0.220857] pci_bus 0000:05: resource 8 [mem 0x7f600000-0xfebfffff]

 

net/ipv4/af_inet.c中有下面代码:

fs_initcall(inet_init);

此时调用inet_init, inet_init调用socket_register(&inet_family_ops),输出下面信息:

[    0.220902] NET: Registered protocol family 2

在include/linux/socket.h中有下面的定义:

#define AF_INET        2    /* Internet IP Protocol     */

inet_family_ops.family=PF_INET,而PF_INET又等于AF_INET,所以输出的协议簇是2

 

inet_init还分别对arp,ip,tcp,udp,ping,icmp等进行了初始化。

inet_init调用ip_init,ip_init调用ip_rt_init,输出下面信息:

[    0.220961] IP route cache hash table entries: 32768 (order: 5, 131072 bytes)

inet_init调用tcp_init,输出下面信息:

[    0.221172] TCP established hash table entries: 131072 (order: 8, 1048576 bytes)[    0.221641] TCP bind hash table entries: 65536 (order: 7, 524288 bytes)[    0.221873] TCP: Hash tables configured (established 131072 bind 65536)

tcp_init调用tcp_register_congestion_control(&tcp_reno),输出下面信息:

[    0.221875] TCP reno registered

 

inet_init调用udp_init,udp_init调用udp_table_init,udp_table_init调用alloc_large_system_hash,输出下面信息:

[    0.221878] UDP hash table entries: 512 (order: 2, 16384 bytes)

inet_init接着调用udplite4_register,udplite4_register调用udp_table_init(&udplite_table,"UDP-LITE"),

udp_table_init调用alloc_large_system_hash,输出下面信息:

[    0.221886] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)

 

net/unix/af_unix.c中有下面代码:

fs_initcall(af_unix_init);

此时调用af_unix_init,af_unit_init调用sock_register(&unix_family_ops),unix_family_ops.family=PF_UNIX,

PF_UNIX=AF_UNIX,而AF_UNIX定义位于include/linux/socket.h,如下所示:

#define AF_UNIX        1    /* Unix domain sockets         */

所以输出下面信息:

[    0.221963] NET: Registered protocol family 1

 

drivers/pci/quirks.c中有下面代码:

fs_initcall_sync(pci_apply_final_quirks);

此时执行pci_apply_final_quirks,pci_apply_final_quirks对于每个pci设备调用pci_fixup_dev(pci_fixup_final,dev).

相当于执行pci_do_fixups(dev, __start_pci_fixups_final,__end_pci_fixups_final).

该函数会调用__start_pci_fixups_final和__end_pci_fixups_final之间的所有函数。

arch/x86/kernel/vmlinux.lds中有下面的定义:

 __start_pci_fixups_final = .; *(.pci_fixup_final) __end_pci_fixups_final = .; 

 所以会调用.pci_fixup_final段中的所有函数。

 

pci_fixup_video有下面的声明(arch/x86/pci/fixup.c):

DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, pci_fixup_video);

DECLARE_PCI_FIXUP_FINAL定义如下(include/linux/pci.h):

#define DECLARE_PCI_FIXUP_FINAL(vendor, device, hook)           1465     DECLARE_PCI_FIXUP_SECTION(.pci_fixup_final,         1466             vendor##device##hook, vendor, device, hook)

该声明会将pci_fixup_video函数放入到.pci_fixup_final段中。

所以此时会执行pci_fixup_video,输出下面信息:

[    0.221980] pci 0000:00:02.0: Boot video device

 

pci_apply_final_quirks中继续输出下面信息:

[    0.222136] PCI: CLS 32 bytes, default 64

 

init/initramfs.c中有下面代码:

rootfs_initcall(populate_rootfs);

此时执行populate_rootfs,输出下面信息:

[    0.222187] Unpacking initramfs...

populate_rootfs中调用free_initrd,free_initrd调用free_initrd_mem,free_initrd_mem调用free_init_pages, 输出下面信息:

[    2.772396] Freeing initrd memory: 116776k freed

 

kernel/audit.c中有下面代码:

__initcall(audit_init);

include/linux/init.h中定义如下:

 #define __initcall(fn) device_initcall(fn)

 

此时执行audit_init,输出下面信息:

[    2.837035] audit: initializing netlink socket (disabled)

 audit_init中调用audit_log,输出下面信息:

[    2.837049] type=2000 audit(1403510217.832:1): initialized

 

mm/bounce.c中有下面代码:

__initcall(init_emergency_pool);

此时执行init_emergency_pool函数,输出下面信息:

[    2.853523] highmem bounce pool size: 64 pages

 

mm/hugetlb.c中有下面定义:

module_init(hugetlb_init);

include/linux/init.h中有下面定义:

#define module_init(x)    __initcall(x);

此时执行hugetlb_init,hugetlb_init调用report_hugepages,输出下面信息:

[    2.853528] HugeTLB registered 2 MB page size, pre-allocated 0 pages

 

fs/quota/dquot.c中有下面代码:

module_init(dquot_init);

此时调用dquot_init,输出下面信息:

[    2.853968] VFS: Disk quotas dquot_6.5.2
[ 2.854000] Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)

 

ipc/util.c中有下面代码:

__initcall(ipc_init);

此时执行ipc_init.ipc_init调用msg_init,输出下面信息:

[    2.854069] msgmni has been set to 1734

 

下面输出信息是从cryptomgr_notifiy中调用的(不知道是从哪个函数调用过来的):

[    2.854228] alg: No test for stdrng (krng)

 

block/bsg.c中有下面代码:

device_initcall(bsg_init);

此时调用bsg_init,输出下面信息:

[    2.854253] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 253)

 

block/noop-iosched.c中有下面代码:

module_init(noop_init);

此时执行noop_init,noop_init调用elv_register,输出下面信息:

[    2.854256] io scheduler noop registered

 

block/deadline-iosched.c中有下面代码:

module_init(deadline_init);

此时执行deadline_init,deadline_init调用elv_register,输出下面信息:

[    2.854258] io scheduler deadline registered

 

block/cfq-iosched.c中有下面代码:

module_init(cfq_init);

此时调用cfq_init,cfq_init调用elv_register,输出下面信息:

[    2.854269] io scheduler cfq registered (default)

 

drivers/pci/pcie/portdrv_pci.c中有下面代码:

module_init(pcie_portdrv_init);

此时执行pcie_portdrv_init,pcie_portdrv_init调用pcie_register_driver,.之后会执行pcie_portdriver的probe函数,即pcie_portdrv_probe.

pcie_portdrv_probe调用pcie_port_device_register,pcie_port_device_register调用pci_set_master,pci_set_master调用pcibios_set_master,

输出下面信息:

[    2.854355] pcieport 0000:00:1c.0: setting latency timer to 64

下面信息是由setup_msi_irq输出的(但不知道是从哪个函数调用过去的):

[    2.854395] pcieport 0000:00:1c.0: irq 40 for MSI/MSI-X

 

类似地,输出下面信息:

[    2.854451] pcieport 0000:00:1c.1: setting latency timer to 64[    2.854484] pcieport 0000:00:1c.1: irq 41 for MSI/MSI-X[    2.854541] pcieport 0000:00:1c.2: setting latency timer to 64[    2.854573] pcieport 0000:00:1c.2: irq 42 for MSI/MSI-X[    2.854628] pcieport 0000:00:1c.3: setting latency timer to 64[    2.854661] pcieport 0000:00:1c.3: irq 43 for MSI/MSI-X

 

drivers/pci/hotplug/pci_hotplug_core.c中有下面代码:

module_init(pci_hotplug_init);

此时执行pci_hotplug_init,输出下面信息:

[    2.854741] pci_hotplug: PCI Hot Plug PCI Core version: 0.5

 

drivers/pci/hotplug/pciehp_core.c中有下面代码:

module_init(pcied_init);

此时执行pcied_init, 输出下面信息:

[    2.854761] pciehp: PCI Express Hot Plug Controller Driver version: 0.4

 

drivers/pci/hotplug/acpiphp_core.c中有下面代码:

module_init(acpiphp_init);

此时执行acpiphp_init,输出下面信息:

[    2.854763] acpiphp: ACPI Hot Plug PCI Controller Driver version: 0.5

 

drivers/idle/intel_idle.c中有下面代码:

module_init(intel_idle_init);

此时执行intel_idle_init,intel_idle_init调用intel_idle_probe,输出下面信息:

[    2.855076] intel_idle: does not run on family 6 model 23

 

drivers/acpi/apei/erst.c中有下面代码:

device_initcall(erst_init);

此时执行erst_init,输出下面信息:

[ 2.855100] ERST: Table is not found!

 

drivers/acpi/apei/ghes.c中有下面代码:

module_init(ghes_init);

此时执行ghes_init,输出下面信息:

[    2.855101] GHES: HEST is not enabled!

 

drivers/pnp/isapnp/core.c中有下面代码:

device_initcall(isapnp_init);

此时执行isapnp_init,输出下面信息:

[    2.855114] isapnp: Scanning for PnP cards...[    3.208006] isapnp: No Plug & Play device found

 

drivers/tty/serial/8250.c有下面代码:

module_init(serial8250_init);

此时执行serial8250_init,输出下面信息:

[    3.208065] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled

serial8250_init调用serial8250_register_ports,serial8250_register_ports对于每个串口调用uart_add_one_port,

uart_add_one_port调用uart_configure_port,uart_configure_port调用uart_report_port,因多次调用,输出下面信息:

[    3.228404] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A[    3.248775] serial8250: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A

之后执行serial8250_probe,对于每个端口serial8250_register_port调用uart_add_one_port,uart_add_one_port调用uart_configure_port,

uart_configure_port调用uart_report_port,因为多次调用输出下面信息:

[    3.272684] 00:08: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A[    3.293099] 00:09: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A

 

drivers/char/agp/backend.c中有下面代码:

module_init(agp_init);

此时执行agp_init,输出下面信息:

[    3.293354] Linux agpgart interface v0.103

 

drivers/char/agp/intel-agp.c中有下面代码:

module_init(agp_intel_init);

此时执行agp_intel_init函数,调用pci_register_driver,经过很长一段调用后会调用agp_intel_pci_driver.probe,即agp_intel_probe.

agp_intel_probe调用agp_gmch_probe,输出下面信息:

[    3.293461] agpgart-intel 0000:00:00.0: Intel G33 Chipset

agp_gmch_probe调用intel_gtt_init,输出下面信息:

[    3.293522] agpgart-intel 0000:00:00.0: detected gtt size: 524288K total, 262144K mappable

intel_gtt_init调用intel_gtt_stolen_size,输出下面信息:

[    3.294055] agpgart-intel 0000:00:00.0: detected 8192K stolen memory

agp_intel_probe调用agp_add_bridge,输出下面信息:

[    3.294182] agpgart-intel 0000:00:00.0: AGP aperture is 256M @ 0xd0000000

 

driver/input/serio/i8042.c中有下面代码:

module_init(i8042_init);

 此时调用i8042_init,i8042_init调用i8042_platform_init,i8042_platform_init调用i8042_pnp_init, 输出下面信息:

[    3.294348] i8042: PNP: No PS/2 controller found. Probing ports directly.

之后执行platform_create_bundle,platform_create_bundle调用platform_driver_probe,之后调用i8042_probe,

i8042_probe调用i8042_register_ports,i8042_register_ports对每个串口输出信息,得到下面内容:

[    3.294708] serio: i8042 KBD port at 0x60,0x64 irq 1[    3.294714] serio: i8042 AUX port at 0x60,0x64 irq 12

 

drivers/input/mousedev.c中有下面代码:

module_init(mousedev_init);

此时执行mousedev_init,输出下面信息:

[    3.294847] mousedev: PS/2 mouse device common for all mice

 

drivers/rtc/rtc-cmos.c中有下面代码:

module_init(cmos_init);

此时执行cmos_init, cmos_init调用pnp_register_driver或者platform_driver_probe,

之后会调用cmos_pnp_probe或者cmos_platform_probe,然后调用cmos_wake_setup,

cmos_wake_setup输出下面信息:

[    3.294893] rtc_cmos 00:04: RTC can wake from S4

cmos_do_probe调用rtc_device_register,输出下面信息:

[    3.294995] rtc_cmos 00:04: rtc core: registered rtc_cmos as rtc0

cmos_do_probe继续输出下面信息:

[    3.295017] rtc0: alarms up to one month, 242 bytes nvram, hpet irqs

 

drivers/cpuidle/governors/ladder.c中有下面代码:

module_init(init_ladder);

此时调用init_ladder, init_ladder调用cpuidle_register_governor(&ladder_governor),ladder_governor.name="ladder".

cpuidle_register_governor调用cpuidle_switch_governor,输出下面信息:

[    3.295029] cpuidle: using governor ladder

 

drivers/cpuidle/governors/menu.c中有下面代码:

module_init(init_menu);

跟上一行输出类似,会产生下面的输出:

[    3.295031] cpuidle: using governor menu

 

net/ipv4/tcp_cubic.c中有下面代码:

module_init(cubictcp_register);

此时执行 cubictcp_register, cubictcp_register调用tcp_register_congestion_control(&cutictcp),输出下面信息:

[    3.295221] TCP cubic registered

 

net/ipv6/af_inet6.c中有下面代码:

module_init(inet6_init);

此时执行inet6_init,inet6_init调用sock_register(&inet6_family_ops),输出下面信息:

[    3.295256] NET: Registered protocol family 10

 

net/ipv6/mip6.c中有下面代码:

module_init(mip6_init);

此时执行mip6_init,输出下面信息:

[    3.295692] Mobile IPv6

 

net/packet/af_packet.c中有下面代码:

module_init(packet_init);

此时执行packet_init,packet_init调用sock_register,输出下面信息:

[    3.295695] NET: Registered protocol family 17

注意:17=AF_PACKET 用于raw packet socket.

 

net/dns_resolver/dns_key.c中有下面代码:

module_init(init_dns_resolver)

此时调用init_dns_resolver,输出下面信息:

[    3.295699] Registering the dns_resolver key type

 

arch/x86/kernel/apci/probe_32.c中有下面代码:

late_initcall(print_ipi_mode);

此时执行print_ipi_mode函数,输出下面信息:

[    3.295718] Using IPI No-Shortcut mode

 

kernel/power/hibernate.c中有下面代码:

late_initcall(software_resume);

此时执行software_resume,输出下面信息:

[    3.295829] PM: Hibernation image not present or could not be loaded.

 

kernel/taskstats.c中有下面代码:

late_initcall(taskstats_init);

此时执行taskstats_init,输出下面信息:

[    3.295839] registered taskstats version 1

 

drivers/rtc/hctosys.c中有下面代码:

late_initcall(rtc_hctosys);

此时执行rtc_hctosys函数,输出下面信息:

[    3.296264] rtc_cmos 00:04: setting system clock to 2014-06-23 07:56:58 UTC (1403510218)

 

net/core/drop_monitor.c中有下面代码:

late_initcall(init_net_drop_monitor);

此时执行init_net_drop_monitor,输出下面信息:

[    3.296298] Initializing network drop monitor service

 

回到kernel_init函数,调用init_post,init_post调用free_initmem,free_initmem调用free_init_pages, 输出下面信息:

[    3.296382] Freeing unused kernel memory: 428k freed

init_post调用mark_rodata_ro,输出下面信息:

[    3.296529] Write protecting the kernel text: 2884k[    3.296559] Write protecting the kernel read-only data: 1104k

mark_rodata_ro调用mark_nxdata_nx,输出下面信息:

[    3.296560] NX-protecting the kernel data: 3260k

init_pos新开启一个进程执行/sbin/init。