1
2
3
4
5
6#include <linux/kernel.h>
7#include <linux/sched.h>
8#include <linux/interrupt.h>
9#include <linux/kernel_stat.h>
10#include <linux/param.h>
11#include <linux/timex.h>
12#include <linux/mm.h>
13
14#include <asm/sn/klconfig.h>
15#include <asm/sn/arch.h>
16#include <asm/sn/gda.h>
17
18klinfo_t *find_component(lboard_t *brd, klinfo_t *kli, unsigned char struct_type)
19{
20 int index, j;
21
22 if (kli == (klinfo_t *)NULL) {
23 index = 0;
24 } else {
25 for (j = 0; j < KLCF_NUM_COMPS(brd); j++)
26 if (kli == KLCF_COMP(brd, j))
27 break;
28 index = j;
29 if (index == KLCF_NUM_COMPS(brd)) {
30 printk("find_component: Bad pointer: 0x%p\n", kli);
31 return (klinfo_t *)NULL;
32 }
33 index++;
34 }
35
36 for (; index < KLCF_NUM_COMPS(brd); index++) {
37 kli = KLCF_COMP(brd, index);
38 if (KLCF_COMP_TYPE(kli) == struct_type)
39 return kli;
40 }
41
42
43 return (klinfo_t *)NULL;
44}
45
46klinfo_t *find_first_component(lboard_t *brd, unsigned char struct_type)
47{
48 return find_component(brd, (klinfo_t *)NULL, struct_type);
49}
50
51lboard_t *find_lboard(lboard_t *start, unsigned char brd_type)
52{
53
54 while (start) {
55 if (start->brd_type == brd_type)
56 return start;
57 start = KLCF_NEXT(start);
58 }
59
60 return (lboard_t *)NULL;
61}
62
63lboard_t *find_lboard_class(lboard_t *start, unsigned char brd_type)
64{
65
66 while (start) {
67 if (KLCLASS(start->brd_type) == KLCLASS(brd_type))
68 return start;
69 start = KLCF_NEXT(start);
70 }
71
72
73 return (lboard_t *)NULL;
74}
75