On 12/6/23 21:28, Bernhard Beschow wrote:
>
>
> Am 9. Juni 2023 18:51:19 UTC schrieb Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>:
>> The aim here is to eliminate any device-specific registers from the main BMDMA
>> bar memory region so it can potentially be moved into the shared PCI IDE device.
>>
>> For each BMDMA bus create a new cmd646-bmdma-specific memory region representing
>> the device-specific BMDMA registers and then map them using aliases onto the
>> existing BMDMAState memory region.
>>
>> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
>> ---
>> hw/ide/cmd646.c | 111 +++++++++++++++++++++++++++++++---------
>> include/hw/ide/cmd646.h | 4 ++
>> 2 files changed, 90 insertions(+), 25 deletions(-)
>> struct CMD646IDEState {
>> PCIIDEState parent_obj;
>> +
>> + MemoryRegion bmdma_mem[2];
>> + MemoryRegion bmdma_mem_alias[2][2];
>
> The added complexity of a two-dimensional alias array seems like a tough call for me. I'm not totally against it but I'm reluctant.
Alternative:
struct {
MemoryRegion mem;
MemoryRegion mem_alias[2];
If `mem_alias` became an anonymous struct as well we could avoid fiddling with two indices in a matrix, lowering the complexity.
Best regards,
Bernhard
} bmdma[2];
>> };
>>
>> #endif
>