man.bsd.lv manual page server

Manual Page Search Parameters

SMB(4) Device Drivers Manual SMB(4)

smbSMB generic I/O device driver

device smb

The character device driver provides generic I/O to any smbus(4) instance. To control SMB devices, use /dev/smb? with the ioctls described below. Any of these ioctl commands takes a pointer to struct smbcmd as its argument.
#include <sys/types.h>

struct smbcmd {
	u_char cmd;
	u_char reserved;
	u_short op;
	union {
		char    byte;
		char    buf[2];
		short   word;
	} wdata;
	union {
		char    byte;
		char    buf[2];
		short   word;
	} rdata;
	int  slave;
	char *wbuf;     /* use wdata if NULL */
	int  wcount;
	char *rbuf;     /* use rdata if NULL */
	int  rcount;
};

The slave field is always used, and provides the address of the SMBus slave device. The slave address is specified in the seven most significant bits (i.e., “left-justified”). The least significant bit of the slave address must be zero.

does not transfer any data. It just issues the device address with write intent to the bus.
does not transfer any data. It just issues the device address with read intent to the bus.
sends the byte provided in cmd to the device.
reads a single byte from the device which is returned in cmd.
first sends the byte from cmd to the device, followed by the byte given in wdata.byte.
first sends the byte from cmd to the device, followed by the word given in wdata.word. Note that the SMBus byte-order is little-endian by definition.
first sends the byte from cmd to the device, then reads one byte of data from the device. Returned data is stored in rdata.byte.
first sends the byte from cmd to the device, then reads one word of data from the device. Returned data is stored in rdata.word.
first sends the byte from cmd to the device, followed by the word provided in wdata.word. It then reads one word of data from the device and returns it in rdata.word.
first sends the byte from cmd to the device, then the byte from wcount followed by wcount bytes of data that are taken from the buffer pointed to by wbuf. The SMBus specification mandates that no more than 32 bytes of data can be transferred in a single block read or write command. This value can be read from the constant SMB_MAXBLOCKSIZE.
first sends the byte from cmd to the device, then reads a count of data bytes that the device is going to provide and then reads that many bytes. The count is returned in rcount. The data is returned in the buffer pointed to by rbuf.

The read(2) and write(2) system calls are not implemented by this driver.

The ioctl(2) commands can cause the following driver-specific errors:

[]
Device did not respond to selection.
[]
Device still in use.
[]
Operation not supported by device (not supposed to happen).
[]
General argument error.
[]
SMBus transaction timed out.

ioctl(2), smbus(4)

The smb manual page first appeared in FreeBSD 3.0.

This manual page was written by Nicolas Souchu and extended by
Michael Gmelin ⟨freebsd@grem.de⟩.

April 25, 2015 FreeBSD-12.0