Cracking the DSDT code

by hobbitalastair

Kind of. I’ve mentioned before that I’ve been poking around in the DSDT tables from the Toshiba, in an attempt to figure out what’s going on. Well, I’ve made some progress.

Specifically, I’ve been looking in the code for the functions for controlling the hard drive. This boils down to a several power management functions, and a couple of functions named _STM and _GTM. These get/set the timing modes for the disk controller.

_STM looks a bit like this:

Put 0x98 into EDI1.

Plug 0xFF00 into EAX1, 0x00A0B10C into EBX1, the timing mode into ECX1, 0x00 into EDX1, and 0xB2 into a register (or memory location?) named “_SB.PCI0.EIO.MOTH.TRP4”.

To quote from the (reverse engineered; not by me) HCI spec:

The HCI is activated by reading a byte from port B2h into the AL register. There are two functions in the HCI one that enables a device setup status to be read and another that enables it to be set. The function that is then executed depends on the value held in the AX register, according to the following list:

– FE00h: Read current status of device

– FF00h: Setup device

Unlike the System Configuration Interface (SCI) it is not necessary to open or close an interface to the HCI.

Does this sound familiar?

So this piece of code is calling into the HCI… which is essentially a SMI (system management mode) trap… which is bad. Because I have no idea about what happens after that!

Essentially, this piece of code sets the timing mode by chucking the device ID in EBX1, timing into ECX1, and then calling into HCI. At least that’s how I understand it at the moment!

However, this does nothing for helping me understand how the hardware really works…

Advertisements