i82439hx.cpp: start to support system management mode (nw)

This commit is contained in:
yz70s 2018-05-13 07:44:05 +02:00
parent 18c91a773f
commit 9f76c7b556
2 changed files with 27 additions and 2 deletions

View File

@ -78,6 +78,7 @@ void i82439hx_host_device::device_reset()
errcmd = 0x00;
errsts = 0x00;
errsyn = 0x00;
smiact_n = 1;
}
void i82439hx_host_device::map_extra(uint64_t memory_window_start, uint64_t memory_window_end, uint64_t memory_offset, address_space *memory_space,
@ -85,14 +86,23 @@ void i82439hx_host_device::map_extra(uint64_t memory_window_start, uint64_t memo
{
io_space->install_device(0, 0xffff, *static_cast<pci_host_device *>(this), &pci_host_device::io_configuration_access_map);
// memory hole at 512-640 kbytes
if((dramc & 0xc0) == 0x40)
memory_space->install_ram (0x00000000, 0x0007ffff, &ram[0x00000000/4]);
else
memory_space->install_ram (0x00000000, 0x0009ffff, &ram[0x00000000/4]);
if(smram & 0x40)
memory_space->install_ram (0x000a0000, 0x000bffff, &ram[0x000a0000/4]);
// assume that map_extra of the northbridge is called after the video card has mepped its memory here
if (smram & 0x08)
{
if (smiact_n == 0)
memory_space->install_ram(0x000a0000, 0x000bffff, &ram[0x000a0000 / 4]);
else
if (smram & 0x40)
memory_space->install_ram(0x000a0000, 0x000bffff, &ram[0x000a0000 / 4]);
}
// assume that map_extra of the northbridge is called after the one of the southbridge
if(pam[1] & 0x01)
memory_space->install_rom (0x000c0000, 0x000c3fff, &ram[0x000c0000/4]);
if(pam[1] & 0x02)
@ -147,6 +157,7 @@ void i82439hx_host_device::map_extra(uint64_t memory_window_start, uint64_t memo
memory_space->install_writeonly(0x000f0000, 0x000fffff, &ram[0x000f0000/4]);
memory_space->install_ram (0x00100000, 0x00efffff, &ram[0x00100000/4]);
// memory hole at 15-16 mbytes
if((dramc & 0xc0) != 0x80)
memory_space->install_ram (0x00f00000, 0x00ffffff, &ram[0x00f00000/4]);
@ -293,3 +304,14 @@ READ8_MEMBER (i82439hx_host_device::errsyn_r)
{
return errsyn;
}
WRITE_LINE_MEMBER(i82439hx_host_device::smi_act_w)
{
// state is 0 when smm is not active
// but smiact_n reflects the state of the SMIACT# pin
if (state == 0)
smiact_n = 1;
else
smiact_n = 0;
remap_cb();
}

View File

@ -21,6 +21,8 @@ public:
void set_cpu_tag(const char *tag);
void set_ram_size(int ram_size);
DECLARE_WRITE_LINE_MEMBER(smi_act_w);
protected:
virtual void device_start() override;
virtual void device_reset() override;
@ -41,6 +43,7 @@ private:
uint8_t pcon, cc, dramec, dramc, dramt;
uint8_t pam[7], drb[8];
uint8_t drt, drat, smram, errcmd, errsts, errsyn;
int smiact_n;
DECLARE_READ8_MEMBER (pcon_r);
DECLARE_WRITE8_MEMBER(pcon_w);