/dev/bsp

From WiiUBrew
Jump to navigation Jump to search

/dev/bsp is the IOSU device node for the Board Support Package. It provides functions to interface with the hardware and checks for access permissions.

It is subdivided in entities (e.g. SMC, USB, SDIO, SATA, ...) and each entity has a number of attributes (e.g baseAdddress, size, pin0); entities can set multiple instance to have different attributes.

List of entities and attributes (wip)

(*) = Different BSP entity available depending on hardware version, [n] = Number of instances of an entity, where hardcoded and not 1

Entity Attributes
AI IOStrength, BaseAddress, IOPower, ClockGate, PLL, StereoOutSelect
CCRH Reset, Summary
CORTADO(*) FPGAType, FPGAVersion, SYSADDR, PCIConfig, NESCAFEConfig, SATAPhyReset
ddrperf ctr_val, ctr_cfg, ctr_ctrl
DI IOStrength, BaseAddress, IOPower, Reset
DISPLAY DC_INIT, DC_CONFIG, DC_SYNC
EE access, control, bc
FLA[2] IOStrength, IOPower, FLAController, FLADevice
GFX(*) subsystem, endianness, spll, upll, vi1pll, vi2pll, DCCMPT
GPIO IOStrength, IOPower, RTCSysInt, DWiFiMode, ToucanSelect, ESP10WorkAround, SMCI2CClock, SMCI2CData, AV0I2CClock, AV0I2CData, AV1I2CClock, AV1I2CData, MuteLamp, BlueToothMode, CCRIO12, CCRHReset, WiFiMode, SDCOS0Power, FanPower, DCDCPwrCnt, CCRIO3, PADPD, EEPROM_CS, EEPROM_SK, EEPROM_DO, EEPROM_DI, AV0I2CClock, AV0I2CData (duplicates?) NDEV_LED, AVInterrupt, AVReset, FanSpeed, DCDCPwrCnt2
PPC(*)[1 or 3] Exe, Clock, EXIRegBoot, PVR, 60XeDataStream (available on first instance only); Summary, CoreProperties (available on all instances)
RAM[3] BaseAddress, Size, PPCBaseAddress, PPCSize (available for all instances); pll (second and third instance only); cfg, disable_2ndrank (third instance only)
Reset RSTB_DSP, RSTB_VI1, RSTB_VI, RSTB_IOPI, RSTB_IODI, RSTB_IOEXI, RSTB_IOSI, RSTB_AI_I2S3, RSTB_AI_I2S5, RSTB_GFX, RSTB_GFXTCPE, RSTB_PI, RSTB_DIRSTB
RTC POFF_EXE, DEVPWR_EN, DEVPWR_SYNC, SLEEP_EN, FPOFF_MODE, CLKOUT_EN, 4COUNT_EN, POFFLG_FPOFF, POFFLG_4S, POFFLG_TMR, PONFLG_SYS, UNSTBL_PWR, LOW_BATT, CANARY, OFFTMR_EN, ONTMR_EN, POFFTMR_DTCT, PONTMR_DTCT, OFFTMR_SET, ONTMR_SET, RTC_COUNTER, RTC_SNAPSHOT, RTC_OFFSET, RTC_CONTROL0, RTC_CONTROL1, RTC_SRAM
SATA SATASUBSYS, SATACTRLPROP, SATAPLL, SATA_CAPABILITY
SDIO(*)[3 or 5] Summary, SlotProperties, IOStrength, IOPower, ClockGate
SI IOStrength, BaseAddress, IOPower, Subsystem
SMC ODDPower, EjectRequest, ONIndicator, CCIndicator, OFFIndicator, BTRSTPulse, WIFIRSTPulse, DWIFIRSTPulse, USBRearControl, USBFrontControl, WIFIResetPin, TimerCounter, ProgramRevision, SystemEventFlag, NotificationLED, PowerFailureState, LAPSSetting, SystemError
Sys WorkArounds, Misc, ClockInfo, ASICRevision, BoardRevision, SYSPLL, devicePresence, topLevel, iop2x, cpuUtil, osVer, powerMode, iopClock
USB(*)[3] Subsystem, Summary, CtrlProp (Available on all hardware); CtrlChicken, usbpll (Available on some hardware)
VI(*) IOStrength (Available on all hardware); SelOSTS (Available on some hardware); IOPower, ClockGate, PLL (Available on some hardware)
WIFI WIFI_ENABLED

List of ioctls

Command Function Description
0x01 bspGetEntityVersion(entityName = &buffer_in[0..7], buffer_io[0] = version) Writes the version number for the specified entity in buffer_io.
0x02 bspMethodGetHardwareVersion(buffer_io[0] = hwVersion) Writes the hardware version in buffer_io.
0x03 bspGetConsoleMask(buffer_io[0] = mask) Writes the a mask that depends on consoleType and boardType in buffer_io.
0x04 bspMethodQuery(entityName = buffer_in[0..7], instance = buffer_in[8], attributeName = buffer_in[9..16], size = buffer_in[17], buffer_io = pData) Calls the query method for the specified entity->attribute.
0x05 bspMethodRead(entityName = buffer_in[0..7], instance = buffer_in[8], attributeName = buffer_in[9..16], size = buffer_in[17], buffer_io = pData) Calls the read method for the specified entity->attribute.
0x06 bspMethodWrite(entityName = buffer_in[0..7], instance = buffer_in[8], attributeName = buffer_in[9..16], size = buffer_in[17], pData = buffer_io[72..72+size]) Calls the write method for the specified entity->attribute.
0x07 bspMethodInit(entityName = buffer_in[0..7], instance = buffer_in[8], attributeName = buffer_in[9..16], optionSize = buffer_in[17], pOptions = buffer_io[72..72+optionSize]) Calls the init method for the specified entity->attribute.
0x08 bspMethodShutdown(entityName = buffer_in[0..7], instance = buffer_in[8], attributeName = buffer_in[9..16]) Calls the shutdown method for the specified entity->attribute.
0x09 bspGetConsoleType(buffer_io[0] = consoleType) Writes a consoleType (2 = retail/test, 3 and 4 = probably debug) in buffer_io.

bspMethodGetHardwareVersion

Gets the hardware version of the system. The hardware version is read from the CHIPREVID registers and the boardType in the SEEPROM.

The higher 16-bits of the hardware version is the chip revision while the lower 16-bits the boardType.

Chip Revisions

Value Name
0x2110 LATTE_A11
0x2120 LATTE_A12
0x2210 LATTE_A2X
0x2310 LATTE_A3X
0x2410 LATTE_A4X
0x2510 LATTE_A5X
0x2610 LATTE_B1X

Board Types

Value Name
0x0010 EV
0x0011 EV_Y
0x0020 CT
0x0021 ID
0x0028 CF
0x0029 IH