Home | History | Annotate | Line # | Download | only in common
      1   1.1  christos /* The common simulator framework for GDB, the GNU Debugger.
      2   1.1  christos 
      3  1.11  christos    Copyright 2002-2024 Free Software Foundation, Inc.
      4   1.1  christos 
      5   1.1  christos    Contributed by Andrew Cagney and Red Hat.
      6   1.1  christos 
      7   1.1  christos    This file is part of GDB.
      8   1.1  christos 
      9   1.1  christos    This program is free software; you can redistribute it and/or modify
     10   1.1  christos    it under the terms of the GNU General Public License as published by
     11   1.1  christos    the Free Software Foundation; either version 3 of the License, or
     12   1.1  christos    (at your option) any later version.
     13   1.1  christos 
     14   1.1  christos    This program is distributed in the hope that it will be useful,
     15   1.1  christos    but WITHOUT ANY WARRANTY; without even the implied warranty of
     16   1.1  christos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     17   1.1  christos    GNU General Public License for more details.
     18   1.1  christos 
     19   1.1  christos    You should have received a copy of the GNU General Public License
     20   1.1  christos    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
     21   1.1  christos 
     22   1.1  christos 
     23   1.1  christos #ifndef HW_DEVICE_H
     24   1.1  christos #define HW_DEVICE_H
     25   1.1  christos 
     26  1.10  christos #include <stdarg.h>
     27  1.10  christos 
     28  1.10  christos #include "ansidecl.h"
     29   1.1  christos 
     30   1.1  christos /* Introduction:
     31   1.1  christos 
     32   1.1  christos    As explained in earlier sections, the device, device instance,
     33   1.1  christos    property and ports lie at the heart of PSIM's device model.
     34   1.1  christos 
     35   1.1  christos    In the below a synopsis of the device object and the operations it
     36   1.1  christos    supports are given.
     37   1.1  christos    */
     38   1.1  christos 
     39   1.1  christos 
     40   1.1  christos /* Creation:
     41   1.1  christos 
     42   1.1  christos    The devices are created using a sequence of steps.  In particular:
     43   1.1  christos 
     44   1.1  christos 	o	A tree framework is created.
     45   1.1  christos 
     46   1.1  christos 		At this point, properties can be modified and extra
     47   1.1  christos 		devices inserted (or removed?).
     48   1.1  christos 
     49   1.1  christos #if LATER
     50   1.1  christos 
     51   1.1  christos 		Any properties that have a run-time value (eg ihandle
     52   1.1  christos 		or device instance pointer properties) are entered
     53   1.1  christos 		into the device tree using a named reference to the
     54   1.1  christos 		corresponding runtime object that is to be created.
     55   1.1  christos 
     56   1.1  christos #endif
     57   1.1  christos 
     58   1.1  christos 	o	Real devices are created for all the dummy devices.
     59   1.1  christos 
     60   1.1  christos 		A device can assume that all of its parents have been
     61   1.1  christos 		initialized.
     62   1.1  christos 
     63   1.1  christos 		A device can assume that all non run-time properties
     64   1.1  christos 		have been initialized.
     65   1.1  christos 
     66   1.1  christos 		As part of being created, the device normally attaches
     67   1.1  christos 		itself to its parent bus.
     68   1.1  christos 
     69   1.1  christos #if LATER
     70   1.1  christos 
     71   1.1  christos 		Device instance data is initialized.
     72   1.1  christos 
     73   1.1  christos #endif
     74   1.1  christos 
     75   1.1  christos #if LATER
     76   1.1  christos 
     77   1.1  christos 	o	Any run-time properties are created.
     78   1.1  christos 
     79   1.1  christos #endif
     80   1.1  christos 
     81   1.1  christos #if MUCH_MUCH_LATER
     82   1.1  christos 
     83   1.1  christos 	o	Some devices, as part of their initialization
     84   1.1  christos 		might want to refer to ihandle properties
     85   1.1  christos 		in the device tree.
     86   1.1  christos 
     87   1.1  christos #endif
     88   1.1  christos 
     89   1.1  christos    NOTES:
     90   1.1  christos 
     91   1.1  christos 	o	It is important to separate the creation
     92   1.1  christos 		of an actual device from the creation
     93   1.1  christos 		of the tree.  The alternative creating
     94   1.1  christos 		the device in two stages: As a separate
     95   1.1  christos 		entity and then as a part of the tree.
     96   1.1  christos 
     97   1.1  christos #if LATER
     98   1.1  christos 	o	Run-time properties can not be created
     99   1.1  christos 		until after the devices in the tree
    100   1.1  christos 		have been created.  Hence an extra pass
    101   1.1  christos 		for handling them.
    102   1.1  christos #endif
    103   1.1  christos 
    104   1.1  christos    */
    105   1.1  christos 
    106   1.1  christos /* Relationships:
    107   1.1  christos 
    108   1.1  christos    A device is able to determine its relationship to other devices
    109   1.1  christos    within the tree.  Operations include querying for a devices parent,
    110   1.1  christos    sibling, child, name, and path (from the root).
    111   1.1  christos 
    112   1.1  christos    */
    113   1.1  christos 
    114   1.1  christos 
    115   1.1  christos #define hw_parent(hw) ((hw)->parent_of_hw + 0)
    116   1.1  christos 
    117   1.1  christos #define hw_sibling(hw) ((hw)->sibling_of_hw + 0)
    118   1.1  christos 
    119   1.1  christos #define hw_child(hw) ((hw)->child_of_hw + 0)
    120   1.1  christos 
    121   1.1  christos 
    122   1.1  christos 
    123   1.1  christos /* Herritage:
    124   1.1  christos 
    125   1.1  christos  */
    126   1.1  christos 
    127   1.1  christos #define hw_family(hw) ((hw)->family_of_hw + 0)
    128   1.1  christos 
    129   1.1  christos #define hw_name(hw) ((hw)->name_of_hw + 0)
    130   1.1  christos 
    131   1.1  christos #define hw_args(hw) ((hw)->args_of_hw + 0)
    132   1.1  christos 
    133   1.1  christos #define hw_path(hw) ((hw)->path_of_hw + 0)
    134   1.1  christos 
    135   1.1  christos 
    136   1.1  christos 
    137   1.1  christos /* Short cut to the root node of the tree */
    138   1.1  christos 
    139   1.1  christos #define hw_root(hw) ((hw)->root_of_hw + 0)
    140   1.1  christos 
    141   1.1  christos /* Short cut back to the simulator object */
    142   1.1  christos 
    143   1.1  christos #define hw_system(hw) ((hw)->system_of_hw)
    144   1.1  christos 
    145   1.1  christos /* For requests initiated by a CPU the cpu that initiated the request */
    146   1.1  christos 
    147   1.1  christos struct _sim_cpu *hw_system_cpu (struct hw *hw);
    148   1.1  christos 
    149   1.1  christos 
    150   1.1  christos /* Device private data */
    151   1.1  christos 
    152   1.1  christos #define hw_data(hw) ((hw)->data_of_hw)
    153   1.1  christos 
    154   1.1  christos #define set_hw_data(hw, value) \
    155   1.1  christos ((hw)->data_of_hw = (value))
    156   1.1  christos 
    157   1.1  christos 
    158   1.1  christos 
    159   1.1  christos /* Perform a soft reset of the device */
    161   1.1  christos 
    162   1.1  christos typedef unsigned (hw_reset_method)
    163   1.1  christos      (struct hw *me);
    164   1.1  christos 
    165   1.1  christos #define hw_reset(hw) ((hw)->to_reset (hw))
    166   1.1  christos 
    167   1.1  christos #define set_hw_reset(hw, method) \
    168   1.1  christos ((hw)->to_reset = method)
    169   1.1  christos 
    170   1.1  christos 
    171   1.1  christos /* Hardware operations:
    173   1.1  christos 
    174   1.1  christos    Connecting a parent to its children is a common bus. The parent
    175   1.1  christos    node is described as the bus owner and is responisble for
    176   1.1  christos    co-ordinating bus operations. On the bus, a SPACE:ADDR pair is used
    177   1.1  christos    to specify an address.  A device that is both a bus owner (parent)
    178   1.1  christos    and bus client (child) are referred to as a bridging device.
    179   1.1  christos 
    180   1.1  christos    A child performing a data (DMA) transfer will pass its request to
    181   1.1  christos    the bus owner (the devices parent).  The bus owner will then either
    182   1.1  christos    reflect the request to one of the other devices attached to the bus
    183   1.1  christos    (a child of the bus owner) or bridge the request up the tree to the
    184   1.1  christos    next bus. */
    185   1.1  christos 
    186   1.1  christos 
    187   1.1  christos /* Children attached to a bus can register (attach) themselves to
    188   1.1  christos    specific addresses on their attached bus.
    189   1.1  christos 
    190   1.1  christos    (A device may also be implicitly attached to certain bus
    191   1.1  christos    addresses).
    192   1.1  christos 
    193   1.1  christos    The SPACE:ADDR pair specify an address on the common bus that
    194   1.1  christos    connects the parent and child devices. */
    195   1.1  christos 
    196   1.1  christos typedef void (hw_attach_address_method)
    197   1.1  christos      (struct hw *me,
    198   1.1  christos       int level,
    199   1.1  christos       int space,
    200   1.1  christos       address_word addr,
    201   1.1  christos       address_word nr_bytes,
    202   1.1  christos       struct hw *client); /*callback/default*/
    203   1.1  christos 
    204   1.1  christos #define hw_attach_address(me, level, space, addr, nr_bytes, client) \
    205   1.1  christos ((me)->to_attach_address (me, level, space, addr, nr_bytes, client))
    206   1.1  christos 
    207   1.1  christos #define set_hw_attach_address(hw, method) \
    208   1.1  christos ((hw)->to_attach_address = (method))
    209   1.1  christos 
    210   1.1  christos typedef void (hw_detach_address_method)
    211   1.1  christos      (struct hw *me,
    212   1.1  christos       int level,
    213   1.1  christos       int space,
    214   1.1  christos       address_word addr,
    215   1.1  christos       address_word nr_bytes,
    216   1.1  christos       struct hw *client); /*callback/default*/
    217   1.1  christos 
    218   1.1  christos #define hw_detach_address(me, level, space, addr, nr_bytes, client) \
    219   1.1  christos ((me)->to_detach_address (me, level, space, addr, nr_bytes, client))
    220   1.1  christos 
    221   1.1  christos #define set_hw_detach_address(hw, method) \
    222   1.1  christos ((hw)->to_detach_address = (method))
    223   1.1  christos 
    224   1.1  christos 
    225   1.1  christos /* An IO operation from a parent to a child via the conecting bus.
    226   1.1  christos 
    227   1.1  christos    The SPACE:ADDR pair specify an address on the bus shared between
    228   1.1  christos    the parent and child devices. */
    229   1.1  christos 
    230   1.1  christos typedef unsigned (hw_io_read_buffer_method)
    231   1.1  christos      (struct hw *me,
    232   1.1  christos       void *dest,
    233   1.1  christos       int space,
    234   1.1  christos       unsigned_word addr,
    235   1.1  christos       unsigned nr_bytes);
    236   1.1  christos 
    237   1.1  christos #define hw_io_read_buffer(hw, dest, space, addr, nr_bytes) \
    238   1.1  christos ((hw)->to_io_read_buffer (hw, dest, space, addr, nr_bytes))
    239   1.1  christos 
    240   1.1  christos #define set_hw_io_read_buffer(hw, method) \
    241   1.1  christos ((hw)->to_io_read_buffer = (method))
    242   1.1  christos 
    243   1.1  christos typedef unsigned (hw_io_write_buffer_method)
    244   1.1  christos      (struct hw *me,
    245   1.1  christos       const void *source,
    246   1.1  christos       int space,
    247   1.1  christos       unsigned_word addr,
    248   1.1  christos       unsigned nr_bytes);
    249   1.1  christos 
    250   1.1  christos #define hw_io_write_buffer(hw, src, space, addr, nr_bytes) \
    251   1.1  christos ((hw)->to_io_write_buffer (hw, src, space, addr, nr_bytes))
    252   1.1  christos 
    253   1.1  christos #define set_hw_io_write_buffer(hw, method) \
    254   1.1  christos ((hw)->to_io_write_buffer = (method))
    255   1.1  christos 
    256   1.1  christos 
    257   1.1  christos /* Conversly, the device pci1000,1@1 may need to perform a dma transfer
    258   1.1  christos    into the cpu/memory core.  Just as I/O moves towards the leaves,
    259   1.1  christos    dma transfers move towards the core via the initiating devices
    260   1.1  christos    parent nodes.  The root device (special) converts the DMA transfer
    261   1.1  christos    into reads/writes to memory.
    262   1.1  christos 
    263   1.1  christos    The SPACE:ADDR pair specify an address on the common bus connecting
    264   1.1  christos    the parent and child devices. */
    265   1.1  christos 
    266   1.1  christos typedef unsigned (hw_dma_read_buffer_method)
    267   1.1  christos      (struct hw *bus,
    268   1.1  christos       void *dest,
    269   1.1  christos       int space,
    270   1.1  christos       unsigned_word addr,
    271   1.1  christos       unsigned nr_bytes);
    272   1.1  christos 
    273   1.1  christos #define hw_dma_read_buffer(bus, dest, space, addr, nr_bytes) \
    274   1.1  christos ((bus)->to_dma_read_buffer (bus, dest, space, addr, nr_bytes))
    275   1.1  christos 
    276   1.1  christos #define set_hw_dma_read_buffer(me, method) \
    277   1.1  christos ((me)->to_dma_read_buffer = (method))
    278   1.1  christos 
    279   1.1  christos typedef unsigned (hw_dma_write_buffer_method)
    280   1.1  christos      (struct hw *bus,
    281   1.1  christos       const void *source,
    282   1.1  christos       int space,
    283   1.1  christos       unsigned_word addr,
    284   1.1  christos       unsigned nr_bytes,
    285   1.1  christos       int violate_read_only_section);
    286   1.1  christos 
    287   1.1  christos #define hw_dma_write_buffer(bus, src, space, addr, nr_bytes, violate_ro) \
    288   1.1  christos ((bus)->to_dma_write_buffer (bus, src, space, addr, nr_bytes, violate_ro))
    289   1.1  christos 
    290   1.1  christos #define set_hw_dma_write_buffer(me, method) \
    291   1.1  christos ((me)->to_dma_write_buffer = (method))
    292   1.1  christos 
    293   1.1  christos /* Address/size specs for devices are encoded following a convention
    295   1.1  christos    similar to that used by OpenFirmware.  In particular, an
    296   1.1  christos    address/size is packed into a sequence of up to four cell words.
    297   1.1  christos    The number of words determined by the number of {address,size}
    298   1.1  christos    cells attributes of the device. */
    299   1.1  christos 
    300   1.1  christos typedef struct _hw_unit
    301   1.1  christos {
    302   1.1  christos   int nr_cells;
    303   1.1  christos   unsigned_cell cells[4]; /* unused cells are zero */
    304   1.1  christos } hw_unit;
    305   1.1  christos 
    306   1.1  christos 
    307   1.1  christos /* For the given bus, the number of address and size cells used in a
    308   1.1  christos    hw_unit. */
    309   1.1  christos 
    310   1.1  christos #define hw_unit_nr_address_cells(bus) ((bus)->nr_address_cells_of_hw_unit + 0)
    311   1.1  christos 
    312   1.1  christos #define hw_unit_nr_size_cells(bus) ((bus)->nr_size_cells_of_hw_unit + 0)
    313   1.1  christos 
    314   1.1  christos 
    315   1.1  christos /* For the given device, its identifying hw_unit address.
    316   1.1  christos 
    317   1.1  christos    Each device has an identifying hw_unit address.  That address is
    318   1.1  christos    used when identifying one of a number of identical devices on a
    319   1.1  christos    common controller bus. ex fd0&fd1. */
    320   1.1  christos 
    321   1.1  christos const hw_unit *hw_unit_address
    322   1.1  christos (struct hw *me);
    323   1.1  christos 
    324   1.1  christos 
    325   1.1  christos /* Convert between a textual and the internal representation of a
    326   1.1  christos    hw_unit address/size.
    327   1.1  christos 
    328   1.1  christos    NOTE: A device asks its parent to translate between a hw_unit and
    329   1.1  christos    textual representation.  This is because the textual address of a
    330   1.1  christos    device is specified using the parent busses notation. */
    331   1.1  christos 
    332   1.1  christos typedef int (hw_unit_decode_method)
    333   1.1  christos      (struct hw *bus,
    334   1.1  christos       const char *encoded,
    335   1.1  christos       hw_unit *unit);
    336   1.1  christos 
    337   1.1  christos #define hw_unit_decode(bus, encoded, unit) \
    338   1.1  christos ((bus)->to_unit_decode (bus, encoded, unit))
    339   1.1  christos 
    340   1.1  christos #define set_hw_unit_decode(hw, method) \
    341   1.1  christos ((hw)->to_unit_decode = (method))
    342   1.1  christos 
    343   1.1  christos typedef int (hw_unit_encode_method)
    344   1.1  christos      (struct hw *bus,
    345   1.1  christos       const hw_unit *unit,
    346   1.1  christos       char *encoded,
    347   1.1  christos       int sizeof_buf);
    348   1.1  christos 
    349   1.1  christos #define hw_unit_encode(bus, unit, encoded, sizeof_encoded) \
    350   1.1  christos ((bus)->to_unit_encode (bus, unit, encoded, sizeof_encoded))
    351   1.1  christos 
    352   1.1  christos #define set_hw_unit_encode(hw, method) \
    353   1.1  christos ((hw)->to_unit_encode = (method))
    354   1.1  christos 
    355   1.1  christos 
    356   1.1  christos /* As the bus that the device is attached too, to translate a devices
    357   1.1  christos    hw_unit address/size into a form suitable for an attach address
    358   1.1  christos    call.
    359   1.1  christos 
    360   1.1  christos    Return a zero result if the address should be ignored when looking
    361   1.1  christos    for attach addresses. */
    362   1.1  christos 
    363   1.1  christos typedef int (hw_unit_address_to_attach_address_method)
    364   1.1  christos      (struct hw *bus,
    365   1.1  christos       const hw_unit *unit_addr,
    366   1.1  christos       int *attach_space,
    367   1.1  christos       unsigned_word *attach_addr,
    368   1.1  christos       struct hw *client);
    369   1.1  christos 
    370   1.1  christos #define hw_unit_address_to_attach_address(bus, unit_addr, attach_space, attach_addr, client) \
    371   1.1  christos ((bus)->to_unit_address_to_attach_address (bus, unit_addr, attach_space, attach_addr, client))
    372   1.1  christos 
    373   1.1  christos #define set_hw_unit_address_to_attach_address(hw, method) \
    374   1.1  christos ((hw)->to_unit_address_to_attach_address = (method))
    375   1.1  christos 
    376   1.1  christos typedef int (hw_unit_size_to_attach_size_method)
    377   1.1  christos      (struct hw *bus,
    378   1.1  christos       const hw_unit *unit_size,
    379   1.1  christos       unsigned *attach_size,
    380   1.1  christos       struct hw *client);
    381   1.1  christos 
    382   1.1  christos #define hw_unit_size_to_attach_size(bus, unit_size, attach_size, client) \
    383   1.1  christos ((bus)->to_unit_size_to_attach_size (bus, unit_size, attach_size, client))
    384   1.1  christos 
    385   1.1  christos #define set_hw_unit_size_to_attach_size(hw, method) \
    386   1.1  christos ((hw)->to_unit_size_to_attach_size = (method))
    387   1.1  christos 
    388   1.1  christos 
    389   1.1  christos extern char *hw_strdup (struct hw *me, const char *str);
    391   1.1  christos 
    392   1.1  christos 
    393   1.1  christos /* Utilities:
    395   1.1  christos 
    396   1.1  christos    */
    397   1.1  christos 
    398   1.1  christos /* IOCTL::
    399   1.1  christos 
    400   1.1  christos    Often devices require `out of band' operations to be performed.
    401   1.1  christos    For instance a pal device may need to notify a PCI bridge device
    402   1.1  christos    that an interrupt ack cycle needs to be performed on the PCI bus.
    403   1.1  christos    Within PSIM such operations are performed by using the generic
    404   1.1  christos    ioctl call <<hw_ioctl()>>.
    405   1.1  christos 
    406   1.1  christos    */
    407   1.1  christos 
    408   1.1  christos typedef enum
    409   1.1  christos {
    410   1.1  christos   hw_ioctl_break, /* unsigned_word requested_break */
    411   1.1  christos   hw_ioctl_set_trace, /* void */
    412   1.1  christos   hw_ioctl_create_stack, /* unsigned_word *sp, char **argv, char **envp */
    413   1.1  christos   hw_ioctl_change_media, /* const char *new_image (possibly NULL) */
    414   1.1  christos   nr_hw_ioctl_requests,
    415   1.1  christos } hw_ioctl_request;
    416   1.1  christos 
    417   1.1  christos typedef int (hw_ioctl_method)
    418   1.1  christos      (struct hw *me,
    419   1.1  christos       hw_ioctl_request request,
    420   1.1  christos       va_list ap);
    421   1.1  christos 
    422   1.1  christos int hw_ioctl
    423   1.1  christos (struct hw *me,
    424   1.1  christos  hw_ioctl_request request,
    425   1.1  christos  ...);
    426   1.1  christos 
    427   1.1  christos 
    428   1.1  christos /* Error reporting::
    429   1.1  christos 
    430   1.1  christos    So that errors originating from devices appear in a consistent
    431   1.1  christos    format, the <<hw_abort()>> function can be used.  Formats and
    432   1.1  christos    outputs the error message before aborting the simulation
    433   1.1  christos 
    434   1.1  christos    Devices should use this function to abort the simulation except
    435   1.1  christos    when the abort reason leaves the simulation in a hazardous
    436   1.1  christos    condition (for instance a failed malloc).
    437   1.1  christos 
    438  1.10  christos    */
    439   1.1  christos 
    440  1.10  christos void hw_abort
    441  1.10  christos (struct hw *me,
    442   1.1  christos  const char *fmt,
    443   1.1  christos  ...) ATTRIBUTE_PRINTF (2, 3) ATTRIBUTE_NORETURN;
    444   1.1  christos 
    445   1.1  christos extern void hw_vabort (struct hw *me, const char *fmt, va_list ap)
    446  1.10  christos   ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (2, 0);
    447   1.1  christos 
    448   1.1  christos void hw_halt
    449   1.1  christos (struct hw *me,
    450   1.1  christos  int reason,
    451   1.1  christos  int status) ATTRIBUTE_NORETURN;
    452   1.1  christos 
    453   1.1  christos 
    454  1.10  christos #define hw_trace_p(hw) ((hw)->trace_of_hw_p + 0)
    455   1.1  christos 
    456   1.1  christos void hw_trace
    457   1.1  christos (struct hw *me,
    458   1.1  christos  const char *fmt,
    459   1.1  christos  ...) ATTRIBUTE_PRINTF (2, 3);
    460   1.1  christos 
    461   1.1  christos #define HW_TRACE(ARGS) \
    462   1.1  christos do { \
    463   1.1  christos   if (hw_trace_p (me)) \
    464   1.1  christos     { \
    465   1.1  christos       hw_trace ARGS; \
    466   1.1  christos     } \
    467   1.1  christos } while (0)
    468   1.1  christos 
    469   1.1  christos 
    470   1.1  christos /* Some of the related functions require specific types */
    471   1.1  christos 
    472   1.1  christos struct hw_property_data;
    473   1.1  christos struct hw_port_data;
    474   1.1  christos struct hw_base_data;
    475   1.1  christos struct hw_alloc_data;
    476   1.1  christos struct hw_event_data;
    477   1.1  christos struct hw_handle_data;
    478   1.1  christos struct hw_instance_data;
    479   1.1  christos 
    480   1.1  christos /* Finally the hardware device - keep your grubby little mits off of
    481   1.1  christos    these internals! :-) */
    482   1.1  christos 
    483   1.1  christos struct hw
    484   1.1  christos {
    485   1.1  christos 
    486   1.1  christos   /* our relatives */
    487   1.1  christos   struct hw *parent_of_hw;
    488   1.1  christos   struct hw *sibling_of_hw;
    489   1.1  christos   struct hw *child_of_hw;
    490   1.1  christos 
    491   1.1  christos   /* our identity */
    492   1.1  christos   const char *name_of_hw;
    493   1.1  christos   const char *family_of_hw;
    494   1.1  christos   const char *args_of_hw;
    495   1.1  christos   const char *path_of_hw;
    496   1.1  christos 
    497   1.1  christos   /* our data */
    498   1.1  christos   void *data_of_hw;
    499   1.1  christos 
    500   1.1  christos   /* hot links */
    501   1.1  christos   struct hw *root_of_hw;
    502   1.1  christos   struct sim_state *system_of_hw;
    503   1.1  christos 
    504   1.1  christos   /* identifying data */
    505   1.1  christos   hw_unit unit_address_of_hw;
    506   1.1  christos   int nr_address_cells_of_hw_unit;
    507   1.1  christos   int nr_size_cells_of_hw_unit;
    508   1.1  christos 
    509   1.1  christos   /* Soft reset */
    510   1.1  christos   hw_reset_method *to_reset;
    511   1.1  christos 
    512   1.1  christos   /* Basic callbacks */
    513   1.1  christos   hw_io_read_buffer_method *to_io_read_buffer;
    514   1.1  christos   hw_io_write_buffer_method *to_io_write_buffer;
    515   1.1  christos   hw_dma_read_buffer_method *to_dma_read_buffer;
    516   1.1  christos   hw_dma_write_buffer_method *to_dma_write_buffer;
    517   1.1  christos   hw_attach_address_method *to_attach_address;
    518   1.1  christos   hw_detach_address_method *to_detach_address;
    519   1.1  christos 
    520   1.1  christos   /* More complicated callbacks */
    521   1.1  christos   hw_ioctl_method *to_ioctl;
    522   1.1  christos   int trace_of_hw_p;
    523   1.1  christos 
    524   1.1  christos   /* address callbacks */
    525   1.1  christos   hw_unit_decode_method *to_unit_decode;
    526   1.1  christos   hw_unit_encode_method *to_unit_encode;
    527   1.1  christos   hw_unit_address_to_attach_address_method *to_unit_address_to_attach_address;
    528   1.1  christos   hw_unit_size_to_attach_size_method *to_unit_size_to_attach_size;
    529   1.1  christos 
    530   1.1  christos   /* related data */
    531   1.1  christos   struct hw_property_data *properties_of_hw;
    532   1.1  christos   struct hw_port_data *ports_of_hw;
    533   1.1  christos   struct hw_base_data *base_of_hw;
    534   1.1  christos   struct hw_alloc_data *alloc_of_hw;
    535   1.1  christos   struct hw_event_data *events_of_hw;
    536   1.1  christos   struct hw_handle_data *handles_of_hw;
    537   1.1  christos   struct hw_instance_data *instances_of_hw;
    538                 
    539                 };
    540                 
    541                 
    542                 #endif
    543