/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 Functions (Ioctl)

Command Name Prototype Description
0x01 bspGetEntityVersion BSP_RVAL bspMethodGetEntityVersion(const char* entityName, BSP_ENTITY_VERSION * pReturnedVersion) Retrieves the version of the specified entity definition.
0x02 bspGetHardwareVersion BSP_RVAL bspMethodGetHardwareVersion(BSP_HARDWARE_VERSION * pVersion) Retrieves the version of the hardware platform. The hardware version is read from the CHIPREVID registers and the boardType in the SEEPROM.
0x03 BSP_RVAL bspGetConsoleMask(buffer_io[0] = mask) Writes the a mask that depends on consoleType and boardType in buffer_io.
0x04 bspQuery BSP_RVAL bspMethodQuery(const char* entityName, u32 instance, const char* attributeName, size_t size, void * pReturnedData) Requests static information about an attribute.
0x05 bspRead BSP_RVAL bspMethodRead(const char* entityName, u32 instance, const char* attributeName, size_t size, void * pReturnedData) Read volatile information from a hardware attribute.
0x06 bspWrite BSP_RVAL bspMethodWrite(const char* entityName, u32 instance, const char* attributeName, size_t size, void * pWrittenData) Writes information to a hardware attribute
0x07 bspInit BSP_RVAL bspMethodInitialize(const char* entityName, u32 instance, const char* attributeName, size_t size, void * pOptionData) Initialize a hardware attribute, making use of optionally supplied data.
0x08 bspShutdown BSP_RVAL bspMethodShutdown(const char* entityName, u32 instance, const char* attributeName) Shuts down specified attribute
0x09 bspGetConsoleType(BSP_CONSOLE_TYPE * consoleType) Gets the consoleType (2 = CF, 3 = CT, 4 = EV)

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