1 /* The common simulator framework for GDB, the GNU Debugger.
3 Copyright 2002-2023 Free Software Foundation, Inc.
5 Contributed by Andrew Cagney and Red Hat.
7 This file is part of GDB.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
22 /* This must come before any other includes. */
30 core - root of the device tree
34 The core device, positioned at the root of the device tree appears
35 to its child devices as a normal device just like every other
38 Internally it is implemented using a core object. Requests to
39 attach (or detach) address spaces are passed to that core object.
40 Requests to transfer (DMA) data are reflected back down the device
41 tree using the core_map data transfer methods.
51 dv_core_attach_address_callback (struct hw
*me
,
55 address_word nr_bytes
,
58 HW_TRACE ((me
, "attach - level=%d, space=%d, addr=0x%lx, nr_bytes=%ld, client=%s",
59 level
, space
, (unsigned long) addr
, (unsigned long) nr_bytes
, hw_path (client
)));
60 /* NOTE: At preset the space is assumed to be zero. Perhaphs the
61 space should be mapped onto something for instance: space0 -
62 unified memory; space1 - IO memory; ... */
63 sim_core_attach (hw_system (me
),
66 access_read_write_exec
,
76 dv_core_detach_address_callback (struct hw
*me
,
80 address_word nr_bytes
,
83 HW_TRACE ((me
, "detach - level=%d, space=%d, addr=0x%lx, nr_bytes=%ld, client=%s",
84 level
, space
, (unsigned long) addr
, (unsigned long) nr_bytes
, hw_path (client
)));
85 /* NOTE: At preset the space is assumed to be zero. Perhaphs the
86 space should be mapped onto something for instance: space0 -
87 unified memory; space1 - IO memory; ... */
88 sim_core_detach (hw_system (me
), NULL
, /*cpu*/ level
, space
, addr
);
93 dv_core_dma_read_buffer_callback (struct hw
*me
,
99 return sim_core_read_buffer (hw_system (me
),
109 dv_core_dma_write_buffer_callback (struct hw
*me
,
114 int violate_read_only_section
)
116 return sim_core_write_buffer (hw_system (me
),
126 dv_core_finish (struct hw
*me
)
128 set_hw_attach_address (me
, dv_core_attach_address_callback
);
129 set_hw_detach_address (me
, dv_core_detach_address_callback
);
130 set_hw_dma_write_buffer (me
, dv_core_dma_write_buffer_callback
);
131 set_hw_dma_read_buffer (me
, dv_core_dma_read_buffer_callback
);
134 const struct hw_descriptor dv_core_descriptor
[] = {
135 { "core", dv_core_finish
, },