The pci bus and bridge nodes have trivial dma related words that just call their parent. It is simpler to install these from forth, there's even a word to do that. This both allows removing some clutter from pci.c and introspecting these words from forth with the 'see' word that only showed it calls some C function before this patch but one can now see what these words actually do.
Signed-off-by: BALATON Zoltan balaton@eik.bme.hu --- drivers/pci.c | 41 +---------------------------------------- drivers/pci.fs | 10 ++++++++++ 2 files changed, 11 insertions(+), 40 deletions(-)
diff --git a/drivers/pci.c b/drivers/pci.c index 779a8a4..55b959c 100644 --- a/drivers/pci.c +++ b/drivers/pci.c @@ -411,45 +411,10 @@ ob_pci_bus_map_in(int *idx) PUSH(virt); }
-static void -ob_pci_dma_alloc(int *idx) -{ - call_parent_method("dma-alloc"); -} - -static void -ob_pci_dma_free(int *idx) -{ - call_parent_method("dma-free"); -} - -static void -ob_pci_dma_map_in(int *idx) -{ - call_parent_method("dma-map-in"); -} - -static void -ob_pci_dma_map_out(int *idx) -{ - call_parent_method("dma-map-out"); -} - -static void -ob_pci_dma_sync(int *idx) -{ - call_parent_method("dma-sync"); -} - NODE_METHODS(ob_pci_bus_node) = { { "decode-unit", ob_pci_decode_unit }, { "encode-unit", ob_pci_encode_unit }, { "pci-map-in", ob_pci_bus_map_in }, - { "dma-alloc", ob_pci_dma_alloc }, - { "dma-free", ob_pci_dma_free }, - { "dma-map-in", ob_pci_dma_map_in }, - { "dma-map-out", ob_pci_dma_map_out }, - { "dma-sync", ob_pci_dma_sync }, };
/* ( pci-addr.lo pci-addr.mid pci-addr.hi size -- virt ) */ @@ -465,11 +430,6 @@ NODE_METHODS(ob_pci_bridge_node) = { { "decode-unit", ob_pci_decode_unit }, { "encode-unit", ob_pci_encode_unit }, { "pci-map-in", ob_pci_bridge_map_in }, - { "dma-alloc", ob_pci_dma_alloc }, - { "dma-free", ob_pci_dma_free }, - { "dma-map-in", ob_pci_dma_map_in }, - { "dma-map-out", ob_pci_dma_map_out }, - { "dma-sync", ob_pci_dma_sync }, };
static void pci_set_bus_range(const pci_config_t *config) @@ -1812,6 +1772,7 @@ static phandle_t ob_configure_pci_device(const char* parent_path, } else { BIND_NODE_METHODS(phandle, ob_pci_bus_node); } + fword("is-pci-bus"); break; }
diff --git a/drivers/pci.fs b/drivers/pci.fs index a7b56e1..3c3752e 100644 --- a/drivers/pci.fs +++ b/drivers/pci.fs @@ -37,4 +37,14 @@ then ;
+\ Install methods for a pci bus node +: is-pci-bus + \ 'is-open' will be called by pci.c + " dma-alloc" is-call-parent + " dma-free" is-call-parent + " dma-map-in" is-call-parent + " dma-map-out" is-call-parent + " dma-sync" is-call-parent + ; + [THEN]