Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Aug 2016 13:56:39 GMT
From:      vincenzo@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r307221 - soc2016/vincenzo/head/usr.sbin/bhyve
Message-ID:  <201608051356.u75DudHj040039@socsvn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: vincenzo
Date: Fri Aug  5 13:56:38 2016
New Revision: 307221
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307221

Log:
   bhyve: ptnet: add I/O register data structure

Modified:
  soc2016/vincenzo/head/usr.sbin/bhyve/pci_ptnetmap_netif.c

Modified: soc2016/vincenzo/head/usr.sbin/bhyve/pci_ptnetmap_netif.c
==============================================================================
--- soc2016/vincenzo/head/usr.sbin/bhyve/pci_ptnetmap_netif.c	Fri Aug  5 13:55:46 2016	(r307220)
+++ soc2016/vincenzo/head/usr.sbin/bhyve/pci_ptnetmap_netif.c	Fri Aug  5 13:56:38 2016	(r307221)
@@ -31,6 +31,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
+#include <string.h>
 
 #include <net/if.h>	/* IFNAMSIZ */
 #include <net/netmap.h>
@@ -48,7 +49,12 @@
 
 
 struct ptnet_softc {
-	struct pci_devinst *pi;		/* PCI device instance */
+	struct pci_devinst	*pi;
+
+	struct ptnetmap_state	*ptbe;
+	unsigned int		num_rings;
+	uint32_t		ioregs[PTNET_IO_END >> 2];
+	void			*csb;
 };
 
 static uint64_t
@@ -65,8 +71,8 @@
 		}
 	}
 
-	printf("%s: Unexpected register read [bar %u, offset %lx size %d]\n",
-		__func__, baridx, offset, size);
+	fprintf(stderr, "%s: Unexpected register read [bar %u, offset %lx "
+		"size %d]\n", __func__, baridx, offset, size);
 
 	return 0;
 }
@@ -80,8 +86,8 @@
 	if (sc == NULL)
 		return;
 
-	printf("%s: Unexpected register write [bar %u, offset %lx size %d "
-	       "value %lx]\n", __func__, baridx, offset, size, value);
+	fprintf(stderr, "%s: Unexpected register write [bar %u, offset %lx "
+		"size %d value %lx]\n", __func__, baridx, offset, size, value);
 }
 
 /* PCI device initialization. */
@@ -118,6 +124,12 @@
 		return ret;
 	}
 
+	/* Initialize registers and data structures. */
+	memset(sc->ioregs, 0, sizeof(sc->ioregs));
+	sc->csb = NULL;
+	sc->num_rings = 0;
+	sc->ptbe = NULL;
+
 	return 0;
 }
 



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