gct.c 1.0 KB

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