Commit 74dcabc2 authored by Greg Howard's avatar Greg Howard Committed by Linus Torvalds

[PATCH] Altix system controller communication driver

drivers/char/Kconfig
    Make a config option for the SGI Altix system controller
    communication driver.

drivers/char/Makefile
    Add an object file target for the SGI Altix system controller
    communication driver.

drivers/char/snsc.c
    This file implements a driver that allows an application to
    communicate with the SGI Altix system controller network. Most of
    the heavy lifting is done in SAL in order to allow Linux run-time
    applications to share the system controller link(s) with SAL
    run-time services.

drivers/char/snsc.h
    Macros and data types for the Altix system controller driver
    (drivers/char/snsc.c).

drivers/serial/sn_console.c
    Modify the SGI Altix console driver to share an interupt with the
    system controller communication driver.

include/asm-ia64/sn/sn_sal.h
    Provide an interface to the SAL runtime services that allow the
    kernel or user applications to send/receive arbitary system
    controller data.
Signed-off-by: default avatarGreg Howard <ghoward@sgi.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent c88eec7c
...@@ -575,6 +575,7 @@ CONFIG_SERIAL_NONSTANDARD=y ...@@ -575,6 +575,7 @@ CONFIG_SERIAL_NONSTANDARD=y
# CONFIG_SYNCLINKMP is not set # CONFIG_SYNCLINKMP is not set
# CONFIG_N_HDLC is not set # CONFIG_N_HDLC is not set
# CONFIG_STALDRV is not set # CONFIG_STALDRV is not set
CONFIG_SGI_SNSC=y
# #
# Serial drivers # Serial drivers
......
...@@ -527,6 +527,7 @@ CONFIG_SERIAL_NONSTANDARD=y ...@@ -527,6 +527,7 @@ CONFIG_SERIAL_NONSTANDARD=y
# CONFIG_SYNCLINKMP is not set # CONFIG_SYNCLINKMP is not set
# CONFIG_N_HDLC is not set # CONFIG_N_HDLC is not set
# CONFIG_STALDRV is not set # CONFIG_STALDRV is not set
CONFIG_SGI_SNSC=y
# #
# Serial drivers # Serial drivers
......
...@@ -424,6 +424,14 @@ config A2232 ...@@ -424,6 +424,14 @@ config A2232
will also be built as a module. This has to be loaded before will also be built as a module. This has to be loaded before
"ser_a2232". If you want to do this, answer M here. "ser_a2232". If you want to do this, answer M here.
config SGI_SNSC
bool "SGI Altix system controller communication support"
depends on (IA64_SGI_SN2 || IA64_GENERIC)
help
If you have an SGI Altix and you want to enable system
controller communication from user space (you want this!),
say Y. Otherwise, say N.
source "drivers/serial/Kconfig" source "drivers/serial/Kconfig"
config UNIX98_PTYS config UNIX98_PTYS
......
...@@ -41,6 +41,7 @@ obj-$(CONFIG_SX) += sx.o generic_serial.o ...@@ -41,6 +41,7 @@ obj-$(CONFIG_SX) += sx.o generic_serial.o
obj-$(CONFIG_RIO) += rio/ generic_serial.o obj-$(CONFIG_RIO) += rio/ generic_serial.o
obj-$(CONFIG_HVC_CONSOLE) += hvc_console.o hvsi.o obj-$(CONFIG_HVC_CONSOLE) += hvc_console.o hvsi.o
obj-$(CONFIG_RAW_DRIVER) += raw.o obj-$(CONFIG_RAW_DRIVER) += raw.o
obj-$(CONFIG_SGI_SNSC) += snsc.o
obj-$(CONFIG_VIOCONS) += viocons.o obj-$(CONFIG_VIOCONS) += viocons.o
obj-$(CONFIG_VIOTAPE) += viotape.o obj-$(CONFIG_VIOTAPE) += viotape.o
obj-$(CONFIG_HVCS) += hvcs.o obj-$(CONFIG_HVCS) += hvcs.o
......
This diff is collapsed.
/*
* SN Platform system controller communication support
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 2004 Silicon Graphics, Inc. All rights reserved.
*/
/*
* This file contains macros and data types for communication with the
* system controllers in SGI SN systems.
*/
#ifndef _SN_SYSCTL_H_
#define _SN_SYSCTL_H_
#include <linux/types.h>
#include <linux/spinlock.h>
#include <linux/wait.h>
#include <linux/kobject.h>
#include <linux/fs.h>
#include <linux/cdev.h>
#include <asm/sn/types.h>
#include <asm/semaphore.h>
#define CHUNKSIZE 127
/* This structure is used to track an open subchannel. */
struct subch_data_s {
nasid_t sd_nasid; /* node on which the subchannel was opened */
int sd_subch; /* subchannel number */
spinlock_t sd_rlock; /* monitor lock for rsv */
spinlock_t sd_wlock; /* monitor lock for wsv */
wait_queue_head_t sd_rq; /* wait queue for readers */
wait_queue_head_t sd_wq; /* wait queue for writers */
struct semaphore sd_rbs; /* semaphore for read buffer */
struct semaphore sd_wbs; /* semaphore for write buffer */
char sd_rb[CHUNKSIZE]; /* read buffer */
char sd_wb[CHUNKSIZE]; /* write buffer */
};
struct sysctl_data_s {
struct cdev scd_cdev; /* Character device info */
nasid_t scd_nasid; /* Node on which subchannels are opened. */
};
#endif /* _SN_SYSCTL_H_ */
...@@ -714,7 +714,8 @@ sn_sal_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -714,7 +714,8 @@ sn_sal_interrupt(int irq, void *dev_id, struct pt_regs *regs)
static int static int
sn_sal_connect_interrupt(struct sn_cons_port *port) sn_sal_connect_interrupt(struct sn_cons_port *port)
{ {
if (request_irq(SGI_UART_VECTOR, sn_sal_interrupt, SA_INTERRUPT, if (request_irq(SGI_UART_VECTOR, sn_sal_interrupt,
SA_INTERRUPT | SA_SHIRQ,
"SAL console driver", port) >= 0) { "SAL console driver", port) >= 0) {
return SGI_UART_VECTOR; return SGI_UART_VECTOR;
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* License. See the file "COPYING" in the main directory of this archive * License. See the file "COPYING" in the main directory of this archive
* for more details. * for more details.
* *
* Copyright (c) 2000-2003 Silicon Graphics, Inc. All rights reserved. * Copyright (c) 2000-2004 Silicon Graphics, Inc. All rights reserved.
*/ */
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
#define SN_SAL_SYSCTL_FRU_CAPTURE 0x0200003f #define SN_SAL_SYSCTL_FRU_CAPTURE 0x0200003f
#define SN_SAL_SYSCTL_IOBRICK_PCI_OP 0x02000042 // reentrant #define SN_SAL_SYSCTL_IOBRICK_PCI_OP 0x02000042 // reentrant
#define SN_SAL_IROUTER_OP 0x02000043
/* /*
* Service-specific constants * Service-specific constants
...@@ -85,6 +86,25 @@ ...@@ -85,6 +86,25 @@
#endif /* CONFIG_HOTPLUG_PCI_SGI */ #endif /* CONFIG_HOTPLUG_PCI_SGI */
/*
* IRouter (i.e. generalized system controller) operations
*/
#define SAL_IROUTER_OPEN 0 /* open a subchannel */
#define SAL_IROUTER_CLOSE 1 /* close a subchannel */
#define SAL_IROUTER_SEND 2 /* send part of an IRouter packet */
#define SAL_IROUTER_RECV 3 /* receive part of an IRouter packet */
#define SAL_IROUTER_INTR_STATUS 4 /* check the interrupt status for
* an open subchannel
*/
#define SAL_IROUTER_INTR_ON 5 /* enable an interrupt */
#define SAL_IROUTER_INTR_OFF 6 /* disable an interrupt */
#define SAL_IROUTER_INIT 7 /* initialize IRouter driver */
/* IRouter interrupt mask bits */
#define SAL_IROUTER_INTR_XMIT SAL_CONSOLE_INTR_XMIT
#define SAL_IROUTER_INTR_RECV SAL_CONSOLE_INTR_RECV
/* /*
* SN_SAL_GET_PARTITION_ADDR return constants * SN_SAL_GET_PARTITION_ADDR return constants
*/ */
...@@ -704,4 +724,124 @@ ia64_sn_set_error_handling_features(const u64 *feature_bits) ...@@ -704,4 +724,124 @@ ia64_sn_set_error_handling_features(const u64 *feature_bits)
return rv.status; return rv.status;
} }
/*
* Open a subchannel for sending arbitrary data to the system
* controller network via the system controller device associated with
* 'nasid'. Return the subchannel number or a negative error code.
*/
static inline int
ia64_sn_irtr_open(nasid_t nasid)
{
struct ia64_sal_retval rv;
SAL_CALL_REENTRANT(rv, SN_SAL_IROUTER_OP, SAL_IROUTER_OPEN, nasid,
0, 0, 0, 0, 0);
return (int) rv.v0;
}
/*
* Close system controller subchannel 'subch' previously opened on 'nasid'.
*/
static inline int
ia64_sn_irtr_close(nasid_t nasid, int subch)
{
struct ia64_sal_retval rv;
SAL_CALL_REENTRANT(rv, SN_SAL_IROUTER_OP, SAL_IROUTER_CLOSE,
(u64) nasid, (u64) subch, 0, 0, 0, 0);
return (int) rv.status;
}
/*
* Read data from system controller associated with 'nasid' on
* subchannel 'subch'. The buffer to be filled is pointed to by
* 'buf', and its capacity is in the integer pointed to by 'len'. The
* referent of 'len' is set to the number of bytes read by the SAL
* call. The return value is either SALRET_OK (for bytes read) or
* SALRET_ERROR (for error or "no data available").
*/
static inline int
ia64_sn_irtr_recv(nasid_t nasid, int subch, char *buf, int *len)
{
struct ia64_sal_retval rv;
SAL_CALL_REENTRANT(rv, SN_SAL_IROUTER_OP, SAL_IROUTER_RECV,
(u64) nasid, (u64) subch, (u64) buf, (u64) len,
0, 0);
return (int) rv.status;
}
/*
* Write data to the system controller network via the system
* controller associated with 'nasid' on suchannel 'subch'. The
* buffer to be written out is pointed to by 'buf', and 'len' is the
* number of bytes to be written. The return value is either the
* number of bytes written (which could be zero) or a negative error
* code.
*/
static inline int
ia64_sn_irtr_send(nasid_t nasid, int subch, char *buf, int len)
{
struct ia64_sal_retval rv;
SAL_CALL_REENTRANT(rv, SN_SAL_IROUTER_OP, SAL_IROUTER_SEND,
(u64) nasid, (u64) subch, (u64) buf, (u64) len,
0, 0);
return (int) rv.v0;
}
/*
* Check whether any interrupts are pending for the system controller
* associated with 'nasid' and its subchannel 'subch'. The return
* value is a mask of pending interrupts (SAL_IROUTER_INTR_XMIT and/or
* SAL_IROUTER_INTR_RECV).
*/
static inline int
ia64_sn_irtr_intr(nasid_t nasid, int subch)
{
struct ia64_sal_retval rv;
SAL_CALL_REENTRANT(rv, SN_SAL_IROUTER_OP, SAL_IROUTER_INTR_STATUS,
(u64) nasid, (u64) subch, 0, 0, 0, 0);
return (int) rv.v0;
}
/*
* Enable the interrupt indicated by the intr parameter (either
* SAL_IROUTER_INTR_XMIT or SAL_IROUTER_INTR_RECV).
*/
static inline int
ia64_sn_irtr_intr_enable(nasid_t nasid, int subch, u64 intr)
{
struct ia64_sal_retval rv;
SAL_CALL_REENTRANT(rv, SN_SAL_IROUTER_OP, SAL_IROUTER_INTR_ON,
(u64) nasid, (u64) subch, intr, 0, 0, 0);
return (int) rv.v0;
}
/*
* Disable the interrupt indicated by the intr parameter (either
* SAL_IROUTER_INTR_XMIT or SAL_IROUTER_INTR_RECV).
*/
static inline int
ia64_sn_irtr_intr_disable(nasid_t nasid, int subch, u64 intr)
{
struct ia64_sal_retval rv;
SAL_CALL_REENTRANT(rv, SN_SAL_IROUTER_OP, SAL_IROUTER_INTR_OFF,
(u64) nasid, (u64) subch, intr, 0, 0, 0);
return (int) rv.v0;
}
/*
* Initialize the SAL components of the system controller
* communication driver; specifically pass in a sizable buffer that
* can be used for allocation of subchannel queues as new subchannels
* are opened. "buf" points to the buffer, and "len" specifies its
* length.
*/
static inline int
ia64_sn_irtr_init(nasid_t nasid, void *buf, int len)
{
struct ia64_sal_retval rv;
SAL_CALL_REENTRANT(rv, SN_SAL_IROUTER_OP, SAL_IROUTER_INIT,
(u64) nasid, (u64) buf, (u64) len, 0, 0, 0);
return (int) rv.status;
}
#endif /* _ASM_IA64_SN_SN_SAL_H */ #endif /* _ASM_IA64_SN_SN_SAL_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment