X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fdevices%2Fnvram.c;h=ef37366ee28b06e2603aa48eedcb507946c68101;hb=d605ad004bd4ddce4be472210496da843763fe16;hp=e59b2f365f2efe296f963c18b8d7615ceddc21ce;hpb=1831ffe56d9eeb2bde9b5584227dcaf958dad70d;p=palacios-OLD.git diff --git a/palacios/src/devices/nvram.c b/palacios/src/devices/nvram.c index e59b2f3..ef37366 100644 --- a/palacios/src/devices/nvram.c +++ b/palacios/src/devices/nvram.c @@ -2,9 +2,15 @@ #include #include -extern struct vmm_os_hooks *os_hooks; -extern void SerialPrint(const char *format, ...); +#ifndef DEBUG_NVRAM +#undef PrintDebug +#define PrintDebug(fmt, args...) +#endif + + + + #define NVRAM_REG_PORT 0x70 #define NVRAM_DATA_PORT 0x71 @@ -80,7 +86,11 @@ static int set_nvram_defaults(struct vm_device *dev) // // 2 1.44 MB floppy drives // +#if 1 nvram_state->mem_state[NVRAM_REG_FLOPPY_TYPE]= 0x44; +#else + nvram_state->mem_state[NVRAM_REG_FLOPPY_TYPE] = 0x00; +#endif // // For old boot sequence style, do floppy first @@ -100,6 +110,7 @@ static int set_nvram_defaults(struct vm_device *dev) // Set equipment byte to note 2 floppies, vga display, keyboard,math,floppy nvram_state->mem_state[NVRAM_REG_EQUIPMENT_BYTE]= 0x4f; + //nvram_state->mem_state[NVRAM_REG_EQUIPMENT_BYTE] = 0xf; // Set conventional memory to 640K nvram_state->mem_state[NVRAM_REG_BASE_MEMORY_HIGH]= 0x02; @@ -112,13 +123,33 @@ static int set_nvram_defaults(struct vm_device *dev) nvram_state->mem_state[NVRAM_REG_EXT_MEMORY_2ND_LOW]= 0x00; // Set the extended memory beyond 16 MB to 128-16 MB - nvram_state->mem_state[NVRAM_REG_AMI_BIG_MEMORY_HIGH]= 0x7; - nvram_state->mem_state[NVRAM_REG_AMI_BIG_MEMORY_LOW]= 0x00; + nvram_state->mem_state[NVRAM_REG_AMI_BIG_MEMORY_HIGH] = 0x7; + nvram_state->mem_state[NVRAM_REG_AMI_BIG_MEMORY_LOW] = 0x00; + + //nvram_state->mem_state[NVRAM_REG_AMI_BIG_MEMORY_HIGH]= 0x00; + //nvram_state->mem_state[NVRAM_REG_AMI_BIG_MEMORY_LOW]= 0x00; // This is the harddisk type.... Set accordingly... nvram_state->mem_state[NVRAM_IBM_HD_DATA] = 0x20; + // Set the shutdown status gently + // soft reset + nvram_state->mem_state[NVRAM_REG_SHUTDOWN_STATUS] = 0x0; + + + // RTC status A + // time update in progress, default timebase (32KHz, default interrupt rate 1KHz) + // 10100110 + nvram_state->mem_state[NVRAM_REG_STAT_A] = 0xa6; + + // RTC status B + // time updates, default timebase (32KHz, default interrupt rate 1KHz) + // 10100110 + //nvram_state->mem_state[NVRAM_REG_STAT_B] = 0xa6; + + + return 0; } @@ -128,7 +159,7 @@ int nvram_reset_device(struct vm_device * dev) { struct nvram_internal *data = (struct nvram_internal *) dev->private_data; - SerialPrint("nvram: reset device\n"); + PrintDebug("nvram: reset device\n"); @@ -146,14 +177,14 @@ int nvram_reset_device(struct vm_device * dev) int nvram_start_device(struct vm_device *dev) { - SerialPrint("nvram: start device\n"); + PrintDebug("nvram: start device\n"); return 0; } int nvram_stop_device(struct vm_device *dev) { - SerialPrint("nvram: stop device\n"); + PrintDebug("nvram: stop device\n"); return 0; } @@ -187,6 +218,12 @@ int nvram_read_data_port(ushort_t port, PrintDebug("nvram_read_data_port(0x%x)=0x%x\n", data->thereg, data->mem_state[data->thereg]); + // hack + if (data->thereg==NVRAM_REG_STAT_A) { + data->mem_state[data->thereg] ^= 0x80; // toggle Update in progess + } + + return 1; } @@ -210,7 +247,7 @@ int nvram_init_device(struct vm_device * dev) { struct nvram_internal *data = (struct nvram_internal *) dev->private_data; - SerialPrint("nvram: init_device\n"); + PrintDebug("nvram: init_device\n"); memset(data->mem_state, 0, NVRAM_REG_MAX); @@ -253,9 +290,9 @@ static struct vm_device_ops dev_ops = { struct vm_device *create_nvram() { - struct nvram_internal * nvram_state = os_hooks->malloc(sizeof(struct nvram_internal)+1000); + struct nvram_internal * nvram_state = (struct nvram_internal *)V3_Malloc(sizeof(struct nvram_internal)+1000); - SerialPrint("internal at %x\n",nvram_state); + PrintDebug("internal at %x\n",nvram_state); struct vm_device *device = create_device("NVRAM", &dev_ops, nvram_state);