mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
rapidio: change inbound window size type to u64
Current definition of map_inb() mport operations callback uses u32 type to specify required inbound window (IBW) size. This is limiting factor because existing hardware - tsi721 and fsl_rio, both support IBW size up to 16GB. Changing type of size parameter to u64 to allow IBW size configurations larger than 4GB. [[email protected]: remove compiler warning about size of constant] Link: http://lkml.kernel.org/r/[email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Alexandre Bounine <[email protected]> Cc: Matt Porter <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Andre van Herk <[email protected]> Cc: Barry Wood <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
60e377b5c1
commit
a057a52e94
3 changed files with 12 additions and 8 deletions
|
|
@ -1090,7 +1090,7 @@ static void tsi721_init_pc2sr_mapping(struct tsi721_device *priv)
|
|||
* from rstart to lstart.
|
||||
*/
|
||||
static int tsi721_rio_map_inb_mem(struct rio_mport *mport, dma_addr_t lstart,
|
||||
u64 rstart, u32 size, u32 flags)
|
||||
u64 rstart, u64 size, u32 flags)
|
||||
{
|
||||
struct tsi721_device *priv = mport->priv;
|
||||
int i, avail = -1;
|
||||
|
|
@ -1103,6 +1103,10 @@ static int tsi721_rio_map_inb_mem(struct rio_mport *mport, dma_addr_t lstart,
|
|||
struct tsi721_ib_win_mapping *map = NULL;
|
||||
int ret = -EBUSY;
|
||||
|
||||
/* Max IBW size supported by HW is 16GB */
|
||||
if (size > 0x400000000UL)
|
||||
return -EINVAL;
|
||||
|
||||
if (direct) {
|
||||
/* Calculate minimal acceptable window size and base address */
|
||||
|
||||
|
|
@ -1110,15 +1114,15 @@ static int tsi721_rio_map_inb_mem(struct rio_mport *mport, dma_addr_t lstart,
|
|||
ibw_start = lstart & ~(ibw_size - 1);
|
||||
|
||||
tsi_debug(IBW, &priv->pdev->dev,
|
||||
"Direct (RIO_0x%llx -> PCIe_%pad), size=0x%x, ibw_start = 0x%llx",
|
||||
"Direct (RIO_0x%llx -> PCIe_%pad), size=0x%llx, ibw_start = 0x%llx",
|
||||
rstart, &lstart, size, ibw_start);
|
||||
|
||||
while ((lstart + size) > (ibw_start + ibw_size)) {
|
||||
ibw_size *= 2;
|
||||
ibw_start = lstart & ~(ibw_size - 1);
|
||||
if (ibw_size > 0x80000000) { /* Limit max size to 2GB */
|
||||
/* Check for crossing IBW max size 16GB */
|
||||
if (ibw_size > 0x400000000UL)
|
||||
return -EBUSY;
|
||||
}
|
||||
}
|
||||
|
||||
loc_start = ibw_start;
|
||||
|
|
@ -1129,7 +1133,7 @@ static int tsi721_rio_map_inb_mem(struct rio_mport *mport, dma_addr_t lstart,
|
|||
|
||||
} else {
|
||||
tsi_debug(IBW, &priv->pdev->dev,
|
||||
"Translated (RIO_0x%llx -> PCIe_%pad), size=0x%x",
|
||||
"Translated (RIO_0x%llx -> PCIe_%pad), size=0x%llx",
|
||||
rstart, &lstart, size);
|
||||
|
||||
if (!is_power_of_2(size) || size < 0x1000 ||
|
||||
|
|
|
|||
Loading…
Reference in a new issue