diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-22 19:02:13 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-22 19:02:13 -0400 |
| commit | 5d4e2d08e7fdf7339f84a1c670d296a77e02f881 (patch) | |
| tree | 1c419660defa56191091dfdf50fdb57a72009173 /lib | |
| parent | fb2123fad3b499f0898835b19dbb93b18d27ee98 (diff) | |
| parent | 94ca629e40eb7e997be21d8065c25e4f3797b03f (diff) | |
Merge tag 'driver-core-3.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Pull driver core updates from Greg Kroah-Hartman:
"Here's the driver core, and other driver subsystems, pull request for
the 3.5-rc1 merge window.
Outside of a few minor driver core changes, we ended up with the
following different subsystem and core changes as well, due to
interdependancies on the driver core:
- hyperv driver updates
- drivers/memory being created and some drivers moved into it
- extcon driver subsystem created out of the old Android staging
switch driver code
- dynamic debug updates
- printk rework, and /dev/kmsg changes
All of this has been tested in the linux-next releases for a few weeks
with no reported problems.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>"
Fix up conflicts in drivers/extcon/extcon-max8997.c where git noticed
that a patch to the deleted drivers/misc/max8997-muic.c driver needs to
be applied to this one.
* tag 'driver-core-3.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (90 commits)
uio_pdrv_genirq: get irq through platform resource if not set otherwise
memory: tegra{20,30}-mc: Remove empty *_remove()
printk() - isolate KERN_CONT users from ordinary complete lines
sysfs: get rid of some lockdep false positives
Drivers: hv: util: Properly handle version negotiations.
Drivers: hv: Get rid of an unnecessary check in vmbus_prep_negotiate_resp()
memory: tegra{20,30}-mc: Use dev_err_ratelimited()
driver core: Add dev_*_ratelimited() family
Driver Core: don't oops with unregistered driver in driver_find_device()
printk() - restore prefix/timestamp printing for multi-newline strings
printk: add stub for prepend_timestamp()
ARM: tegra30: Make MC optional in Kconfig
ARM: tegra20: Make MC optional in Kconfig
ARM: tegra30: MC: Remove unnecessary BUG*()
ARM: tegra20: MC: Remove unnecessary BUG*()
printk: correctly align __log_buf
ARM: tegra30: Add Tegra Memory Controller(MC) driver
ARM: tegra20: Add Tegra Memory Controller(MC) driver
printk() - restore timestamp printing at console output
printk() - do not merge continuation lines of different threads
...
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/Kconfig | 8 | ||||
| -rw-r--r-- | lib/Kconfig.debug | 33 | ||||
| -rw-r--r-- | lib/Makefile | 2 | ||||
| -rw-r--r-- | lib/dynamic_debug.c | 190 | ||||
| -rw-r--r-- | lib/jedec_ddr_data.c | 135 | ||||
| -rw-r--r-- | lib/kobject.c | 14 |
6 files changed, 295 insertions, 87 deletions
diff --git a/lib/Kconfig b/lib/Kconfig index 4a8aba2e5cc..0e25c03939e 100644 --- a/lib/Kconfig +++ b/lib/Kconfig | |||
| @@ -353,6 +353,14 @@ config CORDIC | |||
| 353 | This option provides an implementation of the CORDIC algorithm; | 353 | This option provides an implementation of the CORDIC algorithm; |
| 354 | calculations are in fixed point. Module will be called cordic. | 354 | calculations are in fixed point. Module will be called cordic. |
| 355 | 355 | ||
| 356 | config DDR | ||
| 357 | bool "JEDEC DDR data" | ||
| 358 | help | ||
| 359 | Data from JEDEC specs for DDR SDRAM memories, | ||
| 360 | particularly the AC timing parameters and addressing | ||
| 361 | information. This data is useful for drivers handling | ||
| 362 | DDR SDRAM controllers. | ||
| 363 | |||
| 356 | config MPILIB | 364 | config MPILIB |
| 357 | tristate | 365 | tristate |
| 358 | select CLZ_TAB | 366 | select CLZ_TAB |
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 6777153f18f..e1193417703 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
| @@ -3,12 +3,16 @@ config PRINTK_TIME | |||
| 3 | bool "Show timing information on printks" | 3 | bool "Show timing information on printks" |
| 4 | depends on PRINTK | 4 | depends on PRINTK |
| 5 | help | 5 | help |
| 6 | Selecting this option causes timing information to be | 6 | Selecting this option causes time stamps of the printk() |
| 7 | included in printk output. This allows you to measure | 7 | messages to be added to the output of the syslog() system |
| 8 | the interval between kernel operations, including bootup | 8 | call and at the console. |
| 9 | operations. This is useful for identifying long delays | 9 | |
| 10 | in kernel startup. Or add printk.time=1 at boot-time. | 10 | The timestamp is always recorded internally, and exported |
| 11 | See Documentation/kernel-parameters.txt | 11 | to /dev/kmsg. This flag just specifies if the timestamp should |
| 12 | be included, not that the timestamp is recorded. | ||
| 13 | |||
| 14 | The behavior is also controlled by the kernel command line | ||
| 15 | parameter printk.time=1. See Documentation/kernel-parameters.txt | ||
| 12 | 16 | ||
| 13 | config DEFAULT_MESSAGE_LOGLEVEL | 17 | config DEFAULT_MESSAGE_LOGLEVEL |
| 14 | int "Default message log level (1-7)" | 18 | int "Default message log level (1-7)" |
| @@ -1205,8 +1209,13 @@ config DYNAMIC_DEBUG | |||
| 1205 | otherwise be available at runtime. These messages can then be | 1209 | otherwise be available at runtime. These messages can then be |
| 1206 | enabled/disabled based on various levels of scope - per source file, | 1210 | enabled/disabled based on various levels of scope - per source file, |
| 1207 | function, module, format string, and line number. This mechanism | 1211 | function, module, format string, and line number. This mechanism |
| 1208 | implicitly enables all pr_debug() and dev_dbg() calls. The impact of | 1212 | implicitly compiles in all pr_debug() and dev_dbg() calls, which |
| 1209 | this compile option is a larger kernel text size of about 2%. | 1213 | enlarges the kernel text size by about 2%. |
| 1214 | |||
| 1215 | If a source file is compiled with DEBUG flag set, any | ||
| 1216 | pr_debug() calls in it are enabled by default, but can be | ||
| 1217 | disabled at runtime as below. Note that DEBUG flag is | ||
| 1218 | turned on by many CONFIG_*DEBUG* options. | ||
| 1210 | 1219 | ||
| 1211 | Usage: | 1220 | Usage: |
| 1212 | 1221 | ||
| @@ -1223,16 +1232,16 @@ config DYNAMIC_DEBUG | |||
| 1223 | lineno : line number of the debug statement | 1232 | lineno : line number of the debug statement |
| 1224 | module : module that contains the debug statement | 1233 | module : module that contains the debug statement |
| 1225 | function : function that contains the debug statement | 1234 | function : function that contains the debug statement |
| 1226 | flags : 'p' means the line is turned 'on' for printing | 1235 | flags : '=p' means the line is turned 'on' for printing |
| 1227 | format : the format used for the debug statement | 1236 | format : the format used for the debug statement |
| 1228 | 1237 | ||
| 1229 | From a live system: | 1238 | From a live system: |
| 1230 | 1239 | ||
| 1231 | nullarbor:~ # cat <debugfs>/dynamic_debug/control | 1240 | nullarbor:~ # cat <debugfs>/dynamic_debug/control |
| 1232 | # filename:lineno [module]function flags format | 1241 | # filename:lineno [module]function flags format |
| 1233 | fs/aio.c:222 [aio]__put_ioctx - "__put_ioctx:\040freeing\040%p\012" | 1242 | fs/aio.c:222 [aio]__put_ioctx =_ "__put_ioctx:\040freeing\040%p\012" |
| 1234 | fs/aio.c:248 [aio]ioctx_alloc - "ENOMEM:\040nr_events\040too\040high\012" | 1243 | fs/aio.c:248 [aio]ioctx_alloc =_ "ENOMEM:\040nr_events\040too\040high\012" |
| 1235 | fs/aio.c:1770 [aio]sys_io_cancel - "calling\040cancel\012" | 1244 | fs/aio.c:1770 [aio]sys_io_cancel =_ "calling\040cancel\012" |
| 1236 | 1245 | ||
| 1237 | Example usage: | 1246 | Example usage: |
| 1238 | 1247 | ||
diff --git a/lib/Makefile b/lib/Makefile index 18515f0267c..74290c9e286 100644 --- a/lib/Makefile +++ b/lib/Makefile | |||
| @@ -123,6 +123,8 @@ obj-$(CONFIG_SIGNATURE) += digsig.o | |||
| 123 | 123 | ||
| 124 | obj-$(CONFIG_CLZ_TAB) += clz_tab.o | 124 | obj-$(CONFIG_CLZ_TAB) += clz_tab.o |
| 125 | 125 | ||
| 126 | obj-$(CONFIG_DDR) += jedec_ddr_data.o | ||
| 127 | |||
| 126 | hostprogs-y := gen_crc32table | 128 | hostprogs-y := gen_crc32table |
| 127 | clean-files := crc32table.h | 129 | clean-files := crc32table.h |
| 128 | 130 | ||
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 310c753cf83..7ca29a0a301 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c | |||
| @@ -107,20 +107,22 @@ static char *ddebug_describe_flags(struct _ddebug *dp, char *buf, | |||
| 107 | return buf; | 107 | return buf; |
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | #define vpr_info_dq(q, msg) \ | 110 | #define vpr_info(fmt, ...) \ |
| 111 | do { \ | 111 | if (verbose) do { pr_info(fmt, ##__VA_ARGS__); } while (0) |
| 112 | if (verbose) \ | 112 | |
| 113 | /* trim last char off format print */ \ | 113 | #define vpr_info_dq(q, msg) \ |
| 114 | pr_info("%s: func=\"%s\" file=\"%s\" " \ | 114 | do { \ |
| 115 | "module=\"%s\" format=\"%.*s\" " \ | 115 | /* trim last char off format print */ \ |
| 116 | "lineno=%u-%u", \ | 116 | vpr_info("%s: func=\"%s\" file=\"%s\" " \ |
| 117 | msg, \ | 117 | "module=\"%s\" format=\"%.*s\" " \ |
| 118 | q->function ? q->function : "", \ | 118 | "lineno=%u-%u", \ |
| 119 | q->filename ? q->filename : "", \ | 119 | msg, \ |
| 120 | q->module ? q->module : "", \ | 120 | q->function ? q->function : "", \ |
| 121 | (int)(q->format ? strlen(q->format) - 1 : 0), \ | 121 | q->filename ? q->filename : "", \ |
| 122 | q->format ? q->format : "", \ | 122 | q->module ? q->module : "", \ |
| 123 | q->first_lineno, q->last_lineno); \ | 123 | (int)(q->format ? strlen(q->format) - 1 : 0), \ |
| 124 | q->format ? q->format : "", \ | ||
| 125 | q->first_lineno, q->last_lineno); \ | ||
| 124 | } while (0) | 126 | } while (0) |
| 125 | 127 | ||
| 126 | /* | 128 | /* |
| @@ -180,12 +182,11 @@ static int ddebug_change(const struct ddebug_query *query, | |||
| 180 | if (newflags == dp->flags) | 182 | if (newflags == dp->flags) |
| 181 | continue; | 183 | continue; |
| 182 | dp->flags = newflags; | 184 | dp->flags = newflags; |
| 183 | if (verbose) | 185 | vpr_info("changed %s:%d [%s]%s =%s\n", |
| 184 | pr_info("changed %s:%d [%s]%s =%s\n", | 186 | trim_prefix(dp->filename), dp->lineno, |
| 185 | trim_prefix(dp->filename), dp->lineno, | 187 | dt->mod_name, dp->function, |
| 186 | dt->mod_name, dp->function, | 188 | ddebug_describe_flags(dp, flagbuf, |
| 187 | ddebug_describe_flags(dp, flagbuf, | 189 | sizeof(flagbuf))); |
| 188 | sizeof(flagbuf))); | ||
| 189 | } | 190 | } |
| 190 | } | 191 | } |
| 191 | mutex_unlock(&ddebug_lock); | 192 | mutex_unlock(&ddebug_lock); |
| @@ -337,7 +338,7 @@ static int check_set(const char **dest, char *src, char *name) | |||
| 337 | * Returns 0 on success, <0 on error. | 338 | * Returns 0 on success, <0 on error. |
| 338 | */ | 339 | */ |
| 339 | static int ddebug_parse_query(char *words[], int nwords, | 340 | static int ddebug_parse_query(char *words[], int nwords, |
| 340 | struct ddebug_query *query) | 341 | struct ddebug_query *query, const char *modname) |
| 341 | { | 342 | { |
| 342 | unsigned int i; | 343 | unsigned int i; |
| 343 | int rc; | 344 | int rc; |
| @@ -347,6 +348,10 @@ static int ddebug_parse_query(char *words[], int nwords, | |||
| 347 | return -EINVAL; | 348 | return -EINVAL; |
| 348 | memset(query, 0, sizeof(*query)); | 349 | memset(query, 0, sizeof(*query)); |
| 349 | 350 | ||
| 351 | if (modname) | ||
| 352 | /* support $modname.dyndbg=<multiple queries> */ | ||
| 353 | query->module = modname; | ||
| 354 | |||
| 350 | for (i = 0 ; i < nwords ; i += 2) { | 355 | for (i = 0 ; i < nwords ; i += 2) { |
| 351 | if (!strcmp(words[i], "func")) | 356 | if (!strcmp(words[i], "func")) |
| 352 | rc = check_set(&query->function, words[i+1], "func"); | 357 | rc = check_set(&query->function, words[i+1], "func"); |
| @@ -410,8 +415,7 @@ static int ddebug_parse_flags(const char *str, unsigned int *flagsp, | |||
| 410 | default: | 415 | default: |
| 411 | return -EINVAL; | 416 | return -EINVAL; |
| 412 | } | 417 | } |
| 413 | if (verbose) | 418 | vpr_info("op='%c'\n", op); |
| 414 | pr_info("op='%c'\n", op); | ||
| 415 | 419 | ||
| 416 | for ( ; *str ; ++str) { | 420 | for ( ; *str ; ++str) { |
| 417 | for (i = ARRAY_SIZE(opt_array) - 1; i >= 0; i--) { | 421 | for (i = ARRAY_SIZE(opt_array) - 1; i >= 0; i--) { |
| @@ -423,8 +427,7 @@ static int ddebug_parse_flags(const char *str, unsigned int *flagsp, | |||
| 423 | if (i < 0) | 427 | if (i < 0) |
| 424 | return -EINVAL; | 428 | return -EINVAL; |
| 425 | } | 429 | } |
| 426 | if (verbose) | 430 | vpr_info("flags=0x%x\n", flags); |
| 427 | pr_info("flags=0x%x\n", flags); | ||
| 428 | 431 | ||
| 429 | /* calculate final *flagsp, *maskp according to mask and op */ | 432 | /* calculate final *flagsp, *maskp according to mask and op */ |
| 430 | switch (op) { | 433 | switch (op) { |
| @@ -441,12 +444,11 @@ static int ddebug_parse_flags(const char *str, unsigned int *flagsp, | |||
| 441 | *flagsp = 0; | 444 | *flagsp = 0; |
| 442 | break; | 445 | break; |
| 443 | } | 446 | } |
| 444 | if (verbose) | 447 | vpr_info("*flagsp=0x%x *maskp=0x%x\n", *flagsp, *maskp); |
| 445 | pr_info("*flagsp=0x%x *maskp=0x%x\n", *flagsp, *maskp); | ||
| 446 | return 0; | 448 | return 0; |
| 447 | } | 449 | } |
| 448 | 450 | ||
| 449 | static int ddebug_exec_query(char *query_string) | 451 | static int ddebug_exec_query(char *query_string, const char *modname) |
| 450 | { | 452 | { |
| 451 | unsigned int flags = 0, mask = 0; | 453 | unsigned int flags = 0, mask = 0; |
| 452 | struct ddebug_query query; | 454 | struct ddebug_query query; |
| @@ -457,7 +459,7 @@ static int ddebug_exec_query(char *query_string) | |||
| 457 | nwords = ddebug_tokenize(query_string, words, MAXWORDS); | 459 | nwords = ddebug_tokenize(query_string, words, MAXWORDS); |
| 458 | if (nwords <= 0) | 460 | if (nwords <= 0) |
| 459 | return -EINVAL; | 461 | return -EINVAL; |
| 460 | if (ddebug_parse_query(words, nwords-1, &query)) | 462 | if (ddebug_parse_query(words, nwords-1, &query, modname)) |
| 461 | return -EINVAL; | 463 | return -EINVAL; |
| 462 | if (ddebug_parse_flags(words[nwords-1], &flags, &mask)) | 464 | if (ddebug_parse_flags(words[nwords-1], &flags, &mask)) |
| 463 | return -EINVAL; | 465 | return -EINVAL; |
| @@ -473,7 +475,7 @@ static int ddebug_exec_query(char *query_string) | |||
| 473 | last error or number of matching callsites. Module name is either | 475 | last error or number of matching callsites. Module name is either |
| 474 | in param (for boot arg) or perhaps in query string. | 476 | in param (for boot arg) or perhaps in query string. |
| 475 | */ | 477 | */ |
| 476 | static int ddebug_exec_queries(char *query) | 478 | static int ddebug_exec_queries(char *query, const char *modname) |
| 477 | { | 479 | { |
| 478 | char *split; | 480 | char *split; |
| 479 | int i, errs = 0, exitcode = 0, rc, nfound = 0; | 481 | int i, errs = 0, exitcode = 0, rc, nfound = 0; |
| @@ -487,10 +489,9 @@ static int ddebug_exec_queries(char *query) | |||
| 487 | if (!query || !*query || *query == '#') | 489 | if (!query || !*query || *query == '#') |
| 488 | continue; | 490 | continue; |
| 489 | 491 | ||
| 490 | if (verbose) | 492 | vpr_info("query %d: \"%s\"\n", i, query); |
| 491 | pr_info("query %d: \"%s\"\n", i, query); | ||
| 492 | 493 | ||
| 493 | rc = ddebug_exec_query(query); | 494 | rc = ddebug_exec_query(query, modname); |
| 494 | if (rc < 0) { | 495 | if (rc < 0) { |
| 495 | errs++; | 496 | errs++; |
| 496 | exitcode = rc; | 497 | exitcode = rc; |
| @@ -498,7 +499,7 @@ static int ddebug_exec_queries(char *query) | |||
| 498 | nfound += rc; | 499 | nfound += rc; |
| 499 | i++; | 500 | i++; |
| 500 | } | 501 | } |
| 501 | pr_info("processed %d queries, with %d matches, %d errs\n", | 502 | vpr_info("processed %d queries, with %d matches, %d errs\n", |
| 502 | i, nfound, errs); | 503 | i, nfound, errs); |
| 503 | 504 | ||
| 504 | if (exitcode) | 505 | if (exitcode) |
| @@ -653,10 +654,9 @@ static ssize_t ddebug_proc_write(struct file *file, const char __user *ubuf, | |||
| 653 | return -EFAULT; | 654 | return -EFAULT; |
| 654 | } | 655 | } |
| 655 | tmpbuf[len] = '\0'; | 656 | tmpbuf[len] = '\0'; |
| 656 | if (verbose) | 657 | vpr_info("read %d bytes from userspace\n", (int)len); |
| 657 | pr_info("read %d bytes from userspace\n", (int)len); | ||
| 658 | 658 | ||
| 659 | ret = ddebug_exec_queries(tmpbuf); | 659 | ret = ddebug_exec_queries(tmpbuf, NULL); |
| 660 | kfree(tmpbuf); | 660 | kfree(tmpbuf); |
| 661 | if (ret < 0) | 661 | if (ret < 0) |
| 662 | return ret; | 662 | return ret; |
| @@ -717,8 +717,7 @@ static void *ddebug_proc_start(struct seq_file *m, loff_t *pos) | |||
| 717 | struct _ddebug *dp; | 717 | struct _ddebug *dp; |
| 718 | int n = *pos; | 718 | int n = *pos; |
| 719 | 719 | ||
| 720 | if (verbose) | 720 | vpr_info("called m=%p *pos=%lld\n", m, (unsigned long long)*pos); |
| 721 | pr_info("called m=%p *pos=%lld\n", m, (unsigned long long)*pos); | ||
| 722 | 721 | ||
| 723 | mutex_lock(&ddebug_lock); | 722 | mutex_lock(&ddebug_lock); |
| 724 | 723 | ||
| @@ -742,9 +741,8 @@ static void *ddebug_proc_next(struct seq_file *m, void *p, loff_t *pos) | |||
| 742 | struct ddebug_iter *iter = m->private; | 741 | struct ddebug_iter *iter = m->private; |
| 743 | struct _ddebug *dp; | 742 | struct _ddebug *dp; |
| 744 | 743 | ||
| 745 | if (verbose) | 744 | vpr_info("called m=%p p=%p *pos=%lld\n", |
| 746 | pr_info("called m=%p p=%p *pos=%lld\n", | 745 | m, p, (unsigned long long)*pos); |
| 747 | m, p, (unsigned long long)*pos); | ||
| 748 | 746 | ||
| 749 | if (p == SEQ_START_TOKEN) | 747 | if (p == SEQ_START_TOKEN) |
| 750 | dp = ddebug_iter_first(iter); | 748 | dp = ddebug_iter_first(iter); |
| @@ -766,8 +764,7 @@ static int ddebug_proc_show(struct seq_file *m, void *p) | |||
| 766 | struct _ddebug *dp = p; | 764 | struct _ddebug *dp = p; |
| 767 | char flagsbuf[10]; | 765 | char flagsbuf[10]; |
| 768 | 766 | ||
| 769 | if (verbose) | 767 | vpr_info("called m=%p p=%p\n", m, p); |
| 770 | pr_info("called m=%p p=%p\n", m, p); | ||
| 771 | 768 | ||
| 772 | if (p == SEQ_START_TOKEN) { | 769 | if (p == SEQ_START_TOKEN) { |
| 773 | seq_puts(m, | 770 | seq_puts(m, |
| @@ -791,8 +788,7 @@ static int ddebug_proc_show(struct seq_file *m, void *p) | |||
| 791 | */ | 788 | */ |
| 792 | static void ddebug_proc_stop(struct seq_file *m, void *p) | 789 | static void ddebug_proc_stop(struct seq_file *m, void *p) |
| 793 | { | 790 | { |
| 794 | if (verbose) | 791 | vpr_info("called m=%p p=%p\n", m, p); |
| 795 | pr_info("called m=%p p=%p\n", m, p); | ||
| 796 | mutex_unlock(&ddebug_lock); | 792 | mutex_unlock(&ddebug_lock); |
| 797 | } | 793 | } |
| 798 | 794 | ||
| @@ -815,8 +811,7 @@ static int ddebug_proc_open(struct inode *inode, struct file *file) | |||
| 815 | struct ddebug_iter *iter; | 811 | struct ddebug_iter *iter; |
| 816 | int err; | 812 | int err; |
| 817 | 813 | ||
| 818 | if (verbose) | 814 | vpr_info("called\n"); |
| 819 | pr_info("called\n"); | ||
| 820 | 815 | ||
| 821 | iter = kzalloc(sizeof(*iter), GFP_KERNEL); | 816 | iter = kzalloc(sizeof(*iter), GFP_KERNEL); |
| 822 | if (iter == NULL) | 817 | if (iter == NULL) |
| @@ -866,12 +861,51 @@ int ddebug_add_module(struct _ddebug *tab, unsigned int n, | |||
| 866 | list_add_tail(&dt->link, &ddebug_tables); | 861 | list_add_tail(&dt->link, &ddebug_tables); |
| 867 | mutex_unlock(&ddebug_lock); | 862 | mutex_unlock(&ddebug_lock); |
| 868 | 863 | ||
| 869 | if (verbose) | 864 | vpr_info("%u debug prints in module %s\n", n, dt->mod_name); |
| 870 | pr_info("%u debug prints in module %s\n", n, dt->mod_name); | ||
| 871 | return 0; | 865 | return 0; |
| 872 | } | 866 | } |
| 873 | EXPORT_SYMBOL_GPL(ddebug_add_module); | 867 | EXPORT_SYMBOL_GPL(ddebug_add_module); |
| 874 | 868 | ||
| 869 | /* helper for ddebug_dyndbg_(boot|module)_param_cb */ | ||
| 870 | static int ddebug_dyndbg_param_cb(char *param, char *val, | ||
| 871 | const char *modname, int on_err) | ||
| 872 | { | ||
| 873 | char *sep; | ||
| 874 | |||
| 875 | sep = strchr(param, '.'); | ||
| 876 | if (sep) { | ||
| 877 | /* needed only for ddebug_dyndbg_boot_param_cb */ | ||
| 878 | *sep = '\0'; | ||
| 879 | modname = param; | ||
| 880 | param = sep + 1; | ||
| 881 | } | ||
| 882 | if (strcmp(param, "dyndbg")) | ||
| 883 | return on_err; /* determined by caller */ | ||
| 884 | |||
| 885 | ddebug_exec_queries((val ? val : "+p"), modname); | ||
| 886 | |||
| 887 | return 0; /* query failure shouldnt stop module load */ | ||
| 888 | } | ||
| 889 | |||
| 890 | /* handle both dyndbg and $module.dyndbg params at boot */ | ||
| 891 | static int ddebug_dyndbg_boot_param_cb(char *param, char *val, | ||
| 892 | const char *unused) | ||
| 893 | { | ||
| 894 | vpr_info("%s=\"%s\"\n", param, val); | ||
| 895 | return ddebug_dyndbg_param_cb(param, val, NULL, 0); | ||
| 896 | } | ||
| 897 | |||
| 898 | /* | ||
| 899 | * modprobe foo finds foo.params in boot-args, strips "foo.", and | ||
| 900 | * passes them to load_module(). This callback gets unknown params, | ||
| 901 | * processes dyndbg params, rejects others. | ||
| 902 | */ | ||
| 903 | int ddebug_dyndbg_module_param_cb(char *param, char *val, const char *module) | ||
| 904 | { | ||
| 905 | vpr_info("module: %s %s=\"%s\"\n", module, param, val); | ||
| 906 | return ddebug_dyndbg_param_cb(param, val, module, -ENOENT); | ||
| 907 | } | ||
| 908 | |||
| 875 | static void ddebug_table_free(struct ddebug_table *dt) | 909 | static void ddebug_table_free(struct ddebug_table *dt) |
| 876 | { | 910 | { |
| 877 | list_del_init(&dt->link); | 911 | list_del_init(&dt->link); |
| @@ -888,8 +922,7 @@ int ddebug_remove_module(const char *mod_name) | |||
| 888 | struct ddebug_table *dt, *nextdt; | 922 | struct ddebug_table *dt, *nextdt; |
| 889 | int ret = -ENOENT; | 923 | int ret = -ENOENT; |
| 890 | 924 | ||
| 891 | if (verbose) | 925 | vpr_info("removing module \"%s\"\n", mod_name); |
| 892 | pr_info("removing module \"%s\"\n", mod_name); | ||
| 893 | 926 | ||
| 894 | mutex_lock(&ddebug_lock); | 927 | mutex_lock(&ddebug_lock); |
| 895 | list_for_each_entry_safe(dt, nextdt, &ddebug_tables, link) { | 928 | list_for_each_entry_safe(dt, nextdt, &ddebug_tables, link) { |
| @@ -940,8 +973,10 @@ static int __init dynamic_debug_init(void) | |||
| 940 | { | 973 | { |
| 941 | struct _ddebug *iter, *iter_start; | 974 | struct _ddebug *iter, *iter_start; |
| 942 | const char *modname = NULL; | 975 | const char *modname = NULL; |
| 976 | char *cmdline; | ||
| 943 | int ret = 0; | 977 | int ret = 0; |
| 944 | int n = 0; | 978 | int n = 0, entries = 0, modct = 0; |
| 979 | int verbose_bytes = 0; | ||
| 945 | 980 | ||
| 946 | if (__start___verbose == __stop___verbose) { | 981 | if (__start___verbose == __stop___verbose) { |
| 947 | pr_warn("_ddebug table is empty in a " | 982 | pr_warn("_ddebug table is empty in a " |
| @@ -952,10 +987,15 @@ static int __init dynamic_debug_init(void) | |||
| 952 | modname = iter->modname; | 987 | modname = iter->modname; |
| 953 | iter_start = iter; | 988 | iter_start = iter; |
| 954 | for (; iter < __stop___verbose; iter++) { | 989 | for (; iter < __stop___verbose; iter++) { |
| 990 | entries++; | ||
| 991 | verbose_bytes += strlen(iter->modname) + strlen(iter->function) | ||
| 992 | + strlen(iter->filename) + strlen(iter->format); | ||
| 993 | |||
| 955 | if (strcmp(modname, iter->modname)) { | 994 | if (strcmp(modname, iter->modname)) { |
| 995 | modct++; | ||
| 956 | ret = ddebug_add_module(iter_start, n, modname); | 996 | ret = ddebug_add_module(iter_start, n, modname); |
| 957 | if (ret) | 997 | if (ret) |
| 958 | goto out_free; | 998 | goto out_err; |
| 959 | n = 0; | 999 | n = 0; |
| 960 | modname = iter->modname; | 1000 | modname = iter->modname; |
| 961 | iter_start = iter; | 1001 | iter_start = iter; |
| @@ -964,29 +1004,45 @@ static int __init dynamic_debug_init(void) | |||
| 964 | } | 1004 | } |
| 965 | ret = ddebug_add_module(iter_start, n, modname); | 1005 | ret = ddebug_add_module(iter_start, n, modname); |
| 966 | if (ret) | 1006 | if (ret) |
| 967 | goto out_free; | 1007 | goto out_err; |
| 1008 | |||
| 1009 | ddebug_init_success = 1; | ||
| 1010 | vpr_info("%d modules, %d entries and %d bytes in ddebug tables," | ||
| 1011 | " %d bytes in (readonly) verbose section\n", | ||
| 1012 | modct, entries, (int)( modct * sizeof(struct ddebug_table)), | ||
| 1013 | verbose_bytes + (int)(__stop___verbose - __start___verbose)); | ||
| 968 | 1014 | ||
| 969 | /* ddebug_query boot param got passed -> set it up */ | 1015 | /* apply ddebug_query boot param, dont unload tables on err */ |
| 970 | if (ddebug_setup_string[0] != '\0') { | 1016 | if (ddebug_setup_string[0] != '\0') { |
| 971 | ret = ddebug_exec_queries(ddebug_setup_string); | 1017 | pr_warn("ddebug_query param name is deprecated," |
| 1018 | " change it to dyndbg\n"); | ||
| 1019 | ret = ddebug_exec_queries(ddebug_setup_string, NULL); | ||
| 972 | if (ret < 0) | 1020 | if (ret < 0) |
| 973 | pr_warn("Invalid ddebug boot param %s", | 1021 | pr_warn("Invalid ddebug boot param %s", |
| 974 | ddebug_setup_string); | 1022 | ddebug_setup_string); |
| 975 | else | 1023 | else |
| 976 | pr_info("%d changes by ddebug_query\n", ret); | 1024 | pr_info("%d changes by ddebug_query\n", ret); |
| 977 | |||
| 978 | /* keep tables even on ddebug_query parse error */ | ||
| 979 | ret = 0; | ||
| 980 | } | 1025 | } |
| 1026 | /* now that ddebug tables are loaded, process all boot args | ||
| 1027 | * again to find and activate queries given in dyndbg params. | ||
| 1028 | * While this has already been done for known boot params, it | ||
| 1029 | * ignored the unknown ones (dyndbg in particular). Reusing | ||
| 1030 | * parse_args avoids ad-hoc parsing. This will also attempt | ||
| 1031 | * to activate queries for not-yet-loaded modules, which is | ||
| 1032 | * slightly noisy if verbose, but harmless. | ||
| 1033 | */ | ||
| 1034 | cmdline = kstrdup(saved_command_line, GFP_KERNEL); | ||
| 1035 | parse_args("dyndbg params", cmdline, NULL, | ||
| 1036 | 0, 0, 0, &ddebug_dyndbg_boot_param_cb); | ||
| 1037 | kfree(cmdline); | ||
| 1038 | return 0; | ||
| 981 | 1039 | ||
| 982 | out_free: | 1040 | out_err: |
| 983 | if (ret) | 1041 | ddebug_remove_all_tables(); |
| 984 | ddebug_remove_all_tables(); | ||
| 985 | else | ||
| 986 | ddebug_init_success = 1; | ||
| 987 | return 0; | 1042 | return 0; |
| 988 | } | 1043 | } |
| 989 | /* Allow early initialization for boot messages via boot param */ | 1044 | /* Allow early initialization for boot messages via boot param */ |
| 990 | arch_initcall(dynamic_debug_init); | 1045 | early_initcall(dynamic_debug_init); |
| 1046 | |||
| 991 | /* Debugfs setup must be done later */ | 1047 | /* Debugfs setup must be done later */ |
| 992 | module_init(dynamic_debug_init_debugfs); | 1048 | fs_initcall(dynamic_debug_init_debugfs); |
diff --git a/lib/jedec_ddr_data.c b/lib/jedec_ddr_data.c new file mode 100644 index 00000000000..6d2cbf1d567 --- /dev/null +++ b/lib/jedec_ddr_data.c | |||
| @@ -0,0 +1,135 @@ | |||
| 1 | /* | ||
| 2 | * DDR addressing details and AC timing parameters from JEDEC specs | ||
| 3 | * | ||
| 4 | * Copyright (C) 2012 Texas Instruments, Inc. | ||
| 5 | * | ||
| 6 | * Aneesh V <aneesh@ti.com> | ||
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or modify | ||
| 9 | * it under the terms of the GNU General Public License version 2 as | ||
| 10 | * published by the Free Software Foundation. | ||
| 11 | */ | ||
| 12 | |||
| 13 | #include <memory/jedec_ddr.h> | ||
| 14 | #include <linux/module.h> | ||
| 15 | |||
| 16 | /* LPDDR2 addressing details from JESD209-2 section 2.4 */ | ||
| 17 | const struct lpddr2_addressing | ||
| 18 | lpddr2_jedec_addressing_table[NUM_DDR_ADDR_TABLE_ENTRIES] = { | ||
| 19 | {B4, T_REFI_15_6, T_RFC_90}, /* 64M */ | ||
| 20 | {B4, T_REFI_15_6, T_RFC_90}, /* 128M */ | ||
| 21 | {B4, T_REFI_7_8, T_RFC_90}, /* 256M */ | ||
| 22 | {B4, T_REFI_7_8, T_RFC_90}, /* 512M */ | ||
| 23 | {B8, T_REFI_7_8, T_RFC_130}, /* 1GS4 */ | ||
| 24 | {B8, T_REFI_3_9, T_RFC_130}, /* 2GS4 */ | ||
| 25 | {B8, T_REFI_3_9, T_RFC_130}, /* 4G */ | ||
| 26 | {B8, T_REFI_3_9, T_RFC_210}, /* 8G */ | ||
| 27 | {B4, T_REFI_7_8, T_RFC_130}, /* 1GS2 */ | ||
| 28 | {B4, T_REFI_3_9, T_RFC_130}, /* 2GS2 */ | ||
| 29 | }; | ||
| 30 | EXPORT_SYMBOL_GPL(lpddr2_jedec_addressing_table); | ||
| 31 | |||
| 32 | /* LPDDR2 AC timing parameters from JESD209-2 section 12 */ | ||
| 33 | const struct lpddr2_timings | ||
| 34 | lpddr2_jedec_timings[NUM_DDR_TIMING_TABLE_ENTRIES] = { | ||
| 35 | /* Speed bin 400(200 MHz) */ | ||
| 36 | [0] = { | ||
| 37 | .max_freq = 200000000, | ||
| 38 | .min_freq = 10000000, | ||
| 39 | .tRPab = 21000, | ||
| 40 | .tRCD = 18000, | ||
| 41 | .tWR = 15000, | ||
| 42 | .tRAS_min = 42000, | ||
| 43 | .tRRD = 10000, | ||
| 44 | .tWTR = 10000, | ||
| 45 | .tXP = 7500, | ||
| 46 | .tRTP = 7500, | ||
| 47 | .tCKESR = 15000, | ||
| 48 | .tDQSCK_max = 5500, | ||
| 49 | .tFAW = 50000, | ||
| 50 | .tZQCS = 90000, | ||
| 51 | .tZQCL = 360000, | ||
| 52 | .tZQinit = 1000000, | ||
| 53 | .tRAS_max_ns = 70000, | ||
| 54 | .tDQSCK_max_derated = 6000, | ||
| 55 | }, | ||
| 56 | /* Speed bin 533(266 MHz) */ | ||
| 57 | [1] = { | ||
| 58 | .max_freq = 266666666, | ||
| 59 | .min_freq = 10000000, | ||
| 60 | .tRPab = 21000, | ||
| 61 | .tRCD = 18000, | ||
| 62 | .tWR = 15000, | ||
| 63 | .tRAS_min = 42000, | ||
| 64 | .tRRD = 10000, | ||
| 65 | .tWTR = 7500, | ||
| 66 | .tXP = 7500, | ||
| 67 | .tRTP = 7500, | ||
| 68 | .tCKESR = 15000, | ||
| 69 | .tDQSCK_max = 5500, | ||
| 70 | .tFAW = 50000, | ||
| 71 | .tZQCS = 90000, | ||
| 72 | .tZQCL = 360000, | ||
| 73 | .tZQinit = 1000000, | ||
| 74 | .tRAS_max_ns = 70000, | ||
| 75 | .tDQSCK_max_derated = 6000, | ||
| 76 | }, | ||
| 77 | /* Speed bin 800(400 MHz) */ | ||
| 78 | [2] = { | ||
| 79 | .max_freq = 400000000, | ||
| 80 | .min_freq = 10000000, | ||
| 81 | .tRPab = 21000, | ||
| 82 | .tRCD = 18000, | ||
| 83 | .tWR = 15000, | ||
| 84 | .tRAS_min = 42000, | ||
| 85 | .tRRD = 10000, | ||
| 86 | .tWTR = 7500, | ||
| 87 | .tXP = 7500, | ||
| 88 | .tRTP = 7500, | ||
| 89 | .tCKESR = 15000, | ||
| 90 | .tDQSCK_max = 5500, | ||
| 91 | .tFAW = 50000, | ||
| 92 | .tZQCS = 90000, | ||
| 93 | .tZQCL = 360000, | ||
| 94 | .tZQinit = 1000000, | ||
| 95 | .tRAS_max_ns = 70000, | ||
| 96 | .tDQSCK_max_derated = 6000, | ||
| 97 | }, | ||
| 98 | /* Speed bin 1066(533 MHz) */ | ||
| 99 | [3] = { | ||
| 100 | .max_freq = 533333333, | ||
| 101 | .min_freq = 10000000, | ||
| 102 | .tRPab = 21000, | ||
| 103 | .tRCD = 18000, | ||
| 104 | .tWR = 15000, | ||
| 105 | .tRAS_min = 42000, | ||
| 106 | .tRRD = 10000, | ||
| 107 | .tWTR = 7500, | ||
| 108 | .tXP = 7500, | ||
| 109 | .tRTP = 7500, | ||
| 110 | .tCKESR = 15000, | ||
| 111 | .tDQSCK_max = 5500, | ||
| 112 | .tFAW = 50000, | ||
| 113 | .tZQCS = 90000, | ||
| 114 | .tZQCL = 360000, | ||
| 115 | .tZQinit = 1000000, | ||
| 116 | .tRAS_max_ns = 70000, | ||
| 117 | .tDQSCK_max_derated = 5620, | ||
| 118 | }, | ||
| 119 | }; | ||
| 120 | EXPORT_SYMBOL_GPL(lpddr2_jedec_timings); | ||
| 121 | |||
| 122 | const struct lpddr2_min_tck lpddr2_jedec_min_tck = { | ||
| 123 | .tRPab = 3, | ||
| 124 | .tRCD = 3, | ||
| 125 | .tWR = 3, | ||
| 126 | .tRASmin = 3, | ||
| 127 | .tRRD = 2, | ||
| 128 | .tWTR = 2, | ||
| 129 | .tXP = 2, | ||
| 130 | .tRTP = 2, | ||
| 131 | .tCKE = 3, | ||
| 132 | .tCKESR = 3, | ||
| 133 | .tFAW = 8 | ||
| 134 | }; | ||
| 135 | EXPORT_SYMBOL_GPL(lpddr2_jedec_min_tck); | ||
diff --git a/lib/kobject.c b/lib/kobject.c index aeefa8bc8b1..e07ee1fcd6f 100644 --- a/lib/kobject.c +++ b/lib/kobject.c | |||
| @@ -47,13 +47,11 @@ static int populate_dir(struct kobject *kobj) | |||
| 47 | static int create_dir(struct kobject *kobj) | 47 | static int create_dir(struct kobject *kobj) |
| 48 | { | 48 | { |
| 49 | int error = 0; | 49 | int error = 0; |
| 50 | if (kobject_name(kobj)) { | 50 | error = sysfs_create_dir(kobj); |
| 51 | error = sysfs_create_dir(kobj); | 51 | if (!error) { |
| 52 | if (!error) { | 52 | error = populate_dir(kobj); |
| 53 | error = populate_dir(kobj); | 53 | if (error) |
| 54 | if (error) | 54 | sysfs_remove_dir(kobj); |
| 55 | sysfs_remove_dir(kobj); | ||
| 56 | } | ||
| 57 | } | 55 | } |
| 58 | return error; | 56 | return error; |
| 59 | } | 57 | } |
| @@ -634,7 +632,7 @@ struct kobject *kobject_create(void) | |||
| 634 | /** | 632 | /** |
| 635 | * kobject_create_and_add - create a struct kobject dynamically and register it with sysfs | 633 | * kobject_create_and_add - create a struct kobject dynamically and register it with sysfs |
| 636 | * | 634 | * |
| 637 | * @name: the name for the kset | 635 | * @name: the name for the kobject |
| 638 | * @parent: the parent kobject of this kobject, if any. | 636 | * @parent: the parent kobject of this kobject, if any. |
| 639 | * | 637 | * |
| 640 | * This function creates a kobject structure dynamically and registers it | 638 | * This function creates a kobject structure dynamically and registers it |
