Revision a8170e5e memory.h
b/memory.h | ||
---|---|---|
20 | 20 |
#include <stdbool.h> |
21 | 21 |
#include "qemu-common.h" |
22 | 22 |
#include "cpu-common.h" |
23 |
#include "targphys.h"
|
|
23 |
#include "hwaddr.h"
|
|
24 | 24 |
#include "qemu-queue.h" |
25 | 25 |
#include "iorange.h" |
26 | 26 |
#include "ioport.h" |
... | ... | |
48 | 48 |
struct MemoryRegionIORange { |
49 | 49 |
IORange iorange; |
50 | 50 |
MemoryRegion *mr; |
51 |
target_phys_addr_t offset;
|
|
51 |
hwaddr offset;
|
|
52 | 52 |
}; |
53 | 53 |
|
54 | 54 |
/* |
... | ... | |
58 | 58 |
/* Read from the memory region. @addr is relative to @mr; @size is |
59 | 59 |
* in bytes. */ |
60 | 60 |
uint64_t (*read)(void *opaque, |
61 |
target_phys_addr_t addr,
|
|
61 |
hwaddr addr,
|
|
62 | 62 |
unsigned size); |
63 | 63 |
/* Write to the memory region. @addr is relative to @mr; @size is |
64 | 64 |
* in bytes. */ |
65 | 65 |
void (*write)(void *opaque, |
66 |
target_phys_addr_t addr,
|
|
66 |
hwaddr addr,
|
|
67 | 67 |
uint64_t data, |
68 | 68 |
unsigned size); |
69 | 69 |
|
... | ... | |
84 | 84 |
* by the device (and results in machine dependent behaviour such |
85 | 85 |
* as a machine check exception). |
86 | 86 |
*/ |
87 |
bool (*accepts)(void *opaque, target_phys_addr_t addr,
|
|
87 |
bool (*accepts)(void *opaque, hwaddr addr,
|
|
88 | 88 |
unsigned size, bool is_write); |
89 | 89 |
} valid; |
90 | 90 |
/* Internal implementation constraints: */ |
... | ... | |
122 | 122 |
void *opaque; |
123 | 123 |
MemoryRegion *parent; |
124 | 124 |
Int128 size; |
125 |
target_phys_addr_t addr;
|
|
125 |
hwaddr addr;
|
|
126 | 126 |
void (*destructor)(MemoryRegion *mr); |
127 | 127 |
ram_addr_t ram_addr; |
128 | 128 |
bool subpage; |
... | ... | |
135 | 135 |
bool warning_printed; /* For reservations */ |
136 | 136 |
bool flush_coalesced_mmio; |
137 | 137 |
MemoryRegion *alias; |
138 |
target_phys_addr_t alias_offset;
|
|
138 |
hwaddr alias_offset;
|
|
139 | 139 |
unsigned priority; |
140 | 140 |
bool may_overlap; |
141 | 141 |
QTAILQ_HEAD(subregions, MemoryRegion) subregions; |
... | ... | |
189 | 189 |
struct MemoryRegionSection { |
190 | 190 |
MemoryRegion *mr; |
191 | 191 |
AddressSpace *address_space; |
192 |
target_phys_addr_t offset_within_region;
|
|
192 |
hwaddr offset_within_region;
|
|
193 | 193 |
uint64_t size; |
194 |
target_phys_addr_t offset_within_address_space;
|
|
194 |
hwaddr offset_within_address_space;
|
|
195 | 195 |
bool readonly; |
196 | 196 |
}; |
197 | 197 |
|
... | ... | |
219 | 219 |
void (*eventfd_del)(MemoryListener *listener, MemoryRegionSection *section, |
220 | 220 |
bool match_data, uint64_t data, EventNotifier *e); |
221 | 221 |
void (*coalesced_mmio_add)(MemoryListener *listener, MemoryRegionSection *section, |
222 |
target_phys_addr_t addr, target_phys_addr_t len);
|
|
222 |
hwaddr addr, hwaddr len);
|
|
223 | 223 |
void (*coalesced_mmio_del)(MemoryListener *listener, MemoryRegionSection *section, |
224 |
target_phys_addr_t addr, target_phys_addr_t len);
|
|
224 |
hwaddr addr, hwaddr len);
|
|
225 | 225 |
/* Lower = earlier (during add), later (during del) */ |
226 | 226 |
unsigned priority; |
227 | 227 |
AddressSpace *address_space_filter; |
... | ... | |
301 | 301 |
void memory_region_init_alias(MemoryRegion *mr, |
302 | 302 |
const char *name, |
303 | 303 |
MemoryRegion *orig, |
304 |
target_phys_addr_t offset,
|
|
304 |
hwaddr offset,
|
|
305 | 305 |
uint64_t size); |
306 | 306 |
|
307 | 307 |
/** |
... | ... | |
437 | 437 |
* @client: the user of the logging information; %DIRTY_MEMORY_MIGRATION or |
438 | 438 |
* %DIRTY_MEMORY_VGA. |
439 | 439 |
*/ |
440 |
bool memory_region_get_dirty(MemoryRegion *mr, target_phys_addr_t addr,
|
|
441 |
target_phys_addr_t size, unsigned client);
|
|
440 |
bool memory_region_get_dirty(MemoryRegion *mr, hwaddr addr,
|
|
441 |
hwaddr size, unsigned client);
|
|
442 | 442 |
|
443 | 443 |
/** |
444 | 444 |
* memory_region_set_dirty: Mark a range of bytes as dirty in a memory region. |
... | ... | |
450 | 450 |
* @addr: the address (relative to the start of the region) being dirtied. |
451 | 451 |
* @size: size of the range being dirtied. |
452 | 452 |
*/ |
453 |
void memory_region_set_dirty(MemoryRegion *mr, target_phys_addr_t addr,
|
|
454 |
target_phys_addr_t size);
|
|
453 |
void memory_region_set_dirty(MemoryRegion *mr, hwaddr addr,
|
|
454 |
hwaddr size);
|
|
455 | 455 |
|
456 | 456 |
/** |
457 | 457 |
* memory_region_sync_dirty_bitmap: Synchronize a region's dirty bitmap with |
... | ... | |
476 | 476 |
* @client: the user of the logging information; %DIRTY_MEMORY_MIGRATION or |
477 | 477 |
* %DIRTY_MEMORY_VGA. |
478 | 478 |
*/ |
479 |
void memory_region_reset_dirty(MemoryRegion *mr, target_phys_addr_t addr,
|
|
480 |
target_phys_addr_t size, unsigned client);
|
|
479 |
void memory_region_reset_dirty(MemoryRegion *mr, hwaddr addr,
|
|
480 |
hwaddr size, unsigned client);
|
|
481 | 481 |
|
482 | 482 |
/** |
483 | 483 |
* memory_region_set_readonly: Turn a memory region read-only (or read-write) |
... | ... | |
527 | 527 |
* @size: the size of the subrange to be coalesced. |
528 | 528 |
*/ |
529 | 529 |
void memory_region_add_coalescing(MemoryRegion *mr, |
530 |
target_phys_addr_t offset,
|
|
530 |
hwaddr offset,
|
|
531 | 531 |
uint64_t size); |
532 | 532 |
|
533 | 533 |
/** |
... | ... | |
583 | 583 |
* @fd: the eventfd to be triggered when @addr, @size, and @data all match. |
584 | 584 |
**/ |
585 | 585 |
void memory_region_add_eventfd(MemoryRegion *mr, |
586 |
target_phys_addr_t addr,
|
|
586 |
hwaddr addr,
|
|
587 | 587 |
unsigned size, |
588 | 588 |
bool match_data, |
589 | 589 |
uint64_t data, |
... | ... | |
603 | 603 |
* @fd: the eventfd to be triggered when @addr, @size, and @data all match. |
604 | 604 |
*/ |
605 | 605 |
void memory_region_del_eventfd(MemoryRegion *mr, |
606 |
target_phys_addr_t addr,
|
|
606 |
hwaddr addr,
|
|
607 | 607 |
unsigned size, |
608 | 608 |
bool match_data, |
609 | 609 |
uint64_t data, |
... | ... | |
624 | 624 |
* @subregion: the subregion to be added. |
625 | 625 |
*/ |
626 | 626 |
void memory_region_add_subregion(MemoryRegion *mr, |
627 |
target_phys_addr_t offset,
|
|
627 |
hwaddr offset,
|
|
628 | 628 |
MemoryRegion *subregion); |
629 | 629 |
/** |
630 | 630 |
* memory_region_add_subregion_overlap: Add a subregion to a container |
... | ... | |
644 | 644 |
* @priority: used for resolving overlaps; highest priority wins. |
645 | 645 |
*/ |
646 | 646 |
void memory_region_add_subregion_overlap(MemoryRegion *mr, |
647 |
target_phys_addr_t offset,
|
|
647 |
hwaddr offset,
|
|
648 | 648 |
MemoryRegion *subregion, |
649 | 649 |
unsigned priority); |
650 | 650 |
|
... | ... | |
692 | 692 |
* @mr: the region to be updated |
693 | 693 |
* @addr: new address, relative to parent region |
694 | 694 |
*/ |
695 |
void memory_region_set_address(MemoryRegion *mr, target_phys_addr_t addr);
|
|
695 |
void memory_region_set_address(MemoryRegion *mr, hwaddr addr);
|
|
696 | 696 |
|
697 | 697 |
/* |
698 | 698 |
* memory_region_set_alias_offset: dynamically update a memory alias's offset |
... | ... | |
704 | 704 |
* @offset: the new offset into the target memory region |
705 | 705 |
*/ |
706 | 706 |
void memory_region_set_alias_offset(MemoryRegion *mr, |
707 |
target_phys_addr_t offset);
|
|
707 |
hwaddr offset);
|
|
708 | 708 |
|
709 | 709 |
/** |
710 | 710 |
* memory_region_find: locate a MemoryRegion in an address space |
... | ... | |
725 | 725 |
* @size: size of the area to be searched |
726 | 726 |
*/ |
727 | 727 |
MemoryRegionSection memory_region_find(MemoryRegion *address_space, |
728 |
target_phys_addr_t addr, uint64_t size);
|
|
728 |
hwaddr addr, uint64_t size);
|
|
729 | 729 |
|
730 | 730 |
/** |
731 | 731 |
* memory_region_section_addr: get offset within MemoryRegionSection |
... | ... | |
735 | 735 |
* @section: the memory region section being queried |
736 | 736 |
* @addr: address in address space |
737 | 737 |
*/ |
738 |
static inline target_phys_addr_t
|
|
738 |
static inline hwaddr
|
|
739 | 739 |
memory_region_section_addr(MemoryRegionSection *section, |
740 |
target_phys_addr_t addr)
|
|
740 |
hwaddr addr)
|
|
741 | 741 |
{ |
742 | 742 |
addr -= section->offset_within_address_space; |
743 | 743 |
addr += section->offset_within_region; |
... | ... | |
824 | 824 |
* @buf: buffer with the data transferred |
825 | 825 |
* @is_write: indicates the transfer direction |
826 | 826 |
*/ |
827 |
void address_space_rw(AddressSpace *as, target_phys_addr_t addr, uint8_t *buf,
|
|
827 |
void address_space_rw(AddressSpace *as, hwaddr addr, uint8_t *buf,
|
|
828 | 828 |
int len, bool is_write); |
829 | 829 |
|
830 | 830 |
/** |
... | ... | |
834 | 834 |
* @addr: address within that address space |
835 | 835 |
* @buf: buffer with the data transferred |
836 | 836 |
*/ |
837 |
void address_space_write(AddressSpace *as, target_phys_addr_t addr,
|
|
837 |
void address_space_write(AddressSpace *as, hwaddr addr,
|
|
838 | 838 |
const uint8_t *buf, int len); |
839 | 839 |
|
840 | 840 |
/** |
... | ... | |
844 | 844 |
* @addr: address within that address space |
845 | 845 |
* @buf: buffer with the data transferred |
846 | 846 |
*/ |
847 |
void address_space_read(AddressSpace *as, target_phys_addr_t addr, uint8_t *buf, int len);
|
|
847 |
void address_space_read(AddressSpace *as, hwaddr addr, uint8_t *buf, int len);
|
|
848 | 848 |
|
849 | 849 |
/* address_space_map: map a physical memory region into a host virtual address |
850 | 850 |
* |
... | ... | |
859 | 859 |
* @plen: pointer to length of buffer; updated on return |
860 | 860 |
* @is_write: indicates the transfer direction |
861 | 861 |
*/ |
862 |
void *address_space_map(AddressSpace *as, target_phys_addr_t addr,
|
|
863 |
target_phys_addr_t *plen, bool is_write);
|
|
862 |
void *address_space_map(AddressSpace *as, hwaddr addr,
|
|
863 |
hwaddr *plen, bool is_write);
|
|
864 | 864 |
|
865 | 865 |
/* address_space_unmap: Unmaps a memory region previously mapped by address_space_map() |
866 | 866 |
* |
... | ... | |
873 | 873 |
* @access_len: amount of data actually transferred |
874 | 874 |
* @is_write: indicates the transfer direction |
875 | 875 |
*/ |
876 |
void address_space_unmap(AddressSpace *as, void *buffer, target_phys_addr_t len,
|
|
877 |
int is_write, target_phys_addr_t access_len);
|
|
876 |
void address_space_unmap(AddressSpace *as, void *buffer, hwaddr len,
|
|
877 |
int is_write, hwaddr access_len);
|
|
878 | 878 |
|
879 | 879 |
|
880 | 880 |
#endif |
Also available in: Unified diff