VOGONS


First post, by superfury

User metadata
Rank l33t++
Rank
l33t++

Does i430fx/i440fx chipsets have APM for powering the device off?

If so, how does this work on real hardware (inside SMM)?

Edit: Some more searching...
https://github.com/cirosantilli/ralf-brown-in … nter61d/PORTS.A

----------P00260027--------------------------
PORT 0026-0027 - INTEL 82347 POWER MANAGEMENT PERIPHERAL
SeeAlso: PORT 0178h-0179h

0026 -W index for data port (see #P0377)
0027 RW power management data

(Table P0377)
Values for Intel 82437 Power Management Peripheral register index:
C0h suspend/wakeup status, system state
C1h power supply and activity status, general-purpose output/control
C2h control bits
C3h activity mask
C4h NMI mask
C5h I/O range for activity monitor
C6h power output control bits, ON state
C7h power output control bits, Doze state
C8h power output control bits, Sleep state
C9h power output control bits, Suspend state
CAh power control bits polarity control
CBh current output bits
CCh Doze timeout
CDh Sleep timeout
CEh Suspend timeout
CFh LCD display power timeout
D0h EL display power timeout

https://github.com/cirosantilli/ralf-brown-in … nter61d/PORTS.B

----------P01780179--------------------------
PORT 0178-0179 - Power Management
SeeAlso: PORT 0026h,#P0377

0178 -W index selection for data port
0179 RW power management data

So perhaps a Intel 82437 mapped at both addresses?

Edit: https://archive.org/details/Intel-PeripheralC … ge/n73/mode/2up provides some insight into the chip:
The On/Doze/Sleep/Suspend state bits are the 8 output pins of the chip.

It provides a lot of details on the chip's programming at page 72 and onwards 😁

Named register indexes:

C0h	STATUS
C1h SUPPLY D1=Low battery, D2=Low battery (second warning). D4-D6=GPIN0-2, D7=ACPWR, R/O
C2h CONTROL default 10h.
C3h ACTMASK default 00h
C4h NMIMASK default 84h.
C5h IORNG default 00h
C6h PWRON default FFh
C7h PWRDOZE default FFh
C8h PWRSLEEP default 0Ch
C9h SUSPEND default 00h
CAh POLARITY default FFh
CBh OUTPUT reports effective outputs. sampled before polarity register?
CCh DOZE timer default 4 sec
CDh SLEEP timer default 2 min
CEh SUSPEND timer default 0
CFh LCD timer default 2 min
D0h EL timer default 2 min

Input pins:
LBAT: low battery
GPIO 0: full battery
RI from modem

Outputs:
PWGOUT and NMI to CPU

So, connected power pins are (PWR bits):
VP0 to LCD panel 5V
VP1 to LCD backlight
VP2 to power supply
VP4 to RS232
VP5 to modem (input ring on RI)?

PWRon drives almost all pins directly, inverted by POLARITY.

The polarity of it being 'on' in the PWR registers is determined by POLARITY. Setting a bit turns the VP setting high is the bit is that value (affecting the PWR registers) on the output of the chip. OUTPUT gives the result before applying the POLARITY register.

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 1 of 8, by superfury

User metadata
Rank l33t++
Rank
l33t++

OK. I've implemented the chip according to the found documentation fully (minus some CPU and outputs being handled by hardware (they're calculated though).

I don't see SMM using it though (using a test program from https://github.com/crgimenes/shutdown using quit.com)

I look at https://bochs.sourceforge.io/techspec/PORTS.LST to verify if I see any odd addresses by the BIOS ROM (the i440fx BIOS).

I see it using SMM a few times during boot. As well as when using the test program to try a shutdown. It also enters SMM when executing the quit.com program.
I see no port I/O though?

During POST itself, I see lots of addresses I need to filter out (various sound hardware and misc cards). Some interesting ones I see:
13f4h
fffch
fffdh
42ech-42efh. SMM executed immediately after?

Edit: Looking at the SMM code, it returns from the first two calls, then some interesting stuff happens on the power off command by the .COM program:

13f4
fffc
fffd
42ec-42ef. SMM immediately after?

SMM:
PCI 80000090?
-> address 91? Read 11h?
-> 90 write 000000000h
-> address 91 write 11h?
PCI 800008a8?
offset 2, so 8ac in PCI memory.
read ae of device #0 function #1. =STPCLK high timer.
device #1 function 0 select register A0. read 01h.
Mask with FEh.
Write back 00h.
Select register 59h on device #0 function #0. Read it. Value =30h.
Read register 58h of device #0.
And register 59h.
Write 30h to register 59.
Select register 0 on device #0.
Select device 1 register A8h.
Read register AAh. Read 80h. Cause is write to APM control register.
Detected. So got to 9F67:9A20.
Load 9A24 into SI(9C01).
Jump to 9F67:9A24
More lookup tables...
Jump to 9F67:9A82.
Select device 1 register A0h.
Read register A0h. Read 00h.
Write 00h to it.
Read port 03CCh. VGA misc output register. Read 67h.
Select device 1 register A0h.
Write register A2 value A0h. Trap on Fast Off-Timer and APMC Write.
Select A0 register again on PIIX.
Set it to 08h.
Select register A8 on PIIX.
Write value 00h to it.
Select A0h register again. Read 08h.
Select A0h.
Write 00h to it (SMI control).
Some port 61h read/writing.
Read back A0-A3 registers. Read 80000000h.
Select register 58h on on device #0.
Read register 59h (30h).
Set register to 10h. Reads from RAM, writes to PCI.
Select register 00h.
Select device 01h register A8h.
Clear register AAh (SMI request cause).
Write 01h to port B3 (was 0x01)
Select register A0h. Read 00h.
Write 01h to register A0h (enable SMI gate).
Select device #0 register 58h.
Write 59h value 30h (map BIOS to RAM r/w).
Reset PCI to register 00h.
RSM.

...

BIOS read 58h on device #0 (30h).
Show last 19 lines
Set to 10h.

...

Returns to software.

Function 530e called into BIOS.
Returns with carry flag clear.

Function call 5307h to turn off the system at 0F76:011A (using MS-DOS 6.22 without any drivers).

Select device #1 register 78h.
Write register 79h with 13h.
Select register 78h again.
Write register 78h with F0h. So Programmable Chip-Select Control register address 13F0?
Select port 13F0 in DX.
Write F0 to it. ??? What is this?

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 2 of 8, by superfury

User metadata
Rank l33t++
Rank
l33t++

So the function call 5307h is interesting. It sets PIIX Programmable Chip-Select Control register to I/O port 13F0 (selected by register 78h/79h), then writes 13F0 to it, using byte operations?

That's supposed to be the powerdown sequence?
What chip is it using on PIIX programmable chip-select?

