when #size-cells is zero, don't expect a size.
This commit is contained in:
parent
378af1d671
commit
bebd2b3536
2 changed files with 17 additions and 5 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2001-10-29 Andrew Cagney <ac131313@redhat.com>
|
||||||
|
|
||||||
|
* tree.c (parse_size): Assert #size-cells > 0.
|
||||||
|
(parse_address): Ditto for #address-cells.
|
||||||
|
(parse_reg_property): Only parse the size when #size-cells is
|
||||||
|
non-zero.
|
||||||
|
|
||||||
2001-10-25 Andrew Cagney <ac131313@redhat.com>
|
2001-10-25 Andrew Cagney <ac131313@redhat.com>
|
||||||
|
|
||||||
* emul_generic.c (OEA_MEMORY_SIZE): Increase to 4mb.
|
* emul_generic.c (OEA_MEMORY_SIZE): Increase to 4mb.
|
||||||
|
|
|
@ -463,6 +463,7 @@ parse_address(device *current,
|
||||||
const char *chp,
|
const char *chp,
|
||||||
device_unit *address)
|
device_unit *address)
|
||||||
{
|
{
|
||||||
|
ASSERT(device_nr_address_cells(bus) > 0);
|
||||||
if (device_decode_unit(bus, chp, address) < 0)
|
if (device_decode_unit(bus, chp, address) < 0)
|
||||||
device_error(current, "invalid unit address in %s", chp);
|
device_error(current, "invalid unit address in %s", chp);
|
||||||
return skip_token(chp);
|
return skip_token(chp);
|
||||||
|
@ -485,6 +486,7 @@ parse_size(device *current,
|
||||||
/* parse the numeric list */
|
/* parse the numeric list */
|
||||||
size->nr_cells = device_nr_size_cells(bus);
|
size->nr_cells = device_nr_size_cells(bus);
|
||||||
nr = 0;
|
nr = 0;
|
||||||
|
ASSERT(size->nr_cells > 0);
|
||||||
while (1) {
|
while (1) {
|
||||||
char *next;
|
char *next;
|
||||||
size->cells[nr] = strtoul(curr, &next, 0);
|
size->cells[nr] = strtoul(curr, &next, 0);
|
||||||
|
@ -521,9 +523,11 @@ parse_reg_property(device *current,
|
||||||
int reg_nr;
|
int reg_nr;
|
||||||
reg_property_spec *regs;
|
reg_property_spec *regs;
|
||||||
const char *chp;
|
const char *chp;
|
||||||
|
device *bus = device_parent(current);
|
||||||
|
|
||||||
/* determine the number of reg entries by counting tokens */
|
/* determine the number of reg entries by counting tokens */
|
||||||
nr_regs = count_entries(current, property_name, property_value, 2);
|
nr_regs = count_entries(current, property_name, property_value,
|
||||||
|
1 + (device_nr_size_cells(bus) > 0));
|
||||||
|
|
||||||
/* create working space */
|
/* create working space */
|
||||||
regs = zalloc(nr_regs * sizeof(*regs));
|
regs = zalloc(nr_regs * sizeof(*regs));
|
||||||
|
@ -531,10 +535,11 @@ parse_reg_property(device *current,
|
||||||
/* fill it in */
|
/* fill it in */
|
||||||
chp = property_value;
|
chp = property_value;
|
||||||
for (reg_nr = 0; reg_nr < nr_regs; reg_nr++) {
|
for (reg_nr = 0; reg_nr < nr_regs; reg_nr++) {
|
||||||
chp = parse_address(current, device_parent(current),
|
chp = parse_address(current, bus, chp, ®s[reg_nr].address);
|
||||||
chp, ®s[reg_nr].address);
|
if (device_nr_size_cells(bus) > 0)
|
||||||
chp = parse_size(current, device_parent(current),
|
chp = parse_size(current, bus, chp, ®s[reg_nr].size);
|
||||||
chp, ®s[reg_nr].size);
|
else
|
||||||
|
memset(®s[reg_nr].size, sizeof (®s[reg_nr].size), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create it */
|
/* create it */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue