diff options
author | Rafal Jaworowski <raj@FreeBSD.org> | 2008-11-19 11:30:44 +0000 |
---|---|---|
committer | Rafal Jaworowski <raj@FreeBSD.org> | 2008-11-19 11:30:44 +0000 |
commit | 6975124c23e9314a1e0eaa111cc0fe829ea102bd (patch) | |
tree | 40bce8269da4ed443cd6bad5034b192458fa2483 /sys/arm/mv/common.c | |
parent | 44e33a075818146eb289c39c3ca2817f54517c9f (diff) | |
download | src-6975124c23e9314a1e0eaa111cc0fe829ea102bd.tar.gz src-6975124c23e9314a1e0eaa111cc0fe829ea102bd.zip |
PCI/PCI-Express support for Marvell systems.
Obtained from: Marvell, Semihalf
Notes
Notes:
svn path=/head/; revision=185089
Diffstat (limited to 'sys/arm/mv/common.c')
-rw-r--r-- | sys/arm/mv/common.c | 86 |
1 files changed, 56 insertions, 30 deletions
diff --git a/sys/arm/mv/common.c b/sys/arm/mv/common.c index 5489874ba8f9..2c09a0b22071 100644 --- a/sys/arm/mv/common.c +++ b/sys/arm/mv/common.c @@ -53,6 +53,7 @@ static void decode_win_eth_setup(uint32_t base); static void decode_win_pcie_setup(uint32_t base); static uint32_t dev, rev; +static uint32_t used_cpu_wins; uint32_t read_cpu_ctrl(uint32_t reg) @@ -198,8 +199,20 @@ soc_decode_win(void) decode_win_eth_setup(MV_ETH0_BASE); if (dev == MV_DEV_MV78100) decode_win_eth_setup(MV_ETH1_BASE); + decode_win_idma_setup(); - decode_win_pcie_setup(MV_PCIE_BASE); + + if (dev == MV_DEV_MV78100) { + decode_win_pcie_setup(MV_PCIE00_BASE); + decode_win_pcie_setup(MV_PCIE01_BASE); + decode_win_pcie_setup(MV_PCIE02_BASE); + decode_win_pcie_setup(MV_PCIE03_BASE); + decode_win_pcie_setup(MV_PCIE10_BASE); + decode_win_pcie_setup(MV_PCIE11_BASE); + decode_win_pcie_setup(MV_PCIE12_BASE); + decode_win_pcie_setup(MV_PCIE13_BASE); + } else + decode_win_pcie_setup(MV_PCIE_BASE); /* TODO set up decode wins for SATA */ @@ -405,12 +418,49 @@ decode_win_cpu_valid(void) return (rv); } +int +decode_win_cpu_set(int target, int attr, vm_paddr_t base, uint32_t size, + int remap) +{ + uint32_t br, cr; + int win; + + if (used_cpu_wins >= MV_WIN_CPU_MAX) + return (-1); + + win = used_cpu_wins++; + + br = base & 0xffff0000; + win_cpu_br_write(win, br); + + if (win_cpu_can_remap(win)) { + if (remap >= 0) { + win_cpu_remap_l_write(win, remap & 0xffff0000); + win_cpu_remap_h_write(win, 0); + } else { + /* + * Remap function is not used for a given window + * (capable of remapping) - set remap field with the + * same value as base. + */ + win_cpu_remap_l_write(win, base & 0xffff0000); + win_cpu_remap_h_write(win, 0); + } + } + + cr = ((size - 1) & 0xffff0000) | (attr << 8) | (target << 4) | 1; + win_cpu_cr_write(win, cr); + + return (0); +} + static void decode_win_cpu_setup(void) { - uint32_t br, cr; int i; + used_cpu_wins = 0; + /* Disable all CPU windows */ for (i = 0; i < MV_WIN_CPU_MAX; i++) { win_cpu_cr_write(i, 0); @@ -422,35 +472,11 @@ decode_win_cpu_setup(void) } for (i = 0; i < cpu_wins_no; i++) - if (cpu_wins[i].target > 0) { - - br = cpu_wins[i].base & 0xffff0000; - win_cpu_br_write(i, br); - - if (win_cpu_can_remap(i)) { - if (cpu_wins[i].remap >= 0) { - win_cpu_remap_l_write(i, - cpu_wins[i].remap & 0xffff0000); - win_cpu_remap_h_write(i, 0); - } else { - /* - * Remap function is not used for - * a given window (capable of - * remapping) - set remap field with the - * same value as base. - */ - win_cpu_remap_l_write(i, - cpu_wins[i].base & 0xffff0000); - win_cpu_remap_h_write(i, 0); - } - } - - cr = ((cpu_wins[i].size - 1) & 0xffff0000) | - (cpu_wins[i].attr << 8) | - (cpu_wins[i].target << 4) | 1; + if (cpu_wins[i].target > 0) + decode_win_cpu_set(cpu_wins[i].target, + cpu_wins[i].attr, cpu_wins[i].base, + cpu_wins[i].size, cpu_wins[i].remap); - win_cpu_cr_write(i, cr); - } } /* |