Final INT15h call by the quit.com program:

Filename
i440fx_shutdown_sequence_finalINT15only.zip
File size
13.73 KiB
Downloads
8 downloads
File comment
Final INT15h call to shut the machine down.
File license
Fair use/fair dealing exception

Btw, the program has an error with the string termination being 0, instead of $ required by MS-DOS, so it dumps garbage after the end of the string printed it failed "APM error or not available" followed by garbage.

Attachments

  • Filename
    debugger_shutdown_i440fx.zip
    File size
    88.24 KiB
    Downloads
    8 downloads
    File comment
    APM BIOS followed by shutdown request from the program from segment 0F76h.
    File license
    Fair use/fair dealing exception

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 3 of 8, by superfury

User metadata
Rank l33t++
Rank
l33t++

I added some logging, I see the following before the i440fx memory testing:

Read from 21h, base address 20h, 16-bytes size.
Write to 21h, value FFh x2.
...
Write to 21h, value FEh.
Write to 29h, value 20h x2.
Write to 21h, value FFh.
Write to 21h, value 00h.
Read from 21h.
Write to 21h, value B8h.
- Memory test.

Edit: Implemented the PCS to log writes to it's (if enabled) I/O port range:

00:00:43:45.01392: PCS base: 0000, limit=0003, unmapped: 03
00:00:54:16.00844: PCS base: 0000, limit=0003, unmapped: 03
00:01:10:59.03696: PCS base: 0000, limit=0003, unmapped: 03
00:01:24:59.08432: PCS base: 0000, limit=0003, unmapped: 03
00:01:35:42.04680: PCS base: 0000, limit=0003, unmapped: 03
00:01:39:27.02032: PCS base: 0000, limit=0003, unmapped: 03
00:01:43:71.08600: PCS base: 0000, limit=0003, unmapped: 03
00:01:47:49.00488: PCS base: 0000, limit=0003, unmapped: 03
00:07:24:44.09632: PCS base: 1300, limit=0003, unmapped: 03
00:07:24:45.00912: PCS base: 1300, limit=0003, unmapped: 03
00:07:24:45.01136: PCS base: 13F0, limit=0003, unmapped: 00
00:07:24:45.01232: PCS base: 13F0, limit=0003, unmapped: 00
00:07:24:46.04640: PCS written: 00=F0

From 07:24:44 it's the shutdown commmand executing.
So it enables the PCS I/O range and writes F0h to byte I/O port PCS+00h to perform a shutdown somehow?
What really is the PCS chip?

Edit: Looking at the BIOS code for shutdown executing:
f000:0000802c 34 E4 xor ah,ah
AL from request being less or equal to 13h.
Lookup AL entry number in word-sized table into SI. Thus SI points to entry point of function number 07h (set power state).

BIU T1 E	f000:00008035 E8 59 08 call 00008891	Paged(w):0001f740=38(8); Physical(w):0001f740=38(8); RAM(w):0001f740=38(8); RealRAM(w):0001f740=38(8); Paged(w):0001f741=80( ); Physical(w):0001f741=80( ); RAM(w):0001f741=80( ); RealRAM(w):0001f741=80( )
Registers:
EAX: 0000000e EBX: 00000001 ECX: 00000003 EDX: 00020f76
ESP: 0000ffe2 EBP: 0000ffe2 ESI: 0000807f EDI: 00fffffe
CS: f000 DS: 0f76 ES: 0f76 FS: 0000 GS: 0000 SS: 0f76 TR: 0000 LDTR: 0000
EIP: 00008035 EFLAGS: 00000082
CR0: 00000010 CR2: 00000000 CR3: 00000000 CR4: 00000000
DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
DR6: 00000000 DR7: 00000000
GDTR: 00000008f466ffff IDTR: 00000000000003ff

return point at 8038h.
That function puts d9a0 into AX and adds F0h to AH.
That's loaded into DS (FD9A).
It eventually calls the loaded function number (from input AL into INT 15h):

BIU T1 E	f000:00008044 2E FF 14 call word cs:[si]	RealRAM(r):000f807f=8a( ); RAM(r):000f807f=8a( ); Physical(r):000f807f=8a( ); Paged(r):000f807f=8a( ); RealRAM(r):000f8080=82( ); RAM(r):000f8080=82( ); Physical(r):000f8080=82( ); Paged(r):000f8080=82( ); Paged(w):0001f740=47(G); Physical(w):0001f740=47(G); RAM(w):0001f740=47(G); RealRAM(w):0001f740=47(G); Paged(w):0001f741=80( ); Physical(w):0001f741=80( ); RAM(w):0001f741=80( ); RealRAM(w):0001f741=80( )
Registers:
EAX: 0000fd9a EBX: 00000001 ECX: 00000003 EDX: 00020f80
ESP: 0000ffe2 EBP: 0000ffe2 ESI: 0000807f EDI: 00fffffe
CS: f000 DS: fd9a ES: 0f76 FS: 0000 GS: 0000 SS: 0f76 TR: 0000 LDTR: 0000
EIP: 00008044 EFLAGS: 00000082
CR0: 00000010 CR2: 00000000 CR3: 00000000 CR4: 00000000
DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
DR6: 00000000 DR7: 00000000
GDTR: 00000008f466ffff IDTR: 00000000000003ff
CS descriptor: 0090930F0000FFFF
SS descriptor: 00909300F760FFFF
DS descriptor: 0090930FD9A0FFFF
ES descriptor: 00909300F760FFFF
FS descriptor: 009093000000FFFF
GS descriptor: 009093000000FFFF
TR descriptor: 00808B000000FFFF
LDTR descriptor: 008082000000FFFF
FLAGSINFO: 0000000000ipfavr0n00oditSz0a0p1c

It thus reaches: f000:000082a4 , which is because the CX input is 0003h.
Then it checks BX and finds it to be the full shutdown request:

