ast/io: Fix a number of issues with SuperIO access

The code to access AST registers via the iLPC->AHB bridge was very
fragile and relied on the SIO to be kept unlocked with the right
device selected.

This got broken when adding the new UART configuration among other
things.

Rework this to create a pair of get/put() helpers to use to access
a given SIO device, which take care of doing the appropriate device
selection when needed and also take/release the SIO spinlock.

This fixes Flash/NVRAM setup which got broken along the way and also
makes the fixup for the VUART interrupts actually work.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
core: Make secondary spin and locks use cpu_relax()

This makes secondaries spinning waiting for a job and spinlocks
use cpu_relax() which speeds up the primary thread and thus speeds
up the boot process a bit. Also prettify a bit cpu_relax() implementation

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Change DBG macro to prlog calls for platforms/ibm-fsp/lxvpd.c

No functional changes, when running with higher log level, you'll
get debug messages without recompiling!

Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Change DBG to prlog PR_TRACE and PR_INSANE in hw/fsp/fsp-sensor.c

Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
use prlog(PR_INSANE in hw/fsp/fsp.c in place of DBG ifdef

This means that when log level of PR_INSANE is enabled, you will
get traces of messages to/from FSP.

Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Use prlog rather than DBG #ifdef in hw/fsp/fsp-leds.c

Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Use prlog instead of DBG macros in hw/fsp/fsp-rtc.c

Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Remove (unused) DBG macros from hw/fsp/fsp-nvram.c

Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Convert hw/slw.c from DBG #define to prlog

Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Convert hw/fsi-master.c from DBG define to prlog PR_INSANE

All the DBG() macros seemed to be more trace oriented than debug.

Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Use prlog(PR_INSANE in hw/chiptod.c instead of DBG macro.

It seems like these are more of things to trace rather than too useful
for random debugging... I could be wrong, but that's why you're reading
this, reviewing this code. RIGHT!!??!?

Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
hw/fake-rtc.c now uses prlog(PR_TRACE instead of DBG macro

Only two possible printouts, so probably fine for debug level.

Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
remove unused DBG and FSP_TRACE macros from hw/psi.c

Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
PCI: Refactor error injection

The patch refactors the code we had for PCI error injection. It
doesn't change the logic:

   * Rename names of error types and functions according to the
     comments given by Michael Ellerman when reviewing the kernel
     counterpart.
   * Split The backend of error injection for PHB3 and P7IOC to
     multiple functions to improve code readability. Some logics
     are simplified without affecting their original functionality.
   * Misc cleanup like renaming variables and functions.

Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
PHB3: Support multiple MM32 segments for error injection

When doing error injection to 32-bits MMIO range, fixed length 8MB
is used. That's incorrect as one PE might span multile segments.
Also the 32-bits MMIO segment size isn't 8MB necessarily.

The patch fixes the issue to cover all (contiguous) 32-bits MMIO
segments assigned to the specified PE. Also, it fixes the 48 bits
of 50 bits AIB address, instead of all bits used for comparison.

BZ: 115222

Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
PHB3: Support MM64 error injection

The patch enables injecting PCI errors to 64-bits MMIO range.

BZ: 115222

Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
PHB3: Support DMA error injection

The patch enables injecting PCI errors to DMA address address,
including 32-bits and 64-bits ranges.

BZ: 115222

Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
slw: Remove log flooding from fast sleep code

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Merge branch 'release-2.1.1'
uart: Exploit Tx FIFO

When THRE is 1, we can write up to 16 bytes, so let's make good
use of it

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>