Skip to content

Commit

Permalink
Merge branch 'acpica'
Browse files Browse the repository at this point in the history
* acpica: (30 commits)
  ACPICA: Add new GPE public interface - acpi_mark_gpe_for_wake.
  ACPICA: GPEs: Do not allow enable for GPEs that have no handler(s).
  ACPICA: Fix a regression for deletion of Alias() objects.
  ACPICA: Update version to 20140627
  ACPICA: Tables: Merge DMAR table structure updates
  ACPICA: Hardware: back port of a recursive locking fix
  ACPICA: utprint/oslibcfs: cleanup - no functional change
  ACPICA: Executer: Fix trivial issues in acpi_get_serial_access_bytes()
  ACPICA: OSL: Update acpidump to reduce source code differences
  ACPICA: acpidump: Reduce freopen() invocations to improve portability
  ACPICA: acpidump: Replace file IOs with new APIs to improve portability
  ACPICA: acpidump: Remove exit() from generic layer to improve portability
  ACPICA: acpidump: Add memory/string OSL usage to improve portability
  ACPICA: Common: Enhance acpi_getopt() to improve portability
  ACPICA: Common: Enhance cm_get_file_size() to improve portability
  ACPICA: Application: Enhance ACPI_USAGE_xxx/ACPI_OPTION with acpi_os_printf() to improve portability
  ACPICA: Utilities: Introduce acpi_log_error() to improve portability
  ACPICA: Utilities: Add formatted printing APIs
  ACPICA: OSL: Add portable file IO to improve portability
  ACPICA: OSL: Clean up acpi_os_printf()/acpi_os_vprintf() stubs
  ...
  • Loading branch information
Rafael J. Wysocki committed Jul 27, 2014
2 parents 64aa90f + c12f07d commit 92a1840
Show file tree
Hide file tree
Showing 38 changed files with 3,340 additions and 404 deletions.
14 changes: 7 additions & 7 deletions drivers/acpi/acpi_extlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ static u32 l1_percpu_entry;
#define ELOG_ENTRY_ADDR(phyaddr) \
(phyaddr - elog_base + (u8 *)elog_addr)

static struct acpi_generic_status *extlog_elog_entry_check(int cpu, int bank)
static struct acpi_hest_generic_status *extlog_elog_entry_check(int cpu, int bank)
{
int idx;
u64 data;
struct acpi_generic_status *estatus;
struct acpi_hest_generic_status *estatus;

WARN_ON(cpu < 0);
idx = ELOG_IDX(cpu, bank);
Expand All @@ -82,7 +82,7 @@ static struct acpi_generic_status *extlog_elog_entry_check(int cpu, int bank)
return NULL;

data &= EXT_ELOG_ENTRY_MASK;
estatus = (struct acpi_generic_status *)ELOG_ENTRY_ADDR(data);
estatus = (struct acpi_hest_generic_status *)ELOG_ENTRY_ADDR(data);

/* if no valid data in elog entry, just return */
if (estatus->block_status == 0)
Expand All @@ -92,7 +92,7 @@ static struct acpi_generic_status *extlog_elog_entry_check(int cpu, int bank)
}

