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.
This commit is contained in:
parent
937a4bdc12
commit
775b309a4e
4 changed files with 1390 additions and 4 deletions
|
@ -1,3 +1,13 @@
|
|||
Sun Mar 22 16:45:54 1998 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* hw-base.h, hw-base.c (do_hw_attach_regs): Copy function from
|
||||
../ppc/device_table.c.
|
||||
|
||||
* dv-pal.c (hw_pal_finish): Attach PAL device to parent bus.
|
||||
|
||||
* hw-tree.c (print_properties): Supress path when printing
|
||||
properties of root node.
|
||||
|
||||
Sun Mar 22 16:21:15 1998 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* hw-device.h (HW_TRACE): Define.
|
||||
|
@ -32,6 +42,8 @@ Sun Mar 22 15:23:35 1998 Andrew Cagney <cagney@b1.cygnus.com>
|
|||
(hw_create): Allocate the base type using HW_ZALLOC before setting
|
||||
any methods.
|
||||
|
||||
* hw-tree.h, hw-tree.c (hw_tree_delete): New function.
|
||||
|
||||
* hw-properties.c: Replace zalloc/zfree with hw_zalloc/hw_free.
|
||||
|
||||
* hw-ports.c: Replace zalloc/zfree with hw_zalloc/hw_free.
|
||||
|
|
|
@ -385,6 +385,8 @@ hw_pal_finish (struct hw *hw)
|
|||
set_hw_io_read_buffer (hw, hw_pal_io_read_buffer);
|
||||
set_hw_io_write_buffer (hw, hw_pal_io_write_buffer);
|
||||
set_hw_ports (hw, hw_pal_ports);
|
||||
/* attach ourselves */
|
||||
do_hw_attach_regs (me);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
1316
sim/common/hw-tree.c
Normal file
1316
sim/common/hw-tree.c
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue