Changeset 79ae36dd in mainline for uspace/drv/pciintel/pci.c
- Timestamp:
- 2011-06-08T19:01:55Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0eff68e
- Parents:
- 764d71e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/pciintel/pci.c
r764d71e r79ae36dd 53 53 #include <ipc/dev_iface.h> 54 54 #include <ipc/irc.h> 55 #include < ipc/ns.h>55 #include <ns.h> 56 56 #include <ipc/services.h> 57 57 #include <sysinfo.h> … … 92 92 assert(fnode); 93 93 pci_fun_t *dev_data = (pci_fun_t *) fnode->driver_data; 94 94 95 95 sysarg_t apic; 96 96 sysarg_t i8259; 97 98 int irc_phone = ENOTSUP;99 97 98 async_sess_t *irc_sess = NULL; 99 100 100 if (((sysinfo_get_value("apic", &apic) == EOK) && (apic)) 101 101 || ((sysinfo_get_value("i8259", &i8259) == EOK) && (i8259))) { 102 irc_phone = service_connect_blocking(SERVICE_IRC, 0, 0); 103 } 104 105 if (irc_phone < 0) { 102 irc_sess = service_connect_blocking(EXCHANGE_SERIALIZE, 103 SERVICE_IRC, 0, 0); 104 } 105 106 if (!irc_sess) 106 107 return false; 107 } 108 108 109 109 size_t i = 0; 110 110 hw_resource_list_t *res = &dev_data->hw_resources; … … 112 112 if (res->resources[i].type == INTERRUPT) { 113 113 const int irq = res->resources[i].res.interrupt.irq; 114 115 async_exch_t *exch = async_exchange_begin(irc_sess); 114 116 const int rc = 115 async_req_1_0(irc_phone, IRC_ENABLE_INTERRUPT, irq); 117 async_req_1_0(exch, IRC_ENABLE_INTERRUPT, irq); 118 async_exchange_end(exch); 119 116 120 if (rc != EOK) { 117 async_hangup(irc_ phone);121 async_hangup(irc_sess); 118 122 return false; 119 123 } 120 124 } 121 125 } 122 123 async_hangup(irc_ phone);126 127 async_hangup(irc_sess); 124 128 return true; 125 129 } 126 130 127 static int pci_config_space_write_32( 128 ddf_fun_t *fun, uint32_t address,uint32_t data)131 static int pci_config_space_write_32(ddf_fun_t *fun, uint32_t address, 132 uint32_t data) 129 133 { 130 134 if (address > 252) … … 576 580 577 581 ddf_msg(LVL_DEBUG, "pci_add_device"); 578 dnode->parent_ phone = -1;582 dnode->parent_sess = NULL; 579 583 580 584 bus = pci_bus_new(); … … 587 591 dnode->driver_data = bus; 588 592 589 dnode->parent_ phone = devman_parent_device_connect(dnode->handle,590 IPC_FLAG_BLOCKING);591 if ( dnode->parent_phone < 0) {593 dnode->parent_sess = devman_parent_device_connect(EXCHANGE_SERIALIZE, 594 dnode->handle, IPC_FLAG_BLOCKING); 595 if (!dnode->parent_sess) { 592 596 ddf_msg(LVL_ERROR, "pci_add_device failed to connect to the " 593 "parent 'sdriver.");594 rc = dnode->parent_phone;597 "parent driver."); 598 rc = ENOENT; 595 599 goto fail; 596 600 } … … 598 602 hw_resource_list_t hw_resources; 599 603 600 rc = hw_res_get_resource_list(dnode->parent_ phone, &hw_resources);604 rc = hw_res_get_resource_list(dnode->parent_sess, &hw_resources); 601 605 if (rc != EOK) { 602 606 ddf_msg(LVL_ERROR, "pci_add_device failed to get hw resources " … … 651 655 if (bus != NULL) 652 656 pci_bus_delete(bus); 653 if (dnode->parent_phone >= 0) 654 async_hangup(dnode->parent_phone); 657 658 if (dnode->parent_sess) 659 async_hangup(dnode->parent_sess); 660 655 661 if (got_res) 656 662 hw_res_clean_resource_list(&hw_resources); 663 657 664 if (ctl != NULL) 658 665 ddf_fun_destroy(ctl); 659 666 660 667 return rc; 661 668 }
Note:
See TracChangeset
for help on using the changeset viewer.