arch/sparc/include/asm/vio.h

Source file repositories/reference/linux-study-clean/arch/sparc/include/asm/vio.h

File Facts

System
Linux kernel
Corpus path
arch/sparc/include/asm/vio.h
Extension
.h
Size
11996 bytes
Lines
509
Domain
Architecture Layer
Bucket
arch/sparc
Inferred role
Architecture Layer: operation-table or driver-model contract
Status
pattern implementation candidate

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

struct device_driver		driver;
	bool				no_irq;
};

struct vio_version {
	u16		major;
	u16		minor;
};

struct vio_driver_state;
struct vio_driver_ops {
	int	(*send_attr)(struct vio_driver_state *vio);
	int	(*handle_attr)(struct vio_driver_state *vio, void *pkt);
	void	(*handshake_complete)(struct vio_driver_state *vio);
};

struct vio_completion {
	struct completion	com;
	int			err;
	int			waiting_for;
};

struct vio_driver_state {
	/* Protects VIO handshake and, optionally, driver private state.  */
	spinlock_t		lock;

	struct ldc_channel	*lp;

	u32			_peer_sid;
	u32			_local_sid;
	struct vio_dring_state	drings[2];
#define VIO_DRIVER_TX_RING	0
#define VIO_DRIVER_RX_RING	1

	u8			hs_state;
#define VIO_HS_INVALID		0x00
#define VIO_HS_GOTVERS		0x01
#define VIO_HS_GOT_ATTR		0x04
#define VIO_HS_SENT_DREG	0x08
#define VIO_HS_SENT_RDX		0x10
#define VIO_HS_GOT_RDX_ACK	0x20
#define VIO_HS_GOT_RDX		0x40
#define VIO_HS_SENT_RDX_ACK	0x80
#define VIO_HS_COMPLETE		(VIO_HS_GOT_RDX_ACK | VIO_HS_SENT_RDX_ACK)

	u8			dev_class;

	u8			dr_state;
#define VIO_DR_STATE_TXREG	0x01
#define VIO_DR_STATE_RXREG	0x02
#define VIO_DR_STATE_TXREQ	0x10
#define VIO_DR_STATE_RXREQ	0x20

	u8			debug;
#define VIO_DEBUG_HS		0x01
#define VIO_DEBUG_DATA		0x02

	void			*desc_buf;
	unsigned int		desc_buf_len;

	struct vio_completion	*cmp;

	struct vio_dev		*vdev;

	struct timer_list	timer;

	struct vio_version	ver;

	struct vio_version	*ver_table;
	int			ver_table_entries;

	char			*name;

	struct vio_driver_ops	*ops;
};

static inline bool vio_version_before(struct vio_driver_state *vio,
				      u16 major, u16 minor)
{
	u32 have = (u32)vio->ver.major << 16 | vio->ver.minor;
	u32 want = (u32)major << 16 | minor;

	return have < want;
}

static inline bool vio_version_after(struct vio_driver_state *vio,
				      u16 major, u16 minor)
{
	u32 have = (u32)vio->ver.major << 16 | vio->ver.minor;
	u32 want = (u32)major << 16 | minor;

Annotation

Implementation Notes