diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/mips/kernel/irixinv.c |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'arch/mips/kernel/irixinv.c')
-rw-r--r-- | arch/mips/kernel/irixinv.c | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/arch/mips/kernel/irixinv.c b/arch/mips/kernel/irixinv.c new file mode 100644 index 000000000000..60aa98cd1791 --- /dev/null +++ b/arch/mips/kernel/irixinv.c | |||
@@ -0,0 +1,77 @@ | |||
1 | /* | ||
2 | * Support the inventory interface for IRIX binaries | ||
3 | * This is invoked before the mm layer is working, so we do not | ||
4 | * use the linked lists for the inventory yet. | ||
5 | * | ||
6 | * Miguel de Icaza, 1997. | ||
7 | */ | ||
8 | #include <linux/mm.h> | ||
9 | #include <asm/inventory.h> | ||
10 | #include <asm/uaccess.h> | ||
11 | |||
12 | #define MAX_INVENTORY 50 | ||
13 | int inventory_items = 0; | ||
14 | |||
15 | static inventory_t inventory [MAX_INVENTORY]; | ||
16 | |||
17 | void add_to_inventory (int class, int type, int controller, int unit, int state) | ||
18 | { | ||
19 | inventory_t *ni = &inventory [inventory_items]; | ||
20 | |||
21 | if (inventory_items == MAX_INVENTORY) | ||
22 | return; | ||
23 | |||
24 | ni->inv_class = class; | ||
25 | ni->inv_type = type; | ||
26 | ni->inv_controller = controller; | ||
27 | ni->inv_unit = unit; | ||
28 | ni->inv_state = state; | ||
29 | ni->inv_next = ni; | ||
30 | inventory_items++; | ||
31 | } | ||
32 | |||
33 | int dump_inventory_to_user (void *userbuf, int size) | ||
34 | { | ||
35 | inventory_t *inv = &inventory [0]; | ||
36 | inventory_t *user = userbuf; | ||
37 | int v; | ||
38 | |||
39 | if (!access_ok(VERIFY_WRITE, userbuf, size)) | ||
40 | return -EFAULT; | ||
41 | |||
42 | for (v = 0; v < inventory_items; v++){ | ||
43 | inv = &inventory [v]; | ||
44 | copy_to_user (user, inv, sizeof (inventory_t)); | ||
45 | user++; | ||
46 | } | ||
47 | return inventory_items * sizeof (inventory_t); | ||
48 | } | ||
49 | |||
50 | int __init init_inventory(void) | ||
51 | { | ||
52 | /* | ||
53 | * gross hack while we put the right bits all over the kernel | ||
54 | * most likely this will not let just anyone run the X server | ||
55 | * until we put the right values all over the place | ||
56 | */ | ||
57 | add_to_inventory (10, 3, 0, 0, 16400); | ||
58 | add_to_inventory (1, 1, 150, -1, 12); | ||
59 | add_to_inventory (1, 3, 0, 0, 8976); | ||
60 | add_to_inventory (1, 2, 0, 0, 8976); | ||
61 | add_to_inventory (4, 8, 0, 0, 2); | ||
62 | add_to_inventory (5, 5, 0, 0, 1); | ||
63 | add_to_inventory (3, 3, 0, 0, 32768); | ||
64 | add_to_inventory (3, 4, 0, 0, 32768); | ||
65 | add_to_inventory (3, 8, 0, 0, 524288); | ||
66 | add_to_inventory (3, 9, 0, 0, 64); | ||
67 | add_to_inventory (3, 1, 0, 0, 67108864); | ||
68 | add_to_inventory (12, 3, 0, 0, 16); | ||
69 | add_to_inventory (8, 7, 17, 0, 16777472); | ||
70 | add_to_inventory (8, 0, 0, 0, 1); | ||
71 | add_to_inventory (2, 1, 0, 13, 2); | ||
72 | add_to_inventory (2, 2, 0, 2, 0); | ||
73 | add_to_inventory (2, 2, 0, 1, 0); | ||
74 | add_to_inventory (7, 14, 0, 0, 6); | ||
75 | |||
76 | return 0; | ||
77 | } | ||