static void __print_extlog_rcd(const char *pfx,
struct acpi_generic_status *estatus, int cpu)
struct acpi_hest_generic_status *estatus, int cpu)
{
static atomic_t seqno;
unsigned int curr_seqno;
Expand All @@ -111,7 +111,7 @@ static void __print_extlog_rcd(const char *pfx,
}

static int print_extlog_rcd(const char *pfx,
struct acpi_generic_status *estatus, int cpu)
struct acpi_hest_generic_status *estatus, int cpu)
{
/* Not more than 2 messages every 5 seconds */
static DEFINE_RATELIMIT_STATE(ratelimit_corrected, 5*HZ, 2);
Expand All @@ -137,7 +137,7 @@ static int extlog_print(struct notifier_block *nb, unsigned long val,
struct mce *mce = (struct mce *)data;
int bank = mce->bank;
int cpu = mce->extcpu;
struct acpi_generic_status *estatus;
struct acpi_hest_generic_status *estatus;
int rc;

estatus = extlog_elog_entry_check(cpu, bank);
Expand All @@ -148,7 +148,7 @@ static int extlog_print(struct notifier_block *nb, unsigned long val,
/* clear record status to enable BIOS to update it again */
estatus->block_status = 0;

rc = print_extlog_rcd(NULL, (struct acpi_generic_status *)elog_buf, cpu);
rc = print_extlog_rcd(NULL, (struct acpi_hest_generic_status *)elog_buf, cpu);

return NOTIFY_STOP;
}
Expand Down
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) += uttrack.o utcache.o
acpi-$(ACPI_FUTURE_USAGE) += utfileio.o utprint.o uttrack.o utcache.o

9 changes: 6 additions & 3 deletions drivers/acpi/acpica/acapps.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,13 @@
/* Macros for usage messages */

#define ACPI_USAGE_HEADER(usage) \
printf ("Usage: %s\nOptions:\n", usage);
acpi_os_printf ("Usage: %s\nOptions:\n", usage);

#define ACPI_USAGE_TEXT(description) \
acpi_os_printf (description);

#define ACPI_OPTION(name, description) \
printf (" %-18s%s\n", name, description);
acpi_os_printf (" %-18s%s\n", name, description);

#define FILE_SUFFIX_DISASSEMBLY "dsl"
#define ACPI_TABLE_FILE_SUFFIX ".dat"
Expand All @@ -102,7 +105,7 @@ extern char *acpi_gbl_optarg;
/*
* cmfsize - Common get file size function
*/
u32 cm_get_file_size(FILE * file);
u32 cm_get_file_size(ACPI_FILE file);

#ifndef ACPI_DUMP_APP
/*
Expand Down
3 changes: 0 additions & 3 deletions drivers/acpi/acpica/acdebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,6 @@ acpi_status acpi_db_load_acpi_table(char *filename);
acpi_status
acpi_db_get_table_from_file(char *filename, struct acpi_table_header **table);

acpi_status
acpi_db_read_table_from_file(char *filename, struct acpi_table_header **table);

/*
* dbhistry - debugger HISTORY command
*/
Expand Down
8 changes: 7 additions & 1 deletion drivers/acpi/acpica/acglobal.h
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ ACPI_GLOBAL(u32, acpi_gbl_trace_dbg_layer);
*
****************************************************************************/

ACPI_GLOBAL(u8, acpi_gbl_db_output_flags);
ACPI_INIT_GLOBAL(u8, acpi_gbl_db_output_flags, ACPI_DB_CONSOLE_OUTPUT);

#ifdef ACPI_DISASSEMBLER

Expand Down Expand Up @@ -362,6 +362,12 @@ ACPI_GLOBAL(u32, acpi_gbl_num_objects);
#ifdef ACPI_APPLICATION

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
39 changes: 37 additions & 2 deletions drivers/acpi/acpica/acutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ extern const char *acpi_gbl_pt_decode[];
#ifdef ACPI_ASL_COMPILER

#include <stdio.h>
extern FILE *acpi_gbl_output_file;

#define ACPI_MSG_REDIRECT_BEGIN \
FILE *output_file = acpi_gbl_output_file; \
Expand Down Expand Up @@ -211,6 +210,8 @@ void acpi_ut_subsystem_shutdown(void);

acpi_size acpi_ut_strlen(const char *string);

char *acpi_ut_strchr(const char *string, int ch);

char *acpi_ut_strcpy(char *dst_string, const char *src_string);

char *acpi_ut_strncpy(char *dst_string,
Expand Down Expand Up @@ -257,7 +258,7 @@ extern const u8 _acpi_ctype[];
#define ACPI_IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD))
#define ACPI_IS_UPPER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP))
#define ACPI_IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO))
#define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU))
#define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_XS | _ACPI_PU))
#define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP))

#endif /* !ACPI_USE_SYSTEM_CLIBRARY */
Expand Down Expand Up @@ -352,6 +353,13 @@ acpi_ut_debug_dump_buffer(u8 *buffer, u32 count, u32 display, u32 component_id);

void acpi_ut_dump_buffer(u8 *buffer, u32 count, u32 display, u32 offset);

#ifdef ACPI_APPLICATION
void
acpi_ut_dump_buffer_to_file(ACPI_FILE file,
u8 *buffer,
u32 count, u32 display, u32 base_offset);
#endif

void acpi_ut_report_error(char *module_name, u32 line_number);

void acpi_ut_report_info(char *module_name, u32 line_number);
Expand Down Expand Up @@ -393,6 +401,14 @@ acpi_ut_execute_power_methods(struct acpi_namespace_node *device_node,
const char **method_names,
u8 method_count, u8 *out_values);

/*
* utfileio - file operations
*/
#ifdef ACPI_APPLICATION
acpi_status
acpi_ut_read_table_from_file(char *filename, struct acpi_table_header **table);
#endif

/*
* utids - device ID support
*/
Expand Down Expand Up @@ -743,4 +759,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 */
32 changes: 17 additions & 15 deletions drivers/acpi/acpica/evgpe.c
Original file line number Diff line number Diff line change
Expand Up @@ -697,21 +697,6 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device,
acpi_gbl_global_event_handler_context);
}

/*
* If edge-triggered, clear the GPE status bit now. Note that
* level-triggered events are cleared after the GPE is serviced.
*/
if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
ACPI_GPE_EDGE_TRIGGERED) {
status = acpi_hw_clear_gpe(gpe_event_info);
if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status,
"Unable to clear GPE %02X",
gpe_number));
return_UINT32(ACPI_INTERRUPT_NOT_HANDLED);
}
}

