2 * linux/arch/mips/lib/tags.c
4 * Copyright (C) 1996 Stoned Elipot
6 #include <linux/stddef.h>
7 #include <linux/kernel.h>
8 #include <linux/string.h>
9 #include <asm/addrspace.h>
10 #include <asm/bootinfo.h>
13 * Parse the tags present in upper memory to find out
16 * Parameter: type - tag type to find
18 * returns : NULL - failure
19 * !NULL - pointer on the tag structure found
22 bi_TagFind(enum bi_tag type
)
24 tag
* t
= (tag
*)(mips_memory_upper
- sizeof(tag
));
26 while((t
->tag
!= tag_dummy
) && (t
->tag
!= type
))
27 t
= (tag
*)(NEXTTAGPTR(t
));
29 if (t
->tag
== tag_dummy
) /* tag not found */
36 * Snarf from the tag list in memory end some tags needed
37 * before the kernel reachs setup_arch()
39 * add yours here if you want to, but *beware*: the kernel var
40 * that will hold the values you want to snarf have to be
41 * in .data section of the kernel, so initialized in to whatever
42 * value in the kernel's sources.
44 void bi_EarlySnarf(void)
48 /* for wire_mappings() */
49 atag
= bi_TagFind(tag_machgroup
);
51 memcpy(&mips_machgroup
, TAGVALPTR(atag
), atag
->size
);
53 /* useless for boxes without text video mode but....*/
54 panic("machine group not specified by bootloader");
57 atag
= bi_TagFind(tag_machtype
);
59 memcpy(&mips_machtype
, TAGVALPTR(atag
), atag
->size
);
61 /* useless for boxes without text video mode but....*/
62 panic("machine type not specified by bootloader");
66 atag
= bi_TagFind(tag_tlb_entries
);
68 memcpy(&mips_tlb_entries
, TAGVALPTR(atag
), atag
->size
);
70 /* useless for boxes without text video mode but....*/
71 panic("number of TLB entries not specified by bootloader");