pci-phb: Reimplement dma-map-in/out
pci-phb: Reimplement dma-map-in/out

The immediate problem with the code is that it relies on memory allocator
aligning addresses to the size. This is true for SLOF but not for GRUB
and in unaligned situations we end up mapping more pages than bm-alloc
allocated.

This fixes the problem by calculating aligned DMA size before calling
bm-alloc.

While at this, simplify the code by removing global variables. Also
replace 1000/fff (the default 4K IOMMU page size) with tce-ps/mask.

Signed-off-by: Alexey Kardashevskiy <ac1fc56530d7d037e1ea666f130daca22d72f964@ozlabs.ru>
Reviewed-by: Michael Roth <04e3c7ed0b6a5be8ee7105f6c521ea7c8e5b8c37@linux.vnet.ibm.com>
---
Changes:
v4:
* fixed code comments, tab/spaces
* fixed bm-alloc failure handling

qemu/SLOF,stefanberger/SLOF-tpm,stefanberger/SLOF-tpm,aik/SLOF,aik/SLOF,qemu/SLOF,aik/SLOF,stefanberger/SLOF-tpm,qemu/SLOF