ram.c (2a267e7c41aa88215de2b542de797d03d16ecdfd) | ram.c (8880fa32c557600f5f624084152668ed3c2ea51e) |
---|---|
1/* 2 * RAM Oops/Panic logger 3 * 4 * Copyright (C) 2010 Marco Stornelli <marco.stornelli@gmail.com> 5 * Copyright (C) 2011 Kees Cook <keescook@chromium.org> 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License --- 786 unchanged lines hidden (view full) --- 795 796 err = ramoops_init_prz("pmsg", dev, cxt, &cxt->mprz, &paddr, 797 cxt->pmsg_size, 0); 798 if (err) 799 goto fail_init_mprz; 800 801 cxt->pstore.data = cxt; 802 /* | 1/* 2 * RAM Oops/Panic logger 3 * 4 * Copyright (C) 2010 Marco Stornelli <marco.stornelli@gmail.com> 5 * Copyright (C) 2011 Kees Cook <keescook@chromium.org> 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License --- 786 unchanged lines hidden (view full) --- 795 796 err = ramoops_init_prz("pmsg", dev, cxt, &cxt->mprz, &paddr, 797 cxt->pmsg_size, 0); 798 if (err) 799 goto fail_init_mprz; 800 801 cxt->pstore.data = cxt; 802 /* |
803 * Since bufsize is only used for dmesg crash dumps, it 804 * must match the size of the dprz record (after PRZ header 805 * and ECC bytes have been accounted for). | 803 * Prepare frontend flags based on which areas are initialized. 804 * For ramoops_init_przs() cases, the "max count" variable tells 805 * if there are regions present. For ramoops_init_prz() cases, 806 * the single region size is how to check. |
806 */ | 807 */ |
807 cxt->pstore.bufsize = cxt->dprzs[0]->buffer_size; 808 cxt->pstore.buf = kzalloc(cxt->pstore.bufsize, GFP_KERNEL); 809 if (!cxt->pstore.buf) { 810 pr_err("cannot allocate pstore crash dump buffer\n"); 811 err = -ENOMEM; 812 goto fail_clear; 813 } 814 815 cxt->pstore.flags = PSTORE_FLAGS_DMESG; | 808 cxt->pstore.flags = 0; 809 if (cxt->max_dump_cnt) 810 cxt->pstore.flags |= PSTORE_FLAGS_DMESG; |
816 if (cxt->console_size) 817 cxt->pstore.flags |= PSTORE_FLAGS_CONSOLE; | 811 if (cxt->console_size) 812 cxt->pstore.flags |= PSTORE_FLAGS_CONSOLE; |
818 if (cxt->ftrace_size) | 813 if (cxt->max_ftrace_cnt) |
819 cxt->pstore.flags |= PSTORE_FLAGS_FTRACE; 820 if (cxt->pmsg_size) 821 cxt->pstore.flags |= PSTORE_FLAGS_PMSG; 822 | 814 cxt->pstore.flags |= PSTORE_FLAGS_FTRACE; 815 if (cxt->pmsg_size) 816 cxt->pstore.flags |= PSTORE_FLAGS_PMSG; 817 |
818 /* 819 * Since bufsize is only used for dmesg crash dumps, it 820 * must match the size of the dprz record (after PRZ header 821 * and ECC bytes have been accounted for). 822 */ 823 if (cxt->pstore.flags & PSTORE_FLAGS_DMESG) { 824 cxt->pstore.bufsize = cxt->dprzs[0]->buffer_size; 825 cxt->pstore.buf = kzalloc(cxt->pstore.bufsize, GFP_KERNEL); 826 if (!cxt->pstore.buf) { 827 pr_err("cannot allocate pstore crash dump buffer\n"); 828 err = -ENOMEM; 829 goto fail_clear; 830 } 831 } 832 |
|
823 err = pstore_register(&cxt->pstore); 824 if (err) { 825 pr_err("registering with pstore failed\n"); 826 goto fail_buf; 827 } 828 829 /* 830 * Update the module parameter variables as well so they are visible --- 130 unchanged lines hidden --- | 833 err = pstore_register(&cxt->pstore); 834 if (err) { 835 pr_err("registering with pstore failed\n"); 836 goto fail_buf; 837 } 838 839 /* 840 * Update the module parameter variables as well so they are visible --- 130 unchanged lines hidden --- |