]>
git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - arch/arm/kernel/atags_proc.c
1 #include <linux/slab.h>
2 #include <linux/proc_fs.h>
13 read_buffer(char* page
, char** start
, off_t off
, int count
,
16 struct buffer
*buffer
= (struct buffer
*)data
;
18 if (off
>= buffer
->size
) {
23 count
= min((int) (buffer
->size
- off
), count
);
25 memcpy(page
, &buffer
->data
[off
], count
);
30 #define BOOT_PARAMS_SIZE 1536
31 static char __initdata atags_copy
[BOOT_PARAMS_SIZE
];
33 void __init
save_atags(const struct tag
*tags
)
35 memcpy(atags_copy
, tags
, sizeof(atags_copy
));
38 static int __init
init_atags_procfs(void)
41 * This cannot go into save_atags() because kmalloc and proc don't work
42 * yet when it is called.
44 struct proc_dir_entry
*tags_entry
;
45 struct tag
*tag
= (struct tag
*)atags_copy
;
49 if (tag
->hdr
.tag
!= ATAG_CORE
) {
50 printk(KERN_INFO
"No ATAGs?");
54 for (; tag
->hdr
.size
; tag
= tag_next(tag
))
57 /* include the terminating ATAG_NONE */
58 size
= (char *)tag
- atags_copy
+ sizeof(struct tag_header
);
60 WARN_ON(tag
->hdr
.tag
!= ATAG_NONE
);
62 b
= kmalloc(sizeof(*b
) + size
, GFP_KERNEL
);
67 memcpy(b
->data
, atags_copy
, size
);
69 tags_entry
= create_proc_read_entry("atags", 0400,
70 NULL
, read_buffer
, b
);
79 printk(KERN_ERR
"Exporting ATAGs: not enough memory\n");
83 arch_initcall(init_atags_procfs
);