Changeset 60744cb in mainline
- Timestamp:
- 2024-05-17T17:51:56Z (7 months ago)
- Branches:
- master
- Children:
- 1801005
- Parents:
- 646849b3
- Location:
- uspace
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/audio/hdaudio/hdaudio.c
r646849b3 r60744cb 58 58 static errno_t hda_fun_offline(ddf_fun_t *fun); 59 59 60 static void hdaudio_interrupt(ipc_call_t *, ddf_dev_t*);60 static void hdaudio_interrupt(ipc_call_t *, void *); 61 61 62 62 static driver_ops_t driver_ops = { … … 266 266 cap_irq_handle_t irq_cap; 267 267 rc = register_interrupt_handler(dev, res.irqs.irqs[0], 268 hdaudio_interrupt, &irq_code, &irq_cap);268 hdaudio_interrupt, (void *)hda, &irq_code, &irq_cap); 269 269 if (rc != EOK) { 270 270 ddf_msg(LVL_ERROR, "Failed registering interrupt handler: %s", … … 377 377 } 378 378 379 static void hdaudio_interrupt(ipc_call_t *icall, ddf_dev_t *dev) 380 { 381 hda_t *hda = (hda_t *)ddf_dev_data_get(dev); 379 /** HD Audio interrupt handler. 380 * 381 * @param icall IRQ event notification 382 * @param arg Argument (hda_t *) 383 */ 384 static void hdaudio_interrupt(ipc_call_t *icall, void *arg) 385 { 386 hda_t *hda = (hda_t *)arg; 382 387 383 388 if (0) -
uspace/drv/audio/sb16/main.c
r646849b3 r60744cb 76 76 } 77 77 78 static void irq_handler(ipc_call_t *call, ddf_dev_t *dev) 79 { 80 sb16_t *sb16_dev = ddf_dev_data_get(dev); 78 /** SB16 IRQ handler. 79 * 80 * @param call IRQ event notification 81 * @param arg Argument (sb16_t *) 82 */ 83 static void irq_handler(ipc_call_t *call, void *arg) 84 { 85 sb16_t *sb16_dev = (sb16_t *)arg; 81 86 sb16_interrupt(sb16_dev); 82 87 } … … 124 129 125 130 rc = register_interrupt_handler(device, irq, irq_handler, 126 &irq_code, &irq_cap);131 (void *)soft_state, &irq_code, &irq_cap); 127 132 if (rc != EOK) { 128 133 ddf_log_error("Failed to register irq handler: %s.", -
uspace/drv/block/ahci/ahci.c
r646849b3 r60744cb 162 162 } 163 163 164 /** Get AHCI structure from DDF device. */165 static ahci_dev_t *dev_ahci_dev(ddf_dev_t *dev)166 {167 return ddf_dev_data_get(dev);168 }169 170 164 /** Get SATA device name. 171 165 * … … 891 885 * 892 886 * @param icall The IPC call structure. 893 * @param dev DDF device structure. 894 * 895 */ 896 static void ahci_interrupt(ipc_call_t *icall, ddf_dev_t *dev) 897 { 898 ahci_dev_t *ahci = dev_ahci_dev(dev); 887 * @param arg Argument (ahci_dev_t *) 888 */ 889 static void ahci_interrupt(ipc_call_t *icall, void *arg) 890 { 891 ahci_dev_t *ahci = (ahci_dev_t *)arg; 899 892 unsigned int port = ipc_get_arg1(icall); 900 893 ahci_port_is_t pxis = ipc_get_arg2(icall); … … 1186 1179 cap_irq_handle_t irq_cap; 1187 1180 errno_t rc = register_interrupt_handler(dev, 1188 hw_res_parsed.irqs.irqs[0], ahci_interrupt, &ct, &irq_cap); 1181 hw_res_parsed.irqs.irqs[0], ahci_interrupt, (void *)ahci, &ct, 1182 &irq_cap); 1189 1183 if (rc != EOK) { 1190 1184 ddf_msg(LVL_ERROR, "Failed registering interrupt handler."); -
uspace/drv/block/ddisk/ddisk.c
r646849b3 r60744cb 64 64 static void ddisk_bd_connection(ipc_call_t *, void *); 65 65 66 static void ddisk_irq_handler(ipc_call_t *, ddf_dev_t*);66 static void ddisk_irq_handler(ipc_call_t *, void *); 67 67 68 68 static driver_ops_t driver_ops = { … … 176 176 }; 177 177 178 void ddisk_irq_handler(ipc_call_t *icall, ddf_dev_t *dev) 178 /** Ddisk IRQ handler. 179 * 180 * @param icall IRQ event notification 181 * @param arg Argument (ddisk_t *) 182 */ 183 void ddisk_irq_handler(ipc_call_t *icall, void *arg) 179 184 { 180 185 ddf_msg(LVL_DEBUG, "ddisk_irq_handler(), status=%" PRIx32, 181 186 (uint32_t) ipc_get_arg1(icall)); 182 187 183 ddisk_t *ddisk = (ddisk_t *) ddf_dev_data_get(dev);188 ddisk_t *ddisk = (ddisk_t *)arg; 184 189 185 190 fibril_mutex_lock(&ddisk->lock); … … 512 517 ddisk_irq_commands[3].addr = (void *) &res_phys->command; 513 518 rc = register_interrupt_handler(dev, ddisk->ddisk_res.irq, 514 ddisk_irq_handler, &ddisk_irq_code, &ddisk->irq_cap);519 ddisk_irq_handler, (void *)ddisk, &ddisk_irq_code, &ddisk->irq_cap); 515 520 if (rc != EOK) { 516 521 ddf_msg(LVL_ERROR, "Failed to register interrupt handler."); -
uspace/drv/block/isa-ide/isa-ide.c
r646849b3 r60744cb 59 59 static errno_t isa_ide_init_irq(isa_ide_channel_t *); 60 60 static void isa_ide_fini_irq(isa_ide_channel_t *); 61 static void isa_ide_irq_handler(ipc_call_t *, ddf_dev_t*);61 static void isa_ide_irq_handler(ipc_call_t *, void *); 62 62 63 63 static void isa_ide_write_data_16(void *, uint16_t *, size_t); … … 256 256 257 257 ddf_msg(LVL_NOTE, "IRQ %d", chan->irq); 258 rc = register_interrupt_handler _arg(chan->ctrl->dev, chan->irq,258 rc = register_interrupt_handler(chan->ctrl->dev, chan->irq, 259 259 isa_ide_irq_handler, (void *)chan, &irq_code, &chan->ihandle); 260 260 if (rc != EOK) { … … 291 291 * 292 292 * @param call Call data 293 * @param dev Device that caused the interrupt294 */ 295 static void isa_ide_irq_handler(ipc_call_t *call, ddf_dev_t *xdev)296 { 297 isa_ide_channel_t *chan = (isa_ide_channel_t *) (void *)xdev; // XXX293 * @param arg Argument (isa_ide_channel_t *) 294 */ 295 static void isa_ide_irq_handler(ipc_call_t *call, void *arg) 296 { 297 isa_ide_channel_t *chan = (isa_ide_channel_t *)arg; 298 298 uint8_t status; 299 299 async_sess_t *parent_sess; -
uspace/drv/block/virtio-blk/virtio-blk.c
r646849b3 r60744cb 73 73 }; 74 74 75 static void virtio_blk_irq_handler(ipc_call_t *icall, ddf_dev_t *dev) 76 { 77 virtio_blk_t *virtio_blk = (virtio_blk_t *) ddf_dev_data_get(dev); 75 /** VirtIO block IRQ handler. 76 * 77 * @param icall IRQ event notification 78 * @param arg Argument (virtio_blk_t *) 79 */ 80 static void virtio_blk_irq_handler(ipc_call_t *icall, void *arg) 81 { 82 virtio_blk_t *virtio_blk = (virtio_blk_t *)arg; 78 83 virtio_dev_t *vdev = &virtio_blk->virtio_dev; 79 84 … … 145 150 146 151 return register_interrupt_handler(dev, virtio_blk->irq, 147 virtio_blk_irq_handler, &irq_code, &virtio_blk->irq_handle); 152 virtio_blk_irq_handler, (void *)virtio_blk, &irq_code, 153 &virtio_blk->irq_handle); 148 154 } 149 155 -
uspace/drv/char/i8042/i8042.c
r646849b3 r60744cb 123 123 * Write new data to the corresponding buffer. 124 124 * 125 * @param call pointerr to call data. 126 * @param dev Device that caued the interrupt. 127 * 128 */ 129 static void i8042_irq_handler(ipc_call_t *call, ddf_dev_t *dev) 130 { 131 i8042_t *controller = ddf_dev_data_get(dev); 125 * @param call Pointer to call data. 126 * @param arg Argument (i8042_t *) 127 */ 128 static void i8042_irq_handler(ipc_call_t *call, void *arg) 129 { 130 i8042_t *controller = (i8042_t *)arg; 132 131 errno_t rc; 133 132 … … 147 146 fibril_condvar_broadcast(&port->buf_cv); 148 147 149 async_sess_t *parent_sess = ddf_dev_parent_sess_get( dev);148 async_sess_t *parent_sess = ddf_dev_parent_sess_get(controller->dev); 150 149 hw_res_clear_interrupt(parent_sess, port->irq); 151 150 } … … 178 177 bool aux_bound = false; 179 178 179 dev->dev = ddf_dev; 180 180 181 if (regs->size < sizeof(i8042_regs_t)) { 181 182 rc = EINVAL; … … 288 289 cap_irq_handle_t kbd_ihandle; 289 290 rc = register_interrupt_handler(ddf_dev, irq_kbd, 290 i8042_irq_handler, &irq_code, &kbd_ihandle);291 i8042_irq_handler, (void *)dev, &irq_code, &kbd_ihandle); 291 292 if (rc != EOK) { 292 293 ddf_msg(LVL_ERROR, "Failed set handler for kbd: %s.", … … 297 298 cap_irq_handle_t mouse_ihandle; 298 299 rc = register_interrupt_handler(ddf_dev, irq_mouse, 299 i8042_irq_handler, &irq_code, &mouse_ihandle);300 i8042_irq_handler, (void *)dev, &irq_code, &mouse_ihandle); 300 301 if (rc != EOK) { 301 302 ddf_msg(LVL_ERROR, "Failed set handler for mouse: %s.", -
uspace/drv/char/i8042/i8042.h
r646849b3 r60744cb 1 1 /* 2 * Copyright (c) 202 1Jiri Svoboda2 * Copyright (c) 2024 Jiri Svoboda 3 3 * Copyright (c) 2006 Josef Cejka 4 4 * Copyright (c) 2011 Jan Vesely … … 82 82 /** i8042 Controller. */ 83 83 typedef struct i8042 { 84 /** DDF device */ 85 ddf_dev_t *dev; 84 86 /** I/O registers. */ 85 87 i8042_regs_t *regs; -
uspace/drv/char/ns8250/ns8250.c
r646849b3 r60744cb 783 783 * data and reading the line status register. 784 784 * 785 * @p aram dev The serial port device.786 * 787 */ 788 static inline void ns8250_interrupt_handler(ipc_call_t *icall, ddf_dev_t *dev)789 { 790 ns8250_t *ns = dev_ns8250(dev);785 * @pram icall IRQ event notificatoin 786 * @param arg Argument (ns8250_t *) 787 */ 788 static inline void ns8250_interrupt_handler(ipc_call_t *icall, void *arg) 789 { 790 ns8250_t *ns = (ns8250_t *)arg; 791 791 uint8_t iir = pio_read_8(&ns->regs->iid); 792 792 if ((iir & NS8250_IID_CAUSE_MASK) == NS8250_IID_CAUSE_RXSTATUS) { … … 809 809 { 810 810 return register_interrupt_handler(ns->dev, ns->irq, 811 ns8250_interrupt_handler, NULL, ihandle);811 ns8250_interrupt_handler, (void *)ns, NULL, ihandle); 812 812 } 813 813 -
uspace/drv/char/pl050/pl050.c
r646849b3 r60744cb 143 143 } 144 144 145 static void pl050_interrupt(ipc_call_t *call, ddf_dev_t *dev) 146 { 147 pl050_t *pl050 = (pl050_t *)ddf_dev_data_get(dev); 145 /** PL050 interrupt handler 146 * 147 * @param call IRQ event notification 148 * @param arg Argument (pl050_t *) 149 */ 150 static void pl050_interrupt(ipc_call_t *call, void *arg) 151 { 152 pl050_t *pl050 = (pl050_t *)arg; 148 153 size_t nidx; 149 154 … … 220 225 cap_irq_handle_t ihandle; 221 226 rc = register_interrupt_handler(pl050->dev, 222 res.irqs.irqs[0], pl050_interrupt, &pl050_irq_code, &ihandle); 227 res.irqs.irqs[0], pl050_interrupt, (void *)pl050, &pl050_irq_code, 228 &ihandle); 223 229 if (rc != EOK) { 224 230 ddf_msg(LVL_ERROR, "Failed registering interrupt handler. (%s)", -
uspace/drv/nic/e1k/e1k.c
r646849b3 r60744cb 1244 1244 * 1245 1245 * @param icall IPC call structure 1246 * @param dev E1000 device 1247 * 1248 */ 1249 static void e1000_interrupt_handler(ipc_call_t *icall, 1250 ddf_dev_t *dev) 1246 * @param arg Argument (nic_t *) 1247 * 1248 */ 1249 static void e1000_interrupt_handler(ipc_call_t *icall, void *arg) 1251 1250 { 1252 1251 uint32_t icr = (uint32_t) ipc_get_arg2(icall); 1253 nic_t *nic = NIC_DATA_DEV(dev);1252 nic_t *nic = (nic_t *)arg; 1254 1253 e1000_t *e1000 = DRIVER_DATA_NIC(nic); 1255 1254 … … 1283 1282 1284 1283 errno_t rc = register_interrupt_handler(nic_get_ddf_dev(nic), e1000->irq, 1285 e1000_interrupt_handler, &e1000_irq_code, handle);1284 e1000_interrupt_handler, (void *)nic, &e1000_irq_code, handle); 1286 1285 1287 1286 fibril_mutex_unlock(&irq_reg_mutex); -
uspace/drv/nic/ne2k/ne2k.c
r646849b3 r60744cb 121 121 }; 122 122 123 static void ne2k_interrupt_handler(ipc_call_t *, ddf_dev_t*);123 static void ne2k_interrupt_handler(ipc_call_t *, void *); 124 124 125 125 static errno_t ne2k_register_interrupt(nic_t *nic_data, … … 161 161 162 162 return register_interrupt_handler(nic_get_ddf_dev(nic_data), 163 ne2k->irq, ne2k_interrupt_handler, &ne2k->code, handle); 163 ne2k->irq, ne2k_interrupt_handler, (void *)nic_data, &ne2k->code, 164 handle); 164 165 } 165 166 … … 237 238 } 238 239 239 void ne2k_interrupt_handler(ipc_call_t *call, ddf_dev_t *dev) 240 { 241 nic_t *nic_data = DRIVER_DATA(dev); 240 /** NE2K interrupt handler 241 * 242 * @param call IRQ event notification 243 * @param arg Argument (nic_t *) 244 */ 245 void ne2k_interrupt_handler(ipc_call_t *call, void *arg) 246 { 247 nic_t *nic_data = (nic_t *)arg; 242 248 ne2k_interrupt(nic_data, IRQ_GET_ISR(*call), IRQ_GET_TSR(*call)); 243 249 } -
uspace/drv/nic/rtl8139/driver.c
r646849b3 r60744cb 819 819 * 820 820 * @param icall The IPC call structure 821 * @param dev The rtl8139 device 822 * 823 */ 824 static void rtl8139_interrupt_handler(ipc_call_t *icall, ddf_dev_t *dev) 825 { 826 assert(dev); 827 assert(icall); 828 821 * @param arg Argument (nic_t *) 822 * 823 */ 824 static void rtl8139_interrupt_handler(ipc_call_t *icall, void *arg) 825 { 829 826 uint16_t isr = (uint16_t) ipc_get_arg2(icall); 830 nic_t *nic_data = nic_get_from_ddf_dev(dev);827 nic_t *nic_data = (nic_t *)arg; 831 828 rtl8139_t *rtl8139 = nic_get_specific(nic_data); 832 829 … … 861 858 rtl8139_irq_code.cmds[3].addr = rtl8139->io_addr + IMR; 862 859 errno_t rc = register_interrupt_handler(nic_get_ddf_dev(nic_data), 863 rtl8139->irq, rtl8139_interrupt_handler, &rtl8139_irq_code, handle); 860 rtl8139->irq, rtl8139_interrupt_handler, (void *)nic_data, 861 &rtl8139_irq_code, handle); 864 862 865 863 RTL8139_IRQ_STRUCT_UNLOCK(); -
uspace/drv/nic/rtl8169/driver.c
r646849b3 r60744cb 74 74 static errno_t rtl8169_on_stopped(nic_t *nic_data); 75 75 static void rtl8169_send_frame(nic_t *nic_data, void *data, size_t size); 76 static void rtl8169_irq_handler(ipc_call_t *icall, ddf_dev_t *dev);76 static void rtl8169_irq_handler(ipc_call_t *icall, void *); 77 77 static inline errno_t rtl8169_register_int_handler(nic_t *nic_data, 78 78 cap_irq_handle_t *handle); … … 372 372 rtl8169_irq_code.cmds[3].addr = rtl8169->regs + IMR; 373 373 errno_t rc = register_interrupt_handler(nic_get_ddf_dev(nic_data), 374 rtl8169->irq, rtl8169_irq_handler, &rtl8169_irq_code, handle); 374 rtl8169->irq, rtl8169_irq_handler, (void *)rtl8169, 375 &rtl8169_irq_code, handle); 375 376 376 377 return rc; … … 1033 1034 } 1034 1035 1035 static void rtl8169_irq_handler(ipc_call_t *icall, ddf_dev_t *dev) 1036 { 1037 assert(dev); 1038 assert(icall); 1039 1036 /** RTL8169 IRQ handler. 1037 * 1038 * @param icall IRQ event notification 1039 * @param arg Argument (rtl8169_t *) 1040 */ 1041 static void rtl8169_irq_handler(ipc_call_t *icall, void *arg) 1042 { 1040 1043 uint16_t isr = (uint16_t) ipc_get_arg2(icall) & INT_KNOWN; 1041 nic_t *nic_data = nic_get_from_ddf_dev(dev); 1042 rtl8169_t *rtl8169 = nic_get_specific(nic_data); 1044 rtl8169_t *rtl8169 = (rtl8169_t *)arg; 1043 1045 1044 1046 ddf_msg(LVL_DEBUG, "rtl8169_irq_handler(): isr=0x%04x", isr); … … 1050 1052 /* Packet underrun or link change */ 1051 1053 if (isr & INT_PUN) { 1052 rtl8169_link_change( dev);1054 rtl8169_link_change(rtl8169->dev); 1053 1055 pio_write_16(rtl8169->regs + ISR, INT_PUN); 1054 1056 } … … 1056 1058 /* Transmit notification */ 1057 1059 if (isr & (INT_TER | INT_TOK | INT_TDU)) { 1058 rtl8169_transmit_done( dev);1060 rtl8169_transmit_done(rtl8169->dev); 1059 1061 pio_write_16(rtl8169->regs + ISR, (INT_TER | INT_TOK | INT_TDU)); 1060 1062 } … … 1072 1074 1073 1075 if (isr & (INT_RER | INT_ROK)) { 1074 rtl8169_receive_done( dev);1076 rtl8169_receive_done(rtl8169->dev); 1075 1077 pio_write_16(rtl8169->regs + ISR, (INT_RER | INT_ROK)); 1076 1078 } -
uspace/drv/nic/virtio-net/virtio-net.c
r646849b3 r60744cb 70 70 }; 71 71 72 static void virtio_net_irq_handler(ipc_call_t *icall, ddf_dev_t *dev) 73 { 74 nic_t *nic = ddf_dev_data_get(dev); 72 /** VirtIO net IRQ handler. 73 * 74 * @param icall IRQ event notification 75 * @param arg Argument (nic_t *) 76 */ 77 static void virtio_net_irq_handler(ipc_call_t *icall, void *arg) 78 { 79 nic_t *nic = (nic_t *)arg; 75 80 virtio_net_t *virtio_net = nic_get_specific(nic); 76 81 virtio_dev_t *vdev = &virtio_net->virtio_dev; … … 164 169 165 170 return register_interrupt_handler(dev, virtio_net->irq, 166 virtio_net_irq_handler, &irq_code, &virtio_net->irq_handle); 171 virtio_net_irq_handler, (void *)nic, &irq_code, 172 &virtio_net->irq_handle); 167 173 } 168 174 -
uspace/lib/drv/generic/interrupt.c
r646849b3 r60744cb 44 44 45 45 errno_t register_interrupt_handler(ddf_dev_t *dev, int irq, 46 interrupt_handler_t *handler, const irq_code_t *irq_code,47 cap_irq_handle_t *handle)48 {49 return async_irq_subscribe(irq, (async_notification_handler_t) handler,50 dev, irq_code, handle);51 }52 53 errno_t register_interrupt_handler_arg(ddf_dev_t *dev, int irq,54 46 interrupt_handler_t *handler, void *arg, const irq_code_t *irq_code, 55 47 cap_irq_handle_t *handle) -
uspace/lib/drv/include/ddf/interrupt.h
r646849b3 r60744cb 49 49 */ 50 50 51 typedef void interrupt_handler_t(ipc_call_t *, ddf_dev_t*);51 typedef void interrupt_handler_t(ipc_call_t *, void *); 52 52 53 extern errno_t register_interrupt_handler(ddf_dev_t *, int, interrupt_handler_t *, 54 const irq_code_t *, cap_irq_handle_t *); 55 extern errno_t register_interrupt_handler_arg(ddf_dev_t *, int, 53 extern errno_t register_interrupt_handler(ddf_dev_t *, int, 56 54 interrupt_handler_t *, void *, const irq_code_t *, cap_irq_handle_t *); 57 55 extern errno_t unregister_interrupt_handler(ddf_dev_t *, cap_irq_handle_t); -
uspace/lib/usbhost/src/hcd.c
r646849b3 r60744cb 95 95 * TODO: Make the bus mechanism less flexible in irq handling and remove the 96 96 * lookup. 97 */ 98 static void irq_handler(ipc_call_t *call, ddf_dev_t *dev) 99 { 100 assert(dev); 101 hc_device_t *hcd = dev_to_hcd(dev); 97 * 98 * @param call Interrupt notification 99 * @param arg Argument (hc_device_t *) 100 */ 101 static void irq_handler(ipc_call_t *call, void *arg) 102 { 103 hc_device_t *hcd = (hc_device_t *)arg; 102 104 103 105 const uint32_t status = ipc_get_arg1(call); … … 178 180 cap_irq_handle_t ihandle; 179 181 ret = register_interrupt_handler(hcd->ddf_dev, irq, irq_handler, 180 &irq_code, &ihandle);182 (void *)hcd, &irq_code, &ihandle); 181 183 irq_code_clean(&irq_code); 182 184 if (ret != EOK) {
Note:
See TracChangeset
for help on using the changeset viewer.