/*
* Always disable the GPE so that it does not keep firing before
* any asynchronous activity completes (either from the execution
Expand All @@ -728,6 +713,23 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device,
return_UINT32(ACPI_INTERRUPT_NOT_HANDLED);
}

/*
* If edge-triggered, clear the GPE status bit now. Note that
* level-triggered events are cleared after the GPE is serviced.
*/
if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
ACPI_GPE_EDGE_TRIGGERED) {
status = acpi_hw_clear_gpe(gpe_event_info);
if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status,
"Unable to clear GPE %02X",
gpe_number));
(void)acpi_hw_low_set_gpe(gpe_event_info,
ACPI_GPE_CONDITIONAL_ENABLE);
return_UINT32(ACPI_INTERRUPT_NOT_HANDLED);
}
}

/*
* Dispatch the GPE to either an installed handler or the control
* method associated with this GPE (_Lxx or _Exx). If a handler
Expand Down
61 changes: 58 additions & 3 deletions drivers/acpi/acpica/evxfgpe.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,19 @@ acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number)

flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);

/* Ensure that we have a valid GPE number */

/*
* Ensure that we have a valid GPE number and that there is some way
* of handling the GPE (handler or a GPE method). In other words, we
* won't allow a valid GPE to be enabled if there is no way to handle it.
*/
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
if (gpe_event_info) {
status = acpi_ev_add_gpe_reference(gpe_event_info);
if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) !=
ACPI_GPE_DISPATCH_NONE) {
status = acpi_ev_add_gpe_reference(gpe_event_info);
} else {
status = AE_NO_HANDLER;
}
}

acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
Expand Down Expand Up @@ -177,6 +185,53 @@ acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number)
ACPI_EXPORT_SYMBOL(acpi_disable_gpe)


/*******************************************************************************
*
* FUNCTION: acpi_mark_gpe_for_wake
*
* PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1
* gpe_number - GPE level within the GPE block
*
* RETURN: Status
*
* DESCRIPTION: Mark a GPE as having the ability to wake the system. Simply
* sets the ACPI_GPE_CAN_WAKE flag.
*
* Some potential callers of acpi_setup_gpe_for_wake may know in advance that
* there won't be any notify handlers installed for device wake notifications
* from the given GPE (one example is a button GPE in Linux). For these cases,
* acpi_mark_gpe_for_wake should be used instead of acpi_setup_gpe_for_wake.
* This will set the ACPI_GPE_CAN_WAKE flag for the GPE without trying to
* setup implicit wake notification for it (since there's no handler method).
*
******************************************************************************/
acpi_status acpi_mark_gpe_for_wake(acpi_handle gpe_device, u32 gpe_number)
{
struct acpi_gpe_event_info *gpe_event_info;
acpi_status status = AE_BAD_PARAMETER;
acpi_cpu_flags flags;

ACPI_FUNCTION_TRACE(acpi_mark_gpe_for_wake);

flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);

/* Ensure that we have a valid GPE number */

gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
if (gpe_event_info) {

/* Mark the GPE as a possible wake event */

gpe_event_info->flags |= ACPI_GPE_CAN_WAKE;
status = AE_OK;
}

acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
return_ACPI_STATUS(status);
}

ACPI_EXPORT_SYMBOL(acpi_mark_gpe_for_wake)

/*******************************************************************************
*
* FUNCTION: acpi_setup_gpe_for_wake
Expand Down
4 changes: 2 additions & 2 deletions drivers/acpi/acpica/exfield.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ acpi_ex_get_serial_access_length(u32 accessor_type, u32 access_length);

/*******************************************************************************
*
* FUNCTION: acpi_get_serial_access_bytes
* FUNCTION: acpi_ex_get_serial_access_length
*
* PARAMETERS: accessor_type - The type of the protocol indicated by region
* field access attributes
Expand Down Expand Up @@ -103,7 +103,7 @@ acpi_ex_get_serial_access_length(u32 accessor_type, u32 access_length)
case AML_FIELD_ATTRIB_BLOCK_CALL:
default:

length = ACPI_GSBUS_BUFFER_SIZE;
length = ACPI_GSBUS_BUFFER_SIZE - 2;
break;
}

Expand Down
3 changes: 2 additions & 1 deletion drivers/acpi/acpica/hwregs.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,9 @@ acpi_status acpi_hw_clear_acpi_status(void)

acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags);

if (ACPI_FAILURE(status))
if (ACPI_FAILURE(status)) {
goto exit;
}

/* Clear the GPE Bits in all GPE registers in all GPE blocks */

Expand Down
10 changes: 10 additions & 0 deletions drivers/acpi/acpica/nsobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,16 @@ void acpi_ns_detach_object(struct acpi_namespace_node *node)
(node->object->common.type != ACPI_TYPE_LOCAL_DATA)) {
node->object = node->object->common.next_object;
}

/*
* Detach the object from any data objects (which are still held by
* the namespace node)
*/
if (obj_desc->common.next_object &&
((obj_desc->common.next_object)->common.type ==
ACPI_TYPE_LOCAL_DATA)) {
obj_desc->common.next_object = NULL;
}
}

/* Reset the node type to untyped */
Expand Down
Loading

0 comments on commit 92a1840

Please sign in to comment.