diff options
author | Avik Sil <aviksil@linux.vnet.ibm.com> | 2013-09-23 14:07:35 +0530 |
---|---|---|
committer | Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> | 2013-10-04 11:58:51 +0530 |
commit | 89dee020cfc6101125c5f558e6e1e844f5cef129 (patch) | |
tree | 2e1caab96233c605d95b9fadb805c610dedff923 | |
parent | 43ba6e5c7faa2bf7ca202279ebbd4be3575bdf0a (diff) | |
download | SLOF-89dee020cfc6101125c5f558e6e1e844f5cef129.zip SLOF-89dee020cfc6101125c5f558e6e1e844f5cef129.tar.gz SLOF-89dee020cfc6101125c5f558e6e1e844f5cef129.tar.bz2 |
Add SLOF pci wrapper functions
Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
-rw-r--r-- | include/helpers.h | 5 | ||||
-rw-r--r-- | slof/helpers.c | 35 |
2 files changed, 40 insertions, 0 deletions
diff --git a/include/helpers.h b/include/helpers.h index 1a1f6e5..e37f916 100644 --- a/include/helpers.h +++ b/include/helpers.h @@ -27,5 +27,10 @@ extern void *SLOF_alloc_mem_aligned(long align, long size); extern void SLOF_free_mem(void *addr, long size); extern long SLOF_dma_map_in(void *virt, long size, int cacheable); extern void SLOF_dma_map_out(long phys, void *virt, long size); +extern long SLOF_pci_config_read32(long offset); +extern long SLOF_pci_config_read16(long offset); +extern void SLOF_pci_config_write32(long offset, long value); +extern void SLOF_pci_config_write16(long offset, long value); +extern void *SLOF_translate_my_address(void *addr); #endif diff --git a/slof/helpers.c b/slof/helpers.c index 564052f..cee8729 100644 --- a/slof/helpers.c +++ b/slof/helpers.c @@ -93,3 +93,38 @@ void SLOF_dma_map_out(long phys, void *virt, long size) forth_push(size); forth_eval("dma-map-out"); } + +long SLOF_pci_config_read32(long offset) +{ + forth_push(offset); + forth_eval("config-l@"); + return forth_pop(); +} + +long SLOF_pci_config_read16(long offset) +{ + forth_push(offset); + forth_eval("config-w@"); + return forth_pop(); +} + +void SLOF_pci_config_write32(long offset, long value) +{ + forth_push(value); + forth_push(offset); + forth_eval("config-l!"); +} + +void SLOF_pci_config_write16(long offset, long value) +{ + forth_push(value); + forth_push(offset); + forth_eval("config-w!"); +} + +void *SLOF_translate_my_address(void *addr) +{ + forth_push((long)addr); + forth_eval("translate-my-address"); + return (void *)forth_pop(); +} |