FreeBSD kernel IICBUS device code
iicsmb.c File Reference
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/bus.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/module.h>
#include <sys/mutex.h>
#include <sys/systm.h>
#include <sys/uio.h>
#include <dev/iicbus/iiconf.h>
#include <dev/iicbus/iicbus.h>
#include <dev/smbus/smb.h>
#include <dev/smbus/smbconf.h>
#include "iicbus_if.h"
#include "smbus_if.h"
Include dependency graph for iicsmb.c:

Go to the source code of this file.

Data Structures

struct  iicsmb_softc
 

Macros

#define SMB_WAITING_ADDR   0x0
 
#define SMB_WAITING_LOW   0x1
 
#define SMB_WAITING_HIGH   0x2
 
#define SMB_DONE   0x3
 
#define TRANSFER_MSGS(dev, msgs)   iicbus_transfer(dev, msgs, nitems(msgs))
 

Functions

 __FBSDID ("$FreeBSD$")
 
static int iicsmb_probe (device_t)
 
static int iicsmb_attach (device_t)
 
static int iicsmb_detach (device_t)
 
static void iicsmb_identify (driver_t *driver, device_t parent)
 
static int iicsmb_intr (device_t dev, int event, char *buf)
 
static int iicsmb_callback (device_t dev, int index, void *data)
 
static int iicsmb_quick (device_t dev, u_char slave, int how)
 
static int iicsmb_sendb (device_t dev, u_char slave, char byte)
 
static int iicsmb_recvb (device_t dev, u_char slave, char *byte)
 
static int iicsmb_writeb (device_t dev, u_char slave, char cmd, char byte)
 
static int iicsmb_writew (device_t dev, u_char slave, char cmd, short word)
 
static int iicsmb_readb (device_t dev, u_char slave, char cmd, char *byte)
 
static int iicsmb_readw (device_t dev, u_char slave, char cmd, short *word)
 
static int iicsmb_pcall (device_t dev, u_char slave, char cmd, short sdata, short *rdata)
 
static int iicsmb_bwrite (device_t dev, u_char slave, char cmd, u_char count, char *buf)
 
static int iicsmb_bread (device_t dev, u_char slave, char cmd, u_char *count, char *buf)
 
static int iic2smb_error (int error)
 
 DRIVER_MODULE (iicsmb, iicbus, iicsmb_driver, iicsmb_devclass, 0, 0)
 
 DRIVER_MODULE (smbus, iicsmb, smbus_driver, smbus_devclass, 0, 0)
 
 MODULE_DEPEND (iicsmb, iicbus, IICBUS_MINVER, IICBUS_PREFVER, IICBUS_MAXVER)
 
 MODULE_DEPEND (iicsmb, smbus, SMBUS_MINVER, SMBUS_PREFVER, SMBUS_MAXVER)
 
 MODULE_VERSION (iicsmb, 1)
 

Variables

static devclass_t iicsmb_devclass
 
static device_method_t iicsmb_methods []
 
static driver_t iicsmb_driver
 

Macro Definition Documentation

◆ SMB_DONE

#define SMB_DONE   0x3

Definition at line 73 of file iicsmb.c.

◆ SMB_WAITING_ADDR

#define SMB_WAITING_ADDR   0x0

Definition at line 70 of file iicsmb.c.

◆ SMB_WAITING_HIGH

#define SMB_WAITING_HIGH   0x2

Definition at line 72 of file iicsmb.c.

◆ SMB_WAITING_LOW

#define SMB_WAITING_LOW   0x1

Definition at line 71 of file iicsmb.c.

◆ TRANSFER_MSGS

#define TRANSFER_MSGS (   dev,
  msgs 
)    iicbus_transfer(dev, msgs, nitems(msgs))

Definition at line 310 of file iicsmb.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ DRIVER_MODULE() [1/2]

DRIVER_MODULE ( iicsmb  ,
iicbus  ,
iicsmb_driver  ,
iicsmb_devclass  ,
,
 
)

◆ DRIVER_MODULE() [2/2]

DRIVER_MODULE ( smbus  ,
iicsmb  ,
smbus_driver  ,
smbus_devclass  ,
,
 
)

◆ iic2smb_error()

static int iic2smb_error ( int  error)
static

◆ iicsmb_attach()

static int iicsmb_attach ( device_t  dev)
static

Definition at line 153 of file iicsmb.c.

