diff options
author | raj <raj@FreeBSD.org> | 2008-11-19 11:30:44 +0000 |
---|---|---|
committer | raj <raj@FreeBSD.org> | 2008-11-19 11:30:44 +0000 |
commit | d985db3ad549f77ae4a6045ec7d3c94835224941 (patch) | |
tree | 40bce8269da4ed443cd6bad5034b192458fa2483 /sys/arm/mv/discovery | |
parent | 815d52c5df6a76286604478e5223d2f2c87b2c04 (diff) | |
download | FreeBSD-src-d985db3ad549f77ae4a6045ec7d3c94835224941.zip FreeBSD-src-d985db3ad549f77ae4a6045ec7d3c94835224941.tar.gz |
PCI/PCI-Express support for Marvell systems.
Obtained from: Marvell, Semihalf
Diffstat (limited to 'sys/arm/mv/discovery')
-rw-r--r-- | sys/arm/mv/discovery/db78xxx.c | 19 | ||||
-rw-r--r-- | sys/arm/mv/discovery/discovery.c | 82 |
2 files changed, 93 insertions, 8 deletions
diff --git a/sys/arm/mv/discovery/db78xxx.c b/sys/arm/mv/discovery/db78xxx.c index f472793..16736b0 100644 --- a/sys/arm/mv/discovery/db78xxx.c +++ b/sys/arm/mv/discovery/db78xxx.c @@ -57,7 +57,10 @@ __FBSDID("$FreeBSD$"); * virtual_avail - 0xefff_ffff : KVA (virtual_avail is typically < 0xc0a0_0000) * 0xf000_0000 - 0xf0ff_ffff : no-cache allocation area (16MB) * 0xf100_0000 - 0xf10f_ffff : SoC integrated devices registers range (1MB) - * 0xf110_0000 - 0xfffe_ffff : PCIE (MEM+IO) outbound windows (~238MB) + * 0xf110_0000 - 0xf11f_ffff : PCI-Express I/O space (1MB) + * 0xf120_0000 - 0xf12f_ffff : unused (1MB) + * 0xf130_0000 - 0xf52f_ffff : PCI-Express memory space (64MB) + * 0xf930_0000 - 0xfffe_ffff : unused (~172MB) * 0xffff_0000 - 0xffff_0fff : 'high' vectors page (4KB) * 0xffff_1000 - 0xffff_1fff : ARM_TP_ADDRESS/RAS page (4KB) * 0xffff_2000 - 0xffff_ffff : unused (~55KB) @@ -79,6 +82,20 @@ static const struct pmap_devmap pmap_devmap[] = { VM_PROT_READ | VM_PROT_WRITE, PTE_NOCACHE, }, + { /* PCIE I/O */ + MV_PCIE_IO_BASE, + MV_PCIE_IO_PHYS_BASE, + MV_PCIE_IO_SIZE, + VM_PROT_READ | VM_PROT_WRITE, + PTE_NOCACHE, + }, + { /* PCIE Memory */ + MV_PCIE_MEM_BASE, + MV_PCIE_MEM_PHYS_BASE, + MV_PCIE_MEM_SIZE, + VM_PROT_READ | VM_PROT_WRITE, + PTE_NOCACHE, + }, { 0, 0, 0, 0, 0, } }; diff --git a/sys/arm/mv/discovery/discovery.c b/sys/arm/mv/discovery/discovery.c index 33f0bf5..c245fa9 100644 --- a/sys/arm/mv/discovery/discovery.c +++ b/sys/arm/mv/discovery/discovery.c @@ -41,6 +41,24 @@ __FBSDID("$FreeBSD$"); #include <arm/mv/mvreg.h> #include <arm/mv/mvvar.h> +#define _MV_PCIE_MAX_PORT 8 + +#define _MV_PCIE_IO_SIZE (MV_PCIE_IO_SIZE / _MV_PCIE_MAX_PORT) +#define _MV_PCIE_MEM_SIZE (MV_PCIE_MEM_SIZE / _MV_PCIE_MAX_PORT) + +#define _MV_PCIE_IO(n) (MV_PCIE_IO_BASE + ((n) * _MV_PCIE_IO_SIZE)) +#define _MV_PCIE_MEM(n) (MV_PCIE_MEM_BASE + ((n) * _MV_PCIE_MEM_SIZE)) + +#define _MV_PCIE_IO_PHYS(n) (MV_PCIE_IO_PHYS_BASE + ((n) * _MV_PCIE_IO_SIZE)) +#define _MV_PCIE_MEM_PHYS(n) (MV_PCIE_MEM_PHYS_BASE + ((n) * _MV_PCIE_MEM_SIZE)) + +/* + * Note the 'pcib' devices are not declared in the obio_devices[]: due to the + * much more complex configuration schemes allowed, specifically of the + * PCI-Express (multiple lanes width per port configured dynamically etc.) it + * is better and flexible to instantiate the number of PCI bridge devices + * (known in run-time) in the pcib_mbus_identify() method. + */ struct obio_device obio_devices[] = { { "ic", MV_IC_BASE, MV_IC_SIZE, { -1 }, @@ -104,6 +122,61 @@ struct obio_device obio_devices[] = { { NULL, 0, 0, { 0 }, { 0 }, 0 } }; +const struct obio_pci mv_pci_info[] = { + { MV_TYPE_PCIE, + MV_PCIE00_BASE, MV_PCIE_SIZE, + _MV_PCIE_IO(0), _MV_PCIE_IO_SIZE, 4, 0xE0, + _MV_PCIE_MEM(0), _MV_PCIE_MEM_SIZE, 4, 0xE8, + NULL, MV_INT_PEX00 }, + + { MV_TYPE_PCIE_AGGR_LANE, + MV_PCIE01_BASE, MV_PCIE_SIZE, + _MV_PCIE_IO(1), _MV_PCIE_IO_SIZE, 4, 0xD0, + _MV_PCIE_MEM(1), _MV_PCIE_MEM_SIZE, 4, 0xD8, + NULL, MV_INT_PEX01 }, +#if 0 + /* + * XXX Access to devices on this interface (PCIE 0.2) crashes the + * system. Could be a silicon defect as Marvell U-Boot has a 'Do not + * touch' precaution comment... + */ + { MV_TYPE_PCIE_AGGR_LANE, + MV_PCIE02_BASE, MV_PCIE_SIZE, + _MV_PCIE_IO(2), _MV_PCIE_IO_SIZE(2), 4, 0xB0, + _MV_PCIE_MEM(2), _MV_PCIE_MEM_SIZE(2), 4, 0xB8, + NULL, MV_INT_PEX02 }, +#endif + { MV_TYPE_PCIE_AGGR_LANE, + MV_PCIE03_BASE, MV_PCIE_SIZE, + _MV_PCIE_IO(3), _MV_PCIE_IO_SIZE, 4, 0x70, + _MV_PCIE_MEM(3), _MV_PCIE_MEM_SIZE, 4, 0x78, + NULL, MV_INT_PEX03 }, + + { MV_TYPE_PCIE, + MV_PCIE10_BASE, MV_PCIE_SIZE, + _MV_PCIE_IO(4), _MV_PCIE_IO_SIZE, 8, 0xE0, + _MV_PCIE_MEM(4), _MV_PCIE_MEM_SIZE, 8, 0xE8, + NULL, MV_INT_PEX10 }, + + { MV_TYPE_PCIE_AGGR_LANE, + MV_PCIE11_BASE, MV_PCIE_SIZE, + _MV_PCIE_IO(5), _MV_PCIE_IO_SIZE, 8, 0xD0, + _MV_PCIE_MEM(5), _MV_PCIE_MEM_SIZE, 8, 0xD8, + NULL, MV_INT_PEX11 }, + { MV_TYPE_PCIE_AGGR_LANE, + MV_PCIE12_BASE, MV_PCIE_SIZE, + _MV_PCIE_IO(6), _MV_PCIE_IO_SIZE, 8, 0xB0, + _MV_PCIE_MEM(6), _MV_PCIE_MEM_SIZE, 8, 0xB8, + NULL, MV_INT_PEX12 }, + { MV_TYPE_PCIE_AGGR_LANE, + MV_PCIE13_BASE, MV_PCIE_SIZE, + _MV_PCIE_IO(7), _MV_PCIE_IO_SIZE, 8, 0x70, + _MV_PCIE_MEM(7), _MV_PCIE_MEM_SIZE, 8, 0x78, + NULL, MV_INT_PEX13 }, + + { 0, 0, 0 } +}; + struct resource_spec mv_gpio_spec[] = { { SYS_RES_MEMORY, 0, RF_ACTIVE }, { SYS_RES_IRQ, 0, RF_ACTIVE }, @@ -122,12 +195,6 @@ struct resource_spec mv_xor_spec[] = { }; const struct decode_win cpu_win_tbl[] = { - /* PCIE IO */ - { 4, 0x51, MV_PCIE_IO_PHYS_BASE, MV_PCIE_IO_SIZE, -1 }, - - /* PCIE MEM */ - { 4, 0x59, MV_PCIE_MEM_PHYS_BASE, MV_PCIE_MEM_SIZE, -1 }, - /* Device bus BOOT */ { 1, 0x2f, MV_DEV_BOOT_PHYS_BASE, MV_DEV_BOOT_SIZE, -1 }, @@ -154,7 +221,8 @@ int cpu_wins_no = sizeof(cpu_win_tbl) / sizeof(struct decode_win); */ const struct decode_win idma_win_tbl[] = { /* PCIE MEM */ - { 4, 0x59, MV_PCIE_MEM_PHYS_BASE, MV_PCIE_MEM_SIZE, -1 }, + { 4, 0xE8, _MV_PCIE_MEM_PHYS(0), _MV_PCIE_MEM_SIZE, -1 }, + { 4, 0xD8, _MV_PCIE_MEM_PHYS(1), _MV_PCIE_MEM_SIZE, -1 }, }; const struct decode_win *idma_wins = idma_win_tbl; int idma_wins_no = sizeof(idma_win_tbl) / sizeof(struct decode_win); |