Lines Matching refs:dev

42 #define for_each_padev(dev) \  argument
43 for (dev = root.child; dev != NULL; dev = next_dev(dev))
45 #define check_dev(dev) \ argument
46 (dev->id.hw_type != HPHW_FAULTY) ? dev : next_dev(dev)
55 struct parisc_device *next_dev(struct parisc_device *dev) in next_dev() argument
57 if (dev->child) { in next_dev()
58 return check_dev(dev->child); in next_dev()
59 } else if (dev->sibling) { in next_dev()
60 return dev->sibling; in next_dev()
65 dev = dev->parent; in next_dev()
66 if (dev && dev->sibling) in next_dev()
67 return dev->sibling; in next_dev()
68 } while (dev != &root); in next_dev()
78 static int match_device(struct parisc_driver *driver, struct parisc_device *dev) in match_device() argument
84 (ids->sversion != dev->id.sversion)) in match_device()
88 (ids->hw_type != dev->id.hw_type)) in match_device()
92 (ids->hversion != dev->id.hversion)) in match_device()
100 static void claim_device(struct parisc_driver *driver, struct parisc_device *dev) in claim_device() argument
102 dev->driver = driver; in claim_device()
103 request_mem_region(dev->hpa, 0x1000, driver->name); in claim_device()
173 struct parisc_device *dev; in unregister_parisc_driver() local
199 for_each_padev(dev) { in unregister_parisc_driver()
200 if (dev->driver != driver) in unregister_parisc_driver()
202 dev->driver = NULL; in unregister_parisc_driver()
203 release_mem_region(dev->hpa, 0x1000); in unregister_parisc_driver()
211 struct parisc_device *dev; in find_device_by_addr() local
212 for_each_padev(dev) { in find_device_by_addr()
213 if (dev->hpa == hpa) in find_device_by_addr()
214 return dev; in find_device_by_addr()
227 const struct parisc_device *find_pa_parent_type(const struct parisc_device *dev, int type) in find_pa_parent_type() argument
229 while (dev != &root) { in find_pa_parent_type()
230 if (dev->id.hw_type == type) in find_pa_parent_type()
231 return dev; in find_pa_parent_type()
232 dev = dev->parent; in find_pa_parent_type()
239 get_node_path(struct parisc_device *dev, struct hardware_path *path) in get_node_path() argument
243 while (dev != &root) { in get_node_path()
244 path->bc[i--] = dev->hw_path; in get_node_path()
245 dev = dev->parent; in get_node_path()
270 char *print_pa_hwpath(struct parisc_device *dev, char *output) in print_pa_hwpath() argument
274 get_node_path(dev->parent, &path); in print_pa_hwpath()
275 path.mod = dev->hw_path; in print_pa_hwpath()
290 void get_pci_node_path(struct pci_dev *dev, struct hardware_path *path) in get_pci_node_path() argument
297 path->mod = PCI_FUNC(dev->devfn); in get_pci_node_path()
298 path->bc[i--] = PCI_SLOT(dev->devfn); in get_pci_node_path()
299 for (bus = dev->bus; bus->parent; bus = bus->parent) { in get_pci_node_path()
304 padev = HBA_DATA(bus->sysdata)->dev; in get_pci_node_path()
320 char *print_pci_hwpath(struct pci_dev *dev, char *output) in print_pci_hwpath() argument
324 get_pci_node_path(dev, &path); in print_pci_hwpath()
333 struct parisc_device *dev = kmalloc(sizeof(*dev), GFP_KERNEL); in create_tree_node() local
334 if (!dev) in create_tree_node()
336 memset(dev, 0, sizeof(*dev)); in create_tree_node()
337 dev->hw_path = id; in create_tree_node()
338 dev->id.hw_type = HPHW_FAULTY; in create_tree_node()
339 dev->parent = parent; in create_tree_node()
340 dev->sibling = *insert; in create_tree_node()
341 *insert = dev; in create_tree_node()
342 return dev; in create_tree_node()
393 struct parisc_device *dev; in alloc_pa_dev() local
404 dev = find_parisc_device(mod_path); in alloc_pa_dev()
405 if (dev->id.hw_type != HPHW_FAULTY) { in alloc_pa_dev()
407 print_pa_hwpath(dev, p); in alloc_pa_dev()
413 dev->id.hw_type = iodc_data[3] & 0x1f; in alloc_pa_dev()
414 dev->id.hversion = (iodc_data[0] << 4) | ((iodc_data[1] & 0xf0) >> 4); in alloc_pa_dev()
415 dev->id.hversion_rev = iodc_data[1] & 0x0f; in alloc_pa_dev()
416 dev->id.sversion = ((iodc_data[4] & 0x0f) << 16) | in alloc_pa_dev()
418 dev->hpa = hpa; in alloc_pa_dev()
420 name = parisc_hardware_description(&dev->id); in alloc_pa_dev()
422 strncpy(dev->name, name, sizeof(dev->name)-1); in alloc_pa_dev()
425 return dev; in alloc_pa_dev()
435 int register_parisc_device(struct parisc_device *dev) in register_parisc_device() argument
439 if (!dev) in register_parisc_device()
442 if (dev->driver) in register_parisc_device()
449 if (!match_device(driver,dev)) in register_parisc_device()
451 if (driver->probe(dev) == 0) in register_parisc_device()
456 claim_device(driver, dev); in register_parisc_device()
468 #define BUS_CONVERTER(dev) \ argument
469 ((dev->id.hw_type == HPHW_IOA) || (dev->id.hw_type == HPHW_BCPORT))
471 #define IS_LOWER_PORT(dev) \ argument
472 ((__raw_readl(dev->hpa + IO_STATUS) & BC_PORT_MASK) == BC_LOWER_PORT)
480 #define READ_IO_IO_LOW(dev) (unsigned long)(signed int)__raw_readl(dev->hpa + IO_IO_LOW) argument
481 #define READ_IO_IO_HIGH(dev) (unsigned long)(signed int)__raw_readl(dev->hpa + IO_IO_HIGH) argument
486 void walk_lower_bus(struct parisc_device *dev) in walk_lower_bus() argument
490 if(!BUS_CONVERTER(dev) || IS_LOWER_PORT(dev)) in walk_lower_bus()
493 if(dev->id.hw_type == HPHW_IOA) { in walk_lower_bus()
494 io_io_low = (unsigned long)(signed int)(READ_IO_IO_LOW(dev) << 16); in walk_lower_bus()
497 io_io_low = (READ_IO_IO_LOW(dev) + ~FLEX_MASK) & FLEX_MASK; in walk_lower_bus()
498 io_io_high = (READ_IO_IO_HIGH(dev)+ ~FLEX_MASK) & FLEX_MASK; in walk_lower_bus()
501 walk_native_bus(io_io_low, io_io_high, dev); in walk_lower_bus()
526 struct parisc_device *dev; in walk_native_bus() local
529 dev = find_device_by_addr(hpa); in walk_native_bus()
530 if (!dev) { in walk_native_bus()
532 dev = alloc_pa_dev(hpa, &path); in walk_native_bus()
533 if (!dev) in walk_native_bus()
536 register_parisc_device(dev); in walk_native_bus()
539 walk_lower_bus(dev); in walk_native_bus()
562 struct parisc_device *dev; in fixup_child_irqs() local
567 for (dev = check_dev(parent->child); dev; dev = dev->sibling) { in fixup_child_irqs()
568 int irq = choose_irq(dev); in fixup_child_irqs()
573 dev->irq = base + irq; in fixup_child_irqs()
578 static void print_parisc_device(struct parisc_device *dev) in print_parisc_device() argument
583 print_pa_hwpath(dev, hw_path); in print_parisc_device()
585 ++count, dev->name, dev->id.hw_type, dev->hpa, hw_path, in print_parisc_device()
586 dev->id.hversion, dev->id.hversion_rev, dev->id.sversion); in print_parisc_device()
588 if (dev->num_addrs) { in print_parisc_device()
591 for (k = 0; k < dev->num_addrs; k++) in print_parisc_device()
592 printk("0x%lx ", dev->addr[k]); in print_parisc_device()
599 struct parisc_device *dev; in print_subdevices() local
600 for (dev = parent->child; dev != parent->sibling; dev = next_dev(dev)) { in print_subdevices()
601 print_parisc_device(dev); in print_subdevices()
610 struct parisc_device *dev; in print_parisc_devices() local
611 for_each_padev(dev) { in print_parisc_devices()
612 print_parisc_device(dev); in print_parisc_devices()