Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /*
0003  * Copyright (C) 1999, 2000 Ralf Baechle (ralf@gnu.org)
0004  * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
0005  */
0006 #include <linux/kernel.h>
0007 #include <linux/sched.h>
0008 #include <linux/interrupt.h>
0009 #include <linux/kernel_stat.h>
0010 #include <linux/param.h>
0011 #include <linux/timex.h>
0012 #include <linux/mm.h>
0013 
0014 #include <asm/sn/klconfig.h>
0015 #include <asm/sn/arch.h>
0016 #include <asm/sn/gda.h>
0017 
0018 klinfo_t *find_component(lboard_t *brd, klinfo_t *kli, unsigned char struct_type)
0019 {
0020     int index, j;
0021 
0022     if (kli == (klinfo_t *)NULL) {
0023         index = 0;
0024     } else {
0025         for (j = 0; j < KLCF_NUM_COMPS(brd); j++)
0026             if (kli == KLCF_COMP(brd, j))
0027                 break;
0028         index = j;
0029         if (index == KLCF_NUM_COMPS(brd)) {
0030             printk("find_component: Bad pointer: 0x%p\n", kli);
0031             return (klinfo_t *)NULL;
0032         }
0033         index++;        /* next component */
0034     }
0035 
0036     for (; index < KLCF_NUM_COMPS(brd); index++) {
0037         kli = KLCF_COMP(brd, index);
0038         if (KLCF_COMP_TYPE(kli) == struct_type)
0039             return kli;
0040     }
0041 
0042     /* Didn't find it. */
0043     return (klinfo_t *)NULL;
0044 }
0045 
0046 klinfo_t *find_first_component(lboard_t *brd, unsigned char struct_type)
0047 {
0048     return find_component(brd, (klinfo_t *)NULL, struct_type);
0049 }
0050 
0051 lboard_t *find_lboard(lboard_t *start, unsigned char brd_type)
0052 {
0053     /* Search all boards stored on this node. */
0054     while (start) {
0055         if (start->brd_type == brd_type)
0056             return start;
0057         start = KLCF_NEXT(start);
0058     }
0059     /* Didn't find it. */
0060     return (lboard_t *)NULL;
0061 }
0062 
0063 lboard_t *find_lboard_class(lboard_t *start, unsigned char brd_type)
0064 {
0065     /* Search all boards stored on this node. */
0066     while (start) {
0067         if (KLCLASS(start->brd_type) == KLCLASS(brd_type))
0068             return start;
0069         start = KLCF_NEXT(start);
0070     }
0071 
0072     /* Didn't find it. */
0073     return (lboard_t *)NULL;
0074 }