sim: bfin: se_all32bitopcodes: skip debug insns under the sim
[deliverable/binutils-gdb.git] / sim / ppc / hw_iobus.c
index 50012236df8c36c3e455be122c60e7889f345f61..81ca074ab1158b9bad60817225e880cdfb3aca6d 100644 (file)
@@ -4,7 +4,7 @@
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
+    the Free Software Foundation; either version 3 of the License, or
     (at your option) any later version.
 
     This program is distributed in the hope that it will be useful,
@@ -13,8 +13,7 @@
     GNU General Public License for more details.
  
     You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+    along with this program; if not, see <http://www.gnu.org/licenses/>.
  
     */
 
 #include "device_table.h"
 
 
-/* Device:
+/* DEVICE
 
-   iobus@<address> - bus for attaching devices
+   iobus - simple bus for attaching devices
 
-
-   Description:
+   DESCRIPTION
 
    IOBUS provides a simple `local' bus for attaching (hanging)
-   programmed IO devices from.  All child devices are mapped into this
-   devices parent address space (after adjusting for the iobus's base
-   address).
+   programmed IO devices from.  All child devices are directly mapped
+   into this devices parent address space (after checking that the
+   attach address lies within the <<iobus>> address range.  address).
 
-   
-   Properties:
+   PROPERTIES
 
    None.
 
 
 static void
 hw_iobus_attach_address_callback(device *me,
-                             const char *name,
-                             attach_type type,
-                             int space,
-                             unsigned_word addr,
-                             unsigned nr_bytes,
-                             access_type access,
-                             device *who) /*callback/default*/
+                                attach_type type,
+                                int space,
+                                unsigned_word addr,
+                                unsigned nr_bytes,
+                                access_type access,
+                                device *client) /*callback/default*/
 {
-  unsigned_word hw_iobus_addr;
+  int attach_space;
+  unsigned_word attach_address;
   /* sanity check */
   if (space != 0)
-    error("hw_iobus_attach_address_callback() no space for %s/%s\n",
-         device_name(me), name);
+    device_error(me, "invalid space (%d) specified by %s",
+                space, device_path(client));
   /* get the bus address */
-  if (device_unit_address(me)->nr_cells != 1)
-    error("hw_iobus_attach_address_callback() invalid address for %s\n",
-         device_name(me));
-  hw_iobus_addr = device_unit_address(me)->cells[0];
+  device_address_to_attach_address(device_parent(me),
+                                  device_unit_address(me),
+                                  &attach_space,
+                                  &attach_address,
+                                  me);
+  if (addr < attach_address)
+    device_error(me, "Invalid attach address 0x%lx", (unsigned long)addr);
   device_attach_address(device_parent(me),
-                       device_name(me),
                        type,
-                       0 /*space*/,
-                       hw_iobus_addr + addr,
+                       attach_space,
+                       addr,
                        nr_bytes,
                        access,
-                       who);
+                       client);
 }
 
 
@@ -86,7 +85,9 @@ static device_callbacks const hw_iobus_callbacks = {
   { NULL, }, /* DMA */
   { NULL, }, /* interrupt */
   { generic_device_unit_decode,
-    generic_device_unit_encode, }
+    generic_device_unit_encode,
+    generic_device_address_to_attach_address,
+    generic_device_size_to_attach_size }
 };
 
 
This page took 0.025384 seconds and 4 git commands to generate.