OperationRegion (SM00, SystemIO, 0x5000, 0x01) Field (SM00, ByteAcc, NoLock, Preserve) { HSTS, 8 // Host status } OperationRegion (SM02, SystemIO, 0x5002, 0x01) Field (SM02, ByteAcc, NoLock, Preserve) { CTLR, 8 // Host control } OperationRegion (SM03, SystemIO, 0x5003, 0x01) Field (SM03, ByteAcc, NoLock, Preserve) { CMDR, 8 // SMB command register } OperationRegion (SM04, SystemIO, 0x5004, 0x01) Field (SM04, ByteAcc, NoLock, Preserve) { ADDR, 8 // SMB address register } OperationRegion (SM05, SystemIO, 0x5005, 0x01) Field (SM05, ByteAcc, NoLock, Preserve) { DAT0, 8 // SMB data 0 register } OperationRegion (SM06, SystemIO, 0x5006, 0x01) Field (SM06, ByteAcc, NoLock, Preserve) { DAT1, 8 // SMB data 1 register } Method(SWFS, 0) { And(HSTS, 0x02, Local0) // Wait till completion While(LEqual(Local0, Zero)) { Stall(1) And(HSTS, 0x02, Local0)} Store(0xFF, HSTS) // Clear all status bits } // Method(SWFS) Method(SBYT, 2) { Store(Arg0, ADDR) // Device address Store(Arg1, CMDR) // Command byte Store(0xFF, HSTS) // Clear all status bits Store(0x44, CTLR) // Byte command + start SWFS() // Wait for completion } // Method(SBYT) Method(WBYT, 3) { Store(Arg0, ADDR) // Device address Store(Arg1, CMDR) // Command byte Store(Arg2, DAT0) // Data byte Store(0xFF, HSTS) // Clear all status bits Store(0x48, CTLR) // Byte data command + start SWFS() // Wait for completion } // Method(WBYT) Method(WWRD, 4) { Store(Arg0, ADDR) // Device address Store(Arg1, CMDR) // Command byte Store(Arg2, DAT0) // Data low byte Store(Arg3, DAT1) // Data high byte Store(0xFF, HSTS) // Clear all status bits Store(0x4C, CTLR) // Word data command + start SWFS() // Wait for completion } // Method(WWRD) Method(RBYT, 2) { Or(Arg0, 0x01, Local1) // Read command Store(Local1, ADDR) // Device address Store(Arg1, CMDR) // Command byte Store(0xFF, HSTS) // Clear all status bits Store(0x48, CTLR) // Byte data command + start SWFS() // Wait for completion Return(DAT0) // Return data in DAT0 } // Method(RBYT) Method(RWRD, 2) { Or(Arg0, 0x01, ADDR) // Device address + Read command Store(Arg1, CMDR) // Command byte Store(0xFF, HSTS) // Clear all status bits Store(0x4C, CTLR) // Word data command + start SWFS() // Wait for completion Store(DAT0, Local0) ShiftLeft(DAT1, 8, Local1) Or(Local0, Local1, Local2) // Convert to word Return(Local2) // Return word data } // Method(RWRD)