More sonarlint work
This commit is contained in:
@@ -98,9 +98,9 @@ flash_read(uint32_t addr, void *priv)
|
||||
}
|
||||
|
||||
static uint16_t
|
||||
flash_readw(uint32_t addr, void *p)
|
||||
flash_readw(uint32_t addr, void *priv)
|
||||
{
|
||||
flash_t *dev = (flash_t *) p;
|
||||
flash_t *dev = (flash_t *) priv;
|
||||
uint16_t *q;
|
||||
|
||||
addr &= biosmask;
|
||||
@@ -111,9 +111,9 @@ flash_readw(uint32_t addr, void *p)
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
flash_readl(uint32_t addr, void *p)
|
||||
flash_readl(uint32_t addr, void *priv)
|
||||
{
|
||||
flash_t *dev = (flash_t *) p;
|
||||
flash_t *dev = (flash_t *) priv;
|
||||
uint32_t *q;
|
||||
|
||||
addr &= biosmask;
|
||||
@@ -124,9 +124,9 @@ flash_readl(uint32_t addr, void *p)
|
||||
}
|
||||
|
||||
static void
|
||||
flash_write(uint32_t addr, uint8_t val, void *p)
|
||||
flash_write(uint32_t addr, uint8_t val, void *priv)
|
||||
{
|
||||
flash_t *dev = (flash_t *) p;
|
||||
flash_t *dev = (flash_t *) priv;
|
||||
|
||||
addr &= biosmask;
|
||||
|
||||
@@ -189,7 +189,7 @@ catalyst_flash_reset(void *priv)
|
||||
static void *
|
||||
catalyst_flash_init(UNUSED(const device_t *info))
|
||||
{
|
||||
FILE *f;
|
||||
FILE *fp;
|
||||
flash_t *dev;
|
||||
|
||||
dev = malloc(sizeof(flash_t));
|
||||
@@ -207,24 +207,24 @@ catalyst_flash_init(UNUSED(const device_t *info))
|
||||
|
||||
dev->command = CMD_RESET;
|
||||
|
||||
f = nvr_fopen(flash_path, "rb");
|
||||
if (f) {
|
||||
(void) !fread(dev->array, 0x20000, 1, f);
|
||||
fclose(f);
|
||||
fp = nvr_fopen(flash_path, "rb");
|
||||
if (fp) {
|
||||
(void) !fread(dev->array, 0x20000, 1, fp);
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
return dev;
|
||||
}
|
||||
|
||||
static void
|
||||
catalyst_flash_close(void *p)
|
||||
catalyst_flash_close(void *priv)
|
||||
{
|
||||
FILE *f;
|
||||
flash_t *dev = (flash_t *) p;
|
||||
FILE *fp;
|
||||
flash_t *dev = (flash_t *) priv;
|
||||
|
||||
f = nvr_fopen(flash_path, "wb");
|
||||
fwrite(dev->array, 0x20000, 1, f);
|
||||
fclose(f);
|
||||
fp = nvr_fopen(flash_path, "wb");
|
||||
fwrite(dev->array, 0x20000, 1, fp);
|
||||
fclose(fp);
|
||||
|
||||
free(dev->array);
|
||||
dev->array = NULL;
|
||||
|
||||
@@ -221,10 +221,9 @@ flash_write(uint32_t addr, uint8_t val, void *priv)
|
||||
}
|
||||
|
||||
static void
|
||||
flash_writew(uint32_t addr, uint16_t val, void *p)
|
||||
flash_writew(uint32_t addr, uint16_t val, void *priv)
|
||||
{
|
||||
flash_t *dev = (flash_t *) p;
|
||||
int i;
|
||||
flash_t *dev = (flash_t *) priv;
|
||||
uint32_t bb_mask = biosmask & 0xffffe000;
|
||||
if (biosmask == 0x7ffff)
|
||||
bb_mask &= 0xffff8000;
|
||||
@@ -239,7 +238,7 @@ flash_writew(uint32_t addr, uint16_t val, void *p)
|
||||
switch (dev->command) {
|
||||
case CMD_ERASE_SETUP:
|
||||
if (val == CMD_ERASE_CONFIRM) {
|
||||
for (i = 0; i < 6; i++) {
|
||||
for (uint8_t i = 0; i < 6; i++) {
|
||||
if ((i == dev->program_addr) && (addr >= dev->block_start[i]) && (addr <= dev->block_end[i]))
|
||||
memset(&(dev->array[dev->block_start[i]]), 0xff, dev->block_len[i]);
|
||||
}
|
||||
@@ -264,7 +263,7 @@ flash_writew(uint32_t addr, uint16_t val, void *p)
|
||||
dev->status = 0;
|
||||
break;
|
||||
case CMD_ERASE_SETUP:
|
||||
for (i = 0; i < 7; i++) {
|
||||
for (uint8_t i = 0; i < 7; i++) {
|
||||
if ((addr >= dev->block_start[i]) && (addr <= dev->block_end[i]))
|
||||
dev->program_addr = i;
|
||||
}
|
||||
@@ -292,7 +291,7 @@ flash_writel(UNUSED(uint32_t addr), UNUSED(uint32_t val), UNUSED(void *priv))
|
||||
static void
|
||||
intel_flash_add_mappings(flash_t *dev)
|
||||
{
|
||||
int max = 2;
|
||||
uint8_t max = 2;
|
||||
uint32_t base;
|
||||
uint32_t fbase;
|
||||
uint32_t sub = 0x20000;
|
||||
@@ -305,7 +304,7 @@ intel_flash_add_mappings(flash_t *dev)
|
||||
max = 4;
|
||||
}
|
||||
|
||||
for (int i = 0; i < max; i++) {
|
||||
for (uint8_t i = 0; i < max; i++) {
|
||||
if (biosmask == 0x7ffff)
|
||||
base = 0x80000 + (i << 16);
|
||||
else if (biosmask == 0x3ffff)
|
||||
@@ -348,7 +347,7 @@ intel_flash_reset(void *priv)
|
||||
static void *
|
||||
intel_flash_init(const device_t *info)
|
||||
{
|
||||
FILE *f;
|
||||
FILE *fp;
|
||||
flash_t *dev;
|
||||
uint8_t type = info->local & 0xff;
|
||||
|
||||
@@ -513,19 +512,19 @@ intel_flash_init(const device_t *info)
|
||||
dev->command = CMD_READ_ARRAY;
|
||||
dev->status = 0;
|
||||
|
||||
f = nvr_fopen(flash_path, "rb");
|
||||
if (f) {
|
||||
(void) !fread(&(dev->array[dev->block_start[BLOCK_MAIN1]]), dev->block_len[BLOCK_MAIN1], 1, f);
|
||||
fp = nvr_fopen(flash_path, "rb");
|
||||
if (fp) {
|
||||
(void) !fread(&(dev->array[dev->block_start[BLOCK_MAIN1]]), dev->block_len[BLOCK_MAIN1], 1, fp);
|
||||
if (dev->block_len[BLOCK_MAIN2])
|
||||
(void) !fread(&(dev->array[dev->block_start[BLOCK_MAIN2]]), dev->block_len[BLOCK_MAIN2], 1, f);
|
||||
(void) !fread(&(dev->array[dev->block_start[BLOCK_MAIN2]]), dev->block_len[BLOCK_MAIN2], 1, fp);
|
||||
if (dev->block_len[BLOCK_MAIN3])
|
||||
(void) !fread(&(dev->array[dev->block_start[BLOCK_MAIN3]]), dev->block_len[BLOCK_MAIN3], 1, f);
|
||||
(void) !fread(&(dev->array[dev->block_start[BLOCK_MAIN3]]), dev->block_len[BLOCK_MAIN3], 1, fp);
|
||||
if (dev->block_len[BLOCK_MAIN4])
|
||||
(void) !fread(&(dev->array[dev->block_start[BLOCK_MAIN4]]), dev->block_len[BLOCK_MAIN4], 1, f);
|
||||
(void) !fread(&(dev->array[dev->block_start[BLOCK_MAIN4]]), dev->block_len[BLOCK_MAIN4], 1, fp);
|
||||
|
||||
(void) !fread(&(dev->array[dev->block_start[BLOCK_DATA1]]), dev->block_len[BLOCK_DATA1], 1, f);
|
||||
(void) !fread(&(dev->array[dev->block_start[BLOCK_DATA2]]), dev->block_len[BLOCK_DATA2], 1, f);
|
||||
fclose(f);
|
||||
(void) !fread(&(dev->array[dev->block_start[BLOCK_DATA1]]), dev->block_len[BLOCK_DATA1], 1, fp);
|
||||
(void) !fread(&(dev->array[dev->block_start[BLOCK_DATA2]]), dev->block_len[BLOCK_DATA2], 1, fp);
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
return dev;
|
||||
@@ -534,21 +533,21 @@ intel_flash_init(const device_t *info)
|
||||
static void
|
||||
intel_flash_close(void *priv)
|
||||
{
|
||||
FILE *f;
|
||||
FILE *fp;
|
||||
flash_t *dev = (flash_t *) priv;
|
||||
|
||||
f = nvr_fopen(flash_path, "wb");
|
||||
fwrite(&(dev->array[dev->block_start[BLOCK_MAIN1]]), dev->block_len[BLOCK_MAIN1], 1, f);
|
||||
fp = nvr_fopen(flash_path, "wb");
|
||||
fwrite(&(dev->array[dev->block_start[BLOCK_MAIN1]]), dev->block_len[BLOCK_MAIN1], 1, fp);
|
||||
if (dev->block_len[BLOCK_MAIN2])
|
||||
fwrite(&(dev->array[dev->block_start[BLOCK_MAIN2]]), dev->block_len[BLOCK_MAIN2], 1, f);
|
||||
fwrite(&(dev->array[dev->block_start[BLOCK_MAIN2]]), dev->block_len[BLOCK_MAIN2], 1, fp);
|
||||
if (dev->block_len[BLOCK_MAIN3])
|
||||
fwrite(&(dev->array[dev->block_start[BLOCK_MAIN3]]), dev->block_len[BLOCK_MAIN3], 1, f);
|
||||
fwrite(&(dev->array[dev->block_start[BLOCK_MAIN3]]), dev->block_len[BLOCK_MAIN3], 1, fp);
|
||||
if (dev->block_len[BLOCK_MAIN4])
|
||||
fwrite(&(dev->array[dev->block_start[BLOCK_MAIN4]]), dev->block_len[BLOCK_MAIN4], 1, f);
|
||||
fwrite(&(dev->array[dev->block_start[BLOCK_MAIN4]]), dev->block_len[BLOCK_MAIN4], 1, fp);
|
||||
|
||||
fwrite(&(dev->array[dev->block_start[BLOCK_DATA1]]), dev->block_len[BLOCK_DATA1], 1, f);
|
||||
fwrite(&(dev->array[dev->block_start[BLOCK_DATA2]]), dev->block_len[BLOCK_DATA2], 1, f);
|
||||
fclose(f);
|
||||
fwrite(&(dev->array[dev->block_start[BLOCK_DATA1]]), dev->block_len[BLOCK_DATA1], 1, fp);
|
||||
fwrite(&(dev->array[dev->block_start[BLOCK_DATA2]]), dev->block_len[BLOCK_DATA2], 1, fp);
|
||||
fclose(fp);
|
||||
|
||||
free(dev->array);
|
||||
dev->array = NULL;
|
||||
|
||||
182
src/mem/mem.c
182
src/mem/mem.c
@@ -69,7 +69,7 @@ page_t *pages; /* RAM page table */
|
||||
page_t **page_lookup; /* pagetable lookup */
|
||||
uint32_t pages_sz; /* #pages in table */
|
||||
|
||||
uint8_t *ram;
|
||||
uint8_t *ram; /* the virtual RAM */
|
||||
uint8_t *ram2; /* the virtual RAM */
|
||||
uint8_t page_ff[4096];
|
||||
uint32_t rammask;
|
||||
@@ -522,7 +522,7 @@ mmutranslate_noabrt_pae(uint32_t addr, int rw)
|
||||
|
||||
addr4 = (temp & ~0xfffULL) + ((addr >> 9) & 0xff8);
|
||||
temp = rammap64(addr4) & 0x000000ffffffffffULL;
|
||||
;
|
||||
|
||||
temp3 = temp & temp4;
|
||||
|
||||
if (!(temp & 1) || ((CPL == 3) && !(temp3 & 4) && !cpl_override) || (rw && !(temp3 & 2) && ((CPL == 3) || (cr0 & WP_FLAG))))
|
||||
@@ -705,7 +705,7 @@ read_mem_b(uint32_t addr)
|
||||
|
||||
map = read_mapping[addr >> MEM_GRANULARITY_BITS];
|
||||
if (map && map->read_b)
|
||||
ret = map->read_b(addr, map->p);
|
||||
ret = map->read_b(addr, map->priv);
|
||||
|
||||
resub_cycles(old_cycles);
|
||||
|
||||
@@ -728,9 +728,9 @@ read_mem_w(uint32_t addr)
|
||||
map = read_mapping[addr >> MEM_GRANULARITY_BITS];
|
||||
|
||||
if (map && map->read_w)
|
||||
ret = map->read_w(addr, map->p);
|
||||
ret = map->read_w(addr, map->priv);
|
||||
else if (map && map->read_b)
|
||||
ret = map->read_b(addr, map->p) | (map->read_b(addr + 1, map->p) << 8);
|
||||
ret = map->read_b(addr, map->priv) | (map->read_b(addr + 1, map->priv) << 8);
|
||||
}
|
||||
|
||||
resub_cycles(old_cycles);
|
||||
@@ -749,7 +749,7 @@ write_mem_b(uint32_t addr, uint8_t val)
|
||||
|
||||
map = write_mapping[addr >> MEM_GRANULARITY_BITS];
|
||||
if (map && map->write_b)
|
||||
map->write_b(addr, val, map->p);
|
||||
map->write_b(addr, val, map->priv);
|
||||
|
||||
resub_cycles(old_cycles);
|
||||
}
|
||||
@@ -770,10 +770,10 @@ write_mem_w(uint32_t addr, uint16_t val)
|
||||
map = write_mapping[addr >> MEM_GRANULARITY_BITS];
|
||||
if (map) {
|
||||
if (map->write_w)
|
||||
map->write_w(addr, val, map->p);
|
||||
map->write_w(addr, val, map->priv);
|
||||
else if (map->write_b) {
|
||||
map->write_b(addr, val, map->p);
|
||||
map->write_b(addr + 1, val >> 8, map->p);
|
||||
map->write_b(addr, val, map->priv);
|
||||
map->write_b(addr + 1, val >> 8, map->priv);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -805,7 +805,7 @@ readmembl(uint32_t addr)
|
||||
|
||||
map = read_mapping[addr >> MEM_GRANULARITY_BITS];
|
||||
if (map && map->read_b)
|
||||
return map->read_b(addr, map->p);
|
||||
return map->read_b(addr, map->priv);
|
||||
|
||||
return 0xff;
|
||||
}
|
||||
@@ -839,7 +839,7 @@ writemembl(uint32_t addr, uint8_t val)
|
||||
|
||||
map = write_mapping[addr >> MEM_GRANULARITY_BITS];
|
||||
if (map && map->write_b)
|
||||
map->write_b(addr, val, map->p);
|
||||
map->write_b(addr, val, map->priv);
|
||||
}
|
||||
|
||||
/* Read a byte from memory without MMU translation - result of previous MMU translation passed as value. */
|
||||
@@ -862,7 +862,7 @@ readmembl_no_mmut(uint32_t addr, uint32_t a64)
|
||||
|
||||
map = read_mapping[addr >> MEM_GRANULARITY_BITS];
|
||||
if (map && map->read_b)
|
||||
return map->read_b(addr, map->p);
|
||||
return map->read_b(addr, map->priv);
|
||||
|
||||
return 0xff;
|
||||
}
|
||||
@@ -892,7 +892,7 @@ writemembl_no_mmut(uint32_t addr, uint32_t a64, uint8_t val)
|
||||
|
||||
map = write_mapping[addr >> MEM_GRANULARITY_BITS];
|
||||
if (map && map->write_b)
|
||||
map->write_b(addr, val, map->p);
|
||||
map->write_b(addr, val, map->priv);
|
||||
}
|
||||
|
||||
uint16_t
|
||||
@@ -944,10 +944,10 @@ readmemwl(uint32_t addr)
|
||||
map = read_mapping[addr >> MEM_GRANULARITY_BITS];
|
||||
|
||||
if (map && map->read_w)
|
||||
return map->read_w(addr, map->p);
|
||||
return map->read_w(addr, map->priv);
|
||||
|
||||
if (map && map->read_b) {
|
||||
return map->read_b(addr, map->p) | ((uint16_t) (map->read_b(addr + 1, map->p)) << 8);
|
||||
return map->read_b(addr, map->priv) | ((uint16_t) (map->read_b(addr + 1, map->priv)) << 8);
|
||||
}
|
||||
|
||||
return 0xffff;
|
||||
@@ -1016,13 +1016,13 @@ writememwl(uint32_t addr, uint16_t val)
|
||||
map = write_mapping[addr >> MEM_GRANULARITY_BITS];
|
||||
|
||||
if (map && map->write_w) {
|
||||
map->write_w(addr, val, map->p);
|
||||
map->write_w(addr, val, map->priv);
|
||||
return;
|
||||
}
|
||||
|
||||
if (map && map->write_b) {
|
||||
map->write_b(addr, val, map->p);
|
||||
map->write_b(addr + 1, val >> 8, map->p);
|
||||
map->write_b(addr, val, map->priv);
|
||||
map->write_b(addr + 1, val >> 8, map->priv);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1064,10 +1064,10 @@ readmemwl_no_mmut(uint32_t addr, uint32_t *a64)
|
||||
map = read_mapping[addr >> MEM_GRANULARITY_BITS];
|
||||
|
||||
if (map && map->read_w)
|
||||
return map->read_w(addr, map->p);
|
||||
return map->read_w(addr, map->priv);
|
||||
|
||||
if (map && map->read_b) {
|
||||
return map->read_b(addr, map->p) | ((uint16_t) (map->read_b(addr + 1, map->p)) << 8);
|
||||
return map->read_b(addr, map->priv) | ((uint16_t) (map->read_b(addr + 1, map->priv)) << 8);
|
||||
}
|
||||
|
||||
return 0xffff;
|
||||
@@ -1119,13 +1119,13 @@ writememwl_no_mmut(uint32_t addr, uint32_t *a64, uint16_t val)
|
||||
map = write_mapping[addr >> MEM_GRANULARITY_BITS];
|
||||
|
||||
if (map && map->write_w) {
|
||||
map->write_w(addr, val, map->p);
|
||||
map->write_w(addr, val, map->priv);
|
||||
return;
|
||||
}
|
||||
|
||||
if (map && map->write_b) {
|
||||
map->write_b(addr, val, map->p);
|
||||
map->write_b(addr + 1, val >> 8, map->p);
|
||||
map->write_b(addr, val, map->priv);
|
||||
map->write_b(addr + 1, val >> 8, map->priv);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1193,13 +1193,13 @@ readmemll(uint32_t addr)
|
||||
map = read_mapping[addr >> MEM_GRANULARITY_BITS];
|
||||
|
||||
if (map && map->read_l)
|
||||
return map->read_l(addr, map->p);
|
||||
return map->read_l(addr, map->priv);
|
||||
|
||||
if (map && map->read_w)
|
||||
return map->read_w(addr, map->p) | ((uint32_t) (map->read_w(addr + 2, map->p)) << 16);
|
||||
return map->read_w(addr, map->priv) | ((uint32_t) (map->read_w(addr + 2, map->priv)) << 16);
|
||||
|
||||
if (map && map->read_b)
|
||||
return map->read_b(addr, map->p) | ((uint32_t) (map->read_b(addr + 1, map->p)) << 8) | ((uint32_t) (map->read_b(addr + 2, map->p)) << 16) | ((uint32_t) (map->read_b(addr + 3, map->p)) << 24);
|
||||
return map->read_b(addr, map->priv) | ((uint32_t) (map->read_b(addr + 1, map->priv)) << 8) | ((uint32_t) (map->read_b(addr + 2, map->priv)) << 16) | ((uint32_t) (map->read_b(addr + 3, map->priv)) << 24);
|
||||
|
||||
return 0xffffffff;
|
||||
}
|
||||
@@ -1280,19 +1280,19 @@ writememll(uint32_t addr, uint32_t val)
|
||||
map = write_mapping[addr >> MEM_GRANULARITY_BITS];
|
||||
|
||||
if (map && map->write_l) {
|
||||
map->write_l(addr, val, map->p);
|
||||
map->write_l(addr, val, map->priv);
|
||||
return;
|
||||
}
|
||||
if (map && map->write_w) {
|
||||
map->write_w(addr, val, map->p);
|
||||
map->write_w(addr + 2, val >> 16, map->p);
|
||||
map->write_w(addr, val, map->priv);
|
||||
map->write_w(addr + 2, val >> 16, map->priv);
|
||||
return;
|
||||
}
|
||||
if (map && map->write_b) {
|
||||
map->write_b(addr, val, map->p);
|
||||
map->write_b(addr + 1, val >> 8, map->p);
|
||||
map->write_b(addr + 2, val >> 16, map->p);
|
||||
map->write_b(addr + 3, val >> 24, map->p);
|
||||
map->write_b(addr, val, map->priv);
|
||||
map->write_b(addr + 1, val >> 8, map->priv);
|
||||
map->write_b(addr + 2, val >> 16, map->priv);
|
||||
map->write_b(addr + 3, val >> 24, map->priv);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1334,13 +1334,13 @@ readmemll_no_mmut(uint32_t addr, uint32_t *a64)
|
||||
map = read_mapping[addr >> MEM_GRANULARITY_BITS];
|
||||
|
||||
if (map && map->read_l)
|
||||
return map->read_l(addr, map->p);
|
||||
return map->read_l(addr, map->priv);
|
||||
|
||||
if (map && map->read_w)
|
||||
return map->read_w(addr, map->p) | ((uint32_t) (map->read_w(addr + 2, map->p)) << 16);
|
||||
return map->read_w(addr, map->priv) | ((uint32_t) (map->read_w(addr + 2, map->priv)) << 16);
|
||||
|
||||
if (map && map->read_b)
|
||||
return map->read_b(addr, map->p) | ((uint32_t) (map->read_b(addr + 1, map->p)) << 8) | ((uint32_t) (map->read_b(addr + 2, map->p)) << 16) | ((uint32_t) (map->read_b(addr + 3, map->p)) << 24);
|
||||
return map->read_b(addr, map->priv) | ((uint32_t) (map->read_b(addr + 1, map->priv)) << 8) | ((uint32_t) (map->read_b(addr + 2, map->priv)) << 16) | ((uint32_t) (map->read_b(addr + 3, map->priv)) << 24);
|
||||
|
||||
return 0xffffffff;
|
||||
}
|
||||
@@ -1391,19 +1391,19 @@ writememll_no_mmut(uint32_t addr, uint32_t *a64, uint32_t val)
|
||||
map = write_mapping[addr >> MEM_GRANULARITY_BITS];
|
||||
|
||||
if (map && map->write_l) {
|
||||
map->write_l(addr, val, map->p);
|
||||
map->write_l(addr, val, map->priv);
|
||||
return;
|
||||
}
|
||||
if (map && map->write_w) {
|
||||
map->write_w(addr, val, map->p);
|
||||
map->write_w(addr + 2, val >> 16, map->p);
|
||||
map->write_w(addr, val, map->priv);
|
||||
map->write_w(addr + 2, val >> 16, map->priv);
|
||||
return;
|
||||
}
|
||||
if (map && map->write_b) {
|
||||
map->write_b(addr, val, map->p);
|
||||
map->write_b(addr + 1, val >> 8, map->p);
|
||||
map->write_b(addr + 2, val >> 16, map->p);
|
||||
map->write_b(addr + 3, val >> 24, map->p);
|
||||
map->write_b(addr, val, map->priv);
|
||||
map->write_b(addr + 1, val >> 8, map->priv);
|
||||
map->write_b(addr + 2, val >> 16, map->priv);
|
||||
map->write_b(addr + 3, val >> 24, map->priv);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1469,7 +1469,7 @@ readmemql(uint32_t addr)
|
||||
|
||||
map = read_mapping[addr >> MEM_GRANULARITY_BITS];
|
||||
if (map && map->read_l)
|
||||
return map->read_l(addr, map->p) | ((uint64_t) map->read_l(addr + 4, map->p) << 32);
|
||||
return map->read_l(addr, map->priv) | ((uint64_t) map->read_l(addr + 4, map->priv) << 32);
|
||||
|
||||
return readmemll(addr) | ((uint64_t) readmemll(addr + 4) << 32);
|
||||
}
|
||||
@@ -1548,26 +1548,26 @@ writememql(uint32_t addr, uint64_t val)
|
||||
map = write_mapping[addr >> MEM_GRANULARITY_BITS];
|
||||
|
||||
if (map && map->write_l) {
|
||||
map->write_l(addr, val, map->p);
|
||||
map->write_l(addr + 4, val >> 32, map->p);
|
||||
map->write_l(addr, val, map->priv);
|
||||
map->write_l(addr + 4, val >> 32, map->priv);
|
||||
return;
|
||||
}
|
||||
if (map && map->write_w) {
|
||||
map->write_w(addr, val, map->p);
|
||||
map->write_w(addr + 2, val >> 16, map->p);
|
||||
map->write_w(addr + 4, val >> 32, map->p);
|
||||
map->write_w(addr + 6, val >> 48, map->p);
|
||||
map->write_w(addr, val, map->priv);
|
||||
map->write_w(addr + 2, val >> 16, map->priv);
|
||||
map->write_w(addr + 4, val >> 32, map->priv);
|
||||
map->write_w(addr + 6, val >> 48, map->priv);
|
||||
return;
|
||||
}
|
||||
if (map && map->write_b) {
|
||||
map->write_b(addr, val, map->p);
|
||||
map->write_b(addr + 1, val >> 8, map->p);
|
||||
map->write_b(addr + 2, val >> 16, map->p);
|
||||
map->write_b(addr + 3, val >> 24, map->p);
|
||||
map->write_b(addr + 4, val >> 32, map->p);
|
||||
map->write_b(addr + 5, val >> 40, map->p);
|
||||
map->write_b(addr + 6, val >> 48, map->p);
|
||||
map->write_b(addr + 7, val >> 56, map->p);
|
||||
map->write_b(addr, val, map->priv);
|
||||
map->write_b(addr + 1, val >> 8, map->priv);
|
||||
map->write_b(addr + 2, val >> 16, map->priv);
|
||||
map->write_b(addr + 3, val >> 24, map->priv);
|
||||
map->write_b(addr + 4, val >> 32, map->priv);
|
||||
map->write_b(addr + 5, val >> 40, map->priv);
|
||||
map->write_b(addr + 6, val >> 48, map->priv);
|
||||
map->write_b(addr + 7, val >> 56, map->priv);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1634,7 +1634,7 @@ mem_readb_phys(uint32_t addr)
|
||||
if (map->exec)
|
||||
ret = map->exec[(addr - map->base) & map->mask];
|
||||
else if (map->read_b)
|
||||
ret = map->read_b(addr, map->p);
|
||||
ret = map->read_b(addr, map->priv);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -1653,7 +1653,7 @@ mem_readw_phys(uint32_t addr)
|
||||
p = (uint16_t *) &(map->exec[(addr - map->base) & map->mask]);
|
||||
ret = *p;
|
||||
} else if (((addr & MEM_GRANULARITY_MASK) <= MEM_GRANULARITY_HBOUND) && (map && map->read_w))
|
||||
ret = map->read_w(addr, map->p);
|
||||
ret = map->read_w(addr, map->priv);
|
||||
else {
|
||||
ret = mem_readb_phys(addr + 1) << 8;
|
||||
ret |= mem_readb_phys(addr);
|
||||
@@ -1675,7 +1675,7 @@ mem_readl_phys(uint32_t addr)
|
||||
p = (uint32_t *) &(map->exec[(addr - map->base) & map->mask]);
|
||||
ret = *p;
|
||||
} else if (((addr & MEM_GRANULARITY_MASK) <= MEM_GRANULARITY_QBOUND) && (map && map->read_l))
|
||||
ret = map->read_l(addr, map->p);
|
||||
ret = map->read_l(addr, map->priv);
|
||||
else {
|
||||
ret = mem_readw_phys(addr + 2) << 16;
|
||||
ret |= mem_readw_phys(addr);
|
||||
@@ -1714,7 +1714,7 @@ mem_writeb_phys(uint32_t addr, uint8_t val)
|
||||
if (map->exec)
|
||||
map->exec[(addr - map->base) & map->mask] = val;
|
||||
else if (map->write_b)
|
||||
map->write_b(addr, val, map->p);
|
||||
map->write_b(addr, val, map->priv);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1730,7 +1730,7 @@ mem_writew_phys(uint32_t addr, uint16_t val)
|
||||
p = (uint16_t *) &(map->exec[(addr - map->base) & map->mask]);
|
||||
*p = val;
|
||||
} else if (((addr & MEM_GRANULARITY_MASK) <= MEM_GRANULARITY_HBOUND) && (map && map->write_w))
|
||||
map->write_w(addr, val, map->p);
|
||||
map->write_w(addr, val, map->priv);
|
||||
else {
|
||||
mem_writeb_phys(addr, val & 0xff);
|
||||
mem_writeb_phys(addr + 1, (val >> 8) & 0xff);
|
||||
@@ -1749,7 +1749,7 @@ mem_writel_phys(uint32_t addr, uint32_t val)
|
||||
p = (uint32_t *) &(map->exec[(addr - map->base) & map->mask]);
|
||||
*p = val;
|
||||
} else if (((addr & MEM_GRANULARITY_MASK) <= MEM_GRANULARITY_QBOUND) && (map && map->write_l))
|
||||
map->write_l(addr, val, map->p);
|
||||
map->write_l(addr, val, map->priv);
|
||||
else {
|
||||
mem_writew_phys(addr, val & 0xffff);
|
||||
mem_writew_phys(addr + 2, (val >> 16) & 0xffff);
|
||||
@@ -2051,7 +2051,7 @@ mem_write_ram(uint32_t addr, uint8_t val, UNUSED(void *priv))
|
||||
}
|
||||
|
||||
void
|
||||
mem_write_ramw(uint32_t addr, uint16_t val, void *priv)
|
||||
mem_write_ramw(uint32_t addr, uint16_t val, UNUSED(void *priv))
|
||||
{
|
||||
#ifdef ENABLE_MEM_LOG
|
||||
if ((addr >= 0xa0000) && (addr <= 0xbffff))
|
||||
@@ -2145,7 +2145,7 @@ mem_write_remapped(uint32_t addr, uint8_t val, UNUSED(void *priv))
|
||||
}
|
||||
|
||||
static void
|
||||
mem_write_remappedw(uint32_t addr, uint16_t val, void *priv)
|
||||
mem_write_remappedw(uint32_t addr, uint16_t val, UNUSED(void *priv))
|
||||
{
|
||||
uint32_t oldaddr = addr;
|
||||
addr = 0xA0000 + (addr - remap_start_addr);
|
||||
@@ -2181,7 +2181,7 @@ mem_write_remapped2(uint32_t addr, uint8_t val, UNUSED(void *priv))
|
||||
}
|
||||
|
||||
static void
|
||||
mem_write_remappedw2(uint32_t addr, uint16_t val, void *priv)
|
||||
mem_write_remappedw2(uint32_t addr, uint16_t val, UNUSED(void *priv))
|
||||
{
|
||||
uint32_t oldaddr = addr;
|
||||
addr = 0xD0000 + (addr - remap_start_addr2);
|
||||
@@ -2384,15 +2384,15 @@ void
|
||||
mem_mapping_set(mem_mapping_t *map,
|
||||
uint32_t base,
|
||||
uint32_t size,
|
||||
uint8_t (*read_b)(uint32_t addr, void *p),
|
||||
uint16_t (*read_w)(uint32_t addr, void *p),
|
||||
uint32_t (*read_l)(uint32_t addr, void *p),
|
||||
void (*write_b)(uint32_t addr, uint8_t val, void *p),
|
||||
void (*write_w)(uint32_t addr, uint16_t val, void *p),
|
||||
void (*write_l)(uint32_t addr, uint32_t val, void *p),
|
||||
uint8_t (*read_b)(uint32_t addr, void *priv),
|
||||
uint16_t (*read_w)(uint32_t addr, void *priv),
|
||||
uint32_t (*read_l)(uint32_t addr, void *priv),
|
||||
void (*write_b)(uint32_t addr, uint8_t val, void *priv),
|
||||
void (*write_w)(uint32_t addr, uint16_t val, void *priv),
|
||||
void (*write_l)(uint32_t addr, uint32_t val, void *priv),
|
||||
uint8_t *exec,
|
||||
uint32_t fl,
|
||||
void *p)
|
||||
void *priv)
|
||||
{
|
||||
if (size != 0x00000000)
|
||||
map->enable = 1;
|
||||
@@ -2409,7 +2409,7 @@ mem_mapping_set(mem_mapping_t *map,
|
||||
map->write_l = write_l;
|
||||
map->exec = exec;
|
||||
map->flags = fl;
|
||||
map->p = p;
|
||||
map->priv = priv;
|
||||
map->next = NULL;
|
||||
mem_log("mem_mapping_add(): Linked list structure: %08X -> %08X -> %08X\n", map->prev, map, map->next);
|
||||
|
||||
@@ -2422,15 +2422,15 @@ void
|
||||
mem_mapping_add(mem_mapping_t *map,
|
||||
uint32_t base,
|
||||
uint32_t size,
|
||||
uint8_t (*read_b)(uint32_t addr, void *p),
|
||||
uint16_t (*read_w)(uint32_t addr, void *p),
|
||||
uint32_t (*read_l)(uint32_t addr, void *p),
|
||||
void (*write_b)(uint32_t addr, uint8_t val, void *p),
|
||||
void (*write_w)(uint32_t addr, uint16_t val, void *p),
|
||||
void (*write_l)(uint32_t addr, uint32_t val, void *p),
|
||||
uint8_t (*read_b)(uint32_t addr, void *priv),
|
||||
uint16_t (*read_w)(uint32_t addr, void *priv),
|
||||
uint32_t (*read_l)(uint32_t addr, void *priv),
|
||||
void (*write_b)(uint32_t addr, uint8_t val, void *priv),
|
||||
void (*write_w)(uint32_t addr, uint16_t val, void *priv),
|
||||
void (*write_l)(uint32_t addr, uint32_t val, void *priv),
|
||||
uint8_t *exec,
|
||||
uint32_t fl,
|
||||
void *p)
|
||||
void *priv)
|
||||
{
|
||||
/* Do a sanity check */
|
||||
if ((base_mapping == NULL) && (last_mapping != NULL)) {
|
||||
@@ -2461,7 +2461,7 @@ mem_mapping_add(mem_mapping_t *map,
|
||||
last_mapping = map;
|
||||
|
||||
mem_mapping_set(map, base, size, read_b, read_w, read_l,
|
||||
write_b, write_w, write_l, exec, fl, p);
|
||||
write_b, write_w, write_l, exec, fl, priv);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2472,12 +2472,12 @@ mem_mapping_do_recalc(mem_mapping_t *map)
|
||||
|
||||
void
|
||||
mem_mapping_set_handler(mem_mapping_t *map,
|
||||
uint8_t (*read_b)(uint32_t addr, void *p),
|
||||
uint16_t (*read_w)(uint32_t addr, void *p),
|
||||
uint32_t (*read_l)(uint32_t addr, void *p),
|
||||
void (*write_b)(uint32_t addr, uint8_t val, void *p),
|
||||
void (*write_w)(uint32_t addr, uint16_t val, void *p),
|
||||
void (*write_l)(uint32_t addr, uint32_t val, void *p))
|
||||
uint8_t (*read_b)(uint32_t addr, void *priv),
|
||||
uint16_t (*read_w)(uint32_t addr, void *priv),
|
||||
uint32_t (*read_l)(uint32_t addr, void *priv),
|
||||
void (*write_b)(uint32_t addr, uint8_t val, void *priv),
|
||||
void (*write_w)(uint32_t addr, uint16_t val, void *priv),
|
||||
void (*write_l)(uint32_t addr, uint32_t val, void *priv))
|
||||
{
|
||||
map->read_b = read_b;
|
||||
map->read_w = read_w;
|
||||
@@ -2521,9 +2521,9 @@ mem_mapping_set_mask(mem_mapping_t *map, uint32_t mask)
|
||||
}
|
||||
|
||||
void
|
||||
mem_mapping_set_p(mem_mapping_t *map, void *p)
|
||||
mem_mapping_set_p(mem_mapping_t *map, void *priv)
|
||||
{
|
||||
map->p = p;
|
||||
map->priv = priv;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -140,11 +140,11 @@ rom_getfile(char *fn, char *s, int size)
|
||||
int
|
||||
rom_present(char *fn)
|
||||
{
|
||||
FILE *f;
|
||||
FILE *fp;
|
||||
|
||||
f = rom_fopen(fn, "rb");
|
||||
if (f != NULL) {
|
||||
(void) fclose(f);
|
||||
fp = rom_fopen(fn, "rb");
|
||||
if (fp != NULL) {
|
||||
(void) fclose(fp);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -205,10 +205,9 @@ rom_readl(uint32_t addr, void *priv)
|
||||
int
|
||||
rom_load_linear_oddeven(const char *fn, uint32_t addr, int sz, int off, uint8_t *ptr)
|
||||
{
|
||||
FILE *f = rom_fopen(fn, "rb");
|
||||
int i;
|
||||
FILE *fp = rom_fopen(fn, "rb");
|
||||
|
||||
if (f == NULL) {
|
||||
if (fp == NULL) {
|
||||
rom_log("ROM: image '%s' not found\n", fn);
|
||||
return 0;
|
||||
}
|
||||
@@ -220,19 +219,19 @@ rom_load_linear_oddeven(const char *fn, uint32_t addr, int sz, int off, uint8_t
|
||||
addr &= 0x03ffff;
|
||||
|
||||
if (ptr != NULL) {
|
||||
if (fseek(f, off, SEEK_SET) == -1)
|
||||
if (fseek(fp, off, SEEK_SET) == -1)
|
||||
fatal("rom_load_linear(): Error seeking to the beginning of the file\n");
|
||||
for (i = 0; i < (sz >> 1); i++) {
|
||||
if (fread(ptr + (addr + (i << 1)), 1, 1, f) != 1)
|
||||
for (int i = 0; i < (sz >> 1); i++) {
|
||||
if (fread(ptr + (addr + (i << 1)), 1, 1, fp) != 1)
|
||||
fatal("rom_load_linear(): Error reading even data\n");
|
||||
}
|
||||
for (i = 0; i < (sz >> 1); i++) {
|
||||
if (fread(ptr + (addr + (i << 1) + 1), 1, 1, f) != 1)
|
||||
for (int i = 0; i < (sz >> 1); i++) {
|
||||
if (fread(ptr + (addr + (i << 1) + 1), 1, 1, fp) != 1)
|
||||
fatal("rom_load_linear(): Error reading od data\n");
|
||||
}
|
||||
}
|
||||
|
||||
(void) fclose(f);
|
||||
(void) fclose(fp);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -241,9 +240,9 @@ rom_load_linear_oddeven(const char *fn, uint32_t addr, int sz, int off, uint8_t
|
||||
int
|
||||
rom_load_linear(const char *fn, uint32_t addr, int sz, int off, uint8_t *ptr)
|
||||
{
|
||||
FILE *f = rom_fopen(fn, "rb");
|
||||
FILE *fp = rom_fopen(fn, "rb");
|
||||
|
||||
if (f == NULL) {
|
||||
if (fp == NULL) {
|
||||
rom_log("ROM: image '%s' not found\n", fn);
|
||||
return 0;
|
||||
}
|
||||
@@ -255,13 +254,13 @@ rom_load_linear(const char *fn, uint32_t addr, int sz, int off, uint8_t *ptr)
|
||||
addr &= 0x03ffff;
|
||||
|
||||
if (ptr != NULL) {
|
||||
if (fseek(f, off, SEEK_SET) == -1)
|
||||
if (fseek(fp, off, SEEK_SET) == -1)
|
||||
fatal("rom_load_linear(): Error seeking to the beginning of the file\n");
|
||||
if (fread(ptr + addr, 1, sz, f) > sz)
|
||||
if (fread(ptr + addr, 1, sz, fp) > sz)
|
||||
fatal("rom_load_linear(): Error reading data\n");
|
||||
}
|
||||
|
||||
(void) fclose(f);
|
||||
(void) fclose(fp);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -270,9 +269,9 @@ rom_load_linear(const char *fn, uint32_t addr, int sz, int off, uint8_t *ptr)
|
||||
int
|
||||
rom_load_linear_inverted(const char *fn, uint32_t addr, int sz, int off, uint8_t *ptr)
|
||||
{
|
||||
FILE *f = rom_fopen(fn, "rb");
|
||||
FILE *fp = rom_fopen(fn, "rb");
|
||||
|
||||
if (f == NULL) {
|
||||
if (fp == NULL) {
|
||||
rom_log("ROM: image '%s' not found\n", fn);
|
||||
return 0;
|
||||
}
|
||||
@@ -284,22 +283,22 @@ rom_load_linear_inverted(const char *fn, uint32_t addr, int sz, int off, uint8_t
|
||||
addr &= 0x03ffff;
|
||||
}
|
||||
|
||||
(void) fseek(f, 0, SEEK_END);
|
||||
if (ftell(f) < sz) {
|
||||
(void) fclose(f);
|
||||
(void) fseek(fp, 0, SEEK_END);
|
||||
if (ftell(fp) < sz) {
|
||||
(void) fclose(fp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ptr != NULL) {
|
||||
if (fseek(f, off, SEEK_SET) == -1)
|
||||
if (fseek(fp, off, SEEK_SET) == -1)
|
||||
fatal("rom_load_linear_inverted(): Error seeking to the beginning of the file\n");
|
||||
if (fread(ptr + addr + 0x10000, 1, sz >> 1, f) > (sz >> 1))
|
||||
if (fread(ptr + addr + 0x10000, 1, sz >> 1, fp) > (sz >> 1))
|
||||
fatal("rom_load_linear_inverted(): Error reading the upper half of the data\n");
|
||||
if (fread(ptr + addr, sz >> 1, 1, f) > (sz >> 1))
|
||||
if (fread(ptr + addr, sz >> 1, 1, fp) > (sz >> 1))
|
||||
fatal("rom_load_linear_inverted(): Error reading the lower half of the data\n");
|
||||
}
|
||||
|
||||
(void) fclose(f);
|
||||
(void) fclose(fp);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -308,18 +307,18 @@ rom_load_linear_inverted(const char *fn, uint32_t addr, int sz, int off, uint8_t
|
||||
int
|
||||
rom_load_interleaved(const char *fnl, const char *fnh, uint32_t addr, int sz, int off, uint8_t *ptr)
|
||||
{
|
||||
FILE *fl = rom_fopen(fnl, "rb");
|
||||
FILE *fh = rom_fopen(fnh, "rb");
|
||||
FILE *fpl = rom_fopen(fnl, "rb");
|
||||
FILE *fph = rom_fopen(fnh, "rb");
|
||||
|
||||
if (fl == NULL || fh == NULL) {
|
||||
if (fl == NULL)
|
||||
if (fpl == NULL || fph == NULL) {
|
||||
if (fpl == NULL)
|
||||
rom_log("ROM: image '%s' not found\n", fnl);
|
||||
else
|
||||
(void) fclose(fl);
|
||||
if (fh == NULL)
|
||||
(void) fclose(fpl);
|
||||
if (fph == NULL)
|
||||
rom_log("ROM: image '%s' not found\n", fnh);
|
||||
else
|
||||
(void) fclose(fh);
|
||||
(void) fclose(fph);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -332,16 +331,16 @@ rom_load_interleaved(const char *fnl, const char *fnh, uint32_t addr, int sz, in
|
||||
}
|
||||
|
||||
if (ptr != NULL) {
|
||||
(void) fseek(fl, off, SEEK_SET);
|
||||
(void) fseek(fh, off, SEEK_SET);
|
||||
(void) fseek(fpl, off, SEEK_SET);
|
||||
(void) fseek(fph, off, SEEK_SET);
|
||||
for (int c = 0; c < sz; c += 2) {
|
||||
ptr[addr + c] = fgetc(fl) & 0xff;
|
||||
ptr[addr + c + 1] = fgetc(fh) & 0xff;
|
||||
ptr[addr + c] = fgetc(fpl) & 0xff;
|
||||
ptr[addr + c + 1] = fgetc(fph) & 0xff;
|
||||
}
|
||||
}
|
||||
|
||||
(void) fclose(fh);
|
||||
(void) fclose(fl);
|
||||
(void) fclose(fph);
|
||||
(void) fclose(fpl);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -30,11 +30,12 @@
|
||||
#include <86box/mem.h>
|
||||
#include <86box/spd.h>
|
||||
#include <86box/row.h>
|
||||
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
/* 0 1 2 3 4 5 6 7 */
|
||||
static uint8_t rows_num, rows_default,
|
||||
rows_bits;
|
||||
static uint8_t rows_num;
|
||||
static uint8_t rows_default;
|
||||
static uint8_t rows_bits;
|
||||
static uint32_t row_unit;
|
||||
static uint8_t drb_defaults[16];
|
||||
static row_t *rows;
|
||||
@@ -112,7 +113,7 @@ row_writel(uint32_t addr, uint32_t val, void *priv)
|
||||
void
|
||||
row_allocate(uint8_t row_id, uint8_t set)
|
||||
{
|
||||
uint32_t c, offset;
|
||||
uint32_t offset;
|
||||
|
||||
/* Do nothing if size is either zero or invalid. */
|
||||
if ((rows[row_id].host_size == 0x00000000) || (rows[row_id].host_size == 0xffffffff))
|
||||
@@ -121,7 +122,7 @@ row_allocate(uint8_t row_id, uint8_t set)
|
||||
if (rows[row_id].ram_size == 0x00000000)
|
||||
return;
|
||||
|
||||
for (c = (rows[row_id].host_base >> 12); c < ((rows[row_id].host_base + rows[row_id].host_size) >> 12); c++) {
|
||||
for (uint32_t c = (rows[row_id].host_base >> 12); c < ((rows[row_id].host_base + rows[row_id].host_size) >> 12); c++) {
|
||||
offset = c - (rows[row_id].host_base >> 12);
|
||||
|
||||
pages[c].mem = set ? (rows[row_id].buf + rows[row_id].ram_base + ((offset << 12) & rows[row_id].ram_mask)) : page_ff;
|
||||
@@ -129,22 +130,22 @@ row_allocate(uint8_t row_id, uint8_t set)
|
||||
pages[c].write_w = set ? mem_write_ramw_page : NULL;
|
||||
pages[c].write_l = set ? mem_write_raml_page : NULL;
|
||||
#ifdef USE_NEW_DYNAREC
|
||||
pages[c].evict_prev = EVICT_NOT_IN_LIST;
|
||||
pages[c].byte_dirty_mask = &byte_dirty_mask[offset * 64];
|
||||
pages[c].byte_code_present_mask = &byte_code_present_mask[offset * 64];
|
||||
pages[c].evict_prev = EVICT_NOT_IN_LIST;
|
||||
pages[c].byte_dirty_mask = &byte_dirty_mask[offset * 64];
|
||||
pages[c].byte_code_present_mask = &byte_code_present_mask[offset * 64];
|
||||
#endif
|
||||
}
|
||||
|
||||
if (rows[row_id].host_base >= 0x00100000) {
|
||||
mem_set_mem_state_both(rows[row_id].host_base, rows[row_id].host_base + rows[row_id].host_size,
|
||||
mem_set_mem_state_both(rows[row_id].host_base, rows[row_id].host_base + rows[row_id].host_size,
|
||||
set ? (MEM_READ_INTERNAL | MEM_WRITE_INTERNAL) : (MEM_READ_EXTERNAL | MEM_WRITE_EXTERNAL));
|
||||
} else {
|
||||
if (0x000a0000 > rows[row_id].host_base) {
|
||||
mem_set_mem_state_both(rows[row_id].host_base, 0x000a0000 - rows[row_id].host_base,
|
||||
mem_set_mem_state_both(rows[row_id].host_base, 0x000a0000 - rows[row_id].host_base,
|
||||
set ? (MEM_READ_INTERNAL | MEM_WRITE_INTERNAL) : (MEM_READ_EXTERNAL | MEM_WRITE_EXTERNAL));
|
||||
}
|
||||
if ((rows[row_id].host_base + rows[row_id].host_size) > 0x00100000) {
|
||||
mem_set_mem_state_both(0x00100000, (rows[row_id].host_base + rows[row_id].host_size) - 0x00100000,
|
||||
mem_set_mem_state_both(0x00100000, (rows[row_id].host_base + rows[row_id].host_size) - 0x00100000,
|
||||
set ? (MEM_READ_INTERNAL | MEM_WRITE_INTERNAL) : (MEM_READ_EXTERNAL | MEM_WRITE_EXTERNAL));
|
||||
}
|
||||
}
|
||||
@@ -208,15 +209,15 @@ row_set_boundary(uint8_t row_id, uint32_t boundary)
|
||||
|
||||
|
||||
void
|
||||
row_reset(void *priv)
|
||||
row_reset(UNUSED(void *priv))
|
||||
{
|
||||
int i;
|
||||
uint32_t boundary, shift;
|
||||
uint32_t boundary;
|
||||
uint32_t shift;
|
||||
|
||||
for (i = (rows_num - 1); i >= 0; i--)
|
||||
for (uint8_t i = (rows_num - 1); i >= 0; i--)
|
||||
row_disable(i);
|
||||
|
||||
for (i = 0; i < rows_num; i++) {
|
||||
for (uint8_t i = 0; i < rows_num; i++) {
|
||||
shift = (i & 1) << 2;
|
||||
boundary = ((uint32_t) drb_defaults[i]) + (((((uint32_t) drb_defaults[(i >> 1) + 8]) >> shift) & 0xf) << 8);
|
||||
row_set_boundary(i, boundary);
|
||||
@@ -225,7 +226,7 @@ row_reset(void *priv)
|
||||
|
||||
|
||||
void
|
||||
row_close(void *priv)
|
||||
row_close(UNUSED(void *priv))
|
||||
{
|
||||
free(rows);
|
||||
rows = NULL;
|
||||
@@ -235,14 +236,18 @@ row_close(void *priv)
|
||||
void *
|
||||
row_init(const device_t *info)
|
||||
{
|
||||
uint32_t cur_drb = 0, cur_drbe = 0;
|
||||
uint32_t last_drb = 0, last_drbe = 0;
|
||||
uint8_t phys_drbs[16];
|
||||
int i, max = info->local & 0xff;
|
||||
int c;
|
||||
uint32_t shift, drb;
|
||||
uint32_t boundary, mask;
|
||||
row_t *new_rows = NULL;
|
||||
uint32_t cur_drb = 0;
|
||||
uint32_t cur_drbe = 0;
|
||||
uint32_t last_drb = 0;
|
||||
uint32_t last_drbe = 0;
|
||||
uint8_t phys_drbs[16];
|
||||
int i;
|
||||
int max = info->local & 0xff;
|
||||
uint32_t shift;
|
||||
uint32_t drb;
|
||||
uint32_t boundary;
|
||||
uint32_t mask;
|
||||
row_t *new_rows = NULL;
|
||||
|
||||
rows_bits = ((info->local >> 24) & 0xff);
|
||||
mask = (1 << rows_bits) - 1;
|
||||
@@ -268,7 +273,7 @@ row_init(const device_t *info)
|
||||
mem_mapping_disable(&ram_2gb_mapping);
|
||||
#endif
|
||||
|
||||
for (c = 0; c < pages_sz; c++) {
|
||||
for (uint32_t c = 0; c < pages_sz; c++) {
|
||||
pages[c].mem = page_ff;
|
||||
pages[c].write_b = NULL;
|
||||
pages[c].write_w = NULL;
|
||||
|
||||
@@ -31,8 +31,8 @@
|
||||
|
||||
#define SPD_ROLLUP(x) ((x) >= 16 ? ((x) -15) : (x))
|
||||
|
||||
int spd_present = 0;
|
||||
spd_t *spd_modules[SPD_MAX_SLOTS];
|
||||
uint8_t spd_present = 0;
|
||||
spd_t *spd_modules[SPD_MAX_SLOTS];
|
||||
|
||||
static const device_t spd_device;
|
||||
|
||||
@@ -548,8 +548,8 @@ spd_write_drbs_ali1621(uint8_t *regs, uint8_t reg_min, uint8_t reg_max)
|
||||
regs[drb + 3] |= 0x06;
|
||||
|
||||
switch (size) {
|
||||
case 4:
|
||||
default:
|
||||
case 4:
|
||||
regs[drb + 2] = 0x00;
|
||||
break;
|
||||
case 8:
|
||||
|
||||
Reference in New Issue
Block a user