BIU T1 -	f000:000082a6 83 FB 01 cmp bx,0001
Registers:
EAX: 00000993 EBX: 00000001 ECX: 00000003 EDX: 00020f80
ESP: 0000ffe0 EBP: 0000ffe2 ESI: 0000807f EDI: 00fffffe
CS: f000 DS: fd9a ES: 0f76 FS: 0000 GS: 0000 SS: 0f76 TR: 0000 LDTR: 0000
EIP: 000082a6 EFLAGS: 00000046
CR0: 00000010 CR2: 00000000 CR3: 00000000 CR4: 00000000
DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
DR6: 00000000 DR7: 00000000
GDTR: 00000008f466ffff IDTR: 00000000000003ff
CS descriptor: 0090930F0000FFFF
SS descriptor: 00909300F760FFFF
DS descriptor: 0090930FD9A0FFFF
ES descriptor: 00909300F760FFFF
FS descriptor: 009093000000FFFF
GS descriptor: 009093000000FFFF
TR descriptor: 00808B000000FFFF
LDTR descriptor: 008082000000FFFF
FLAGSINFO: 0000000000ipfavr0n00oditsZ0a0P1c
BIU T1 I RealRAM(p):000f82b5=73(s); RAM(p):000f82b5=73(s); Physical(p):000f82b5=73(s); Paged(p):000f82b5=73(s); Normal(p):000082b5=73(s); RealRAM(p):000f82b6=1a(); RAM(p):000f82b6=1a(); Physical(p):000f82b6=1a(); Paged(p):000f82b6=1a(); Normal(p):000082b6=1a(); RealRAM(p):000f82b7=a0( ); RAM(p):000f82b7=a0( ); Physical(p):000f82b7=a0( ); Paged(p):000f82b7=a0( ); Normal(p):000082b7=a0( )
BIU T1 E f000:000082a9 74 1A jz 000082c5
Registers:
EAX: 00000993 EBX: 00000001 ECX: 00000003 EDX: 00020f80
ESP: 0000ffe0 EBP: 0000ffe2 ESI: 0000807f EDI: 00fffffe
CS: f000 DS: fd9a ES: 0f76 FS: 0000 GS: 0000 SS: 0f76 TR: 0000 LDTR: 0000
EIP: 000082a9 EFLAGS: 00000046
CR0: 00000010 CR2: 00000000 CR3: 00000000 CR4: 00000000
DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
DR6: 00000000 DR7: 00000000
GDTR: 00000008f466ffff IDTR: 00000000000003ff
CS descriptor: 0090930F0000FFFF
SS descriptor: 00909300F760FFFF
DS descriptor: 0090930FD9A0FFFF
ES descriptor: 00909300F760FFFF
FS descriptor: 009093000000FFFF
GS descriptor: 009093000000FFFF
TR descriptor: 00808B000000FFFF
LDTR descriptor: 008082000000FFFF
FLAGSINFO: 0000000000ipfavr0n00oditsZ0a0P1c
BIU T1 I RealRAM(p):000f82c5=b4( ); RAM(p):000f82c5=b4( ); Physical(p):000f82c5=b4( ); Paged(p):000f82c5=b4( ); Normal(p):000082c5=b4( ); RealRAM(p):000f82c6=0a( ); RAM(p):000f82c6=0a( ); Physical(p):000f82c6=0a( ); Paged(p):000f82c6=0a( ); Normal(p):000082c6=0a( ); RealRAM(p):000f82c7=83( ); RAM(p):000f82c7=83( ); Physical(p):000f82c7=83( ); Paged(p):000f82c7=83( ); Normal(p):000082c7=83( ); RealRAM(p):000f82c8=f9( ); RAM(p):000f82c8=f9( ); Physical(p):000f82c8=f9( ); Paged(p):000f82c8=f9( ); Normal(p):000082c8=f9( ); RealRAM(p):000f82c9=06(); RAM(p):000f82c9=06(); Physical(p):000f82c9=06(); Paged(p):000f82c9=06(); Normal(p):000082c9=06(); RealRAM(p):000f82ca=73(s); RAM(p):000f82ca=73(s); Physical(p):000f82ca=73(s); Paged(p):000f82ca=73(s); Normal(p):000082ca=73(s); RealRAM(p):000f82cb=05(); RAM(p):000f82cb=05(); Physical(p):000f82cb=05(); Paged(p):000f82cb=05(); Normal(p):000082cb=05(); RealRAM(p):000f82cc=be( ); RAM(p):000f82cc=be( ); Physical(p):000f82cc=be( ); Paged(p):000f82cc=be( ); Normal(p):000082cc=be( ); RealRAM(p):000f82cd=d3( ); RAM(p):000f82cd=d3( ); Physical(p):000f82cd=d3( ); Paged(p):000f82cd=d3( ); Normal(p):000082cd=d3( ); RealRAM(p):000f82ce=82( ); RAM(p):000f82ce=82( ); Physical(p):000f82ce=82( ); Paged(p):000f82ce=82( ); Normal(p):000082ce=82( ); RealRAM(p):000f82cf=eb( ); RAM(p):000f82cf=eb( ); Physical(p):000f82cf=eb( ); Paged(p):000f82cf=eb( ); Normal(p):000082cf=eb( ); RealRAM(p):000f82d0=16(); RAM(p):000f82d0=16(); Physical(p):000f82d0=16(); Paged(p):000f82d0=16(); Normal(p):000082d0=16(); RealRAM(p):000f82d1=f9( ); RAM(p):000f82d1=f9( ); Physical(p):000f82d1=f9( ); Paged(p):000f82d1=f9( ); Normal(p):000082d1=f9( ); RealRAM(p):000f82d2=c3( ); RAM(p):000f82d2=c3( ); Physical(p):000f82d2=c3( ); Paged(p):000f82d2=c3( ); Normal(p):000082d2=c3( ); RealRAM(p):000f82d3=ee( ); RAM(p):000f82d3=ee( ); Physical(p):000f82d3=ee( ); Paged(p):000f82d3=ee( ); Normal(p):000082d3=ee( )
BIU T1 - f000:000082c5 B4 0A mov ah,0a
Registers:
EAX: 00000993 EBX: 00000001 ECX: 00000003 EDX: 00020f80
ESP: 0000ffe0 EBP: 0000ffe2 ESI: 0000807f EDI: 00fffffe
CS: f000 DS: fd9a ES: 0f76 FS: 0000 GS: 0000 SS: 0f76 TR: 0000 LDTR: 0000
EIP: 000082c5 EFLAGS: 00000046
CR0: 00000010 CR2: 00000000 CR3: 00000000 CR4: 00000000
DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
DR6: 00000000 DR7: 00000000
GDTR: 00000008f466ffff IDTR: 00000000000003ff
CS descriptor: 0090930F0000FFFF
SS descriptor: 00909300F760FFFF
DS descriptor: 0090930FD9A0FFFF
ES descriptor: 00909300F760FFFF
FS descriptor: 009093000000FFFF
GS descriptor: 009093000000FFFF
TR descriptor: 00808B000000FFFF
LDTR descriptor: 008082000000FFFF

f000:000082c5 is the start of the full poweroff being detected by the BIOS.
It checks CX for the requested state again, according to http://www.ctyme.com/intr/rb-1401.htm#Table475 (checks for CX=0006h).

BIU T1 -	f000:000082c7 83 F9 06 cmp cx,0006

Finds it's less,. this reaches:

