Changeset b2d06fa in mainline for uspace/drv
- Timestamp:
- 2010-12-25T17:14:36Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 092e4f1
- Parents:
- 59e9398b (diff), 3ac66f69 (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
- Files:
-
- 1 added
- 8 edited
- 1 moved
-
ns8250/ns8250.c (modified) (3 diffs)
-
pciintel/pci.c (modified) (2 diffs)
-
root/root.c (modified) (3 diffs)
-
rootpc/rootpc.c (modified) (3 diffs)
-
rootpc/rootpc.ma (modified) (1 diff)
-
rootvirt/devices.def (modified) (1 diff)
-
test1/Makefile (modified) (1 diff)
-
test1/char.c (moved) (moved from uspace/app/tester/ipc/connect.c ) (2 diffs)
-
test1/test1.c (modified) (3 diffs)
-
test1/test1.h (added)
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/ns8250/ns8250.c
r59e9398b rb2d06fa 342 342 printf(NAME ": failed to connect to the parent driver of the " 343 343 "device %s.\n", dev->name); 344 ret = EPARTY; /* FIXME: use another EC */344 ret = dev->parent_phone; 345 345 goto failed; 346 346 } 347 347 348 348 /* Get hw resources. */ 349 if (!get_hw_resources(dev->parent_phone, &hw_resources)) { 349 ret = get_hw_resources(dev->parent_phone, &hw_resources); 350 if (ret != EOK) { 350 351 printf(NAME ": failed to get hw resources for the device " 351 352 "%s.\n", dev->name); 352 ret = EPARTY; /* FIXME: use another EC */353 353 goto failed; 354 354 } … … 374 374 printf(NAME ": i/o range assigned to the device " 375 375 "%s is too small.\n", dev->name); 376 ret = E PARTY; /* FIXME: use another EC */376 ret = ELIMIT; 377 377 goto failed; 378 378 } … … 390 390 printf(NAME ": missing hw resource(s) for the device %s.\n", 391 391 dev->name); 392 ret = E PARTY; /* FIXME: use another EC */392 ret = ENOENT; 393 393 goto failed; 394 394 } -
uspace/drv/pciintel/pci.c
r59e9398b rb2d06fa 452 452 static int pci_add_device(device_t *dev) 453 453 { 454 int rc; 455 454 456 printf(NAME ": pci_add_device\n"); 455 457 … … 466 468 "parent's driver.\n"); 467 469 delete_pci_bus_data(bus_data); 468 return EPARTY; /* FIXME: use another EC */470 return dev->parent_phone; 469 471 } 470 472 471 473 hw_resource_list_t hw_resources; 472 474 473 if (!get_hw_resources(dev->parent_phone, &hw_resources)) { 475 rc = get_hw_resources(dev->parent_phone, &hw_resources); 476 if (rc != EOK) { 474 477 printf(NAME ": pci_add_device failed to get hw resources for " 475 478 "the device.\n"); 476 479 delete_pci_bus_data(bus_data); 477 480 ipc_hangup(dev->parent_phone); 478 return EPARTY; /* FIXME: use another EC */481 return rc; 479 482 } 480 483 -
uspace/drv/root/root.c
r59e9398b rb2d06fa 47 47 #include <macros.h> 48 48 #include <inttypes.h> 49 #include <sysinfo.h> 49 50 50 51 #include <driver.h> … … 55 56 56 57 #define PLATFORM_DEVICE_NAME "hw" 57 #define PLATFORM_DEVICE_MATCH_ID STRING(UARCH)58 #define PLATFORM_DEVICE_MATCH_ID_FMT "platform/%s" 58 59 #define PLATFORM_DEVICE_MATCH_SCORE 100 59 60 … … 99 100 static int add_platform_child(device_t *parent) 100 101 { 102 char *match_id; 103 char *platform; 104 size_t platform_size; 105 int res; 106 107 /* Get platform name from sysinfo. */ 108 109 platform = sysinfo_get_data("platform", &platform_size); 110 if (platform == NULL) { 111 printf(NAME ": Failed to obtain platform name.\n"); 112 return ENOENT; 113 } 114 115 /* Null-terminate string. */ 116 platform = realloc(platform, platform_size + 1); 117 if (platform == NULL) { 118 printf(NAME ": Memory allocation failed.\n"); 119 return ENOMEM; 120 } 121 122 platform[platform_size] = '\0'; 123 124 /* Construct match ID. */ 125 126 if (asprintf(&match_id, PLATFORM_DEVICE_MATCH_ID_FMT, platform) == -1) { 127 printf(NAME ": Memory allocation failed.\n"); 128 return ENOMEM; 129 } 130 131 /* Add child. */ 132 101 133 printf(NAME ": adding new child for platform device.\n"); 102 134 printf(NAME ": device node is `%s' (%d %s)\n", PLATFORM_DEVICE_NAME, 103 PLATFORM_DEVICE_MATCH_SCORE, PLATFORM_DEVICE_MATCH_ID);104 105 intres = child_device_register_wrapper(parent, PLATFORM_DEVICE_NAME,106 PLATFORM_DEVICE_MATCH_ID, PLATFORM_DEVICE_MATCH_SCORE);135 PLATFORM_DEVICE_MATCH_SCORE, match_id); 136 137 res = child_device_register_wrapper(parent, PLATFORM_DEVICE_NAME, 138 match_id, PLATFORM_DEVICE_MATCH_SCORE); 107 139 108 140 return res; -
uspace/drv/rootpc/rootpc.c
r59e9398b rb2d06fa 28 28 29 29 /** 30 * @defgroup root_pc Root HW device driver for ia32 and amd64 platform.31 * @brief HelenOS root HW device driver for ia32 and amd64 platform.30 * @defgroup root_pc PC platform driver. 31 * @brief HelenOS PC platform driver. 32 32 * @{ 33 33 */ … … 182 182 /* Register child devices. */ 183 183 if (!rootpc_add_children(dev)) { 184 printf(NAME ": failed to add child devices for platform " 185 "ia32.\n"); 184 printf(NAME ": failed to add child devices for PC platform.\n"); 186 185 } 187 186 … … 196 195 int main(int argc, char *argv[]) 197 196 { 198 printf(NAME ": HelenOS rootpc devicedriver\n");197 printf(NAME ": HelenOS PC platform driver\n"); 199 198 root_pc_init(); 200 199 return driver_main(&rootpc_driver); -
uspace/drv/rootpc/rootpc.ma
r59e9398b rb2d06fa 1 10 ia32 2 10 amd64 1 10 platform/pc -
uspace/drv/rootvirt/devices.def
r59e9398b rb2d06fa 17 17 .match_id = "virtual&test2" 18 18 }, 19 { 20 .name = "null", 21 .match_id = "virtual&test1" 22 }, 19 23 #endif -
uspace/drv/test1/Makefile
r59e9398b rb2d06fa 33 33 34 34 SOURCES = \ 35 char.c \ 35 36 test1.c 36 37 -
uspace/drv/test1/char.c
r59e9398b rb2d06fa 1 1 /* 2 * Copyright (c) 20 06 Ondrej Palkovsky2 * Copyright (c) 2010 Vojtech Horky 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 #include <stdio.h> 30 #include <unistd.h> 31 #include <atomic.h> 32 #include "../tester.h" 29 /** @file 30 */ 33 31 34 static atomic_t finish; 32 #include <assert.h> 33 #include <errno.h> 34 #include <mem.h> 35 #include <char.h> 35 36 36 static void callback(void *priv, int retval, ipc_call_t *data) 37 { 38 atomic_set(&finish, 1); 37 #include "test1.h" 38 39 static int impl_char_read(device_t *dev, char *buf, size_t count) { 40 memset(buf, 0, count); 41 return count; 39 42 } 40 43 41 const char *test_connect(void) 42 { 43 TPRINTF("Connecting to %u...", IPC_TEST_SERVICE); 44 int phone = ipc_connect_me_to(PHONE_NS, IPC_TEST_SERVICE, 0, 0); 45 if (phone > 0) { 46 TPRINTF("phoneid %d\n", phone); 47 } else { 48 TPRINTF("\n"); 49 return "ipc_connect_me_to() failed"; 50 } 51 52 printf("Sending synchronous message...\n"); 53 int retval = ipc_call_sync_0_0(phone, IPC_TEST_METHOD); 54 TPRINTF("Received response to synchronous message\n"); 55 56 TPRINTF("Sending asynchronous message...\n"); 57 atomic_set(&finish, 0); 58 ipc_call_async_0(phone, IPC_TEST_METHOD, NULL, callback, 1); 59 while (atomic_get(&finish) != 1) 60 TPRINTF("."); 61 TPRINTF("Received response to asynchronous message\n"); 62 63 TPRINTF("Hanging up..."); 64 retval = ipc_hangup(phone); 65 if (retval == 0) { 66 TPRINTF("OK\n"); 67 } else { 68 TPRINTF("\n"); 69 return "ipc_hangup() failed"; 70 } 71 72 return NULL; 44 static int imp_char_write(device_t *dev, char *buf, size_t count) { 45 return count; 73 46 } 47 48 static char_iface_t char_interface = { 49 .read = &impl_char_read, 50 .write = &imp_char_write 51 }; 52 53 device_ops_t char_device_ops = { 54 .interfaces[CHAR_DEV_IFACE] = &char_interface 55 }; 56 -
uspace/drv/test1/test1.c
r59e9398b rb2d06fa 34 34 #include <errno.h> 35 35 #include <str_error.h> 36 #include <driver.h> 37 38 #define NAME "test1" 36 #include "test1.h" 39 37 40 38 static int add_device(device_t *dev); … … 98 96 add_device_to_class(dev, "virtual"); 99 97 100 if (dev->parent == NULL) { 98 if (str_cmp(dev->name, "null") == 0) { 99 dev->ops = &char_device_ops; 100 add_device_to_class(dev, "virt-null"); 101 } else if (dev->parent == NULL) { 101 102 register_child_verbose(dev, "cloning myself ;-)", "clone", 102 103 "virtual&test1", 10); … … 117 118 } 118 119 119
Note:
See TracChangeset
for help on using the changeset viewer.
