#include <palacios/vmm.h>
#include <palacios/vmm_types.h>
-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
// 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;
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;
+ //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;
}
{
struct nvram_internal *data = (struct nvram_internal *) dev->private_data;
- SerialPrint("nvram: reset device\n");
+ PrintDebug("nvram: reset device\n");
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;
}
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;
}
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);
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);