BIU T1 -	f000:000082cc BE D3 82 mov si,82d3
Registers:
EAX: 00000a93 EBX: 00000001 ECX: 00000003 EDX: 00020f80
ESP: 0000ffe0 EBP: 0000ffe2 ESI: 0000807f EDI: 00fffffe
CS: f000 DS: fd9a ES: 0f76 FS: 0000 GS: 0000 SS: 0f76 TR: 0000 LDTR: 0000
EIP: 000082cc EFLAGS: 00000093
CR0: 00000010 CR2: 00000000 CR3: 00000000 CR4: 00000000
DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
DR6: 00000000 DR7: 00000000
GDTR: 00000008f466ffff IDTR: 00000000000003ff
CS descriptor: 0090930F0000FFFF
SS descriptor: 00909300F760FFFF
DS descriptor: 0090930FD9A0FFFF
ES descriptor: 00909300F760FFFF
FS descriptor: 009093000000FFFF
GS descriptor: 009093000000FFFF
TR descriptor: 00808B000000FFFF
LDTR descriptor: 008082000000FFFF
FLAGSINFO: 0000000000ipfavr0n00oditSz0A0p1C

It adds the requested state to SI to get a lookup for the requested power state (0003h), then jumps to:

BIU T1 -	f000:00008333 80 3E 0F 00 10 cmp byte ds:[000f],10	RealRAM(r):000fd9af=12(); RAM(r):000fd9af=12(); Physical(r):000fd9af=12(); Paged(r):000fd9af=12()
Registers:
EAX: 00000a93 EBX: 00000001 ECX: 00000006 EDX: 00020f80
ESP: 0000ffe0 EBP: 0000ffe2 ESI: 000082d9 EDI: 00fffffe
CS: f000 DS: fd9a ES: 0f76 FS: 0000 GS: 0000 SS: 0f76 TR: 0000 LDTR: 0000
EIP: 00008333 EFLAGS: 00000082
CR0: 00000010 CR2: 00000000 CR3: 00000000 CR4: 00000000
DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
DR6: 00000000 DR7: 00000000
GDTR: 00000008f466ffff IDTR: 00000000000003ff
CS descriptor: 0090930F0000FFFF
SS descriptor: 00909300F760FFFF
DS descriptor: 0090930FD9A0FFFF
ES descriptor: 00909300F760FFFF
FS descriptor: 009093000000FFFF
GS descriptor: 009093000000FFFF
TR descriptor: 00808B000000FFFF
LDTR descriptor: 008082000000FFFF
FLAGSINFO: 0000000000ipfavr0n00oditSz0a0p1c

It checks some BIOS setting, then jumps to f000:0000833E because it's 10h.

