Changes in / [70922c2:3d4750f] in mainline
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/ppc32/Makefile.inc
r70922c2 r3d4750f 43 43 44 44 RD_DRVS += \ 45 infrastructure/rootmac \ 46 bus/pci/pciintel 45 infrastructure/rootmac 47 46 48 47 SOURCES = \ -
uspace/Makefile
r70922c2 r3d4750f 165 165 DIRS += \ 166 166 drv/infrastructure/rootmac \ 167 drv/bus/pci/pciintel \168 167 srv/hw/bus/cuda_adb 169 168 endif -
uspace/drv/bus/pci/pciintel/pci.c
r70922c2 r3d4750f 38 38 39 39 #include <assert.h> 40 #include <byteorder.h>41 40 #include <stdio.h> 42 41 #include <errno.h> … … 232 231 void *addr = bus->conf_data_port + (reg & 3); 233 232 234 pio_write_32(bus->conf_addr_port, host2uint32_t_le(conf_addr));233 pio_write_32(bus->conf_addr_port, conf_addr); 235 234 236 235 switch (len) { 237 236 case 1: 238 /* No endianness change for 1 byte */239 237 buf[0] = pio_read_8(addr); 240 238 break; 241 239 case 2: 242 ((uint16_t *) buf)[0] = uint16_t_le2host(pio_read_16(addr));240 ((uint16_t *) buf)[0] = pio_read_16(addr); 243 241 break; 244 242 case 4: 245 ((uint32_t *) buf)[0] = uint32_t_le2host(pio_read_32(addr));243 ((uint32_t *) buf)[0] = pio_read_32(addr); 246 244 break; 247 245 } … … 256 254 fibril_mutex_lock(&bus->conf_mutex); 257 255 258 const uint32_t conf_addr = CONF_ADDR(fun->bus, fun->dev, fun->fn, reg); 256 uint32_t conf_addr; 257 conf_addr = CONF_ADDR(fun->bus, fun->dev, fun->fn, reg); 259 258 void *addr = bus->conf_data_port + (reg & 3); 260 259 261 pio_write_32(bus->conf_addr_port, host2uint32_t_le(conf_addr));260 pio_write_32(bus->conf_addr_port, conf_addr); 262 261 263 262 switch (len) { 264 263 case 1: 265 /* No endianness change for 1 byte */266 264 pio_write_8(addr, buf[0]); 267 265 break; 268 266 case 2: 269 pio_write_16(addr, host2uint16_t_le(((uint16_t *) buf)[0]));267 pio_write_16(addr, ((uint16_t *) buf)[0]); 270 268 break; 271 269 case 4: 272 pio_write_32(addr, host2uint32_t_le(((uint32_t *) buf)[0]));270 pio_write_32(addr, ((uint32_t *) buf)[0]); 273 271 break; 274 272 } … … 652 650 got_res = true; 653 651 654 655 assert(hw_resources.count > 1);656 assert(hw_resources.resources[0].type == IO_RANGE);657 assert(hw_resources.resources[0].res.io_range.size >= 4);658 659 assert(hw_resources.resources[1].type == IO_RANGE);660 assert(hw_resources.resources[1].res.io_range.size >= 4);661 662 652 ddf_msg(LVL_DEBUG, "conf_addr = %" PRIx64 ".", 663 653 hw_resources.resources[0].res.io_range.address); 664 ddf_msg(LVL_DEBUG, "data_addr = %" PRIx64 ".", 665 hw_resources.resources[1].res.io_range.address); 654 655 assert(hw_resources.count > 0); 656 assert(hw_resources.resources[0].type == IO_RANGE); 657 assert(hw_resources.resources[0].res.io_range.size == 8); 666 658 667 659 bus->conf_io_addr = 668 660 (uint32_t) hw_resources.resources[0].res.io_range.address; 669 bus->conf_io_data = 670 (uint32_t) hw_resources.resources[1].res.io_range.address; 671 672 if (pio_enable((void *)(uintptr_t)bus->conf_io_addr, 4, 661 662 if (pio_enable((void *)(uintptr_t)bus->conf_io_addr, 8, 673 663 &bus->conf_addr_port)) { 674 664 ddf_msg(LVL_ERROR, "Failed to enable configuration ports."); … … 676 666 goto fail; 677 667 } 678 if (pio_enable((void *)(uintptr_t)bus->conf_io_data, 4, 679 &bus->conf_data_port)) { 680 ddf_msg(LVL_ERROR, "Failed to enable configuration ports."); 681 rc = EADDRNOTAVAIL; 682 goto fail; 683 } 668 bus->conf_data_port = (char *) bus->conf_addr_port + 4; 684 669 685 670 /* Make the bus device more visible. It has no use yet. */ -
uspace/drv/bus/pci/pciintel/pci.h
r70922c2 r3d4750f 46 46 ddf_dev_t *dnode; 47 47 uint32_t conf_io_addr; 48 uint32_t conf_io_data;49 48 void *conf_data_port; 50 49 void *conf_addr_port; -
uspace/drv/bus/usb/usbhid/kbd/kbddev.c
r70922c2 r3d4750f 71 71 #include "../usbhid.h" 72 72 73 static void default_connection_handler(ddf_fun_t *, ipc_callid_t, ipc_call_t *);74 static ddf_dev_ops_t kbdops = { .default_handler = default_connection_handler };75 73 /*----------------------------------------------------------------------------*/ 76 74 … … 189 187 break; 190 188 } 191 if (kbd_dev->c lient_sess == NULL) {192 kbd_dev->c lient_sess = sess;189 if (kbd_dev->console_sess == NULL) { 190 kbd_dev->console_sess = sess; 193 191 usb_log_debug("%s: OK\n", __FUNCTION__); 194 192 async_answer_0(icallid, EOK); … … 294 292 { 295 293 usb_log_debug2("Sending kbdev event %d/%d to the console\n", type, key); 296 if (kbd_dev->c lient_sess == NULL) {294 if (kbd_dev->console_sess == NULL) { 297 295 usb_log_warning( 298 296 "Connection to console not ready, key discarded.\n"); … … 300 298 } 301 299 302 async_exch_t *exch = async_exchange_begin(kbd_dev->c lient_sess);300 async_exch_t *exch = async_exchange_begin(kbd_dev->console_sess); 303 301 if (exch != NULL) { 304 302 async_msg_2(exch, KBDEV_EVENT, type, key); … … 501 499 /* Store the initialized HID device and HID ops 502 500 * to the DDF function. */ 503 fun->ops = &kbd ops;501 fun->ops = &kbd_dev->ops; 504 502 fun->driver_data = kbd_dev; 505 503 … … 578 576 fibril_mutex_initialize(&kbd_dev->repeat_mtx); 579 577 kbd_dev->initialized = USB_KBD_STATUS_UNINITIALIZED; 578 kbd_dev->ops.default_handler = default_connection_handler; 580 579 581 580 /* Store link to HID device */ … … 738 737 739 738 /* Hangup session to the console. */ 740 if (kbd_dev->c lient_sess)741 async_hangup(kbd_dev->c lient_sess);739 if (kbd_dev->console_sess) 740 async_hangup(kbd_dev->console_sess); 742 741 743 742 //assert(!fibril_mutex_is_locked((*kbd_dev)->repeat_mtx)); -
uspace/drv/bus/usb/usbhid/kbd/kbddev.h
r70922c2 r3d4750f 82 82 unsigned lock_keys; 83 83 84 /** IPC session to client (for sending key events). */ 85 async_sess_t *client_sess; 84 /** IPC session to the console device (for sending key events). */ 85 async_sess_t *console_sess; 86 87 /** @todo What is this actually? */ 88 ddf_dev_ops_t ops; 86 89 87 90 /** Information for auto-repeat of keys. */ -
uspace/drv/bus/usb/usbhid/mouse/mousedev.c
r70922c2 r3d4750f 54 54 #define NAME "mouse" 55 55 56 static void default_connection_handler(ddf_fun_t *, ipc_callid_t, ipc_call_t *); 57 58 static ddf_dev_ops_t ops = { .default_handler = default_connection_handler }; 59 60 /*----------------------------------------------------------------------------*/ 56 /*----------------------------------------------------------------------------*/ 57 61 58 const usb_endpoint_description_t usb_hid_mouse_poll_endpoint_description = { 62 59 .transfer_type = USB_TRANSFER_INTERRUPT, … … 224 221 assert(index < mouse_dev->buttons_count); 225 222 226 if (mouse_dev->buttons[index] != field->value) {223 if (mouse_dev->buttons[index] == 0 && field->value != 0) { 227 224 async_exch_t *exch = 228 225 async_exchange_begin(mouse_dev->mouse_sess); 229 226 if (exch != NULL) { 230 227 async_req_2_0(exch, MOUSEEV_BUTTON_EVENT, 231 field->usage, (field->value != 0) ? 1 : 0); 228 field->usage, 1); 229 async_exchange_end(exch); 230 mouse_dev->buttons[index] = field->value; 231 } 232 233 } else if (mouse_dev->buttons[index] != 0 && field->value == 0) { 234 async_exch_t *exch = 235 async_exchange_begin(mouse_dev->mouse_sess); 236 if (exch != NULL) { 237 async_req_2_0(exch, MOUSEEV_BUTTON_EVENT, 238 field->usage, 0); 232 239 async_exchange_end(exch); 233 240 mouse_dev->buttons[index] = field->value; … … 272 279 } 273 280 274 fun->ops = & ops;281 fun->ops = &mouse->ops; 275 282 fun->driver_data = mouse; 276 283 … … 295 302 } 296 303 mouse->mouse_fun = fun; 304 297 305 return EOK; 298 306 } … … 371 379 } 372 380 381 // set handler for incoming calls 382 mouse_dev->ops.default_handler = default_connection_handler; 383 373 384 // TODO: how to know if the device supports the request??? 374 385 usbhid_req_set_idle(&hid_dev->usb_dev->ctrl_pipe, -
uspace/drv/bus/usb/usbhid/mouse/mousedev.h
r70922c2 r3d4750f 46 46 /** Container for USB mouse device. */ 47 47 typedef struct { 48 /** IPC session to cons umer. */48 /** IPC session to console (consumer). */ 49 49 async_sess_t *mouse_sess; 50 50 … … 53 53 size_t buttons_count; 54 54 55 ddf_dev_ops_t ops; 55 56 /* DDF mouse function */ 56 57 ddf_fun_t *mouse_fun; -
uspace/drv/infrastructure/rootmac/rootmac.c
r70922c2 r3d4750f 52 52 } rootmac_fun_t; 53 53 54 static hw_resource_t pci_conf_regs[] = { 55 { 56 .type = IO_RANGE, 57 .res.io_range = { 58 .address = 0xfec00000, 59 .size = 4, 60 .endianness = LITTLE_ENDIAN 61 } 62 }, 63 { 64 .type = IO_RANGE, 65 .res.io_range = { 66 .address = 0xfee00000, 67 .size = 4, 68 .endianness = LITTLE_ENDIAN 69 } 54 static hw_resource_t pci_conf_regs = { 55 .type = IO_RANGE, 56 .res.io_range = { 57 .address = 0xCF8, 58 .size = 8, 59 .endianness = LITTLE_ENDIAN 70 60 } 71 61 }; … … 73 63 static rootmac_fun_t pci_data = { 74 64 .hw_resources = { 75 2,76 pci_conf_regs65 1, 66 &pci_conf_regs 77 67 } 78 68 }; … … 138 128 { 139 129 /* Register functions */ 140 if (!rootmac_add_fun(dev, "pci0", " intel_pci", &pci_data))130 if (!rootmac_add_fun(dev, "pci0", "pangea_pci", &pci_data)) 141 131 ddf_msg(LVL_ERROR, "Failed to add functions for Mac platform."); 142 132 -
uspace/drv/infrastructure/rootpc/rootpc.c
r70922c2 r3d4750f 77 77 }; 78 78 79 static hw_resource_t pci_conf_regs[] = { 80 { 81 .type = IO_RANGE, 82 .res.io_range = { 83 .address = 0xCF8, 84 .size = 4, 85 .endianness = LITTLE_ENDIAN 86 } 87 }, 88 { 89 .type = IO_RANGE, 90 .res.io_range = { 91 .address = 0xCFC, 92 .size = 4, 93 .endianness = LITTLE_ENDIAN 94 } 79 static hw_resource_t pci_conf_regs = { 80 .type = IO_RANGE, 81 .res.io_range = { 82 .address = 0xCF8, 83 .size = 8, 84 .endianness = LITTLE_ENDIAN 95 85 } 96 86 }; … … 98 88 static rootpc_fun_t pci_data = { 99 89 .hw_resources = { 100 sizeof(pci_conf_regs)/sizeof(pci_conf_regs[0]),101 pci_conf_regs90 1, 91 &pci_conf_regs 102 92 } 103 93 }; -
uspace/lib/drv/generic/remote_usb.c
r70922c2 r3d4750f 56 56 { 57 57 if (!exch) 58 return E BADMEM;58 return EINVAL; 59 59 sysarg_t addr; 60 60 const int ret = async_req_1_1(exch, DEV_IFACE_ID(USB_DEV_IFACE), … … 75 75 { 76 76 if (!exch) 77 return E BADMEM;77 return EINVAL; 78 78 sysarg_t iface_no; 79 79 const int ret = async_req_1_1(exch, DEV_IFACE_ID(USB_DEV_IFACE), … … 92 92 { 93 93 if (!exch) 94 return E BADMEM;94 return EINVAL; 95 95 devman_handle_t h; 96 96 const int ret = async_req_1_1(exch, DEV_IFACE_ID(USB_DEV_IFACE), -
uspace/lib/drv/generic/remote_usbhc.c
r70922c2 r3d4750f 165 165 { 166 166 if (!exch || !address) 167 return E BADMEM;167 return EINVAL; 168 168 sysarg_t new_address; 169 169 const int ret = async_req_4_1(exch, DEV_IFACE_ID(USBHC_DEV_IFACE), … … 178 178 { 179 179 if (!exch) 180 return E BADMEM;180 return EINVAL; 181 181 return async_req_3_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE), 182 182 IPC_M_USBHC_BIND_ADDRESS, address, handle); … … 187 187 { 188 188 if (!exch) 189 return E BADMEM;189 return EINVAL; 190 190 sysarg_t h; 191 191 const int ret = async_req_2_1(exch, DEV_IFACE_ID(USBHC_DEV_IFACE), … … 199 199 { 200 200 if (!exch) 201 return E BADMEM;201 return EINVAL; 202 202 return async_req_2_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE), 203 203 IPC_M_USBHC_RELEASE_ADDRESS, address); … … 209 209 { 210 210 if (!exch) 211 return E BADMEM;211 return EINVAL; 212 212 const usb_target_t target = 213 213 {{ .address = address, .endpoint = endpoint }}; … … 225 225 { 226 226 if (!exch) 227 return E BADMEM;227 return EINVAL; 228 228 return async_req_4_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE), 229 229 IPC_M_USBHC_UNREGISTER_ENDPOINT, address, endpoint, direction); … … 234 234 size_t *rec_size) 235 235 { 236 if (!exch)237 return EBADMEM;238 239 236 if (size == 0 && setup == 0) 240 237 return EOK; 241 238 239 if (!exch) 240 return EINVAL; 242 241 const usb_target_t target = 243 242 {{ .address = address, .endpoint = endpoint }}; … … 289 288 usb_endpoint_t endpoint, uint64_t setup, const void *data, size_t size) 290 289 { 291 if (!exch)292 return EBADMEM;293 294 290 if (size == 0 && setup == 0) 295 291 return EOK; 296 292 293 if (!exch) 294 return EINVAL; 297 295 const usb_target_t target = 298 296 {{ .address = address, .endpoint = endpoint }};
Note:
See TracChangeset
for help on using the changeset viewer.