X86 platform: New BayTrail IOSF-SB MBI driver

Current Intel SOC cores use a MailBox Interface (MBI) to provide access to unit
devices connected to the system fabric. This driver implements access to this
interface on BayTrail platforms. This is a requirement for drivers that need
access to unit registers on the platform (e.g. accessing the PUNIT for power
management features such as RAPL). Serialized access is handled by all exported
routines with spinlocks.

The API includes 3 functions for access to unit registers:

u32 bt_mbi_read(u8 port, u8 opcode, u32 offset)
void bt_mbi_write(u8 port, u8 opcode, u32 offset, u32 mdr)
void bt_mbi_modify(u8 port, u8 opcode, u32 offset, u32 mdr, u32 mask)

port:	indicating the unit being accessed
opcode:	the read or write port specific opcode
offset:	the register offset within the port
mdr:	the register data to be written, or modified
mask:	bit locations in mdr to change

Note: GPU code handles access to the GFX unit. Therefore access to that unit
with this driver is disallowed to avoid conflicts.

Signed-off-by: David E. Box <david.e.box@linux.intel.com>
Cc: Mathhew Garrett <mjg59@srcf.ucam.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
PNPACPI: check return value of pnp_add_device()

pnp_add_device() may fail so we need to handle errors and avoid leaking
memory. Also, do not use ACPI-specific return codes (AE_OK) but rather
standard one (0).

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Merge branch 'pnp-next' into bleeding-edge

* pnp-next:
  PNPACPI: check return value of pnp_add_device()
  X86 platform: New BayTrail IOSF-SB MBI driver
ACPI / Button: Fix enabling button GPEs twice

Button GPEs have been enabled in the acpi_wake_device_init() during
boot and the button driver enables them for the second time.
Consequently, it is necessary to do

# echo disable > /sys/firmware/acpi/interrupts/gpeXXX

twice in a row to disable those GPEs via sysfs. This patch is to
remove the GPE enabling code from the button driver to avoid the
problem.

Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
[rjw: Changelog]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPI / EC: disable GPE before removing GPE handler

Adjust the order of disabling the EC GPE and removing its handler to
avoid unhandled events.

Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
[rjw: Changelog]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Merge branch 'acpi-gpe-next' into bleeding-edge

* acpi-gpe-next:
  ACPI / EC: disable GPE before removing GPE handler
  ACPI / Button: Fix enabling button GPEs twice