Changeset 95c675b in mainline for uspace/drv/bus
- Timestamp:
- 2017-10-17T13:11:35Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 60af4cdb
- Parents:
- dbf32b1 (diff), a416d070 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- uspace/drv/bus
- Files:
-
- 4 added
- 10 edited
- 2 moved
-
adb/cuda_adb/Makefile (moved) (moved from uspace/srv/hw/bus/cuda_adb/Makefile ) (1 diff)
-
adb/cuda_adb/cuda_adb.c (added)
-
adb/cuda_adb/cuda_adb.h (added)
-
adb/cuda_adb/cuda_adb.ma (added)
-
adb/cuda_adb/cuda_hw.h (moved) (moved from uspace/srv/hw/bus/cuda_adb/cuda_adb.h ) (2 diffs)
-
adb/cuda_adb/main.c (added)
-
isa/i8237.c (modified) (2 diffs)
-
isa/isa.c (modified) (3 diffs)
-
pci/pciintel/pci.c (modified) (3 diffs)
-
usb/ehci/res.c (modified) (2 diffs)
-
usb/ohci/hw_struct/transfer_descriptor.c (modified) (1 diff)
-
usb/ohci/ohci_rh.c (modified) (2 diffs)
-
usb/uhci/main.c (modified) (2 diffs)
-
usb/usbhub/status.h (modified) (1 diff)
-
usb/usbhub/usbhub.h (modified) (2 diffs)
-
usb/usbmid/explore.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/adb/cuda_adb/Makefile
rdbf32b1 r95c675b 28 28 29 29 USPACE_PREFIX = ../../../.. 30 LIBS = $(LIBDRV_PREFIX)/libdrv.a 31 EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include 30 32 BINARY = cuda_adb 31 33 32 34 SOURCES = \ 33 cuda_adb.c 35 cuda_adb.c \ 36 main.c 34 37 35 38 include $(USPACE_PREFIX)/Makefile.common -
uspace/drv/bus/adb/cuda_adb/cuda_hw.h
rdbf32b1 r95c675b 34 34 */ 35 35 36 #ifndef CUDA_ ADB_H_37 #define CUDA_ ADB_H_36 #ifndef CUDA_HW_H_ 37 #define CUDA_HW_H_ 38 38 39 #include <stddef.h>40 39 #include <stdint.h> 41 #include <async.h>42 #include <fibril_synch.h>43 40 44 typedef struct {41 typedef struct cuda_regs { 45 42 uint8_t b; 46 43 uint8_t pad0[0x1ff]; … … 90 87 uint8_t anh; 91 88 uint8_t pad15[0x1ff]; 92 } cuda_t; 89 } cuda_regs_t; 90 91 /** B register fields */ 92 enum { 93 TREQ = 0x08, 94 TACK = 0x10, 95 TIP = 0x20 96 }; 97 98 /** IER register fields */ 99 enum { 100 IER_CLR = 0x00, 101 IER_SET = 0x80, 102 103 SR_INT = 0x04, 104 ALL_INT = 0x7f 105 }; 106 107 /** ACR register fields */ 108 enum { 109 SR_OUT = 0x10 110 }; 111 112 /** Packet types */ 113 enum { 114 PT_ADB = 0x00, 115 PT_CUDA = 0x01 116 }; 117 118 /** CUDA packet types */ 119 enum { 120 CPT_AUTOPOLL = 0x01 121 }; 93 122 94 123 enum { 95 CUDA_RCV_BUF_SIZE = 5124 ADB_MAX_ADDR = 16 96 125 }; 97 98 enum cuda_xfer_state {99 cx_listen,100 cx_receive,101 cx_rcv_end,102 cx_send_start,103 cx_send104 };105 106 typedef struct {107 service_id_t service_id;108 async_sess_t *client_sess;109 } adb_dev_t;110 111 typedef struct {112 cuda_t *cuda;113 uintptr_t cuda_physical;114 115 uint8_t rcv_buf[CUDA_RCV_BUF_SIZE];116 uint8_t snd_buf[CUDA_RCV_BUF_SIZE];117 size_t bidx;118 size_t snd_bytes;119 enum cuda_xfer_state xstate;120 fibril_mutex_t dev_lock;121 } cuda_instance_t;122 126 123 127 #endif -
uspace/drv/bus/isa/i8237.c
rdbf32b1 r95c675b 371 371 372 372 /* 16 bit transfers are a bit special */ 373 ddf_msg(LVL_DEBUG, "Unspoiled address %#" PRIx32 " (size %" PRIu 16")",373 ddf_msg(LVL_DEBUG, "Unspoiled address %#" PRIx32 " (size %" PRIu32 ")", 374 374 pa, size); 375 375 if (is_dma16(channel)) { … … 388 388 389 389 ddf_msg(LVL_DEBUG, "Setting channel %u to address %#" PRIx32 " " 390 "(size %" PRIu 16"), mode %hhx.", channel, pa, size, mode);390 "(size %" PRIu32 "), mode %hhx.", channel, pa, size, mode); 391 391 392 392 /* Mask DMA request */ -
uspace/drv/bus/isa/isa.c
rdbf32b1 r95c675b 115 115 } 116 116 117 static bool isa_fun_enable_interrupt(ddf_fun_t *fnode) 118 { 119 /* This is an old ugly way, copied from pci driver */ 120 assert(fnode); 117 static bool isa_fun_owns_interrupt(isa_fun_t *fun, int irq) 118 { 119 const hw_resource_list_t *res = &fun->hw_resources; 120 121 /* Check that specified irq really belongs to the function */ 122 for (size_t i = 0; i < res->count; ++i) { 123 if (res->resources[i].type == INTERRUPT && 124 res->resources[i].res.interrupt.irq == irq) { 125 return true; 126 } 127 } 128 129 return false; 130 } 131 132 static int isa_fun_enable_interrupt(ddf_fun_t *fnode, int irq) 133 { 121 134 isa_fun_t *fun = isa_fun(fnode); 122 assert(fun); 123 124 const hw_resource_list_t *res = &fun->hw_resources; 125 assert(res); 126 for (size_t i = 0; i < res->count; ++i) { 127 if (res->resources[i].type == INTERRUPT) { 128 int rc = irc_enable_interrupt( 129 res->resources[i].res.interrupt.irq); 130 131 if (rc != EOK) 132 return false; 133 } 134 } 135 136 return true; 135 136 if (!isa_fun_owns_interrupt(fun, irq)) 137 return EINVAL; 138 139 return irc_enable_interrupt(irq); 140 } 141 142 static int isa_fun_disable_interrupt(ddf_fun_t *fnode, int irq) 143 { 144 isa_fun_t *fun = isa_fun(fnode); 145 146 if (!isa_fun_owns_interrupt(fun, irq)) 147 return EINVAL; 148 149 return irc_disable_interrupt(irq); 150 } 151 152 static int isa_fun_clear_interrupt(ddf_fun_t *fnode, int irq) 153 { 154 isa_fun_t *fun = isa_fun(fnode); 155 156 if (!isa_fun_owns_interrupt(fun, irq)) 157 return EINVAL; 158 159 return irc_clear_interrupt(irq); 137 160 } 138 161 … … 185 208 .get_resource_list = isa_fun_get_resources, 186 209 .enable_interrupt = isa_fun_enable_interrupt, 210 .disable_interrupt = isa_fun_disable_interrupt, 211 .clear_interrupt = isa_fun_clear_interrupt, 187 212 .dma_channel_setup = isa_fun_setup_dma, 188 213 .dma_channel_remain = isa_fun_remain_dma, … … 643 668 list_initialize(&isa->functions); 644 669 645 sess = ddf_dev_parent_sess_ create(dev);670 sess = ddf_dev_parent_sess_get(dev); 646 671 if (sess == NULL) { 647 672 ddf_msg(LVL_ERROR, "isa_dev_add failed to connect to the " -
uspace/drv/bus/pci/pciintel/pci.c
rdbf32b1 r95c675b 99 99 } 100 100 101 static bool pciintel_enable_interrupt(ddf_fun_t *fnode) 102 { 103 /* This is an old ugly way */ 104 assert(fnode); 105 pci_fun_t *dev_data = pci_fun(fnode); 106 107 size_t i = 0; 108 hw_resource_list_t *res = &dev_data->hw_resources; 109 for (; i < res->count; i++) { 110 if (res->resources[i].type == INTERRUPT) { 111 int rc = irc_enable_interrupt( 112 res->resources[i].res.interrupt.irq); 113 114 if (rc != EOK) 115 return false; 101 static int pciintel_fun_owns_interrupt(pci_fun_t *fun, int irq) 102 { 103 size_t i; 104 hw_resource_list_t *res = &fun->hw_resources; 105 106 for (i = 0; i < res->count; i++) { 107 if (res->resources[i].type == INTERRUPT && 108 res->resources[i].res.interrupt.irq == irq) { 109 return true; 116 110 } 117 111 } 118 112 119 return true; 113 return false; 114 } 115 116 static int pciintel_enable_interrupt(ddf_fun_t *fnode, int irq) 117 { 118 pci_fun_t *fun = pci_fun(fnode); 119 120 if (!pciintel_fun_owns_interrupt(fun, irq)) 121 return EINVAL; 122 123 return irc_enable_interrupt(irq); 124 } 125 126 static int pciintel_disable_interrupt(ddf_fun_t *fnode, int irq) 127 { 128 pci_fun_t *fun = pci_fun(fnode); 129 130 if (!pciintel_fun_owns_interrupt(fun, irq)) 131 return EINVAL; 132 133 return irc_disable_interrupt(irq); 134 } 135 136 static int pciintel_clear_interrupt(ddf_fun_t *fnode, int irq) 137 { 138 pci_fun_t *fun = pci_fun(fnode); 139 140 if (!pciintel_fun_owns_interrupt(fun, irq)) 141 return EINVAL; 142 143 return irc_clear_interrupt(irq); 120 144 } 121 145 … … 187 211 .get_resource_list = &pciintel_get_resources, 188 212 .enable_interrupt = &pciintel_enable_interrupt, 213 .disable_interrupt = &pciintel_disable_interrupt, 214 .clear_interrupt = &pciintel_clear_interrupt, 189 215 }; 190 216 … … 683 709 bus->dnode = dnode; 684 710 685 sess = ddf_dev_parent_sess_ create(dnode);711 sess = ddf_dev_parent_sess_get(dnode); 686 712 if (sess == NULL) { 687 713 ddf_msg(LVL_ERROR, "pci_dev_add failed to connect to the " -
uspace/drv/bus/usb/ehci/res.c
rdbf32b1 r95c675b 39 39 #include <str_error.h> 40 40 #include <assert.h> 41 #include <d evman.h>41 #include <ddf/driver.h> 42 42 #include <ddi.h> 43 43 #include <usb/debug.h> … … 176 176 assert(device); 177 177 178 async_sess_t *parent_sess = devman_parent_device_connect( 179 ddf_dev_get_handle(device), IPC_FLAG_BLOCKING); 180 if (!parent_sess) 178 async_sess_t *parent_sess = ddf_dev_parent_sess_get(device); 179 if (parent_sess == NULL) 181 180 return ENOMEM; 182 181 -
uspace/drv/bus/usb/ohci/hw_struct/transfer_descriptor.c
rdbf32b1 r95c675b 78 78 79 79 /* Allow less data on input. */ 80 if (dir == USB_DIRECTION_IN) {80 if (direction == USB_DIRECTION_IN) { 81 81 OHCI_MEM32_SET(instance->status, TD_STATUS_ROUND_FLAG); 82 82 } -
uspace/drv/bus/usb/ohci/ohci_rh.c
rdbf32b1 r95c675b 361 361 case USB_HUB_FEATURE_C_PORT_RESET: /*20*/ 362 362 usb_log_debug2("Clearing port C_CONNECTION, C_ENABLE, " 363 "C_SUSPEND, C_OC or C_RESET on port % "PRIu16".\n", port);363 "C_SUSPEND, C_OC or C_RESET on port %u.\n", port); 364 364 /* Bit offsets correspond to the feature number */ 365 365 OHCI_WR(hub->registers->rh_port_status[port], … … 410 410 case USB_HUB_FEATURE_PORT_RESET: /*4*/ 411 411 usb_log_debug2("Setting port POWER, ENABLE, SUSPEND or RESET " 412 "on port % "PRIu16".\n", port);412 "on port %u.\n", port); 413 413 /* Bit offsets correspond to the feature number */ 414 414 OHCI_WR(hub->registers->rh_port_status[port], 1 << feature); -
uspace/drv/bus/usb/uhci/main.c
rdbf32b1 r95c675b 36 36 #include <assert.h> 37 37 #include <ddf/driver.h> 38 #include <devman.h>39 38 #include <errno.h> 40 39 #include <io/log.h> … … 123 122 assert(device); 124 123 125 async_sess_t *parent_sess = devman_parent_device_connect( 126 ddf_dev_get_handle(device), IPC_FLAG_BLOCKING); 127 if (!parent_sess) 124 async_sess_t *parent_sess = ddf_dev_parent_sess_get(device); 125 if (parent_sess == NULL) 128 126 return ENOMEM; 129 127 130 128 /* See UHCI design guide page 45 for these values. 131 129 * Write all WC bits in USB legacy register */ 132 const int rc = pci_config_space_write_16(parent_sess, 0xc0, 0xaf00); 133 134 async_hangup(parent_sess); 135 return rc; 130 return pci_config_space_write_16(parent_sess, 0xc0, 0xaf00); 136 131 } 137 132 -
uspace/drv/bus/usb/usbhub/status.h
rdbf32b1 r95c675b 35 35 #define HUB_STATUS_H 36 36 37 #include <stdbool.h>38 #include <stdint.h>39 37 #include <usb/dev/request.h> 40 38 -
uspace/drv/bus/usb/usbhub/usbhub.h
rdbf32b1 r95c675b 38 38 #define DRV_USBHUB_USBHUB_H 39 39 40 #include <ipc/devman.h>41 40 #include <ddf/driver.h> 42 41 … … 72 71 /** Condition variable for pending_ops_count. */ 73 72 fibril_condvar_t pending_ops_cv; 74 /** Pointer to devmanusbhub function. */73 /** Pointer to usbhub function. */ 75 74 ddf_fun_t *hub_fun; 76 75 /** Status indicator */ -
uspace/drv/bus/usb/usbmid/explore.c
rdbf32b1 r95c675b 132 132 * 133 133 * @param dev Device to be explored. 134 * @return Whether to accept this device from devman.134 * @return Whether to accept this device. 135 135 */ 136 136 int usbmid_explore_device(usb_device_t *dev)
Note:
See TracChangeset
for help on using the changeset viewer.
