io_memory mdio45_bus
API Reference Manual  /  4 Model-to-Model Interfaces  / 

map_demap

Description
Interface used to dynamically add and remove mappings in a memory space. The first argument to all functions, space is the memory space to map an object in.

The map_simple function adds a device/port pair to the memory map. The added device (port) must implement either the ram, rom, io_memory, or port_space interface, or it can be another memory space (which implements the translate and memory_space interfaces).

The map_bridge function adds a device/port pair to the memory map to act as a bridge that translates memory accesses before passing them on to another object. The added device (port) must implement either the translate interface or the bridge interface, and the target and target_port parameter specifies the object behind the bridge. The target is typically another memory space.

The unmap removes an object from the memory map. The dev and port parameters are the same as those given to the map_simple and map_bridge functions.

The unmap_address removes all mappings that map object and start at the base address.

The add_map, remove_map, add_default and remove_default functions are deprecated and should not be used. Both base and length of the map_info_t structure should be 0 to map a default_target.

All functions in the map_demap return 1 on success and 0 on failure.

More information about the different kinds of memory space mappings is available in Simics Model Builder User's Guide.

SIM_INTERFACE(map_demap) {
        /* old-style */
        int (*add_map)(conf_object_t *NOTNULL space,
                       conf_object_t *NOTNULL dev,
                       conf_object_t *target,
                       map_info_t map_info);
        int (*remove_map)(conf_object_t *NOTNULL space,
                          conf_object_t *NOTNULL dev,
                          int function);
        int (*add_default)(conf_object_t *NOTNULL space,
                           conf_object_t *NOTNULL dev,
                           conf_object_t *target,
                           map_info_t map_info);
        void (*remove_default)(conf_object_t *NOTNULL space);

        /* new-style */
        int (*map_simple)(conf_object_t *NOTNULL space,
                          conf_object_t *NOTNULL dev,
                          const char *dev_port,
                          map_info_t map_info);
        int (*map_bridge)(conf_object_t *NOTNULL space,
                          conf_object_t *NOTNULL dev,
                          const char *dev_port,
                          conf_object_t *target,
                          const char *target_port,
                          map_info_t map_info);
        int (*unmap)(conf_object_t *NOTNULL space,
                     conf_object_t *NOTNULL dev,
                     const char *dev_port);
        int (*unmap_address)(conf_object_t *NOTNULL space,
                             conf_object_t *NOTNULL dev,
                             physical_address_t base,
                             const char *dev_port);
};

#define MAP_DEMAP_INTERFACE "map_demap"

Execution Context
Cell Context for all methods.

io_memory mdio45_bus