diff options
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/xmon/xmon.c | 107 |
1 files changed, 106 insertions, 1 deletions
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index 987f441525cb..3a56a639a92e 100644 --- a/arch/powerpc/xmon/xmon.c +++ b/arch/powerpc/xmon/xmon.c | |||
@@ -60,6 +60,8 @@ static cpumask_t cpus_in_xmon = CPU_MASK_NONE; | |||
60 | static unsigned long xmon_taken = 1; | 60 | static unsigned long xmon_taken = 1; |
61 | static int xmon_owner; | 61 | static int xmon_owner; |
62 | static int xmon_gate; | 62 | static int xmon_gate; |
63 | #else | ||
64 | #define xmon_owner 0 | ||
63 | #endif /* CONFIG_SMP */ | 65 | #endif /* CONFIG_SMP */ |
64 | 66 | ||
65 | static unsigned long in_xmon __read_mostly = 0; | 67 | static unsigned long in_xmon __read_mostly = 0; |
@@ -202,7 +204,13 @@ Commands:\n\ | |||
202 | di dump instructions\n\ | 204 | di dump instructions\n\ |
203 | df dump float values\n\ | 205 | df dump float values\n\ |
204 | dd dump double values\n\ | 206 | dd dump double values\n\ |
205 | dl dump the kernel log buffer\n\ | 207 | dl dump the kernel log buffer\n" |
208 | #ifdef CONFIG_PPC64 | ||
209 | "\ | ||
210 | dp[#] dump paca for current cpu, or cpu #\n\ | ||
211 | dpa dump paca for all possible cpus\n" | ||
212 | #endif | ||
213 | "\ | ||
206 | dr dump stream of raw bytes\n\ | 214 | dr dump stream of raw bytes\n\ |
207 | e print exception information\n\ | 215 | e print exception information\n\ |
208 | f flush cache\n\ | 216 | f flush cache\n\ |
@@ -2009,6 +2017,95 @@ static void xmon_rawdump (unsigned long adrs, long ndump) | |||
2009 | printf("\n"); | 2017 | printf("\n"); |
2010 | } | 2018 | } |
2011 | 2019 | ||
2020 | #ifdef CONFIG_PPC64 | ||
2021 | static void dump_one_paca(int cpu) | ||
2022 | { | ||
2023 | struct paca_struct *p; | ||
2024 | |||
2025 | if (setjmp(bus_error_jmp) != 0) { | ||
2026 | printf("*** Error dumping paca for cpu 0x%x!\n", cpu); | ||
2027 | return; | ||
2028 | } | ||
2029 | |||
2030 | catch_memory_errors = 1; | ||
2031 | sync(); | ||
2032 | |||
2033 | p = &paca[cpu]; | ||
2034 | |||
2035 | printf("paca for cpu 0x%x @ %p:\n", cpu, p); | ||
2036 | |||
2037 | printf(" %-*s = %s\n", 16, "possible", cpu_possible(cpu) ? "yes" : "no"); | ||
2038 | printf(" %-*s = %s\n", 16, "present", cpu_present(cpu) ? "yes" : "no"); | ||
2039 | printf(" %-*s = %s\n", 16, "online", cpu_online(cpu) ? "yes" : "no"); | ||
2040 | |||
2041 | #define DUMP(paca, name, format) \ | ||
2042 | printf(" %-*s = %#-*"format"\t(0x%lx)\n", 16, #name, 18, paca->name, \ | ||
2043 | offsetof(struct paca_struct, name)); | ||
2044 | |||
2045 | DUMP(p, lock_token, "x"); | ||
2046 | DUMP(p, paca_index, "x"); | ||
2047 | DUMP(p, kernel_toc, "lx"); | ||
2048 | DUMP(p, kernelbase, "lx"); | ||
2049 | DUMP(p, kernel_msr, "lx"); | ||
2050 | #ifdef CONFIG_PPC_STD_MMU_64 | ||
2051 | DUMP(p, stab_real, "lx"); | ||
2052 | DUMP(p, stab_addr, "lx"); | ||
2053 | #endif | ||
2054 | DUMP(p, emergency_sp, "p"); | ||
2055 | DUMP(p, data_offset, "lx"); | ||
2056 | DUMP(p, hw_cpu_id, "x"); | ||
2057 | DUMP(p, cpu_start, "x"); | ||
2058 | DUMP(p, kexec_state, "x"); | ||
2059 | DUMP(p, __current, "p"); | ||
2060 | DUMP(p, kstack, "lx"); | ||
2061 | DUMP(p, stab_rr, "lx"); | ||
2062 | DUMP(p, saved_r1, "lx"); | ||
2063 | DUMP(p, trap_save, "x"); | ||
2064 | DUMP(p, soft_enabled, "x"); | ||
2065 | DUMP(p, irq_happened, "x"); | ||
2066 | DUMP(p, io_sync, "x"); | ||
2067 | DUMP(p, irq_work_pending, "x"); | ||
2068 | DUMP(p, nap_state_lost, "x"); | ||
2069 | |||
2070 | #undef DUMP | ||
2071 | |||
2072 | catch_memory_errors = 0; | ||
2073 | sync(); | ||
2074 | } | ||
2075 | |||
2076 | static void dump_all_pacas(void) | ||
2077 | { | ||
2078 | int cpu; | ||
2079 | |||
2080 | if (num_possible_cpus() == 0) { | ||
2081 | printf("No possible cpus, use 'dp #' to dump individual cpus\n"); | ||
2082 | return; | ||
2083 | } | ||
2084 | |||
2085 | for_each_possible_cpu(cpu) | ||
2086 | dump_one_paca(cpu); | ||
2087 | } | ||
2088 | |||
2089 | static void dump_pacas(void) | ||
2090 | { | ||
2091 | unsigned long num; | ||
2092 | int c; | ||
2093 | |||
2094 | c = inchar(); | ||
2095 | if (c == 'a') { | ||
2096 | dump_all_pacas(); | ||
2097 | return; | ||
2098 | } | ||
2099 | |||
2100 | termch = c; /* Put c back, it wasn't 'a' */ | ||
2101 | |||
2102 | if (scanhex(&num)) | ||
2103 | dump_one_paca(num); | ||
2104 | else | ||
2105 | dump_one_paca(xmon_owner); | ||
2106 | } | ||
2107 | #endif | ||
2108 | |||
2012 | #define isxdigit(c) (('0' <= (c) && (c) <= '9') \ | 2109 | #define isxdigit(c) (('0' <= (c) && (c) <= '9') \ |
2013 | || ('a' <= (c) && (c) <= 'f') \ | 2110 | || ('a' <= (c) && (c) <= 'f') \ |
2014 | || ('A' <= (c) && (c) <= 'F')) | 2111 | || ('A' <= (c) && (c) <= 'F')) |
@@ -2018,6 +2115,14 @@ dump(void) | |||
2018 | int c; | 2115 | int c; |
2019 | 2116 | ||
2020 | c = inchar(); | 2117 | c = inchar(); |
2118 | |||
2119 | #ifdef CONFIG_PPC64 | ||
2120 | if (c == 'p') { | ||
2121 | dump_pacas(); | ||
2122 | return; | ||
2123 | } | ||
2124 | #endif | ||
2125 | |||
2021 | if ((isxdigit(c) && c != 'f' && c != 'd') || c == '\n') | 2126 | if ((isxdigit(c) && c != 'f' && c != 'd') || c == '\n') |
2022 | termch = c; | 2127 | termch = c; |
2023 | scanhex((void *)&adrs); | 2128 | scanhex((void *)&adrs); |