BIU T1 S		RealRAM(p):000f8333=80( ); RAM(p):000f8333=80( ); Physical(p):000f8333=80( ); Paged(p):000f8333=80( ); Normal(p):00008333=80( ); RealRAM(p):000f8334=3e(>); RAM(p):000f8334=3e(>); Physical(p):000f8334=3e(>); Paged(p):000f8334=3e(>); Normal(p):00008334=3e(>); RealRAM(p):000f8335=0f(); RAM(p):000f8335=0f(); Physical(p):000f8335=0f(); Paged(p):000f8335=0f(); Normal(p):00008335=0f(); RealRAM(p):000f8336=00( ); RAM(p):000f8336=00( ); Physical(p):000f8336=00( ); Paged(p):000f8336=00( ); Normal(p):00008336=00( ); RealRAM(p):000f8337=10(); RAM(p):000f8337=10(); Physical(p):000f8337=10(); Paged(p):000f8337=10(); Normal(p):00008337=10(); RealRAM(p):000f8338=75(u); RAM(p):000f8338=75(u); Physical(p):000f8338=75(u); Paged(p):000f8338=75(u); Normal(p):00008338=75(u); RealRAM(p):000f8339=04(); RAM(p):000f8339=04(); Physical(p):000f8339=04(); Paged(p):000f8339=04(); Normal(p):00008339=04(); RealRAM(p):000f833a=b4( ); RAM(p):000f833a=b4( ); Physical(p):000f833a=b4( ); Paged(p):000f833a=b4( ); Normal(p):0000833a=b4( ); RealRAM(p):000f833b=60(`); RAM(p):000f833b=60(`); Physical(p):000f833b=60(`); Paged(p):000f833b=60(`); Normal(p):0000833b=60(`); RealRAM(p):000f833c=f9( ); RAM(p):000f833c=f9( ); Physical(p):000f833c=f9( ); Paged(p):000f833c=f9( ); Normal(p):0000833c=f9( ); RealRAM(p):000f833d=c3( ); RAM(p):000f833d=c3( ); Physical(p):000f833d=c3( ); Paged(p):000f833d=c3( ); Normal(p):0000833d=c3( ); RealRAM(p):000f833e=e8( ); RAM(p):000f833e=e8( ); Physical(p):000f833e=e8( ); Paged(p):000f833e=e8( ); Normal(p):0000833e=e8( ); RealRAM(p):000f833f=e0( ); RAM(p):000f833f=e0( ); Physical(p):000f833f=e0( ); Paged(p):000f833f=e0( ); Normal(p):0000833f=e0( ); RealRAM(p):000f8340=05(); RAM(p):000f8340=05(); Physical(p):000f8340=05(); Paged(p):000f8340=05(); Normal(p):00008340=05(); RealRAM(p):000f8341=73(s); RAM(p):000f8341=73(s); Physical(p):000f8341=73(s); Paged(p):000f8341=73(s); Normal(p):00008341=73(s)
BIU T1 - f000:00008333 80 3E 0F 00 10 cmp byte ds:[000f],10 RealRAM(r):000fd9af=12(); RAM(r):000fd9af=12(); Physical(r):000fd9af=12(); Paged(r):000fd9af=12()
Registers:
EAX: 00000a93 EBX: 00000001 ECX: 00000006 EDX: 00020f80
ESP: 0000ffe0 EBP: 0000ffe2 ESI: 000082d9 EDI: 00fffffe
CS: f000 DS: fd9a ES: 0f76 FS: 0000 GS: 0000 SS: 0f76 TR: 0000 LDTR: 0000
EIP: 00008333 EFLAGS: 00000082
CR0: 00000010 CR2: 00000000 CR3: 00000000 CR4: 00000000
DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
DR6: 00000000 DR7: 00000000
GDTR: 00000008f466ffff IDTR: 00000000000003ff
CS descriptor: 0090930F0000FFFF
SS descriptor: 00909300F760FFFF
DS descriptor: 0090930FD9A0FFFF
ES descriptor: 00909300F760FFFF
FS descriptor: 009093000000FFFF
GS descriptor: 009093000000FFFF
TR descriptor: 00808B000000FFFF
LDTR descriptor: 008082000000FFFF
FLAGSINFO: 0000000000ipfavr0n00oditSz0a0p1c
BIU T1 I RealRAM(p):000f8342=03(); RAM(p):000f8342=03(); Physical(p):000f8342=03(); Paged(p):000f8342=03(); Normal(p):00008342=03(); RealRAM(p):000f8343=b4( ); RAM(p):000f8343=b4( ); Physical(p):000f8343=b4( ); Paged(p):000f8343=b4( ); Normal(p):00008343=b4( ); RealRAM(p):000f8344=60(`); RAM(p):000f8344=60(`); Physical(p):000f8344=60(`); Paged(p):000f8344=60(`); Normal(p):00008344=60(`); RealRAM(p):000f8345=c3( ); RAM(p):000f8345=c3( ); Physical(p):000f8345=c3( ); Paged(p):000f8345=c3( ); Normal(p):00008345=c3( ); RealRAM(p):000f8346=f8( ); RAM(p):000f8346=f8( ); Physical(p):000f8346=f8( ); Paged(p):000f8346=f8( ); Normal(p):00008346=f8( )
BIU T1 E f000:00008338 75 04 jnz 0000833e
Registers:
EAX: 00000a93 EBX: 00000001 ECX: 00000006 EDX: 00020f80
ESP: 0000ffe0 EBP: 0000ffe2 ESI: 000082d9 EDI: 00fffffe
CS: f000 DS: fd9a ES: 0f76 FS: 0000 GS: 0000 SS: 0f76 TR: 0000 LDTR: 0000
EIP: 00008338 EFLAGS: 00000002
CR0: 00000010 CR2: 00000000 CR3: 00000000 CR4: 00000000
DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
DR6: 00000000 DR7: 00000000
GDTR: 00000008f466ffff IDTR: 00000000000003ff
CS descriptor: 0090930F0000FFFF
SS descriptor: 00909300F760FFFF
DS descriptor: 0090930FD9A0FFFF
ES descriptor: 00909300F760FFFF
FS descriptor: 009093000000FFFF
GS descriptor: 009093000000FFFF
TR descriptor: 00808B000000FFFF
LDTR descriptor: 008082000000FFFF
FLAGSINFO: 0000000000ipfavr0n00oditsz0a0p1c
BIU T1 I RealRAM(p):000f833e=e8( ); RAM(p):000f833e=e8( ); Physical(p):000f833e=e8( ); Paged(p):000f833e=e8( ); Normal(p):0000833e=e8( ); RealRAM(p):000f833f=e0( ); RAM(p):000f833f=e0( ); Physical(p):000f833f=e0( ); Paged(p):000f833f=e0( ); Normal(p):0000833f=e0( ); RealRAM(p):000f8340=05(); RAM(p):000f8340=05(); Physical(p):000f8340=05(); Paged(p):000f8340=05(); Normal(p):00008340=05(); RealRAM(p):000f8341=73(s); RAM(p):000f8341=73(s); Physical(p):000f8341=73(s); Paged(p):000f8341=73(s); Normal(p):00008341=73(s); RealRAM(p):000f8342=03(); RAM(p):000f8342=03(); Physical(p):000f8342=03(); Paged(p):000f8342=03(); Normal(p):00008342=03(); RealRAM(p):000f8343=b4( ); RAM(p):000f8343=b4( ); Physical(p):000f8343=b4( ); Paged(p):000f8343=b4( ); Normal(p):00008343=b4( ); RealRAM(p):000f8344=60(`); RAM(p):000f8344=60(`); Physical(p):000f8344=60(`); Paged(p):000f8344=60(`); Normal(p):00008344=60(`); RealRAM(p):000f8345=c3( ); RAM(p):000f8345=c3( ); Physical(p):000f8345=c3( ); Paged(p):000f8345=c3( ); Normal(p):00008345=c3( ); RealRAM(p):000f8346=f8( ); RAM(p):000f8346=f8( ); Physical(p):000f8346=f8( ); Paged(p):000f8346=f8( ); Normal(p):00008346=f8( ); RealRAM(p):000f8347=c3( ); RAM(p):000f8347=c3( ); Physical(p):000f8347=c3( ); Paged(p):000f8347=c3( ); Normal(p):00008347=c3( ); RealRAM(p):000f8348=80( ); RAM(p):000f8348=80( ); Physical(p):000f8348=80( ); Paged(p):000f8348=80( ); Normal(p):00008348=80( ); RealRAM(p):000f8349=3e(>); RAM(p):000f8349=3e(>); Physical(p):000f8349=3e(>); Paged(p):000f8349=3e(>); Normal(p):00008349=3e(>); RealRAM(p):000f834a=0b(
); RAM(p):000f834a=0b(
); Physical(p):000f834a=0b(
); Paged(p):000f834a=0b(
); Normal(p):0000834a=0b(
); RealRAM(p):000f834b=00( ); RAM(p):000f834b=00( ); Physical(p):000f834b=00( ); Paged(p):000f834b=00( ); Normal(p):0000834b=00( ); RealRAM(p):000f834c=01(); RAM(p):000f834c=01(); Physical(p):000f834c=01(); Paged(p):000f834c=01(); Normal(p):0000834c=01()
BIU T1 E f000:0000833e E8 E0 05 call 00008921 Paged(w):0001f73e=41(A); Physical(w):0001f73e=41(A); RAM(w):0001f73e=41(A); RealRAM(w):0001f73e=41(A); Paged(w):0001f73f=83( ); Physical(w):0001f73f=83( ); RAM(w):0001f73f=83( ); RealRAM(w):0001f73f=83( )
Registers:
EAX: 00000a93 EBX: 00000001 ECX: 00000006 EDX: 00020f80
ESP: 0000ffe0 EBP: 0000ffe2 ESI: 000082d9 EDI: 00fffffe
CS: f000 DS: fd9a ES: 0f76 FS: 0000 GS: 0000 SS: 0f76 TR: 0000 LDTR: 0000
EIP: 0000833e EFLAGS: 00000002
CR0: 00000010 CR2: 00000000 CR3: 00000000 CR4: 00000000
DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
DR6: 00000000 DR7: 00000000
GDTR: 00000008f466ffff IDTR: 00000000000003ff
CS descriptor: 0090930F0000FFFF
SS descriptor: 00909300F760FFFF
DS descriptor: 0090930FD9A0FFFF
ES descriptor: 00909300F760FFFF
Show last 6 lines
FS descriptor: 009093000000FFFF
GS descriptor: 009093000000FFFF
TR descriptor: 00808B000000FFFF
LDTR descriptor: 008082000000FFFF
FLAGSINFO: 0000000000ipfavr0n00oditsz0a0p1c

That calls function f000:0000888b from function f000:0008921.
That function setting up of that PCS chip at 13h into the high port number.
Then it returns to function f000:0000888b at:

BIU T1 -	f000:00008929 B1 78 mov cl,78
Registers:
EAX: 80000113 EBX: 00000001 ECX: 00000879 EDX: 00020cfd
ESP: 0000ffde EBP: 0000ffe2 ESI: 000082d9 EDI: 00fffffe
CS: f000 DS: fd9a ES: 0f76 FS: 0000 GS: 0000 SS: 0f76 TR: 0000 LDTR: 0000
EIP: 00008929 EFLAGS: 00000082
CR0: 00000010 CR2: 00000000 CR3: 00000000 CR4: 00000000
DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
DR6: 00000000 DR7: 00000000
GDTR: 00000008f466ffff IDTR: 00000000000003ff
CS descriptor: 0090930F0000FFFF
SS descriptor: 00909300F760FFFF
DS descriptor: 0090930FD9A0FFFF
ES descriptor: 00909300F760FFFF
FS descriptor: 009093000000FFFF
GS descriptor: 009093000000FFFF
TR descriptor: 00808B000000FFFF
LDTR descriptor: 008082000000FFFF
FLAGSINFO: 0000000000ipfavr0n00oditSz0a0p1c

It then sets AL to F0h and calls the function f000:0000888b again.
That then writes F0h to the low PCS register, enabling the register for 4-byte access at address 13F0h.
That once again returns to function f000:0000888b again.
This time the function writes to the base port that's setup just now, completing the action:

BIU T1 -	f000:00008930 BA F0 13 mov dx,13f0
Registers:
EAX: 800000f0 EBX: 00000001 ECX: 00000878 EDX: 00020cfc
ESP: 0000ffde EBP: 0000ffe2 ESI: 000082d9 EDI: 00fffffe
CS: f000 DS: fd9a ES: 0f76 FS: 0000 GS: 0000 SS: 0f76 TR: 0000 LDTR: 0000
EIP: 00008930 EFLAGS: 00000086
CR0: 00000010 CR2: 00000000 CR3: 00000000 CR4: 00000000
DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
DR6: 00000000 DR7: 00000000
GDTR: 00000008f466ffff IDTR: 00000000000003ff
CS descriptor: 0090930F0000FFFF
SS descriptor: 00909300F760FFFF
DS descriptor: 0090930FD9A0FFFF
ES descriptor: 00909300F760FFFF
FS descriptor: 009093000000FFFF
GS descriptor: 009093000000FFFF
TR descriptor: 00808B000000FFFF
LDTR descriptor: 008082000000FFFF
FLAGSINFO: 0000000000ipfavr0n00oditSz0a0P1c
BIU T1 I RealRAM(p):000f893f=c6( ); RAM(p):000f893f=c6( ); Physical(p):000f893f=c6( ); Paged(p):000f893f=c6( ); Normal(p):0000893f=c6( ); RealRAM(p):000f8940=06(); RAM(p):000f8940=06(); Physical(p):000f8940=06(); Paged(p):000f8940=06(); Normal(p):00008940=06(); RealRAM(p):000f8941=12(); RAM(p):000f8941=12(); Physical(p):000f8941=12(); Paged(p):000f8941=12(); Normal(p):00008941=12()
BIU T1 - f000:00008933 EE out dx,al IO(w):13f0=f0( )
Registers:
EAX: 800000f0 EBX: 00000001 ECX: 00000878 EDX: 000213f0
ESP: 0000ffde EBP: 0000ffe2 ESI: 000082d9 EDI: 00fffffe
CS: f000 DS: fd9a ES: 0f76 FS: 0000 GS: 0000 SS: 0f76 TR: 0000 LDTR: 0000
EIP: 00008933 EFLAGS: 00000086
CR0: 00000010 CR2: 00000000 CR3: 00000000 CR4: 00000000
DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
DR6: 00000000 DR7: 00000000
GDTR: 00000008f466ffff IDTR: 00000000000003ff
CS descriptor: 0090930F0000FFFF
SS descriptor: 00909300F760FFFF
DS descriptor: 0090930FD9A0FFFF
ES descriptor: 00909300F760FFFF
FS descriptor: 009093000000FFFF
GS descriptor: 009093000000FFFF
TR descriptor: 00808B000000FFFF
LDTR descriptor: 008082000000FFFF
FLAGSINFO: 0000000000ipfavr0n00oditSz0a0P1c
BIU T1 I RealRAM(p):000f8942=00( ); RAM(p):000f8942=00( ); Physical(p):000f8942=00( ); Paged(p):000f8942=00( ); Normal(p):00008942=00( )
BIU T1 - f000:00008934 F8 clc
Registers:
EAX: 800000f0 EBX: 00000001 ECX: 00000878 EDX: 000213f0
ESP: 0000ffde EBP: 0000ffe2 ESI: 000082d9 EDI: 00fffffe
CS: f000 DS: fd9a ES: 0f76 FS: 0000 GS: 0000 SS: 0f76 TR: 0000 LDTR: 0000
EIP: 00008934 EFLAGS: 00000086
CR0: 00000010 CR2: 00000000 CR3: 00000000 CR4: 00000000
DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
DR6: 00000000 DR7: 00000000
GDTR: 00000008f466ffff IDTR: 00000000000003ff
CS descriptor: 0090930F0000FFFF
SS descriptor: 00909300F760FFFF
DS descriptor: 0090930FD9A0FFFF
ES descriptor: 00909300F760FFFF
FS descriptor: 009093000000FFFF
GS descriptor: 009093000000FFFF
TR descriptor: 00808B000000FFFF
LDTR descriptor: 008082000000FFFF
FLAGSINFO: 0000000000ipfavr0n00oditSz0a0P1c
BIU T1 I RealRAM(p):000f8943=07( ); RAM(p):000f8943=07( ); Physical(p):000f8943=07( ); Paged(p):000f8943=07( ); Normal(p):00008943=07( )
Show last 20 lines
BIU T1 E	f000:00008935 C3 ret	RealRAM(r):0001f73e=41(A); RAM(r):0001f73e=41(A); Physical(r):0001f73e=41(A); Paged(r):0001f73e=41(A); RealRAM(r):0001f73f=83( ); RAM(r):0001f73f=83( ); Physical(r):0001f73f=83( ); Paged(r):0001f73f=83( )
Registers:
EAX: 800000f0 EBX: 00000001 ECX: 00000878 EDX: 000213f0
ESP: 0000ffde EBP: 0000ffe2 ESI: 000082d9 EDI: 00fffffe
CS: f000 DS: fd9a ES: 0f76 FS: 0000 GS: 0000 SS: 0f76 TR: 0000 LDTR: 0000
EIP: 00008935 EFLAGS: 00000086
CR0: 00000010 CR2: 00000000 CR3: 00000000 CR4: 00000000
DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
DR6: 00000000 DR7: 00000000
GDTR: 00000008f466ffff IDTR: 00000000000003ff
CS descriptor: 0090930F0000FFFF
SS descriptor: 00909300F760FFFF
DS descriptor: 0090930FD9A0FFFF
ES descriptor: 00909300F760FFFF
FS descriptor: 009093000000FFFF
GS descriptor: 009093000000FFFF
TR descriptor: 00808B000000FFFF
LDTR descriptor: 008082000000FFFF
FLAGSINFO: 0000000000ipfavr0n00oditSz0a0P1c

It's returned success by clearing the carry flag and returns to the caller.
It then returns back to caller through each stack frame, keeps checking CF for errors (which is cleared for no error) until it reaches the INT 15h function call IRET.

BIU T1 E	f000:0000805f CF iret	RealRAM(r):0001f758=25(%); RAM(r):0001f758=25(%); Physical(r):0001f758=25(%); Paged(r):0001f758=25(%); RealRAM(r):0001f759=01(); RAM(r):0001f759=01(); Physical(r):0001f759=01(); Paged(r):0001f759=01(); RealRAM(r):0001f75a=76(v); RAM(r):0001f75a=76(v); Physical(r):0001f75a=76(v); Paged(r):0001f75a=76(v); RealRAM(r):0001f75b=0f(); RAM(r):0001f75b=0f(); Physical(r):0001f75b=0f(); Paged(r):0001f75b=0f(); RealRAM(r):0001f75c=46(F); RAM(r):0001f75c=46(F); Physical(r):0001f75c=46(F); Paged(r):0001f75c=46(F); RealRAM(r):0001f75d=02(); RAM(r):0001f75d=02(); Physical(r):0001f75d=02(); Paged(r):0001f75d=02()
Registers:
EAX: 00005307 EBX: 00000001 ECX: 00000003 EDX: 00020f76
ESP: 0000fff8 EBP: 0000091c ESI: 00000100 EDI: 00fffffe
CS: f000 DS: 0f76 ES: 0f76 FS: 0000 GS: 0000 SS: 0f76 TR: 0000 LDTR: 0000
EIP: 0000805f EFLAGS: 00000086
CR0: 00000010 CR2: 00000000 CR3: 00000000 CR4: 00000000
DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
DR6: 00000000 DR7: 00000000
GDTR: 00000008f466ffff IDTR: 00000000000003ff
CS descriptor: 0090930F0000FFFF
SS descriptor: 00909300F760FFFF
DS descriptor: 00909300F760FFFF
ES descriptor: 00909300F760FFFF
FS descriptor: 009093000000FFFF
GS descriptor: 009093000000FFFF
TR descriptor: 00808B000000FFFF
LDTR descriptor: 008082000000FFFF
FLAGSINFO: 0000000000ipfavr0n00oditSz0a0P1c
BIU T1 I RealRAM(p):0000f885=f4( ); RAM(p):0000f885=f4( ); Physical(p):0000f885=f4( ); Paged(p):0000f885=f4( ); Normal(p):00000125=f4( ); RealRAM(p):0000f886=ba( ); RAM(p):0000f886=ba( ); Physical(p):0000f886=ba( ); Paged(p):0000f886=ba( ); Normal(p):00000126=ba( ); RealRAM(p):0000f887=32(2); RAM(p):0000f887=32(2); Physical(p):0000f887=32(2); Paged(p):0000f887=32(2); Normal(p):00000127=32(2); RealRAM(p):0000f888=01(); RAM(p):0000f888=01(); Physical(p):0000f888=01(); Paged(p):0000f888=01(); Normal(p):00000128=01(); RealRAM(p):0000f889=b4( ); RAM(p):0000f889=b4( ); Physical(p):0000f889=b4( ); Paged(p):0000f889=b4( ); Normal(p):00000129=b4( ); RealRAM(p):0000f88a=09( ); RAM(p):0000f88a=09( ); Physical(p):0000f88a=09( ); Paged(p):0000f88a=09( ); Normal(p):0000012a=09( ); RealRAM(p):0000f88b=cd( ); RAM(p):0000f88b=cd( ); Physical(p):0000f88b=cd( ); Paged(p):0000f88b=cd( ); Normal(p):0000012b=cd( ); RealRAM(p):0000f88c=21(!); RAM(p):0000f88c=21(!); Physical(p):0000f88c=21(!); Paged(p):0000f88c=21(!); Normal(p):0000012c=21(!); RealRAM(p):0000f88d=b8( ); RAM(p):0000f88d=b8( ); Physical(p):0000f88d=b8( ); Paged(p):0000f88d=b8( ); Normal(p):0000012d=b8( ); RealRAM(p):0000f88e=ff( ); RAM(p):0000f88e=ff( ); Physical(p):0000f88e=ff( ); Paged(p):0000f88e=ff( ); Normal(p):0000012e=ff( ); RealRAM(p):0000f88f=4c(L); RAM(p):0000f88f=4c(L); Physical(p):0000f88f=4c(L); Paged(p):0000f88f=4c(L); Normal(p):0000012f=4c(L); RealRAM(p):0000f890=cd( ); RAM(p):0000f890=cd( ); Physical(p):0000f890=cd( ); Paged(p):0000f890=cd( ); Normal(p):00000130=cd( ); RealRAM(p):0000f891=21(!); RAM(p):0000f891=21(!); Physical(p):0000f891=21(!); Paged(p):0000f891=21(!); Normal(p):00000131=21(!); RealRAM(p):0000f892=41(A); RAM(p):0000f892=41(A); Physical(p):0000f892=41(A); Paged(p):0000f892=41(A); Normal(p):00000132=41(A); RealRAM(p):0000f893=50(P); RAM(p):0000f893=50(P); Physical(p):0000f893=50(P); Paged(p):0000f893=50(P); Normal(p):00000133=50(P)
BIU T1 - 0f76:00000125 F4 hlt
Registers:
EAX: 00005307 EBX: 00000001 ECX: 00000003 EDX: 00020f76
ESP: 0000fffe EBP: 0000091c ESI: 00000100 EDI: 00fffffe
CS: 0f76 DS: 0f76 ES: 0f76 FS: 0000 GS: 0000 SS: 0f76 TR: 0000 LDTR: 0000
EIP: 00000125 EFLAGS: 00000246
CR0: 00000010 CR2: 00000000 CR3: 00000000 CR4: 00000000
DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
DR6: 00000000 DR7: 00000000
GDTR: 00000008f466ffff IDTR: 00000000000003ff
CS descriptor: 00909300F760FFFF
SS descriptor: 00909300F760FFFF
DS descriptor: 00909300F760FFFF
ES descriptor: 00909300F760FFFF
FS descriptor: 009093000000FFFF
GS descriptor: 009093000000FFFF
TR descriptor: 00808B000000FFFF
LDTR descriptor: 008082000000FFFF

The quit.com program at segment 0f76 (returned to 0f76:00000125) then proceeds to halt the system to wait for the power supply to terminate power. Carry flag is indeed cleared, so the BIOS thinks it's just requested a poweroff from the hardware.

So it looks like the writing of the byte F0h to the base address of the PCS chip (whatever chip it is) really is supposed to cut off the power to the motherboard (the BIOS returning success is confirming that).

Last edited by superfury on 2024-03-17, 15:56. Edited 4 times in total.

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 4 of 8, by Battler

User metadata
Rank Member
Rank
Member

There is no power down sequence for the PIIX3, but Intel boards set up the PC87306 Super I/O chip to do a power down when the power supply is ATX, on ports 78h and 79h (the Super I/O chip's GPIO registers).

Reply 5 of 8, by superfury

User metadata
Rank l33t++
Rank
l33t++

But looking at what the BIOS does doesn't match anything sane with what the program is requesting and what the BIOS writes to register address 0 on said device?
The port written by the request is at 13F0 (configured to 13F0) with value F0 written to that address.

Looking at the address x0 on said chip you've mentioned doesn't match anything that would match the top 4 bits set and bottom bits cleared with a full poweroff request?

The writing of the register really confirms that the chip at PCS is actually performing power supply poweroff, probably even more.

Though I'd need a COM program to check what the other power states do with said registers to be sure.
Luckily the source code is open-sourced, so it's easy to adapt.

Perhaps loop through setting the 4 power states (0,1,2,3) and observe what's written to the chip for each value to confirm?
If I'm correct, I should see the value in said register change for every INT 15h call.

Edit: Adjusted the program, then compiled with some old Turbo C 1.01:
https://github.com/superfury/shutdown

TCC -mt -IC:\TC\INCLUDE -LC:\TC\LIB shutdown.c

Shutdown.exe -R does nothing.
-s gives a black screen and stops responding.
-S untested.
-h writes F0 to said port.

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 6 of 8, by superfury

User metadata
Rank l33t++
Rank
l33t++

Shutting down Windows 95 also writes F0h to said port.

Other issued states locks up the machine with a black screen (suspend I think), or resume from a black screen with a key press.

This is what I get on said PCS ports when Windows 95 (and BIOS) boots up and shuts down the machine:

00:00:01:16.07094: PCS base: 0000, limit=0003, unmapped: 03
00:00:01:16.08257: PCS base: 0000, limit=0003, unmapped: 03
00:00:01:55.07831: PCS base: 0000, limit=0003, unmapped: 03
00:00:01:55.08090: PCS base: 0000, limit=0003, unmapped: 03
00:00:06:98.06407: PCS base: 0000, limit=0003, unmapped: 03
00:00:06:98.07316: PCS base: 0000, limit=0003, unmapped: 03
00:00:07:20.08990: PCS base: 0000, limit=0003, unmapped: 03
00:00:07:20.09242: PCS base: 0000, limit=0003, unmapped: 03
00:03:59:49.01760: PCS base: 0000, limit=0003, unmapped: 03
00:03:59:49.02992: PCS base: 0000, limit=0003, unmapped: 03
00:03:59:72.02832: PCS base: 0000, limit=0003, unmapped: 03
00:03:59:72.03088: PCS base: 0000, limit=0003, unmapped: 03
00:04:44:45.03504: PCS base: 0000, limit=0003, unmapped: 03
00:04:44:45.04304: PCS base: 0000, limit=0003, unmapped: 03
00:04:44:69.06000: PCS base: 0000, limit=0003, unmapped: 03
00:04:44:69.06160: PCS base: 0000, limit=0003, unmapped: 03
00:04:48:99.02384: PCS base: 0000, limit=0003, unmapped: 03
00:04:48:99.06384: PCS base: 0000, limit=0003, unmapped: 03
00:04:49:22.05568: PCS base: 0000, limit=0003, unmapped: 03
00:04:49:22.05728: PCS base: 0000, limit=0003, unmapped: 03
00:27:04:04.03392: PCS base: 0000, limit=0003, unmapped: 03
00:27:04:04.04416: PCS base: 0000, limit=0003, unmapped: 03
00:27:04:27.02768: PCS base: 0000, limit=0003, unmapped: 03
00:27:04:27.02896: PCS base: 0000, limit=0003, unmapped: 03
00:27:08:60.06464: PCS base: 0000, limit=0003, unmapped: 03
00:27:08:61.00688: PCS base: 0000, limit=0003, unmapped: 03
00:27:08:84.00576: PCS base: 0000, limit=0003, unmapped: 03
00:27:08:84.00832: PCS base: 0000, limit=0003, unmapped: 03
00:47:23:78.05728: PCS base: 1300, limit=0003, unmapped: 03
00:47:23:78.07008: PCS base: 1300, limit=0003, unmapped: 03
00:47:23:78.07008: PCS base: 13F0, limit=0003, unmapped: 00
00:47:23:78.07264: PCS base: 13F0, limit=0003, unmapped: 00
00:47:23:78.07264: PCS written: 00=F0

The PCS written is a relative offset to the PCS base btw, F0h is the value written to said port. So it's writing F0 to port 13F0, just like the shutdown program.

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 7 of 8, by superfury

User metadata
Rank l33t++
Rank
l33t++

Added an extra 'green button' option to the settings to trigger EXTSMI# on the chipset (both i82347 and PIIX/PIIX3 chipsets). i82347 will only take effect if 'activated' by writing it's registers after a hard reset (which is a PCI reset and during poweron). So both ways can work in harmony with each other.

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 8 of 8, by superfury

User metadata
Rank l33t++
Rank
l33t++

Just added an extra mapping of the i82347 mapping to address base+2 and base+3 of the PCS chipset. Then I also added mapping writes at the PCS base address +0 to write C0 to address +2 and the value written to address +3(thus the F0h write writes to the first register of the i82347). It also adjusts value F0 to FF when it detects it being written (thus triggering a shutdown).
It temporarily moves the chip to address 0 and back to it's original mapping when it's done handling such a write to the PCS I/O range.

Since the addrsel is 0 in all other cases (it uses special case 3(disabled) and 4(enabled custom mapping) to map internally), it will revert it's behaviour after a read or write is performed using the special PCS window.

So the i82347 chip is visible at (since addrsel is 0) 26h/27h range, as well as PCS +2/+3. And PCS+0 is turned into a write to PCS+2(C0h) and a write to PCS+3 with the value written to archieve the proper effect. Value F0 is also turned into FFh when written to PCS+0 (to archieve a shutdown request).

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io