Skip to content
gsly edited this page Jun 14, 2012 · 1 revision

Big Battery Information Extended (BBIX) method for DVx. Note that these methods are not ACPI standards compliant but allow the use of all of the Smart Battery standard information to be returned to OSX including attributes such as battery temperature that OSX can consume.

// Battery information - Non-standard (ACPI) stuff OSX battery driver will use

Name (PBIG, Package (0x10)
{
	Zero, 		// 0x00, ManufacturerAccess() - WORD - ?
	Zero, 		// 0x01, BatteryMode() - WORD - unsigned int
	0xFFFFFFFF, // 0x02, AtRateTimeToFull() - WORD - unsigned int (min)
	0xFFFFFFFF, // 0x03, AtRateTimeToEmpty() - WORD - unsigned int (min)
	Zero, 		// 0x04, Temperature() - WORD - unsigned int (0.1K)
	Zero, 		// 0x05, Voltage() - WORD - unsigned int (mV)
	Zero, 		// 0x06, Current() - WORD - signed int (mA)
	Zero, 		// 0x07, AverageCurrent() - WORD - signed int (mA)
	Zero, 		// 0x08, RelativeStateOfCharge() - WORD - unsigned int (%)
	Zero, 		// 0x09, AbsoluteStateOfCharge() - WORD - unsigned int (%)
	Zero, 		// 0x0a, RemaingingCapacity() - WORD - unsigned int (mAh or 10mWh)
	0xFFFFFFFF, // 0x0b, RunTimeToEmpty() - WORD - unsigned int (min)
	0xFFFFFFFF, // 0x0c, AverageTimeToEmpty() - WORD - unsigned int (min)
	0xFFFFFFFF, // 0x0d, AverageTimeToFull() - WORD - unsigned int (min)
	Zero, 		// 0x0e, ManufactureDate() - WORD - unsigned int (packed date)
	"N/A"       // 0x0f, ManufacturerData() - BLOCK - Unknown
})

// Return battery extra information in PBIG

Method (BBIX, 0, NotSerialized)
{
	If (ECON)						// Embedded controller
	{
		If (^^PCI0.LPCB.EC.MBTS)	// Main battery terminal sense?
		{
			UPBG () 				// Return battery information
		}
		Else
		{
			IVBG () 				// No battery, return placeholder info
		}
	}
	Else
	{
		IVBG () 					// No battery, return placeholder info
	}

	Return (PBIG)
}

// Get and store battery extra information in PBIG

