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