2008年11月24日 星期一

Linux PCI (linux-2.6.27.4)

include/linux/init.h

/*
* Early initcalls run before initializing SMP.
*
* Only for built-in code, not modules.
*/
#define early_initcall(fn) __define_initcall("early",fn,early)

/*
* A "pure" initcall has no dependencies on anything else, and purely
* initializes variables that couldn't be statically initialized.
*
* This only exists for built-in code, not for modules.
*/
#define pure_initcall(fn) __define_initcall("0",fn,0)

#define core_initcall(fn) __define_initcall("1",fn,1)
#define core_initcall_sync(fn) __define_initcall("1s",fn,1s)
#define postcore_initcall(fn) __define_initcall("2",fn,2)
#define postcore_initcall_sync(fn) __define_initcall("2s",fn,2s)
#define arch_initcall(fn) __define_initcall("3",fn,3)
#define arch_initcall_sync(fn) __define_initcall("3s",fn,3s)
#define subsys_initcall(fn) __define_initcall("4",fn,4)
#define subsys_initcall_sync(fn) __define_initcall("4s",fn,4s)
#define fs_initcall(fn) __define_initcall("5",fn,5)
#define fs_initcall_sync(fn) __define_initcall("5s",fn,5s)
#define rootfs_initcall(fn) __define_initcall("rootfs",fn,rootfs)
#define device_initcall(fn) __define_initcall("6",fn,6)
#define device_initcall_sync(fn) __define_initcall("6s",fn,6s)
#define late_initcall(fn) __define_initcall("7",fn,7)
#define late_initcall_sync(fn) __define_initcall("7s",fn,7s)

#define __initcall(fn) device_initcall(fn)

(..................)

/**
* module_init() - driver initialization entry point
* @x: function to be run at kernel boot time or module insertion
*
* module_init() will either be called during do_initcalls() (if
* builtin) or at module insertion time (if a module). There can only
* be one per module.
*/
#define module_init(x) __initcall(x);


The PCI initial sequence: (arch specific not included)

drivers/pci/pci.c: early_param("pci", pci_setup);
drivers/pci/pci-driver.c: postcore_initcall(pci_driver_init);
drivers/pci/pci-acpi.c: arch_initcall(acpi_pci_init);
drivers/pci/slot.c: subsys_initcall(pci_slot_init);
drivers/pci/pcie/aspm.c: fs_initcall(pcie_aspm_init);
drivers/pci/pci.c: device_initcall(pci_init);
drivers/pci/proc.c: device_initcall(pci_proc_init);
drivers/pci/pci-sysfs.c: late_initcall(pci_sysfs_init);






http://blog.csdn.net/fudan_abc/category/345294.aspx

Linux 2.6.10内核下PCI Express Native热插拔框架的实现机制
http://www.ibm.com/developerworks/cn/linux/l-pcie/

System and method for balancing pci-express bandwidth
http://www.freshpatents.com/System-and-method-for-balancing-pci-express-bandwidth-dt20081023ptan20080263246.php

Rather than taking advantage of multiple traffic classes and virtual lanes, existing PCI-Express adapters only support one virtual channel and one traffic class. Moreover, the primary operating systems, i.e. Microsoft Windows and Linux, only use one traffic channel and one virtual lane. As a result, currently known environments often encounter problems where the total possible bandwidth of a set of PCI-Express adapter cards within an I/O drawer attached to a CPU complex via an I/O hub or switch may far exceed the capabilities of the I/O hub, switch, and/or the front-side bus.


include/linux/ioport.h
/*
* Resources are tree-like, allowing
* nesting etc..
*/
struct resource {
resource_size_t start;
resource_size_t end;
const char *name;
unsigned long flags;
struct resource *parent, *sibling, *child;
};

沒有留言: