Skip to contentSkip to conversation

Call for testers: Kernel connector update, SuperIO update.

PATCH Evgeniy Polyakov 3 participants 8 messages May 19, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Attached patches and changelogs for the latest connector and superio drivers updates.

Patch against tree included here.
also attached userspace programm to communicate with superio module.

Please review, test and comment.

Little note: driver for access bus is not tested since in my Soekris board ACB can not be detected with both old drivers and new one.

drivers/Makefile renamed from drivers/Makefile~ +2 -0
@@ -43,6 +43,8 @@
 obj-$(CONFIG_I2O)		+= message/
 obj-$(CONFIG_I2C)		+= i2c/
 obj-$(CONFIG_W1)		+= w1/
+obj-$(CONFIG_CONNECTOR)	+= connector/
+obj-$(CONFIG_SUPERIO)		+= superio/
 obj-$(CONFIG_PHONE)		+= telephony/
 obj-$(CONFIG_MD)		+= md/
 obj-$(CONFIG_BT)		+= bluetooth/
drivers/Kconfig renamed from drivers/Kconfig~ +4 -0
@@ -44,6 +44,10 @@
 
 source "drivers/w1/Kconfig"
 
+source "drivers/connector/Kconfig"
+
+source "drivers/superio/Kconfig"
+
 source "drivers/misc/Kconfig"
 
 source "drivers/media/Kconfig"
drivers/superio/Kconfig renamed from tmp/empty/Kconfig +34 -0
diff -Nru /tmp/empty/Kconfig linux-2.6/drivers/superio/Kconfig
@@ -0,0 +1,34 @@
+menu "SuperIO subsystem support"
+
+config SC_SUPERIO
+	tristate "SuperIO subsystem support"
+	depends on CONNECTOR
+	help
+	  SuperIO subsystem support.
+
+config SC_PC8736X
+	tristate "PC8736x SuperIO"
+	depends on SC_SUPERIO
+	help
+	  Say Y here if you want to use PC8736x controller.
+
+config SC_SCX200
+	tristate "SCx200/SC1100 SuperIO"
+	depends on SC_SUPERIO
+	help
+	  Say Y here if you want to use SCx200/SC1100 controller.
+
+
+config SC_GPIO
+	tristate "SuperIO - GPIO"
+	depends on SC_SUPERIO
+	help
+	  Say Y here if you want to use GPIO pins.
+
+config SC_ACB
+	tristate "SuperIO - Access Bus"
+	depends on SC_SUPERIO
+	help
+	  Say Y here if you want to use Access Bus.
+
+endmenu
drivers/superio/Kconfig~ renamed from tmp/empty/Kconfig~ +34 -0
diff -Nru /tmp/empty/Kconfig~ linux-2.6/drivers/superio/Kconfig~
@@ -0,0 +1,34 @@
+menu "SuperIO subsystem support"
+
+config SUPERIO
+	tristate "SuperIO subsystem support"
+	depends on CONNECTOR
+	---help---
+	  SuperIO subsystem support.
+
+config PC8736X
+	tristate "PC8736x SuperIO"
+	depends on SUPERIO
+	help
+	  Say Y here if you want to use PC8736x controller.
+
+config SCX200
+	tristate "SCx200/SC1100 SuperIO"
+	depends on SUPERIO
+	help
+	  Say Y here if you want to use SCx200/SC1100 controller.
+
+
+config SC_GPIO
+	tristate "SuperIO - GPIO"
+	depends on SUPERIO
+	help
+	  Say Y here if you want to use GPIO pins.
+
+config SC_ACB
+	tristate "SuperIO - Access Bus"
+	depends on SUPERIO
+	help
+	  Say Y here if you want to use Access Bus.
+
+endmenu
drivers/superio/Makefile renamed from tmp/empty/Makefile +11 -0
diff -Nru /tmp/empty/Makefile linux-2.6/drivers/superio/Makefile
@@ -0,0 +1,11 @@
+#
+# Makefile for the SuperIO subsystem.
+#
+
+obj-$(CONFIG_SC_SUPERIO)	+= superio.o
+obj-$(CONFIG_SC_GPIO)		+= sc_gpio.o
+obj-$(CONFIG_SC_ACB)		+= sc_acb.o
+obj-$(CONFIG_SC_PC8736X)	+= pc8736x.o
+obj-$(CONFIG_SC_SCX200)		+= scx200.o
+
+superio-objs		:= sc.o chain.o sc_conn.o
drivers/superio/Makefile~ renamed from tmp/empty/Makefile~ +15 -0
diff -Nru /tmp/empty/Makefile~ linux-2.6/drivers/superio/Makefile~
@@ -0,0 +1,15 @@
+#
+# Makefile for the Dallas's 1-wire bus.
+#
+
+obj-$(CONFIG_W1)	+= wire.o
+wire-objs		:= w1.o w1_int.o w1_family.o w1_netlink.o w1_io.o
+
+obj-$(CONFIG_W1_MATROX)		+= matrox_w1.o
+obj-$(CONFIG_W1_THERM)		+= w1_therm.o
+obj-$(CONFIG_W1_SOEKRIS)	+= superio.o
+obj-$(CONFIG_W1_SOEKRIS_GPIO)	+= sc_gpio.o
+obj-$(CONFIG_W1_SOEKRIS_GPIO_W1)+= sc_w1.o
+
+superio-objs		:= sc.o chain.o sc_conn.o
+obj-m				+= pc8736x.o pin_test.o scx200.o sc_acb.o
drivers/superio/chain.c renamed from tmp/empty/chain.c +53 -0

