Linux pci Initialization

Source: Internet
Author: User

1. Function call Sequence

(Gdb) bt

#0 pci_arch_init () at arch/x86/pci/init. c: 13
#1 0xc1001255 in do_one_initcall (fn = 0xc17a3afa <pci_arch_init>) at init/main. c: 758
#2 0xc176c963 in do_initcils (unused = <value optimized out>) at init/main. c: 788
#3 do_basic_setup (unused = <value optimized out>) at init/main. c: 806
#4 kernel_init (unused = <value optimized out>) at init/main. c: 898
#5 0xc1001_e in ?? () At arch/x86/kernel/entry_32.S: 1009
#6 0x00000000 in ?? ()

Static void _ init do_initcils (void)
{
Initcall_t * fn;

For (fn = _ early_initcall_end; fn <_ initcall_end; fn ++)
Do_one_initcall (* fn );
}

The definition in vmlinux. lds is as follows:

_ Early_initcall_end = .; *(. initcall0.init )*(. initcall0s. init )*(. initcall1.init )*(. initcall1s. init )*(. initcall2.init )*(. initcall2s. init )*(. initcall3.init )*(. initcall3s. init )*(. initcall4.init )*(. initcall4s. init )*(. initcall5.init )*(. initcall5s. init)
* (. Initcallrootfs. init) * (. initcall6.init) * (. initcall6s. init) * (. initcall7.init) * (. initcall7s. init) _ initcall_end =.

That is to say, the do_initcils function calls all the Code placed in these sections.

The pci_arch_init function is defined

Static _ init int pci_arch_init (void)
{

}
Arch_initcall (pci_arch_init );

# Define arch_initcall (FN) _ define_initcall ("3", FN, 3)

# DEFINE _ define_initcall (Level, FN, ID )\
Static initcall_t _ initcall _ # FN # ID _ used \
_ Attribute _ (_ Section _ (". initcall" level ". init") = FN

This definition defines the _ initcall_pci_arch_init_init3 function pointer in the section. initcall3.init. Its value is pci_arch_init.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.