Skip to content

Commit

Permalink
ACPICA: Utilities: Add formatted printing APIs
Browse files Browse the repository at this point in the history
This patch introduces formatted printing APIs to handle ACPICA specific
formatted print requirements. Currently only specific OSPMs will use this
customized printing support, Linux kernel doesn't use these APIs at this
time. It will be enabled for Linux kernel resident ACPICA after being well
tested. So currently this patch is a no-op.

The specific formatted printing APIs are useful to ACPICA as:
 1. Some portable applications do not link standard C library, so they
    cannot use standard formatted print APIs directly.
 2. Platform specific printing format may differ and thus not portable, for
    example, u64 is %ull for Linux kernel and is %uI64 for some MSVC
    versions.
 3. Platform specific printing format may conflict with ACPICA's usages
    while it is not possible for ACPICA developers to test their code for
    all platforms. For example, developers may generate %pRxxx while Linux
    kernel treats %pR as structured resource printing and decodes variable
    argument as a "struct resource" pointer.
This patch solves above issues by introducing the new APIs.

Note that users of such APIs are not introduced in this patch. Users of
acpi_os_file_vprintf()/acpi_ut_file_printf() need to invoke acpi_os_initialize(),
this should be taken care by the further patches where such users are
introduced. Lv Zheng.

Signed-off-by: Lv Zheng <[email protected]>
Signed-off-by: Bob Moore <[email protected]>
Signed-off-by: Rafael J. Wysocki <[email protected]>
  • Loading branch information
Lv Zheng authored and rafaeljw committed Jul 8, 2014
1 parent 7824f44 commit 80a648c
Show file tree
Hide file tree
Showing 6 changed files with 682 additions and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/acpi/acpica/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -175,5 +175,5 @@ acpi-y += \
utxferror.o \
utxfmutex.o

acpi-$(ACPI_FUTURE_USAGE) += utfileio.o uttrack.o utcache.o
acpi-$(ACPI_FUTURE_USAGE) += utfileio.o utprint.o uttrack.o utcache.o

5 changes: 5 additions & 0 deletions drivers/acpi/acpica/acglobal.h
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,11 @@ ACPI_GLOBAL(u32, acpi_gbl_num_objects);
ACPI_INIT_GLOBAL(ACPI_FILE, acpi_gbl_debug_file, NULL);
ACPI_INIT_GLOBAL(ACPI_FILE, acpi_gbl_output_file, NULL);

/* Print buffer */

ACPI_GLOBAL(acpi_spinlock, acpi_gbl_print_lock); /* For print buffer */
ACPI_GLOBAL(char, acpi_gbl_print_buffer[1024]);

#endif /* ACPI_APPLICATION */

/*****************************************************************************
Expand Down
19 changes: 19 additions & 0 deletions drivers/acpi/acpica/acutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -750,4 +750,23 @@ const struct ah_predefined_name *acpi_ah_match_predefined_name(char *nameseg);

const struct ah_device_id *acpi_ah_match_hardware_id(char *hid);

/*
* utprint - printf/vprintf output functions
*/
const char *acpi_ut_scan_number(const char *string, u64 *number_ptr);

const char *acpi_ut_print_number(char *string, u64 number);

int
acpi_ut_vsnprintf(char *string,
acpi_size size, const char *format, va_list args);

int acpi_ut_snprintf(char *string, acpi_size size, const char *format, ...);

#ifdef ACPI_APPLICATION
int acpi_ut_file_vprintf(ACPI_FILE file, const char *format, va_list args);

int acpi_ut_file_printf(ACPI_FILE file, const char *format, ...);
#endif

#endif /* _ACUTILS_H */
Loading

0 comments on commit 80a648c

Please sign in to comment.