gct.c 1011 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * linux/arch/alpha/kernel/gct.c
  3. */
  4. #include <linux/kernel.h>
  5. #include <linux/types.h>
  6. #include <linux/errno.h>
  7. #include <asm/hwrpb.h>
  8. #include <asm/gct.h>
  9. int
  10. gct6_find_nodes(gct6_node *node, gct6_search_struct *search)
  11. {
  12. gct6_search_struct *wanted;
  13. int status = 0;
  14. /* First check the magic number. */
  15. if (node->magic != GCT_NODE_MAGIC) {
  16. printk(KERN_ERR "GCT Node MAGIC incorrect - GCT invalid\n");
  17. return -EINVAL;
  18. }
  19. /* Check against the search struct. */
  20. for (wanted = search;
  21. wanted && (wanted->type | wanted->subtype);
  22. wanted++) {
  23. if (node->type != wanted->type)
  24. continue;
  25. if (node->subtype != wanted->subtype)
  26. continue;
  27. /* Found it -- call out. */
  28. if (wanted->callout)
  29. wanted->callout(node);
  30. }
  31. /* Now walk the tree, siblings first. */
  32. if (node->next)
  33. status |= gct6_find_nodes(GCT_NODE_PTR(node->next), search);
  34. /* Then the children. */
  35. if (node->child)
  36. status |= gct6_find_nodes(GCT_NODE_PTR(node->child), search);
  37. return status;
  38. }