diff options
author | Andrew Cagney <cagney@redhat.com> | 1998-03-22 05:49:30 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 1998-03-22 05:49:30 +0000 |
commit | 775b309a4ed05c21bb05c2f325da04635bef44b0 (patch) | |
tree | 76f3b66848b3fb9eeeca62a1db80b12de6c9a276 /sim/common/hw-base.c | |
parent | 937a4bdc12d90b400da5b5f5e1e3770c6e4b39ea (diff) | |
download | gdb-775b309a4ed05c21bb05c2f325da04635bef44b0.zip gdb-775b309a4ed05c21bb05c2f325da04635bef44b0.tar.gz gdb-775b309a4ed05c21bb05c2f325da04635bef44b0.tar.bz2 |
Copy function ../ppc/device_table.c:generic_device_init_address() to
hw-base.c:do_hw_attach_regs(). Use in dv-pal.
Add hw_tree_delete to hw-tree.c.
Diffstat (limited to 'sim/common/hw-base.c')
-rw-r--r-- | sim/common/hw-base.c | 64 |
1 files changed, 60 insertions, 4 deletions
diff --git a/sim/common/hw-base.c b/sim/common/hw-base.c index ad17df4..2057e90 100644 --- a/sim/common/hw-base.c +++ b/sim/common/hw-base.c @@ -442,10 +442,6 @@ hw_create (SIM_DESC sd, } } - /* Fill in the (hopefully) defined trace variable */ - if (hw_find_property (hw, "trace?") != NULL) - hw->trace_of_hw_p = hw_find_boolean_property (hw, "trace?"); - /* Attach dummy ports */ set_hw_ports (hw, empty_hw_ports); set_hw_port_event (hw, panic_hw_port_event); @@ -478,6 +474,10 @@ hw_finish (struct hw *me) else me->nr_size_cells_of_hw_unit = 1; + /* Fill in the (hopefully) defined trace variable */ + if (hw_find_property (hw, "trace?") != NULL) + hw->trace_of_hw_p = hw_find_boolean_property (hw, "trace?"); + /* Allow the real device to override any methods */ me->base_of_hw->descriptor->to_finish (me); me->base_of_hw->finished_p = 1; @@ -523,3 +523,59 @@ hw_delete (struct hw *me) zfree (me->base_of_hw); zfree (me); } + + +/* Go through the devices various reg properties for those that + specify attach addresses */ + + +void +do_hw_attach_regs (struct hw *hw) +{ + static const char *(reg_property_names[]) = { + "attach-addresses", + "assigned-addresses", + "reg", + "alternate-reg" , + NULL + }; + const char **reg_property_name; + int nr_valid_reg_properties = 0; + for (reg_property_name = reg_property_names; + *reg_property_name != NULL; + reg_property_name++) + { + if (hw_find_property (hw, *reg_property_name) != NULL) + { + reg_property_spec reg; + int reg_entry; + for (reg_entry = 0; + hw_find_reg_array_property (hw, *reg_property_name, reg_entry, + ®); + reg_entry++) + { + unsigned_word attach_address; + int attach_space; + unsigned attach_size; + if (!hw_unit_address_to_attach_address (hw_parent (hw), + ®.address, + &attach_space, + &attach_address, + hw)) + continue; + if (!hw_unit_size_to_attach_size (hw_parent (hw), + ®.size, + &attach_size, hw)) + continue; + hw_attach_address (hw_parent (hw), + 0, + attach_space, attach_address, attach_size, + hw); + nr_valid_reg_properties++; + } + /* if first option matches don't try for any others */ + if (reg_property_name == reg_property_names) + break; + } + } +} |