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.
6 * Miguel de Icaza, 1997.
9 #include <asm/inventory.h>
10 #include <asm/uaccess.h>
12 #define MAX_INVENTORY 50
13 int inventory_items
= 0;
15 static inventory_t inventory
[MAX_INVENTORY
];
17 void add_to_inventory (int class, int type
, int controller
, int unit
, int state
)
19 inventory_t
*ni
= &inventory
[inventory_items
];
21 if (inventory_items
== MAX_INVENTORY
)
24 ni
->inv_class
= class;
26 ni
->inv_controller
= controller
;
28 ni
->inv_state
= state
;
33 int dump_inventory_to_user (void *userbuf
, int size
)
35 inventory_t
*inv
= &inventory
[0];
36 inventory_t
*user
= userbuf
;
39 if (!access_ok(VERIFY_WRITE
, userbuf
, size
))
42 for (v
= 0; v
< inventory_items
; v
++){
44 copy_to_user (user
, inv
, sizeof (inventory_t
));
47 return inventory_items
* sizeof (inventory_t
);
50 int __init
init_inventory(void)
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
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);