Exemplo n.º 1
0
tree_find_boolean_property(device *root,
			   const char *path_to_property)
{
  name_specifier spec;
  if (!split_property_specifier(root, path_to_property, &spec))
    device_error(root, "Invalid property path %s", path_to_property);
  root = split_find_device(root, &spec);
  return device_find_boolean_property(root, spec.property);
}
Exemplo n.º 2
0
INLINE_EMUL_GENERIC void
emul_add_tree_options(device *tree,
		      bfd *image,
		      const char *emul,
		      const char *env,
		      int oea_interrupt_prefix)
{
  int little_endian = 0;

  /* sort out little endian */
  if (device_find_property(tree, "/options/little-endian?"))
    little_endian = device_find_boolean_property(tree, "/options/little-endian?");
  else {
#ifdef bfd_little_endian	/* new bfd */
    little_endian = (image != NULL && bfd_little_endian(image));
#else
    little_endian = (image != NULL &&
		     !image->xvec->byteorder_big_p);
#endif
    device_tree_add_parsed(tree, "/options/little-endian? %s",
			   little_endian ? "true" : "false");
  }

  /* misc other stuff */
  device_tree_add_parsed(tree, "/openprom/options/oea-memory-size 0x%x",
			 OEA_MEMORY_SIZE);
  device_tree_add_parsed(tree, "/openprom/options/oea-interrupt-prefix %d",
			 oea_interrupt_prefix);
  device_tree_add_parsed(tree, "/openprom/options/smp 1");
  device_tree_add_parsed(tree, "/openprom/options/env %s", env);
  device_tree_add_parsed(tree, "/openprom/options/os-emul %s", emul);
  device_tree_add_parsed(tree, "/openprom/options/strict-alignment? %s",
			 ((WITH_ALIGNMENT == 0 && little_endian)
			  || (WITH_ALIGNMENT == STRICT_ALIGNMENT))
			 ? "true" : "false");
  device_tree_add_parsed(tree, "/openprom/options/floating-point? %s",
			 WITH_FLOATING_POINT ? "true" : "false");
  device_tree_add_parsed(tree, "/openprom/options/use-stdio? %s",
			 WITH_STDIO == DO_USE_STDIO ? "true" : "false");
  device_tree_add_parsed(tree, "/openprom/options/model \"%s",
			 model_name[WITH_DEFAULT_MODEL]);
  device_tree_add_parsed(tree, "/openprom/options/model-issue %d",
			 MODEL_ISSUE_IGNORE);

  /* useful options */
  /* FIXME - need to check the OpenBoot powerpc bindings to see if
     this is still used and if so what it should be */
  device_tree_add_parsed(tree, "/options/load-base 0x80000");
}
Exemplo n.º 3
0
print_properties(device *me)
{
  const device_property *property;
  for (property = device_find_property(me, NULL);
       property != NULL;
       property = device_next_property(property)) {
    printf_filtered("%s/%s", device_path(me), property->name);
    if (property->original != NULL) {
      printf_filtered(" !");
      printf_filtered("%s/%s", 
		      device_path(property->original->owner),
		      property->original->name);
    }
    else {
      switch (property->type) {
      case array_property:
	if ((property->sizeof_array % sizeof(signed_cell)) == 0) {
	  unsigned_cell *w = (unsigned_cell*)property->array;
	  int cell_nr;
	  for (cell_nr = 0;
	       cell_nr < (property->sizeof_array / sizeof(unsigned_cell));
	       cell_nr++) {
	    printf_filtered(" 0x%lx", (unsigned long)BE2H_cell(w[cell_nr]));
	  }
	}
	else {
	  unsigned8 *w = (unsigned8*)property->array;
	  printf_filtered(" [");
	  while ((char*)w - (char*)property->array < property->sizeof_array) {
	    printf_filtered(" 0x%2x", BE2H_1(*w));
	    w++;
	  }
	}
	break;
      case boolean_property:
	{
	  int b = device_find_boolean_property(me, property->name);
	  printf_filtered(" %s", b ? "true"  : "false");
	}
	break;
      case ihandle_property:
	{
	  if (property->array != NULL) {
	    device_instance *instance = device_find_ihandle_property(me, property->name);
	    printf_filtered(" *%s", device_instance_path(instance));
	  }
	  else {
	    /* not yet initialized, ask the device for the path */
	    ihandle_runtime_property_spec spec;
	    device_find_ihandle_runtime_property(me, property->name, &spec);
	    printf_filtered(" *%s", spec.full_path);
	  }
	}
	break;
      case integer_property:
	{
	  unsigned_word w = device_find_integer_property(me, property->name);
	  printf_filtered(" 0x%lx", (unsigned long)w);
	}
	break;
      case range_array_property:
	print_ranges_property(me, property);
	break;
      case reg_array_property:
	print_reg_property(me, property);
	break;
      case string_property:
	{
	  const char *s = device_find_string_property(me, property->name);
	  print_string(s);
	}
	break;
      case string_array_property:
	print_string_array_property(me, property);
	break;
      }
    }
    printf_filtered("\n");
  }
}