53 lines not on this page · raw message

drivers/superio/chain.h renamed from tmp/empty/chain.h +37 -0
diff -Nru /tmp/empty/chain.h linux-2.6/drivers/superio/chain.h
@@ -0,0 +1,37 @@
+/*
+ * 	chain.h
+ * 
+ * 2004 Copyright (c) Evgeniy Polyakov <[email protected]>
+ * All rights reserved.
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+#ifndef __CHAIN_H
+#define __CHAIN_H
+
+#include <linux/list.h>
+
+struct dev_chain
+{
+	struct list_head	chain_entry;
+	void			*ptr;
+};
+
+struct dev_chain *chain_alloc(void *ptr);
+void chain_free(struct dev_chain *ch);
+
+#endif /* __CHAIN_H */
drivers/superio/pc8736x.c renamed from tmp/empty/pc8736x.c +212 -0

212 lines not on this page · raw message

drivers/superio/pc8736x.h renamed from tmp/empty/pc8736x.h +39 -0
diff -Nru /tmp/empty/pc8736x.h linux-2.6/drivers/superio/pc8736x.h
@@ -0,0 +1,39 @@
+/*
+ * 	pc8736x.h
+ * 
+ * 2004 Copyright (c) Evgeniy Polyakov <[email protected]>
+ * All rights reserved.
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+#ifndef __PC8736X_H
+#define __PC8736X_H
+
+#define SIO_GPDO0		0x00
+#define SIO_GPDI0 		0x01
+#define SIO_GPEVEN0		0x02 
+#define SIO_GPEVST0		0x03 
+#define SIO_GPDO1 		0x04
+#define SIO_GPDI1 		0x05
+#define SIO_GPEVEN1		0x06 
+#define SIO_GPEVST1		0x07 
+#define SIO_GPDO2 		0x08
+#define SIO_GPDI2 		0x09
+#define SIO_GPDO3 		0x0A
+#define SIO_GPDI3 		0x0B
+
+#endif /* __PC8736X_H */
drivers/superio/sc.c renamed from tmp/empty/sc.c +777 -0

777 lines not on this page · raw message

drivers/superio/sc.h renamed from tmp/empty/sc.h +132 -0

132 lines not on this page · raw message

drivers/superio/sc_acb.c renamed from tmp/empty/sc_acb.c +166 -0

166 lines not on this page · raw message

drivers/superio/sc_acb.h renamed from tmp/empty/sc_acb.h +45 -0

45 lines not on this page · raw message

drivers/superio/sc_conn.c renamed from tmp/empty/sc_conn.c +133 -0

133 lines not on this page · raw message

drivers/superio/sc_conn.h renamed from tmp/empty/sc_conn.h +50 -0

50 lines not on this page · raw message

drivers/superio/sc_gpio.c renamed from tmp/empty/sc_gpio.c +214 -0

214 lines not on this page · raw message

drivers/superio/sc_gpio.h renamed from tmp/empty/sc_gpio.h +53 -0

53 lines not on this page · raw message

drivers/superio/scx200.c renamed from tmp/empty/scx200.c +411 -0

411 lines not on this page · raw message

drivers/superio/scx200.h renamed from tmp/empty/scx200.h +28 -0
diff -Nru /tmp/empty/scx200.h linux-2.6/drivers/superio/scx200.h
@@ -0,0 +1,28 @@
+/*
+ * 	scx200.h
+ * 
+ * 2004 Copyright (c) Evgeniy Polyakov <[email protected]>
+ * All rights reserved.
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+#ifndef __SCX200_H
+#define __SCX200_H
+
+#define SCx200_GPIO_SIZE 	0x2c
+
+#endif /* __SCX200_H */
drivers/connector/Kconfig renamed from tmp/empty/Kconfig +13 -0
diff -Nru /tmp/empty/Kconfig linux-2.6/drivers/connector/Kconfig
@@ -0,0 +1,13 @@
+menu "Connector - unified userspace <-> kernelspace linker"
+
+config CONNECTOR
+	tristate "Connector - unified userspace <-> kernelspace linker"
+	depends on NET
+	---help---
+	  This is unified userspace <-> kernelspace connector working on top
+	  of the netlink socket protocol.
+
+	  Connector support can also be built as a module.  If so, the module
+	  will be called connector.ko.
+
+endmenu
drivers/connector/Makefile renamed from tmp/empty/Makefile +16 -0
diff -Nru /tmp/empty/Makefile linux-2.6/drivers/connector/Makefile
@@ -0,0 +1,16 @@
+obj-m		:= cn.o
+cn-objs		:= cn_queue.o connector.o
+
+#KDIR	:= /lib/modules/$(shell uname -r)/build
+KDIR	:= /usr/local/src/linux-2.6/linux-2.6.6
+PWD	:= $(shell pwd)
+
+default:
+	$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
+
+clean:
+	rm -f *.o *.ko *.mod.* .*.cmd *~
+	rm -rf .tmp_versions
+
+ucon:	ucon.c connector.h
+	gcc -W -Wall -O9 ucon.c -o ucon
drivers/connector/cn_queue.c renamed from tmp/empty/cn_queue.c +214 -0

214 lines not on this page · raw message

drivers/connector/cn_queue.h renamed from tmp/empty/cn_queue.h +90 -0

90 lines not on this page · raw message

drivers/connector/cn_test.c renamed from tmp/empty/cn_test.c +66 -0

66 lines not on this page · raw message

drivers/connector/connector.c renamed from tmp/empty/connector.c +310 -0

139 lines not on this page · raw message

drivers/connector/connector.h renamed from tmp/empty/connector.h +58 -0

58 lines not on this page · raw message

drivers/connector/ucon.c renamed from tmp/empty/ucon.c +213 -0

213 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

--
Evgeniy Polyakov ( s0mbre )

Crash is better than data corruption. -- Artur Grabowski -------------- next part --------------

# do not edit -- automatically generated by arch changelog
# arch-tag: [email protected]/connector--main--0
#
2004-09-09 07:04:41 GMT	Evgeniy Polyakov <[email protected]>	patch-6

Summary:
Use group 1 as start point not group 0.
Revision:
connector--main--0--patch-6

Use group 1 as start point not group 0.

modified files:
cn_queue.c

2004-09-09 07:03:09 GMT	Evgeniy Polyakov <[email protected]>	patch-5

Summary:
Changed to support new protocol headers.
Revision:
connector--main--0--patch-5

Changed to support new protocol headers.

modified files:
ucon.c

2004-09-09 07:02:27 GMT	Evgeniy Polyakov <[email protected]>	patch-4

Summary:
Fixed skb leaks in callback processing, added commented debug output.
Revision:
connector--main--0--patch-4

Fixed skb leaks in callback processing, added commented debug output.

modified files:
connector.c

2004-09-09 04:28:26 GMT	Evgeniy Polyakov <[email protected]>	patch-3

Summary:
new header/message support.
Revision:
connector--main--0--patch-3

New header/message support.

modified files:
ucon.c

2004-09-08 12:42:22 GMT	Evgeniy Polyakov <[email protected]>	patch-2

Summary:
Added cn_netlink_send(), changed packet identification.
Revision:
connector--main--0--patch-2

Added cn_netlink_send() - sends provided packet through dev->nls socket.

Changed packet identification - struct cb_id.

modified files:
cn_queue.c cn_queue.h cn_test.c connector.c connector.h

-------------- next part --------------

cn_queue.c +23 -5
diff -Nru connector--main--0--patch-1/cn_queue.c connector--main--0--patch-6/cn_queue.c

Lines of this file are not shown. View the raw message.

cn_queue.h +21 -3
diff -Nru connector--main--0--patch-1/cn_queue.h connector--main--0--patch-6/cn_queue.h

Lines of this file are not shown. View the raw message.

cn_test.c +12 -8
diff -Nru connector--main--0--patch-1/cn_test.c connector--main--0--patch-6/cn_test.c

Lines of this file are not shown. View the raw message.

connector.c +99 -16

115 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Binary files connector--main--0--patch-1/connector.dia and connector--main--0--patch-6/connector.dia differ

connector.h +19 -11
diff -Nru connector--main--0--patch-1/connector.h connector--main--0--patch-6/connector.h

Lines of this file are not shown. View the raw message.

ucon.c +50 -12

62 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

-------------- next part --------------

chain.h +2 -0
diff -Nru soekris--main--0--patch-56/chain.h soekris--main--0--patch-66/chain.h

Lines of this file are not shown. View the raw message.

Makefile +1 -1
diff -Nru soekris--main--0--patch-56/Makefile soekris--main--0--patch-66/Makefile

Lines of this file are not shown. View the raw message.

sc.c +29 -11
diff -Nru soekris--main--0--patch-56/sc.c soekris--main--0--patch-66/sc.c

Lines of this file are not shown. View the raw message.

sc_conn.c +133 -0

133 lines not on this page · raw message

sc_conn.h +50 -0

50 lines not on this page · raw message

sc.h +1 -0
diff -Nru soekris--main--0--patch-56/sc.h soekris--main--0--patch-66/sc.h

Lines of this file are not shown. View the raw message.

scx200.c +102 -1

103 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

-------------- next part --------------

# do not edit -- automatically generated by arch changelog
# arch-tag: [email protected]/soekris--main--0
#
2004-09-09 07:07:21 GMT	Evgeniy Polyakov <[email protected]>	patch-66

Summary:
Added callback registration prototype definitions, marked first entry in enum as 0.
Revision:
soekris--main--0--patch-66

Added callback registration prototype definitions, marked first entry in enum as 0.

modified files:
sc_conn.h

2004-09-09 07:06:43 GMT	Evgeniy Polyakov <[email protected]>	patch-65

Summary:
Commented some debug info, fixed leak in reply messge, added callback registration routing.
Revision:
soekris--main--0--patch-65

Commented some debug info, fixed leak in reply messge, added callback registration routing.

modified files:
sc_conn.c

2004-09-09 07:05:41 GMT	Evgeniy Polyakov <[email protected]>	patch-64

Summary:
Removed unneded debug output, added callback registration.
Revision:
soekris--main--0--patch-64

Removed unneded debug output, added callback registration.

modified files:
sc.c

2004-09-08 12:44:53 GMT	Evgeniy Polyakov <[email protected]>	patch-63

Summary:
Added sc_conn - initial part of migrating to "connector".
Revision:
soekris--main--0--patch-63

Added sc_conn - initial part of migrating to "connector".

new files:
.arch-ids/sc_conn.c.id .arch-ids/sc_conn.h.id sc_conn.c sc_conn.h

modified files:
Makefile

2004-09-08 12:43:50 GMT	Evgeniy Polyakov <[email protected]>	patch-62

Summary:
Added sc_conn.h include.
Revision:
soekris--main--0--patch-62

Added sc_conn.h include.

modified files:
sc.c

2004-09-08 12:43:10 GMT	Evgeniy Polyakov <[email protected]>	patch-61
    Summary:
      Fixes includes.
    Revision:
      soekris--main--0--patch-61

    Fixes includes.

    modified files:
     chain.h
2004-09-08 08:05:11 GMT	Evgeniy Polyakov <[email protected]>	patch-60

Summary:
Need to prototype declaration of sc_get_ldev_in_sdev().
Revision:
soekris--main--0--patch-60

Need to prototype declaration of sc_get_ldev_in_sdev().

modified files:
sc.h

2004-09-08 08:04:08 GMT	Evgeniy Polyakov <[email protected]>	patch-59

Summary:
Need to export sc_get_ldev_in_sdev().
Revision:
soekris--main--0--patch-59

Need to export sc_get_ldev_in_sdev().

modified files:
sc.c

2004-09-08 08:00:51 GMT	Evgeniy Polyakov <[email protected]>	patch-58

Summary:
Added sc_get_ldev_in_sdev() - searches first logical device with the given name connected to given SuperIO chip.
Revision:
soekris--main--0--patch-58

Added sc_get_ldev_in_sdev() - searches first logical device with the given name connected to given SuperIO chip.

modified files:
sc.c

2004-09-08 07:58:20 GMT	Evgeniy Polyakov <[email protected]>	patch-57
    Summary:
      Added scx200_gpio_* functions().
    Revision:
      soekris--main--0--patch-57

    Added scx200_gpio_* functions() - they must be used for GPIO operations with SCx200/SC1100 chip.
    Functions provided by the higher SuperIO layer are substituted with private ones.

    modified files:
     scx200.c

-------------- next part --------------
/*
* ucon.c
*
* Copyright (c) 2004 Evgeniy Polyakov <[email protected]>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */

#include <asm/types.h>

#include <sys/types.h>
#include <sys/socket.h>
#include <sys/poll.h>

#include <linux/netlink.h>
#include <linux/rtnetlink.h>

#include <arpa/inet.h>

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <time.h>

#include "connector.h"
#include "../soekris/sc_conn.h"

static int need_exit;
__u32 seq;

static int netlink_send(int s, char *data)

{
	struct nlmsghdr *nlh;
	unsigned int size;
	int err;
	char buf[128];
	struct cn_msg *m, *msg;
	struct sc_conn_data *cmd;

	size = NLMSG_SPACE(sizeof(struct cn_msg) + sizeof(struct sc_conn_data));
	
	nlh = (struct nlmsghdr *)buf;
	nlh->nlmsg_seq = seq++;
	nlh->nlmsg_pid = getpid();
	nlh->nlmsg_type = NLMSG_DONE;
	nlh->nlmsg_len = NLMSG_LENGTH(size - sizeof(*nlh));
	nlh->nlmsg_flags = 0;

	m = NLMSG_DATA(nlh);
	msg = (struct cn_msg *)data;
	cmd = (struct sc_conn_data *)(msg + 1);

	printf("%s: len=%u, seq=%u, ack=%u, "
		"sname=%s, lname=%s, idx=0x%x, cmd=%02x [%02x.%02x.%02x].\n",
			__func__, 
			msg->len, msg->seq, msg->ack,
			cmd->sname,
			cmd->lname, cmd->idx,
			cmd->cmd, cmd->p0, cmd->p1, cmd->p2);

	memcpy(m, data, sizeof(*m) + msg->len);

	err = send(s, nlh, size, 0);
	if (err = -1)
		fprintf(stderr, "Failed to send: %s [%d].\n",
				strerror(errno), errno);

	return err;
}

int main(int argc, char *argv[])

{
	int s;
	char buf[1024];
	int len;
	struct nlmsghdr *reply;
	struct sockaddr_nl l_local;
	struct cn_msg *data;
	struct sc_conn_data *m;
	FILE *out;
	time_t tm;
	struct pollfd pfd;
	
	if (argc < 2)
		out = stdout;
	else
	{
		out = fopen(argv[1], "a+");
		if (!out)
		{
			fprintf(stderr, "Unable to open %s for writing: %s\n", 
					argv[1], strerror(errno));
			out = stdout;
		}
	}
	
	memset(buf, 0, sizeof(buf));
	
	s = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_NFLOG);
	if (s = -1)
	{
		perror("socket");
		return -1;
	}
	
	l_local.nl_family = AF_NETLINK;
	l_local.nl_groups = 1;
	l_local.nl_pid    = getpid();
	
	if (bind(s, (struct sockaddr *)&l_local, sizeof(struct sockaddr_nl)) = -1)
	{
		perror("bind");
		close(s);
		return -1;
	}

	pfd.fd = s;

	while (!need_exit)
	{
		pfd.events = POLLIN;
		pfd.revents = 0;
		/*switch (poll(&pfd, 1, -1)) 
		{
			case 0:
				need_exit = 1;
				break;
			case -1:
				if (errno != EINTR) 
				{
					need_exit = 1;
					break;
				}
				continue;
		}*/
		if (need_exit)
			break;

		data = (struct cn_msg *)buf;

		data->id.idx 	= 0xaabb;
		data->id.val 	= 0xccdd;
		data->seq 	= seq++;
		data->ack 	= (seq ^ 0x1234);
		data->len 	= sizeof(*m);

		m = (struct sc_conn_data *)(data+1);
		memset(m, 0, sizeof(*m));

		m->cmd = SC_CMD_LDEV_READ;
		m->idx = 0xff;
		sprintf(m->sname, "PC8736X");
		sprintf(m->lname, "GPIO");

		m->p0 = 21;

		len = netlink_send(s, buf);

		len = recv(s, buf, sizeof(buf), 0);
		if (len = -1)
		{
			perror("recv buf");
			close(s);
			return -1;
		}
		reply = (struct nlmsghdr *)buf;
		
		switch (reply->nlmsg_type)
		{
			case NLMSG_ERROR:
				fprintf(out, "Error message received.\n");
				fflush(out);
				break;
			case NLMSG_DONE:
				data = (struct cn_msg *)NLMSG_DATA(reply);
				m = (struct sc_conn_data *)(data+1);
				
				time(&tm);
				fprintf(out, "%.24s : [%x.%x] [seq=%u, ack=%u], sname=%s, lname=%s, idx=%u, cmd=%#02x [%#02x.%#02x.%#02x]\n", 
					ctime(&tm), 
					data->id.idx, data->id.val,
					data->seq, data->ack, 
					m->sname, m->lname, m->idx,
					m->cmd,
					m->p0, m->p1, m->p2);
				fflush(out);
				break;
			default:
				break;
		}

		sleep(1);
	}

	close(s);
	return 0;
}

Part of the diff is not shown here. View the raw message.

#1 lore raw
Quoted 2 lines · Evgeniy Polyakov

Attached patches and changelogs for the latest connector and superio drivers updates.

Can you please fix up the coding style issues?

Quoted 1 line

+source "drivers/connector/Kconfig"

This code will have to go through the linux-kernel list before it will be accepted, as you are creating a new way for kernel and userspace to talk. How about just dropping it for now from this superio patch?

Quoted 26 lines

diff -Nru /tmp/empty/Kconfig linux-2.6/drivers/superio/Kconfig

drivers/superio/Kconfig renamed from tmp/empty/Kconfig +22 -0
@@ -0,0 +1,34 @@
+menu "SuperIO subsystem support"
+
+config SC_SUPERIO
+	tristate "SuperIO subsystem support"
+	depends on CONNECTOR
+	help
+	  SuperIO subsystem support.
+
+config SC_PC8736X
+	tristate "PC8736x SuperIO"
+	depends on SC_SUPERIO
+	help
+	  Say Y here if you want to use PC8736x controller.
+
+config SC_SCX200
+	tristate "SCx200/SC1100 SuperIO"
+	depends on SC_SUPERIO
+	help
+	  Say Y here if you want to use SCx200/SC1100 controller.
+
+
+config SC_GPIO

drivers/superio/Kconfig line 32

Quoted 10 lines
drivers/superio/Kconfig renamed from tmp/empty/Kconfig +10 -0
+	tristate "SuperIO - GPIO"
+	depends on SC_SUPERIO
+	help
+	  Say Y here if you want to use GPIO pins.
+
+config SC_ACB
+	tristate "SuperIO - Access Bus"
+	depends on SC_SUPERIO
+	help
+	  Say Y here if you want to use Access Bus.

Please add more documentation about what this is.

thanks,

greg k-h

#2 lore raw
In reply to Evgeniy Polyakov
Quoted 5 lines · Greg KH
Quoted 2 lines · Evgeniy Polyakov

Attached patches and changelogs for the latest connector and superio drivers updates.

Can you please fix up the coding style issues?

Sigh. I thought you will not notice. :)
Fixed...

Quoted 6 lines
Quoted 2 lines

+source "drivers/connector/Kconfig"

This code will have to go through the linux-kernel list before it will be accepted, as you are creating a new way for kernel and userspace to talk. How about just dropping it for now from this superio patch?

Actually superio depends on it since it is the only way for superio to communicate with the external(userspace) world by design.