References dev, iicsmb_softc::lock, and iicsmb_softc::smbus.

◆ iicsmb_bread()

static int iicsmb_bread ( device_t  dev,
u_char  slave,
char  cmd,
u_char *  count,
char *  buf 
)
static

Definition at line 445 of file iicsmb.c.

References buf, dev, iic2smb_error(), IIC_M_NOSTART, IIC_M_NOSTOP, IIC_M_RD, IIC_M_WR, IIC_RECURSIVE, IIC_WAIT, iicbus_release_bus(), iicbus_request_bus(), iic_msg::len, msgs, slave, and TRANSFER_MSGS.

Here is the call graph for this function:

◆ iicsmb_bwrite()

static int iicsmb_bwrite ( device_t  dev,
u_char  slave,
char  cmd,
u_char  count,
char *  buf 
)
static

Definition at line 429 of file iicsmb.c.

References buf, bytes, dev, iic2smb_error(), IIC_M_NOSTART, IIC_M_NOSTOP, IIC_M_WR, msgs, slave, and TRANSFER_MSGS.

Here is the call graph for this function:

◆ iicsmb_callback()

static int iicsmb_callback ( device_t  dev,
int  index,
void *  data 
)
static

Definition at line 254 of file iicsmb.c.

References data, dev, iicbus_release_bus(), iicbus_request_bus(), and index.

Here is the call graph for this function:

◆ iicsmb_detach()

static int iicsmb_detach ( device_t  dev)
static

Definition at line 168 of file iicsmb.c.

References dev, and iicsmb_softc::lock.

◆ iicsmb_identify()

static void iicsmb_identify ( driver_t *  driver,
device_t  parent 
)
static

Definition at line 138 of file iicsmb.c.

◆ iicsmb_intr()

◆ iicsmb_pcall()

static int iicsmb_pcall ( device_t  dev,
u_char  slave,
char  cmd,
short  sdata,
short *  rdata 
)
static

Definition at line 412 of file iicsmb.c.

References dev, iic2smb_error(), IIC_M_NOSTOP, IIC_M_RD, IIC_M_WR, msgs, slave, and TRANSFER_MSGS.

Here is the call graph for this function:

◆ iicsmb_probe()

static int iicsmb_probe ( device_t  dev)
static

Definition at line 146 of file iicsmb.c.

References dev.

◆ iicsmb_quick()

static int iicsmb_quick ( device_t  dev,
u_char  slave,
int  how 
)
static

Definition at line 313 of file iicsmb.c.

References dev, iic2smb_error(), IIC_M_RD, IIC_M_WR, msgs, slave, and TRANSFER_MSGS.

Here is the call graph for this function:

◆ iicsmb_readb()

static int iicsmb_readb ( device_t  dev,
u_char  slave,
char  cmd,
char *  byte 
)
static

Definition at line 383 of file iicsmb.c.

References dev, iic2smb_error(), IIC_M_NOSTOP, IIC_M_RD, IIC_M_WR, msgs, slave, and TRANSFER_MSGS.

Here is the call graph for this function:

◆ iicsmb_readw()

static int iicsmb_readw ( device_t  dev,
u_char  slave,
char  cmd,
short *  word 
)
static

Definition at line 396 of file iicsmb.c.

References buf, dev, iic2smb_error(), IIC_M_NOSTOP, IIC_M_RD, IIC_M_WR, msgs, slave, and TRANSFER_MSGS.

Here is the call graph for this function:

◆ iicsmb_recvb()

static int iicsmb_recvb ( device_t  dev,
u_char  slave,
char *  byte 
)
static

Definition at line 345 of file iicsmb.c.

References dev, iic2smb_error(), IIC_M_RD, msgs, slave, and TRANSFER_MSGS.

Here is the call graph for this function:

◆ iicsmb_sendb()

static int iicsmb_sendb ( device_t  dev,
u_char  slave,
char  byte 
)
static

Definition at line 333 of file iicsmb.c.

References dev, iic2smb_error(), IIC_M_WR, msgs, slave, and TRANSFER_MSGS.

Here is the call graph for this function:

◆ iicsmb_writeb()

static int iicsmb_writeb ( device_t  dev,
u_char  slave,
char  cmd,
char  byte 
)
static

Definition at line 357 of file iicsmb.c.

References bytes, dev, iic2smb_error(), IIC_M_WR, msgs, slave, and TRANSFER_MSGS.

Here is the call graph for this function:

