Changeset fb78ae72 in mainline
- Timestamp:
- 2011-02-19T23:34:48Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 423e8c81, deece2f
- Parents:
- b9d910f
- Location:
- uspace/drv
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/pciintel/pci.c
rb9d910f rfb78ae72 49 49 #include <ipc/devman.h> 50 50 #include <ipc/dev_iface.h> 51 #include <ipc/irc.h> 52 #include <ipc/ns.h> 53 #include <ipc/services.h> 54 #include <sysinfo.h> 51 55 #include <ops/hw_res.h> 52 56 #include <device/hw_res.h> … … 72 76 static bool pciintel_enable_child_interrupt(device_t *dev) 73 77 { 74 /* TODO */ 75 76 return false; 78 /* This is an old ugly way, copied from ne2000 driver */ 79 assert(dev); 80 pci_dev_data_t *dev_data = (pci_dev_data_t *) dev->driver_data; 81 82 sysarg_t apic; 83 sysarg_t i8259; 84 int irc_phone = -1; 85 int irc_service = 0; 86 87 if ((sysinfo_get_value("apic", &apic) == EOK) && (apic)) { 88 irc_service = SERVICE_APIC; 89 } else if ((sysinfo_get_value("i8259", &i8259) == EOK) && (i8259)) { 90 irc_service = SERVICE_I8259; 91 } 92 93 if (irc_service) { 94 while (irc_phone < 0) 95 irc_phone = service_connect_blocking(irc_service, 0, 0); 96 } else { 97 return false; 98 } 99 100 size_t i; 101 for (i = 0; i < dev_data->hw_resources.count; i++) { 102 if (dev_data->hw_resources.resources[i].type == INTERRUPT) { 103 int irq = dev_data->hw_resources.resources[i].res.interrupt.irq; 104 async_msg_1(irc_phone, IRC_ENABLE_INTERRUPT, irq); 105 } 106 } 107 108 async_hangup(irc_phone); 109 return true; 77 110 } 78 111 -
uspace/drv/uhci-hcd/main.c
rb9d910f rfb78ae72 34 34 #include <driver.h> 35 35 #include <usb_iface.h> 36 #include <ipc/irc.h> 37 #include <ipc/ns.h> 38 #include <ipc/services.h> 39 #include <sysinfo.h> 36 #include <device/hw_res.h> 40 37 41 38 #include <errno.h> … … 84 81 assert(device); 85 82 uhci_t *hc = dev_to_uhci(device); 86 usb_log_info("LOL HARDWARE INTERRUPT: %p.\n", hc);87 83 uint16_t status = IPC_GET_ARG1(*call); 88 84 assert(hc); … … 111 107 112 108 CHECK_RET_RETURN(ret, 113 "Failed(%d) to get I/O registers addresses for device:.\n", 114 ret, device->handle); 109 "Failed(%d) to get I/O addresses:.\n", ret, device->handle); 115 110 usb_log_info("I/O regs at 0x%X (size %zu), IRQ %d.\n", 116 111 io_reg_base, io_reg_size, irq); 117 112 118 119 sysarg_t apic; 120 sysarg_t i8259; 121 int irc_phone = -1; 122 int irc_service = 0; 123 124 if ((sysinfo_get_value("apic", &apic) == EOK) && (apic)) { 125 irc_service = SERVICE_APIC; 126 usb_log_debug("SERVICE_APIC\n"); 127 } else if ((sysinfo_get_value("i8259", &i8259) == EOK) && (i8259)) { 128 irc_service = SERVICE_I8259; 129 usb_log_debug("SERVICE_I8259\n"); 130 } 131 132 if (irc_service) { 133 while (irc_phone < 0) 134 irc_phone = service_connect_blocking(irc_service, 0, 0); 135 } 136 usb_log_debug("Interrupt conttroller phone: %d\n", irc_phone); 137 138 async_msg_1(irc_phone, IRC_ENABLE_INTERRUPT, irq); 139 async_hangup(irc_phone); 140 113 ret = pci_enable_interrupts(device); 114 CHECK_RET_RETURN(ret, "Failed(%d) to get enable interrupts:\n", ret); 141 115 142 116 uhci_t *uhci_hc = malloc(sizeof(uhci_t)); -
uspace/drv/uhci-hcd/pci.c
rb9d910f rfb78ae72 121 121 return rc; 122 122 } 123 123 /*----------------------------------------------------------------------------*/ 124 int pci_enable_interrupts(device_t *device) 125 { 126 int parent_phone = devman_parent_device_connect(device->handle, 127 IPC_FLAG_BLOCKING); 128 bool enabled = hw_res_enable_interrupt(parent_phone); 129 return enabled ? EOK : EIO; 130 } 124 131 /** 125 132 * @} -
uspace/drv/uhci-hcd/pci.h
rb9d910f rfb78ae72 39 39 40 40 int pci_get_my_registers(device_t *, uintptr_t *, size_t *, int *); 41 int pci_enable_interrupts(device_t *device); 41 42 42 43 #endif -
uspace/drv/uhci-hcd/uhci.h
rb9d910f rfb78ae72 104 104 static inline void uhci_fini(uhci_t *instance) {}; 105 105 106 int uhci_transfer(107 uhci_t *instance,108 device_t *dev,109 usb_target_t target,110 usb_transfer_type_t transfer_type,111 bool toggle,112 usb_packet_id pid,113 bool low_speed,114 void *buffer, size_t size,115 usbhc_iface_transfer_out_callback_t callback_out,116 usbhc_iface_transfer_in_callback_t callback_in,117 void *arg );118 119 106 int uhci_schedule(uhci_t *instance, batch_t *batch); 120 107
Note:
See TracChangeset
for help on using the changeset viewer.