Changeset 3843ecb in mainline for uspace/srv
- Timestamp:
- 2010-04-09T13:54:06Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 892e4e1
- Parents:
- 3a5909f
- Location:
- uspace/srv
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devman/main.c
r3a5909f r3843ecb 121 121 } 122 122 123 /** 124 * Receive device match ID from the device's parent driver and add it to the list of devices match ids. 125 * 126 * @param match_ids the list of the device's match ids. 127 * 128 * @return 0 on success, negative error code otherwise. 129 */ 123 130 static int devman_receive_match_id(match_id_list_t *match_ids) { 124 131 … … 159 166 } 160 167 168 /** 169 * Receive device match IDs from the device's parent driver 170 * and add them to the list of devices match ids. 171 * 172 * @param match_count the number of device's match ids to be received. 173 * @param match_ids the list of the device's match ids. 174 * 175 * @return 0 on success, negative error code otherwise. 176 */ 161 177 static int devman_receive_match_ids(ipcarg_t match_count, match_id_list_t *match_ids) 162 178 { … … 171 187 } 172 188 173 static void devman_add_child(ipc_callid_t callid, ipc_call_t *call, driver_t *driver) 189 /** Handle child device registration. 190 * 191 * Child devices are registered by their parent's device driver. 192 */ 193 static void devman_add_child(ipc_callid_t callid, ipc_call_t *call) 174 194 { 175 195 // printf(NAME ": devman_add_child\n"); … … 211 231 } 212 232 233 /** 234 * Initialize driver which has registered itself as running and ready. 235 * 236 * The initialization is done in a separate fibril to avoid deadlocks 237 * (if the driver needed to be served by devman during the driver's initialization). 238 */ 213 239 static int init_running_drv(void *drv) 214 240 { … … 219 245 } 220 246 221 /** Function for handling connections to device manager. 222 * 247 /** Function for handling connections from a driver to the device manager. 223 248 */ 224 249 static void devman_connection_driver(ipc_callid_t iid, ipc_call_t *icall) … … 231 256 return; 232 257 258 // Initialize the driver as running (e.g. pass assigned devices to it) in a separate fibril; 259 // the separate fibril is used to enable the driver 260 // to use devman service during the driver's initialization. 233 261 fid_t fid = fibril_create(init_running_drv, driver); 234 262 if (fid == 0) { 235 263 printf(NAME ": Error creating fibril for the initialization of the newly registered running driver.\n"); 236 exit(1);264 return; 237 265 } 238 266 fibril_add_ready(fid); … … 254 282 continue; 255 283 case DEVMAN_ADD_CHILD_DEVICE: 256 devman_add_child(callid, &call , driver);284 devman_add_child(callid, &call); 257 285 break; 258 286 default: … … 299 327 300 328 if (driver->phone <= 0) { 301 printf(NAME ": devman_forward: cound not forward to driver %s (the driver's phone is %x).\n", driver->name, driver->phone); 329 printf(NAME ": devman_forward: cound not forward to driver %s ", driver->name); 330 printf("the driver's phone is %x).\n", driver->phone); 302 331 return; 303 332 } -
uspace/srv/drivers/pciintel/pci.c
r3a5909f r3843ecb 58 58 #define NAME "pciintel" 59 59 60 61 60 #define CONF_ADDR(bus, dev, fn, reg) ((1 << 31) | (bus << 16) | (dev << 11) | (fn << 8) | (reg & ~3)) 61 62 63 static hw_resource_list_t * pciintel_get_child_resources(device_t *dev) 64 { 65 pci_dev_data_t *dev_data = (pci_dev_data_t *)dev->driver_data; 66 if (NULL == dev_data) { 67 return NULL; 68 } 69 return &dev_data->hw_resources; 70 } 71 72 static bool pciintel_enable_child_interrupt(device_t *dev) 73 { 74 // TODO 75 76 return false; 77 } 78 79 static resource_iface_t pciintel_child_res_iface = { 80 &pciintel_get_child_resources, 81 &pciintel_enable_child_interrupt 82 }; 83 84 static device_class_t pci_child_class; 62 85 63 86 … … 373 396 pci_read_interrupt(dev); 374 397 375 // TODO initialize device interfaces398 dev->class = &pci_child_class; 376 399 377 400 printf(NAME ": adding new child device %s.\n", dev->name); … … 464 487 } 465 488 489 static void pciintel_init() 490 { 491 pci_child_class.id = 0; // TODO 492 pci_child_class.interfaces[HW_RES_DEV_IFACE] = &pciintel_child_res_iface; 493 } 494 466 495 int main(int argc, char *argv[]) 467 496 { 468 printf(NAME ": HelenOS pci bus driver (intel method 1).\n"); 497 printf(NAME ": HelenOS pci bus driver (intel method 1).\n"); 498 pciintel_init(); 469 499 return driver_main(&pci_driver); 470 500 } -
uspace/srv/drivers/pciintel/pci.h
r3a5909f r3843ecb 110 110 } 111 111 112 static inline boolpci_clean_resource_list(device_t *dev)112 static inline void pci_clean_resource_list(device_t *dev) 113 113 { 114 114 pci_dev_data_t *dev_data = (pci_dev_data_t *)dev->driver_data; -
uspace/srv/drivers/rootia32/rootia32.c
r3a5909f r3843ecb 51 51 #include <ipc/dev_iface.h> 52 52 #include <resource.h> 53 #include <device/hw_res.h> 53 54 54 55 #define NAME "rootia32" … … 111 112 }; 112 113 114 // initialized in root_ia32_init() function 115 static device_class_t rootia32_child_class; 116 113 117 static bool rootia32_add_child( 114 118 device_t *parent, const char *name, const char *str_match_id, … … 136 140 add_match_id(&child->match_ids, match_id); 137 141 138 // add an interfaceto the device139 device_set_iface(child, HW_RES_DEV_IFACE, &child_res_iface);142 // set class to the device 143 child->class = &rootia32_child_class; 140 144 141 145 // register child device … … 181 185 } 182 186 187 static void root_ia32_init() { 188 // initialize child device class 189 rootia32_child_class.id = 0; // TODO 190 rootia32_child_class.interfaces[HW_RES_DEV_IFACE] = &child_res_iface; 191 } 192 183 193 int main(int argc, char *argv[]) 184 194 { 185 195 printf(NAME ": HelenOS root device driver\n"); 196 root_ia32_init(); 186 197 return driver_main(&rootia32_driver); 187 198 }
Note:
See TracChangeset
for help on using the changeset viewer.