Connector is simply a little additional storey on netlink which as a bonus allows to register callback based on the predefined fields of the protocol header(btw, it uses simple protocol, which is described in connector.c file, but one easily may skip filling it's seq, ack...).

If you do think that it must be discussed in those flood of "strangeness" known as linux-kernel@ mail list, then ok, I will post it there, but I really do not see any reason for this.

Quoted 3 lines
Quoted 3 lines

diff -Nru /tmp/empty/Kconfig linux-2.6/drivers/superio/Kconfig

drivers/superio/Kconfig renamed from tmp/empty/Kconfig +0 -0

<snip>

Quoted 2 lines

Please add more documentation about what this is.

Sure. Done.

Thank you.

Quoted 3 lines

thanks,

greg k-h

drivers/Makefile renamed from drivers/Makefile~ +2 -0
@@ -43,6 +43,8 @@
 obj-$(CONFIG_I2O)		+= message/
 obj-$(CONFIG_I2C)		+= i2c/
 obj-$(CONFIG_W1)		+= w1/
+obj-$(CONFIG_CONNECTOR)	+= connector/
+obj-$(CONFIG_SUPERIO)		+= superio/
 obj-$(CONFIG_PHONE)		+= telephony/
 obj-$(CONFIG_MD)		+= md/
 obj-$(CONFIG_BT)		+= bluetooth/
drivers/Kconfig renamed from drivers/Kconfig~ +4 -0
@@ -44,6 +44,10 @@
 
 source "drivers/w1/Kconfig"
 
+source "drivers/connector/Kconfig"
+
+source "drivers/superio/Kconfig"
+
 source "drivers/misc/Kconfig"
 
 source "drivers/media/Kconfig"
drivers/superio/Kconfig renamed from tmp/empty/Kconfig +56 -0

56 lines not on this page · raw message

drivers/superio/Makefile renamed from tmp/empty/Makefile +11 -0
diff -Nru /tmp/empty/Makefile linux-2.6/drivers/superio/Makefile
@@ -0,0 +1,11 @@
+#
+# Makefile for the SuperIO subsystem.
+#
+
+obj-$(CONFIG_SC_SUPERIO)	+= superio.o
+obj-$(CONFIG_SC_GPIO)		+= sc_gpio.o
+obj-$(CONFIG_SC_ACB)		+= sc_acb.o
+obj-$(CONFIG_SC_PC8736X)	+= pc8736x.o
+obj-$(CONFIG_SC_SCX200)		+= scx200.o
+
+superio-objs		:= sc.o chain.o sc_conn.o
drivers/superio/chain.c renamed from tmp/empty/chain.c +52 -0

52 lines not on this page · raw message

drivers/superio/chain.h renamed from tmp/empty/chain.h +37 -0
diff -Nru /tmp/empty/chain.h linux-2.6/drivers/superio/chain.h
@@ -0,0 +1,37 @@
+/*
+ * 	chain.h
+ * 
+ * 2004 Copyright (c) Evgeniy Polyakov <[email protected]>
+ * All rights reserved.
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+#ifndef __CHAIN_H
+#define __CHAIN_H
+
+#include <linux/list.h>
+
+struct dev_chain
+{
+	struct list_head	chain_entry;
+	void			*ptr;
+};
+
+struct dev_chain *chain_alloc(void *ptr);
+void chain_free(struct dev_chain *ch);
+
+#endif /* __CHAIN_H */
drivers/superio/pc8736x.c renamed from tmp/empty/pc8736x.c +205 -0

205 lines not on this page · raw message

drivers/superio/pc8736x.h renamed from tmp/empty/pc8736x.h +39 -0
diff -Nru /tmp/empty/pc8736x.h linux-2.6/drivers/superio/pc8736x.h
@@ -0,0 +1,39 @@
+/*
+ * 	pc8736x.h
+ * 
+ * 2004 Copyright (c) Evgeniy Polyakov <[email protected]>
+ * All rights reserved.
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+#ifndef __PC8736X_H
+#define __PC8736X_H
+
+#define SIO_GPDO0		0x00
+#define SIO_GPDI0 		0x01
+#define SIO_GPEVEN0		0x02 
+#define SIO_GPEVST0		0x03 
+#define SIO_GPDO1 		0x04
+#define SIO_GPDI1 		0x05
+#define SIO_GPEVEN1		0x06 
+#define SIO_GPEVST1		0x07 
+#define SIO_GPDO2 		0x08
+#define SIO_GPDI2 		0x09
+#define SIO_GPDO3 		0x0A
+#define SIO_GPDI3 		0x0B
+
+#endif /* __PC8736X_H */
drivers/superio/sc.c renamed from tmp/empty/sc.c +753 -0

753 lines not on this page · raw message

drivers/superio/sc.h renamed from tmp/empty/sc.h +132 -0

132 lines not on this page · raw message

drivers/superio/sc_acb.c renamed from tmp/empty/sc_acb.c +163 -0

163 lines not on this page · raw message

drivers/superio/sc_acb.h renamed from tmp/empty/sc_acb.h +45 -0

45 lines not on this page · raw message

drivers/superio/sc_conn.c renamed from tmp/empty/sc_conn.c +127 -0

127 lines not on this page · raw message

drivers/superio/sc_conn.h renamed from tmp/empty/sc_conn.h +50 -0

50 lines not on this page · raw message

drivers/superio/sc_gpio.c renamed from tmp/empty/sc_gpio.c +210 -0

210 lines not on this page · raw message

drivers/superio/sc_gpio.h renamed from tmp/empty/sc_gpio.h +53 -0

53 lines not on this page · raw message

drivers/superio/sc_w1.c renamed from tmp/empty/sc_w1.c +112 -0

112 lines not on this page · raw message

drivers/superio/scx200.c renamed from tmp/empty/scx200.c +412 -0

412 lines not on this page · raw message

drivers/superio/scx200.h renamed from tmp/empty/scx200.h +28 -0
diff -Nru /tmp/empty/scx200.h linux-2.6/drivers/superio/scx200.h
@@ -0,0 +1,28 @@
+/*
+ * 	scx200.h
+ * 
+ * 2004 Copyright (c) Evgeniy Polyakov <[email protected]>
+ * All rights reserved.
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+#ifndef __SCX200_H
+#define __SCX200_H
+
+#define SCx200_GPIO_SIZE 	0x2c
+
+#endif /* __SCX200_H */
drivers/connector/Kconfig renamed from tmp/empty/Kconfig +13 -0
diff -Nru /tmp/empty/Kconfig linux-2.6/drivers/connector/Kconfig
@@ -0,0 +1,13 @@
+menu "Connector - unified userspace <-> kernelspace linker"
+
+config CONNECTOR
+	tristate "Connector - unified userspace <-> kernelspace linker"
+	depends on NET
+	---help---
+	  This is unified userspace <-> kernelspace connector working on top
+	  of the netlink socket protocol.
+
+	  Connector support can also be built as a module.  If so, the module
+	  will be called connector.ko.
+
+endmenu
drivers/connector/Makefile renamed from tmp/empty/Makefile +2 -0
diff -Nru /tmp/empty/Makefile linux-2.6/drivers/connector/Makefile
@@ -0,0 +1,2 @@
+obj-$(CONFIG_CONNECTOR)		+= cn.o
+cn-objs		:= cn_queue.o connector.o
drivers/connector/cn_queue.c renamed from tmp/empty/cn_queue.c +217 -0

217 lines not on this page · raw message

drivers/connector/cn_queue.h renamed from tmp/empty/cn_queue.h +90 -0

90 lines not on this page · raw message

drivers/connector/cn_test.c renamed from tmp/empty/cn_test.c +64 -0

64 lines not on this page · raw message

drivers/connector/connector.c renamed from tmp/empty/connector.c +294 -0

111 lines not on this page · raw message

drivers/connector/connector.h renamed from tmp/empty/connector.h +58 -0

58 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 8 lines
	Evgeniy Polyakov ( s0mbre )
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20040910/0e17384d/attachment.bin

Part of the diff is not shown here. View the raw message.

#3 lore raw
In reply to Evgeniy Polyakov

Doh. Minor update.

Questions, requests, suggestions?

Evgeniy Polyakov ( s0mbre )

Only failure makes us experts. -- Theo de Raadt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: connector.patch
Type: application/octet-stream
Size: 20464 bytes
Desc: not available
Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20040911/4912235b/connector.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: superio.patch
Type: application/octet-stream
Size: 68980 bytes
Desc: not available
Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20040911/4912235b/superio.obj

#4 lore raw
In reply to Evgeniy Polyakov
Quoted 3 lines

Doh. Minor update.

Questions, requests, suggestions?

FYI, I will not be able to review your code. For one thing I don't have much spare time these days and no convenient Internet access either. For another I don't feel competent for the job; this is simply beyond me.

Side note: no need to CC me, I am subscribed to the lm_sensors mailing-list.

Thanks.

Signature · 2 lines
Jean "Khali" Delvare
http://khali.linux-fr.org/
#5 lore raw
In reply to Evgeniy Polyakov
Quoted 4 lines

I swear I will not smoke bad crack anymore.

Patch for Makefile was broken.
Corrected shoud use SC_SUPERIO not SUPERIO.

BTW I still don't get what that "SC" is for. This is a directory where drivers for Super-I/O chips will be located, so why not actually simply call the option SUPERIO?

Thanks.

Signature · 2 lines
Jean "Khali" Delvare
http://khali.linux-fr.org/
#6 lore raw
In reply to Evgeniy Polyakov
Quoted 3 lines · On Sat, 11 Sep 2004 17:46:06 +0400 Evgeniy Polyakov <[email protected]> wrote:

Doh. Minor update.

Questions, requests, suggestions?

I swear I will not smoke bad crack anymore.

Patch for Makefile was broken.
Corrected shoud use SC_SUPERIO not SUPERIO.

usr/local/src/linux/soekris/linux-2.6/drivers/Makefile renamed from usr/local/src/linux/soekris/linux-2.6/drivers/Makefile.orig +2 -0
@@ -43,6 +43,8 @@
 obj-$(CONFIG_I2O)		+= message/
 obj-$(CONFIG_I2C)		+= i2c/
 obj-$(CONFIG_W1)		+= w1/
+obj-$(CONFIG_CONNECTOR)		+= connector/
+obj-$(CONFIG_SC_SUPERIO)	+= superio/
 obj-$(CONFIG_PHONE)		+= telephony/
 obj-$(CONFIG_MD)		+= md/
 obj-$(CONFIG_BT)		+= bluetooth/

Evgeniy Polyakov ( s0mbre )

Only failure makes us experts. -- Theo de Raadt

#7 lore raw
In reply to Evgeniy Polyakov
Quoted 8 lines · On Sat, 11 Sep 2004 23:18:45 +0200 Jean Delvare <[email protected]> wrote:
Quoted 4 lines

I swear I will not smoke bad crack anymore.

Patch for Makefile was broken.
Corrected shoud use SC_SUPERIO not SUPERIO.

BTW I still don't get what that "SC" is for. This is a directory where drivers for Super-I/O chips will be located, so why not actually simply call the option SUPERIO?

I really do not remember why it has sc_ prefix. Initially it was something like "soekris", probably "soekris control" or "superio control". Directory for superio subsystem probably will be called superio, at least it has such name in the patches.

Quoted 5 lines

Thanks.

Signature · 2 lines
Jean "Khali" Delvare
http://khali.linux-fr.org/

Evgeniy Polyakov ( s0mbre )

Only failure makes us experts. -- Theo de Raadt