pci.c
上传用户:qddsws
上传日期:2022-06-22
资源大小:723k
文件大小:1k
- #include <pci.h>
- static int x;
- void __init_bus init_pci_bus (struct bus_driver* newbus) {
-
- struct device* root_device;
- root_device=(struct device*) kmalloc (sizeof(struct device));
- root_device->name=(char*)kmalloc((1+strlen(ROOT_DEV_STR))*sizeof(char));
- strcpy(root_device->name,ROOT_DEV_STR);
- root_device->parent_bus = newbus;
- newbus->dev_root=root_device;
- INIT_LIST_HEAD (&root_device->dev_list);
-
- kprint ("init Pci bus: ");
- kprint (newbus->name);
- kprint ("n");
- print_PCI_bios_entryp();
- print_bus_enum ();
- pci_scan_the_bus(newbus);
- }
- #include <devices/rtl8029.h>
- void pci_scan_the_bus (struct bus_driver* actbus) {
- struct device* rtl;
- rtl=(struct device*)kmalloc(sizeof(struct device));
- rtl->name=(char*)kmalloc((1+strlen("RTL 8029"))*sizeof(char));
- strcpy(rtl->name,"RTL 8029");
- rtl->parent_bus = actbus;
- rtl->init=(void*)&init_rtl8029;
-
- pci_add_device(actbus,rtl);
- /* Rutines PCIBOS!!! */
-
-
- }
- void pci_add_device (struct bus_driver* actbus, struct device* newdev) {
- list_add (&newdev->dev_list,&actbus->dev_root->dev_list);
- if (newdev->init!=(void*)NULL) newdev->init(newdev);
- }