1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 1999, 2000 Ralf Baechle (ralf@gnu.org)
4 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
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>
14 #include <asm/sn/klconfig.h>
15 #include <asm/sn/arch.h>
16 #include <asm/sn/gda.h>
18 klinfo_t
*find_component(lboard_t
*brd
, klinfo_t
*kli
, unsigned char struct_type
)
22 if (kli
== (klinfo_t
*)NULL
) {
25 for (j
= 0; j
< KLCF_NUM_COMPS(brd
); j
++)
26 if (kli
== KLCF_COMP(brd
, j
))
29 if (index
== KLCF_NUM_COMPS(brd
)) {
30 printk("find_component: Bad pointer: 0x%p\n", kli
);
31 return (klinfo_t
*)NULL
;
33 index
++; /* next component */
36 for (; index
< KLCF_NUM_COMPS(brd
); index
++) {
37 kli
= KLCF_COMP(brd
, index
);
38 if (KLCF_COMP_TYPE(kli
) == struct_type
)
43 return (klinfo_t
*)NULL
;
46 klinfo_t
*find_first_component(lboard_t
*brd
, unsigned char struct_type
)
48 return find_component(brd
, (klinfo_t
*)NULL
, struct_type
);
51 lboard_t
*find_lboard(lboard_t
*start
, unsigned char brd_type
)
53 /* Search all boards stored on this node. */
55 if (start
->brd_type
== brd_type
)
57 start
= KLCF_NEXT(start
);
60 return (lboard_t
*)NULL
;
63 lboard_t
*find_lboard_class(lboard_t
*start
, unsigned char brd_type
)
65 /* Search all boards stored on this node. */
67 if (KLCLASS(start
->brd_type
) == KLCLASS(brd_type
))
69 start
= KLCF_NEXT(start
);
73 return (lboard_t
*)NULL
;