Method (UPBG, 0, NotSerialized)
{
	^^PCI0.LPCB.EC.SMRD (0x09, 0x16, Zero, RefOf (Local0))  // ManufacturerAccess() - WORD - ?
	Store (Local0, Index (PBIG, Zero))
	^^PCI0.LPCB.EC.SMRD (0x09, 0x16, 0x03, RefOf (Local0))  // BatteryMode() - WORD - unsigned int
	Store (Local0, Index (PBIG, One))
	^^PCI0.LPCB.EC.SMRD (0x09, 0x16, 0x05, RefOf (Local0))  // AtRateTimeToFull() - WORD - unsigned int (min)
	Store (Local0, Index (PBIG, 0x02))
	^^PCI0.LPCB.EC.SMRD (0x09, 0x16, 0x06, RefOf (Local0))  // AtRateTimeToEmpty() - WORD - unsigned int (min)
	Store (Local0, Index (PBIG, 0x03))
	^^PCI0.LPCB.EC.SMRD (0x09, 0x16, 0x08, RefOf (Local0))  // Temperature() - WORD - unsigned int (0.1K)
	Store (Local0, Index (PBIG, 0x04))
	^^PCI0.LPCB.EC.SMRD (0x09, 0x16, 0x09, RefOf (Local0))  // Voltage() - WORD - unsigned int (mV)
	Store (Local0, Index (PBIG, 0x05))
	^^PCI0.LPCB.EC.SMRD (0x09, 0x16, 0x0a, RefOf (Local0))  // Current() - WORD - signed int (mA)
	Store (Local0, Index (PBIG, 0x06))
	^^PCI0.LPCB.EC.SMRD (0x09, 0x16, 0x0b, RefOf (Local0))  // AverageCurrent() - WORD - signed int (mA)
	Store (Local0, Index (PBIG, 0x07))
	^^PCI0.LPCB.EC.SMRD (0x09, 0x16, 0x0d, RefOf (Local0))  // RelativeStateOfCharge() - WORD - unsigned int (%)
	Store (Local0, Index (PBIG, 0x08))
	^^PCI0.LPCB.EC.SMRD (0x09, 0x16, 0x0e, RefOf (Local0))  // AbsoluteStateOfCharge() - WORD - unsigned int (%)
	Store (Local0, Index (PBIG, 0x09))
	^^PCI0.LPCB.EC.SMRD (0x09, 0x16, 0x0f, RefOf (Local0))  // RemaingingCapacity() - WORD - unsigned int (mAh or 10mWh)
	Store (Local0, Index (PBIG, 0x0A))
	^^PCI0.LPCB.EC.SMRD (0x09, 0x16, 0x11, RefOf (Local0))  // RunTimeToEmpty() - WORD - unsigned int (min)
	Store (Local0, Index (PBIG, 0x0B))
	^^PCI0.LPCB.EC.SMRD (0x09, 0x16, 0x12, RefOf (Local0))  // AverageTimeToEmpty() - WORD - unsigned int (min)
	Store (Local0, Index (PBIG, 0x0C))
	^^PCI0.LPCB.EC.SMRD (0x09, 0x16, 0x13, RefOf (Local0))  // AverageTimeToFull() - WORD - unsigned int (min)
	Store (Local0, Index (PBIG, 0x0D))
	^^PCI0.LPCB.EC.SMRD (0x09, 0x16, 0x1b, RefOf (Local0))  // ManufactureDate() - WORD - unsigned int (packed date)
	Store (Local0, Index (PBIG, 0x0E))
	^^PCI0.LPCB.EC.SMRD (0x0B, 0x16, 0x23, RefOf (Local0))  // ManufacturerData() - BLOCK - Unknown
	Store (Local0, Index (PBIG, 0x0F))
}

// InValid battery extra information
// Store placeholder battery extra information in PBIG when no battery is installed

Method (IVBG, 0, NotSerialized)
{
	Store (Zero, Index (PBIG, Zero)) 		// 0x00, ManufacturerAccess() - WORD - ?
	Store (Zero, Index (PBIG, One)) 		// 0x01, BatteryMode() - WORD - unsigned int
	Store (0xFFFFFFFF, Index (PBIG, 0x02)) 	// 0x02, AtRateTimeToFull() - WORD - unsigned int (min)
	Store (0xFFFFFFFF, Index (PBIG, 0x03)) 	// 0x03, AtRateTimeToEmpty() - WORD - unsigned int (min)
	Store (Zero, Index (PBIG, 0x04)) 		// 0x04, Temperature() - WORD - unsigned int (0.1K)
	Store (Zero, Index (PBIG, 0x05)) 		// 0x05, Voltage() - WORD - unsigned int (mV)
	Store (Zero, Index (PBIG, 0x06)) 		// 0x06, Current() - WORD - signed int (mA)
	Store (Zero, Index (PBIG, 0x07)) 		// 0x07, AverageCurrent() - WORD - signed int (mA)
	Store (Zero, Index (PBIG, 0x08)) 		// 0x08, RelativeStateOfCharge() - WORD - unsigned int (%)
	Store (Zero, Index (PBIG, 0x09)) 		// 0x09, AbsoluteStateOfCharge() - WORD - unsigned int (%)
	Store (Zero, Index (PBIG, 0x0a)) 		// 0x0a, RemaingingCapacity() - WORD - unsigned int (mAh or 10mWh)
	Store (0xFFFFFFFF, Index (PBIG, 0x0b)) 	// 0x0b, RunTimeToEmpty() - WORD - unsigned int (min)
	Store (0xFFFFFFFF, Index (PBIG, 0x0c)) 	// 0x0c, AverageTimeToEmpty() - WORD - unsigned int (min)
	Store (0xFFFFFFFF, Index (PBIG, 0x0d)) 	// 0x0d, AverageTimeToFull() - WORD - unsigned int (min)
	Store (Zero, Index (PBIG, 0x0e)) 		// 0x0e, ManufactureDate() - WORD - unsigned int (packed date)
	Store ("N/A", Index (PBIG, 0x0f))      	// 0x0f, ManufacturerData() - BLOCK - Unknown
}
Clone this wiki locally