Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Aug 2012 17:08:47 +0000 (UTC)
From:      Max Khon <fjoe@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r239783 - stable/9/sys/dev/puc
Message-ID:  <201208281708.q7SH8l3Z099596@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: fjoe
Date: Tue Aug 28 17:08:47 2012
New Revision: 239783
URL: http://svn.freebsd.org/changeset/base/239783

Log:
  MFC: r238933
  
  - Change back "d_ofs" to int8_t to not pessimize padding and size of "struct puc_cfg".
  - Use "puc_config_moxa" for Moxa boards that need d_ofs greater than 0x7f
  
  Approved by:	re (kib)

Modified:
  stable/9/sys/dev/puc/puc_cfg.h
  stable/9/sys/dev/puc/pucdata.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/puc/puc_cfg.h
==============================================================================
--- stable/9/sys/dev/puc/puc_cfg.h	Tue Aug 28 15:45:37 2012	(r239782)
+++ stable/9/sys/dev/puc/puc_cfg.h	Tue Aug 28 17:08:47 2012	(r239783)
@@ -79,7 +79,7 @@ struct puc_cfg {
 	int8_t		ports;
 	int8_t		rid;		/* Rid of first port */
 	int8_t		d_rid;		/* Delta rid of next ports */
-	int16_t		d_ofs;		/* Delta offset of next ports */
+	int8_t		d_ofs;		/* Delta offset of next ports */
 	puc_config_f 	*config_function;
 };
 

Modified: stable/9/sys/dev/puc/pucdata.c
==============================================================================
--- stable/9/sys/dev/puc/pucdata.c	Tue Aug 28 15:45:37 2012	(r239782)
+++ stable/9/sys/dev/puc/pucdata.c	Tue Aug 28 17:08:47 2012	(r239783)
@@ -510,13 +510,15 @@ const struct puc_cfg puc_pci_devices[] =
 	{   0x1393, 0x1024, 0xffff, 0,
 	    "Moxa Technologies, Smartio CP-102E/PCIe",
 	    DEFAULT_RCLK * 8,
-	    PUC_PORT_2S, 0x14, 0, 0x200
+	    PUC_PORT_2S, 0x14, 0, -1,
+	        .config_function = puc_config_moxa
 	},
 
 	{   0x1393, 0x1025, 0xffff, 0,
 	    "Moxa Technologies, Smartio CP-102EL/PCIe",
 	    DEFAULT_RCLK * 8,
-	    PUC_PORT_2S, 0x14, 0, 0x200,
+	    PUC_PORT_2S, 0x14, 0, -1,
+	        .config_function = puc_config_moxa
 	},
 
 	{   0x1393, 0x1040, 0xffff, 0,
@@ -572,7 +574,8 @@ const struct puc_cfg puc_pci_devices[] =
 	{   0x1393, 0x1182, 0xffff, 0,
 	    "Moxa Technologies, Smartio CP-118EL-A/PCIe",
 	    DEFAULT_RCLK * 8,
-	    PUC_PORT_8S, 0x14, 0, 0x200,
+	    PUC_PORT_8S, 0x14, 0, -1,
+		.config_function = puc_config_moxa
 	},
 
 	{   0x1393, 0x1680, 0xffff, 0,
@@ -596,7 +599,8 @@ const struct puc_cfg puc_pci_devices[] =
 	{   0x1393, 0x1683, 0xffff, 0,
 	    "Moxa Technologies, Smartio CP-168EL-A/PCIe",
 	    DEFAULT_RCLK * 8,
-	    PUC_PORT_8S, 0x14, 0, 0x200,
+	    PUC_PORT_8S, 0x14, 0, -1,
+		.config_function = puc_config_moxa
 	},
 
 	{   0x13a8, 0x0152, 0xffff, 0,
@@ -1153,7 +1157,12 @@ puc_config_moxa(struct puc_softc *sc, en
     intptr_t *res)
 {
 	if (cmd == PUC_CFG_GET_OFS) {
-		*res = ((port == 3) ? 7 : port) * 0x200;
+		const struct puc_cfg *cfg = sc->sc_cfg;
+
+		if (port == 3 && (cfg->device == 0x1045 || cfg->device == 0x1144))
+			port = 7;
+		*res = port * 0x200;
+
 		return 0;
 	}
 	return (ENXIO);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201208281708.q7SH8l3Z099596>