このドキュメントで説明するソフトウェアは、Extended SupportまたはSustaining Supportのいずれかにあります。 詳細は、https://www.oracle.com/us/support/library/enterprise-linux-support-policies-069172.pdfを参照してください。
Oracleでは、このドキュメントに記載されているソフトウェアをできるだけ早くアップグレードすることをお薦めします。

機械翻訳について

6.4 バス・モデルについて

Oracle Linuxのデバイス・ドライバ・モデルでは、グローバル・データ構造体を使用して、ブリッジやその他のデバイス用バス・ドライバに対してデータの提供や制御操作を行います。 このような、バスやそのデバイスを記述するための統一されたデータ・モデルでは、バス・プロービング、デバイスの検出、停止、電源管理およびその他の制御操作で使用するバスの属性とコールバックを定義します。 このモデルでは、Advanced Configuration and Power Interface (ACPI)モデルで規定されたプラグ・アンド・プレイ、電源管理およびホット・プラグ機能をサポートしており、ACPIは最新のx86/x86-64アーキテクチャ・システムのほとんどのデバイスに適用されています。 デバイス・ドライバは、そのドライバ・オブジェクトをバス・サブシステムに登録します。 これにより、ベンダーIDと製品IDを使用して、ハードウェアが存在するかどうかを識別できます。

カーネルでは、バスの各レイヤーまたは個々のデバイス・ドライバがアクセス可能なバスごとに共通のデータ構造体を定義します。

たとえば、pci_busデータ構造体はPCIバスを表します。

struct pci_bus {
        struct list_head node;          /* node in list of buses */
        struct pci_bus  *parent;        /* parent bus this bridge is on */
        struct list_head children;      /* list of child buses */
        struct list_head devices;       /* list of devices on this bus */
        struct pci_dev  *self;          /* bridge device as seen by parent */
        struct list_head slots;         /* list of slots on this bus */
        struct resource *resource[PCI_BRIDGE_RESOURCE_NUM];
        struct list_head resources;     /* address space routed to this bus */

        struct pci_ops  *ops;           /* configuration access functions */
        void            *sysdata;       /* hook for sys-specific extension */
        struct proc_dir_entry *procdir; /* directory entry in /proc/bus/pci */

        unsigned char   number;         /* bus number */
        unsigned char   primary;        /* number of primary bridge */
        unsigned char   secondary;      /* number of secondary bridge */
        unsigned char   subordinate;    /* max number of subordinate buses */
        unsigned char   max_bus_speed;  /* enum pci_bus_speed */
        unsigned char   cur_bus_speed;  /* enum pci_bus_speed */

        char            name[48];

        unsigned short  bridge_ctl;     /* manage NO_ISA/FBB/et al behaviors */
        pci_bus_flags_t bus_flags;      /* Inherited by child busses */
        struct device           *bridge;
        struct device           dev;
        struct bin_attribute    *legacy_io; /* legacy I/O for this bus */
        struct bin_attribute    *legacy_mem; /* legacy mem */
        unsigned int            is_added:1;
};

pci_slot構造体はPCIバスのスロットを表します。

struct pci_slot {
        struct pci_bus *bus;            /* The bus this slot is on */
        struct list_head list;          /* node in list of slots on this bus */
        struct hotplug_slot *hotplug;   /* Hotplug info (migrate over time) */
        unsigned char number;           /* PCI_SLOT(pci_dev->devfn) */
        struct kobject kobj;
};

pci_dev構造体はPCIバス上の各デバイスを定義します。

struct pci_dev {
        struct list_head bus_list;      /* node in per-bus list */
        struct pci_bus  *bus;           /* bus this device is on */
        struct pci_bus  *subordinate;   /* bus this device bridges to */

        void            *sysdata;       /* hook for sys-specific extension */
        struct proc_dir_entry *procent; /* device entry in /proc/bus/pci */
        struct pci_slot *slot;          /* Physical slot this device is in */

        unsigned int    devfn;          /* encoded device & function index */
        unsigned short  vendor;
        unsigned short  device;
        unsigned short  subsystem_vendor;
        unsigned short  subsystem_device;
        unsigned int    class;          /* 3 bytes: (base,sub,prog-if) */
        ...
        struct pci_driver *driver;      /* which driver has allocated this device */
        ...
        pci_channel_state_t error_state;        /* current connectivity state */
        struct  device  dev;            /* Generic device interface */

        int             cfg_size;       /* Size of configuration space */

        /*
         * Instead of touching interrupt line and base address registers
         * directly, use the values stored here. They might be different!
         */
        unsigned int    irq;
        struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and memory regions
                                                            & expansion ROMs */
        resource_size_t fw_addr[DEVICE_COUNT_RESOURCE]; /* FW-assigned addr */
        ...
        pci_dev_flags_t dev_flags;
        atomic_t        enable_cnt;     /* pci_enable_device has been called */
        /* Several lines omitted */
};

ここに表示されているのは、重要な構造体メンバーの一部のみです。

スロットと関数番号の組合せごとに1つのpci_dev構造体があります。 システム内のすべてのPCIデバイス(PCI-PCI、PCI-ISAブリッジ・デバイスなど)がpci_dev構造体で表現されます。

pci_devstruct device devメンバーは、デバイスの汎用インタフェースを表します。 PCIバス・レイヤーは、この構造体のメンバーにアクセスできます。 ただし、通常は個々のPCIデバイス・ドライバが構造体にアクセスできるようにする必要はありません。 このような抽象化により、構造体のメンバーが変更または削除された場合に、ダウンストリームのドライバが切断されるのを防ぎます。 修正する必要があるのは、バス・レイヤーのコードのみです。

他のバスベースのサブシステムと同様に、PCIデバイス・ドライバは、そのドライバ・オブジェクトをPCIサブシステムに登録します。 これにより、ベンダーIDとデバイスIDを使用して、ハードウェアが存在するかどうかを識別できます。