Import 2.3.9pre4
[davej-history.git] / arch / mips / lib / tags.c
blob9a2e3cd731f41508f590411468ed386c449a5f13
1 /*
2 * linux/arch/mips/lib/tags.c
4 * Copyright (C) 1996 Stoned Elipot
5 */
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
14 * a pecular one.
16 * Parameter: type - tag type to find
18 * returns : NULL - failure
19 * !NULL - pointer on the tag structure found
21 tag *
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 */
30 return (tag*)NULL;
32 return t;
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)
46 tag* atag;
48 /* for wire_mappings() */
49 atag = bi_TagFind(tag_machgroup);
50 if (atag)
51 memcpy(&mips_machgroup, TAGVALPTR(atag), atag->size);
52 else {
53 /* useless for boxes without text video mode but....*/
54 panic("machine group not specified by bootloader");
57 atag = bi_TagFind(tag_machtype);
58 if (atag)
59 memcpy(&mips_machtype, TAGVALPTR(atag), atag->size);
60 else {
61 /* useless for boxes without text video mode but....*/
62 panic("machine type not specified by bootloader");
65 /* for tlbflush() */
66 atag = bi_TagFind(tag_tlb_entries);
67 if (atag)
68 memcpy(&mips_tlb_entries, TAGVALPTR(atag), atag->size);
69 else {
70 /* useless for boxes without text video mode but....*/
71 panic("number of TLB entries not specified by bootloader");
74 return;