◆ iicsmb_writew()

static int iicsmb_writew ( device_t  dev,
u_char  slave,
char  cmd,
short  word 
)
static

Definition at line 370 of file iicsmb.c.

References bytes, dev, iic2smb_error(), IIC_M_WR, msgs, slave, and TRANSFER_MSGS.

Here is the call graph for this function:

◆ MODULE_DEPEND() [1/2]

MODULE_DEPEND ( iicsmb  ,
iicbus  ,
IICBUS_MINVER  ,
IICBUS_PREFVER  ,
IICBUS_MAXVER   
)

◆ MODULE_DEPEND() [2/2]

MODULE_DEPEND ( iicsmb  ,
smbus  ,
SMBUS_MINVER  ,
SMBUS_PREFVER  ,
SMBUS_MAXVER   
)

◆ MODULE_VERSION()

MODULE_VERSION ( iicsmb  ,
 
)

Variable Documentation

◆ iicsmb_devclass

devclass_t iicsmb_devclass
static

Definition at line 103 of file iicsmb.c.

◆ iicsmb_driver

driver_t iicsmb_driver
static
Initial value:
= {
"iicsmb",
sizeof(struct iicsmb_softc),
}
static device_method_t iicsmb_methods[]
Definition: iicsmb.c:105

Definition at line 131 of file iicsmb.c.

◆ iicsmb_methods

device_method_t iicsmb_methods[]
static
Initial value:
= {
DEVMETHOD(device_identify, iicsmb_identify),
DEVMETHOD(device_probe, iicsmb_probe),
DEVMETHOD(device_attach, iicsmb_attach),
DEVMETHOD(device_detach, iicsmb_detach),
DEVMETHOD(iicbus_intr, iicsmb_intr),
DEVMETHOD(smbus_callback, iicsmb_callback),
DEVMETHOD(smbus_quick, iicsmb_quick),
DEVMETHOD(smbus_sendb, iicsmb_sendb),
DEVMETHOD(smbus_recvb, iicsmb_recvb),
DEVMETHOD(smbus_writeb, iicsmb_writeb),
DEVMETHOD(smbus_writew, iicsmb_writew),
DEVMETHOD(smbus_readb, iicsmb_readb),
DEVMETHOD(smbus_readw, iicsmb_readw),
DEVMETHOD(smbus_pcall, iicsmb_pcall),
DEVMETHOD(smbus_bwrite, iicsmb_bwrite),
DEVMETHOD(smbus_bread, iicsmb_bread),
DEVMETHOD_END
}
void iicbus_intr(device_t bus, int event, char *buf)
Definition: iiconf.c:97
static int iicsmb_quick(device_t dev, u_char slave, int how)
Definition: iicsmb.c:313
static int iicsmb_attach(device_t)
Definition: iicsmb.c:153
static void iicsmb_identify(driver_t *driver, device_t parent)
Definition: iicsmb.c:138
static int iicsmb_probe(device_t)
Definition: iicsmb.c:146
static int iicsmb_bread(device_t dev, u_char slave, char cmd, u_char *count, char *buf)
Definition: iicsmb.c:445
static int iicsmb_detach(device_t)
Definition: iicsmb.c:168
static int iicsmb_readw(device_t dev, u_char slave, char cmd, short *word)
Definition: iicsmb.c:396
static int iicsmb_sendb(device_t dev, u_char slave, char byte)
Definition: iicsmb.c:333
static int iicsmb_bwrite(device_t dev, u_char slave, char cmd, u_char count, char *buf)
Definition: iicsmb.c:429
static int iicsmb_callback(device_t dev, int index, void *data)
Definition: iicsmb.c:254
static int iicsmb_pcall(device_t dev, u_char slave, char cmd, short sdata, short *rdata)
Definition: iicsmb.c:412
static int iicsmb_intr(device_t dev, int event, char *buf)
Definition: iicsmb.c:185
static int iicsmb_readb(device_t dev, u_char slave, char cmd, char *byte)
Definition: iicsmb.c:383
static int iicsmb_recvb(device_t dev, u_char slave, char *byte)
Definition: iicsmb.c:345
static int iicsmb_writeb(device_t dev, u_char slave, char cmd, char byte)
Definition: iicsmb.c:357
static int iicsmb_writew(device_t dev, u_char slave, char cmd, short word)
Definition: iicsmb.c:370

Definition at line 105 of file iicsmb.c.