From 57ce33acfe52aed68c2dac645bd433d083052bf2 Mon Sep 17 00:00:00 2001 From: Bryan Drewery Date: Mon, 11 Jan 2016 20:27:05 +0000 Subject: [PATCH 01/82] Correct a comment. Submitted by: jhb --- Makefile.inc1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 3429fdaae8ae..6ee07b1d19c0 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -569,7 +569,7 @@ _worldtmp: .PHONY .endif .else rm -rf ${WORLDTMP}/legacy/usr/include -# XXX - These three can depend on any header file. +# XXX - These can depend on any header file. rm -f ${OBJTREE}${.CURDIR}/lib/libsysdecode/ioctl.c rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c .endif From c0ada0377a08a45380ccb7eb01e24f2094bd9d61 Mon Sep 17 00:00:00 2001 From: Colin Percival Date: Mon, 11 Jan 2016 20:38:39 +0000 Subject: [PATCH 02/82] Fix a bug introduced in r291716: "The problem with the approach taken both in _bus_dmamap_load_pages and bus_dmamap_load_ma_triv is that they split the request buffer into arbitrary chunks based on page boundaries, creating segments that no longer have a size that's a multiple of the sector size. This breaks drivers like blkfront (and probably other stuff)." [1] This was most easily triggered by running `fsck /` on a system running in Xen (e.g. Amazon EC2) but also showed up via growfs(8) and probably many other userland tools which access the disk directly. Patch by: royger [1] "Thinks this should be fine" by: ken --- sys/kern/subr_bus_dma.c | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/sys/kern/subr_bus_dma.c b/sys/kern/subr_bus_dma.c index ae302768f2f1..cdf176b26ee4 100644 --- a/sys/kern/subr_bus_dma.c +++ b/sys/kern/subr_bus_dma.c @@ -130,28 +130,6 @@ _bus_dmamap_load_mbuf_sg(bus_dma_tag_t dmat, bus_dmamap_t map, return (error); } -/* - * Load tlen data starting at offset within a region specified by a list of - * physical pages. - */ -static int -_bus_dmamap_load_pages(bus_dma_tag_t dmat, bus_dmamap_t map, - vm_page_t *pages, bus_size_t tlen, int offset, int *nsegs, int flags) -{ - vm_paddr_t paddr; - bus_size_t len; - int error, i; - - for (i = 0, error = 0; error == 0 && tlen > 0; i++, tlen -= len) { - len = min(PAGE_SIZE - offset, tlen); - paddr = VM_PAGE_TO_PHYS(pages[i]) + offset; - error = _bus_dmamap_load_phys(dmat, map, paddr, len, - flags, NULL, nsegs); - offset = 0; - } - return (error); -} - /* * Load from block io. */ @@ -168,8 +146,8 @@ _bus_dmamap_load_bio(bus_dma_tag_t dmat, bus_dmamap_t map, struct bio *bio, } if ((bio->bio_flags & BIO_UNMAPPED) != 0) - return (_bus_dmamap_load_pages(dmat, map, bio->bio_ma, - bio->bio_bcount, bio->bio_ma_offset, nsegs, flags)); + return (_bus_dmamap_load_ma(dmat, map, bio->bio_ma, + bio->bio_bcount, bio->bio_ma_offset, flags, NULL, nsegs)); return (_bus_dmamap_load_buffer(dmat, map, bio->bio_data, bio->bio_bcount, kernel_pmap, flags, NULL, nsegs)); From cbb261aec7de20bad5d56ed7a2b2670c6f1ce902 Mon Sep 17 00:00:00 2001 From: Colin Percival Date: Mon, 11 Jan 2016 21:02:30 +0000 Subject: [PATCH 03/82] Add two more assertions to catch busdma problems. Each segment provided by busdma to the blkfront driver must be an integer number of sectors, and must be aligned in memory on a "sector" boundary. Having these assertions yesterday would have made finding the bug fixed in r293698 somewhat easier. --- sys/dev/xen/blkfront/blkfront.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/dev/xen/blkfront/blkfront.c b/sys/dev/xen/blkfront/blkfront.c index 0a75d79b1d25..c193d84b5a2b 100644 --- a/sys/dev/xen/blkfront/blkfront.c +++ b/sys/dev/xen/blkfront/blkfront.c @@ -170,6 +170,11 @@ xbd_mksegarray(bus_dma_segment_t *segs, int nsegs, int ref; while (sg < last_block_sg) { + KASSERT(segs->ds_addr % (1 << XBD_SECTOR_SHFT) == 0, + ("XEN disk driver I/O must be sector aligned")); + KASSERT(segs->ds_len % (1 << XBD_SECTOR_SHFT) == 0, + ("XEN disk driver I/Os must be a multiple of " + "the sector length")); buffer_ma = segs->ds_addr; fsect = (buffer_ma & PAGE_MASK) >> XBD_SECTOR_SHFT; lsect = fsect + (segs->ds_len >> XBD_SECTOR_SHFT) - 1; From d140ec33c78cf86f083ca60afbabb8740113ec22 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Mon, 11 Jan 2016 21:56:53 +0000 Subject: [PATCH 04/82] Fix theoretical leak of netconfig(3) resources in svcunix_create(..) In the event that the getconfig(3) call in svcunix_create is partly successful, some of the netconfig(3) resources allocated might be leaked if the call returns NULL as endnetconfig(3) wasn't called explicitly in that case. Ensure that the resources are fully cleaned up by going to the `done` label, which will call endnetconfig(3) for us. MFC after: 1 week Reported by: Coverity Submitted by: Miles Ohlrich Sponsored by: EMC / Isilon Storage Division --- lib/libc/rpc/rpc_soc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libc/rpc/rpc_soc.c b/lib/libc/rpc/rpc_soc.c index 11fc80302a12..64516a9fe806 100644 --- a/lib/libc/rpc/rpc_soc.c +++ b/lib/libc/rpc/rpc_soc.c @@ -483,7 +483,7 @@ svcunix_create(int sock, u_int sendsize, u_int recvsize, char *path) break; } if (nconf == NULL) - return(xprt); + goto done; if ((sock = __rpc_nconf2fd(nconf)) < 0) goto done; From 7f3159edc59814f1c728ef4a2c751099db334346 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Mon, 11 Jan 2016 22:01:33 +0000 Subject: [PATCH 05/82] Similar to r293704, fix theoretical leak of netconfig(3) resources in __rpcbind_is_up(..) if getnetconfig(3) is partly successful in allocating resources, but not completely successful by moving the endnetconfig(3) call up before we return from the function if nconf == NULL. MFC after: 1 week Reported by: Coverity Submitted by: Miles Ohlrich Sponsored by: EMC / Isilon Storage Division --- lib/libc/rpc/rpcb_clnt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libc/rpc/rpcb_clnt.c b/lib/libc/rpc/rpcb_clnt.c index 49300ed37db0..84775052374e 100644 --- a/lib/libc/rpc/rpcb_clnt.c +++ b/lib/libc/rpc/rpcb_clnt.c @@ -661,11 +661,11 @@ __rpcbind_is_up(void) strcmp(nconf->nc_protofmly, NC_LOOPBACK) == 0) break; } + endnetconfig(localhandle); + if (nconf == NULL) return (FALSE); - endnetconfig(localhandle); - memset(&sun, 0, sizeof sun); sock = _socket(AF_LOCAL, SOCK_STREAM, 0); if (sock < 0) From 53f68627238718f04ab177161afe4061a78fbda8 Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Mon, 11 Jan 2016 22:15:46 +0000 Subject: [PATCH 06/82] Fix importing l2arc device by guid After r292066, vdev_geom verifies both the vdev and pool guids of device labels during open. However, spare and l2arc devices don't have pool guids, so opening them by guid will fail (opening by path, when the pathname is known, still succeeds). This change allows a vdev to be opened by guid if the label contains no pool_guid, which is the case for inactive spares and l2arc devices. PR: 292066 Reported by: delphij Reviewed by: delphij, smh MFC after: 2 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D4861 --- .../contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c index 5e52759a05f5..99496c06af8f 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c @@ -594,7 +594,15 @@ vdev_geom_attach_by_guids(vdev_t *vd) vdev_geom_read_guids(zcp, &pguid, &vguid); g_topology_lock(); vdev_geom_detach_taster(zcp); - if (pguid != spa_guid(vd->vdev_spa) || + /* + * Check that the label's vdev guid matches the + * desired guid. If the label has a pool guid, + * check that it matches too. (Inactive spares + * and L2ARCs do not have any pool guid in the + * label.) + */ + if ((pguid != 0 && + pguid != spa_guid(vd->vdev_spa)) || vguid != vd->vdev_guid) continue; cp = vdev_geom_attach(pp, vd); From 6420fb29aade7aa5a52ab80af8cc36992f619229 Mon Sep 17 00:00:00 2001 From: Andriy Voskoboinyk Date: Tue, 12 Jan 2016 00:12:18 +0000 Subject: [PATCH 07/82] rtwn: import r290022 (do not filter out control frames in the RX path) Tested by: kevlo Reviewed by: kevlo Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D4838 --- sys/dev/rtwn/if_rtwn.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sys/dev/rtwn/if_rtwn.c b/sys/dev/rtwn/if_rtwn.c index 927a8c88f387..886b281a9108 100644 --- a/sys/dev/rtwn/if_rtwn.c +++ b/sys/dev/rtwn/if_rtwn.c @@ -1438,7 +1438,7 @@ rtwn_rx_frame(struct rtwn_softc *sc, struct r92c_rx_desc *rx_desc, struct rtwn_rx_data *rx_data, int desc_idx) { struct ieee80211com *ic = &sc->sc_ic; - struct ieee80211_frame *wh; + struct ieee80211_frame_min *wh; struct ieee80211_node *ni; struct r92c_rx_phystat *phy = NULL; uint32_t rxdw0, rxdw3; @@ -1462,7 +1462,8 @@ rtwn_rx_frame(struct rtwn_softc *sc, struct r92c_rx_desc *rx_desc, } pktlen = MS(rxdw0, R92C_RXDW0_PKTLEN); - if (__predict_false(pktlen < sizeof(*wh) || pktlen > MCLBYTES)) { + if (__predict_false(pktlen < sizeof(struct ieee80211_frame_ack) || + pktlen > MCLBYTES)) { counter_u64_add(ic->ic_ierrors, 1); return; } @@ -1554,10 +1555,13 @@ rtwn_rx_frame(struct rtwn_softc *sc, struct r92c_rx_desc *rx_desc, } RTWN_UNLOCK(sc); - wh = mtod(m, struct ieee80211_frame *); + wh = mtod(m, struct ieee80211_frame_min *); + if (m->m_len >= sizeof(*wh)) + ni = ieee80211_find_rxnode(ic, wh); + else + ni = NULL; /* Send the frame to the 802.11 layer. */ - ni = ieee80211_find_rxnode(ic, (struct ieee80211_frame_min *)wh); if (ni != NULL) { (void)ieee80211_input(ni, m, rssi - nf, nf); /* Node is no longer needed. */ From c16d674c2d02ebbcbbebe4c52eee8a0b4bcf3676 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Tue, 12 Jan 2016 00:20:57 +0000 Subject: [PATCH 08/82] Fix a mismerge from NetBSD in r162194 with `xdr_rpcb_entry_list_ptr(..)` This fixes the potential NULL pointer dereference properly, and also fixes memory leaks encountered in the process of iterating through `*rp`. MFC after: 1 week Found by: Valgrind Reported by: Dan Roberts Submitted by: Miles Ohlrich Sponsored by: EMC / Isilon Storage Division --- lib/libc/rpc/rpcb_prot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libc/rpc/rpcb_prot.c b/lib/libc/rpc/rpcb_prot.c index b793eca31cf5..2b87f347a4c9 100644 --- a/lib/libc/rpc/rpcb_prot.c +++ b/lib/libc/rpc/rpcb_prot.c @@ -207,14 +207,14 @@ xdr_rpcb_entry_list_ptr(XDR *xdrs, rpcb_entry_list_ptr *rp) * the case of freeing we must remember the next object * before we free the current object ... */ - if (freeing) + if (freeing && *rp) next = (*rp)->rpcb_entry_next; if (! xdr_reference(xdrs, (caddr_t *)rp, (u_int)sizeof (rpcb_entry_list), (xdrproc_t)xdr_rpcb_entry)) { return (FALSE); } - if (freeing && *rp) { + if (freeing) { next_copy = next; rp = &next_copy; /* From 1c6b43df0a36ff2c6277b52b132f616c3e105f0f Mon Sep 17 00:00:00 2001 From: Andriy Voskoboinyk Date: Tue, 12 Jan 2016 00:24:40 +0000 Subject: [PATCH 09/82] wpi, iwn: implement ic_getradiocaps method This will allow to restore channel list after switching interface to more restrictive regdomain. Tested with Intel 3945BG (wpi) only. Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D4863 --- sys/dev/iwn/if_iwn.c | 66 ++++++++++++++++++++++++++++++++++---------- sys/dev/wpi/if_wpi.c | 38 ++++++++++++++++++++----- 2 files changed, 83 insertions(+), 21 deletions(-) diff --git a/sys/dev/iwn/if_iwn.c b/sys/dev/iwn/if_iwn.c index ab630e7f8660..c361fe36aeb7 100644 --- a/sys/dev/iwn/if_iwn.c +++ b/sys/dev/iwn/if_iwn.c @@ -177,11 +177,15 @@ static void iwn4965_print_power_group(struct iwn_softc *, int); #endif static void iwn5000_read_eeprom(struct iwn_softc *); static uint32_t iwn_eeprom_channel_flags(struct iwn_eeprom_chan *); -static void iwn_read_eeprom_band(struct iwn_softc *, int); -static void iwn_read_eeprom_ht40(struct iwn_softc *, int); +static void iwn_read_eeprom_band(struct iwn_softc *, int, int, int *, + struct ieee80211_channel[]); +static void iwn_read_eeprom_ht40(struct iwn_softc *, int, int, int *, + struct ieee80211_channel[]); static void iwn_read_eeprom_channels(struct iwn_softc *, int, uint32_t); static struct iwn_eeprom_chan *iwn_find_eeprom_channel(struct iwn_softc *, struct ieee80211_channel *); +static void iwn_getradiocaps(struct ieee80211com *, int, int *, + struct ieee80211_channel[]); static int iwn_setregdomain(struct ieee80211com *, struct ieee80211_regdomain *, int, struct ieee80211_channel[]); @@ -666,6 +670,7 @@ iwn_attach(device_t dev) ic->ic_set_channel = iwn_set_channel; ic->ic_scan_curchan = iwn_scan_curchan; ic->ic_scan_mindwell = iwn_scan_mindwell; + ic->ic_getradiocaps = iwn_getradiocaps; ic->ic_setregdomain = iwn_setregdomain; iwn_radiotap_attach(sc); @@ -2371,9 +2376,9 @@ iwn_eeprom_channel_flags(struct iwn_eeprom_chan *channel) } static void -iwn_read_eeprom_band(struct iwn_softc *sc, int n) +iwn_read_eeprom_band(struct iwn_softc *sc, int n, int maxchans, int *nchans, + struct ieee80211_channel chans[]) { - struct ieee80211com *ic = &sc->sc_ic; struct iwn_eeprom_chan *channels = sc->eeprom_channels[n]; const struct iwn_chan_band *band = &iwn_bands[n]; struct ieee80211_channel *c; @@ -2390,10 +2395,14 @@ iwn_read_eeprom_band(struct iwn_softc *sc, int n) channels[i].maxpwr); continue; } + + if (*nchans >= maxchans) + break; + chan = band->chan[i]; nflags = iwn_eeprom_channel_flags(&channels[i]); - c = &ic->ic_channels[ic->ic_nchans++]; + c = &chans[(*nchans)++]; c->ic_ieee = chan; c->ic_maxregpower = channels[i].maxpwr; c->ic_maxpower = 2*c->ic_maxregpower; @@ -2402,7 +2411,11 @@ iwn_read_eeprom_band(struct iwn_softc *sc, int n) c->ic_freq = ieee80211_ieee2mhz(chan, IEEE80211_CHAN_G); /* G =>'s B is supported */ c->ic_flags = IEEE80211_CHAN_B | nflags; - c = &ic->ic_channels[ic->ic_nchans++]; + + if (*nchans >= maxchans) + break; + + c = &chans[(*nchans)++]; c[0] = c[-1]; c->ic_flags = IEEE80211_CHAN_G | nflags; } else { /* 5GHz band */ @@ -2418,8 +2431,11 @@ iwn_read_eeprom_band(struct iwn_softc *sc, int n) channels[i].flags, channels[i].maxpwr); if (sc->sc_flags & IWN_FLAG_HAS_11N) { + if (*nchans >= maxchans) + break; + /* add HT20, HT40 added separately */ - c = &ic->ic_channels[ic->ic_nchans++]; + c = &chans[(*nchans)++]; c[0] = c[-1]; c->ic_flags |= IEEE80211_CHAN_HT20; } @@ -2430,7 +2446,8 @@ iwn_read_eeprom_band(struct iwn_softc *sc, int n) } static void -iwn_read_eeprom_ht40(struct iwn_softc *sc, int n) +iwn_read_eeprom_ht40(struct iwn_softc *sc, int n, int maxchans, int *nchans, + struct ieee80211_channel chans[]) { struct ieee80211com *ic = &sc->sc_ic; struct iwn_eeprom_chan *channels = sc->eeprom_channels[n]; @@ -2454,6 +2471,10 @@ iwn_read_eeprom_ht40(struct iwn_softc *sc, int n) channels[i].maxpwr); continue; } + + if (*nchans + 1 >= maxchans) + break; + chan = band->chan[i]; nflags = iwn_eeprom_channel_flags(&channels[i]); @@ -2481,12 +2502,12 @@ iwn_read_eeprom_ht40(struct iwn_softc *sc, int n) "add ht40 chan %d flags 0x%x maxpwr %d\n", chan, channels[i].flags, channels[i].maxpwr); - c = &ic->ic_channels[ic->ic_nchans++]; + c = &chans[(*nchans)++]; c[0] = cent[0]; c->ic_extieee = extc->ic_ieee; c->ic_flags &= ~IEEE80211_CHAN_HT; c->ic_flags |= IEEE80211_CHAN_HT40U | nflags; - c = &ic->ic_channels[ic->ic_nchans++]; + c = &chans[(*nchans)++]; c[0] = extc[0]; c->ic_extieee = cent->ic_ieee; c->ic_flags &= ~IEEE80211_CHAN_HT; @@ -2505,10 +2526,13 @@ iwn_read_eeprom_channels(struct iwn_softc *sc, int n, uint32_t addr) iwn_read_prom_data(sc, addr, &sc->eeprom_channels[n], iwn_bands[n].nchan * sizeof (struct iwn_eeprom_chan)); - if (n < 5) - iwn_read_eeprom_band(sc, n); - else - iwn_read_eeprom_ht40(sc, n); + if (n < 5) { + iwn_read_eeprom_band(sc, n, IEEE80211_CHAN_MAX, &ic->ic_nchans, + ic->ic_channels); + } else { + iwn_read_eeprom_ht40(sc, n, IEEE80211_CHAN_MAX, &ic->ic_nchans, + ic->ic_channels); + } ieee80211_sort_channels(ic->ic_channels, ic->ic_nchans); } @@ -2538,6 +2562,20 @@ iwn_find_eeprom_channel(struct iwn_softc *sc, struct ieee80211_channel *c) return NULL; } +static void +iwn_getradiocaps(struct ieee80211com *ic, + int maxchans, int *nchans, struct ieee80211_channel chans[]) +{ + struct iwn_softc *sc = ic->ic_softc; + int i; + + /* Parse the list of authorized channels. */ + for (i = 0; i < 5 && *nchans < maxchans; i++) + iwn_read_eeprom_band(sc, i, maxchans, nchans, chans); + for (i = 5; i < IWN_NBANDS - 1 && *nchans < maxchans; i++) + iwn_read_eeprom_ht40(sc, i, maxchans, nchans, chans); +} + /* * Enforce flags read from EEPROM. */ diff --git a/sys/dev/wpi/if_wpi.c b/sys/dev/wpi/if_wpi.c index b59d3e6ddf5b..824f75b17532 100644 --- a/sys/dev/wpi/if_wpi.c +++ b/sys/dev/wpi/if_wpi.c @@ -166,10 +166,13 @@ static void wpi_free_tx_ring(struct wpi_softc *, struct wpi_tx_ring *); static int wpi_read_eeprom(struct wpi_softc *, uint8_t macaddr[IEEE80211_ADDR_LEN]); static uint32_t wpi_eeprom_channel_flags(struct wpi_eeprom_chan *); -static void wpi_read_eeprom_band(struct wpi_softc *, uint8_t); +static void wpi_read_eeprom_band(struct wpi_softc *, uint8_t, int, int *, + struct ieee80211_channel[]); static int wpi_read_eeprom_channels(struct wpi_softc *, uint8_t); static struct wpi_eeprom_chan *wpi_find_eeprom_channel(struct wpi_softc *, struct ieee80211_channel *); +static void wpi_getradiocaps(struct ieee80211com *, int, int *, + struct ieee80211_channel[]); static int wpi_setregdomain(struct ieee80211com *, struct ieee80211_regdomain *, int, struct ieee80211_channel[]); @@ -516,6 +519,7 @@ wpi_attach(device_t dev) ic->ic_set_channel = wpi_set_channel; ic->ic_scan_curchan = wpi_scan_curchan; ic->ic_scan_mindwell = wpi_scan_mindwell; + ic->ic_getradiocaps = wpi_getradiocaps; ic->ic_setregdomain = wpi_setregdomain; sc->sc_update_rx_ring = wpi_update_rx_ring; @@ -1417,9 +1421,9 @@ wpi_eeprom_channel_flags(struct wpi_eeprom_chan *channel) } static void -wpi_read_eeprom_band(struct wpi_softc *sc, uint8_t n) +wpi_read_eeprom_band(struct wpi_softc *sc, uint8_t n, int maxchans, + int *nchans, struct ieee80211_channel chans[]) { - struct ieee80211com *ic = &sc->sc_ic; struct wpi_eeprom_chan *channels = sc->eeprom_channels[n]; const struct wpi_chan_band *band = &wpi_bands[n]; struct ieee80211_channel *c; @@ -1434,10 +1438,13 @@ wpi_read_eeprom_band(struct wpi_softc *sc, uint8_t n) continue; } + if (*nchans >= maxchans) + break; + chan = band->chan[i]; nflags = wpi_eeprom_channel_flags(&channels[i]); - c = &ic->ic_channels[ic->ic_nchans++]; + c = &chans[(*nchans)++]; c->ic_ieee = chan; c->ic_maxregpower = channels[i].maxpwr; c->ic_maxpower = 2*c->ic_maxregpower; @@ -1448,7 +1455,11 @@ wpi_read_eeprom_band(struct wpi_softc *sc, uint8_t n) /* G =>'s B is supported */ c->ic_flags = IEEE80211_CHAN_B | nflags; - c = &ic->ic_channels[ic->ic_nchans++]; + + if (*nchans >= maxchans) + break; + + c = &chans[(*nchans)++]; c[0] = c[-1]; c->ic_flags = IEEE80211_CHAN_G | nflags; } else { /* 5GHz band */ @@ -1465,7 +1476,7 @@ wpi_read_eeprom_band(struct wpi_softc *sc, uint8_t n) "adding chan %d (%dMHz) flags=0x%x maxpwr=%d passive=%d," " offset %d\n", chan, c->ic_freq, channels[i].flags, sc->maxpwr[chan], - IEEE80211_IS_CHAN_PASSIVE(c), ic->ic_nchans); + IEEE80211_IS_CHAN_PASSIVE(c), *nchans); } } @@ -1489,7 +1500,8 @@ wpi_read_eeprom_channels(struct wpi_softc *sc, uint8_t n) return error; } - wpi_read_eeprom_band(sc, n); + wpi_read_eeprom_band(sc, n, IEEE80211_CHAN_MAX, &ic->ic_nchans, + ic->ic_channels); ieee80211_sort_channels(ic->ic_channels, ic->ic_nchans); @@ -1511,6 +1523,18 @@ wpi_find_eeprom_channel(struct wpi_softc *sc, struct ieee80211_channel *c) return NULL; } +static void +wpi_getradiocaps(struct ieee80211com *ic, + int maxchans, int *nchans, struct ieee80211_channel chans[]) +{ + struct wpi_softc *sc = ic->ic_softc; + int i; + + /* Parse the list of authorized channels. */ + for (i = 0; i < WPI_CHAN_BANDS_COUNT && *nchans < maxchans; i++) + wpi_read_eeprom_band(sc, i, maxchans, nchans, chans); +} + /* * Enforce flags read from EEPROM. */ From 39863fbd989378a64801cb548251d01f78a6c6fe Mon Sep 17 00:00:00 2001 From: Sepherosa Ziehau Date: Tue, 12 Jan 2016 01:30:51 +0000 Subject: [PATCH 10/82] hyperv/hn: Implement LRO - Implement the LRO using tcp_lro APIs, and LRO is enabled by default. - Add several stats sysctl nodes. - Check IP/TCP length before sending the packet to tcp_lro_rx(), if host does not provide RX csum information (*); and add an option through sysctl to always trust host TCP segment csum checks (default is off). - Add sysctl to control the LRO entry depth; it is disabled by default. It is used to avoid holding too much TCP segments in driver. Limiting the LRO entry depth helps a lot in a one/two streams RX test. This one 3x the RX performance on my local test (3Gbps -> 10Gbps), and ~2x the RX performance over a directly connected 40Ge network (5Gbps -> 9Gbps). (*) It seems the host stops supplying csum information, once the network load is high. This still needs investigation... Reviewed by: Hongjiang Zhang , Dexuan Cui , Jun Su , delphij Tested by: me (local), Hongjiang Zhang (directly connected 40Ge) Approved by: delphij (mentor), adrian (mentor, no objection) With feedback from: delphij, Hongjiang Zhang Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D4824 --- sys/dev/hyperv/netvsc/hv_net_vsc.c | 1 + sys/dev/hyperv/netvsc/hv_net_vsc.h | 13 + sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c | 267 +++++++++++++++++- sys/dev/hyperv/netvsc/hv_rndis.h | 1 + sys/dev/hyperv/netvsc/hv_rndis_filter.c | 11 + sys/dev/hyperv/netvsc/hv_rndis_filter.h | 1 + 6 files changed, 289 insertions(+), 5 deletions(-) diff --git a/sys/dev/hyperv/netvsc/hv_net_vsc.c b/sys/dev/hyperv/netvsc/hv_net_vsc.c index a32f1ee22b75..99e500c57479 100644 --- a/sys/dev/hyperv/netvsc/hv_net_vsc.c +++ b/sys/dev/hyperv/netvsc/hv_net_vsc.c @@ -919,6 +919,7 @@ hv_nv_on_receive(netvsc_dev *net_dev, struct hv_device *device, */ hv_nv_on_receive_completion(device, vm_xfer_page_pkt->d.transaction_id, status); + hv_rf_receive_rollup(net_dev); } /* diff --git a/sys/dev/hyperv/netvsc/hv_net_vsc.h b/sys/dev/hyperv/netvsc/hv_net_vsc.h index 0796f222e34f..dee8757149b8 100644 --- a/sys/dev/hyperv/netvsc/hv_net_vsc.h +++ b/sys/dev/hyperv/netvsc/hv_net_vsc.h @@ -43,6 +43,8 @@ #include #include #include +#include +#include #include @@ -993,6 +995,17 @@ typedef struct hn_softc { int temp_unusable; struct hv_device *hn_dev_obj; netvsc_dev *net_dev; + + struct lro_ctrl hn_lro; + int hn_lro_hiwat; + + /* Trust tcp segments verification on host side */ + int hn_trust_hosttcp; + + u_long hn_csum_ip; + u_long hn_csum_tcp; + u_long hn_csum_trusted; + u_long hn_lro_tried; } hn_softc_t; diff --git a/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c b/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c index 2f2b07b916bb..4aa91d3c4e77 100644 --- a/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c +++ b/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c @@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -138,6 +139,15 @@ __FBSDID("$FreeBSD$"); CSUM_IP_ISCSI|CSUM_IP6_UDP|CSUM_IP6_TCP|CSUM_IP6_SCTP| \ CSUM_IP6_TSO|CSUM_IP6_ISCSI) +/* XXX move to netinet/tcp_lro.h */ +#define HN_LRO_HIWAT_MAX 65535 +#define HN_LRO_HIWAT_DEF HN_LRO_HIWAT_MAX +/* YYY 2*MTU is a bit rough, but should be good enough. */ +#define HN_LRO_HIWAT_MTULIM(ifp) (2 * (ifp)->if_mtu) +#define HN_LRO_HIWAT_ISVALID(sc, hiwat) \ + ((hiwat) >= HN_LRO_HIWAT_MTULIM((sc)->hn_ifp) || \ + (hiwat) <= HN_LRO_HIWAT_MAX) + /* * Data types */ @@ -171,6 +181,9 @@ int hv_promisc_mode = 0; /* normal mode by default */ /* The one and only one */ static struct hv_netvsc_driver_context g_netvsc_drv; +/* Trust tcp segements verification on host side. */ +static int hn_trust_hosttcp = 0; +TUNABLE_INT("dev.hn.trust_hosttcp", &hn_trust_hosttcp); /* * Forward declarations @@ -181,6 +194,19 @@ static void hn_ifinit(void *xsc); static int hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data); static int hn_start_locked(struct ifnet *ifp); static void hn_start(struct ifnet *ifp); +#ifdef HN_LRO_HIWAT +static int hn_lro_hiwat_sysctl(SYSCTL_HANDLER_ARGS); +#endif +static int hn_check_iplen(const struct mbuf *, int); + +static __inline void +hn_set_lro_hiwat(struct hn_softc *sc, int hiwat) +{ + sc->hn_lro_hiwat = hiwat; +#ifdef HN_LRO_HIWAT + sc->hn_lro.lro_hiwat = sc->hn_lro_hiwat; +#endif +} /* * NetVsc get message transport protocol type @@ -310,6 +336,8 @@ netvsc_attach(device_t dev) hn_softc_t *sc; int unit = device_get_unit(dev); struct ifnet *ifp; + struct sysctl_oid_list *child; + struct sysctl_ctx_list *ctx; int ret; netvsc_init(); @@ -322,6 +350,8 @@ netvsc_attach(device_t dev) bzero(sc, sizeof(hn_softc_t)); sc->hn_unit = unit; sc->hn_dev = dev; + sc->hn_lro_hiwat = HN_LRO_HIWAT_DEF; + sc->hn_trust_hosttcp = hn_trust_hosttcp; NV_LOCK_INIT(sc, "NetVSCLock"); @@ -349,9 +379,11 @@ netvsc_attach(device_t dev) */ ifp->if_hdrlen = sizeof(struct ether_vlan_header); ifp->if_capabilities |= - IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | IFCAP_TSO; + IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | IFCAP_TSO | + IFCAP_LRO; ifp->if_capenable |= - IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | IFCAP_TSO; + IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | IFCAP_TSO | + IFCAP_LRO; /* * Only enable UDP checksum offloading when it is on 2012R2 or * later. UDP checksum offloading doesn't work on earlier @@ -372,8 +404,59 @@ netvsc_attach(device_t dev) sc->hn_carrier = 1; } + tcp_lro_init(&sc->hn_lro); + /* Driver private LRO settings */ + sc->hn_lro.ifp = ifp; +#ifdef HN_LRO_HIWAT + sc->hn_lro.lro_hiwat = sc->hn_lro_hiwat; +#endif + ether_ifattach(ifp, device_info.mac_addr); + ctx = device_get_sysctl_ctx(dev); + child = SYSCTL_CHILDREN(device_get_sysctl_tree(dev)); + + SYSCTL_ADD_INT(ctx, child, OID_AUTO, "lro_queued", + CTLFLAG_RW, &sc->hn_lro.lro_queued, 0, "LRO queued"); + SYSCTL_ADD_INT(ctx, child, OID_AUTO, "lro_flushed", + CTLFLAG_RW, &sc->hn_lro.lro_flushed, 0, "LRO flushed"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "lro_tried", + CTLFLAG_RW, &sc->hn_lro_tried, "# of LRO tries"); +#ifdef HN_LRO_HIWAT + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "lro_hiwat", + CTLTYPE_INT | CTLFLAG_RW, sc, 0, hn_lro_hiwat_sysctl, + "I", "LRO high watermark"); +#endif + SYSCTL_ADD_INT(ctx, child, OID_AUTO, "trust_hosttcp", + CTLFLAG_RW, &sc->hn_trust_hosttcp, 0, + "Trust tcp segement verification on host side, " + "when csum info is missing"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "csum_ip", + CTLFLAG_RW, &sc->hn_csum_ip, "RXCSUM IP"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "csum_tcp", + CTLFLAG_RW, &sc->hn_csum_tcp, "RXCSUM TCP"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "csum_trusted", + CTLFLAG_RW, &sc->hn_csum_trusted, + "# of TCP segements that we trust host's csum verification"); + + if (unit == 0) { + struct sysctl_ctx_list *dc_ctx; + struct sysctl_oid_list *dc_child; + devclass_t dc; + + /* + * Add sysctl nodes for devclass + */ + dc = device_get_devclass(dev); + dc_ctx = devclass_get_sysctl_ctx(dc); + dc_child = SYSCTL_CHILDREN(devclass_get_sysctl_tree(dc)); + + SYSCTL_ADD_INT(dc_ctx, dc_child, OID_AUTO, "trust_hosttcp", + CTLFLAG_RD, &hn_trust_hosttcp, 0, + "Trust tcp segement verification on host side, " + "when csum info is missing (global setting)"); + } + return (0); } @@ -383,6 +466,7 @@ netvsc_attach(device_t dev) static int netvsc_detach(device_t dev) { + struct hn_softc *sc = device_get_softc(dev); struct hv_device *hv_device = vmbus_get_devctx(dev); if (bootverbose) @@ -401,6 +485,8 @@ netvsc_detach(device_t dev) hv_rf_on_device_remove(hv_device, HV_RF_NV_DESTROY_CHANNEL); + tcp_lro_free(&sc->hn_lro); + return (0); } @@ -887,7 +973,7 @@ netvsc_recv(struct hv_device *device_ctx, netvsc_packet *packet, struct mbuf *m_new; struct ifnet *ifp; device_t dev = device_ctx->device; - int size; + int size, do_lro = 0; if (sc == NULL) { return (0); /* TODO: KYS how can this be! */ @@ -938,6 +1024,7 @@ netvsc_recv(struct hv_device *device_ctx, netvsc_packet *packet, if (csum_info->receive.ip_csum_succeeded) { m_new->m_pkthdr.csum_flags |= (CSUM_IP_CHECKED | CSUM_IP_VALID); + sc->hn_csum_ip++; } /* TCP csum offload */ @@ -945,9 +1032,50 @@ netvsc_recv(struct hv_device *device_ctx, netvsc_packet *packet, m_new->m_pkthdr.csum_flags |= (CSUM_DATA_VALID | CSUM_PSEUDO_HDR); m_new->m_pkthdr.csum_data = 0xffff; + sc->hn_csum_tcp++; + } + + if (csum_info->receive.ip_csum_succeeded && + csum_info->receive.tcp_csum_succeeded) + do_lro = 1; + } else { + const struct ether_header *eh; + uint16_t etype; + int hoff; + + hoff = sizeof(*eh); + if (m_new->m_len < hoff) + goto skip; + eh = mtod(m_new, struct ether_header *); + etype = ntohs(eh->ether_type); + if (etype == ETHERTYPE_VLAN) { + const struct ether_vlan_header *evl; + + hoff = sizeof(*evl); + if (m_new->m_len < hoff) + goto skip; + evl = mtod(m_new, struct ether_vlan_header *); + etype = ntohs(evl->evl_proto); + } + + if (etype == ETHERTYPE_IP) { + int pr; + + pr = hn_check_iplen(m_new, hoff); + if (pr == IPPROTO_TCP) { + if (sc->hn_trust_hosttcp) { + sc->hn_csum_trusted++; + m_new->m_pkthdr.csum_flags |= + (CSUM_IP_CHECKED | CSUM_IP_VALID | + CSUM_DATA_VALID | CSUM_PSEUDO_HDR); + m_new->m_pkthdr.csum_data = 0xffff; + } + /* Rely on SW csum verification though... */ + do_lro = 1; + } } } - +skip: if ((packet->vlan_tci != 0) && (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) != 0) { m_new->m_pkthdr.ether_vtag = packet->vlan_tci; @@ -961,12 +1089,37 @@ netvsc_recv(struct hv_device *device_ctx, netvsc_packet *packet, if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); + if ((ifp->if_capenable & IFCAP_LRO) && do_lro) { + struct lro_ctrl *lro = &sc->hn_lro; + + if (lro->lro_cnt) { + sc->hn_lro_tried++; + if (tcp_lro_rx(lro, m_new, 0) == 0) { + /* DONE! */ + return 0; + } + } + } + /* We're not holding the lock here, so don't release it */ (*ifp->if_input)(ifp, m_new); return (0); } +void +netvsc_recv_rollup(struct hv_device *device_ctx) +{ + hn_softc_t *sc = device_get_softc(device_ctx->device); + struct lro_ctrl *lro = &sc->hn_lro; + struct lro_entry *queued; + + while ((queued = SLIST_FIRST(&lro->lro_active)) != NULL) { + SLIST_REMOVE_HEAD(&lro->lro_active, next); + tcp_lro_flush(lro, queued); + } +} + /* * Rules for using sc->temp_unusable: * 1. sc->temp_unusable can only be read or written while holding NV_LOCK() @@ -1022,7 +1175,13 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) /* Obtain and record requested MTU */ ifp->if_mtu = ifr->ifr_mtu; - + /* + * Make sure that LRO high watermark is still valid, + * after MTU change (the 2*MTU limit). + */ + if (!HN_LRO_HIWAT_ISVALID(sc, sc->hn_lro_hiwat)) + hn_set_lro_hiwat(sc, HN_LRO_HIWAT_MTULIM(ifp)); + do { NV_LOCK(sc); if (!sc->temp_unusable) { @@ -1147,6 +1306,8 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) ifp->if_capenable |= IFCAP_RXCSUM; } } + if (mask & IFCAP_LRO) + ifp->if_capenable ^= IFCAP_LRO; if (mask & IFCAP_TSO4) { ifp->if_capenable ^= IFCAP_TSO4; @@ -1292,6 +1453,102 @@ hn_watchdog(struct ifnet *ifp) } #endif +#ifdef HN_LRO_HIWAT +static int +hn_lro_hiwat_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct hn_softc *sc = arg1; + int hiwat, error; + + hiwat = sc->hn_lro_hiwat; + error = sysctl_handle_int(oidp, &hiwat, 0, req); + if (error || req->newptr == NULL) + return error; + + if (!HN_LRO_HIWAT_ISVALID(sc, hiwat)) + return EINVAL; + + if (sc->hn_lro_hiwat != hiwat) + hn_set_lro_hiwat(sc, hiwat); + return 0; +} +#endif /* HN_LRO_HIWAT */ + +static int +hn_check_iplen(const struct mbuf *m, int hoff) +{ + const struct ip *ip; + int len, iphlen, iplen; + const struct tcphdr *th; + int thoff; /* TCP data offset */ + + len = hoff + sizeof(struct ip); + + /* The packet must be at least the size of an IP header. */ + if (m->m_pkthdr.len < len) + return IPPROTO_DONE; + + /* The fixed IP header must reside completely in the first mbuf. */ + if (m->m_len < len) + return IPPROTO_DONE; + + ip = mtodo(m, hoff); + + /* Bound check the packet's stated IP header length. */ + iphlen = ip->ip_hl << 2; + if (iphlen < sizeof(struct ip)) /* minimum header length */ + return IPPROTO_DONE; + + /* The full IP header must reside completely in the one mbuf. */ + if (m->m_len < hoff + iphlen) + return IPPROTO_DONE; + + iplen = ntohs(ip->ip_len); + + /* + * Check that the amount of data in the buffers is as + * at least much as the IP header would have us expect. + */ + if (m->m_pkthdr.len < hoff + iplen) + return IPPROTO_DONE; + + /* + * Ignore IP fragments. + */ + if (ntohs(ip->ip_off) & (IP_OFFMASK | IP_MF)) + return IPPROTO_DONE; + + /* + * The TCP/IP or UDP/IP header must be entirely contained within + * the first fragment of a packet. + */ + switch (ip->ip_p) { + case IPPROTO_TCP: + if (iplen < iphlen + sizeof(struct tcphdr)) + return IPPROTO_DONE; + if (m->m_len < hoff + iphlen + sizeof(struct tcphdr)) + return IPPROTO_DONE; + th = (const struct tcphdr *)((const uint8_t *)ip + iphlen); + thoff = th->th_off << 2; + if (thoff < sizeof(struct tcphdr) || thoff + iphlen > iplen) + return IPPROTO_DONE; + if (m->m_len < hoff + iphlen + thoff) + return IPPROTO_DONE; + break; + case IPPROTO_UDP: + if (iplen < iphlen + sizeof(struct udphdr)) + return IPPROTO_DONE; + if (m->m_len < hoff + iphlen + sizeof(struct udphdr)) + return IPPROTO_DONE; + break; + default: + if (iplen < iphlen) + return IPPROTO_DONE; + break; + } + return ip->ip_p; +} + static device_method_t netvsc_methods[] = { /* Device interface */ DEVMETHOD(device_probe, netvsc_probe), diff --git a/sys/dev/hyperv/netvsc/hv_rndis.h b/sys/dev/hyperv/netvsc/hv_rndis.h index 64fd5786838e..fd032dea062b 100644 --- a/sys/dev/hyperv/netvsc/hv_rndis.h +++ b/sys/dev/hyperv/netvsc/hv_rndis.h @@ -1049,6 +1049,7 @@ typedef struct rndismp_rx_bufs_info_ { int netvsc_recv(struct hv_device *device_ctx, netvsc_packet *packet, rndis_tcp_ip_csum_info *csum_info); +void netvsc_recv_rollup(struct hv_device *device_ctx); void* hv_set_rppi_data(rndis_msg *rndis_mesg, uint32_t rppi_size, diff --git a/sys/dev/hyperv/netvsc/hv_rndis_filter.c b/sys/dev/hyperv/netvsc/hv_rndis_filter.c index 691badd55e1b..3e9502434f49 100644 --- a/sys/dev/hyperv/netvsc/hv_rndis_filter.c +++ b/sys/dev/hyperv/netvsc/hv_rndis_filter.c @@ -963,3 +963,14 @@ hv_rf_on_send_request_halt_completion(void *context) request->halt_complete_flag = 1; } +/* + * RNDIS filter when "all" reception is done + */ +void +hv_rf_receive_rollup(netvsc_dev *net_dev) +{ + rndis_device *rndis_dev; + + rndis_dev = (rndis_device *)net_dev->extension; + netvsc_recv_rollup(rndis_dev->net_dev->dev); +} diff --git a/sys/dev/hyperv/netvsc/hv_rndis_filter.h b/sys/dev/hyperv/netvsc/hv_rndis_filter.h index 8355c6a0148c..2f3ebd8b58b7 100644 --- a/sys/dev/hyperv/netvsc/hv_rndis_filter.h +++ b/sys/dev/hyperv/netvsc/hv_rndis_filter.h @@ -98,6 +98,7 @@ typedef struct rndis_device_ { int hv_rf_on_receive(netvsc_dev *net_dev, struct hv_device *device, netvsc_packet *pkt); +void hv_rf_receive_rollup(netvsc_dev *net_dev); int hv_rf_on_device_add(struct hv_device *device, void *additl_info); int hv_rf_on_device_remove(struct hv_device *device, boolean_t destroy_channel); int hv_rf_on_open(struct hv_device *device); From da949700f240c05ea006a4765bc2647025103bd4 Mon Sep 17 00:00:00 2001 From: Sepherosa Ziehau Date: Tue, 12 Jan 2016 01:41:34 +0000 Subject: [PATCH 11/82] hyperv/hn: Implement SIOC[SG]IFMEDIA support Many applications and kernel modules (e.g. bridge) rely on the ifmedia status report; give them what they want. Submitted by: Dexuan Cui Reviewed by: Jun Su , me, adrian Modified by: me (minor) Original differential: https://reviews.freebsd.org/D4611 Differential Revision: https://reviews.freebsd.org/D4852 Approved by: adrian (mentor) Sponsored by: Microsoft OSTC --- sys/dev/hyperv/netvsc/hv_net_vsc.h | 5 +++ sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c | 37 ++++++++++++++++++- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/sys/dev/hyperv/netvsc/hv_net_vsc.h b/sys/dev/hyperv/netvsc/hv_net_vsc.h index dee8757149b8..bc34898be08c 100644 --- a/sys/dev/hyperv/netvsc/hv_net_vsc.h +++ b/sys/dev/hyperv/netvsc/hv_net_vsc.h @@ -43,9 +43,13 @@ #include #include #include + #include #include +#include +#include + #include MALLOC_DECLARE(M_NETVSC); @@ -985,6 +989,7 @@ typedef struct { */ typedef struct hn_softc { struct ifnet *hn_ifp; + struct ifmedia hn_media; device_t hn_dev; uint8_t hn_unit; int hn_carrier; diff --git a/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c b/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c index 4aa91d3c4e77..aae5881e9287 100644 --- a/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c +++ b/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c @@ -194,6 +194,8 @@ static void hn_ifinit(void *xsc); static int hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data); static int hn_start_locked(struct ifnet *ifp); static void hn_start(struct ifnet *ifp); +static int hn_ifmedia_upd(struct ifnet *ifp); +static void hn_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr); #ifdef HN_LRO_HIWAT static int hn_lro_hiwat_sysctl(SYSCTL_HANDLER_ARGS); #endif @@ -264,6 +266,29 @@ static uint32_t get_transport_proto_type(struct mbuf *m_head) return (ret_val); } +static int +hn_ifmedia_upd(struct ifnet *ifp __unused) +{ + + return EOPNOTSUPP; +} + +static void +hn_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) +{ + struct hn_softc *sc = ifp->if_softc; + + ifmr->ifm_status = IFM_AVALID; + ifmr->ifm_active = IFM_ETHER; + + if (!sc->hn_carrier) { + ifmr->ifm_active |= IFM_NONE; + return; + } + ifmr->ifm_status |= IFM_ACTIVE; + ifmr->ifm_active |= IFM_10G_T | IFM_FDX; +} + /* * NetVsc driver initialization * Note: Filter init is no longer required @@ -374,6 +399,12 @@ netvsc_attach(device_t dev) ifp->if_snd.ifq_drv_maxlen = 511; IFQ_SET_READY(&ifp->if_snd); + ifmedia_init(&sc->hn_media, 0, hn_ifmedia_upd, hn_ifmedia_sts); + ifmedia_add(&sc->hn_media, IFM_ETHER | IFM_AUTO, 0, NULL); + ifmedia_set(&sc->hn_media, IFM_ETHER | IFM_AUTO); + /* XXX ifmedia_set really should do this for us */ + sc->hn_media.ifm_media = sc->hn_media.ifm_cur->ifm_media; + /* * Tell upper layers that we support full VLAN capability. */ @@ -485,6 +516,7 @@ netvsc_detach(device_t dev) hv_rf_on_device_remove(hv_device, HV_RF_NV_DESTROY_CHANNEL); + ifmedia_removeall(&sc->hn_media); tcp_lro_free(&sc->hn_lro); return (0); @@ -1332,10 +1364,11 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = 0; } #endif - /* FALLTHROUGH */ + error = EINVAL; + break; case SIOCSIFMEDIA: case SIOCGIFMEDIA: - error = EINVAL; + error = ifmedia_ioctl(ifp, ifr, &sc->hn_media, cmd); break; default: error = ether_ioctl(ifp, cmd, data); From c48d20d7c75383ca2a4a100998b919f88b3e0675 Mon Sep 17 00:00:00 2001 From: Sepherosa Ziehau Date: Tue, 12 Jan 2016 01:50:56 +0000 Subject: [PATCH 12/82] hyperv/hn: Avoid mbuf cluster allocation, if the packet is small. This one mainly avoids mbuf cluster allocation for TCP ACKs during TCP sending tests. And it gives me ~200Mbps improvement (4.7Gbps -> 4.9Gbps), when running iperf3 TCP sending test w/ 16 connections. While I'm here, nuke the unnecessary zeroing out pkthdr.csum_flags. Reviewed by: adrain Approved by: adrian (mentor) Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D4853 --- sys/dev/hyperv/netvsc/hv_net_vsc.h | 1 + sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c | 55 ++++++++++--------- 2 files changed, 31 insertions(+), 25 deletions(-) diff --git a/sys/dev/hyperv/netvsc/hv_net_vsc.h b/sys/dev/hyperv/netvsc/hv_net_vsc.h index bc34898be08c..b1d1e37cedca 100644 --- a/sys/dev/hyperv/netvsc/hv_net_vsc.h +++ b/sys/dev/hyperv/netvsc/hv_net_vsc.h @@ -1011,6 +1011,7 @@ typedef struct hn_softc { u_long hn_csum_tcp; u_long hn_csum_trusted; u_long hn_lro_tried; + u_long hn_small_pkts; } hn_softc_t; diff --git a/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c b/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c index aae5881e9287..4225a431eb93 100644 --- a/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c +++ b/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c @@ -469,6 +469,8 @@ netvsc_attach(device_t dev) SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "csum_trusted", CTLFLAG_RW, &sc->hn_csum_trusted, "# of TCP segements that we trust host's csum verification"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "small_pkts", + CTLFLAG_RW, &sc->hn_small_pkts, "# of small packets received"); if (unit == 0) { struct sysctl_ctx_list *dc_ctx; @@ -1022,35 +1024,38 @@ netvsc_recv(struct hv_device *device_ctx, netvsc_packet *packet, */ if (packet->tot_data_buf_len > (ifp->if_mtu + ETHER_HDR_LEN)) { return (0); + } else if (packet->tot_data_buf_len <= MHLEN) { + m_new = m_gethdr(M_NOWAIT, MT_DATA); + if (m_new == NULL) + return (0); + memcpy(mtod(m_new, void *), packet->data, + packet->tot_data_buf_len); + m_new->m_pkthdr.len = m_new->m_len = packet->tot_data_buf_len; + sc->hn_small_pkts++; + } else { + /* + * Get an mbuf with a cluster. For packets 2K or less, + * get a standard 2K cluster. For anything larger, get a + * 4K cluster. Any buffers larger than 4K can cause problems + * if looped around to the Hyper-V TX channel, so avoid them. + */ + size = MCLBYTES; + if (packet->tot_data_buf_len > MCLBYTES) { + /* 4096 */ + size = MJUMPAGESIZE; + } + + m_new = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, size); + if (m_new == NULL) { + device_printf(dev, "alloc mbuf failed.\n"); + return (0); + } + + hv_m_append(m_new, packet->tot_data_buf_len, packet->data); } - - /* - * Get an mbuf with a cluster. For packets 2K or less, - * get a standard 2K cluster. For anything larger, get a - * 4K cluster. Any buffers larger than 4K can cause problems - * if looped around to the Hyper-V TX channel, so avoid them. - */ - size = MCLBYTES; - - if (packet->tot_data_buf_len > MCLBYTES) { - /* 4096 */ - size = MJUMPAGESIZE; - } - - m_new = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, size); - - if (m_new == NULL) { - device_printf(dev, "alloc mbuf failed.\n"); - return (0); - } - - hv_m_append(m_new, packet->tot_data_buf_len, - packet->data); - m_new->m_pkthdr.rcvif = ifp; /* receive side checksum offload */ - m_new->m_pkthdr.csum_flags = 0; if (NULL != csum_info) { /* IP csum offload */ if (csum_info->receive.ip_csum_succeeded) { From 4f8f2d4274ecdbcbbabfde2c4f6abb548d447214 Mon Sep 17 00:00:00 2001 From: Sepherosa Ziehau Date: Tue, 12 Jan 2016 01:55:57 +0000 Subject: [PATCH 13/82] hyperv/hn: Removed unused netvsc_init() Submitted by: Dexuan Cui Reviewed by: me, adrian, royger, Hongjiang Zhang Approved by: adrian (mentor) Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D4594 --- sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c | 47 ------------------- 1 file changed, 47 deletions(-) diff --git a/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c b/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c index 4225a431eb93..68f822a004bd 100644 --- a/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c +++ b/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c @@ -148,14 +148,6 @@ __FBSDID("$FreeBSD$"); ((hiwat) >= HN_LRO_HIWAT_MTULIM((sc)->hn_ifp) || \ (hiwat) <= HN_LRO_HIWAT_MAX) -/* - * Data types - */ - -struct hv_netvsc_driver_context { - uint32_t drv_inited; -}; - /* * Be aware that this sleepable mutex will exhibit WITNESS errors when * certain TCP and ARP code paths are taken. This appears to be a @@ -178,9 +170,6 @@ struct hv_netvsc_driver_context { int hv_promisc_mode = 0; /* normal mode by default */ -/* The one and only one */ -static struct hv_netvsc_driver_context g_netvsc_drv; - /* Trust tcp segements verification on host side. */ static int hn_trust_hosttcp = 0; TUNABLE_INT("dev.hn.trust_hosttcp", &hn_trust_hosttcp); @@ -289,37 +278,6 @@ hn_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) ifmr->ifm_active |= IFM_10G_T | IFM_FDX; } -/* - * NetVsc driver initialization - * Note: Filter init is no longer required - */ -static int -netvsc_drv_init(void) -{ - return (0); -} - -/* - * NetVsc global initialization entry point - */ -static void -netvsc_init(void) -{ - if (bootverbose) - printf("Netvsc initializing... "); - - /* - * XXXKYS: cleanup initialization - */ - if (!cold && !g_netvsc_drv.drv_inited) { - g_netvsc_drv.drv_inited = 1; - netvsc_drv_init(); - if (bootverbose) - printf("done!\n"); - } else if (bootverbose) - printf("Already initialized!\n"); -} - /* {F8615163-DF3E-46c5-913F-F2D2F965ED0E} */ static const hv_guid g_net_vsc_device_type = { .data = {0x63, 0x51, 0x61, 0xF8, 0x3E, 0xDF, 0xc5, 0x46, @@ -365,8 +323,6 @@ netvsc_attach(device_t dev) struct sysctl_ctx_list *ctx; int ret; - netvsc_init(); - sc = device_get_softc(dev); if (sc == NULL) { return (ENOMEM); @@ -1608,6 +1564,3 @@ static devclass_t netvsc_devclass; DRIVER_MODULE(hn, vmbus, netvsc_driver, netvsc_devclass, 0, 0); MODULE_VERSION(hn, 1); MODULE_DEPEND(hn, vmbus, 1, 1, 1); -SYSINIT(netvsc_initx, SI_SUB_KTHREAD_IDLE, SI_ORDER_MIDDLE + 1, netvsc_init, - NULL); - From 022e692a4780fe2d8768f4445b6ff0d5a46c8242 Mon Sep 17 00:00:00 2001 From: Steven Hartland Date: Tue, 12 Jan 2016 02:17:39 +0000 Subject: [PATCH 14/82] Enable warnings in EFI boot code Set WARNS if not set for EFI boot code and fix the issues highlighted by setting it. Most components are set to WARNS level 6 with few being left at lower levels due to the amount of changes needed to fix at higher levels. Error types fixed: * Missing / invalid casts * Missing inner structs * Unused vars * Missing static for internal only funcs * Missing prototypes * Alignment changes * Use of uninitialised vars * Unknown pragma (intrinsic) * Missing types etc due to missing includes * printf formatting types Reviewed by: emaste (in part) MFC after: 2 weeks X-MFC-With: r293268 Sponsored by: Multiplay Differential Revision: https://reviews.freebsd.org/D4839 --- sys/boot/arm64/libarm64/cache.c | 2 +- sys/boot/common/load_elf.c | 2 +- sys/boot/common/load_elf_obj.c | 4 +- sys/boot/common/misc.c | 8 +--- sys/boot/common/module.c | 2 +- sys/boot/common/part.c | 12 ++--- sys/boot/common/self_reloc.c | 4 +- sys/boot/common/ufsread.c | 8 ++-- sys/boot/efi/boot1/Makefile | 1 + sys/boot/efi/boot1/boot1.c | 15 +++---- sys/boot/efi/fdt/Makefile | 1 + sys/boot/efi/fdt/efi_fdt.c | 3 +- sys/boot/efi/include/arm64/efibind.h | 2 - sys/boot/efi/include/efi_nii.h | 4 +- sys/boot/efi/include/efiapi.h | 44 +++++++++---------- sys/boot/efi/include/eficon.h | 6 +-- sys/boot/efi/include/eficonsctl.h | 2 +- sys/boot/efi/include/efidevp.h | 10 ++--- sys/boot/efi/include/efierr.h | 2 +- sys/boot/efi/include/efifpswa.h | 2 +- sys/boot/efi/include/efigop.h | 5 +-- sys/boot/efi/include/efilib.h | 1 + sys/boot/efi/include/efinet.h | 2 +- sys/boot/efi/include/efipciio.h | 4 +- sys/boot/efi/include/efiprot.h | 28 ++++++------ sys/boot/efi/include/efipxebc.h | 4 +- sys/boot/efi/include/efiser.h | 2 +- sys/boot/efi/include/efiuga.h | 4 +- sys/boot/efi/libefi/Makefile | 1 + sys/boot/efi/libefi/efi_console.c | 2 + sys/boot/efi/libefi/efipart.c | 1 - sys/boot/efi/libefi/libefi.c | 2 +- sys/boot/efi/loader/Makefile | 1 + .../efi/loader/arch/amd64/elf64_freebsd.c | 1 - sys/boot/efi/loader/arch/amd64/framebuffer.c | 4 +- sys/boot/efi/loader/arch/arm/exec.c | 6 +-- sys/boot/efi/loader/arch/arm64/exec.c | 7 ++- sys/boot/efi/loader/autoload.c | 2 + sys/boot/efi/loader/bootinfo.c | 8 ++-- sys/boot/efi/loader/copy.c | 2 + sys/boot/efi/loader/devicename.c | 4 +- sys/boot/efi/loader/loader_efi.h | 2 + sys/boot/efi/loader/main.c | 20 +++++---- sys/boot/i386/libi386/smbios.c | 4 +- 44 files changed, 127 insertions(+), 124 deletions(-) diff --git a/sys/boot/arm64/libarm64/cache.c b/sys/boot/arm64/libarm64/cache.c index 2b3c0b176aa7..25766ef564dd 100644 --- a/sys/boot/arm64/libarm64/cache.c +++ b/sys/boot/arm64/libarm64/cache.c @@ -67,7 +67,7 @@ cpu_flush_dcache(const void *ptr, size_t len) cl_size = get_dcache_line_size(); /* Calculate end address to clean */ - end = (vm_offset_t)(ptr + len); + end = (vm_offset_t)ptr + (vm_offset_t)len; /* Align start address to cache line */ addr = (vm_offset_t)ptr; addr = rounddown2(addr, cl_size); diff --git a/sys/boot/common/load_elf.c b/sys/boot/common/load_elf.c index 7db1867e774c..0ff1a15be880 100644 --- a/sys/boot/common/load_elf.c +++ b/sys/boot/common/load_elf.c @@ -886,7 +886,7 @@ __elfN(parse_modmetadata)(struct preloaded_file *fp, elf_file_t ef, error = __elfN(reloc_ptr)(fp, ef, v, &md, sizeof(md)); if (error == EOPNOTSUPP) { md.md_cval += ef->off; - md.md_data += ef->off; + md.md_data = (void *)((uintptr_t)md.md_data + ef->off); } else if (error != 0) return (error); #endif diff --git a/sys/boot/common/load_elf_obj.c b/sys/boot/common/load_elf_obj.c index 453bb79311c8..869f02041fa6 100644 --- a/sys/boot/common/load_elf_obj.c +++ b/sys/boot/common/load_elf_obj.c @@ -520,10 +520,8 @@ __elfN(obj_symaddr)(struct elf_file *ef, Elf_Size symidx) { Elf_Sym sym; Elf_Addr base; - int symcnt; - symcnt = ef->e_shdr[ef->symtabindex].sh_size / sizeof(Elf_Sym); - if (symidx >= symcnt) + if (symidx >= ef->e_shdr[ef->symtabindex].sh_size / sizeof(Elf_Sym)) return (0); COPYOUT(ef->e_shdr[ef->symtabindex].sh_addr + symidx * sizeof(Elf_Sym), &sym, sizeof(sym)); diff --git a/sys/boot/common/misc.c b/sys/boot/common/misc.c index 990df614fbeb..9b938afdf8c8 100644 --- a/sys/boot/common/misc.c +++ b/sys/boot/common/misc.c @@ -118,7 +118,6 @@ kern_bzero(vm_offset_t dest, size_t len) int kern_pread(int fd, vm_offset_t dest, size_t len, off_t off) { - ssize_t nread; if (lseek(fd, off, SEEK_SET) == -1) { #ifdef DEBUG @@ -126,8 +125,7 @@ kern_pread(int fd, vm_offset_t dest, size_t len, off_t off) #endif return (-1); } - nread = archsw.arch_readin(fd, dest, len); - if (nread != len) { + if ((size_t)archsw.arch_readin(fd, dest, len) != len) { #ifdef DEBUG printf("\nreadin failed\n"); #endif @@ -144,7 +142,6 @@ void * alloc_pread(int fd, off_t off, size_t len) { void *buf; - ssize_t nread; buf = malloc(len); if (buf == NULL) { @@ -160,8 +157,7 @@ alloc_pread(int fd, off_t off, size_t len) free(buf); return (NULL); } - nread = read(fd, buf, len); - if (nread != len) { + if ((size_t)read(fd, buf, len) != len) { #ifdef DEBUG printf("\nread failed\n"); #endif diff --git a/sys/boot/common/module.c b/sys/boot/common/module.c index 163814b94b9b..b01b497b39b2 100644 --- a/sys/boot/common/module.c +++ b/sys/boot/common/module.c @@ -983,7 +983,7 @@ moduledir_rebuild(void) { struct moduledir *mdp, *mtmp; const char *path, *cp, *ep; - int cplen; + size_t cplen; path = getenv("module_path"); if (path == NULL) diff --git a/sys/boot/common/part.c b/sys/boot/common/part.c index 8638f0260fa0..3fad5dd76d3c 100644 --- a/sys/boot/common/part.c +++ b/sys/boot/common/part.c @@ -102,7 +102,7 @@ static struct parttypes { const char * parttype2str(enum partition_type type) { - int i; + size_t i; for (i = 0; i < sizeof(ptypes) / sizeof(ptypes[0]); i++) if (ptypes[i].type == type) @@ -203,7 +203,7 @@ gpt_checktbl(const struct gpt_hdr *hdr, u_char *tbl, size_t size, uint64_t lba_last) { struct gpt_ent *ent; - int i, cnt; + uint32_t i, cnt; cnt = size / hdr->hdr_entsz; if (hdr->hdr_entries <= cnt) { @@ -234,8 +234,8 @@ ptable_gptread(struct ptable *table, void *dev, diskread_t dread) struct gpt_ent *ent; u_char *buf, *tbl; uint64_t offset; - int pri, sec, i; - size_t size; + int pri, sec; + size_t size, i; buf = malloc(table->sectorsize); if (buf == NULL) @@ -358,7 +358,7 @@ mbr_parttype(uint8_t type) return (PART_UNKNOWN); } -struct ptable* +static struct ptable* ptable_ebrread(struct ptable *table, void *dev, diskread_t dread) { struct dos_partition *dp; @@ -436,7 +436,7 @@ bsd_parttype(uint8_t type) return (PART_UNKNOWN); } -struct ptable* +static struct ptable* ptable_bsdread(struct ptable *table, void *dev, diskread_t dread) { struct disklabel *dl; diff --git a/sys/boot/common/self_reloc.c b/sys/boot/common/self_reloc.c index 9864a4899f6a..29b9c5fabf0f 100644 --- a/sys/boot/common/self_reloc.c +++ b/sys/boot/common/self_reloc.c @@ -61,6 +61,8 @@ __FBSDID("$FreeBSD$"); #define RELOC_TYPE_RELATIVE R_386_RELATIVE #endif +void self_reloc(Elf_Addr baseaddr, ElfW_Dyn *dynamic); + /* * A simple elf relocator. */ @@ -118,6 +120,6 @@ self_reloc(Elf_Addr baseaddr, ElfW_Dyn *dynamic) /* XXX: do we need other relocations ? */ break; } - rel = (ElfW_Rel *) ((caddr_t) rel + relent); + rel = (ElfW_Rel *)(void *)((caddr_t) rel + relent); } } diff --git a/sys/boot/common/ufsread.c b/sys/boot/common/ufsread.c index d0ca57a5775c..acff1e56b84e 100644 --- a/sys/boot/common/ufsread.c +++ b/sys/boot/common/ufsread.c @@ -207,7 +207,7 @@ fsread(ufs_ino_t inode, void *buf, size_t nbyte) #endif ) && fs.fs_bsize <= MAXBSIZE && - fs.fs_bsize >= sizeof(struct fs)) + fs.fs_bsize >= (int32_t)sizeof(struct fs)) break; } if (sblock_try[n] == -1) { @@ -231,10 +231,10 @@ fsread(ufs_ino_t inode, void *buf, size_t nbyte) sizeof(struct ufs2_dinode)); #else if (fs.fs_magic == FS_UFS1_MAGIC) - memcpy(&dp1, (struct ufs1_dinode *)blkbuf + n, + memcpy(&dp1, (struct ufs1_dinode *)(void *)blkbuf + n, sizeof(struct ufs1_dinode)); else - memcpy(&dp2, (struct ufs2_dinode *)blkbuf + n, + memcpy(&dp2, (struct ufs2_dinode *)(void *)blkbuf + n, sizeof(struct ufs2_dinode)); #endif inomap = inode; @@ -283,7 +283,7 @@ fsread(ufs_ino_t inode, void *buf, size_t nbyte) return -1; vbaddr = fsbtodb(&fs, addr2) + (off >> VBLKSHIFT) * DBPERVBLK; vboff = off & VBLKMASK; - n = sblksize(&fs, size, lbn) - (off & ~VBLKMASK); + n = sblksize(&fs, (off_t)size, lbn) - (off & ~VBLKMASK); if (n > VBLKSIZE) n = VBLKSIZE; if (blkmap != vbaddr) { diff --git a/sys/boot/efi/boot1/Makefile b/sys/boot/efi/boot1/Makefile index 6ac63ee87a0e..9a003ce17e85 100644 --- a/sys/boot/efi/boot1/Makefile +++ b/sys/boot/efi/boot1/Makefile @@ -11,6 +11,7 @@ MK_SSP= no PROG= boot1.sym INTERNALPROG= +WARNS?= 6 # architecture-specific loader code SRCS= boot1.c self_reloc.c start.S diff --git a/sys/boot/efi/boot1/boot1.c b/sys/boot/efi/boot1/boot1.c index b7592676ad3f..2b000e066d8e 100644 --- a/sys/boot/efi/boot1/boot1.c +++ b/sys/boot/efi/boot1/boot1.c @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); void panic(const char *fmt, ...) __dead2; void putchar(int c); +EFI_STATUS efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE* Xsystab); static int domount(EFI_DEVICE_PATH *device, EFI_BLOCK_IO *blkio, int quiet); static void load(const char *fname); @@ -62,7 +63,7 @@ EFI_STATUS efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE* Xsystab) EFI_BOOT_SERVICES *BS; EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl = NULL; SIMPLE_TEXT_OUTPUT_INTERFACE *conout = NULL; - char *path = _PATH_LOADER; + const char *path = _PATH_LOADER; systab = Xsystab; image = Ximage; @@ -157,7 +158,6 @@ fsstat(ufs_ino_t inode) { #ifndef UFS2_ONLY static struct ufs1_dinode dp1; - ufs1_daddr_t addr1; #endif #ifndef UFS1_ONLY static struct ufs2_dinode dp2; @@ -166,11 +166,8 @@ fsstat(ufs_ino_t inode) static ufs_ino_t inomap; char *blkbuf; void *indbuf; - size_t n, nb, size, off, vboff; - ufs_lbn_t lbn; - ufs2_daddr_t addr2, vbaddr; + size_t n, size; static ufs2_daddr_t blkmap, indmap; - u_int u; blkbuf = dmadat->blkbuf; indbuf = dmadat->indbuf; @@ -194,7 +191,7 @@ fsstat(ufs_ino_t inode) #endif ) && fs.fs_bsize <= MAXBSIZE && - fs.fs_bsize >= sizeof(struct fs)) + fs.fs_bsize >= (int32_t)sizeof(struct fs)) break; } if (sblock_try[n] == -1) { @@ -218,10 +215,10 @@ fsstat(ufs_ino_t inode) sizeof(struct ufs2_dinode)); #else if (fs.fs_magic == FS_UFS1_MAGIC) - memcpy(&dp1, (struct ufs1_dinode *)blkbuf + n, + memcpy(&dp1, (struct ufs1_dinode *)(void *)blkbuf + n, sizeof(struct ufs1_dinode)); else - memcpy(&dp2, (struct ufs2_dinode *)blkbuf + n, + memcpy(&dp2, (struct ufs2_dinode *)(void *)blkbuf + n, sizeof(struct ufs2_dinode)); #endif inomap = inode; diff --git a/sys/boot/efi/fdt/Makefile b/sys/boot/efi/fdt/Makefile index 19a4c49f0d5f..15862dc2957e 100644 --- a/sys/boot/efi/fdt/Makefile +++ b/sys/boot/efi/fdt/Makefile @@ -6,6 +6,7 @@ LIB= efi_fdt INTERNALLIB= +WARNS?= 6 SRCS= efi_fdt.c diff --git a/sys/boot/efi/fdt/efi_fdt.c b/sys/boot/efi/fdt/efi_fdt.c index d6ee85cec257..d6757689c896 100644 --- a/sys/boot/efi/fdt/efi_fdt.c +++ b/sys/boot/efi/fdt/efi_fdt.c @@ -44,7 +44,6 @@ int fdt_platform_load_dtb(void) { struct fdt_header *hdr; - int err; hdr = efi_get_table(&fdtdtb); if (hdr != NULL) { @@ -54,7 +53,7 @@ fdt_platform_load_dtb(void) } } - return (err); + return (1); } void diff --git a/sys/boot/efi/include/arm64/efibind.h b/sys/boot/efi/include/arm64/efibind.h index 6569f96fcf84..142f16267c4e 100644 --- a/sys/boot/efi/include/arm64/efibind.h +++ b/sys/boot/efi/include/arm64/efibind.h @@ -127,7 +127,6 @@ typedef uint64_t UINTN; #define BAD_POINTER 0xFBFBFBFBFBFBFBFB #define MAX_ADDRESS 0xFFFFFFFFFFFFFFFF -#pragma intrinsic (__break) #define BREAKPOINT() __break(0) // @@ -180,7 +179,6 @@ typedef uint64_t UINTN; // BugBug: Need to find out if this is portable accross compliers. // void __mfa (void); -#pragma intrinsic (__mfa) #define MEMORY_FENCE() __mfa() #ifdef EFI_NO_INTERFACE_DECL diff --git a/sys/boot/efi/include/efi_nii.h b/sys/boot/efi/include/efi_nii.h index 522223221640..561cbd46a3ea 100644 --- a/sys/boot/efi/include/efi_nii.h +++ b/sys/boot/efi/include/efi_nii.h @@ -26,9 +26,9 @@ Revision history: --*/ #define EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL \ - { 0xE18541CD, 0xF755, 0x4f73, 0x92, 0x8D, 0x64, 0x3C, 0x8A, 0x79, 0xB2, 0x29 } + { 0xE18541CD, 0xF755, 0x4f73, {0x92, 0x8D, 0x64, 0x3C, 0x8A, 0x79, 0xB2, 0x29} } #define EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_31 \ - { 0x1ACED566, 0x76ED, 0x4218, 0xBC, 0x81, 0x76, 0x7F, 0x1F, 0x97, 0x7A, 0x89 } + { 0x1ACED566, 0x76ED, 0x4218, {0xBC, 0x81, 0x76, 0x7F, 0x1F, 0x97, 0x7A, 0x89} } #define EFI_NETWORK_INTERFACE_IDENTIFIER_INTERFACE_REVISION 0x00010000 #define EFI_NETWORK_INTERFACE_IDENTIFIER_INTERFACE_REVISION_31 0x00010001 diff --git a/sys/boot/efi/include/efiapi.h b/sys/boot/efi/include/efiapi.h index 9c2dfbbb74e1..b1a7b45eeb53 100644 --- a/sys/boot/efi/include/efiapi.h +++ b/sys/boot/efi/include/efiapi.h @@ -214,8 +214,8 @@ VOID // EFI platform varibles // -#define EFI_GLOBAL_VARIABLE \ - { 0x8BE4DF61, 0x93CA, 0x11d2, 0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C } +#define EFI_GLOBAL_VARIABLE \ + { 0x8BE4DF61, 0x93CA, 0x11d2, {0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C} } // Variable attributes #define EFI_VARIABLE_NON_VOLATILE 0x00000001 @@ -363,8 +363,8 @@ EFI_STATUS // Image handle -#define LOADED_IMAGE_PROTOCOL \ - { 0x5B1B31A1, 0x9562, 0x11d2, 0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B } +#define LOADED_IMAGE_PROTOCOL \ + { 0x5B1B31A1, 0x9562, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} } #define EFI_LOADED_IMAGE_INFORMATION_REVISION 0x1000 typedef struct { @@ -827,35 +827,35 @@ typedef struct { // EFI Configuration Table and GUID definitions // -#define MPS_TABLE_GUID \ - { 0xeb9d2d2f, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } +#define MPS_TABLE_GUID \ + { 0xeb9d2d2f, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } -#define ACPI_TABLE_GUID \ - { 0xeb9d2d30, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } +#define ACPI_TABLE_GUID \ + { 0xeb9d2d30, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } -#define ACPI_20_TABLE_GUID \ - { 0x8868e871, 0xe4f1, 0x11d3, 0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } +#define ACPI_20_TABLE_GUID \ + { 0x8868e871, 0xe4f1, 0x11d3, {0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81} } -#define SMBIOS_TABLE_GUID \ - { 0xeb9d2d31, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } +#define SMBIOS_TABLE_GUID \ + { 0xeb9d2d31, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } -#define SAL_SYSTEM_TABLE_GUID \ - { 0xeb9d2d32, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } +#define SAL_SYSTEM_TABLE_GUID \ + { 0xeb9d2d32, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } -#define FDT_TABLE_GUID \ - { 0xb1b621d5, 0xf19c, 0x41a5, 0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0 } +#define FDT_TABLE_GUID \ + { 0xb1b621d5, 0xf19c, 0x41a5, {0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0} } -#define DXE_SERVICES_TABLE_GUID \ - { 0x5ad34ba, 0x6f02, 0x4214, 0x95, 0x2e, 0x4d, 0xa0, 0x39, 0x8e, 0x2b, 0xb9 } +#define DXE_SERVICES_TABLE_GUID \ + { 0x5ad34ba, 0x6f02, 0x4214, {0x95, 0x2e, 0x4d, 0xa0, 0x39, 0x8e, 0x2b, 0xb9} } -#define HOB_LIST_TABLE_GUID \ - { 0x7739f24c, 0x93d7, 0x11d4, 0x9a, 0x3a, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } +#define HOB_LIST_TABLE_GUID \ + { 0x7739f24c, 0x93d7, 0x11d4, {0x9a, 0x3a, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } #define MEMORY_TYPE_INFORMATION_TABLE_GUID \ - { 0x4c19049f, 0x4137, 0x4dd3, 0x9c, 0x10, 0x8b, 0x97, 0xa8, 0x3f, 0xfd, 0xfa } + { 0x4c19049f, 0x4137, 0x4dd3, {0x9c, 0x10, 0x8b, 0x97, 0xa8, 0x3f, 0xfd, 0xfa} } #define DEBUG_IMAGE_INFO_TABLE_GUID \ - { 0x49152e77, 0x1ada, 0x4764, 0xb7, 0xa2, 0x7a, 0xfe, 0xfe, 0xd9, 0x5e, 0x8b } + { 0x49152e77, 0x1ada, 0x4764, {0xb7, 0xa2, 0x7a, 0xfe, 0xfe, 0xd9, 0x5e, 0x8b} } typedef struct _EFI_CONFIGURATION_TABLE { EFI_GUID VendorGuid; diff --git a/sys/boot/efi/include/eficon.h b/sys/boot/efi/include/eficon.h index ef4af81f77e4..2f719e70a7e4 100644 --- a/sys/boot/efi/include/eficon.h +++ b/sys/boot/efi/include/eficon.h @@ -32,7 +32,7 @@ Revision History // #define SIMPLE_TEXT_OUTPUT_PROTOCOL \ - { 0x387477c2, 0x69c7, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } + { 0x387477c2, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } INTERFACE_DECL(_SIMPLE_TEXT_OUTPUT_INTERFACE); @@ -239,8 +239,8 @@ typedef struct _SIMPLE_TEXT_OUTPUT_INTERFACE { // Text input protocol // -#define SIMPLE_TEXT_INPUT_PROTOCOL \ - { 0x387477c1, 0x69c7, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } +#define SIMPLE_TEXT_INPUT_PROTOCOL \ + { 0x387477c1, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } INTERFACE_DECL(_SIMPLE_INPUT_INTERFACE); diff --git a/sys/boot/efi/include/eficonsctl.h b/sys/boot/efi/include/eficonsctl.h index 36dd2c1aceec..68be3d69f4fd 100644 --- a/sys/boot/efi/include/eficonsctl.h +++ b/sys/boot/efi/include/eficonsctl.h @@ -35,7 +35,7 @@ #define _EFI_CONS_CTL_H #define EFI_CONSOLE_CONTROL_PROTOCOL_GUID \ - { 0xf42f7782, 0x12e, 0x4c12, {0x99, 0x56, 0x49, 0xf9, 0x43, 0x4, 0xf7, 0x21} } + { 0xf42f7782, 0x12e, 0x4c12, {0x99, 0x56, 0x49, 0xf9, 0x43, 0x4, 0xf7, 0x21} } typedef struct _EFI_CONSOLE_CONTROL_PROTOCOL EFI_CONSOLE_CONTROL_PROTOCOL; diff --git a/sys/boot/efi/include/efidevp.h b/sys/boot/efi/include/efidevp.h index a332af5b6694..f0f49efc3fff 100644 --- a/sys/boot/efi/include/efidevp.h +++ b/sys/boot/efi/include/efidevp.h @@ -110,7 +110,7 @@ typedef struct _VENDOR_DEVICE_PATH { } VENDOR_DEVICE_PATH; #define UNKNOWN_DEVICE_GUID \ - { 0xcf31fac5, 0xc24e, 0x11d2, 0x85, 0xf3, 0x0, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b } + { 0xcf31fac5, 0xc24e, 0x11d2, {0x85, 0xf3, 0x0, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b} } typedef struct _UKNOWN_DEVICE_VENDOR_DP { VENDOR_DEVICE_PATH DevicePath; @@ -274,16 +274,16 @@ typedef struct _UART_DEVICE_PATH { /* Use VENDOR_DEVICE_PATH struct */ #define DEVICE_PATH_MESSAGING_PC_ANSI \ - { 0xe0c14753, 0xf9be, 0x11d2, 0x9a, 0x0c, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } + { 0xe0c14753, 0xf9be, 0x11d2, {0x9a, 0x0c, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } #define DEVICE_PATH_MESSAGING_VT_100 \ - { 0xdfa66065, 0xb419, 0x11d3, 0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } + { 0xdfa66065, 0xb419, 0x11d3, {0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } #define DEVICE_PATH_MESSAGING_VT_100_PLUS \ - { 0x7baec70b, 0x57e0, 0x4c76, 0x8e, 0x87, 0x2f, 0x9e, 0x28, 0x08, 0x83, 0x43 } + { 0x7baec70b, 0x57e0, 0x4c76, {0x8e, 0x87, 0x2f, 0x9e, 0x28, 0x08, 0x83, 0x43} } #define DEVICE_PATH_MESSAGING_VT_UTF8 \ - { 0xad15a0d6, 0x8bec, 0x4acf, 0xa0, 0x73, 0xd0, 0x1d, 0xe7, 0x7e, 0x2d, 0x88 } + { 0xad15a0d6, 0x8bec, 0x4acf, {0xa0, 0x73, 0xd0, 0x1d, 0xe7, 0x7e, 0x2d, 0x88} } #define MEDIA_DEVICE_PATH 0x04 diff --git a/sys/boot/efi/include/efierr.h b/sys/boot/efi/include/efierr.h index 921b297ed4fb..a8b655718599 100644 --- a/sys/boot/efi/include/efierr.h +++ b/sys/boot/efi/include/efierr.h @@ -31,7 +31,7 @@ Revision History #define EFIWARN(a) (a) #define EFI_ERROR(a) (((INTN) a) < 0) -#define EFI_ERROR_CODE(a) (a & ~EFI_ERROR_MASK) +#define EFI_ERROR_CODE(a) (unsigned long)(a & ~EFI_ERROR_MASK) #define EFI_SUCCESS 0 diff --git a/sys/boot/efi/include/efifpswa.h b/sys/boot/efi/include/efifpswa.h index 3e039ef6a26d..21823c5ff6f1 100644 --- a/sys/boot/efi/include/efifpswa.h +++ b/sys/boot/efi/include/efifpswa.h @@ -7,7 +7,7 @@ */ #define EFI_INTEL_FPSWA \ - { 0xc41b6531, 0x97b9, 0x11d3, 0x9a, 0x29, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } + { 0xc41b6531, 0x97b9, 0x11d3, {0x9a, 0x29, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } INTERFACE_DECL(_FPSWA_INTERFACE); diff --git a/sys/boot/efi/include/efigop.h b/sys/boot/efi/include/efigop.h index dfc4bba1150c..104fa6e44b5a 100644 --- a/sys/boot/efi/include/efigop.h +++ b/sys/boot/efi/include/efigop.h @@ -27,9 +27,8 @@ Revision History #ifndef _EFIGOP_H #define _EFIGOP_H -#define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \ - { 0x9042a9de, 0x23dc, 0x4a38, 0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, \ - 0x51, 0x6a } +#define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \ + { 0x9042a9de, 0x23dc, 0x4a38, {0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a} } INTERFACE_DECL(_EFI_GRAPHICS_OUTPUT); diff --git a/sys/boot/efi/include/efilib.h b/sys/boot/efi/include/efilib.h index ef030284a6c7..b67ffc5305ca 100644 --- a/sys/boot/efi/include/efilib.h +++ b/sys/boot/efi/include/efilib.h @@ -50,3 +50,4 @@ time_t efi_time(EFI_TIME *); EFI_STATUS main(int argc, CHAR16 *argv[]); void exit(EFI_STATUS status); +void delay(int usecs); diff --git a/sys/boot/efi/include/efinet.h b/sys/boot/efi/include/efinet.h index b4996d9b5cc5..3ac58b2431ca 100644 --- a/sys/boot/efi/include/efinet.h +++ b/sys/boot/efi/include/efinet.h @@ -29,7 +29,7 @@ Revision History // #define EFI_SIMPLE_NETWORK_PROTOCOL \ - { 0xA19832B9, 0xAC25, 0x11D3, 0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D } + { 0xA19832B9, 0xAC25, 0x11D3, {0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D} } INTERFACE_DECL(_EFI_SIMPLE_NETWORK); diff --git a/sys/boot/efi/include/efipciio.h b/sys/boot/efi/include/efipciio.h index 6ab49baf245e..b00d6ecc994a 100644 --- a/sys/boot/efi/include/efipciio.h +++ b/sys/boot/efi/include/efipciio.h @@ -21,9 +21,7 @@ /// Global ID for the PCI I/O Protocol /// #define EFI_PCI_IO_PROTOCOL_GUID \ - { \ - 0x4cf5b200, 0x68b8, 0x4ca5, {0x9e, 0xec, 0xb2, 0x3e, 0x3f, 0x50, 0x2, 0x9a } \ - } + { 0x4cf5b200, 0x68b8, 0x4ca5, {0x9e, 0xec, 0xb2, 0x3e, 0x3f, 0x50, 0x2, 0x9a} } typedef struct _EFI_PCI_IO_PROTOCOL EFI_PCI_IO_PROTOCOL; diff --git a/sys/boot/efi/include/efiprot.h b/sys/boot/efi/include/efiprot.h index fac4568b5b32..28cec5991e31 100644 --- a/sys/boot/efi/include/efiprot.h +++ b/sys/boot/efi/include/efiprot.h @@ -31,8 +31,8 @@ Revision History // Device Path protocol // -#define DEVICE_PATH_PROTOCOL \ - { 0x9576e91, 0x6d3f, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } +#define DEVICE_PATH_PROTOCOL \ + { 0x9576e91, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } // @@ -40,7 +40,7 @@ Revision History // #define BLOCK_IO_PROTOCOL \ - { 0x964e5b21, 0x6459, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } + { 0x964e5b21, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } #define EFI_BLOCK_IO_INTERFACE_REVISION 0x00010000 INTERFACE_DECL(_EFI_BLOCK_IO); @@ -116,7 +116,7 @@ typedef struct _EFI_BLOCK_IO { // #define DISK_IO_PROTOCOL \ - { 0xce345171, 0xba0b, 0x11d2, 0x8e, 0x4f, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } + { 0xce345171, 0xba0b, 0x11d2, {0x8e, 0x4f, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } #define EFI_DISK_IO_INTERFACE_REVISION 0x00010000 INTERFACE_DECL(_EFI_DISK_IO); @@ -155,7 +155,7 @@ typedef struct _EFI_DISK_IO { // #define SIMPLE_FILE_SYSTEM_PROTOCOL \ - { 0x964e5b22, 0x6459, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } + { 0x964e5b22, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } INTERFACE_DECL(_EFI_FILE_IO_INTERFACE); INTERFACE_DECL(_EFI_FILE_HANDLE); @@ -290,8 +290,8 @@ typedef struct _EFI_FILE_HANDLE { // File information types // -#define EFI_FILE_INFO_ID \ - { 0x9576e92, 0x6d3f, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } +#define EFI_FILE_INFO_ID \ + { 0x9576e92, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } typedef struct { UINT64 Size; @@ -314,8 +314,8 @@ typedef struct { #define SIZE_OF_EFI_FILE_INFO EFI_FIELD_OFFSET(EFI_FILE_INFO,FileName) -#define EFI_FILE_SYSTEM_INFO_ID \ - { 0x9576e93, 0x6d3f, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } +#define EFI_FILE_SYSTEM_INFO_ID \ + { 0x9576e93, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } typedef struct { UINT64 Size; @@ -336,8 +336,8 @@ typedef struct { #define SIZE_OF_EFI_FILE_SYSTEM_INFO EFI_FIELD_OFFSET(EFI_FILE_SYSTEM_INFO,VolumeLabel) -#define EFI_FILE_SYSTEM_VOLUME_LABEL_INFO_ID \ - { 0xDB47D7D3,0xFE81, 0x11d3, 0x9A, 0x35, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D } +#define EFI_FILE_SYSTEM_VOLUME_LABEL_INFO_ID \ + { 0xDB47D7D3,0xFE81, 0x11d3, {0x9A, 0x35, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D} } typedef struct { CHAR16 VolumeLabel[1]; @@ -351,7 +351,7 @@ typedef struct { #define LOAD_FILE_PROTOCOL \ - { 0x56EC3091, 0x954C, 0x11d2, 0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B } + { 0x56EC3091, 0x954C, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} } INTERFACE_DECL(_EFI_LOAD_FILE_INTERFACE); @@ -375,7 +375,7 @@ typedef struct _EFI_LOAD_FILE_INTERFACE { // #define DEVICE_IO_PROTOCOL \ - { 0xaf6ac311, 0x84c3, 0x11d2, 0x8e, 0x3c, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } + { 0xaf6ac311, 0x84c3, 0x11d2, {0x8e, 0x3c, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } INTERFACE_DECL(_EFI_DEVICE_IO_INTERFACE); @@ -485,7 +485,7 @@ typedef struct _EFI_DEVICE_IO_INTERFACE { // #define UNICODE_COLLATION_PROTOCOL \ - { 0x1d85cd7f, 0xf43d, 0x11d2, 0x9a, 0xc, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } + { 0x1d85cd7f, 0xf43d, 0x11d2, {0x9a, 0xc, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } #define UNICODE_BYTE_ORDER_MARK (CHAR16)(0xfeff) diff --git a/sys/boot/efi/include/efipxebc.h b/sys/boot/efi/include/efipxebc.h index 3781a6760149..ba0b2e9b6c5d 100644 --- a/sys/boot/efi/include/efipxebc.h +++ b/sys/boot/efi/include/efipxebc.h @@ -32,7 +32,7 @@ Revision History // #define EFI_PXE_BASE_CODE_PROTOCOL \ - { 0x03c4e603, 0xac28, 0x11d3, 0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } + { 0x03c4e603, 0xac28, 0x11d3, {0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } INTERFACE_DECL(_EFI_PXE_BASE_CODE); @@ -425,7 +425,7 @@ typedef struct _EFI_PXE_BASE_CODE { // #define EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL \ - { 0x245dca21, 0xfb7b, 0x11d3, 0x8f, 0x01, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } + { 0x245dca21, 0xfb7b, 0x11d3, {0x8f, 0x01, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } // // Revision Number diff --git a/sys/boot/efi/include/efiser.h b/sys/boot/efi/include/efiser.h index 1f3fe4a81ba3..e3d66e203a4b 100644 --- a/sys/boot/efi/include/efiser.h +++ b/sys/boot/efi/include/efiser.h @@ -30,7 +30,7 @@ Revision History // #define SERIAL_IO_PROTOCOL \ - { 0xBB25CF6F, 0xF1D4, 0x11D2, 0x9A, 0x0C, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0xFD } + { 0xBB25CF6F, 0xF1D4, 0x11D2, {0x9A, 0x0C, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0xFD} } INTERFACE_DECL(_SERIAL_IO_INTERFACE); diff --git a/sys/boot/efi/include/efiuga.h b/sys/boot/efi/include/efiuga.h index ad129e32a040..6dfaf500b2fd 100644 --- a/sys/boot/efi/include/efiuga.h +++ b/sys/boot/efi/include/efiuga.h @@ -22,9 +22,7 @@ #define __UGA_DRAW_H__ #define EFI_UGA_DRAW_PROTOCOL_GUID \ - { \ - 0x982c298b, 0xf4fa, 0x41cb, {0xb8, 0x38, 0x77, 0xaa, 0x68, 0x8f, 0xb8, 0x39 } \ - } + { 0x982c298b, 0xf4fa, 0x41cb, {0xb8, 0x38, 0x77, 0xaa, 0x68, 0x8f, 0xb8, 0x39} } typedef struct _EFI_UGA_DRAW_PROTOCOL EFI_UGA_DRAW_PROTOCOL; diff --git a/sys/boot/efi/libefi/Makefile b/sys/boot/efi/libefi/Makefile index 25251c5319c2..bb2f9ea36c0b 100644 --- a/sys/boot/efi/libefi/Makefile +++ b/sys/boot/efi/libefi/Makefile @@ -2,6 +2,7 @@ LIB= efi INTERNALLIB= +WARNS?= 2 SRCS= delay.c efi_console.c efinet.c efipart.c errno.c handles.c \ libefi.c time.c diff --git a/sys/boot/efi/libefi/efi_console.c b/sys/boot/efi/libefi/efi_console.c index 52a372582898..daf1338881e1 100644 --- a/sys/boot/efi/libefi/efi_console.c +++ b/sys/boot/efi/libefi/efi_console.c @@ -47,6 +47,8 @@ static int esc; void get_pos(int *x, int *y); void curs_move(int *_x, int *_y, int x, int y); static void CL(int); +void HO(void); +void end_term(void); #endif static void efi_cons_probe(struct console *); diff --git a/sys/boot/efi/libefi/efipart.c b/sys/boot/efi/libefi/efipart.c index 0831a98d69a0..757d64f1881b 100644 --- a/sys/boot/efi/libefi/efipart.c +++ b/sys/boot/efi/libefi/efipart.c @@ -67,7 +67,6 @@ efipart_init(void) EFI_HANDLE *hin, *hout, *aliases, handle; EFI_STATUS status; UINTN sz; - CHAR16 *path; u_int n, nin, nout; int err; size_t devpathlen; diff --git a/sys/boot/efi/libefi/libefi.c b/sys/boot/efi/libefi/libefi.c index 3c66b04f76e0..0c24c6d64a72 100644 --- a/sys/boot/efi/libefi/libefi.c +++ b/sys/boot/efi/libefi/libefi.c @@ -179,7 +179,7 @@ efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *system_table) argv = malloc((argc + 1) * sizeof(CHAR16*)); argc = 0; if (addprog) - argv[argc++] = L"loader.efi"; + argv[argc++] = (CHAR16 *)"loader.efi"; argp = args; while (argp != NULL && *argp != 0) { argp = arg_skipsep(argp); diff --git a/sys/boot/efi/loader/Makefile b/sys/boot/efi/loader/Makefile index d6bd9c74a7df..56f3cabf8367 100644 --- a/sys/boot/efi/loader/Makefile +++ b/sys/boot/efi/loader/Makefile @@ -11,6 +11,7 @@ MK_SSP= no PROG= loader.sym INTERNALPROG= +WARNS?= 3 # architecture-specific loader code SRCS= autoload.c \ diff --git a/sys/boot/efi/loader/arch/amd64/elf64_freebsd.c b/sys/boot/efi/loader/arch/amd64/elf64_freebsd.c index c1dbec265542..1b95cdede4b5 100644 --- a/sys/boot/efi/loader/arch/amd64/elf64_freebsd.c +++ b/sys/boot/efi/loader/arch/amd64/elf64_freebsd.c @@ -100,7 +100,6 @@ elf64_exec(struct preloaded_file *fp) ACPI_TABLE_RSDP *rsdp; char buf[24]; int revision; - EFI_STATUS status; rsdp = efi_get_table(&acpi20_guid); if (rsdp == NULL) { diff --git a/sys/boot/efi/loader/arch/amd64/framebuffer.c b/sys/boot/efi/loader/arch/amd64/framebuffer.c index 04b880424f22..d861ee4ecdc5 100644 --- a/sys/boot/efi/loader/arch/amd64/framebuffer.c +++ b/sys/boot/efi/loader/arch/amd64/framebuffer.c @@ -39,6 +39,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include "framebuffer.h" + static EFI_GUID gop_guid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID; static EFI_GUID pciio_guid = EFI_PCI_IO_PROTOCOL_GUID; static EFI_GUID uga_guid = EFI_UGA_DRAW_PROTOCOL_GUID; @@ -270,7 +272,7 @@ efifb_from_uga(struct efi_fb *efifb, EFI_UGA_DRAW_PROTOCOL *uga) char *ev, *p; EFI_STATUS status; ssize_t offset; - uint64_t fbaddr, fbsize; + uint64_t fbaddr; uint32_t horiz, vert, stride; uint32_t np, depth, refresh; diff --git a/sys/boot/efi/loader/arch/arm/exec.c b/sys/boot/efi/loader/arch/arm/exec.c index 7c51e6e2dbe3..716c7d300a12 100644 --- a/sys/boot/efi/loader/arch/arm/exec.c +++ b/sys/boot/efi/loader/arch/arm/exec.c @@ -44,8 +44,9 @@ __FBSDID("$FreeBSD$"); #include "loader_efi.h" extern vm_offset_t md_load(char *, vm_offset_t *); +extern int bi_load(char *, vm_offset_t *, vm_offset_t *); -int +static int __elfN(arm_load)(char *filename, u_int64_t dest, struct preloaded_file **result) { @@ -58,7 +59,7 @@ __elfN(arm_load)(char *filename, u_int64_t dest, return (0); } -int +static int __elfN(arm_exec)(struct preloaded_file *fp) { struct file_metadata *fmp; @@ -66,7 +67,6 @@ __elfN(arm_exec)(struct preloaded_file *fp) Elf_Ehdr *e; int error; void (*entry)(void *); - EFI_STATUS status; if ((fmp = file_findmetadata(fp, MODINFOMD_ELFHDR)) == NULL) return (EFTYPE); diff --git a/sys/boot/efi/loader/arch/arm64/exec.c b/sys/boot/efi/loader/arch/arm64/exec.c index 0746c052cb09..a0f8b833eb7e 100644 --- a/sys/boot/efi/loader/arch/arm64/exec.c +++ b/sys/boot/efi/loader/arch/arm64/exec.c @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include "platform/acfreebsd.h" #include "acconfig.h" #define ACPI_SYSTEM_XFACE +#define ACPI_USE_SYSTEM_INTTYPES #include "actypes.h" #include "actbl.h" @@ -74,8 +75,6 @@ elf64_exec(struct preloaded_file *fp) size_t clean_size; struct file_metadata *md; ACPI_TABLE_RSDP *rsdp; - EFI_STATUS status; - EFI_PHYSICAL_ADDRESS addr; Elf_Ehdr *ehdr; char buf[24]; int err, revision; @@ -119,8 +118,8 @@ elf64_exec(struct preloaded_file *fp) return (err); /* Clean D-cache under kernel area and invalidate whole I-cache */ - clean_addr = efi_translate(fp->f_addr); - clean_size = efi_translate(kernendp) - clean_addr; + clean_addr = (vm_offset_t)efi_translate(fp->f_addr); + clean_size = (vm_offset_t)efi_translate(kernendp) - clean_addr; cpu_flush_dcache((void *)clean_addr, clean_size); cpu_inval_icache(NULL, 0); diff --git a/sys/boot/efi/loader/autoload.c b/sys/boot/efi/loader/autoload.c index 694a6da5591f..c1eb84928ed8 100644 --- a/sys/boot/efi/loader/autoload.c +++ b/sys/boot/efi/loader/autoload.c @@ -27,6 +27,8 @@ #include __FBSDID("$FreeBSD$"); +#include "loader_efi.h" + int efi_autoload(void) { diff --git a/sys/boot/efi/loader/bootinfo.c b/sys/boot/efi/loader/bootinfo.c index ac665b200d91..c6a76abc0845 100644 --- a/sys/boot/efi/loader/bootinfo.c +++ b/sys/boot/efi/loader/bootinfo.c @@ -55,6 +55,8 @@ __FBSDID("$FreeBSD$"); #include #endif +int bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp); + extern EFI_SYSTEM_TABLE *ST; static const char howto_switches[] = "aCdrgDmphsv"; @@ -122,7 +124,7 @@ bi_copyenv(vm_offset_t start) /* Traverse the environment. */ for (ep = environ; ep != NULL; ep = ep->ev_next) { len = strlen(ep->ev_name); - if (archsw.arch_copyin(ep->ev_name, addr, len) != len) + if ((size_t)archsw.arch_copyin(ep->ev_name, addr, len) != len) break; addr += len; if (archsw.arch_copyin("=", addr, 1) != 1) @@ -130,7 +132,7 @@ bi_copyenv(vm_offset_t start) addr++; if (ep->ev_value != NULL) { len = strlen(ep->ev_value); - if (archsw.arch_copyin(ep->ev_value, addr, len) != len) + if ((size_t)archsw.arch_copyin(ep->ev_value, addr, len) != len) break; addr += len; } @@ -351,7 +353,7 @@ bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp) #endif #if defined(__arm__) vm_offset_t vaddr; - int i; + size_t i; /* * These metadata addreses must be converted for kernel after * relocation. diff --git a/sys/boot/efi/loader/copy.c b/sys/boot/efi/loader/copy.c index 8714786c3471..128196e2696b 100644 --- a/sys/boot/efi/loader/copy.c +++ b/sys/boot/efi/loader/copy.c @@ -37,6 +37,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include "loader_efi.h" + #ifndef EFI_STAGING_SIZE #define EFI_STAGING_SIZE 48 #endif diff --git a/sys/boot/efi/loader/devicename.c b/sys/boot/efi/loader/devicename.c index 1ba33e8f7ad0..45f9871bd45d 100644 --- a/sys/boot/efi/loader/devicename.c +++ b/sys/boot/efi/loader/devicename.c @@ -31,11 +31,13 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include "bootstrap.h" +#include #include #include +#include "loader_efi.h" + static int efi_parsedev(struct devdesc **, const char *, const char **); /* diff --git a/sys/boot/efi/loader/loader_efi.h b/sys/boot/efi/loader/loader_efi.h index 5819d78e2207..ee7c4bb72eba 100644 --- a/sys/boot/efi/loader/loader_efi.h +++ b/sys/boot/efi/loader/loader_efi.h @@ -31,6 +31,8 @@ #ifndef _LOADER_EFI_COPY_H_ #define _LOADER_EFI_COPY_H_ +#include + int efi_autoload(void); int efi_getdev(void **vdev, const char *devspec, const char **path); diff --git a/sys/boot/efi/loader/main.c b/sys/boot/efi/loader/main.c index 1fa031f29afe..ddd96b41e572 100644 --- a/sys/boot/efi/loader/main.c +++ b/sys/boot/efi/loader/main.c @@ -68,6 +68,7 @@ main(int argc, CHAR16 *argv[]) EFI_LOADED_IMAGE *img; EFI_GUID *guid; int i, j, vargood; + UINTN k; /* * XXX Chicken-and-egg problem; we want to have console output @@ -155,10 +156,10 @@ main(int argc, CHAR16 *argv[]) archsw.arch_copyout = efi_copyout; archsw.arch_readin = efi_readin; - for (i = 0; i < ST->NumberOfTableEntries; i++) { - guid = &ST->ConfigurationTable[i].VendorGuid; + for (k = 0; k < ST->NumberOfTableEntries; k++) { + guid = &ST->ConfigurationTable[k].VendorGuid; if (!memcmp(guid, &smbios, sizeof(EFI_GUID))) { - smbios_detect(ST->ConfigurationTable[i].VendorTable); + smbios_detect(ST->ConfigurationTable[k].VendorTable); break; } } @@ -242,8 +243,9 @@ command_memmap(int argc, char *argv[]) for (i = 0, p = map; i < ndesc; i++, p = NextMemoryDescriptor(p, dsz)) { - printf("%23s %012lx %012lx %08lx ", types[p->Type], - p->PhysicalStart, p->VirtualStart, p->NumberOfPages); + printf("%23s %012jx %012jx %08jx ", types[p->Type], + (uintmax_t)p->PhysicalStart, (uintmax_t)p->VirtualStart, + (uintmax_t)p->NumberOfPages); if (p->Attribute & EFI_MEMORY_UC) printf("UC "); if (p->Attribute & EFI_MEMORY_WC) @@ -284,9 +286,10 @@ guid_to_string(EFI_GUID *guid) static int command_configuration(int argc, char *argv[]) { - int i; + UINTN i; - printf("NumberOfTableEntries=%ld\n", ST->NumberOfTableEntries); + printf("NumberOfTableEntries=%lu\n", + (unsigned long)ST->NumberOfTableEntries); for (i = 0; i < ST->NumberOfTableEntries; i++) { EFI_GUID *guid; @@ -382,9 +385,8 @@ command_nvram(int argc, char *argv[]) CHAR16 *data; EFI_STATUS status; EFI_GUID varguid = { 0,0,0,{0,0,0,0,0,0,0,0} }; - UINTN varsz, datasz; + UINTN varsz, datasz, i; SIMPLE_TEXT_OUTPUT_INTERFACE *conout; - int i; conout = ST->ConOut; diff --git a/sys/boot/i386/libi386/smbios.c b/sys/boot/i386/libi386/smbios.c index 6e4fb842d22b..7a7ce4ba4f56 100644 --- a/sys/boot/i386/libi386/smbios.c +++ b/sys/boot/i386/libi386/smbios.c @@ -332,7 +332,7 @@ static caddr_t smbios_find_struct(int type) { caddr_t dmi; - int i; + size_t i; if (smbios.addr == NULL) return (NULL); @@ -402,7 +402,7 @@ smbios_detect(const caddr_t addr) { char buf[16]; caddr_t dmi; - int i; + size_t i; smbios_probe(addr); if (smbios.addr == NULL) From 8883918d66cd50ccded70109db5670514baf8e8a Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Tue, 12 Jan 2016 06:29:17 +0000 Subject: [PATCH 15/82] sfxge: add sanity checking for EFX_OPT_MEDFORD build option to efx_check.h Submitted by: Mark Spender Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D4854 --- sys/dev/sfxge/common/efx_check.h | 100 ++++++++++++++++++------------- 1 file changed, 57 insertions(+), 43 deletions(-) diff --git a/sys/dev/sfxge/common/efx_check.h b/sys/dev/sfxge/common/efx_check.h index 684cbbfbe952..f84bd7d36584 100644 --- a/sys/dev/sfxge/common/efx_check.h +++ b/sys/dev/sfxge/common/efx_check.h @@ -52,16 +52,17 @@ /* Verify chip implements accessed registers */ #if EFSYS_OPT_CHECK_REG -# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON) -# error "CHECK_REG requires FALCON or SIENA or HUNTINGTON" +# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \ + EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) +# error "CHECK_REG requires FALCON or SIENA or HUNTINGTON or MEDFORD" # endif #endif /* EFSYS_OPT_CHECK_REG */ /* Decode fatal errors */ #if EFSYS_OPT_DECODE_INTR_FATAL # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA) -# if EFSYS_OPT_HUNTINGTON -# error "INTR_FATAL not supported on HUNTINGTON" +# if (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) +# error "INTR_FATAL not supported on HUNTINGTON or MEDFORD" # endif # error "INTR_FATAL requires FALCON or SIENA" # endif @@ -69,15 +70,17 @@ /* Support diagnostic hardware tests */ #if EFSYS_OPT_DIAG -# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON) -# error "DIAG requires FALCON or SIENA or HUNTINGTON" +# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \ + EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) +# error "DIAG requires FALCON or SIENA or HUNTINGTON or MEDFORD" # endif #endif /* EFSYS_OPT_DIAG */ /* Support optimized EVQ data access */ #if EFSYS_OPT_EV_PREFETCH -# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON) -# error "EV_PREFETCH requires FALCON or SIENA or HUNTINGTON" +# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \ + EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) +# error "EV_PREFETCH requires FALCON or SIENA or HUNTINGTON or MEDFORD" # endif #endif /* EFSYS_OPT_EV_PREFETCH */ @@ -90,21 +93,23 @@ /* Support hardware packet filters */ #if EFSYS_OPT_FILTER -# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON) -# error "FILTER requires FALCON or SIENA or HUNTINGTON" +# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \ + EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) +# error "FILTER requires FALCON or SIENA or HUNTINGTON or MEDFORD" # endif #endif /* EFSYS_OPT_FILTER */ -#if EFSYS_OPT_HUNTINGTON +#if (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) # if !EFSYS_OPT_FILTER -# error "HUNTINGTON requires FILTER" +# error "HUNTINGTON or MEDFORD requires FILTER" # endif #endif /* EFSYS_OPT_HUNTINGTON */ /* Support hardware loopback modes */ #if EFSYS_OPT_LOOPBACK -# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON) -# error "LOOPBACK requires FALCON or SIENA or HUNTINGTON" +# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \ + EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) +# error "LOOPBACK requires FALCON or SIENA or HUNTINGTON or MEDFORD" # endif #endif /* EFSYS_OPT_LOOPBACK */ @@ -124,26 +129,26 @@ /* Support MAC statistics */ #if EFSYS_OPT_MAC_STATS -# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON) -# error "MAC_STATS requires FALCON or SIENA or HUNTINGTON" +# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \ + EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) +# error "MAC_STATS requires FALCON or SIENA or HUNTINGTON or MEDFORD" # endif #endif /* EFSYS_OPT_MAC_STATS */ /* Support management controller messages */ #if EFSYS_OPT_MCDI -# if !(EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON) +# if !(EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) # if EFSYS_OPT_FALCON # error "MCDI not supported on FALCON" # endif -# error "MCDI requires SIENA or HUNTINGTON" +# error "MCDI requires SIENA or HUNTINGTON or MEDFORD" # endif #endif /* EFSYS_OPT_MCDI */ -#if EFSYS_OPT_SIENA && !EFSYS_OPT_MCDI -# error "SIENA requires MCDI" -#endif -#if EFSYS_OPT_HUNTINGTON && !EFSYS_OPT_MCDI -# error "HUNTINGTON requires MCDI" +#if (EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) +# if !EFSYS_OPT_MCDI +# error "SIENA or HUNTINGTON or MEDFORD requires MCDI" +# endif #endif /* Support MCDI logging */ @@ -193,15 +198,16 @@ /* Support monitor statistics (voltage/temperature) */ #if EFSYS_OPT_MON_STATS -# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON) -# error "MON_STATS requires FALCON or SIENA or HUNTINGTON" +# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \ + EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) +# error "MON_STATS requires FALCON or SIENA or HUNTINGTON or MEDFORD" # endif #endif /* EFSYS_OPT_MON_STATS */ /* Support Monitor via mcdi */ #if EFSYS_OPT_MON_MCDI -# if !(EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON) -# error "MON_MCDI requires SIENA or HUNTINGTON" +# if !(EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) +# error "MON_MCDI requires SIENA or HUNTINGTON or MEDFORD" # endif #endif /* EFSYS_OPT_MON_MCDI*/ @@ -216,8 +222,9 @@ /* Support non volatile configuration */ #if EFSYS_OPT_NVRAM -# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON) -# error "NVRAM requires FALCON or SIENA or HUNTINGTON" +# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \ + EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) +# error "NVRAM requires FALCON or SIENA or HUNTINGTON or MEDFORD" # endif #endif /* EFSYS_OPT_NVRAM */ @@ -340,29 +347,33 @@ /* Support EVQ/RXQ/TXQ statistics */ #if EFSYS_OPT_QSTATS -# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON) -# error "QSTATS requires FALCON or SIENA or HUNTINGTON" +# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \ + EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) +# error "QSTATS requires FALCON or SIENA or HUNTINGTON or MEDFORD" # endif #endif /* EFSYS_OPT_QSTATS */ /* Support receive header split */ #if EFSYS_OPT_RX_HDR_SPLIT -# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON) -# error "RX_HDR_SPLIT requires FALCON or SIENA or HUNTINGTON" +# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \ + EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) +# error "RX_HDR_SPLIT requires FALCON or SIENA or HUNTINGTON or MEDFORD" # endif #endif /* EFSYS_OPT_RX_HDR_SPLIT */ /* Support receive scaling (RSS) */ #if EFSYS_OPT_RX_SCALE -# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON) -# error "RX_SCALE requires FALCON or SIENA or HUNTINGTON" +# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \ + EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) +# error "RX_SCALE requires FALCON or SIENA or HUNTINGTON or MEDFORD" # endif #endif /* EFSYS_OPT_RX_SCALE */ /* Support receive scatter DMA */ #if EFSYS_OPT_RX_SCATTER -# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON) -# error "RX_SCATTER requires FALCON or SIENA or HUNTINGTON" +# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \ + EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) +# error "RX_SCATTER requires FALCON or SIENA or HUNTINGTON or MEDFORD" # endif #endif /* EFSYS_OPT_RX_SCATTER */ @@ -373,8 +384,9 @@ /* Support PCI Vital Product Data (VPD) */ #if EFSYS_OPT_VPD -# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON) -# error "VPD requires FALCON or SIENA or HUNTINGTON" +# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \ + EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) +# error "VPD requires FALCON or SIENA or HUNTINGTON or MEDFORD" # endif #endif /* EFSYS_OPT_VPD */ @@ -387,15 +399,17 @@ /* Support calculating multicast pktfilter in common code */ #if EFSYS_OPT_MCAST_FILTER_LIST -# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON) -# error "MCAST_FILTER_LIST requires FALCON or SIENA or HUNTINGTON" +# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \ + EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) +# error "MCAST_FILTER_LIST requires FALCON or SIENA or HUNTINGTON or MEDFORD" # endif #endif /* EFSYS_OPT_MCAST_FILTER_LIST */ /* Support BIST */ #if EFSYS_OPT_BIST -# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON) -# error "BIST requires FALCON or SIENA or HUNTINGTON" +# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \ + EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) +# error "BIST requires FALCON or SIENA or HUNTINGTON or MEDFORD" # endif #endif /* EFSYS_OPT_BIST */ From 34f6ea2980a1f5bc88eb85f4b19b323793fc77f9 Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Tue, 12 Jan 2016 06:32:56 +0000 Subject: [PATCH 16/82] sfxge: add Medford PCI IDs to common code Submitted by: Mark Spender Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D4856 --- sys/dev/sfxge/common/efx.h | 8 +++-- sys/dev/sfxge/common/efx_impl.h | 4 +++ sys/dev/sfxge/common/efx_nic.c | 60 +++++++++++++++++++++------------ 3 files changed, 49 insertions(+), 23 deletions(-) diff --git a/sys/dev/sfxge/common/efx.h b/sys/dev/sfxge/common/efx.h index a84454dc4775..20f265589291 100644 --- a/sys/dev/sfxge/common/efx.h +++ b/sys/dev/sfxge/common/efx.h @@ -61,6 +61,7 @@ typedef enum efx_family_e { EFX_FAMILY_FALCON, EFX_FAMILY_SIENA, EFX_FAMILY_HUNTINGTON, + EFX_FAMILY_MEDFORD, EFX_FAMILY_NTYPES } efx_family_t; @@ -90,6 +91,9 @@ efx_infer_family( #define EFX_PCI_DEVID_FARMINGDALE_VF 0x1903 /* SFC9120 VF */ #define EFX_PCI_DEVID_GREENPORT_VF 0x1923 /* SFC9140 VF */ +#define EFX_PCI_DEVID_MEDFORD_PF_UNINIT 0x0913 +#define EFX_PCI_DEVID_MEDFORD 0x0A03 /* SFC9240 PF */ +#define EFX_PCI_DEVID_MEDFORD_VF 0x1A03 /* SFC9240 VF */ #define EFX_MEM_BAR 2 @@ -1153,11 +1157,11 @@ typedef struct efx_nic_cfg_s { #if EFSYS_OPT_BIST uint32_t enc_bist_mask; #endif /* EFSYS_OPT_BIST */ -#if EFSYS_OPT_HUNTINGTON +#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD uint32_t enc_pf; uint32_t enc_vf; uint32_t enc_privilege_mask; -#endif /* EFSYS_OPT_HUNTINGTON */ +#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */ boolean_t enc_bug26807_workaround; boolean_t enc_bug35388_workaround; boolean_t enc_bug41750_workaround; diff --git a/sys/dev/sfxge/common/efx_impl.h b/sys/dev/sfxge/common/efx_impl.h index 502fc78517ca..11b723fab01a 100644 --- a/sys/dev/sfxge/common/efx_impl.h +++ b/sys/dev/sfxge/common/efx_impl.h @@ -797,6 +797,10 @@ struct efx_txq_s { rev = 'D'; \ break; \ \ + case EFX_FAMILY_MEDFORD: \ + rev = 'E'; \ + break; \ + \ default: \ rev = '?'; \ break; \ diff --git a/sys/dev/sfxge/common/efx_nic.c b/sys/dev/sfxge/common/efx_nic.c index 96d06496a442..f1742e6e9ed5 100644 --- a/sys/dev/sfxge/common/efx_nic.c +++ b/sys/dev/sfxge/common/efx_nic.c @@ -49,7 +49,8 @@ efx_family( case EFX_PCI_DEVID_FALCON: *efp = EFX_FAMILY_FALCON; return (0); -#endif +#endif /* EFSYS_OPT_FALCON */ + #if EFSYS_OPT_SIENA case EFX_PCI_DEVID_SIENA_F1_UNINIT: /* @@ -63,7 +64,7 @@ efx_family( case EFX_PCI_DEVID_SIENA: *efp = EFX_FAMILY_SIENA; return (0); -#endif +#endif /* EFSYS_OPT_SIENA */ #if EFSYS_OPT_HUNTINGTON case EFX_PCI_DEVID_HUNTINGTON_PF_UNINIT: @@ -83,7 +84,26 @@ efx_family( case EFX_PCI_DEVID_GREENPORT_VF: *efp = EFX_FAMILY_HUNTINGTON; return (0); -#endif +#endif /* EFSYS_OPT_HUNTINGTON */ + +#if EFSYS_OPT_MEDFORD + case EFX_PCI_DEVID_MEDFORD_PF_UNINIT: + /* + * Hardware default for PF0 of uninitialised Medford. + * manftest must be able to cope with this device id. + */ + *efp = EFX_FAMILY_MEDFORD; + return (0); + + case EFX_PCI_DEVID_MEDFORD: + *efp = EFX_FAMILY_MEDFORD; + return (0); + + case EFX_PCI_DEVID_MEDFORD_VF: + *efp = EFX_FAMILY_MEDFORD; + return (0); +#endif /* EFSYS_OPT_MEDFORD */ + default: break; } @@ -110,8 +130,12 @@ efx_infer_family( EFSYS_BAR_READO(esbp, FR_AZ_CS_DEBUG_REG_OFST, &oword, B_TRUE); portnum = EFX_OWORD_FIELD(oword, FRF_CZ_CS_PORT_NUM); - switch (portnum) { - case 0: { + if ((portnum == 1) || (portnum == 2)) { +#if EFSYS_OPT_SIENA + family = EFX_FAMILY_SIENA; + goto out; +#endif + } else if (portnum == 0) { efx_dword_t dword; uint32_t hw_rev; @@ -119,31 +143,25 @@ efx_infer_family( B_TRUE); hw_rev = EFX_DWORD_FIELD(dword, ERF_DZ_HW_REV_ID); if (hw_rev == ER_DZ_BIU_HW_REV_ID_REG_RESET) { -#if EFSYS_OPT_HUNTINGTON +#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD + /* + * BIU_HW_REV_ID is the same for Huntington and Medford. + * Assume Huntington, as Medford is very similar. + */ family = EFX_FAMILY_HUNTINGTON; - break; + goto out; #endif } else { #if EFSYS_OPT_FALCON family = EFX_FAMILY_FALCON; - break; + goto out; #endif } - rc = ENOTSUP; - goto fail1; - } - -#if EFSYS_OPT_SIENA - case 1: - case 2: - family = EFX_FAMILY_SIENA; - break; -#endif - default: - rc = ENOTSUP; - goto fail1; } + rc = ENOTSUP; + goto fail1; +out: if (efp != NULL) *efp = family; return (0); From 19bc938f5a28648ed8ce8cd96a88cf07169b409e Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Tue, 12 Jan 2016 06:34:45 +0000 Subject: [PATCH 17/82] sfxge: use MCDIv2 on Medford Submitted by: Mark Spender Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D4857 --- sys/dev/sfxge/common/efx.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/sfxge/common/efx.h b/sys/dev/sfxge/common/efx.h index 20f265589291..3bee09aba635 100644 --- a/sys/dev/sfxge/common/efx.h +++ b/sys/dev/sfxge/common/efx.h @@ -191,8 +191,8 @@ efx_nic_destroy( #if EFSYS_OPT_MCDI -#if EFSYS_OPT_HUNTINGTON -/* Huntington requires MCDIv2 commands */ +#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD +/* Huntington and Medford require MCDIv2 commands */ #define WITH_MCDI_V2 1 #endif From b13ad4deb6f2556b940300161f79224178c8b5b9 Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Tue, 12 Jan 2016 06:37:42 +0000 Subject: [PATCH 18/82] sfxge: add Medford sensor support Submitted by: Mark Spender Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D4858 --- sys/dev/sfxge/common/efx.h | 5 +-- sys/dev/sfxge/common/efx_mon.c | 55 +++++++++++++++------------------ sys/dev/sfxge/common/mcdi_mon.c | 5 +++ 3 files changed, 33 insertions(+), 32 deletions(-) diff --git a/sys/dev/sfxge/common/efx.h b/sys/dev/sfxge/common/efx.h index 3bee09aba635..aba1ebe1069a 100644 --- a/sys/dev/sfxge/common/efx.h +++ b/sys/dev/sfxge/common/efx.h @@ -594,6 +594,7 @@ typedef enum efx_mon_type_e { EFX_MON_MAX6647, EFX_MON_SFC90X0, EFX_MON_SFC91X0, + EFX_MON_SFC92X0, EFX_MON_NTYPES } efx_mon_type_t; @@ -1148,12 +1149,12 @@ typedef struct efx_nic_cfg_s { uint32_t enc_mcdi_phy_stat_mask; #endif /* EFSYS_OPT_PHY_STATS */ #endif /* EFSYS_OPT_SIENA */ -#if (EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON) +#if (EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) #if EFSYS_OPT_MON_STATS uint32_t *enc_mcdi_sensor_maskp; uint32_t enc_mcdi_sensor_mask_size; #endif /* EFSYS_OPT_MON_STATS */ -#endif /* (EFSYS_OPT_SIENA | EFSYS_OPT_HUNTINGTON) */ +#endif /* (EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) */ #if EFSYS_OPT_BIST uint32_t enc_bist_mask; #endif /* EFSYS_OPT_BIST */ diff --git a/sys/dev/sfxge/common/efx_mon.c b/sys/dev/sfxge/common/efx_mon.c index 3574e8a5d652..00bb3a195d21 100644 --- a/sys/dev/sfxge/common/efx_mon.c +++ b/sys/dev/sfxge/common/efx_mon.c @@ -62,6 +62,7 @@ static const char *__efx_mon_name[] = { "max6647", "sfx90x0", "sfx91x0" + "sfx92x0" }; const char * @@ -119,34 +120,6 @@ static efx_mon_ops_t __efx_mon_mcdi_ops = { }; #endif -static efx_mon_ops_t *__efx_mon_ops[] = { - NULL, -#if EFSYS_OPT_MON_NULL - &__efx_mon_null_ops, -#else - NULL, -#endif -#if EFSYS_OPT_MON_LM87 - &__efx_mon_lm87_ops, -#else - NULL, -#endif -#if EFSYS_OPT_MON_MAX6647 - &__efx_mon_max6647_ops, -#else - NULL, -#endif -#if EFSYS_OPT_MON_MCDI - &__efx_mon_mcdi_ops, -#else - NULL, -#endif -#if EFSYS_OPT_MON_MCDI - &__efx_mon_mcdi_ops -#else - NULL -#endif -}; __checkReturn efx_rc_t efx_mon_init( @@ -170,8 +143,30 @@ efx_mon_init( emp->em_type = encp->enc_mon_type; EFSYS_ASSERT(encp->enc_mon_type != EFX_MON_INVALID); - EFSYS_ASSERT3U(emp->em_type, <, EFX_MON_NTYPES); - if ((emop = (efx_mon_ops_t *)__efx_mon_ops[emp->em_type]) == NULL) { + switch (emp->em_type) { +#if EFSYS_OPT_MON_NULL + case EFX_MON_NULL: + emop = &__efx_mon_null_ops; + break; +#endif +#if EFSYS_OPT_MON_LM87 + case EFX_MON_LM87: + emop = &__efx_mon_lm87_ops; + break; +#endif +#if EFSYS_OPT_MON_MAX6647 + case EFX_MON_MAX6647: + emop = &__efx_mon_max6647_ops; + break; +#endif +#if EFSYS_OPT_MON_MCDI + case EFX_MON_SFC90X0: + case EFX_MON_SFC91X0: + case EFX_MON_SFC92X0: + emop = &__efx_mon_mcdi_ops; + break; +#endif + default: rc = ENOTSUP; goto fail2; } diff --git a/sys/dev/sfxge/common/mcdi_mon.c b/sys/dev/sfxge/common/mcdi_mon.c index f8b1681e55b4..e2105cdcef01 100644 --- a/sys/dev/sfxge/common/mcdi_mon.c +++ b/sys/dev/sfxge/common/mcdi_mon.c @@ -477,6 +477,11 @@ mcdi_mon_cfg_build( case EFX_FAMILY_HUNTINGTON: encp->enc_mon_type = EFX_MON_SFC91X0; break; +#endif +#if EFSYS_OPT_MEDFORD + case EFX_FAMILY_MEDFORD: + encp->enc_mon_type = EFX_MON_SFC92X0; + break; #endif default: rc = EINVAL; From 5f5c71cc134f7dd301383ab996bd97e4fc44bd12 Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Tue, 12 Jan 2016 08:32:53 +0000 Subject: [PATCH 19/82] sfxge: add medford_impl.h, medford_nic.c, ef10_impl.h Creating some files together to do the build system changes in one go. Submitted by: Mark Spender Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D4859 --- sys/dev/sfxge/common/ef10_impl.h | 47 +++++++++++++++++++++++++++++ sys/dev/sfxge/common/efx_impl.h | 8 +++++ sys/dev/sfxge/common/medford_impl.h | 47 +++++++++++++++++++++++++++++ sys/dev/sfxge/common/medford_nic.c | 46 ++++++++++++++++++++++++++++ sys/modules/sfxge/Makefile | 5 +++ 5 files changed, 153 insertions(+) create mode 100644 sys/dev/sfxge/common/ef10_impl.h create mode 100644 sys/dev/sfxge/common/medford_impl.h create mode 100644 sys/dev/sfxge/common/medford_nic.c diff --git a/sys/dev/sfxge/common/ef10_impl.h b/sys/dev/sfxge/common/ef10_impl.h new file mode 100644 index 000000000000..d35de82c99b9 --- /dev/null +++ b/sys/dev/sfxge/common/ef10_impl.h @@ -0,0 +1,47 @@ +/*- + * Copyright (c) 2015 Solarflare Communications Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are + * those of the authors and should not be interpreted as representing official + * policies, either expressed or implied, of the FreeBSD Project. + * + * $FreeBSD$ + */ + +#ifndef _SYS_EF10_IMPL_H +#define _SYS_EF10_IMPL_H + +#ifdef __cplusplus +extern "C" { +#endif + + + + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_EF10_IMPL_H */ diff --git a/sys/dev/sfxge/common/efx_impl.h b/sys/dev/sfxge/common/efx_impl.h index 11b723fab01a..b1a918bdb731 100644 --- a/sys/dev/sfxge/common/efx_impl.h +++ b/sys/dev/sfxge/common/efx_impl.h @@ -58,6 +58,14 @@ #include "hunt_impl.h" #endif /* EFSYS_OPT_HUNTINGTON */ +#if EFSYS_OPT_MEDFORD +#include "medford_impl.h" +#endif /* EFSYS_OPT_MEDFORD */ + +#if (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) +#include "ef10_impl.h" +#endif /* (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) */ + #ifdef __cplusplus extern "C" { #endif diff --git a/sys/dev/sfxge/common/medford_impl.h b/sys/dev/sfxge/common/medford_impl.h new file mode 100644 index 000000000000..39f908eff114 --- /dev/null +++ b/sys/dev/sfxge/common/medford_impl.h @@ -0,0 +1,47 @@ +/*- + * Copyright (c) 2015 Solarflare Communications Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are + * those of the authors and should not be interpreted as representing official + * policies, either expressed or implied, of the FreeBSD Project. + * + * $FreeBSD$ + */ + +#ifndef _SYS_MEDFORD_IMPL_H +#define _SYS_MEDFORD_IMPL_H + +#ifdef __cplusplus +extern "C" { +#endif + + + + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_MEDFORD_IMPL_H */ diff --git a/sys/dev/sfxge/common/medford_nic.c b/sys/dev/sfxge/common/medford_nic.c new file mode 100644 index 000000000000..a293ae33df68 --- /dev/null +++ b/sys/dev/sfxge/common/medford_nic.c @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 2015 Solarflare Communications Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are + * those of the authors and should not be interpreted as representing official + * policies, either expressed or implied, of the FreeBSD Project. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "efsys.h" +#include "efx.h" +#include "efx_impl.h" +#include "mcdi_mon.h" + +#if EFSYS_OPT_MEDFORD + +#include "ef10_tlv_layout.h" + + + + +#endif /* EFSYS_OPT_MEDFORD */ diff --git a/sys/modules/sfxge/Makefile b/sys/modules/sfxge/Makefile index b2116d8e7e97..54d0af13d730 100644 --- a/sys/modules/sfxge/Makefile +++ b/sys/modules/sfxge/Makefile @@ -29,11 +29,16 @@ SRCS+= siena_mac.c siena_mcdi.c siena_nic.c siena_nvram.c siena_phy.c SRCS+= siena_sram.c siena_vpd.c SRCS+= siena_flash.h siena_impl.h +SRCS+= ef10_impl.h + SRCS+= hunt_ev.c hunt_intr.c hunt_mac.c hunt_mcdi.c hunt_nic.c SRCS+= hunt_nvram.c hunt_rx.c hunt_phy.c hunt_sram.c hunt_tx.c hunt_vpd.c SRCS+= hunt_filter.c SRCS+= hunt_impl.h +SRCS+= medford_nic.c +SRCS+= medford_impl.h + # Extra debug checks #CFLAGS += -DDEBUG=1 From 4d6b63767536dbd5908a1e7fd086f53c2547210c Mon Sep 17 00:00:00 2001 From: Colin Percival Date: Tue, 12 Jan 2016 09:42:21 +0000 Subject: [PATCH 20/82] Enable "EC2 Enhanced Networking" (aka. SR-IOV networking) when creating EC2 images. X-MFC after: if/when the driver fixes get MFCed Relnotes: FreeBSD now supports EC2 Enhanced Networking --- release/Makefile.ec2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/Makefile.ec2 b/release/Makefile.ec2 index 2695183d90f1..221ea6cc0d82 100644 --- a/release/Makefile.ec2 +++ b/release/Makefile.ec2 @@ -51,7 +51,7 @@ ec2ami: cw-ec2 ${CW_EC2_PORTINSTALL} @echo "--------------------------------------------------------------" @false .endif - /usr/local/bin/bsdec2-image-upload ${PUBLISH} \ + /usr/local/bin/bsdec2-image-upload ${PUBLISH} --sriov \ ${.OBJDIR}/ec2.raw \ "${TYPE} ${REVISION}-${BRANCH}-${TARGET}${AMINAMESUFFIX}" \ "${TYPE} ${REVISION}-${BRANCH}-${TARGET}" \ From 435c2014688711ca559754989973171e32874c47 Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Tue, 12 Jan 2016 09:52:38 +0000 Subject: [PATCH 21/82] sfxge: update autogenerated monitors lists Submitted by: Andy Moreton Sponsored by: Solarflare Communications, Inc. MFC after: 2 days --- sys/dev/sfxge/common/efx.h | 8 +++++++- sys/dev/sfxge/common/efx_mon.c | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/sys/dev/sfxge/common/efx.h b/sys/dev/sfxge/common/efx.h index aba1ebe1069a..96fe401a1df1 100644 --- a/sys/dev/sfxge/common/efx.h +++ b/sys/dev/sfxge/common/efx.h @@ -615,7 +615,7 @@ efx_mon_init( #define EFX_MON_STATS_PAGE_SIZE 0x100 #define EFX_MON_MASK_ELEMENT_SIZE 32 -/* START MKCONFIG GENERATED MonitorHeaderStatsBlock c79c86b62a144846 */ +/* START MKCONFIG GENERATED MonitorHeaderStatsBlock c09b13f732431f23 */ typedef enum efx_mon_stat_e { EFX_MON_STAT_2_5V, EFX_MON_STAT_VCCP1, @@ -686,6 +686,12 @@ typedef enum efx_mon_stat_e { EFX_MON_STAT_CONTROLLER_SLAVE_INTERNAL_TEMP, EFX_MON_STAT_CONTROLLER_SLAVE_VPTAT_EXT_ADC, EFX_MON_STAT_CONTROLLER_SLAVE_INTERNAL_TEMP_EXT_ADC, + EFX_MON_STAT_SODIMM_VOUT, + EFX_MON_STAT_SODIMM_0_TEMP, + EFX_MON_STAT_SODIMM_1_TEMP, + EFX_MON_STAT_PHY0_VCC, + EFX_MON_STAT_PHY1_VCC, + EFX_MON_STAT_CONTROLLER_TDIODE_TEMP, EFX_MON_NSTATS } efx_mon_stat_t; diff --git a/sys/dev/sfxge/common/efx_mon.c b/sys/dev/sfxge/common/efx_mon.c index 00bb3a195d21..8603b8b7609f 100644 --- a/sys/dev/sfxge/common/efx_mon.c +++ b/sys/dev/sfxge/common/efx_mon.c @@ -209,7 +209,7 @@ efx_mon_init( #if EFSYS_OPT_NAMES -/* START MKCONFIG GENERATED MonitorStatNamesBlock b9328f15438c4d01 */ +/* START MKCONFIG GENERATED MonitorStatNamesBlock 01ee3ea01f23a0c4 */ static const char *__mon_stat_name[] = { "value_2_5v", "value_vccp1", @@ -280,6 +280,12 @@ static const char *__mon_stat_name[] = { "controller_slave_internal_temp", "controller_slave_vptat_ext_adc", "controller_slave_internal_temp_ext_adc", + "sodimm_vout", + "sodimm_0_temp", + "sodimm_1_temp", + "phy0_vcc", + "phy1_vcc", + "controller_tdiode_temp", }; /* END MKCONFIG GENERATED MonitorStatNamesBlock */ From 799d68c0249970393413acb0ae17eab659337113 Mon Sep 17 00:00:00 2001 From: Christian Brueffer Date: Tue, 12 Jan 2016 10:16:15 +0000 Subject: [PATCH 22/82] Add a basic bhyvectl manpage. Reviewed by: neel MFC after: 2 weeks --- usr.sbin/bhyvectl/Makefile | 2 +- usr.sbin/bhyvectl/bhyvectl.8 | 97 ++++++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 usr.sbin/bhyvectl/bhyvectl.8 diff --git a/usr.sbin/bhyvectl/Makefile b/usr.sbin/bhyvectl/Makefile index 4a33dee94676..fe8f1d32e5dc 100644 --- a/usr.sbin/bhyvectl/Makefile +++ b/usr.sbin/bhyvectl/Makefile @@ -5,7 +5,7 @@ PROG= bhyvectl SRCS= bhyvectl.c -MAN= +MAN= bhyvectl.8 LIBADD= vmmapi util diff --git a/usr.sbin/bhyvectl/bhyvectl.8 b/usr.sbin/bhyvectl/bhyvectl.8 new file mode 100644 index 000000000000..d72a795f3832 --- /dev/null +++ b/usr.sbin/bhyvectl/bhyvectl.8 @@ -0,0 +1,97 @@ +.\" Copyright (c) 2015 Christian Brueffer +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd January 12, 2016 +.Dt BHYVECTL 8 +.Os +.Sh NAME +.Nm bhyvectl +.Nd "control utility for bhyve instances" +.Sh SYNOPSIS +.Nm +.Fl -vm= Ns Ar +.Op Fl -create +.Op Fl -destroy +.Op Fl -get-stats +.Op Fl -inject-nmi +.Op Fl -force-reset +.Op Fl -force-poweroff +.Sh DESCRIPTION +The +.Nm +command is a control utility for active +.Xr bhyve 8 +virtual machine instances. +.Pp +.Em Note : +Most +.Nm +flags are intended for querying and setting the state of an active instance. +These commands are intended for development purposes, and are not documented here. +A complete list can be obtained by executing +.Nm +without any arguments. +.Pp +The user-facing options are as follows: +.Bl -tag -width ".Fl d Ar argument" +.It Fl -vm= Ns Ar +Operate on the virtual machine +.Ar . +.It Fl -create +Create the specified VM. +.It Fl -destroy +Destroy the specified VM. +.It Fl -get-state +Retrieve statistics for the specified VM. +.It Fl -inject-nmi +Inject a non-maskable interrupt (NMI) into the VM. +.It Fl -force-reset +Force the VM to reset. +.It Fl -force-poweroff +Force the VM to power off. +.El +.Sh EXIT STATUS +.Ex -std +.Sh EXAMPLES +Destroy the VM called fbsd10: +.Pp +.Dl "bhyvectl --vm=fbsd10 --destroy" +.Sh SEE ALSO +.Xr bhyve 8 , +.Xr bhyveload 8 +.Sh HISTORY +The +.Nm +command first appeared in +.Fx 10.1 . +.Sh AUTHORS +.An -nosplit +The +.Nm +utility was written by +.An Peter Grehan +and +.An Neel Natu . From f45757caea2a0b4542bb05777ab60f21a75243cc Mon Sep 17 00:00:00 2001 From: Christian Brueffer Date: Tue, 12 Jan 2016 10:19:56 +0000 Subject: [PATCH 23/82] Document etherswitch and drivers using this framework. MFC after: 2 weeks --- sys/conf/NOTES | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/sys/conf/NOTES b/sys/conf/NOTES index 3c64d5b502c2..7d06fe321703 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -2586,6 +2586,25 @@ device pps device lpbb device pcfclock +# +# Etherswitch framework and drivers +# +# etherswitch The etherswitch(4) framework +# miiproxy Proxy device for miibus(4) functionality +# +# Switch hardware support: +# arswitch Atheros switches +# ip17x IC+ 17x family switches +# rtl8366r Realtek RTL8366 switches +# ukswitch Multi-PHY switches +# +device etherswitch +device miiproxy +device arswitch +device ip17x +device rtl8366rb +device ukswitch + # Kernel BOOTP support options BOOTP # Use BOOTP to obtain IP address/hostname From e7119ad9ae3df4760e9bc0fac8f8066de65f718e Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Tue, 12 Jan 2016 13:26:04 +0000 Subject: [PATCH 24/82] sfxge: change hunt specific fields of efx_nic_t to ef10 All these fields will be used in shared ef10 code, so put them in an ef10 member of a per-architecture union, rather that in the per-chip union. Submitted by: Mark Spender Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D4865 --- sys/dev/sfxge/common/ef10_impl.h | 7 +++ sys/dev/sfxge/common/efx_impl.h | 41 +++++++------ sys/dev/sfxge/common/hunt_nic.c | 95 +++++++++++++++-------------- sys/dev/sfxge/common/hunt_vpd.c | 40 ++++++------ sys/dev/sfxge/common/medford_impl.h | 2 +- 5 files changed, 98 insertions(+), 87 deletions(-) diff --git a/sys/dev/sfxge/common/ef10_impl.h b/sys/dev/sfxge/common/ef10_impl.h index d35de82c99b9..9b9f0aaf4b55 100644 --- a/sys/dev/sfxge/common/ef10_impl.h +++ b/sys/dev/sfxge/common/ef10_impl.h @@ -37,6 +37,13 @@ extern "C" { #endif +#if (EFSYS_OPT_HUNTINGTON && EFSYS_OPT_MEDFORD) +#define EF10_MAX_PIOBUF_NBUFS MAX(HUNT_PIOBUF_NBUFS, MEDFORD_PIOBUF_NBUFS) +#elif EFSYS_OPT_HUNTINGTON +#define EF10_MAX_PIOBUF_NBUFS HUNT_PIOBUF_NBUFS +#elif EFSYS_OPT_MEDFORD +#define EF10_MAX_PIOBUF_NBUFS MEDFORD_PIOBUF_NBUFS +#endif diff --git a/sys/dev/sfxge/common/efx_impl.h b/sys/dev/sfxge/common/efx_impl.h index b1a918bdb731..a78e28b708c0 100644 --- a/sys/dev/sfxge/common/efx_impl.h +++ b/sys/dev/sfxge/common/efx_impl.h @@ -672,26 +672,29 @@ struct efx_nic_s { int enu_unused; } siena; #endif /* EFSYS_OPT_SIENA */ -#if EFSYS_OPT_HUNTINGTON - struct { - int enu_vi_base; - int enu_vi_count; -#if EFSYS_OPT_VPD - caddr_t enu_svpd; - size_t enu_svpd_length; -#endif /* EFSYS_OPT_VPD */ - efx_piobuf_handle_t enu_piobuf_handle[HUNT_PIOBUF_NBUFS]; - uint32_t enu_piobuf_count; - uint32_t enu_pio_alloc_map[HUNT_PIOBUF_NBUFS]; - uint32_t enu_pio_write_vi_base; - /* Memory BAR mapping regions */ - uint32_t enu_uc_mem_map_offset; - size_t enu_uc_mem_map_size; - uint32_t enu_wc_mem_map_offset; - size_t enu_wc_mem_map_size; - } hunt; -#endif /* EFSYS_OPT_HUNTINGTON */ + int enu_unused; } en_u; +#if (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) + union en_arch { + struct { + int ena_vi_base; + int ena_vi_count; +#if EFSYS_OPT_VPD + caddr_t ena_svpd; + size_t ena_svpd_length; +#endif /* EFSYS_OPT_VPD */ + efx_piobuf_handle_t ena_piobuf_handle[EF10_MAX_PIOBUF_NBUFS]; + uint32_t ena_piobuf_count; + uint32_t ena_pio_alloc_map[EF10_MAX_PIOBUF_NBUFS]; + uint32_t ena_pio_write_vi_base; + /* Memory BAR mapping regions */ + uint32_t ena_uc_mem_map_offset; + size_t ena_uc_mem_map_size; + uint32_t ena_wc_mem_map_offset; + size_t ena_wc_mem_map_size; + } ef10; + } en_arch; +#endif /* (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) */ }; diff --git a/sys/dev/sfxge/common/hunt_nic.c b/sys/dev/sfxge/common/hunt_nic.c index 2869ad5dff7d..ba52d76a3327 100644 --- a/sys/dev/sfxge/common/hunt_nic.c +++ b/sys/dev/sfxge/common/hunt_nic.c @@ -715,30 +715,30 @@ hunt_nic_alloc_piobufs( efx_rc_t rc; EFSYS_ASSERT3U(max_piobuf_count, <=, - EFX_ARRAY_SIZE(enp->en_u.hunt.enu_piobuf_handle)); + EFX_ARRAY_SIZE(enp->en_arch.ef10.ena_piobuf_handle)); - enp->en_u.hunt.enu_piobuf_count = 0; + enp->en_arch.ef10.ena_piobuf_count = 0; for (i = 0; i < max_piobuf_count; i++) { - handlep = &enp->en_u.hunt.enu_piobuf_handle[i]; + handlep = &enp->en_arch.ef10.ena_piobuf_handle[i]; if ((rc = efx_mcdi_alloc_piobuf(enp, handlep)) != 0) goto fail1; - enp->en_u.hunt.enu_pio_alloc_map[i] = 0; - enp->en_u.hunt.enu_piobuf_count++; + enp->en_arch.ef10.ena_pio_alloc_map[i] = 0; + enp->en_arch.ef10.ena_piobuf_count++; } return; fail1: - for (i = 0; i < enp->en_u.hunt.enu_piobuf_count; i++) { - handlep = &enp->en_u.hunt.enu_piobuf_handle[i]; + for (i = 0; i < enp->en_arch.ef10.ena_piobuf_count; i++) { + handlep = &enp->en_arch.ef10.ena_piobuf_handle[i]; efx_mcdi_free_piobuf(enp, *handlep); *handlep = EFX_PIOBUF_HANDLE_INVALID; } - enp->en_u.hunt.enu_piobuf_count = 0; + enp->en_arch.ef10.ena_piobuf_count = 0; } @@ -749,13 +749,13 @@ hunt_nic_free_piobufs( efx_piobuf_handle_t *handlep; unsigned int i; - for (i = 0; i < enp->en_u.hunt.enu_piobuf_count; i++) { - handlep = &enp->en_u.hunt.enu_piobuf_handle[i]; + for (i = 0; i < enp->en_arch.ef10.ena_piobuf_count; i++) { + handlep = &enp->en_arch.ef10.ena_piobuf_handle[i]; efx_mcdi_free_piobuf(enp, *handlep); *handlep = EFX_PIOBUF_HANDLE_INVALID; } - enp->en_u.hunt.enu_piobuf_count = 0; + enp->en_arch.ef10.ena_piobuf_count = 0; } /* Sub-allocate a block from a piobuf */ @@ -781,14 +781,14 @@ hunt_nic_pio_alloc( EFSYS_ASSERT(sizep); if ((edcp->edc_pio_alloc_size == 0) || - (enp->en_u.hunt.enu_piobuf_count == 0)) { + (enp->en_arch.ef10.ena_piobuf_count == 0)) { rc = ENOMEM; goto fail1; } blk_per_buf = HUNT_PIOBUF_SIZE / edcp->edc_pio_alloc_size; - for (buf = 0; buf < enp->en_u.hunt.enu_piobuf_count; buf++) { - uint32_t *map = &enp->en_u.hunt.enu_pio_alloc_map[buf]; + for (buf = 0; buf < enp->en_arch.ef10.ena_piobuf_count; buf++) { + uint32_t *map = &enp->en_arch.ef10.ena_pio_alloc_map[buf]; if (~(*map) == 0) continue; @@ -805,7 +805,7 @@ hunt_nic_pio_alloc( goto fail2; done: - *handlep = enp->en_u.hunt.enu_piobuf_handle[buf]; + *handlep = enp->en_arch.ef10.ena_piobuf_handle[buf]; *bufnump = buf; *blknump = blk; *sizep = edcp->edc_pio_alloc_size; @@ -831,13 +831,13 @@ hunt_nic_pio_free( uint32_t *map; efx_rc_t rc; - if ((bufnum >= enp->en_u.hunt.enu_piobuf_count) || + if ((bufnum >= enp->en_arch.ef10.ena_piobuf_count) || (blknum >= (8 * sizeof (*map)))) { rc = EINVAL; goto fail1; } - map = &enp->en_u.hunt.enu_pio_alloc_map[bufnum]; + map = &enp->en_arch.ef10.ena_pio_alloc_map[bufnum]; if ((*map & (1u << blknum)) == 0) { rc = ENOENT; goto fail2; @@ -1579,7 +1579,8 @@ hunt_nic_init( * each VI that is using a sub-allocated block from the piobuf. */ min_vi_count = edcp->edc_min_vi_count; - max_vi_count = edcp->edc_max_vi_count + enp->en_u.hunt.enu_piobuf_count; + max_vi_count = + edcp->edc_max_vi_count + enp->en_arch.ef10.ena_piobuf_count; /* Ensure that the previously attached driver's VIs are freed */ if ((rc = efx_mcdi_free_vis(enp)) != 0) @@ -1601,44 +1602,44 @@ hunt_nic_init( goto fail4; } - enp->en_u.hunt.enu_vi_base = vi_base; - enp->en_u.hunt.enu_vi_count = vi_count; + enp->en_arch.ef10.ena_vi_base = vi_base; + enp->en_arch.ef10.ena_vi_count = vi_count; - if (vi_count < min_vi_count + enp->en_u.hunt.enu_piobuf_count) { + if (vi_count < min_vi_count + enp->en_arch.ef10.ena_piobuf_count) { /* Not enough extra VIs to map piobufs */ hunt_nic_free_piobufs(enp); } - enp->en_u.hunt.enu_pio_write_vi_base = - vi_count - enp->en_u.hunt.enu_piobuf_count; + enp->en_arch.ef10.ena_pio_write_vi_base = + vi_count - enp->en_arch.ef10.ena_piobuf_count; /* Save UC memory mapping details */ - enp->en_u.hunt.enu_uc_mem_map_offset = 0; - if (enp->en_u.hunt.enu_piobuf_count > 0) { - enp->en_u.hunt.enu_uc_mem_map_size = + enp->en_arch.ef10.ena_uc_mem_map_offset = 0; + if (enp->en_arch.ef10.ena_piobuf_count > 0) { + enp->en_arch.ef10.ena_uc_mem_map_size = (ER_DZ_TX_PIOBUF_STEP * - enp->en_u.hunt.enu_pio_write_vi_base); + enp->en_arch.ef10.ena_pio_write_vi_base); } else { - enp->en_u.hunt.enu_uc_mem_map_size = + enp->en_arch.ef10.ena_uc_mem_map_size = (ER_DZ_TX_PIOBUF_STEP * - enp->en_u.hunt.enu_vi_count); + enp->en_arch.ef10.ena_vi_count); } /* Save WC memory mapping details */ - enp->en_u.hunt.enu_wc_mem_map_offset = - enp->en_u.hunt.enu_uc_mem_map_offset + - enp->en_u.hunt.enu_uc_mem_map_size; + enp->en_arch.ef10.ena_wc_mem_map_offset = + enp->en_arch.ef10.ena_uc_mem_map_offset + + enp->en_arch.ef10.ena_uc_mem_map_size; - enp->en_u.hunt.enu_wc_mem_map_size = + enp->en_arch.ef10.ena_wc_mem_map_size = (ER_DZ_TX_PIOBUF_STEP * - enp->en_u.hunt.enu_piobuf_count); + enp->en_arch.ef10.ena_piobuf_count); /* Link piobufs to extra VIs in WC mapping */ - if (enp->en_u.hunt.enu_piobuf_count > 0) { - for (i = 0; i < enp->en_u.hunt.enu_piobuf_count; i++) { + if (enp->en_arch.ef10.ena_piobuf_count > 0) { + for (i = 0; i < enp->en_arch.ef10.ena_piobuf_count; i++) { rc = efx_mcdi_link_piobuf(enp, - enp->en_u.hunt.enu_pio_write_vi_base + i, - enp->en_u.hunt.enu_piobuf_handle[i]); + enp->en_arch.ef10.ena_pio_write_vi_base + i, + enp->en_arch.ef10.ena_piobuf_handle[i]); if (rc != 0) break; } @@ -1715,7 +1716,7 @@ hunt_nic_get_vi_pool( * Report VIs that the client driver can use. * Do not include VIs used for PIO buffer writes. */ - *vi_countp = enp->en_u.hunt.enu_pio_write_vi_base; + *vi_countp = enp->en_arch.ef10.ena_pio_write_vi_base; return (0); } @@ -1739,14 +1740,14 @@ hunt_nic_get_bar_region( switch (region) { case EFX_REGION_VI: /* UC mapped memory BAR region for VI registers */ - *offsetp = enp->en_u.hunt.enu_uc_mem_map_offset; - *sizep = enp->en_u.hunt.enu_uc_mem_map_size; + *offsetp = enp->en_arch.ef10.ena_uc_mem_map_offset; + *sizep = enp->en_arch.ef10.ena_uc_mem_map_size; break; case EFX_REGION_PIO_WRITE_VI: /* WC mapped memory BAR region for piobuf writes */ - *offsetp = enp->en_u.hunt.enu_wc_mem_map_offset; - *sizep = enp->en_u.hunt.enu_wc_mem_map_size; + *offsetp = enp->en_arch.ef10.ena_wc_mem_map_offset; + *sizep = enp->en_arch.ef10.ena_wc_mem_map_size; break; default: @@ -1773,10 +1774,10 @@ hunt_nic_fini( enp->en_vport_id = 0; /* Unlink piobufs from extra VIs in WC mapping */ - if (enp->en_u.hunt.enu_piobuf_count > 0) { - for (i = 0; i < enp->en_u.hunt.enu_piobuf_count; i++) { + if (enp->en_arch.ef10.ena_piobuf_count > 0) { + for (i = 0; i < enp->en_arch.ef10.ena_piobuf_count; i++) { rc = efx_mcdi_unlink_piobuf(enp, - enp->en_u.hunt.enu_pio_write_vi_base + i); + enp->en_arch.ef10.ena_pio_write_vi_base + i); if (rc != 0) break; } @@ -1785,7 +1786,7 @@ hunt_nic_fini( hunt_nic_free_piobufs(enp); (void) efx_mcdi_free_vis(enp); - enp->en_u.hunt.enu_vi_count = 0; + enp->en_arch.ef10.ena_vi_count = 0; } void diff --git a/sys/dev/sfxge/common/hunt_vpd.c b/sys/dev/sfxge/common/hunt_vpd.c index 129167c052d8..c11f4524ef5c 100644 --- a/sys/dev/sfxge/common/hunt_vpd.c +++ b/sys/dev/sfxge/common/hunt_vpd.c @@ -81,8 +81,8 @@ hunt_vpd_init( goto fail2; } - enp->en_u.hunt.enu_svpd = svpd; - enp->en_u.hunt.enu_svpd_length = svpd_size; + enp->en_arch.ef10.ena_svpd = svpd; + enp->en_arch.ef10.ena_svpd_length = svpd_size; out: return (0); @@ -197,7 +197,7 @@ hunt_vpd_verify( * Verify that there is no duplication between the static and * dynamic cfg sectors. */ - if (enp->en_u.hunt.enu_svpd_length == 0) + if (enp->en_arch.ef10.ena_svpd_length == 0) goto done; dcont = 0; @@ -213,8 +213,8 @@ hunt_vpd_verify( _NOTE(CONSTANTCONDITION) while (1) { if ((rc = efx_vpd_hunk_next( - enp->en_u.hunt.enu_svpd, - enp->en_u.hunt.enu_svpd_length, &stag, &skey, + enp->en_arch.ef10.ena_svpd, + enp->en_arch.ef10.ena_svpd_length, &stag, &skey, NULL, NULL, &scont)) != 0) goto fail3; if (scont == 0) @@ -254,14 +254,14 @@ hunt_vpd_reinit( /* * Only create an ID string if the dynamic cfg doesn't have one */ - if (enp->en_u.hunt.enu_svpd_length == 0) + if (enp->en_arch.ef10.ena_svpd_length == 0) wantpid = B_TRUE; else { unsigned int offset; uint8_t length; - rc = efx_vpd_hunk_get(enp->en_u.hunt.enu_svpd, - enp->en_u.hunt.enu_svpd_length, + rc = efx_vpd_hunk_get(enp->en_arch.ef10.ena_svpd, + enp->en_arch.ef10.ena_svpd_length, EFX_VPD_ID, 0, &offset, &length); if (rc == 0) wantpid = B_FALSE; @@ -298,13 +298,13 @@ hunt_vpd_get( EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON); /* Attempt to satisfy the request from svpd first */ - if (enp->en_u.hunt.enu_svpd_length > 0) { - if ((rc = efx_vpd_hunk_get(enp->en_u.hunt.enu_svpd, - enp->en_u.hunt.enu_svpd_length, evvp->evv_tag, + if (enp->en_arch.ef10.ena_svpd_length > 0) { + if ((rc = efx_vpd_hunk_get(enp->en_arch.ef10.ena_svpd, + enp->en_arch.ef10.ena_svpd_length, evvp->evv_tag, evvp->evv_keyword, &offset, &length)) == 0) { evvp->evv_length = length; memcpy(evvp->evv_value, - enp->en_u.hunt.enu_svpd + offset, length); + enp->en_arch.ef10.ena_svpd + offset, length); return (0); } else if (rc != ENOENT) goto fail1; @@ -340,12 +340,12 @@ hunt_vpd_set( EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON); /* If the provided (tag,keyword) exists in svpd, then it is readonly */ - if (enp->en_u.hunt.enu_svpd_length > 0) { + if (enp->en_arch.ef10.ena_svpd_length > 0) { unsigned int offset; uint8_t length; - if ((rc = efx_vpd_hunk_get(enp->en_u.hunt.enu_svpd, - enp->en_u.hunt.enu_svpd_length, evvp->evv_tag, + if ((rc = efx_vpd_hunk_get(enp->en_arch.ef10.ena_svpd, + enp->en_arch.ef10.ena_svpd_length, evvp->evv_tag, evvp->evv_keyword, &offset, &length)) == 0) { rc = EACCES; goto fail1; @@ -421,12 +421,12 @@ hunt_vpd_fini( { EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON); - if (enp->en_u.hunt.enu_svpd_length > 0) { - EFSYS_KMEM_FREE(enp->en_esip, enp->en_u.hunt.enu_svpd_length, - enp->en_u.hunt.enu_svpd); + if (enp->en_arch.ef10.ena_svpd_length > 0) { + EFSYS_KMEM_FREE(enp->en_esip, enp->en_arch.ef10.ena_svpd_length, + enp->en_arch.ef10.ena_svpd); - enp->en_u.hunt.enu_svpd = NULL; - enp->en_u.hunt.enu_svpd_length = 0; + enp->en_arch.ef10.ena_svpd = NULL; + enp->en_arch.ef10.ena_svpd_length = 0; } } diff --git a/sys/dev/sfxge/common/medford_impl.h b/sys/dev/sfxge/common/medford_impl.h index 39f908eff114..11084dc00f68 100644 --- a/sys/dev/sfxge/common/medford_impl.h +++ b/sys/dev/sfxge/common/medford_impl.h @@ -37,7 +37,7 @@ extern "C" { #endif - +#define MEDFORD_PIOBUF_NBUFS (16) #ifdef __cplusplus From b026a4006f9fd0ae15bb446d9daf6ee62ad43989 Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Tue, 12 Jan 2016 13:27:46 +0000 Subject: [PATCH 25/82] sfxge: use NIC config in place of some Huntington specific PIO constants This should allow these functions to work for Medford as well. Submitted by: Mark Spender Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D4866 --- sys/dev/sfxge/common/efx.h | 1 + sys/dev/sfxge/common/hunt_nic.c | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/dev/sfxge/common/efx.h b/sys/dev/sfxge/common/efx.h index 96fe401a1df1..d6e55acc79ce 100644 --- a/sys/dev/sfxge/common/efx.h +++ b/sys/dev/sfxge/common/efx.h @@ -1128,6 +1128,7 @@ typedef struct efx_nic_cfg_s { uint32_t enc_buftbl_limit; uint32_t enc_piobuf_limit; uint32_t enc_piobuf_size; + uint32_t enc_piobuf_min_alloc_size; uint32_t enc_evq_timer_quantum_ns; uint32_t enc_evq_timer_max_us; uint32_t enc_clk_mult; diff --git a/sys/dev/sfxge/common/hunt_nic.c b/sys/dev/sfxge/common/hunt_nic.c index ba52d76a3327..3f86032918c1 100644 --- a/sys/dev/sfxge/common/hunt_nic.c +++ b/sys/dev/sfxge/common/hunt_nic.c @@ -768,6 +768,7 @@ hunt_nic_pio_alloc( __out uint32_t *offsetp, __out size_t *sizep) { + efx_nic_cfg_t *encp = &enp->en_nic_cfg; efx_drv_cfg_t *edcp = &enp->en_drv_cfg; uint32_t blk_per_buf; uint32_t buf, blk; @@ -785,7 +786,7 @@ hunt_nic_pio_alloc( rc = ENOMEM; goto fail1; } - blk_per_buf = HUNT_PIOBUF_SIZE / edcp->edc_pio_alloc_size; + blk_per_buf = encp->enc_piobuf_size / edcp->edc_pio_alloc_size; for (buf = 0; buf < enp->en_arch.ef10.ena_piobuf_count; buf++) { uint32_t *map = &enp->en_arch.ef10.ena_pio_alloc_map[buf]; @@ -1260,6 +1261,7 @@ hunt_board_cfg( encp->enc_piobuf_limit = HUNT_PIOBUF_NBUFS; encp->enc_piobuf_size = HUNT_PIOBUF_SIZE; + encp->enc_piobuf_min_alloc_size = HUNT_MIN_PIO_ALLOC_SIZE; /* * Get the current privilege mask. Note that this may be modified @@ -1470,7 +1472,8 @@ hunt_nic_set_drv_limits( uint32_t blk_size, blk_count, blks_per_piobuf; blk_size = - MAX(edlp->edl_min_pio_alloc_size, HUNT_MIN_PIO_ALLOC_SIZE); + MAX(edlp->edl_min_pio_alloc_size, + encp->enc_piobuf_min_alloc_size); blks_per_piobuf = encp->enc_piobuf_size / blk_size; EFSYS_ASSERT3U(blks_per_piobuf, <=, 32); From 3c5bf8f1c276174a7f80b2fd5a94473389663402 Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Tue, 12 Jan 2016 13:29:05 +0000 Subject: [PATCH 26/82] sfxge: update SRAM methods to be no-ops on Medford as well Submitted by: Mark Spender Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D4867 --- sys/dev/sfxge/common/efx_nic.c | 2 +- sys/dev/sfxge/common/efx_sram.c | 18 ++++++++++-------- sys/dev/sfxge/common/hunt_impl.h | 2 +- sys/dev/sfxge/common/hunt_sram.c | 2 +- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/sys/dev/sfxge/common/efx_nic.c b/sys/dev/sfxge/common/efx_nic.c index f1742e6e9ed5..f5f7aea1f4c9 100644 --- a/sys/dev/sfxge/common/efx_nic.c +++ b/sys/dev/sfxge/common/efx_nic.c @@ -291,7 +291,7 @@ static efx_nic_ops_t __efx_nic_hunt_ops = { hunt_nic_get_vi_pool, /* eno_get_vi_pool */ hunt_nic_get_bar_region, /* eno_get_bar_region */ #if EFSYS_OPT_DIAG - hunt_sram_test, /* eno_sram_test */ + ef10_sram_test, /* eno_sram_test */ hunt_nic_register_test, /* eno_register_test */ #endif /* EFSYS_OPT_DIAG */ hunt_nic_fini, /* eno_fini */ diff --git a/sys/dev/sfxge/common/efx_sram.c b/sys/dev/sfxge/common/efx_sram.c index 862447861467..c400ca0157dc 100644 --- a/sys/dev/sfxge/common/efx_sram.c +++ b/sys/dev/sfxge/common/efx_sram.c @@ -55,20 +55,21 @@ efx_sram_buf_tbl_set( EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_NIC); -#if EFSYS_OPT_HUNTINGTON - if (enp->en_family == EFX_FAMILY_HUNTINGTON) { +#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD + if (enp->en_family == EFX_FAMILY_HUNTINGTON || + enp->en_family == EFX_FAMILY_MEDFORD) { /* * FIXME: the efx_sram_buf_tbl_*() functionality needs to be * pulled inside the Falcon/Siena queue create/destroy code, * and then the original functions can be removed (see bug30834 * comment #1). But, for now, we just ensure that they are - * no-ops for Huntington, to allow bringing up existing drivers + * no-ops for EF10, to allow bringing up existing drivers * without modification. */ return (0); } -#endif /* EFSYS_OPT_HUNTINGTON */ +#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */ if (stop >= EFX_BUF_TBL_SIZE) { rc = EFBIG; @@ -176,20 +177,21 @@ efx_sram_buf_tbl_clear( EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_NIC); -#if EFSYS_OPT_HUNTINGTON - if (enp->en_family == EFX_FAMILY_HUNTINGTON) { +#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD + if (enp->en_family == EFX_FAMILY_HUNTINGTON || + enp->en_family == EFX_FAMILY_MEDFORD) { /* * FIXME: the efx_sram_buf_tbl_*() functionality needs to be * pulled inside the Falcon/Siena queue create/destroy code, * and then the original functions can be removed (see bug30834 * comment #1). But, for now, we just ensure that they are - * no-ops for Huntington, to allow bringing up existing drivers + * no-ops for EF10, to allow bringing up existing drivers * without modification. */ return; } -#endif /* EFSYS_OPT_HUNTINGTON */ +#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */ EFSYS_ASSERT3U(stop, <, EFX_BUF_TBL_SIZE); diff --git a/sys/dev/sfxge/common/hunt_impl.h b/sys/dev/sfxge/common/hunt_impl.h index 49a124426429..543abba1e7a0 100644 --- a/sys/dev/sfxge/common/hunt_impl.h +++ b/sys/dev/sfxge/common/hunt_impl.h @@ -562,7 +562,7 @@ hunt_bist_stop( #if EFSYS_OPT_DIAG extern __checkReturn efx_rc_t -hunt_sram_test( +ef10_sram_test( __in efx_nic_t *enp, __in efx_sram_pattern_fn_t func); diff --git a/sys/dev/sfxge/common/hunt_sram.c b/sys/dev/sfxge/common/hunt_sram.c index 9eb14805a72b..6b4b3be4a79d 100644 --- a/sys/dev/sfxge/common/hunt_sram.c +++ b/sys/dev/sfxge/common/hunt_sram.c @@ -41,7 +41,7 @@ __FBSDID("$FreeBSD$"); #if EFSYS_OPT_DIAG __checkReturn efx_rc_t -hunt_sram_test( +ef10_sram_test( __in efx_nic_t *enp, __in efx_sram_pattern_fn_t func) { From 15f20ea67d37407912584c7e18d02e03452455e5 Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Tue, 12 Jan 2016 13:30:42 +0000 Subject: [PATCH 27/82] sfxge: rename hunt interrupt methods to ef10 and use on Medford All of these apply to both Huntington and Medford. Submitted by: Mark Spender Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D4868 --- sys/dev/sfxge/common/efx_intr.c | 27 ++++++++++++++++----------- sys/dev/sfxge/common/hunt_impl.h | 12 ++++++------ sys/dev/sfxge/common/hunt_intr.c | 20 ++++++++++++-------- 3 files changed, 34 insertions(+), 25 deletions(-) diff --git a/sys/dev/sfxge/common/efx_intr.c b/sys/dev/sfxge/common/efx_intr.c index 48ec3cbba253..b0eebe877d25 100644 --- a/sys/dev/sfxge/common/efx_intr.c +++ b/sys/dev/sfxge/common/efx_intr.c @@ -101,17 +101,16 @@ static efx_intr_ops_t __efx_intr_siena_ops = { }; #endif /* EFSYS_OPT_SIENA */ -#if EFSYS_OPT_HUNTINGTON -static efx_intr_ops_t __efx_intr_hunt_ops = { - hunt_intr_init, /* eio_init */ - hunt_intr_enable, /* eio_enable */ - hunt_intr_disable, /* eio_disable */ - hunt_intr_disable_unlocked, /* eio_disable_unlocked */ - hunt_intr_trigger, /* eio_trigger */ - hunt_intr_fini, /* eio_fini */ +#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD +static efx_intr_ops_t __efx_intr_ef10_ops = { + ef10_intr_init, /* eio_init */ + ef10_intr_enable, /* eio_enable */ + ef10_intr_disable, /* eio_disable */ + ef10_intr_disable_unlocked, /* eio_disable_unlocked */ + ef10_intr_trigger, /* eio_trigger */ + ef10_intr_fini, /* eio_fini */ }; -#endif /* EFSYS_OPT_HUNTINGTON */ - +#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */ __checkReturn efx_rc_t efx_intr_init( @@ -152,10 +151,16 @@ efx_intr_init( #if EFSYS_OPT_HUNTINGTON case EFX_FAMILY_HUNTINGTON: - eiop = (efx_intr_ops_t *)&__efx_intr_hunt_ops; + eiop = (efx_intr_ops_t *)&__efx_intr_ef10_ops; break; #endif /* EFSYS_OPT_HUNTINGTON */ +#if EFSYS_OPT_MEDFORD + case EFX_FAMILY_MEDFORD: + eiop = (efx_intr_ops_t *)&__efx_intr_ef10_ops; + break; +#endif /* EFSYS_OPT_MEDFORD */ + default: EFSYS_ASSERT(B_FALSE); rc = ENOTSUP; diff --git a/sys/dev/sfxge/common/hunt_impl.h b/sys/dev/sfxge/common/hunt_impl.h index 543abba1e7a0..2f819874b36d 100644 --- a/sys/dev/sfxge/common/hunt_impl.h +++ b/sys/dev/sfxge/common/hunt_impl.h @@ -112,30 +112,30 @@ hunt_ev_rxlabel_fini( /* INTR */ __checkReturn efx_rc_t -hunt_intr_init( +ef10_intr_init( __in efx_nic_t *enp, __in efx_intr_type_t type, __in efsys_mem_t *esmp); void -hunt_intr_enable( +ef10_intr_enable( __in efx_nic_t *enp); void -hunt_intr_disable( +ef10_intr_disable( __in efx_nic_t *enp); void -hunt_intr_disable_unlocked( +ef10_intr_disable_unlocked( __in efx_nic_t *enp); __checkReturn efx_rc_t -hunt_intr_trigger( +ef10_intr_trigger( __in efx_nic_t *enp, __in unsigned int level); void -hunt_intr_fini( +ef10_intr_fini( __in efx_nic_t *enp); /* NIC */ diff --git a/sys/dev/sfxge/common/hunt_intr.c b/sys/dev/sfxge/common/hunt_intr.c index d5e977ad7ee3..2033398f9ba7 100644 --- a/sys/dev/sfxge/common/hunt_intr.c +++ b/sys/dev/sfxge/common/hunt_intr.c @@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$"); #if EFSYS_OPT_HUNTINGTON __checkReturn efx_rc_t -hunt_intr_init( +ef10_intr_init( __in efx_nic_t *enp, __in efx_intr_type_t type, __in efsys_mem_t *esmp) @@ -50,7 +50,7 @@ hunt_intr_init( void -hunt_intr_enable( +ef10_intr_enable( __in efx_nic_t *enp) { _NOTE(ARGUNUSED(enp)) @@ -58,7 +58,7 @@ hunt_intr_enable( void -hunt_intr_disable( +ef10_intr_disable( __in efx_nic_t *enp) { _NOTE(ARGUNUSED(enp)) @@ -66,7 +66,7 @@ hunt_intr_disable( void -hunt_intr_disable_unlocked( +ef10_intr_disable_unlocked( __in efx_nic_t *enp) { _NOTE(ARGUNUSED(enp)) @@ -83,7 +83,8 @@ efx_mcdi_trigger_interrupt( MC_CMD_TRIGGER_INTERRUPT_OUT_LEN)]; efx_rc_t rc; - EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON); + EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON || + enp->en_family == EFX_FAMILY_MEDFORD); if (level >= enp->en_nic_cfg.enc_intr_limit) { rc = EINVAL; @@ -118,7 +119,7 @@ efx_mcdi_trigger_interrupt( } __checkReturn efx_rc_t -hunt_intr_trigger( +ef10_intr_trigger( __in efx_nic_t *enp, __in unsigned int level) { @@ -126,7 +127,10 @@ hunt_intr_trigger( efx_rc_t rc; if (encp->enc_bug41750_workaround) { - /* bug 41750: Test interrupts don't work on Greenport */ + /* + * bug 41750: Test interrupts don't work on Greenport + * bug 50084: Test interrupts don't work on VFs + */ rc = ENOTSUP; goto fail1; } @@ -146,7 +150,7 @@ hunt_intr_trigger( void -hunt_intr_fini( +ef10_intr_fini( __in efx_nic_t *enp) { _NOTE(ARGUNUSED(enp)) From ad8a32cb5d5090a9efd8256adefa490bf213b5c5 Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Tue, 12 Jan 2016 13:32:04 +0000 Subject: [PATCH 28/82] sfxge: rename hunt ev methods to ef10 and use for Medford Submitted by: Mark Spender Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D4869 --- sys/dev/sfxge/common/efx_ev.c | 30 ++++++++++------- sys/dev/sfxge/common/hunt_ev.c | 57 +++++++++++++++----------------- sys/dev/sfxge/common/hunt_impl.h | 20 +++++------ sys/dev/sfxge/common/hunt_rx.c | 4 +-- 4 files changed, 57 insertions(+), 54 deletions(-) diff --git a/sys/dev/sfxge/common/efx_ev.c b/sys/dev/sfxge/common/efx_ev.c index ffbe8dce31f7..d0f549742f3e 100644 --- a/sys/dev/sfxge/common/efx_ev.c +++ b/sys/dev/sfxge/common/efx_ev.c @@ -139,20 +139,20 @@ static efx_ev_ops_t __efx_ev_siena_ops = { }; #endif /* EFSYS_OPT_SIENA */ -#if EFSYS_OPT_HUNTINGTON -static efx_ev_ops_t __efx_ev_hunt_ops = { - hunt_ev_init, /* eevo_init */ - hunt_ev_fini, /* eevo_fini */ - hunt_ev_qcreate, /* eevo_qcreate */ - hunt_ev_qdestroy, /* eevo_qdestroy */ - hunt_ev_qprime, /* eevo_qprime */ - hunt_ev_qpost, /* eevo_qpost */ - hunt_ev_qmoderate, /* eevo_qmoderate */ +#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD +static efx_ev_ops_t __efx_ev_ef10_ops = { + ef10_ev_init, /* eevo_init */ + ef10_ev_fini, /* eevo_fini */ + ef10_ev_qcreate, /* eevo_qcreate */ + ef10_ev_qdestroy, /* eevo_qdestroy */ + ef10_ev_qprime, /* eevo_qprime */ + ef10_ev_qpost, /* eevo_qpost */ + ef10_ev_qmoderate, /* eevo_qmoderate */ #if EFSYS_OPT_QSTATS - hunt_ev_qstats_update, /* eevo_qstats_update */ + ef10_ev_qstats_update, /* eevo_qstats_update */ #endif }; -#endif /* EFSYS_OPT_HUNTINGTON */ +#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */ __checkReturn efx_rc_t @@ -185,10 +185,16 @@ efx_ev_init( #if EFSYS_OPT_HUNTINGTON case EFX_FAMILY_HUNTINGTON: - eevop = (efx_ev_ops_t *)&__efx_ev_hunt_ops; + eevop = (efx_ev_ops_t *)&__efx_ev_ef10_ops; break; #endif /* EFSYS_OPT_HUNTINGTON */ +#if EFSYS_OPT_MEDFORD + case EFX_FAMILY_MEDFORD: + eevop = (efx_ev_ops_t *)&__efx_ev_ef10_ops; + break; +#endif /* EFSYS_OPT_MEDFORD */ + default: EFSYS_ASSERT(0); rc = ENOTSUP; diff --git a/sys/dev/sfxge/common/hunt_ev.c b/sys/dev/sfxge/common/hunt_ev.c index 5e6ccabd9a9c..c0a5b4f448e5 100644 --- a/sys/dev/sfxge/common/hunt_ev.c +++ b/sys/dev/sfxge/common/hunt_ev.c @@ -54,35 +54,35 @@ __FBSDID("$FreeBSD$"); static __checkReturn boolean_t -hunt_ev_rx( +ef10_ev_rx( __in efx_evq_t *eep, __in efx_qword_t *eqp, __in const efx_ev_callbacks_t *eecp, __in_opt void *arg); static __checkReturn boolean_t -hunt_ev_tx( +ef10_ev_tx( __in efx_evq_t *eep, __in efx_qword_t *eqp, __in const efx_ev_callbacks_t *eecp, __in_opt void *arg); static __checkReturn boolean_t -hunt_ev_driver( +ef10_ev_driver( __in efx_evq_t *eep, __in efx_qword_t *eqp, __in const efx_ev_callbacks_t *eecp, __in_opt void *arg); static __checkReturn boolean_t -hunt_ev_drv_gen( +ef10_ev_drv_gen( __in efx_evq_t *eep, __in efx_qword_t *eqp, __in const efx_ev_callbacks_t *eecp, __in_opt void *arg); static __checkReturn boolean_t -hunt_ev_mcdi( +ef10_ev_mcdi( __in efx_evq_t *eep, __in efx_qword_t *eqp, __in const efx_ev_callbacks_t *eecp, @@ -230,7 +230,7 @@ efx_mcdi_fini_evq( __checkReturn efx_rc_t -hunt_ev_init( +ef10_ev_init( __in efx_nic_t *enp) { _NOTE(ARGUNUSED(enp)) @@ -238,14 +238,14 @@ hunt_ev_init( } void -hunt_ev_fini( +ef10_ev_fini( __in efx_nic_t *enp) { _NOTE(ARGUNUSED(enp)) } __checkReturn efx_rc_t -hunt_ev_qcreate( +ef10_ev_qcreate( __in efx_nic_t *enp, __in unsigned int index, __in efsys_mem_t *esmp, @@ -272,11 +272,11 @@ hunt_ev_qcreate( } /* Set up the handler table */ - eep->ee_rx = hunt_ev_rx; - eep->ee_tx = hunt_ev_tx; - eep->ee_driver = hunt_ev_driver; - eep->ee_drv_gen = hunt_ev_drv_gen; - eep->ee_mcdi = hunt_ev_mcdi; + eep->ee_rx = ef10_ev_rx; + eep->ee_tx = ef10_ev_tx; + eep->ee_driver = ef10_ev_driver; + eep->ee_drv_gen = ef10_ev_drv_gen; + eep->ee_mcdi = ef10_ev_mcdi; /* * Set up the event queue @@ -299,18 +299,19 @@ hunt_ev_qcreate( } void -hunt_ev_qdestroy( +ef10_ev_qdestroy( __in efx_evq_t *eep) { efx_nic_t *enp = eep->ee_enp; - EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON); + EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON || + enp->en_family == EFX_FAMILY_MEDFORD); (void) efx_mcdi_fini_evq(eep->ee_enp, eep->ee_index); } __checkReturn efx_rc_t -hunt_ev_qprime( +ef10_ev_qprime( __in efx_evq_t *eep, __in unsigned int count) { @@ -390,7 +391,7 @@ efx_mcdi_driver_event( } void -hunt_ev_qpost( +ef10_ev_qpost( __in efx_evq_t *eep, __in uint16_t data) { @@ -406,7 +407,7 @@ hunt_ev_qpost( } __checkReturn efx_rc_t -hunt_ev_qmoderate( +ef10_ev_qmoderate( __in efx_evq_t *eep, __in unsigned int us) { @@ -463,14 +464,10 @@ hunt_ev_qmoderate( #if EFSYS_OPT_QSTATS void -hunt_ev_qstats_update( +ef10_ev_qstats_update( __in efx_evq_t *eep, __inout_ecount(EV_NQSTATS) efsys_stat_t *stat) { - /* - * TBD: Consider a common Siena/Huntington function. The code is - * essentially identical. - */ unsigned int id; for (id = 0; id < EV_NQSTATS; id++) { @@ -484,7 +481,7 @@ hunt_ev_qstats_update( static __checkReturn boolean_t -hunt_ev_rx( +ef10_ev_rx( __in efx_evq_t *eep, __in efx_qword_t *eqp, __in const efx_ev_callbacks_t *eecp, @@ -691,7 +688,7 @@ hunt_ev_rx( } static __checkReturn boolean_t -hunt_ev_tx( +ef10_ev_tx( __in efx_evq_t *eep, __in efx_qword_t *eqp, __in const efx_ev_callbacks_t *eecp, @@ -726,7 +723,7 @@ hunt_ev_tx( } static __checkReturn boolean_t -hunt_ev_driver( +ef10_ev_driver( __in efx_evq_t *eep, __in efx_qword_t *eqp, __in const efx_ev_callbacks_t *eecp, @@ -776,7 +773,7 @@ hunt_ev_driver( } static __checkReturn boolean_t -hunt_ev_drv_gen( +ef10_ev_drv_gen( __in efx_evq_t *eep, __in efx_qword_t *eqp, __in const efx_ev_callbacks_t *eecp, @@ -804,7 +801,7 @@ hunt_ev_drv_gen( } static __checkReturn boolean_t -hunt_ev_mcdi( +ef10_ev_mcdi( __in efx_evq_t *eep, __in efx_qword_t *eqp, __in const efx_ev_callbacks_t *eecp, @@ -1000,7 +997,7 @@ hunt_ev_mcdi( } void -hunt_ev_rxlabel_init( +ef10_ev_rxlabel_init( __in efx_evq_t *eep, __in efx_rxq_t *erp, __in unsigned int label) @@ -1017,7 +1014,7 @@ hunt_ev_rxlabel_init( } void -hunt_ev_rxlabel_fini( +ef10_ev_rxlabel_fini( __in efx_evq_t *eep, __in unsigned int label) { diff --git a/sys/dev/sfxge/common/hunt_impl.h b/sys/dev/sfxge/common/hunt_impl.h index 2f819874b36d..620f347f2ff7 100644 --- a/sys/dev/sfxge/common/hunt_impl.h +++ b/sys/dev/sfxge/common/hunt_impl.h @@ -56,15 +56,15 @@ extern "C" { /* EV */ __checkReturn efx_rc_t -hunt_ev_init( +ef10_ev_init( __in efx_nic_t *enp); void -hunt_ev_fini( +ef10_ev_fini( __in efx_nic_t *enp); __checkReturn efx_rc_t -hunt_ev_qcreate( +ef10_ev_qcreate( __in efx_nic_t *enp, __in unsigned int index, __in efsys_mem_t *esmp, @@ -73,39 +73,39 @@ hunt_ev_qcreate( __in efx_evq_t *eep); void -hunt_ev_qdestroy( +ef10_ev_qdestroy( __in efx_evq_t *eep); __checkReturn efx_rc_t -hunt_ev_qprime( +ef10_ev_qprime( __in efx_evq_t *eep, __in unsigned int count); void -hunt_ev_qpost( +ef10_ev_qpost( __in efx_evq_t *eep, __in uint16_t data); __checkReturn efx_rc_t -hunt_ev_qmoderate( +ef10_ev_qmoderate( __in efx_evq_t *eep, __in unsigned int us); #if EFSYS_OPT_QSTATS void -hunt_ev_qstats_update( +ef10_ev_qstats_update( __in efx_evq_t *eep, __inout_ecount(EV_NQSTATS) efsys_stat_t *stat); #endif /* EFSYS_OPT_QSTATS */ void -hunt_ev_rxlabel_init( +ef10_ev_rxlabel_init( __in efx_evq_t *eep, __in efx_rxq_t *erp, __in unsigned int label); void -hunt_ev_rxlabel_fini( +ef10_ev_rxlabel_fini( __in efx_evq_t *eep, __in unsigned int label); diff --git a/sys/dev/sfxge/common/hunt_rx.c b/sys/dev/sfxge/common/hunt_rx.c index 6fdc747c63f5..3af5a58dd0f1 100644 --- a/sys/dev/sfxge/common/hunt_rx.c +++ b/sys/dev/sfxge/common/hunt_rx.c @@ -727,7 +727,7 @@ hunt_rx_qcreate( erp->er_eep = eep; erp->er_label = label; - hunt_ev_rxlabel_init(eep, erp, label); + ef10_ev_rxlabel_init(eep, erp, label); return (0); @@ -749,7 +749,7 @@ hunt_rx_qdestroy( efx_evq_t *eep = erp->er_eep; unsigned int label = erp->er_label; - hunt_ev_rxlabel_fini(eep, label); + ef10_ev_rxlabel_fini(eep, label); EFSYS_ASSERT(enp->en_rx_qcount != 0); --enp->en_rx_qcount; From cc62e811f930d7b29ceb63b77c7e5fbe6bcf6cfc Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Tue, 12 Jan 2016 13:33:16 +0000 Subject: [PATCH 29/82] sfxge: rename hunt TX methods to ef10 and use for Medford Rename all except hunt_tx_qdesc_tso_create(), which creates a fw-assisted TSO v1 descriptor which isn't supported on Medford. Submitted by: Mark Spender Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D4870 --- sys/dev/sfxge/common/efx_tx.c | 65 +++++++++++++++++++++++--------- sys/dev/sfxge/common/hunt_impl.h | 34 ++++++++--------- sys/dev/sfxge/common/hunt_tx.c | 41 +++++++++----------- 3 files changed, 83 insertions(+), 57 deletions(-) diff --git a/sys/dev/sfxge/common/efx_tx.c b/sys/dev/sfxge/common/efx_tx.c index 9cf31bc0abb7..bcd92c99d735 100644 --- a/sys/dev/sfxge/common/efx_tx.c +++ b/sys/dev/sfxge/common/efx_tx.c @@ -179,29 +179,54 @@ static efx_tx_ops_t __efx_tx_siena_ops = { #if EFSYS_OPT_HUNTINGTON static efx_tx_ops_t __efx_tx_hunt_ops = { - hunt_tx_init, /* etxo_init */ - hunt_tx_fini, /* etxo_fini */ - hunt_tx_qcreate, /* etxo_qcreate */ - hunt_tx_qdestroy, /* etxo_qdestroy */ - hunt_tx_qpost, /* etxo_qpost */ - hunt_tx_qpush, /* etxo_qpush */ - hunt_tx_qpace, /* etxo_qpace */ - hunt_tx_qflush, /* etxo_qflush */ - hunt_tx_qenable, /* etxo_qenable */ - hunt_tx_qpio_enable, /* etxo_qpio_enable */ - hunt_tx_qpio_disable, /* etxo_qpio_disable */ - hunt_tx_qpio_write, /* etxo_qpio_write */ - hunt_tx_qpio_post, /* etxo_qpio_post */ - hunt_tx_qdesc_post, /* etxo_qdesc_post */ - hunt_tx_qdesc_dma_create, /* etxo_qdesc_dma_create */ + ef10_tx_init, /* etxo_init */ + ef10_tx_fini, /* etxo_fini */ + ef10_tx_qcreate, /* etxo_qcreate */ + ef10_tx_qdestroy, /* etxo_qdestroy */ + ef10_tx_qpost, /* etxo_qpost */ + ef10_tx_qpush, /* etxo_qpush */ + ef10_tx_qpace, /* etxo_qpace */ + ef10_tx_qflush, /* etxo_qflush */ + ef10_tx_qenable, /* etxo_qenable */ + ef10_tx_qpio_enable, /* etxo_qpio_enable */ + ef10_tx_qpio_disable, /* etxo_qpio_disable */ + ef10_tx_qpio_write, /* etxo_qpio_write */ + ef10_tx_qpio_post, /* etxo_qpio_post */ + ef10_tx_qdesc_post, /* etxo_qdesc_post */ + ef10_tx_qdesc_dma_create, /* etxo_qdesc_dma_create */ hunt_tx_qdesc_tso_create, /* etxo_qdesc_tso_create */ - hunt_tx_qdesc_vlantci_create, /* etxo_qdesc_vlantci_create */ + ef10_tx_qdesc_vlantci_create, /* etxo_qdesc_vlantci_create */ #if EFSYS_OPT_QSTATS - hunt_tx_qstats_update, /* etxo_qstats_update */ + ef10_tx_qstats_update, /* etxo_qstats_update */ #endif }; #endif /* EFSYS_OPT_HUNTINGTON */ +#if EFSYS_OPT_MEDFORD +static efx_tx_ops_t __efx_tx_medford_ops = { + ef10_tx_init, /* etxo_init */ + ef10_tx_fini, /* etxo_fini */ + ef10_tx_qcreate, /* etxo_qcreate */ + ef10_tx_qdestroy, /* etxo_qdestroy */ + ef10_tx_qpost, /* etxo_qpost */ + ef10_tx_qpush, /* etxo_qpush */ + ef10_tx_qpace, /* etxo_qpace */ + ef10_tx_qflush, /* etxo_qflush */ + ef10_tx_qenable, /* etxo_qenable */ + ef10_tx_qpio_enable, /* etxo_qpio_enable */ + ef10_tx_qpio_disable, /* etxo_qpio_disable */ + ef10_tx_qpio_write, /* etxo_qpio_write */ + ef10_tx_qpio_post, /* etxo_qpio_post */ + ef10_tx_qdesc_post, /* etxo_qdesc_post */ + ef10_tx_qdesc_dma_create, /* etxo_qdesc_dma_create */ + NULL, /* etxo_qdesc_tso_create */ + ef10_tx_qdesc_vlantci_create, /* etxo_qdesc_vlantci_create */ +#if EFSYS_OPT_QSTATS + ef10_tx_qstats_update, /* etxo_qstats_update */ +#endif +}; +#endif /* EFSYS_OPT_MEDFORD */ + __checkReturn efx_rc_t efx_tx_init( __in efx_nic_t *enp) @@ -241,6 +266,12 @@ efx_tx_init( break; #endif /* EFSYS_OPT_HUNTINGTON */ +#if EFSYS_OPT_MEDFORD + case EFX_FAMILY_MEDFORD: + etxop = (efx_tx_ops_t *)&__efx_tx_medford_ops; + break; +#endif /* EFSYS_OPT_MEDFORD */ + default: EFSYS_ASSERT(0); rc = ENOTSUP; diff --git a/sys/dev/sfxge/common/hunt_impl.h b/sys/dev/sfxge/common/hunt_impl.h index 620f347f2ff7..c6fe9f61e656 100644 --- a/sys/dev/sfxge/common/hunt_impl.h +++ b/sys/dev/sfxge/common/hunt_impl.h @@ -572,15 +572,15 @@ ef10_sram_test( /* TX */ extern __checkReturn efx_rc_t -hunt_tx_init( +ef10_tx_init( __in efx_nic_t *enp); extern void -hunt_tx_fini( +ef10_tx_fini( __in efx_nic_t *enp); extern __checkReturn efx_rc_t -hunt_tx_qcreate( +ef10_tx_qcreate( __in efx_nic_t *enp, __in unsigned int index, __in unsigned int label, @@ -593,11 +593,11 @@ hunt_tx_qcreate( __out unsigned int *addedp); extern void -hunt_tx_qdestroy( +ef10_tx_qdestroy( __in efx_txq_t *etp); extern __checkReturn efx_rc_t -hunt_tx_qpost( +ef10_tx_qpost( __in efx_txq_t *etp, __in_ecount(n) efx_buffer_t *eb, __in unsigned int n, @@ -605,48 +605,48 @@ hunt_tx_qpost( __inout unsigned int *addedp); extern void -hunt_tx_qpush( +ef10_tx_qpush( __in efx_txq_t *etp, __in unsigned int added, __in unsigned int pushed); extern __checkReturn efx_rc_t -hunt_tx_qpace( +ef10_tx_qpace( __in efx_txq_t *etp, __in unsigned int ns); extern __checkReturn efx_rc_t -hunt_tx_qflush( +ef10_tx_qflush( __in efx_txq_t *etp); extern void -hunt_tx_qenable( +ef10_tx_qenable( __in efx_txq_t *etp); extern __checkReturn efx_rc_t -hunt_tx_qpio_enable( +ef10_tx_qpio_enable( __in efx_txq_t *etp); extern void -hunt_tx_qpio_disable( +ef10_tx_qpio_disable( __in efx_txq_t *etp); extern __checkReturn efx_rc_t -hunt_tx_qpio_write( +ef10_tx_qpio_write( __in efx_txq_t *etp, __in_ecount(buf_length) uint8_t *buffer, __in size_t buf_length, __in size_t pio_buf_offset); extern __checkReturn efx_rc_t -hunt_tx_qpio_post( +ef10_tx_qpio_post( __in efx_txq_t *etp, __in size_t pkt_length, __in unsigned int completed, __inout unsigned int *addedp); extern __checkReturn efx_rc_t -hunt_tx_qdesc_post( +ef10_tx_qdesc_post( __in efx_txq_t *etp, __in_ecount(n) efx_desc_t *ed, __in unsigned int n, @@ -654,7 +654,7 @@ hunt_tx_qdesc_post( __inout unsigned int *addedp); extern void -hunt_tx_qdesc_dma_create( +ef10_tx_qdesc_dma_create( __in efx_txq_t *etp, __in efsys_dma_addr_t addr, __in size_t size, @@ -670,7 +670,7 @@ hunt_tx_qdesc_tso_create( __out efx_desc_t *edp); extern void -hunt_tx_qdesc_vlantci_create( +ef10_tx_qdesc_vlantci_create( __in efx_txq_t *etp, __in uint16_t vlan_tci, __out efx_desc_t *edp); @@ -679,7 +679,7 @@ hunt_tx_qdesc_vlantci_create( #if EFSYS_OPT_QSTATS extern void -hunt_tx_qstats_update( +ef10_tx_qstats_update( __in efx_txq_t *etp, __inout_ecount(TX_NQSTATS) efsys_stat_t *stat); diff --git a/sys/dev/sfxge/common/hunt_tx.c b/sys/dev/sfxge/common/hunt_tx.c index 45fdd832b01d..f8e09c999893 100755 --- a/sys/dev/sfxge/common/hunt_tx.c +++ b/sys/dev/sfxge/common/hunt_tx.c @@ -165,7 +165,7 @@ efx_mcdi_fini_txq( } __checkReturn efx_rc_t -hunt_tx_init( +ef10_tx_init( __in efx_nic_t *enp) { _NOTE(ARGUNUSED(enp)) @@ -173,14 +173,14 @@ hunt_tx_init( } void -hunt_tx_fini( +ef10_tx_fini( __in efx_nic_t *enp) { _NOTE(ARGUNUSED(enp)) } __checkReturn efx_rc_t -hunt_tx_qcreate( +ef10_tx_qcreate( __in efx_nic_t *enp, __in unsigned int index, __in unsigned int label, @@ -218,7 +218,7 @@ hunt_tx_qcreate( (flags & EFX_TXQ_CKSUM_IPV4) ? 1 : 0); EFSYS_MEM_WRITEQ(etp->et_esmp, 0, &desc); - hunt_tx_qpush(etp, *addedp, 0); + ef10_tx_qpush(etp, *addedp, 0); return (0); @@ -229,7 +229,7 @@ hunt_tx_qcreate( } void -hunt_tx_qdestroy( +ef10_tx_qdestroy( __in efx_txq_t *etp) { /* FIXME */ @@ -238,7 +238,7 @@ hunt_tx_qdestroy( } __checkReturn efx_rc_t -hunt_tx_qpio_enable( +ef10_tx_qpio_enable( __in efx_txq_t *etp) { efx_nic_t *enp = etp->et_enp; @@ -294,7 +294,7 @@ hunt_tx_qpio_enable( } void -hunt_tx_qpio_disable( +ef10_tx_qpio_disable( __in efx_txq_t *etp) { efx_nic_t *enp = etp->et_enp; @@ -311,7 +311,7 @@ hunt_tx_qpio_disable( } __checkReturn efx_rc_t -hunt_tx_qpio_write( +ef10_tx_qpio_write( __in efx_txq_t *etp, __in_ecount(length) uint8_t *buffer, __in size_t length, @@ -359,7 +359,7 @@ hunt_tx_qpio_write( } __checkReturn efx_rc_t -hunt_tx_qpio_post( +ef10_tx_qpio_post( __in efx_txq_t *etp, __in size_t pkt_length, __in unsigned int completed, @@ -412,7 +412,7 @@ hunt_tx_qpio_post( } __checkReturn efx_rc_t -hunt_tx_qpost( +ef10_tx_qpost( __in efx_txq_t *etp, __in_ecount(n) efx_buffer_t *eb, __in unsigned int n, @@ -474,7 +474,7 @@ hunt_tx_qpost( * hardware decides not to use the pushed descriptor. */ void -hunt_tx_qpush( +ef10_tx_qpush( __in efx_txq_t *etp, __in unsigned int added, __in unsigned int pushed) @@ -504,7 +504,7 @@ hunt_tx_qpush( } __checkReturn efx_rc_t -hunt_tx_qdesc_post( +ef10_tx_qdesc_post( __in efx_txq_t *etp, __in_ecount(n) efx_desc_t *ed, __in unsigned int n, @@ -546,7 +546,7 @@ hunt_tx_qdesc_post( } void -hunt_tx_qdesc_dma_create( +ef10_tx_qdesc_dma_create( __in efx_txq_t *etp, __in efsys_dma_addr_t addr, __in size_t size, @@ -590,7 +590,7 @@ hunt_tx_qdesc_tso_create( } void -hunt_tx_qdesc_vlantci_create( +ef10_tx_qdesc_vlantci_create( __in efx_txq_t *etp, __in uint16_t tci, __out efx_desc_t *edp) @@ -608,7 +608,7 @@ hunt_tx_qdesc_vlantci_create( __checkReturn efx_rc_t -hunt_tx_qpace( +ef10_tx_qpace( __in efx_txq_t *etp, __in unsigned int ns) { @@ -631,7 +631,7 @@ hunt_tx_qpace( } __checkReturn efx_rc_t -hunt_tx_qflush( +ef10_tx_qflush( __in efx_txq_t *etp) { efx_nic_t *enp = etp->et_enp; @@ -649,7 +649,7 @@ hunt_tx_qflush( } void -hunt_tx_qenable( +ef10_tx_qenable( __in efx_txq_t *etp) { /* FIXME */ @@ -659,15 +659,10 @@ hunt_tx_qenable( #if EFSYS_OPT_QSTATS void -hunt_tx_qstats_update( +ef10_tx_qstats_update( __in efx_txq_t *etp, __inout_ecount(TX_NQSTATS) efsys_stat_t *stat) { - /* - * TBD: Consider a common Siena/Huntington function. The code is - * essentially identical. - */ - unsigned int id; for (id = 0; id < TX_NQSTATS; id++) { From b627be989d1368aad0fdd4ab102734456e5ad923 Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Tue, 12 Jan 2016 13:34:55 +0000 Subject: [PATCH 30/82] sfxge: rename hunt RX methods to ef10 and use for Medford Submitted by: Mark Spender Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D4871 --- sys/dev/sfxge/common/efx_rx.c | 46 ++++++++++++++++++------------ sys/dev/sfxge/common/hunt_filter.c | 2 +- sys/dev/sfxge/common/hunt_impl.h | 28 +++++++++--------- sys/dev/sfxge/common/hunt_rx.c | 36 +++++++++++------------ 4 files changed, 60 insertions(+), 52 deletions(-) diff --git a/sys/dev/sfxge/common/efx_rx.c b/sys/dev/sfxge/common/efx_rx.c index 2481c861c38e..48e6328b3d40 100644 --- a/sys/dev/sfxge/common/efx_rx.c +++ b/sys/dev/sfxge/common/efx_rx.c @@ -175,29 +175,29 @@ static efx_rx_ops_t __efx_rx_siena_ops = { }; #endif /* EFSYS_OPT_SIENA */ -#if EFSYS_OPT_HUNTINGTON -static efx_rx_ops_t __efx_rx_hunt_ops = { - hunt_rx_init, /* erxo_init */ - hunt_rx_fini, /* erxo_fini */ +#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD +static efx_rx_ops_t __efx_rx_ef10_ops = { + ef10_rx_init, /* erxo_init */ + ef10_rx_fini, /* erxo_fini */ #if EFSYS_OPT_RX_HDR_SPLIT - hunt_rx_hdr_split_enable, /* erxo_hdr_split_enable */ + ef10_rx_hdr_split_enable, /* erxo_hdr_split_enable */ #endif #if EFSYS_OPT_RX_SCATTER - hunt_rx_scatter_enable, /* erxo_scatter_enable */ + ef10_rx_scatter_enable, /* erxo_scatter_enable */ #endif #if EFSYS_OPT_RX_SCALE - hunt_rx_scale_mode_set, /* erxo_scale_mode_set */ - hunt_rx_scale_key_set, /* erxo_scale_key_set */ - hunt_rx_scale_tbl_set, /* erxo_scale_tbl_set */ + ef10_rx_scale_mode_set, /* erxo_scale_mode_set */ + ef10_rx_scale_key_set, /* erxo_scale_key_set */ + ef10_rx_scale_tbl_set, /* erxo_scale_tbl_set */ #endif - hunt_rx_qpost, /* erxo_qpost */ - hunt_rx_qpush, /* erxo_qpush */ - hunt_rx_qflush, /* erxo_qflush */ - hunt_rx_qenable, /* erxo_qenable */ - hunt_rx_qcreate, /* erxo_qcreate */ - hunt_rx_qdestroy, /* erxo_qdestroy */ + ef10_rx_qpost, /* erxo_qpost */ + ef10_rx_qpush, /* erxo_qpush */ + ef10_rx_qflush, /* erxo_qflush */ + ef10_rx_qenable, /* erxo_qenable */ + ef10_rx_qcreate, /* erxo_qcreate */ + ef10_rx_qdestroy, /* erxo_qdestroy */ }; -#endif /* EFSYS_OPT_HUNTINGTON */ +#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */ __checkReturn efx_rc_t @@ -235,10 +235,16 @@ efx_rx_init( #if EFSYS_OPT_HUNTINGTON case EFX_FAMILY_HUNTINGTON: - erxop = (efx_rx_ops_t *)&__efx_rx_hunt_ops; + erxop = (efx_rx_ops_t *)&__efx_rx_ef10_ops; break; #endif /* EFSYS_OPT_HUNTINGTON */ +#if EFSYS_OPT_MEDFORD + case EFX_FAMILY_MEDFORD: + erxop = (efx_rx_ops_t *)&__efx_rx_ef10_ops; + break; +#endif /* EFSYS_OPT_MEDFORD */ + default: EFSYS_ASSERT(0); rc = ENOTSUP; @@ -607,7 +613,7 @@ efx_rx_qdestroy( * Hash values are in network (big-endian) byte order. * * - * On Huntington the pseudo-header is laid out as: + * On EF10 the pseudo-header is laid out as: * (See also SF-109306-TC section 9) * * Toeplitz hash (32 bits, little-endian) @@ -629,7 +635,8 @@ efx_psuedo_hdr_pkt_length_get( __in uint8_t *buffer, __out uint16_t *pkt_lengthp) { - if (enp->en_family != EFX_FAMILY_HUNTINGTON) { + if (enp->en_family != EFX_FAMILY_HUNTINGTON && + enp->en_family != EFX_FAMILY_MEDFORD) { EFSYS_ASSERT(0); return (ENOTSUP); } @@ -656,6 +663,7 @@ efx_psuedo_hdr_hash_get( (buffer[14] << 8) | buffer[15]); case EFX_FAMILY_HUNTINGTON: + case EFX_FAMILY_MEDFORD: return (buffer[0] | (buffer[1] << 8) | (buffer[2] << 16) | diff --git a/sys/dev/sfxge/common/hunt_filter.c b/sys/dev/sfxge/common/hunt_filter.c index 0666d9dc17f6..846687db7f52 100644 --- a/sys/dev/sfxge/common/hunt_filter.c +++ b/sys/dev/sfxge/common/hunt_filter.c @@ -1351,7 +1351,7 @@ hunt_filter_default_rxq_set( #if EFSYS_OPT_RX_SCALE EFSYS_ASSERT((using_rss == B_FALSE) || - (enp->en_rss_context != HUNTINGTON_RSS_CONTEXT_INVALID)); + (enp->en_rss_context != EF10_RSS_CONTEXT_INVALID)); table->hft_using_rss = using_rss; #else EFSYS_ASSERT(using_rss == B_FALSE); diff --git a/sys/dev/sfxge/common/hunt_impl.h b/sys/dev/sfxge/common/hunt_impl.h index c6fe9f61e656..b0ee587ccdde 100644 --- a/sys/dev/sfxge/common/hunt_impl.h +++ b/sys/dev/sfxge/common/hunt_impl.h @@ -50,7 +50,7 @@ extern "C" { #define HUNTINGTON_RX_WPTR_ALIGN 8 /* Invalid RSS context handle */ -#define HUNTINGTON_RSS_CONTEXT_INVALID (0xffffffff) +#define EF10_RSS_CONTEXT_INVALID (0xffffffff) /* EV */ @@ -822,12 +822,12 @@ hunt_vpd_fini( /* RX */ extern __checkReturn efx_rc_t -hunt_rx_init( +ef10_rx_init( __in efx_nic_t *enp); #if EFSYS_OPT_RX_HDR_SPLIT extern __checkReturn efx_rc_t -hunt_rx_hdr_split_enable( +ef10_rx_hdr_split_enable( __in efx_nic_t *enp, __in unsigned int hdr_buf_size, __in unsigned int pld_buf_size); @@ -835,7 +835,7 @@ hunt_rx_hdr_split_enable( #if EFSYS_OPT_RX_SCATTER extern __checkReturn efx_rc_t -hunt_rx_scatter_enable( +ef10_rx_scatter_enable( __in efx_nic_t *enp, __in unsigned int buf_size); #endif /* EFSYS_OPT_RX_SCATTER */ @@ -844,20 +844,20 @@ hunt_rx_scatter_enable( #if EFSYS_OPT_RX_SCALE extern __checkReturn efx_rc_t -hunt_rx_scale_mode_set( +ef10_rx_scale_mode_set( __in efx_nic_t *enp, __in efx_rx_hash_alg_t alg, __in efx_rx_hash_type_t type, __in boolean_t insert); extern __checkReturn efx_rc_t -hunt_rx_scale_key_set( +ef10_rx_scale_key_set( __in efx_nic_t *enp, __in_ecount(n) uint8_t *key, __in size_t n); extern __checkReturn efx_rc_t -hunt_rx_scale_tbl_set( +ef10_rx_scale_tbl_set( __in efx_nic_t *enp, __in_ecount(n) unsigned int *table, __in size_t n); @@ -865,7 +865,7 @@ hunt_rx_scale_tbl_set( #endif /* EFSYS_OPT_RX_SCALE */ extern void -hunt_rx_qpost( +ef10_rx_qpost( __in efx_rxq_t *erp, __in_ecount(n) efsys_dma_addr_t *addrp, __in size_t size, @@ -874,21 +874,21 @@ hunt_rx_qpost( __in unsigned int added); extern void -hunt_rx_qpush( +ef10_rx_qpush( __in efx_rxq_t *erp, __in unsigned int added, __inout unsigned int *pushedp); extern __checkReturn efx_rc_t -hunt_rx_qflush( +ef10_rx_qflush( __in efx_rxq_t *erp); extern void -hunt_rx_qenable( +ef10_rx_qenable( __in efx_rxq_t *erp); extern __checkReturn efx_rc_t -hunt_rx_qcreate( +ef10_rx_qcreate( __in efx_nic_t *enp, __in unsigned int index, __in unsigned int label, @@ -900,11 +900,11 @@ hunt_rx_qcreate( __in efx_rxq_t *erp); extern void -hunt_rx_qdestroy( +ef10_rx_qdestroy( __in efx_rxq_t *erp); extern void -hunt_rx_fini( +ef10_rx_fini( __in efx_nic_t *enp); #if EFSYS_OPT_FILTER diff --git a/sys/dev/sfxge/common/hunt_rx.c b/sys/dev/sfxge/common/hunt_rx.c index 3af5a58dd0f1..d5a38159fbd4 100644 --- a/sys/dev/sfxge/common/hunt_rx.c +++ b/sys/dev/sfxge/common/hunt_rx.c @@ -182,7 +182,7 @@ efx_mcdi_rss_context_alloc( } rss_context = MCDI_OUT_DWORD(req, RSS_CONTEXT_ALLOC_OUT_RSS_CONTEXT_ID); - if (rss_context == HUNTINGTON_RSS_CONTEXT_INVALID) { + if (rss_context == EF10_RSS_CONTEXT_INVALID) { rc = ENOENT; goto fail3; } @@ -213,7 +213,7 @@ efx_mcdi_rss_context_free( MC_CMD_RSS_CONTEXT_FREE_OUT_LEN)]; efx_rc_t rc; - if (rss_context == HUNTINGTON_RSS_CONTEXT_INVALID) { + if (rss_context == EF10_RSS_CONTEXT_INVALID) { rc = EINVAL; goto fail1; } @@ -257,7 +257,7 @@ efx_mcdi_rss_context_set_flags( MC_CMD_RSS_CONTEXT_SET_FLAGS_OUT_LEN)]; efx_rc_t rc; - if (rss_context == HUNTINGTON_RSS_CONTEXT_INVALID) { + if (rss_context == EF10_RSS_CONTEXT_INVALID) { rc = EINVAL; goto fail1; } @@ -313,7 +313,7 @@ efx_mcdi_rss_context_set_key( MC_CMD_RSS_CONTEXT_SET_KEY_OUT_LEN)]; efx_rc_t rc; - if (rss_context == HUNTINGTON_RSS_CONTEXT_INVALID) { + if (rss_context == EF10_RSS_CONTEXT_INVALID) { rc = EINVAL; goto fail1; } @@ -371,7 +371,7 @@ efx_mcdi_rss_context_set_table( uint8_t *req_table; int i, rc; - if (rss_context == HUNTINGTON_RSS_CONTEXT_INVALID) { + if (rss_context == EF10_RSS_CONTEXT_INVALID) { rc = EINVAL; goto fail1; } @@ -415,7 +415,7 @@ efx_mcdi_rss_context_set_table( __checkReturn efx_rc_t -hunt_rx_init( +ef10_rx_init( __in efx_nic_t *enp) { #if EFSYS_OPT_RX_SCALE @@ -444,7 +444,7 @@ hunt_rx_init( #if EFSYS_OPT_RX_HDR_SPLIT __checkReturn efx_rc_t -hunt_rx_hdr_split_enable( +ef10_rx_hdr_split_enable( __in efx_nic_t *enp, __in unsigned int hdr_buf_size, __in unsigned int pld_buf_size) @@ -470,7 +470,7 @@ hunt_rx_hdr_split_enable( #if EFSYS_OPT_RX_SCATTER __checkReturn efx_rc_t -hunt_rx_scatter_enable( +ef10_rx_scatter_enable( __in efx_nic_t *enp, __in unsigned int buf_size) { @@ -481,7 +481,7 @@ hunt_rx_scatter_enable( #if EFSYS_OPT_RX_SCALE __checkReturn efx_rc_t -hunt_rx_scale_mode_set( +ef10_rx_scale_mode_set( __in efx_nic_t *enp, __in efx_rx_hash_alg_t alg, __in efx_rx_hash_type_t type, @@ -521,7 +521,7 @@ hunt_rx_scale_mode_set( #if EFSYS_OPT_RX_SCALE __checkReturn efx_rc_t -hunt_rx_scale_key_set( +ef10_rx_scale_key_set( __in efx_nic_t *enp, __in_ecount(n) uint8_t *key, __in size_t n) @@ -550,7 +550,7 @@ hunt_rx_scale_key_set( #if EFSYS_OPT_RX_SCALE __checkReturn efx_rc_t -hunt_rx_scale_tbl_set( +ef10_rx_scale_tbl_set( __in efx_nic_t *enp, __in_ecount(n) unsigned int *table, __in size_t n) @@ -578,7 +578,7 @@ hunt_rx_scale_tbl_set( #endif /* EFSYS_OPT_RX_SCALE */ void -hunt_rx_qpost( +ef10_rx_qpost( __in efx_rxq_t *erp, __in_ecount(n) efsys_dma_addr_t *addrp, __in size_t size, @@ -616,7 +616,7 @@ hunt_rx_qpost( } void -hunt_rx_qpush( +ef10_rx_qpush( __in efx_rxq_t *erp, __in unsigned int added, __inout unsigned int *pushedp) @@ -647,7 +647,7 @@ hunt_rx_qpush( } __checkReturn efx_rc_t -hunt_rx_qflush( +ef10_rx_qflush( __in efx_rxq_t *erp) { efx_nic_t *enp = erp->er_enp; @@ -665,7 +665,7 @@ hunt_rx_qflush( } void -hunt_rx_qenable( +ef10_rx_qenable( __in efx_rxq_t *erp) { /* FIXME */ @@ -674,7 +674,7 @@ hunt_rx_qenable( } __checkReturn efx_rc_t -hunt_rx_qcreate( +ef10_rx_qcreate( __in efx_nic_t *enp, __in unsigned int index, __in unsigned int label, @@ -742,7 +742,7 @@ hunt_rx_qcreate( } void -hunt_rx_qdestroy( +ef10_rx_qdestroy( __in efx_rxq_t *erp) { efx_nic_t *enp = erp->er_enp; @@ -758,7 +758,7 @@ hunt_rx_qdestroy( } void -hunt_rx_fini( +ef10_rx_fini( __in efx_nic_t *enp) { #if EFSYS_OPT_RX_SCALE From 5311abfa259581949a7b150d5d332606f78d878b Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Tue, 12 Jan 2016 13:36:21 +0000 Subject: [PATCH 31/82] sfxge: rename Huntington VPD methods to ef10 and use for Medford Submitted by: Mark Spender Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D4872 --- sys/dev/sfxge/common/efx_vpd.c | 34 +++++++++++++---------- sys/dev/sfxge/common/hunt_impl.h | 20 +++++++------- sys/dev/sfxge/common/hunt_vpd.c | 46 +++++++++++++++++++------------- 3 files changed, 57 insertions(+), 43 deletions(-) diff --git a/sys/dev/sfxge/common/efx_vpd.c b/sys/dev/sfxge/common/efx_vpd.c index 8c6e993490f1..032dcd689f9c 100644 --- a/sys/dev/sfxge/common/efx_vpd.c +++ b/sys/dev/sfxge/common/efx_vpd.c @@ -91,22 +91,22 @@ static efx_vpd_ops_t __efx_vpd_siena_ops = { #endif /* EFSYS_OPT_SIENA */ -#if EFSYS_OPT_HUNTINGTON +#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD -static efx_vpd_ops_t __efx_vpd_hunt_ops = { - hunt_vpd_init, /* evpdo_init */ - hunt_vpd_size, /* evpdo_size */ - hunt_vpd_read, /* evpdo_read */ - hunt_vpd_verify, /* evpdo_verify */ - hunt_vpd_reinit, /* evpdo_reinit */ - hunt_vpd_get, /* evpdo_get */ - hunt_vpd_set, /* evpdo_set */ - hunt_vpd_next, /* evpdo_next */ - hunt_vpd_write, /* evpdo_write */ - hunt_vpd_fini, /* evpdo_fini */ +static efx_vpd_ops_t __efx_vpd_ef10_ops = { + ef10_vpd_init, /* evpdo_init */ + ef10_vpd_size, /* evpdo_size */ + ef10_vpd_read, /* evpdo_read */ + ef10_vpd_verify, /* evpdo_verify */ + ef10_vpd_reinit, /* evpdo_reinit */ + ef10_vpd_get, /* evpdo_get */ + ef10_vpd_set, /* evpdo_set */ + ef10_vpd_next, /* evpdo_next */ + ef10_vpd_write, /* evpdo_write */ + ef10_vpd_fini, /* evpdo_fini */ }; -#endif /* EFSYS_OPT_HUNTINGTON */ +#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */ __checkReturn efx_rc_t efx_vpd_init( @@ -134,10 +134,16 @@ efx_vpd_init( #if EFSYS_OPT_HUNTINGTON case EFX_FAMILY_HUNTINGTON: - evpdop = (efx_vpd_ops_t *)&__efx_vpd_hunt_ops; + evpdop = (efx_vpd_ops_t *)&__efx_vpd_ef10_ops; break; #endif /* EFSYS_OPT_HUNTINGTON */ +#if EFSYS_OPT_MEDFORD + case EFX_FAMILY_MEDFORD: + evpdop = (efx_vpd_ops_t *)&__efx_vpd_ef10_ops; + break; +#endif /* EFSYS_OPT_MEDFORD */ + default: EFSYS_ASSERT(0); rc = ENOTSUP; diff --git a/sys/dev/sfxge/common/hunt_impl.h b/sys/dev/sfxge/common/hunt_impl.h index b0ee587ccdde..d43f9725975a 100644 --- a/sys/dev/sfxge/common/hunt_impl.h +++ b/sys/dev/sfxge/common/hunt_impl.h @@ -758,48 +758,48 @@ hunt_nic_pio_unlink( #if EFSYS_OPT_VPD extern __checkReturn efx_rc_t -hunt_vpd_init( +ef10_vpd_init( __in efx_nic_t *enp); extern __checkReturn efx_rc_t -hunt_vpd_size( +ef10_vpd_size( __in efx_nic_t *enp, __out size_t *sizep); extern __checkReturn efx_rc_t -hunt_vpd_read( +ef10_vpd_read( __in efx_nic_t *enp, __out_bcount(size) caddr_t data, __in size_t size); extern __checkReturn efx_rc_t -hunt_vpd_verify( +ef10_vpd_verify( __in efx_nic_t *enp, __in_bcount(size) caddr_t data, __in size_t size); extern __checkReturn efx_rc_t -hunt_vpd_reinit( +ef10_vpd_reinit( __in efx_nic_t *enp, __in_bcount(size) caddr_t data, __in size_t size); extern __checkReturn efx_rc_t -hunt_vpd_get( +ef10_vpd_get( __in efx_nic_t *enp, __in_bcount(size) caddr_t data, __in size_t size, __inout efx_vpd_value_t *evvp); extern __checkReturn efx_rc_t -hunt_vpd_set( +ef10_vpd_set( __in efx_nic_t *enp, __in_bcount(size) caddr_t data, __in size_t size, __in efx_vpd_value_t *evvp); extern __checkReturn efx_rc_t -hunt_vpd_next( +ef10_vpd_next( __in efx_nic_t *enp, __in_bcount(size) caddr_t data, __in size_t size, @@ -807,13 +807,13 @@ hunt_vpd_next( __inout unsigned int *contp); extern __checkReturn efx_rc_t -hunt_vpd_write( +ef10_vpd_write( __in efx_nic_t *enp, __in_bcount(size) caddr_t data, __in size_t size); extern void -hunt_vpd_fini( +ef10_vpd_fini( __in efx_nic_t *enp); #endif /* EFSYS_OPT_VPD */ diff --git a/sys/dev/sfxge/common/hunt_vpd.c b/sys/dev/sfxge/common/hunt_vpd.c index c11f4524ef5c..ca2ea68b9b44 100644 --- a/sys/dev/sfxge/common/hunt_vpd.c +++ b/sys/dev/sfxge/common/hunt_vpd.c @@ -45,7 +45,7 @@ __FBSDID("$FreeBSD$"); #include "ef10_tlv_layout.h" __checkReturn efx_rc_t -hunt_vpd_init( +ef10_vpd_init( __in efx_nic_t *enp) { caddr_t svpd; @@ -54,7 +54,8 @@ hunt_vpd_init( efx_rc_t rc; EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PROBE); - EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON); + EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON || + enp->en_family == EFX_FAMILY_MEDFORD); pci_pf = enp->en_nic_cfg.enc_pf; /* @@ -98,13 +99,14 @@ hunt_vpd_init( } __checkReturn efx_rc_t -hunt_vpd_size( +ef10_vpd_size( __in efx_nic_t *enp, __out size_t *sizep) { efx_rc_t rc; - EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON); + EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON || + enp->en_family == EFX_FAMILY_MEDFORD); /* * This function returns the total size the user should allocate @@ -125,7 +127,7 @@ hunt_vpd_size( } __checkReturn efx_rc_t -hunt_vpd_read( +ef10_vpd_read( __in efx_nic_t *enp, __out_bcount(size) caddr_t data, __in size_t size) @@ -135,7 +137,8 @@ hunt_vpd_read( uint32_t pci_pf; efx_rc_t rc; - EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON); + EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON || + enp->en_family == EFX_FAMILY_MEDFORD); pci_pf = enp->en_nic_cfg.enc_pf; @@ -169,7 +172,7 @@ hunt_vpd_read( } __checkReturn efx_rc_t -hunt_vpd_verify( +ef10_vpd_verify( __in efx_nic_t *enp, __in_bcount(size) caddr_t data, __in size_t size) @@ -182,12 +185,13 @@ hunt_vpd_verify( unsigned int dcont; efx_rc_t rc; - EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON); + EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON || + enp->en_family == EFX_FAMILY_MEDFORD); /* * Strictly you could take the view that dynamic vpd is optional. * Instead, to conform more closely to the read/verify/reinit() - * paradigm, we require dynamic vpd. hunt_vpd_reinit() will + * paradigm, we require dynamic vpd. ef10_vpd_reinit() will * reinitialize it as required. */ if ((rc = efx_vpd_hunk_verify(data, size, NULL)) != 0) @@ -243,7 +247,7 @@ hunt_vpd_verify( } __checkReturn efx_rc_t -hunt_vpd_reinit( +ef10_vpd_reinit( __in efx_nic_t *enp, __in_bcount(size) caddr_t data, __in size_t size) @@ -285,7 +289,7 @@ hunt_vpd_reinit( } __checkReturn efx_rc_t -hunt_vpd_get( +ef10_vpd_get( __in efx_nic_t *enp, __in_bcount(size) caddr_t data, __in size_t size, @@ -295,7 +299,8 @@ hunt_vpd_get( uint8_t length; efx_rc_t rc; - EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON); + EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON || + enp->en_family == EFX_FAMILY_MEDFORD); /* Attempt to satisfy the request from svpd first */ if (enp->en_arch.ef10.ena_svpd_length > 0) { @@ -329,7 +334,7 @@ hunt_vpd_get( } __checkReturn efx_rc_t -hunt_vpd_set( +ef10_vpd_set( __in efx_nic_t *enp, __in_bcount(size) caddr_t data, __in size_t size, @@ -337,7 +342,8 @@ hunt_vpd_set( { efx_rc_t rc; - EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON); + EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON || + enp->en_family == EFX_FAMILY_MEDFORD); /* If the provided (tag,keyword) exists in svpd, then it is readonly */ if (enp->en_arch.ef10.ena_svpd_length > 0) { @@ -366,7 +372,7 @@ hunt_vpd_set( } __checkReturn efx_rc_t -hunt_vpd_next( +ef10_vpd_next( __in efx_nic_t *enp, __in_bcount(size) caddr_t data, __in size_t size, @@ -379,7 +385,7 @@ hunt_vpd_next( } __checkReturn efx_rc_t -hunt_vpd_write( +ef10_vpd_write( __in efx_nic_t *enp, __in_bcount(size) caddr_t data, __in size_t size) @@ -388,7 +394,8 @@ hunt_vpd_write( uint32_t pci_pf; efx_rc_t rc; - EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON); + EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON || + enp->en_family == EFX_FAMILY_MEDFORD); pci_pf = enp->en_nic_cfg.enc_pf; @@ -416,10 +423,11 @@ hunt_vpd_write( } void -hunt_vpd_fini( +ef10_vpd_fini( __in efx_nic_t *enp) { - EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON); + EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON || + enp->en_family == EFX_FAMILY_MEDFORD); if (enp->en_arch.ef10.ena_svpd_length > 0) { EFSYS_KMEM_FREE(enp->en_esip, enp->en_arch.ef10.ena_svpd_length, From de9775ad34d8b2ce4bdd9245b670e74f10846617 Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Tue, 12 Jan 2016 13:37:58 +0000 Subject: [PATCH 32/82] sfxge: rename hunt nvram methods and use for Medford Some new partitions have been added, but they shouldn't need to be handled any differently. Submitted by: Mark Spender Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D4873 --- sys/dev/sfxge/common/efx_nvram.c | 32 +++--- sys/dev/sfxge/common/hunt_impl.h | 49 +++++---- sys/dev/sfxge/common/hunt_nvram.c | 176 +++++++++++++++--------------- sys/dev/sfxge/common/hunt_vpd.c | 6 +- 4 files changed, 138 insertions(+), 125 deletions(-) diff --git a/sys/dev/sfxge/common/efx_nvram.c b/sys/dev/sfxge/common/efx_nvram.c index b7d29fd884a8..78f4be4d73de 100644 --- a/sys/dev/sfxge/common/efx_nvram.c +++ b/sys/dev/sfxge/common/efx_nvram.c @@ -75,23 +75,23 @@ static efx_nvram_ops_t __efx_nvram_siena_ops = { #endif /* EFSYS_OPT_SIENA */ -#if EFSYS_OPT_HUNTINGTON +#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD -static efx_nvram_ops_t __efx_nvram_hunt_ops = { +static efx_nvram_ops_t __efx_nvram_ef10_ops = { #if EFSYS_OPT_DIAG - hunt_nvram_test, /* envo_test */ + ef10_nvram_test, /* envo_test */ #endif /* EFSYS_OPT_DIAG */ - hunt_nvram_size, /* envo_size */ - hunt_nvram_get_version, /* envo_get_version */ - hunt_nvram_rw_start, /* envo_rw_start */ - hunt_nvram_read_chunk, /* envo_read_chunk */ - hunt_nvram_erase, /* envo_erase */ - hunt_nvram_write_chunk, /* envo_write_chunk */ - hunt_nvram_rw_finish, /* envo_rw_finish */ - hunt_nvram_set_version, /* envo_set_version */ + ef10_nvram_size, /* envo_size */ + ef10_nvram_get_version, /* envo_get_version */ + ef10_nvram_rw_start, /* envo_rw_start */ + ef10_nvram_read_chunk, /* envo_read_chunk */ + ef10_nvram_erase, /* envo_erase */ + ef10_nvram_write_chunk, /* envo_write_chunk */ + ef10_nvram_rw_finish, /* envo_rw_finish */ + ef10_nvram_set_version, /* envo_set_version */ }; -#endif /* EFSYS_OPT_HUNTINGTON */ +#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */ __checkReturn efx_rc_t efx_nvram_init( @@ -119,10 +119,16 @@ efx_nvram_init( #if EFSYS_OPT_HUNTINGTON case EFX_FAMILY_HUNTINGTON: - envop = (efx_nvram_ops_t *)&__efx_nvram_hunt_ops; + envop = (efx_nvram_ops_t *)&__efx_nvram_ef10_ops; break; #endif /* EFSYS_OPT_HUNTINGTON */ +#if EFSYS_OPT_MEDFORD + case EFX_FAMILY_MEDFORD: + envop = (efx_nvram_ops_t *)&__efx_nvram_ef10_ops; + break; +#endif /* EFSYS_OPT_MEDFORD */ + default: EFSYS_ASSERT(0); rc = ENOTSUP; diff --git a/sys/dev/sfxge/common/hunt_impl.h b/sys/dev/sfxge/common/hunt_impl.h index d43f9725975a..e595e9ab5830 100644 --- a/sys/dev/sfxge/common/hunt_impl.h +++ b/sys/dev/sfxge/common/hunt_impl.h @@ -42,7 +42,12 @@ extern "C" { #endif -#define HUNTINGTON_NVRAM_CHUNK 0x80 +/* + * FIXME: This is just a power of 2 which fits in an MCDI v1 message, and could + * possibly be increased, or the write size reported by newer firmware used + * instead. + */ +#define EF10_NVRAM_CHUNK 0x80 /* Alignment requirement for value written to RX WPTR: * the WPTR must be aligned to an 8 descriptor boundary @@ -296,7 +301,7 @@ hunt_mcdi_feature_supported( #if EFSYS_OPT_NVRAM || EFSYS_OPT_VPD extern __checkReturn efx_rc_t -hunt_nvram_buf_read_tlv( +ef10_nvram_buf_read_tlv( __in efx_nic_t *enp, __in_bcount(max_seg_size) caddr_t seg_data, __in size_t max_seg_size, @@ -305,7 +310,7 @@ hunt_nvram_buf_read_tlv( __out size_t *sizep); extern __checkReturn efx_rc_t -hunt_nvram_buf_write_tlv( +ef10_nvram_buf_write_tlv( __inout_bcount(partn_size) caddr_t partn_data, __in size_t partn_size, __in uint32_t tag, @@ -314,7 +319,7 @@ hunt_nvram_buf_write_tlv( __out size_t *total_lengthp); extern __checkReturn efx_rc_t -hunt_nvram_partn_read_tlv( +ef10_nvram_partn_read_tlv( __in efx_nic_t *enp, __in uint32_t partn, __in uint32_t tag, @@ -322,7 +327,7 @@ hunt_nvram_partn_read_tlv( __out size_t *sizep); extern __checkReturn efx_rc_t -hunt_nvram_partn_write_tlv( +ef10_nvram_partn_write_tlv( __in efx_nic_t *enp, __in uint32_t partn, __in uint32_t tag, @@ -330,7 +335,7 @@ hunt_nvram_partn_write_tlv( __in size_t size); extern __checkReturn efx_rc_t -hunt_nvram_partn_write_segment_tlv( +ef10_nvram_partn_write_segment_tlv( __in efx_nic_t *enp, __in uint32_t partn, __in uint32_t tag, @@ -339,18 +344,18 @@ hunt_nvram_partn_write_segment_tlv( __in boolean_t all_segments); extern __checkReturn efx_rc_t -hunt_nvram_partn_size( +ef10_nvram_partn_size( __in efx_nic_t *enp, __in unsigned int partn, __out size_t *sizep); extern __checkReturn efx_rc_t -hunt_nvram_partn_lock( +ef10_nvram_partn_lock( __in efx_nic_t *enp, __in unsigned int partn); extern __checkReturn efx_rc_t -hunt_nvram_partn_read( +ef10_nvram_partn_read( __in efx_nic_t *enp, __in unsigned int partn, __in unsigned int offset, @@ -358,14 +363,14 @@ hunt_nvram_partn_read( __in size_t size); extern __checkReturn efx_rc_t -hunt_nvram_partn_erase( +ef10_nvram_partn_erase( __in efx_nic_t *enp, __in unsigned int partn, __in unsigned int offset, __in size_t size); extern __checkReturn efx_rc_t -hunt_nvram_partn_write( +ef10_nvram_partn_write( __in efx_nic_t *enp, __in unsigned int partn, __in unsigned int offset, @@ -373,7 +378,7 @@ hunt_nvram_partn_write( __in size_t size); extern void -hunt_nvram_partn_unlock( +ef10_nvram_partn_unlock( __in efx_nic_t *enp, __in unsigned int partn); @@ -384,32 +389,32 @@ hunt_nvram_partn_unlock( #if EFSYS_OPT_DIAG extern __checkReturn efx_rc_t -hunt_nvram_test( +ef10_nvram_test( __in efx_nic_t *enp); #endif /* EFSYS_OPT_DIAG */ extern __checkReturn efx_rc_t -hunt_nvram_size( +ef10_nvram_size( __in efx_nic_t *enp, __in efx_nvram_type_t type, __out size_t *sizep); extern __checkReturn efx_rc_t -hunt_nvram_get_version( +ef10_nvram_get_version( __in efx_nic_t *enp, __in efx_nvram_type_t type, __out uint32_t *subtypep, __out_ecount(4) uint16_t version[4]); extern __checkReturn efx_rc_t -hunt_nvram_rw_start( +ef10_nvram_rw_start( __in efx_nic_t *enp, __in efx_nvram_type_t type, __out size_t *pref_chunkp); extern __checkReturn efx_rc_t -hunt_nvram_read_chunk( +ef10_nvram_read_chunk( __in efx_nic_t *enp, __in efx_nvram_type_t type, __in unsigned int offset, @@ -417,12 +422,12 @@ hunt_nvram_read_chunk( __in size_t size); extern __checkReturn efx_rc_t -hunt_nvram_erase( +ef10_nvram_erase( __in efx_nic_t *enp, __in efx_nvram_type_t type); extern __checkReturn efx_rc_t -hunt_nvram_write_chunk( +ef10_nvram_write_chunk( __in efx_nic_t *enp, __in efx_nvram_type_t type, __in unsigned int offset, @@ -430,18 +435,18 @@ hunt_nvram_write_chunk( __in size_t size); extern void -hunt_nvram_rw_finish( +ef10_nvram_rw_finish( __in efx_nic_t *enp, __in efx_nvram_type_t type); extern __checkReturn efx_rc_t -hunt_nvram_partn_set_version( +ef10_nvram_partn_set_version( __in efx_nic_t *enp, __in unsigned int partn, __in_ecount(4) uint16_t version[4]); extern __checkReturn efx_rc_t -hunt_nvram_set_version( +ef10_nvram_set_version( __in efx_nic_t *enp, __in efx_nvram_type_t type, __in_ecount(4) uint16_t version[4]); diff --git a/sys/dev/sfxge/common/hunt_nvram.c b/sys/dev/sfxge/common/hunt_nvram.c index c25fa1099656..38db912bb29f 100644 --- a/sys/dev/sfxge/common/hunt_nvram.c +++ b/sys/dev/sfxge/common/hunt_nvram.c @@ -489,7 +489,7 @@ efx_nvram_tlv_validate( int pos; efx_rc_t rc; - EFX_STATIC_ASSERT(sizeof (*header) <= HUNTINGTON_NVRAM_CHUNK); + EFX_STATIC_ASSERT(sizeof (*header) <= EF10_NVRAM_CHUNK); if ((partn_data == NULL) || (partn_size == 0)) { rc = EINVAL; @@ -578,7 +578,7 @@ efx_nvram_tlv_validate( * beyond the first to be read. */ static __checkReturn efx_rc_t -hunt_nvram_read_tlv_segment( +ef10_nvram_read_tlv_segment( __in efx_nic_t *enp, __in uint32_t partn, __in size_t seg_offset, @@ -593,7 +593,7 @@ hunt_nvram_read_tlv_segment( int pos; efx_rc_t rc; - EFX_STATIC_ASSERT(sizeof (*header) <= HUNTINGTON_NVRAM_CHUNK); + EFX_STATIC_ASSERT(sizeof (*header) <= EF10_NVRAM_CHUNK); if ((seg_data == NULL) || (max_seg_size == 0)) { rc = EINVAL; @@ -601,8 +601,8 @@ hunt_nvram_read_tlv_segment( } /* Read initial chunk of the segment, starting at offset */ - if ((rc = hunt_nvram_partn_read(enp, partn, seg_offset, seg_data, - HUNTINGTON_NVRAM_CHUNK)) != 0) { + if ((rc = ef10_nvram_partn_read(enp, partn, seg_offset, seg_data, + EF10_NVRAM_CHUNK)) != 0) { goto fail2; } @@ -626,11 +626,11 @@ hunt_nvram_read_tlv_segment( } /* Read the remaining segment content */ - if (total_length > HUNTINGTON_NVRAM_CHUNK) { - if ((rc = hunt_nvram_partn_read(enp, partn, - seg_offset + HUNTINGTON_NVRAM_CHUNK, - seg_data + HUNTINGTON_NVRAM_CHUNK, - total_length - HUNTINGTON_NVRAM_CHUNK)) != 0) + if (total_length > EF10_NVRAM_CHUNK) { + if ((rc = ef10_nvram_partn_read(enp, partn, + seg_offset + EF10_NVRAM_CHUNK, + seg_data + EF10_NVRAM_CHUNK, + total_length - EF10_NVRAM_CHUNK)) != 0) goto fail6; } @@ -705,7 +705,7 @@ hunt_nvram_read_tlv_segment( * buffer containing a TLV formatted segment. */ __checkReturn efx_rc_t -hunt_nvram_buf_read_tlv( +ef10_nvram_buf_read_tlv( __in efx_nic_t *enp, __in_bcount(max_seg_size) caddr_t seg_data, __in size_t max_seg_size, @@ -768,7 +768,7 @@ hunt_nvram_buf_read_tlv( /* Read a single TLV item from the first segment in a TLV formatted partition */ __checkReturn efx_rc_t -hunt_nvram_partn_read_tlv( +ef10_nvram_partn_read_tlv( __in efx_nic_t *enp, __in uint32_t partn, __in uint32_t tag, @@ -783,7 +783,7 @@ hunt_nvram_partn_read_tlv( efx_rc_t rc; /* Allocate sufficient memory for the entire partition */ - if ((rc = hunt_nvram_partn_size(enp, partn, &partn_size)) != 0) + if ((rc = ef10_nvram_partn_size(enp, partn, &partn_size)) != 0) goto fail1; if (partn_size == 0) { @@ -807,7 +807,7 @@ hunt_nvram_partn_read_tlv( */ retry = 10; do { - rc = hunt_nvram_read_tlv_segment(enp, partn, 0, + rc = ef10_nvram_read_tlv_segment(enp, partn, 0, seg_data, partn_size); } while ((rc == EAGAIN) && (--retry > 0)); @@ -816,7 +816,7 @@ hunt_nvram_partn_read_tlv( goto fail4; } - if ((rc = hunt_nvram_buf_read_tlv(enp, seg_data, partn_size, + if ((rc = ef10_nvram_buf_read_tlv(enp, seg_data, partn_size, tag, &data, &length)) != 0) goto fail5; @@ -845,7 +845,7 @@ hunt_nvram_partn_read_tlv( /* Compute the size of a segment. */ static __checkReturn efx_rc_t -hunt_nvram_buf_segment_size( +ef10_nvram_buf_segment_size( __in caddr_t seg_data, __in size_t max_seg_size, __out size_t *seg_sizep) @@ -976,7 +976,7 @@ hunt_nvram_buf_segment_size( * formatted segment. Historically partitions consisted of only one segment. */ __checkReturn efx_rc_t -hunt_nvram_buf_write_tlv( +ef10_nvram_buf_write_tlv( __inout_bcount(max_seg_size) caddr_t seg_data, __in size_t max_seg_size, __in uint32_t tag, @@ -1077,14 +1077,14 @@ hunt_nvram_buf_write_tlv( * configuration. */ __checkReturn efx_rc_t -hunt_nvram_partn_write_tlv( +ef10_nvram_partn_write_tlv( __in efx_nic_t *enp, __in uint32_t partn, __in uint32_t tag, __in_bcount(size) caddr_t data, __in size_t size) { - return hunt_nvram_partn_write_segment_tlv(enp, partn, tag, data, + return ef10_nvram_partn_write_segment_tlv(enp, partn, tag, data, size, B_FALSE); } @@ -1093,7 +1093,7 @@ hunt_nvram_partn_write_tlv( * and optionally write a new tag to it. */ static __checkReturn efx_rc_t -hunt_nvram_segment_write_tlv( +ef10_nvram_segment_write_tlv( __in efx_nic_t *enp, __in uint32_t partn, __in uint32_t tag, @@ -1116,19 +1116,19 @@ hunt_nvram_segment_write_tlv( * this is the first segment in a partition. In this case the caller * must propogate the error. */ - status = hunt_nvram_read_tlv_segment(enp, partn, *partn_offsetp, + status = ef10_nvram_read_tlv_segment(enp, partn, *partn_offsetp, *seg_datap, *src_remain_lenp); if (status != 0) return (EINVAL); - status = hunt_nvram_buf_segment_size(*seg_datap, + status = ef10_nvram_buf_segment_size(*seg_datap, *src_remain_lenp, &original_segment_size); if (status != 0) return (EINVAL); if (write) { /* Update the contents of the segment in the buffer */ - if ((rc = hunt_nvram_buf_write_tlv(*seg_datap, + if ((rc = ef10_nvram_buf_write_tlv(*seg_datap, *dest_remain_lenp, tag, data, size, &modified_segment_size)) != 0) goto fail1; @@ -1176,7 +1176,7 @@ hunt_nvram_segment_write_tlv( * invalidate them. */ __checkReturn efx_rc_t -hunt_nvram_partn_write_segment_tlv( +ef10_nvram_partn_write_segment_tlv( __in efx_nic_t *enp, __in uint32_t partn, __in uint32_t tag, @@ -1196,7 +1196,7 @@ hunt_nvram_partn_write_segment_tlv( EFSYS_ASSERT3U(partn, ==, NVRAM_PARTITION_TYPE_DYNAMIC_CONFIG); /* Allocate sufficient memory for the entire partition */ - if ((rc = hunt_nvram_partn_size(enp, partn, &partn_size)) != 0) + if ((rc = ef10_nvram_partn_size(enp, partn, &partn_size)) != 0) goto fail1; EFSYS_KMEM_ALLOC(enp->en_esip, partn_size, partn_data); @@ -1210,14 +1210,14 @@ hunt_nvram_partn_write_segment_tlv( segment_data = partn_data; /* Lock the partition */ - if ((rc = hunt_nvram_partn_lock(enp, partn)) != 0) + if ((rc = ef10_nvram_partn_lock(enp, partn)) != 0) goto fail3; /* Iterate over each (potential) segment to update it. */ do { boolean_t write = all_segments || current_offset == 0; - rc = hunt_nvram_segment_write_tlv(enp, partn, tag, data, size, + rc = ef10_nvram_segment_write_tlv(enp, partn, tag, data, size, &segment_data, ¤t_offset, &remaining_original_length, &remaining_modified_length, write); if (rc != 0) { @@ -1236,7 +1236,7 @@ hunt_nvram_partn_write_segment_tlv( /* * We've run out of space. This should actually be dealt with by - * hunt_nvram_buf_write_tlv returning ENOSPC. + * ef10_nvram_buf_write_tlv returning ENOSPC. */ if (total_length > partn_size) { rc = ENOSPC; @@ -1244,16 +1244,16 @@ hunt_nvram_partn_write_segment_tlv( } /* Erase the whole partition in NVRAM */ - if ((rc = hunt_nvram_partn_erase(enp, partn, 0, partn_size)) != 0) + if ((rc = ef10_nvram_partn_erase(enp, partn, 0, partn_size)) != 0) goto fail6; /* Write new partition contents from the buffer to NVRAM */ - if ((rc = hunt_nvram_partn_write(enp, partn, 0, partn_data, + if ((rc = ef10_nvram_partn_write(enp, partn, 0, partn_data, total_length)) != 0) goto fail7; /* Unlock the partition */ - hunt_nvram_partn_unlock(enp, partn); + ef10_nvram_partn_unlock(enp, partn); EFSYS_KMEM_FREE(enp->en_esip, partn_size, partn_data); @@ -1268,7 +1268,7 @@ hunt_nvram_partn_write_segment_tlv( fail4: EFSYS_PROBE(fail4); - hunt_nvram_partn_unlock(enp, partn); + ef10_nvram_partn_unlock(enp, partn); fail3: EFSYS_PROBE(fail3); @@ -1286,7 +1286,7 @@ hunt_nvram_partn_write_segment_tlv( * not the data used by the segments in the partition. */ __checkReturn efx_rc_t -hunt_nvram_partn_size( +ef10_nvram_partn_size( __in efx_nic_t *enp, __in unsigned int partn, __out size_t *sizep) @@ -1306,7 +1306,7 @@ hunt_nvram_partn_size( } __checkReturn efx_rc_t -hunt_nvram_partn_lock( +ef10_nvram_partn_lock( __in efx_nic_t *enp, __in unsigned int partn) { @@ -1324,7 +1324,7 @@ hunt_nvram_partn_lock( } __checkReturn efx_rc_t -hunt_nvram_partn_read( +ef10_nvram_partn_read( __in efx_nic_t *enp, __in unsigned int partn, __in unsigned int offset, @@ -1335,7 +1335,7 @@ hunt_nvram_partn_read( efx_rc_t rc; while (size > 0) { - chunk = MIN(size, HUNTINGTON_NVRAM_CHUNK); + chunk = MIN(size, EF10_NVRAM_CHUNK); if ((rc = efx_mcdi_nvram_read(enp, partn, offset, data, chunk)) != 0) { @@ -1356,7 +1356,7 @@ hunt_nvram_partn_read( } __checkReturn efx_rc_t -hunt_nvram_partn_erase( +ef10_nvram_partn_erase( __in efx_nic_t *enp, __in unsigned int partn, __in unsigned int offset, @@ -1401,7 +1401,7 @@ hunt_nvram_partn_erase( } __checkReturn efx_rc_t -hunt_nvram_partn_write( +ef10_nvram_partn_write( __in efx_nic_t *enp, __in unsigned int partn, __in unsigned int offset, @@ -1426,7 +1426,7 @@ hunt_nvram_partn_write( goto fail2; } } else { - write_size = HUNTINGTON_NVRAM_CHUNK; + write_size = EF10_NVRAM_CHUNK; } while (size > 0) { @@ -1455,7 +1455,7 @@ hunt_nvram_partn_write( } void -hunt_nvram_partn_unlock( +ef10_nvram_partn_unlock( __in efx_nic_t *enp, __in unsigned int partn) { @@ -1473,7 +1473,7 @@ hunt_nvram_partn_unlock( } __checkReturn efx_rc_t -hunt_nvram_partn_set_version( +ef10_nvram_partn_set_version( __in efx_nic_t *enp, __in unsigned int partn, __in_ecount(4) uint16_t version[4]) @@ -1491,7 +1491,7 @@ hunt_nvram_partn_set_version( size = sizeof (partn_version) - (2 * sizeof (uint32_t)); /* Write the version number to all segments in the partition */ - if ((rc = hunt_nvram_partn_write_segment_tlv(enp, + if ((rc = ef10_nvram_partn_write_segment_tlv(enp, NVRAM_PARTITION_TYPE_DYNAMIC_CONFIG, TLV_TAG_PARTITION_VERSION(partn), (caddr_t)&partn_version.version_w, size, B_TRUE)) != 0) @@ -1509,14 +1509,16 @@ hunt_nvram_partn_set_version( #if EFSYS_OPT_NVRAM -typedef struct hunt_parttbl_entry_s { +/* FIXME: Update partition table for Medford */ + +typedef struct ef10_parttbl_entry_s { unsigned int partn; unsigned int port; efx_nvram_type_t nvtype; -} hunt_parttbl_entry_t; +} ef10_parttbl_entry_t; /* Translate EFX NVRAM types to firmware partition types */ -static hunt_parttbl_entry_t hunt_parttbl[] = { +static ef10_parttbl_entry_t ef10_parttbl[] = { {NVRAM_PARTITION_TYPE_MC_FIRMWARE, 1, EFX_NVRAM_MC_FIRMWARE}, {NVRAM_PARTITION_TYPE_MC_FIRMWARE, 2, EFX_NVRAM_MC_FIRMWARE}, {NVRAM_PARTITION_TYPE_MC_FIRMWARE, 3, EFX_NVRAM_MC_FIRMWARE}, @@ -1547,19 +1549,19 @@ static hunt_parttbl_entry_t hunt_parttbl[] = { {NVRAM_PARTITION_TYPE_FPGA_BACKUP, 4, EFX_NVRAM_FPGA_BACKUP} }; -static __checkReturn hunt_parttbl_entry_t * -hunt_parttbl_entry( +static __checkReturn ef10_parttbl_entry_t * +ef10_parttbl_entry( __in efx_nic_t *enp, __in efx_nvram_type_t type) { efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip); - hunt_parttbl_entry_t *entry; + ef10_parttbl_entry_t *entry; int i; EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES); - for (i = 0; i < EFX_ARRAY_SIZE(hunt_parttbl); i++) { - entry = &hunt_parttbl[i]; + for (i = 0; i < EFX_ARRAY_SIZE(ef10_parttbl); i++) { + entry = &ef10_parttbl[i]; if (entry->port == emip->emi_port && entry->nvtype == type) return (entry); @@ -1572,11 +1574,11 @@ hunt_parttbl_entry( #if EFSYS_OPT_DIAG __checkReturn efx_rc_t -hunt_nvram_test( +ef10_nvram_test( __in efx_nic_t *enp) { efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip); - hunt_parttbl_entry_t *entry; + ef10_parttbl_entry_t *entry; unsigned int npartns = 0; uint32_t *partns = NULL; size_t size; @@ -1601,8 +1603,8 @@ hunt_nvram_test( * Iterate over the list of supported partition types * applicable to *this* port */ - for (i = 0; i < EFX_ARRAY_SIZE(hunt_parttbl); i++) { - entry = &hunt_parttbl[i]; + for (i = 0; i < EFX_ARRAY_SIZE(ef10_parttbl); i++) { + entry = &ef10_parttbl[i]; if (entry->port != emip->emi_port) continue; @@ -1632,22 +1634,22 @@ hunt_nvram_test( #endif /* EFSYS_OPT_DIAG */ __checkReturn efx_rc_t -hunt_nvram_size( +ef10_nvram_size( __in efx_nic_t *enp, __in efx_nvram_type_t type, __out size_t *sizep) { - hunt_parttbl_entry_t *entry; + ef10_parttbl_entry_t *entry; uint32_t partn; efx_rc_t rc; - if ((entry = hunt_parttbl_entry(enp, type)) == NULL) { + if ((entry = ef10_parttbl_entry(enp, type)) == NULL) { rc = ENOTSUP; goto fail1; } partn = entry->partn; - if ((rc = hunt_nvram_partn_size(enp, partn, sizep)) != 0) + if ((rc = ef10_nvram_partn_size(enp, partn, sizep)) != 0) goto fail2; return (0); @@ -1663,17 +1665,17 @@ hunt_nvram_size( } __checkReturn efx_rc_t -hunt_nvram_get_version( +ef10_nvram_get_version( __in efx_nic_t *enp, __in efx_nvram_type_t type, __out uint32_t *subtypep, __out_ecount(4) uint16_t version[4]) { - hunt_parttbl_entry_t *entry; + ef10_parttbl_entry_t *entry; uint32_t partn; efx_rc_t rc; - if ((entry = hunt_parttbl_entry(enp, type)) == NULL) { + if ((entry = ef10_parttbl_entry(enp, type)) == NULL) { rc = ENOTSUP; goto fail1; } @@ -1697,26 +1699,26 @@ hunt_nvram_get_version( } __checkReturn efx_rc_t -hunt_nvram_rw_start( +ef10_nvram_rw_start( __in efx_nic_t *enp, __in efx_nvram_type_t type, __out size_t *chunk_sizep) { - hunt_parttbl_entry_t *entry; + ef10_parttbl_entry_t *entry; uint32_t partn; efx_rc_t rc; - if ((entry = hunt_parttbl_entry(enp, type)) == NULL) { + if ((entry = ef10_parttbl_entry(enp, type)) == NULL) { rc = ENOTSUP; goto fail1; } partn = entry->partn; - if ((rc = hunt_nvram_partn_lock(enp, partn)) != 0) + if ((rc = ef10_nvram_partn_lock(enp, partn)) != 0) goto fail2; if (chunk_sizep != NULL) - *chunk_sizep = HUNTINGTON_NVRAM_CHUNK; + *chunk_sizep = EF10_NVRAM_CHUNK; return (0); @@ -1729,22 +1731,22 @@ hunt_nvram_rw_start( } __checkReturn efx_rc_t -hunt_nvram_read_chunk( +ef10_nvram_read_chunk( __in efx_nic_t *enp, __in efx_nvram_type_t type, __in unsigned int offset, __out_bcount(size) caddr_t data, __in size_t size) { - hunt_parttbl_entry_t *entry; + ef10_parttbl_entry_t *entry; efx_rc_t rc; - if ((entry = hunt_parttbl_entry(enp, type)) == NULL) { + if ((entry = ef10_parttbl_entry(enp, type)) == NULL) { rc = ENOTSUP; goto fail1; } - if ((rc = hunt_nvram_partn_read(enp, entry->partn, + if ((rc = ef10_nvram_partn_read(enp, entry->partn, offset, data, size)) != 0) goto fail2; @@ -1759,23 +1761,23 @@ hunt_nvram_read_chunk( } __checkReturn efx_rc_t -hunt_nvram_erase( +ef10_nvram_erase( __in efx_nic_t *enp, __in efx_nvram_type_t type) { - hunt_parttbl_entry_t *entry; + ef10_parttbl_entry_t *entry; size_t size; efx_rc_t rc; - if ((entry = hunt_parttbl_entry(enp, type)) == NULL) { + if ((entry = ef10_parttbl_entry(enp, type)) == NULL) { rc = ENOTSUP; goto fail1; } - if ((rc = hunt_nvram_partn_size(enp, entry->partn, &size)) != 0) + if ((rc = ef10_nvram_partn_size(enp, entry->partn, &size)) != 0) goto fail2; - if ((rc = hunt_nvram_partn_erase(enp, entry->partn, 0, size)) != 0) + if ((rc = ef10_nvram_partn_erase(enp, entry->partn, 0, size)) != 0) goto fail3; return (0); @@ -1791,22 +1793,22 @@ hunt_nvram_erase( } __checkReturn efx_rc_t -hunt_nvram_write_chunk( +ef10_nvram_write_chunk( __in efx_nic_t *enp, __in efx_nvram_type_t type, __in unsigned int offset, __in_bcount(size) caddr_t data, __in size_t size) { - hunt_parttbl_entry_t *entry; + ef10_parttbl_entry_t *entry; efx_rc_t rc; - if ((entry = hunt_parttbl_entry(enp, type)) == NULL) { + if ((entry = ef10_parttbl_entry(enp, type)) == NULL) { rc = ENOTSUP; goto fail1; } - if ((rc = hunt_nvram_partn_write(enp, entry->partn, + if ((rc = ef10_nvram_partn_write(enp, entry->partn, offset, data, size)) != 0) goto fail2; @@ -1821,33 +1823,33 @@ hunt_nvram_write_chunk( } void -hunt_nvram_rw_finish( +ef10_nvram_rw_finish( __in efx_nic_t *enp, __in efx_nvram_type_t type) { - hunt_parttbl_entry_t *entry; + ef10_parttbl_entry_t *entry; - if ((entry = hunt_parttbl_entry(enp, type)) != NULL) - hunt_nvram_partn_unlock(enp, entry->partn); + if ((entry = ef10_parttbl_entry(enp, type)) != NULL) + ef10_nvram_partn_unlock(enp, entry->partn); } __checkReturn efx_rc_t -hunt_nvram_set_version( +ef10_nvram_set_version( __in efx_nic_t *enp, __in efx_nvram_type_t type, __in_ecount(4) uint16_t version[4]) { - hunt_parttbl_entry_t *entry; + ef10_parttbl_entry_t *entry; unsigned int partn; efx_rc_t rc; - if ((entry = hunt_parttbl_entry(enp, type)) == NULL) { + if ((entry = ef10_parttbl_entry(enp, type)) == NULL) { rc = ENOTSUP; goto fail1; } partn = entry->partn; - if ((rc = hunt_nvram_partn_set_version(enp, partn, version)) != 0) + if ((rc = ef10_nvram_partn_set_version(enp, partn, version)) != 0) goto fail2; return (0); diff --git a/sys/dev/sfxge/common/hunt_vpd.c b/sys/dev/sfxge/common/hunt_vpd.c index ca2ea68b9b44..ecdb7ab8a108 100644 --- a/sys/dev/sfxge/common/hunt_vpd.c +++ b/sys/dev/sfxge/common/hunt_vpd.c @@ -65,7 +65,7 @@ ef10_vpd_init( */ svpd = NULL; svpd_size = 0; - rc = hunt_nvram_partn_read_tlv(enp, + rc = ef10_nvram_partn_read_tlv(enp, NVRAM_PARTITION_TYPE_STATIC_CONFIG, TLV_TAG_PF_STATIC_VPD(pci_pf), &svpd, &svpd_size); @@ -142,7 +142,7 @@ ef10_vpd_read( pci_pf = enp->en_nic_cfg.enc_pf; - if ((rc = hunt_nvram_partn_read_tlv(enp, + if ((rc = ef10_nvram_partn_read_tlv(enp, NVRAM_PARTITION_TYPE_DYNAMIC_CONFIG, TLV_TAG_PF_DYNAMIC_VPD(pci_pf), &dvpd, &dvpd_size)) != 0) @@ -404,7 +404,7 @@ ef10_vpd_write( goto fail1; /* Store new dynamic VPD in all segments in DYNAMIC_CONFIG partition */ - if ((rc = hunt_nvram_partn_write_segment_tlv(enp, + if ((rc = ef10_nvram_partn_write_segment_tlv(enp, NVRAM_PARTITION_TYPE_DYNAMIC_CONFIG, TLV_TAG_PF_DYNAMIC_VPD(pci_pf), data, vpd_length, B_TRUE)) != 0) { From ead1c5dfe574b7b1c85e21f944e1a43c818c1b7e Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Tue, 12 Jan 2016 13:39:25 +0000 Subject: [PATCH 33/82] sfxge: rename hunt MCDI methods to ef10 and use for Medford Submitted by: Mark Spender Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D4874 --- sys/dev/sfxge/common/efx_mcdi.c | 38 ++++++++++++++++------------ sys/dev/sfxge/common/efx_mcdi.h | 4 +-- sys/dev/sfxge/common/hunt_impl.h | 16 ++++++------ sys/dev/sfxge/common/hunt_mcdi.c | 43 +++++++++++++++++--------------- 4 files changed, 55 insertions(+), 46 deletions(-) diff --git a/sys/dev/sfxge/common/efx_mcdi.c b/sys/dev/sfxge/common/efx_mcdi.c index a5c4d5297896..e9912d7af957 100644 --- a/sys/dev/sfxge/common/efx_mcdi.c +++ b/sys/dev/sfxge/common/efx_mcdi.c @@ -56,20 +56,20 @@ static efx_mcdi_ops_t __efx_mcdi_siena_ops = { #endif /* EFSYS_OPT_SIENA */ -#if EFSYS_OPT_HUNTINGTON +#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD -static efx_mcdi_ops_t __efx_mcdi_hunt_ops = { - hunt_mcdi_init, /* emco_init */ - hunt_mcdi_request_copyin, /* emco_request_copyin */ - hunt_mcdi_request_copyout, /* emco_request_copyout */ - hunt_mcdi_poll_reboot, /* emco_poll_reboot */ - hunt_mcdi_poll_response, /* emco_poll_response */ - hunt_mcdi_read_response, /* emco_read_response */ - hunt_mcdi_fini, /* emco_fini */ - hunt_mcdi_feature_supported, /* emco_feature_supported */ +static efx_mcdi_ops_t __efx_mcdi_ef10_ops = { + ef10_mcdi_init, /* emco_init */ + ef10_mcdi_request_copyin, /* emco_request_copyin */ + ef10_mcdi_request_copyout, /* emco_request_copyout */ + ef10_mcdi_poll_reboot, /* emco_poll_reboot */ + ef10_mcdi_poll_response, /* emco_poll_response */ + ef10_mcdi_read_response, /* emco_read_response */ + ef10_mcdi_fini, /* emco_fini */ + ef10_mcdi_feature_supported, /* emco_feature_supported */ }; -#endif /* EFSYS_OPT_HUNTINGTON */ +#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */ @@ -100,10 +100,16 @@ efx_mcdi_init( #if EFSYS_OPT_HUNTINGTON case EFX_FAMILY_HUNTINGTON: - emcop = (efx_mcdi_ops_t *)&__efx_mcdi_hunt_ops; + emcop = (efx_mcdi_ops_t *)&__efx_mcdi_ef10_ops; break; #endif /* EFSYS_OPT_HUNTINGTON */ +#if EFSYS_OPT_MEDFORD + case EFX_FAMILY_MEDFORD: + emcop = (efx_mcdi_ops_t *)&__efx_mcdi_ef10_ops; + break; +#endif /* EFSYS_OPT_MEDFORD */ + default: EFSYS_ASSERT(0); rc = ENOTSUP; @@ -1491,7 +1497,7 @@ efx_mcdi_mac_spoofing_supported( #if EFSYS_OPT_BIST -#if EFSYS_OPT_HUNTINGTON +#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD /* * Enter bist offline mode. This is a fw mode which puts the NIC into a state * where memory BIST tests can be run and not much else can interfere or happen. @@ -1527,7 +1533,7 @@ efx_mcdi_bist_enable_offline( return (rc); } -#endif /* EFSYS_OPT_HUNTINGTON */ +#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */ __checkReturn efx_rc_t efx_mcdi_bist_start( @@ -1788,7 +1794,7 @@ efx_mcdi_mac_stats_periodic( #endif /* EFSYS_OPT_MAC_STATS */ -#if EFSYS_OPT_HUNTINGTON +#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD /* * This function returns the pf and vf number of a function. If it is a pf the @@ -1887,7 +1893,7 @@ efx_mcdi_privilege_mask( return (rc); } -#endif /* EFSYS_OPT_HUNTINGTON */ +#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */ __checkReturn efx_rc_t efx_mcdi_set_workaround( diff --git a/sys/dev/sfxge/common/efx_mcdi.h b/sys/dev/sfxge/common/efx_mcdi.h index 18924a00acb3..a9a5c0917745 100644 --- a/sys/dev/sfxge/common/efx_mcdi.h +++ b/sys/dev/sfxge/common/efx_mcdi.h @@ -188,11 +188,11 @@ efx_mcdi_mac_spoofing_supported( #if EFSYS_OPT_BIST -#if EFSYS_OPT_HUNTINGTON +#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD extern __checkReturn efx_rc_t efx_mcdi_bist_enable_offline( __in efx_nic_t *enp); -#endif /* EFSYS_OPT_HUNTINGTON */ +#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */ extern __checkReturn efx_rc_t efx_mcdi_bist_start( __in efx_nic_t *enp, diff --git a/sys/dev/sfxge/common/hunt_impl.h b/sys/dev/sfxge/common/hunt_impl.h index e595e9ab5830..c0b727097992 100644 --- a/sys/dev/sfxge/common/hunt_impl.h +++ b/sys/dev/sfxge/common/hunt_impl.h @@ -252,16 +252,16 @@ hunt_mac_stats_update( #if EFSYS_OPT_MCDI extern __checkReturn efx_rc_t -hunt_mcdi_init( +ef10_mcdi_init( __in efx_nic_t *enp, __in const efx_mcdi_transport_t *mtp); extern void -hunt_mcdi_fini( +ef10_mcdi_fini( __in efx_nic_t *enp); extern void -hunt_mcdi_request_copyin( +ef10_mcdi_request_copyin( __in efx_nic_t *enp, __in efx_mcdi_req_t *emrp, __in unsigned int seq, @@ -269,27 +269,27 @@ hunt_mcdi_request_copyin( __in boolean_t new_epoch); extern __checkReturn boolean_t -hunt_mcdi_poll_response( +ef10_mcdi_poll_response( __in efx_nic_t *enp); extern void -hunt_mcdi_read_response( +ef10_mcdi_read_response( __in efx_nic_t *enp, __out void *bufferp, __in size_t offset, __in size_t length); extern void -hunt_mcdi_request_copyout( +ef10_mcdi_request_copyout( __in efx_nic_t *enp, __in efx_mcdi_req_t *emrp); extern efx_rc_t -hunt_mcdi_poll_reboot( +ef10_mcdi_poll_reboot( __in efx_nic_t *enp); extern __checkReturn efx_rc_t -hunt_mcdi_feature_supported( +ef10_mcdi_feature_supported( __in efx_nic_t *enp, __in efx_mcdi_feature_id_t id, __out boolean_t *supportedp); diff --git a/sys/dev/sfxge/common/hunt_mcdi.c b/sys/dev/sfxge/common/hunt_mcdi.c index 2e61e74ff07c..590456e7b789 100644 --- a/sys/dev/sfxge/common/hunt_mcdi.c +++ b/sys/dev/sfxge/common/hunt_mcdi.c @@ -36,12 +36,12 @@ __FBSDID("$FreeBSD$"); #include "efx_impl.h" -#if EFSYS_OPT_HUNTINGTON +#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD #if EFSYS_OPT_MCDI #ifndef WITH_MCDI_V2 -#error "WITH_MCDI_V2 required for Huntington MCDIv2 commands." +#error "WITH_MCDI_V2 required for EF10 MCDIv2 commands." #endif typedef enum efx_mcdi_header_type_e { @@ -77,7 +77,7 @@ typedef enum efx_mcdi_header_type_e { __checkReturn efx_rc_t -hunt_mcdi_init( +ef10_mcdi_init( __in efx_nic_t *enp, __in const efx_mcdi_transport_t *emtp) { @@ -85,10 +85,11 @@ hunt_mcdi_init( efx_dword_t dword; efx_rc_t rc; - EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON); + EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON || + enp->en_family == EFX_FAMILY_MEDFORD); EFSYS_ASSERT(enp->en_features & EFX_FEATURE_MCDI_DMA); - /* A host DMA buffer is required for Huntington MCDI */ + /* A host DMA buffer is required for EF10 MCDI */ if (esmp == NULL) { rc = EINVAL; goto fail1; @@ -107,7 +108,7 @@ hunt_mcdi_init( EFX_BAR_WRITED(enp, ER_DZ_MC_DB_HWRD_REG, &dword, B_FALSE); /* Save initial MC reboot status */ - (void) hunt_mcdi_poll_reboot(enp); + (void) ef10_mcdi_poll_reboot(enp); /* Start a new epoch (allow fresh MCDI requests to succeed) */ efx_mcdi_new_epoch(enp); @@ -123,7 +124,7 @@ hunt_mcdi_init( } void -hunt_mcdi_fini( +ef10_mcdi_fini( __in efx_nic_t *enp) { efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip); @@ -132,7 +133,7 @@ hunt_mcdi_fini( } void -hunt_mcdi_request_copyin( +ef10_mcdi_request_copyin( __in efx_nic_t *enp, __in efx_mcdi_req_t *emrp, __in unsigned int seq, @@ -148,7 +149,8 @@ hunt_mcdi_request_copyin( unsigned int pos; size_t offset; - EFSYS_ASSERT3U(enp->en_family, ==, EFX_FAMILY_HUNTINGTON); + EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON || + enp->en_family == EFX_FAMILY_MEDFORD); xflags = 0; if (ev_cpl) @@ -225,7 +227,7 @@ hunt_mcdi_request_copyin( } void -hunt_mcdi_request_copyout( +ef10_mcdi_request_copyout( __in efx_nic_t *enp, __in efx_mcdi_req_t *emrp) { @@ -241,13 +243,13 @@ hunt_mcdi_request_copyout( /* Read the command header to detect MCDI response format */ hdr_len = sizeof (hdr[0]); - hunt_mcdi_read_response(enp, &hdr[0], 0, hdr_len); + ef10_mcdi_read_response(enp, &hdr[0], 0, hdr_len); if (EFX_DWORD_FIELD(hdr[0], MCDI_HEADER_CODE) == MC_CMD_V2_EXTN) { /* * Read the actual payload length. The length given in the event * is only correct for responses with the V1 format. */ - hunt_mcdi_read_response(enp, &hdr[1], hdr_len, sizeof (hdr[1])); + ef10_mcdi_read_response(enp, &hdr[1], hdr_len, sizeof (hdr[1])); hdr_len += sizeof (hdr[1]); emrp->emr_out_length_used = EFX_DWORD_FIELD(hdr[1], @@ -256,7 +258,7 @@ hunt_mcdi_request_copyout( /* Copy payload out into caller supplied buffer */ bytes = MIN(emrp->emr_out_length_used, emrp->emr_out_length); - hunt_mcdi_read_response(enp, emrp->emr_out_buf, hdr_len, bytes); + ef10_mcdi_read_response(enp, emrp->emr_out_buf, hdr_len, bytes); #if EFSYS_OPT_MCDI_LOGGING if (emtp->emt_logger != NULL) { @@ -269,7 +271,7 @@ hunt_mcdi_request_copyout( } __checkReturn boolean_t -hunt_mcdi_poll_response( +ef10_mcdi_poll_response( __in efx_nic_t *enp) { const efx_mcdi_transport_t *emtp = enp->en_mcdi.em_emtp; @@ -281,7 +283,7 @@ hunt_mcdi_poll_response( } void -hunt_mcdi_read_response( +ef10_mcdi_read_response( __in efx_nic_t *enp, __out void *bufferp, __in size_t offset, @@ -300,7 +302,7 @@ hunt_mcdi_read_response( } efx_rc_t -hunt_mcdi_poll_reboot( +ef10_mcdi_poll_reboot( __in efx_nic_t *enp) { efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip); @@ -324,7 +326,7 @@ hunt_mcdi_poll_reboot( * * The Siena support for checking for MC reboot from status * flags is broken - see comments in siena_mcdi_poll_reboot(). - * As the generic MCDI code is shared the Huntington reboot + * As the generic MCDI code is shared the EF10 reboot * detection suffers similar problems. * * Do not report an error when the boot status changes until @@ -346,7 +348,7 @@ hunt_mcdi_poll_reboot( } __checkReturn efx_rc_t -hunt_mcdi_feature_supported( +ef10_mcdi_feature_supported( __in efx_nic_t *enp, __in efx_mcdi_feature_id_t id, __out boolean_t *supportedp) @@ -355,7 +357,8 @@ hunt_mcdi_feature_supported( uint32_t privilege_mask = encp->enc_privilege_mask; efx_rc_t rc; - EFSYS_ASSERT3U(enp->en_family, ==, EFX_FAMILY_HUNTINGTON); + EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON || + enp->en_family == EFX_FAMILY_MEDFORD); /* * Use privilege mask state at MCDI attach. @@ -417,4 +420,4 @@ hunt_mcdi_feature_supported( #endif /* EFSYS_OPT_MCDI */ -#endif /* EFSYS_OPT_HUNTINGTON */ +#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */ From dae248ee46bb0c2bb37176d7fcd9f187a4f89341 Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Tue, 12 Jan 2016 13:42:27 +0000 Subject: [PATCH 34/82] sfxge: remove obsolete common code PKTFILTER module The pktfilter module has been obsolete for some time, as it was replaced by newer features in filter module. With the removal of the storport driver, this module has no users and can be removed. Submitted by: Andy Moreton Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D4875 --- sys/dev/sfxge/common/efsys.h | 1 - sys/dev/sfxge/common/efx.h | 25 ------------------------- sys/dev/sfxge/common/efx_check.h | 9 +++------ sys/dev/sfxge/common/efx_impl.h | 11 ----------- sys/dev/sfxge/common/hunt_impl.h | 20 -------------------- 5 files changed, 3 insertions(+), 63 deletions(-) diff --git a/sys/dev/sfxge/common/efsys.h b/sys/dev/sfxge/common/efsys.h index a3980ff191df..b3013dce89ce 100644 --- a/sys/dev/sfxge/common/efsys.h +++ b/sys/dev/sfxge/common/efsys.h @@ -287,7 +287,6 @@ sfxge_map_mbuf_fast(bus_dma_tag_t tag, bus_dmamap_t map, #define EFSYS_OPT_RX_SCALE 1 #define EFSYS_OPT_QSTATS 1 #define EFSYS_OPT_FILTER 1 -#define EFSYS_OPT_MCAST_FILTER_LIST 1 #define EFSYS_OPT_RX_SCATTER 0 #define EFSYS_OPT_RX_HDR_SPLIT 0 diff --git a/sys/dev/sfxge/common/efx.h b/sys/dev/sfxge/common/efx.h index d6e55acc79ce..7eee1c3bc1d8 100644 --- a/sys/dev/sfxge/common/efx.h +++ b/sys/dev/sfxge/common/efx.h @@ -507,36 +507,11 @@ efx_mac_fcntl_get( #define EFX_MAC_HASH_BITS (1 << 8) -extern __checkReturn efx_rc_t -efx_pktfilter_init( - __in efx_nic_t *enp); - -extern void -efx_pktfilter_fini( - __in efx_nic_t *enp); - -extern __checkReturn efx_rc_t -efx_pktfilter_set( - __in efx_nic_t *enp, - __in boolean_t unicst, - __in boolean_t brdcst); - extern __checkReturn efx_rc_t efx_mac_hash_set( __in efx_nic_t *enp, __in_ecount(EFX_MAC_HASH_BITS) unsigned int const *bucket); -#if EFSYS_OPT_MCAST_FILTER_LIST -extern __checkReturn efx_rc_t -efx_pktfilter_mcast_list_set( - __in efx_nic_t *enp, - __in uint8_t const *addrs, - __in int count); -#endif /* EFSYS_OPT_MCAST_FILTER_LIST */ - -extern __checkReturn efx_rc_t -efx_pktfilter_mcast_all( - __in efx_nic_t *enp); #if EFSYS_OPT_MAC_STATS diff --git a/sys/dev/sfxge/common/efx_check.h b/sys/dev/sfxge/common/efx_check.h index f84bd7d36584..80119c5cf451 100644 --- a/sys/dev/sfxge/common/efx_check.h +++ b/sys/dev/sfxge/common/efx_check.h @@ -397,12 +397,9 @@ # endif #endif /* EFSYS_OPT_WOL */ -/* Support calculating multicast pktfilter in common code */ -#if EFSYS_OPT_MCAST_FILTER_LIST -# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \ - EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) -# error "MCAST_FILTER_LIST requires FALCON or SIENA or HUNTINGTON or MEDFORD" -# endif +/* Obsolete option */ +#ifdef EFSYS_OPT_MCAST_FILTER_LIST +# error "MCAST_FILTER_LIST is obsolete and not supported" #endif /* EFSYS_OPT_MCAST_FILTER_LIST */ /* Support BIST */ diff --git a/sys/dev/sfxge/common/efx_impl.h b/sys/dev/sfxge/common/efx_impl.h index a78e28b708c0..0aba6f6e0f44 100644 --- a/sys/dev/sfxge/common/efx_impl.h +++ b/sys/dev/sfxge/common/efx_impl.h @@ -266,16 +266,6 @@ efx_filter_reconfigure( #endif /* EFSYS_OPT_FILTER */ -typedef struct efx_pktfilter_ops_s { - efx_rc_t (*epfo_set)(efx_nic_t *, - boolean_t unicst, - boolean_t brdcast); -#if EFSYS_OPT_MCAST_FILTER_LIST - efx_rc_t (*epfo_mcast_list_set)(efx_nic_t *, - uint8_t const *addrs, int count); -#endif /* EFSYS_OPT_MCAST_FILTER_LIST */ - efx_rc_t (*epfo_mcast_all)(efx_nic_t *); -} efx_pktfilter_ops_t; typedef struct efx_port_s { efx_mac_type_t ep_mac_type; @@ -624,7 +614,6 @@ struct efx_nic_s { efx_filter_t en_filter; efx_filter_ops_t *en_efop; #endif /* EFSYS_OPT_FILTER */ - efx_pktfilter_ops_t *en_epfop; #if EFSYS_OPT_MCDI efx_mcdi_t en_mcdi; #endif /* EFSYS_OPT_MCDI */ diff --git a/sys/dev/sfxge/common/hunt_impl.h b/sys/dev/sfxge/common/hunt_impl.h index c0b727097992..cb5f3b4d4931 100644 --- a/sys/dev/sfxge/common/hunt_impl.h +++ b/sys/dev/sfxge/common/hunt_impl.h @@ -1007,26 +1007,6 @@ hunt_filter_default_rxq_clear( #endif /* EFSYS_OPT_FILTER */ -extern __checkReturn efx_rc_t -hunt_pktfilter_set( - __in efx_nic_t *enp, - __in boolean_t unicst, - __in boolean_t brdcst); - -#if EFSYS_OPT_MCAST_FILTER_LIST - -extern __checkReturn efx_rc_t -hunt_pktfilter_mcast_set( - __in efx_nic_t *enp, - __in uint8_t const *addrs, - __in int count); - -#endif /* EFSYS_OPT_MCAST_FILTER_LIST */ - -extern __checkReturn efx_rc_t -hunt_pktfilter_mcast_all( - __in efx_nic_t *enp); - extern __checkReturn efx_rc_t efx_mcdi_get_function_info( __in efx_nic_t *enp, From 5a2680acd413e7bc035a2743962c668dffc81f1b Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Tue, 12 Jan 2016 15:20:03 +0000 Subject: [PATCH 35/82] sfxge: remove unnecessary pulling out of soft bits from RX events These bigs are changed on Medford. Submitted by: Mark Spender Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D4876 --- sys/dev/sfxge/common/hunt_ev.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/sys/dev/sfxge/common/hunt_ev.c b/sys/dev/sfxge/common/hunt_ev.c index c0a5b4f448e5..4742cbf61384 100644 --- a/sys/dev/sfxge/common/hunt_ev.c +++ b/sys/dev/sfxge/common/hunt_ev.c @@ -499,7 +499,6 @@ ef10_ev_rx( uint32_t l3_class; uint32_t l4_class; uint32_t next_read_lbits; - boolean_t soft1, soft2; uint16_t flags; boolean_t should_abort; efx_evq_rxq_state_t *eersp; @@ -561,10 +560,6 @@ ef10_ev_rx( flags |= EFX_DISCARD; } - /* FIXME: do we need soft bits from RXDP firmware ? */ - soft1 = (EFX_QWORD_FIELD(*eqp, ESF_DZ_RX_EV_SOFT1) != 0); - soft2 = (EFX_QWORD_FIELD(*eqp, ESF_DZ_RX_EV_SOFT2) != 0); - mcast = EFX_QWORD_FIELD(*eqp, ESF_DZ_RX_MAC_CLASS); if (mcast == ESE_DZ_MAC_CLASS_UCAST) flags |= EFX_PKT_UNICAST; From 8b286d1c57eff5c01bd86ed302526857d5763df9 Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Tue, 12 Jan 2016 15:20:53 +0000 Subject: [PATCH 36/82] sfxge: add new MCDI sensors to common code Submitted by: Andy Moreton Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D4877 --- sys/dev/sfxge/common/mcdi_mon.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/dev/sfxge/common/mcdi_mon.c b/sys/dev/sfxge/common/mcdi_mon.c index e2105cdcef01..d443cbadaa8c 100644 --- a/sys/dev/sfxge/common/mcdi_mon.c +++ b/sys/dev/sfxge/common/mcdi_mon.c @@ -149,6 +149,13 @@ static const struct mcdi_sensor_map_s { STAT(Px, CONTROLLER_SLAVE_VPTAT_EXT_ADC), /* 0x46 SLAVE_VPTAT_EXT_ADC */ STAT(Px, CONTROLLER_SLAVE_INTERNAL_TEMP_EXT_ADC), /* 0x47 SLAVE_INTERNAL_TEMP_EXT_ADC */ + STAT_NO_SENSOR(), /* 0x48 (no sensor) */ + STAT(Px, SODIMM_VOUT), /* 0x49 SODIMM_VOUT */ + STAT(Px, SODIMM_0_TEMP), /* 0x4a SODIMM_0_TEMP */ + STAT(Px, SODIMM_1_TEMP), /* 0x4b SODIMM_1_TEMP */ + STAT(Px, PHY0_VCC), /* 0x4c PHY0_VCC */ + STAT(Px, PHY1_VCC), /* 0x4d PHY1_VCC */ + STAT(Px, CONTROLLER_TDIODE_TEMP), /* 0x4e CONTROLLER_TDIODE_TEMP */ }; #define MCDI_STATIC_SENSOR_ASSERT(_field) \ From 1fa702a2619693853f5cfc811ccf1790b329f50c Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Tue, 12 Jan 2016 15:21:52 +0000 Subject: [PATCH 37/82] sfxge: add definitions for compressed satellite images to common code headers Submitted by: Mark Spender Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D4878 --- sys/dev/sfxge/common/siena_flash.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sys/dev/sfxge/common/siena_flash.h b/sys/dev/sfxge/common/siena_flash.h index 51e29e71f7e4..48ddfac11b7b 100644 --- a/sys/dev/sfxge/common/siena_flash.h +++ b/sys/dev/sfxge/common/siena_flash.h @@ -91,6 +91,19 @@ typedef struct blob_hdr_s { /* GENERATED BY scripts/genfwdef */ #define BLOB_CPU_TYPE_RXDI_VTBL1 (14) #define BLOB_CPU_TYPE_TXDI_VTBL1 (15) #define BLOB_CPU_TYPE_DUMPSPEC (32) +#define BLOB_CPU_TYPE_MC_XIP (33) + +#define BLOB_CPU_TYPE_INVALID (31) + +/* + * The upper four bits of the CPU type field specify the compression + * algorithm used for this blob. + */ +#define BLOB_COMPRESSION_MASK (0xf0000000) +#define BLOB_CPU_TYPE_MASK (0x0fffffff) + +#define BLOB_COMPRESSION_NONE (0x00000000) /* Stored as is */ +#define BLOB_COMPRESSION_LZ (0x10000000) /* see lib/lzdecoder.c */ typedef struct siena_mc_boot_hdr_s { /* GENERATED BY scripts/genfwdef */ efx_dword_t magic; /* = SIENA_MC_BOOT_MAGIC */ From 1289fe72c45ccccd5e2c991977fe57feac57f7cb Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Tue, 12 Jan 2016 15:24:13 +0000 Subject: [PATCH 38/82] sfxge: rename hunt filter methods, types etc. to ef10 and use for Medford New filters types may be added, but the same machinery should be able to handle them. Submitted by: Mark Spender Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D4881 --- sys/dev/sfxge/common/efx_filter.c | 28 ++- sys/dev/sfxge/common/efx_impl.h | 6 +- sys/dev/sfxge/common/hunt_filter.c | 373 +++++++++++++++-------------- sys/dev/sfxge/common/hunt_impl.h | 70 +++--- sys/dev/sfxge/common/hunt_mac.c | 8 +- 5 files changed, 251 insertions(+), 234 deletions(-) diff --git a/sys/dev/sfxge/common/efx_filter.c b/sys/dev/sfxge/common/efx_filter.c index 9841715e317e..93cf540539bc 100644 --- a/sys/dev/sfxge/common/efx_filter.c +++ b/sys/dev/sfxge/common/efx_filter.c @@ -97,17 +97,17 @@ static efx_filter_ops_t __efx_filter_siena_ops = { }; #endif /* EFSYS_OPT_SIENA */ -#if EFSYS_OPT_HUNTINGTON -static efx_filter_ops_t __efx_filter_hunt_ops = { - hunt_filter_init, /* efo_init */ - hunt_filter_fini, /* efo_fini */ - hunt_filter_restore, /* efo_restore */ - hunt_filter_add, /* efo_add */ - hunt_filter_delete, /* efo_delete */ - hunt_filter_supported_filters, /* efo_supported_filters */ - hunt_filter_reconfigure, /* efo_reconfigure */ +#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD +static efx_filter_ops_t __efx_filter_ef10_ops = { + ef10_filter_init, /* efo_init */ + ef10_filter_fini, /* efo_fini */ + ef10_filter_restore, /* efo_restore */ + ef10_filter_add, /* efo_add */ + ef10_filter_delete, /* efo_delete */ + ef10_filter_supported_filters, /* efo_supported_filters */ + ef10_filter_reconfigure, /* efo_reconfigure */ }; -#endif /* EFSYS_OPT_HUNTINGTON */ +#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */ __checkReturn efx_rc_t efx_filter_insert( @@ -189,10 +189,16 @@ efx_filter_init( #if EFSYS_OPT_HUNTINGTON case EFX_FAMILY_HUNTINGTON: - efop = (efx_filter_ops_t *)&__efx_filter_hunt_ops; + efop = (efx_filter_ops_t *)&__efx_filter_ef10_ops; break; #endif /* EFSYS_OPT_HUNTINGTON */ +#if EFSYS_OPT_MEDFORD + case EFX_FAMILY_MEDFORD: + efop = (efx_filter_ops_t *)&__efx_filter_ef10_ops; + break; +#endif /* EFSYS_OPT_MEDFORD */ + default: EFSYS_ASSERT(0); rc = ENOTSUP; diff --git a/sys/dev/sfxge/common/efx_impl.h b/sys/dev/sfxge/common/efx_impl.h index 0aba6f6e0f44..4102e733fa2e 100644 --- a/sys/dev/sfxge/common/efx_impl.h +++ b/sys/dev/sfxge/common/efx_impl.h @@ -436,9 +436,9 @@ typedef struct efx_filter_s { #if EFSYS_OPT_FALCON || EFSYS_OPT_SIENA falconsiena_filter_t *ef_falconsiena_filter; #endif /* EFSYS_OPT_FALCON || EFSYS_OPT_SIENA */ -#if EFSYS_OPT_HUNTINGTON - hunt_filter_table_t *ef_hunt_filter_table; -#endif /* EFSYS_OPT_HUNTINGTON */ +#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD + ef10_filter_table_t *ef_ef10_filter_table; +#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */ } efx_filter_t; extern void diff --git a/sys/dev/sfxge/common/hunt_filter.c b/sys/dev/sfxge/common/hunt_filter.c index 846687db7f52..49ed0142ed06 100644 --- a/sys/dev/sfxge/common/hunt_filter.c +++ b/sys/dev/sfxge/common/hunt_filter.c @@ -41,90 +41,91 @@ __FBSDID("$FreeBSD$"); #if EFSYS_OPT_FILTER -#define HFE_SPEC(hftp, index) ((hftp)->hft_entry[(index)].hfe_spec) +#define EFE_SPEC(eftp, index) ((eftp)->eft_entry[(index)].efe_spec) static efx_filter_spec_t * -hunt_filter_entry_spec( - __in const hunt_filter_table_t *hftp, +ef10_filter_entry_spec( + __in const ef10_filter_table_t *eftp, __in unsigned int index) { - return ((efx_filter_spec_t *)(HFE_SPEC(hftp, index) & - ~(uintptr_t)EFX_HUNT_FILTER_FLAGS)); + return ((efx_filter_spec_t *)(EFE_SPEC(eftp, index) & + ~(uintptr_t)EFX_EF10_FILTER_FLAGS)); } static boolean_t -hunt_filter_entry_is_busy( - __in const hunt_filter_table_t *hftp, +ef10_filter_entry_is_busy( + __in const ef10_filter_table_t *eftp, __in unsigned int index) { - if (HFE_SPEC(hftp, index) & EFX_HUNT_FILTER_FLAG_BUSY) + if (EFE_SPEC(eftp, index) & EFX_EF10_FILTER_FLAG_BUSY) return (B_TRUE); else return (B_FALSE); } static boolean_t -hunt_filter_entry_is_auto_old( - __in const hunt_filter_table_t *hftp, +ef10_filter_entry_is_auto_old( + __in const ef10_filter_table_t *eftp, __in unsigned int index) { - if (HFE_SPEC(hftp, index) & EFX_HUNT_FILTER_FLAG_AUTO_OLD) + if (EFE_SPEC(eftp, index) & EFX_EF10_FILTER_FLAG_AUTO_OLD) return (B_TRUE); else return (B_FALSE); } static void -hunt_filter_set_entry( - __inout hunt_filter_table_t *hftp, +ef10_filter_set_entry( + __inout ef10_filter_table_t *eftp, __in unsigned int index, __in_opt const efx_filter_spec_t *efsp) { - HFE_SPEC(hftp, index) = (uintptr_t)efsp; + EFE_SPEC(eftp, index) = (uintptr_t)efsp; } static void -hunt_filter_set_entry_busy( - __inout hunt_filter_table_t *hftp, +ef10_filter_set_entry_busy( + __inout ef10_filter_table_t *eftp, __in unsigned int index) { - HFE_SPEC(hftp, index) |= (uintptr_t)EFX_HUNT_FILTER_FLAG_BUSY; + EFE_SPEC(eftp, index) |= (uintptr_t)EFX_EF10_FILTER_FLAG_BUSY; } static void -hunt_filter_set_entry_not_busy( - __inout hunt_filter_table_t *hftp, +ef10_filter_set_entry_not_busy( + __inout ef10_filter_table_t *eftp, __in unsigned int index) { - HFE_SPEC(hftp, index) &= ~(uintptr_t)EFX_HUNT_FILTER_FLAG_BUSY; + EFE_SPEC(eftp, index) &= ~(uintptr_t)EFX_EF10_FILTER_FLAG_BUSY; } static void -hunt_filter_set_entry_auto_old( - __inout hunt_filter_table_t *hftp, +ef10_filter_set_entry_auto_old( + __inout ef10_filter_table_t *eftp, __in unsigned int index) { - EFSYS_ASSERT(hunt_filter_entry_spec(hftp, index) != NULL); - HFE_SPEC(hftp, index) |= (uintptr_t)EFX_HUNT_FILTER_FLAG_AUTO_OLD; + EFSYS_ASSERT(ef10_filter_entry_spec(eftp, index) != NULL); + EFE_SPEC(eftp, index) |= (uintptr_t)EFX_EF10_FILTER_FLAG_AUTO_OLD; } static void -hunt_filter_set_entry_not_auto_old( - __inout hunt_filter_table_t *hftp, +ef10_filter_set_entry_not_auto_old( + __inout ef10_filter_table_t *eftp, __in unsigned int index) { - HFE_SPEC(hftp, index) &= ~(uintptr_t)EFX_HUNT_FILTER_FLAG_AUTO_OLD; - EFSYS_ASSERT(hunt_filter_entry_spec(hftp, index) != NULL); + EFE_SPEC(eftp, index) &= ~(uintptr_t)EFX_EF10_FILTER_FLAG_AUTO_OLD; + EFSYS_ASSERT(ef10_filter_entry_spec(eftp, index) != NULL); } __checkReturn efx_rc_t -hunt_filter_init( +ef10_filter_init( __in efx_nic_t *enp) { efx_rc_t rc; - hunt_filter_table_t *hftp; + ef10_filter_table_t *eftp; - EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON); + EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON || + enp->en_family == EFX_FAMILY_MEDFORD); #define MATCH_MASK(match) (EFX_MASK32(match) << EFX_LOW_BIT(match)) EFX_STATIC_ASSERT(EFX_FILTER_MATCH_REM_HOST == @@ -149,14 +150,14 @@ hunt_filter_init( MATCH_MASK(MC_CMD_FILTER_OP_IN_MATCH_IP_PROTO)); #undef MATCH_MASK - EFSYS_KMEM_ALLOC(enp->en_esip, sizeof (hunt_filter_table_t), hftp); + EFSYS_KMEM_ALLOC(enp->en_esip, sizeof (ef10_filter_table_t), eftp); - if (!hftp) { + if (!eftp) { rc = ENOMEM; goto fail1; } - enp->en_filter.ef_hunt_filter_table = hftp; + enp->en_filter.ef_ef10_filter_table = eftp; return (0); @@ -167,14 +168,15 @@ hunt_filter_init( } void -hunt_filter_fini( +ef10_filter_fini( __in efx_nic_t *enp) { - EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON); + EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON || + enp->en_family == EFX_FAMILY_MEDFORD); - if (enp->en_filter.ef_hunt_filter_table != NULL) { - EFSYS_KMEM_FREE(enp->en_esip, sizeof (hunt_filter_table_t), - enp->en_filter.ef_hunt_filter_table); + if (enp->en_filter.ef_ef10_filter_table != NULL) { + EFSYS_KMEM_FREE(enp->en_esip, sizeof (ef10_filter_table_t), + enp->en_filter.ef_ef10_filter_table); } } @@ -183,7 +185,7 @@ efx_mcdi_filter_op_add( __in efx_nic_t *enp, __in efx_filter_spec_t *spec, __in unsigned int filter_op, - __inout hunt_filter_handle_t *handle) + __inout ef10_filter_handle_t *handle) { efx_mcdi_req_t req; uint8_t payload[MAX(MC_CMD_FILTER_OP_IN_LEN, @@ -201,9 +203,9 @@ efx_mcdi_filter_op_add( switch (filter_op) { case MC_CMD_FILTER_OP_IN_OP_REPLACE: MCDI_IN_SET_DWORD(req, FILTER_OP_IN_HANDLE_LO, - handle->hfh_lo); + handle->efh_lo); MCDI_IN_SET_DWORD(req, FILTER_OP_IN_HANDLE_HI, - handle->hfh_hi); + handle->efh_hi); /* Fall through */ case MC_CMD_FILTER_OP_IN_OP_INSERT: case MC_CMD_FILTER_OP_IN_OP_SUBSCRIBE: @@ -302,8 +304,8 @@ efx_mcdi_filter_op_add( goto fail3; } - handle->hfh_lo = MCDI_OUT_DWORD(req, FILTER_OP_OUT_HANDLE_LO); - handle->hfh_hi = MCDI_OUT_DWORD(req, FILTER_OP_OUT_HANDLE_HI); + handle->efh_lo = MCDI_OUT_DWORD(req, FILTER_OP_OUT_HANDLE_LO); + handle->efh_hi = MCDI_OUT_DWORD(req, FILTER_OP_OUT_HANDLE_HI); return (0); @@ -322,7 +324,7 @@ static __checkReturn efx_rc_t efx_mcdi_filter_op_delete( __in efx_nic_t *enp, __in unsigned int filter_op, - __inout hunt_filter_handle_t *handle) + __inout ef10_filter_handle_t *handle) { efx_mcdi_req_t req; uint8_t payload[MAX(MC_CMD_FILTER_OP_IN_LEN, @@ -351,8 +353,8 @@ efx_mcdi_filter_op_delete( goto fail1; } - MCDI_IN_SET_DWORD(req, FILTER_OP_IN_HANDLE_LO, handle->hfh_lo); - MCDI_IN_SET_DWORD(req, FILTER_OP_IN_HANDLE_HI, handle->hfh_hi); + MCDI_IN_SET_DWORD(req, FILTER_OP_IN_HANDLE_LO, handle->efh_lo); + MCDI_IN_SET_DWORD(req, FILTER_OP_IN_HANDLE_HI, handle->efh_hi); efx_mcdi_execute(enp, &req); @@ -380,7 +382,7 @@ efx_mcdi_filter_op_delete( } static __checkReturn boolean_t -hunt_filter_equal( +ef10_filter_equal( __in const efx_filter_spec_t *left, __in const efx_filter_spec_t *right) { @@ -413,7 +415,7 @@ hunt_filter_equal( } static __checkReturn boolean_t -hunt_filter_same_dest( +ef10_filter_same_dest( __in const efx_filter_spec_t *left, __in const efx_filter_spec_t *right) { @@ -430,7 +432,7 @@ hunt_filter_same_dest( } static __checkReturn uint32_t -hunt_filter_hash( +ef10_filter_hash( __in efx_filter_spec_t *spec) { EFX_STATIC_ASSERT((sizeof (efx_filter_spec_t) % sizeof (uint32_t)) @@ -456,7 +458,7 @@ hunt_filter_hash( * exclusive. */ static __checkReturn boolean_t -hunt_filter_is_exclusive( +ef10_filter_is_exclusive( __in efx_filter_spec_t *spec) { if ((spec->efs_match_flags & EFX_FILTER_MATCH_LOC_MAC) && @@ -478,30 +480,31 @@ hunt_filter_is_exclusive( } __checkReturn efx_rc_t -hunt_filter_restore( +ef10_filter_restore( __in efx_nic_t *enp) { int tbl_id; efx_filter_spec_t *spec; - hunt_filter_table_t *hftp = enp->en_filter.ef_hunt_filter_table; + ef10_filter_table_t *eftp = enp->en_filter.ef_ef10_filter_table; boolean_t restoring; int state; efx_rc_t rc; - EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON); + EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON || + enp->en_family == EFX_FAMILY_MEDFORD); - for (tbl_id = 0; tbl_id < EFX_HUNT_FILTER_TBL_ROWS; tbl_id++) { + for (tbl_id = 0; tbl_id < EFX_EF10_FILTER_TBL_ROWS; tbl_id++) { EFSYS_LOCK(enp->en_eslp, state); - spec = hunt_filter_entry_spec(hftp, tbl_id); + spec = ef10_filter_entry_spec(eftp, tbl_id); if (spec == NULL) { restoring = B_FALSE; - } else if (hunt_filter_entry_is_busy(hftp, tbl_id)) { + } else if (ef10_filter_entry_is_busy(eftp, tbl_id)) { /* Ignore busy entries. */ restoring = B_FALSE; } else { - hunt_filter_set_entry_busy(hftp, tbl_id); + ef10_filter_set_entry_busy(eftp, tbl_id); restoring = B_TRUE; } @@ -510,14 +513,14 @@ hunt_filter_restore( if (restoring == B_FALSE) continue; - if (hunt_filter_is_exclusive(spec)) { + if (ef10_filter_is_exclusive(spec)) { rc = efx_mcdi_filter_op_add(enp, spec, MC_CMD_FILTER_OP_IN_OP_INSERT, - &hftp->hft_entry[tbl_id].hfe_handle); + &eftp->eft_entry[tbl_id].efe_handle); } else { rc = efx_mcdi_filter_op_add(enp, spec, MC_CMD_FILTER_OP_IN_OP_SUBSCRIBE, - &hftp->hft_entry[tbl_id].hfe_handle); + &eftp->eft_entry[tbl_id].efe_handle); } if (rc != 0) @@ -525,7 +528,7 @@ hunt_filter_restore( EFSYS_LOCK(enp->en_eslp, state); - hunt_filter_set_entry_not_busy(hftp, tbl_id); + ef10_filter_set_entry_not_busy(eftp, tbl_id); EFSYS_UNLOCK(enp->en_eslp, state); } @@ -542,17 +545,17 @@ hunt_filter_restore( * An arbitrary search limit for the software hash table. As per the linux net * driver. */ -#define EFX_HUNT_FILTER_SEARCH_LIMIT 200 +#define EF10_FILTER_SEARCH_LIMIT 200 static __checkReturn efx_rc_t -hunt_filter_add_internal( +ef10_filter_add_internal( __in efx_nic_t *enp, __inout efx_filter_spec_t *spec, __in boolean_t may_replace, __out_opt uint32_t *filter_id) { efx_rc_t rc; - hunt_filter_table_t *hftp = enp->en_filter.ef_hunt_filter_table; + ef10_filter_table_t *eftp = enp->en_filter.ef_ef10_filter_table; efx_filter_spec_t *saved_spec; uint32_t hash; unsigned int depth; @@ -562,13 +565,14 @@ hunt_filter_add_internal( int state; boolean_t locked = B_FALSE; - EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON); + EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON || + enp->en_family == EFX_FAMILY_MEDFORD); #if EFSYS_OPT_RX_SCALE spec->efs_rss_context = enp->en_rss_context; #endif - hash = hunt_filter_hash(spec); + hash = ef10_filter_hash(spec); /* * FIXME: Add support for inserting filters of different priorities @@ -587,21 +591,21 @@ hunt_filter_add_internal( locked = B_TRUE; for (;;) { - i = (hash + depth) & (EFX_HUNT_FILTER_TBL_ROWS - 1); - saved_spec = hunt_filter_entry_spec(hftp, i); + i = (hash + depth) & (EFX_EF10_FILTER_TBL_ROWS - 1); + saved_spec = ef10_filter_entry_spec(eftp, i); if (!saved_spec) { if (ins_index < 0) { ins_index = i; } - } else if (hunt_filter_equal(spec, saved_spec)) { - if (hunt_filter_entry_is_busy(hftp, i)) + } else if (ef10_filter_equal(spec, saved_spec)) { + if (ef10_filter_entry_is_busy(eftp, i)) break; if (saved_spec->efs_priority == EFX_FILTER_PRI_AUTO) { ins_index = i; goto found; - } else if (hunt_filter_is_exclusive(spec)) { + } else if (ef10_filter_is_exclusive(spec)) { if (may_replace) { ins_index = i; goto found; @@ -619,7 +623,7 @@ hunt_filter_add_internal( * the first suitable slot or return EBUSY if * there was none. */ - if (depth == EFX_HUNT_FILTER_SEARCH_LIMIT) { + if (depth == EF10_FILTER_SEARCH_LIMIT) { if (ins_index < 0) { rc = EBUSY; goto fail2; @@ -639,11 +643,11 @@ hunt_filter_add_internal( * insert a conflicting filter while we're waiting for the * firmware must find the busy entry. */ - saved_spec = hunt_filter_entry_spec(hftp, ins_index); + saved_spec = ef10_filter_entry_spec(eftp, ins_index); if (saved_spec) { if (saved_spec->efs_priority == EFX_FILTER_PRI_AUTO) { /* This is a filter we are refreshing */ - hunt_filter_set_entry_not_auto_old(hftp, ins_index); + ef10_filter_set_entry_not_auto_old(eftp, ins_index); goto out_unlock; } @@ -655,9 +659,9 @@ hunt_filter_add_internal( goto fail3; } *saved_spec = *spec; - hunt_filter_set_entry(hftp, ins_index, saved_spec); + ef10_filter_set_entry(eftp, ins_index, saved_spec); } - hunt_filter_set_entry_busy(hftp, ins_index); + ef10_filter_set_entry_busy(eftp, ins_index); EFSYS_UNLOCK(enp->en_eslp, state); locked = B_FALSE; @@ -669,15 +673,15 @@ hunt_filter_add_internal( if (replacing) { rc = efx_mcdi_filter_op_add(enp, spec, MC_CMD_FILTER_OP_IN_OP_REPLACE, - &hftp->hft_entry[ins_index].hfe_handle); - } else if (hunt_filter_is_exclusive(spec)) { + &eftp->eft_entry[ins_index].efe_handle); + } else if (ef10_filter_is_exclusive(spec)) { rc = efx_mcdi_filter_op_add(enp, spec, MC_CMD_FILTER_OP_IN_OP_INSERT, - &hftp->hft_entry[ins_index].hfe_handle); + &eftp->eft_entry[ins_index].efe_handle); } else { rc = efx_mcdi_filter_op_add(enp, spec, MC_CMD_FILTER_OP_IN_OP_SUBSCRIBE, - &hftp->hft_entry[ins_index].hfe_handle); + &eftp->eft_entry[ins_index].efe_handle); } if (rc != 0) @@ -694,7 +698,7 @@ hunt_filter_add_internal( saved_spec->efs_dmaq_id = spec->efs_dmaq_id; } - hunt_filter_set_entry_not_busy(hftp, ins_index); + ef10_filter_set_entry_not_busy(eftp, ins_index); out_unlock: @@ -713,8 +717,8 @@ hunt_filter_add_internal( EFSYS_KMEM_FREE(enp->en_esip, sizeof (*spec), saved_spec); saved_spec = NULL; } - hunt_filter_set_entry_not_busy(hftp, ins_index); - hunt_filter_set_entry(hftp, ins_index, NULL); + ef10_filter_set_entry_not_busy(eftp, ins_index); + ef10_filter_set_entry(eftp, ins_index, NULL); fail3: EFSYS_PROBE(fail3); @@ -732,14 +736,14 @@ hunt_filter_add_internal( } __checkReturn efx_rc_t -hunt_filter_add( +ef10_filter_add( __in efx_nic_t *enp, __inout efx_filter_spec_t *spec, __in boolean_t may_replace) { efx_rc_t rc; - rc = hunt_filter_add_internal(enp, spec, may_replace, NULL); + rc = ef10_filter_add_internal(enp, spec, may_replace, NULL); if (rc != 0) goto fail1; @@ -753,15 +757,15 @@ hunt_filter_add( static __checkReturn efx_rc_t -hunt_filter_delete_internal( +ef10_filter_delete_internal( __in efx_nic_t *enp, __in uint32_t filter_id) { efx_rc_t rc; - hunt_filter_table_t *table = enp->en_filter.ef_hunt_filter_table; + ef10_filter_table_t *table = enp->en_filter.ef_ef10_filter_table; efx_filter_spec_t *spec; int state; - uint32_t filter_idx = filter_id % EFX_HUNT_FILTER_TBL_ROWS; + uint32_t filter_idx = filter_id % EFX_EF10_FILTER_TBL_ROWS; /* * Find the software table entry and mark it busy. Don't @@ -771,13 +775,13 @@ hunt_filter_delete_internal( * FIXME: What if the busy flag is never cleared? */ EFSYS_LOCK(enp->en_eslp, state); - while (hunt_filter_entry_is_busy(table, filter_idx)) { + while (ef10_filter_entry_is_busy(table, filter_idx)) { EFSYS_UNLOCK(enp->en_eslp, state); EFSYS_SPIN(1); EFSYS_LOCK(enp->en_eslp, state); } - if ((spec = hunt_filter_entry_spec(table, filter_idx)) != NULL) { - hunt_filter_set_entry_busy(table, filter_idx); + if ((spec = ef10_filter_entry_spec(table, filter_idx)) != NULL) { + ef10_filter_set_entry_busy(table, filter_idx); } EFSYS_UNLOCK(enp->en_eslp, state); @@ -790,20 +794,20 @@ hunt_filter_delete_internal( * Try to remove the hardware filter. This may fail if the MC has * rebooted (which frees all hardware filter resources). */ - if (hunt_filter_is_exclusive(spec)) { + if (ef10_filter_is_exclusive(spec)) { rc = efx_mcdi_filter_op_delete(enp, MC_CMD_FILTER_OP_IN_OP_REMOVE, - &table->hft_entry[filter_idx].hfe_handle); + &table->eft_entry[filter_idx].efe_handle); } else { rc = efx_mcdi_filter_op_delete(enp, MC_CMD_FILTER_OP_IN_OP_UNSUBSCRIBE, - &table->hft_entry[filter_idx].hfe_handle); + &table->eft_entry[filter_idx].efe_handle); } /* Free the software table entry */ EFSYS_LOCK(enp->en_eslp, state); - hunt_filter_set_entry_not_busy(table, filter_idx); - hunt_filter_set_entry(table, filter_idx, NULL); + ef10_filter_set_entry_not_busy(table, filter_idx); + ef10_filter_set_entry(table, filter_idx, NULL); EFSYS_UNLOCK(enp->en_eslp, state); EFSYS_KMEM_FREE(enp->en_esip, sizeof (*spec), spec); @@ -824,12 +828,12 @@ hunt_filter_delete_internal( } __checkReturn efx_rc_t -hunt_filter_delete( +ef10_filter_delete( __in efx_nic_t *enp, __inout efx_filter_spec_t *spec) { efx_rc_t rc; - hunt_filter_table_t *table = enp->en_filter.ef_hunt_filter_table; + ef10_filter_table_t *table = enp->en_filter.ef_ef10_filter_table; efx_filter_spec_t *saved_spec; unsigned int hash; unsigned int depth; @@ -837,22 +841,23 @@ hunt_filter_delete( int state; boolean_t locked = B_FALSE; - EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON); + EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON || + enp->en_family == EFX_FAMILY_MEDFORD); - hash = hunt_filter_hash(spec); + hash = ef10_filter_hash(spec); EFSYS_LOCK(enp->en_eslp, state); locked = B_TRUE; depth = 1; for (;;) { - i = (hash + depth) & (EFX_HUNT_FILTER_TBL_ROWS - 1); - saved_spec = hunt_filter_entry_spec(table, i); - if (saved_spec && hunt_filter_equal(spec, saved_spec) && - hunt_filter_same_dest(spec, saved_spec)) { + i = (hash + depth) & (EFX_EF10_FILTER_TBL_ROWS - 1); + saved_spec = ef10_filter_entry_spec(table, i); + if (saved_spec && ef10_filter_equal(spec, saved_spec) && + ef10_filter_same_dest(spec, saved_spec)) { break; } - if (depth == EFX_HUNT_FILTER_SEARCH_LIMIT) { + if (depth == EF10_FILTER_SEARCH_LIMIT) { rc = ENOENT; goto fail1; } @@ -862,7 +867,7 @@ hunt_filter_delete( EFSYS_UNLOCK(enp->en_eslp, state); locked = B_FALSE; - rc = hunt_filter_delete_internal(enp, i); + rc = ef10_filter_delete_internal(enp, i); if (rc != 0) goto fail2; @@ -961,7 +966,7 @@ efx_mcdi_get_parser_disp_info( } __checkReturn efx_rc_t -hunt_filter_supported_filters( +ef10_filter_supported_filters( __in efx_nic_t *enp, __out uint32_t *list, __out size_t *length) @@ -980,13 +985,13 @@ hunt_filter_supported_filters( } static __checkReturn efx_rc_t -hunt_filter_unicast_refresh( +ef10_filter_unicast_refresh( __in efx_nic_t *enp, __in_ecount(6) uint8_t const *addr, __in boolean_t all_unicst, __in efx_filter_flag_t filter_flags) { - hunt_filter_table_t *hftp = enp->en_filter.ef_hunt_filter_table; + ef10_filter_table_t *eftp = enp->en_filter.ef_ef10_filter_table; efx_filter_spec_t spec; efx_rc_t rc; @@ -996,11 +1001,11 @@ hunt_filter_unicast_refresh( /* Insert the filter for the local station address */ efx_filter_spec_init_rx(&spec, EFX_FILTER_PRI_AUTO, filter_flags, - hftp->hft_default_rxq); + eftp->eft_default_rxq); efx_filter_spec_set_eth_local(&spec, EFX_FILTER_SPEC_VID_UNSPEC, addr); - rc = hunt_filter_add_internal(enp, &spec, B_TRUE, - &hftp->hft_unicst_filter_index); + rc = ef10_filter_add_internal(enp, &spec, B_TRUE, + &eftp->eft_unicst_filter_index); if (rc != 0) { /* * Fall back to an unknown filter. We may be able to subscribe @@ -1008,7 +1013,7 @@ hunt_filter_unicast_refresh( */ goto use_uc_def; } - hftp->hft_unicst_filter_set = B_TRUE; + eftp->eft_unicst_filter_set = B_TRUE; return (0); @@ -1016,32 +1021,32 @@ hunt_filter_unicast_refresh( /* Insert the unknown unicast filter */ efx_filter_spec_init_rx(&spec, EFX_FILTER_PRI_AUTO, filter_flags, - hftp->hft_default_rxq); + eftp->eft_default_rxq); efx_filter_spec_set_uc_def(&spec); - rc = hunt_filter_add_internal(enp, &spec, B_TRUE, - &hftp->hft_unicst_filter_index); + rc = ef10_filter_add_internal(enp, &spec, B_TRUE, + &eftp->eft_unicst_filter_index); if (rc != 0) goto fail1; - hftp->hft_unicst_filter_set = B_TRUE; + eftp->eft_unicst_filter_set = B_TRUE; return (0); fail1: EFSYS_PROBE1(fail1, efx_rc_t, rc); - if (hftp->hft_unicst_filter_set != B_FALSE) { - (void) hunt_filter_delete_internal(enp, - hftp->hft_unicst_filter_index); + if (eftp->eft_unicst_filter_set != B_FALSE) { + (void) ef10_filter_delete_internal(enp, + eftp->eft_unicst_filter_index); - hftp->hft_unicst_filter_set = B_FALSE; + eftp->eft_unicst_filter_set = B_FALSE; } return (rc); } static __checkReturn efx_rc_t -hunt_filter_multicast_refresh( +ef10_filter_multicast_refresh( __in efx_nic_t *enp, __in boolean_t mulcst, __in boolean_t all_mulcst, @@ -1050,7 +1055,7 @@ hunt_filter_multicast_refresh( __in int count, __in efx_filter_flag_t filter_flags) { - hunt_filter_table_t *hftp = enp->en_filter.ef_hunt_filter_table; + ef10_filter_table_t *eftp = enp->en_filter.ef_ef10_filter_table; efx_filter_spec_t spec; uint8_t addr[6]; unsigned i; @@ -1063,25 +1068,25 @@ hunt_filter_multicast_refresh( count = 0; if (count + (brdcst ? 1 : 0) > - EFX_ARRAY_SIZE(hftp->hft_mulcst_filter_indexes)) { + EFX_ARRAY_SIZE(eftp->eft_mulcst_filter_indexes)) { /* Too many MAC addresses; use unknown multicast filter */ goto use_mc_def; } /* Insert/renew multicast address list filters */ - hftp->hft_mulcst_filter_count = count; - for (i = 0; i < hftp->hft_mulcst_filter_count; i++) { + eftp->eft_mulcst_filter_count = count; + for (i = 0; i < eftp->eft_mulcst_filter_count; i++) { efx_filter_spec_init_rx(&spec, EFX_FILTER_PRI_AUTO, filter_flags, - hftp->hft_default_rxq); + eftp->eft_default_rxq); efx_filter_spec_set_eth_local(&spec, EFX_FILTER_SPEC_VID_UNSPEC, &addrs[i * EFX_MAC_ADDR_LEN]); - rc = hunt_filter_add_internal(enp, &spec, B_TRUE, - &hftp->hft_mulcst_filter_indexes[i]); + rc = ef10_filter_add_internal(enp, &spec, B_TRUE, + &eftp->eft_mulcst_filter_indexes[i]); if (rc != 0) { /* Rollback, then use unknown multicast filter */ goto rollback; @@ -1090,18 +1095,18 @@ hunt_filter_multicast_refresh( if (brdcst == B_TRUE) { /* Insert/renew broadcast address filter */ - hftp->hft_mulcst_filter_count++; + eftp->eft_mulcst_filter_count++; efx_filter_spec_init_rx(&spec, EFX_FILTER_PRI_AUTO, filter_flags, - hftp->hft_default_rxq); + eftp->eft_default_rxq); EFX_MAC_BROADCAST_ADDR_SET(addr); efx_filter_spec_set_eth_local(&spec, EFX_FILTER_SPEC_VID_UNSPEC, addr); - rc = hunt_filter_add_internal(enp, &spec, B_TRUE, - &hftp->hft_mulcst_filter_indexes[ - hftp->hft_mulcst_filter_count - 1]); + rc = ef10_filter_add_internal(enp, &spec, B_TRUE, + &eftp->eft_mulcst_filter_indexes[ + eftp->eft_mulcst_filter_count - 1]); if (rc != 0) { /* Rollback, then use unknown multicast filter */ goto rollback; @@ -1116,24 +1121,24 @@ hunt_filter_multicast_refresh( * before inserting the unknown multicast filter. */ while (i--) { - (void) hunt_filter_delete_internal(enp, - hftp->hft_mulcst_filter_indexes[i]); + (void) ef10_filter_delete_internal(enp, + eftp->eft_mulcst_filter_indexes[i]); } - hftp->hft_mulcst_filter_count = 0; + eftp->eft_mulcst_filter_count = 0; use_mc_def: /* Insert the unknown multicast filter */ efx_filter_spec_init_rx(&spec, EFX_FILTER_PRI_AUTO, filter_flags, - hftp->hft_default_rxq); + eftp->eft_default_rxq); efx_filter_spec_set_mc_def(&spec); - rc = hunt_filter_add_internal(enp, &spec, B_TRUE, - &hftp->hft_mulcst_filter_indexes[0]); + rc = ef10_filter_add_internal(enp, &spec, B_TRUE, + &eftp->eft_mulcst_filter_indexes[0]); if (rc != 0) goto fail1; - hftp->hft_mulcst_filter_count = 1; + eftp->eft_mulcst_filter_count = 1; /* * FIXME: If brdcst == B_FALSE, add a filter to drop broadcast traffic. @@ -1192,7 +1197,7 @@ hunt_filter_get_workarounds( * still applied in this case). */ __checkReturn efx_rc_t -hunt_filter_reconfigure( +ef10_filter_reconfigure( __in efx_nic_t *enp, __in_ecount(6) uint8_t const *mac_addr, __in boolean_t all_unicst, @@ -1202,58 +1207,58 @@ hunt_filter_reconfigure( __in_ecount(6*count) uint8_t const *addrs, __in int count) { - hunt_filter_table_t *table = enp->en_filter.ef_hunt_filter_table; + ef10_filter_table_t *table = enp->en_filter.ef_ef10_filter_table; efx_filter_flag_t filter_flags; unsigned i; int all_unicst_rc; int all_mulcst_rc; efx_rc_t rc; - if (table->hft_default_rxq == NULL) { + if (table->eft_default_rxq == NULL) { /* * Filters direct traffic to the default RXQ, and so cannot be * inserted until it is available. Any currently configured * filters must be removed (ignore errors in case the MC * has rebooted, which removes hardware filters). */ - if (table->hft_unicst_filter_set != B_FALSE) { - (void) hunt_filter_delete_internal(enp, - table->hft_unicst_filter_index); - table->hft_unicst_filter_set = B_FALSE; + if (table->eft_unicst_filter_set != B_FALSE) { + (void) ef10_filter_delete_internal(enp, + table->eft_unicst_filter_index); + table->eft_unicst_filter_set = B_FALSE; } - for (i = 0; i < table->hft_mulcst_filter_count; i++) { - (void) hunt_filter_delete_internal(enp, - table->hft_mulcst_filter_indexes[i]); + for (i = 0; i < table->eft_mulcst_filter_count; i++) { + (void) ef10_filter_delete_internal(enp, + table->eft_mulcst_filter_indexes[i]); } - table->hft_mulcst_filter_count = 0; + table->eft_mulcst_filter_count = 0; return (0); } - if (table->hft_using_rss) + if (table->eft_using_rss) filter_flags = EFX_FILTER_FLAG_RX_RSS; else filter_flags = 0; /* Mark old filters which may need to be removed */ - if (table->hft_unicst_filter_set != B_FALSE) { - hunt_filter_set_entry_auto_old(table, - table->hft_unicst_filter_index); + if (table->eft_unicst_filter_set != B_FALSE) { + ef10_filter_set_entry_auto_old(table, + table->eft_unicst_filter_index); } - for (i = 0; i < table->hft_mulcst_filter_count; i++) { - hunt_filter_set_entry_auto_old(table, - table->hft_mulcst_filter_indexes[i]); + for (i = 0; i < table->eft_mulcst_filter_count; i++) { + ef10_filter_set_entry_auto_old(table, + table->eft_mulcst_filter_indexes[i]); } /* Insert or renew unicast filters */ - if ((all_unicst_rc = hunt_filter_unicast_refresh(enp, mac_addr, + if ((all_unicst_rc = ef10_filter_unicast_refresh(enp, mac_addr, all_unicst, filter_flags)) != 0) { if (all_unicst == B_FALSE) { rc = all_unicst_rc; goto fail1; } /* Retry without all_unicast flag */ - rc = hunt_filter_unicast_refresh(enp, mac_addr, + rc = ef10_filter_unicast_refresh(enp, mac_addr, B_FALSE, filter_flags); if (rc != 0) goto fail2; @@ -1272,12 +1277,14 @@ hunt_filter_reconfigure( * filters. This ensures that encp->enc_workaround_bug26807 matches the * firmware state, and that later changes to enable/disable the * workaround will result in this function seeing a reset (FLR). + * + * FIXME: On Medford mulicast chaining should always be on. */ if ((rc = hunt_filter_get_workarounds(enp)) != 0) goto fail3; /* Insert or renew multicast filters */ - if ((all_mulcst_rc = hunt_filter_multicast_refresh(enp, mulcst, + if ((all_mulcst_rc = ef10_filter_multicast_refresh(enp, mulcst, all_mulcst, brdcst, addrs, count, filter_flags)) != 0) { if (all_mulcst == B_FALSE) { @@ -1285,7 +1292,7 @@ hunt_filter_reconfigure( goto fail4; } /* Retry without all_mulcast flag */ - rc = hunt_filter_multicast_refresh(enp, mulcst, + rc = ef10_filter_multicast_refresh(enp, mulcst, B_FALSE, brdcst, addrs, count, filter_flags); if (rc != 0) @@ -1293,9 +1300,9 @@ hunt_filter_reconfigure( } /* Remove old filters which were not renewed */ - for (i = 0; i < EFX_ARRAY_SIZE(table->hft_entry); i++) { - if (hunt_filter_entry_is_auto_old(table, i)) { - (void) hunt_filter_delete_internal(enp, i); + for (i = 0; i < EFX_ARRAY_SIZE(table->eft_entry); i++) { + if (ef10_filter_entry_is_auto_old(table, i)) { + (void) ef10_filter_delete_internal(enp, i); } } @@ -1319,9 +1326,9 @@ hunt_filter_reconfigure( EFSYS_PROBE1(fail1, efx_rc_t, rc); /* Clear auto old flags */ - for (i = 0; i < EFX_ARRAY_SIZE(table->hft_entry); i++) { - if (hunt_filter_entry_is_auto_old(table, i)) { - hunt_filter_set_entry_not_auto_old(table, i); + for (i = 0; i < EFX_ARRAY_SIZE(table->eft_entry); i++) { + if (ef10_filter_entry_is_auto_old(table, i)) { + ef10_filter_set_entry_not_auto_old(table, i); } } @@ -1329,45 +1336,45 @@ hunt_filter_reconfigure( } void -hunt_filter_get_default_rxq( +ef10_filter_get_default_rxq( __in efx_nic_t *enp, __out efx_rxq_t **erpp, __out boolean_t *using_rss) { - hunt_filter_table_t *table = enp->en_filter.ef_hunt_filter_table; + ef10_filter_table_t *table = enp->en_filter.ef_ef10_filter_table; - *erpp = table->hft_default_rxq; - *using_rss = table->hft_using_rss; + *erpp = table->eft_default_rxq; + *using_rss = table->eft_using_rss; } void -hunt_filter_default_rxq_set( +ef10_filter_default_rxq_set( __in efx_nic_t *enp, __in efx_rxq_t *erp, __in boolean_t using_rss) { - hunt_filter_table_t *table = enp->en_filter.ef_hunt_filter_table; + ef10_filter_table_t *table = enp->en_filter.ef_ef10_filter_table; #if EFSYS_OPT_RX_SCALE EFSYS_ASSERT((using_rss == B_FALSE) || (enp->en_rss_context != EF10_RSS_CONTEXT_INVALID)); - table->hft_using_rss = using_rss; + table->eft_using_rss = using_rss; #else EFSYS_ASSERT(using_rss == B_FALSE); - table->hft_using_rss = B_FALSE; + table->eft_using_rss = B_FALSE; #endif - table->hft_default_rxq = erp; + table->eft_default_rxq = erp; } void -hunt_filter_default_rxq_clear( +ef10_filter_default_rxq_clear( __in efx_nic_t *enp) { - hunt_filter_table_t *table = enp->en_filter.ef_hunt_filter_table; + ef10_filter_table_t *table = enp->en_filter.ef_ef10_filter_table; - table->hft_default_rxq = NULL; - table->hft_using_rss = B_FALSE; + table->eft_default_rxq = NULL; + table->eft_using_rss = B_FALSE; } diff --git a/sys/dev/sfxge/common/hunt_impl.h b/sys/dev/sfxge/common/hunt_impl.h index cb5f3b4d4931..73f477e0612a 100644 --- a/sys/dev/sfxge/common/hunt_impl.h +++ b/sys/dev/sfxge/common/hunt_impl.h @@ -914,71 +914,75 @@ ef10_rx_fini( #if EFSYS_OPT_FILTER -typedef struct hunt_filter_handle_s { - uint32_t hfh_lo; - uint32_t hfh_hi; -} hunt_filter_handle_t; +typedef struct ef10_filter_handle_s { + uint32_t efh_lo; + uint32_t efh_hi; +} ef10_filter_handle_t; -typedef struct hunt_filter_entry_s { - uintptr_t hfe_spec; /* pointer to filter spec plus busy bit */ - hunt_filter_handle_t hfe_handle; -} hunt_filter_entry_t; +typedef struct ef10_filter_entry_s { + uintptr_t efe_spec; /* pointer to filter spec plus busy bit */ + ef10_filter_handle_t efe_handle; +} ef10_filter_entry_t; /* * BUSY flag indicates that an update is in progress. * AUTO_OLD flag is used to mark and sweep MAC packet filters. */ -#define EFX_HUNT_FILTER_FLAG_BUSY 1U -#define EFX_HUNT_FILTER_FLAG_AUTO_OLD 2U -#define EFX_HUNT_FILTER_FLAGS 3U +#define EFX_EF10_FILTER_FLAG_BUSY 1U +#define EFX_EF10_FILTER_FLAG_AUTO_OLD 2U +#define EFX_EF10_FILTER_FLAGS 3U -#define EFX_HUNT_FILTER_TBL_ROWS 8192 +/* + * Size of the hash table used by the driver. Doesn't need to be the + * same size as the hardware's table. + */ +#define EFX_EF10_FILTER_TBL_ROWS 8192 /* Allow for the broadcast address to be added to the multicast list */ -#define EFX_HUNT_FILTER_MULTICAST_FILTERS_MAX (EFX_MAC_MULTICAST_LIST_MAX + 1) +#define EFX_EF10_FILTER_MULTICAST_FILTERS_MAX (EFX_MAC_MULTICAST_LIST_MAX + 1) -typedef struct hunt_filter_table_s { - hunt_filter_entry_t hft_entry[EFX_HUNT_FILTER_TBL_ROWS]; - efx_rxq_t * hft_default_rxq; - boolean_t hft_using_rss; - uint32_t hft_unicst_filter_index; - boolean_t hft_unicst_filter_set; - uint32_t hft_mulcst_filter_indexes[ - EFX_HUNT_FILTER_MULTICAST_FILTERS_MAX]; - uint32_t hft_mulcst_filter_count; -} hunt_filter_table_t; +typedef struct ef10_filter_table_s { + ef10_filter_entry_t eft_entry[EFX_EF10_FILTER_TBL_ROWS]; + efx_rxq_t * eft_default_rxq; + boolean_t eft_using_rss; + uint32_t eft_unicst_filter_index; + boolean_t eft_unicst_filter_set; + uint32_t eft_mulcst_filter_indexes[ + EFX_EF10_FILTER_MULTICAST_FILTERS_MAX]; + uint32_t eft_mulcst_filter_count; +} ef10_filter_table_t; __checkReturn efx_rc_t -hunt_filter_init( +ef10_filter_init( __in efx_nic_t *enp); void -hunt_filter_fini( +ef10_filter_fini( __in efx_nic_t *enp); __checkReturn efx_rc_t -hunt_filter_restore( +ef10_filter_restore( __in efx_nic_t *enp); __checkReturn efx_rc_t -hunt_filter_add( +ef10_filter_add( __in efx_nic_t *enp, __inout efx_filter_spec_t *spec, __in boolean_t may_replace); __checkReturn efx_rc_t -hunt_filter_delete( +ef10_filter_delete( __in efx_nic_t *enp, __inout efx_filter_spec_t *spec); extern __checkReturn efx_rc_t -hunt_filter_supported_filters( +ef10_filter_supported_filters( __in efx_nic_t *enp, __out uint32_t *list, __out size_t *length); extern __checkReturn efx_rc_t -hunt_filter_reconfigure( +ef10_filter_reconfigure( __in efx_nic_t *enp, __in_ecount(6) uint8_t const *mac_addr, __in boolean_t all_unicst, @@ -989,19 +993,19 @@ hunt_filter_reconfigure( __in int count); extern void -hunt_filter_get_default_rxq( +ef10_filter_get_default_rxq( __in efx_nic_t *enp, __out efx_rxq_t **erpp, __out boolean_t *using_rss); extern void -hunt_filter_default_rxq_set( +ef10_filter_default_rxq_set( __in efx_nic_t *enp, __in efx_rxq_t *erp, __in boolean_t using_rss); extern void -hunt_filter_default_rxq_clear( +ef10_filter_default_rxq_clear( __in efx_nic_t *enp); diff --git a/sys/dev/sfxge/common/hunt_mac.c b/sys/dev/sfxge/common/hunt_mac.c index 5d5d26fb33a9..e93919a038a3 100644 --- a/sys/dev/sfxge/common/hunt_mac.c +++ b/sys/dev/sfxge/common/hunt_mac.c @@ -281,9 +281,9 @@ hunt_mac_filter_default_rxq_set( boolean_t old_using_rss; efx_rc_t rc; - hunt_filter_get_default_rxq(enp, &old_rxq, &old_using_rss); + ef10_filter_get_default_rxq(enp, &old_rxq, &old_using_rss); - hunt_filter_default_rxq_set(enp, erp, using_rss); + ef10_filter_default_rxq_set(enp, erp, using_rss); rc = efx_filter_reconfigure(enp, epp->ep_mac_addr, epp->ep_all_unicst, epp->ep_mulcst, @@ -299,7 +299,7 @@ hunt_mac_filter_default_rxq_set( fail1: EFSYS_PROBE1(fail1, efx_rc_t, rc); - hunt_filter_default_rxq_set(enp, old_rxq, old_using_rss); + ef10_filter_default_rxq_set(enp, old_rxq, old_using_rss); return (rc); } @@ -310,7 +310,7 @@ hunt_mac_filter_default_rxq_clear( { efx_port_t *epp = &(enp->en_port); - hunt_filter_default_rxq_clear(enp); + ef10_filter_default_rxq_clear(enp); efx_filter_reconfigure(enp, epp->ep_mac_addr, epp->ep_all_unicst, epp->ep_mulcst, From 14d6f73e33ccc6823491173c658a54b3d3373fdc Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Tue, 12 Jan 2016 15:25:03 +0000 Subject: [PATCH 39/82] sfxge: rework MCDI header version handling Submitted by: Andy Moreton Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D4882 --- sys/dev/sfxge/common/efx_mcdi.c | 3 +-- sys/dev/sfxge/common/efx_mcdi.h | 1 + sys/dev/sfxge/common/hunt_mcdi.c | 8 ++++++++ sys/dev/sfxge/common/siena_mcdi.c | 3 +++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/sys/dev/sfxge/common/efx_mcdi.c b/sys/dev/sfxge/common/efx_mcdi.c index e9912d7af957..600da9aeb1a5 100644 --- a/sys/dev/sfxge/common/efx_mcdi.c +++ b/sys/dev/sfxge/common/efx_mcdi.c @@ -643,7 +643,6 @@ efx_mcdi_ev_cpl( efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip); const efx_mcdi_transport_t *emtp = enp->en_mcdi.em_emtp; efx_mcdi_ops_t *emcop = enp->en_mcdi.em_emcop; - efx_nic_cfg_t *encp = &enp->en_nic_cfg; efx_mcdi_req_t *emrp; int state; @@ -668,7 +667,7 @@ efx_mcdi_ev_cpl( emip->emi_pending_req = NULL; EFSYS_UNLOCK(enp->en_eslp, state); - if (encp->enc_mcdi_max_payload_length > MCDI_CTL_SDU_LEN_MAX_V1) { + if (emip->emi_max_version >= 2) { /* MCDIv2 response details do not fit into an event. */ efx_mcdi_read_response_header(enp, emrp); } else { diff --git a/sys/dev/sfxge/common/efx_mcdi.h b/sys/dev/sfxge/common/efx_mcdi.h index a9a5c0917745..53f76b32d91c 100644 --- a/sys/dev/sfxge/common/efx_mcdi.h +++ b/sys/dev/sfxge/common/efx_mcdi.h @@ -69,6 +69,7 @@ struct efx_mcdi_req_s { typedef struct efx_mcdi_iface_s { unsigned int emi_port; + unsigned int emi_max_version; unsigned int emi_seq; efx_mcdi_req_t *emi_pending_req; boolean_t emi_ev_cpl; diff --git a/sys/dev/sfxge/common/hunt_mcdi.c b/sys/dev/sfxge/common/hunt_mcdi.c index 590456e7b789..d23259e70060 100644 --- a/sys/dev/sfxge/common/hunt_mcdi.c +++ b/sys/dev/sfxge/common/hunt_mcdi.c @@ -81,6 +81,7 @@ ef10_mcdi_init( __in efx_nic_t *enp, __in const efx_mcdi_transport_t *emtp) { + efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip); efsys_mem_t *esmp = emtp->emt_dma_mem; efx_dword_t dword; efx_rc_t rc; @@ -89,6 +90,13 @@ ef10_mcdi_init( enp->en_family == EFX_FAMILY_MEDFORD); EFSYS_ASSERT(enp->en_features & EFX_FEATURE_MCDI_DMA); + /* + * All EF10 firmware supports MCDIv2 and MCDIv1. + * Medford BootROM supports MCDIv2 and MCDIv1. + * Huntington BootROM supports MCDIv1 only. + */ + emip->emi_max_version = 2; + /* A host DMA buffer is required for EF10 MCDI */ if (esmp == NULL) { rc = EINVAL; diff --git a/sys/dev/sfxge/common/siena_mcdi.c b/sys/dev/sfxge/common/siena_mcdi.c index a3505989d068..cb62f6dee3a4 100644 --- a/sys/dev/sfxge/common/siena_mcdi.c +++ b/sys/dev/sfxge/common/siena_mcdi.c @@ -244,6 +244,9 @@ siena_mcdi_init( goto fail1; } + /* Siena BootROM and firmware only support MCDIv1 */ + emip->emi_max_version = 1; + /* * Wipe the atomic reboot status so subsequent MCDI requests succeed. * BOOT_STATUS is preserved so eno_nic_probe() can boot out of the From 74bb0ed8b90c6049dd588aea1a20d27c3dee6109 Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Tue, 12 Jan 2016 15:26:17 +0000 Subject: [PATCH 40/82] sfxge: remove obsolete efx_mac_hash_set() from common code This API has been replaced by efx_mac_multicast_list_set() and has no callers. Submitted by: Andy Moreton Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D4883 --- sys/dev/sfxge/common/efx.h | 7 ----- sys/dev/sfxge/common/efx_mac.c | 51 ++-------------------------------- 2 files changed, 2 insertions(+), 56 deletions(-) diff --git a/sys/dev/sfxge/common/efx.h b/sys/dev/sfxge/common/efx.h index 7eee1c3bc1d8..89404e73aae8 100644 --- a/sys/dev/sfxge/common/efx.h +++ b/sys/dev/sfxge/common/efx.h @@ -505,13 +505,6 @@ efx_mac_fcntl_get( __out unsigned int *fcntl_wantedp, __out unsigned int *fcntl_linkp); -#define EFX_MAC_HASH_BITS (1 << 8) - -extern __checkReturn efx_rc_t -efx_mac_hash_set( - __in efx_nic_t *enp, - __in_ecount(EFX_MAC_HASH_BITS) unsigned int const *bucket); - #if EFSYS_OPT_MAC_STATS diff --git a/sys/dev/sfxge/common/efx_mac.c b/sys/dev/sfxge/common/efx_mac.c index 50f9333ae274..79f8516efd91 100644 --- a/sys/dev/sfxge/common/efx_mac.c +++ b/sys/dev/sfxge/common/efx_mac.c @@ -462,55 +462,6 @@ efx_mac_fcntl_get( *fcntl_wantedp = wanted; } -/* - * FIXME: efx_mac_hash_set() should be deleted once all its callers have been - * updated to use efx_mac_multicast_list_set(). - * Then efx_port_t.ep_multicst_hash could be made Falcon/Siena specific as - * well. - */ - __checkReturn efx_rc_t -efx_mac_hash_set( - __in efx_nic_t *enp, - __in_ecount(EFX_MAC_HASH_BITS) unsigned int const *bucket) -{ - efx_port_t *epp = &(enp->en_port); - efx_mac_ops_t *emop = epp->ep_emop; - efx_oword_t old_hash[2]; - unsigned int index; - efx_rc_t rc; - - EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); - EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PORT); - - memcpy(old_hash, epp->ep_multicst_hash, sizeof (old_hash)); - - /* Set the lower 128 bits of the hash */ - EFX_ZERO_OWORD(epp->ep_multicst_hash[0]); - for (index = 0; index < 128; index++) { - if (bucket[index] != 0) - EFX_SET_OWORD_BIT(epp->ep_multicst_hash[0], index); - } - - /* Set the upper 128 bits of the hash */ - EFX_ZERO_OWORD(epp->ep_multicst_hash[1]); - for (index = 0; index < 128; index++) { - if (bucket[index + 128] != 0) - EFX_SET_OWORD_BIT(epp->ep_multicst_hash[1], index); - } - - if ((rc = emop->emo_reconfigure(enp)) != 0) - goto fail1; - - return (0); - -fail1: - EFSYS_PROBE1(fail1, efx_rc_t, rc); - - memcpy(epp->ep_multicst_hash, old_hash, sizeof (old_hash)); - - return (rc); -} - __checkReturn efx_rc_t efx_mac_multicast_list_set( __in efx_nic_t *enp, @@ -912,6 +863,8 @@ efx_mac_select( #if EFSYS_OPT_FALCON || EFSYS_OPT_SIENA +#define EFX_MAC_HASH_BITS (1 << 8) + /* Compute the multicast hash as used on Falcon and Siena. */ static void falconsiena_mac_multicast_hash_compute( From 3d385f4e515bdd75b82123d4240325d0045db2b1 Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Tue, 12 Jan 2016 15:27:11 +0000 Subject: [PATCH 41/82] sfxge: cleanup: improve consistency in efx_check.h Make error messages consistent, and remove redundant checks. Submitted by: Andy Moreton Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D4884 --- sys/dev/sfxge/common/efx_check.h | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/sys/dev/sfxge/common/efx_check.h b/sys/dev/sfxge/common/efx_check.h index 80119c5cf451..eab4f4b191d2 100644 --- a/sys/dev/sfxge/common/efx_check.h +++ b/sys/dev/sfxge/common/efx_check.h @@ -61,9 +61,6 @@ /* Decode fatal errors */ #if EFSYS_OPT_DECODE_INTR_FATAL # if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA) -# if (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) -# error "INTR_FATAL not supported on HUNTINGTON or MEDFORD" -# endif # error "INTR_FATAL requires FALCON or SIENA" # endif #endif /* EFSYS_OPT_DECODE_INTR_FATAL */ @@ -138,9 +135,6 @@ /* Support management controller messages */ #if EFSYS_OPT_MCDI # if !(EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) -# if EFSYS_OPT_FALCON -# error "MCDI not supported on FALCON" -# endif # error "MCDI requires SIENA or HUNTINGTON or MEDFORD" # endif #endif /* EFSYS_OPT_MCDI */ @@ -186,14 +180,14 @@ # endif #endif /* EFSYS_OPT_MON_NULL */ -/* Support Siena monitor */ +/* Obsolete option */ #ifdef EFSYS_OPT_MON_SIENA -# error "MON_SIENA is obsolete use MON_MCDI" +# error "MON_SIENA is obsolete (replaced by MON_MCDI)." #endif /* EFSYS_OPT_MON_SIENA*/ -/* Support Huntington monitor */ +/* Obsolete option */ #ifdef EFSYS_OPT_MON_HUNTINGTON -# error "MON_HUNTINGTON is obsolete use MON_MCDI" +# error "MON_HUNTINGTON is obsolete (replaced by MON_MCDI)." #endif /* EFSYS_OPT_MON_HUNTINGTON*/ /* Support monitor statistics (voltage/temperature) */ @@ -265,9 +259,9 @@ # endif #endif /* EFSYS_OPT_PCIE_TUNE */ -/* Support PHY BIST diagnostics */ +/* Obsolete option */ #if EFSYS_OPT_PHY_BIST -# error "PHY_BIST is obsolete. It has been replaced by the BIST option." +# error "PHY_BIST is obsolete (replaced by BIST)." #endif /* EFSYS_OPT_PHY_BIST */ /* Support PHY flags */ @@ -379,7 +373,7 @@ /* Obsolete option */ #ifdef EFSYS_OPT_STAT_NAME -# error "EFSYS_OPT_STAT_NAME is obsolete (replaced by EFSYS_OPT_NAMES)." +# error "STAT_NAME is obsolete (replaced by NAMES)." #endif /* Support PCI Vital Product Data (VPD) */ @@ -399,7 +393,7 @@ /* Obsolete option */ #ifdef EFSYS_OPT_MCAST_FILTER_LIST -# error "MCAST_FILTER_LIST is obsolete and not supported" +# error "MCAST_FILTER_LIST is obsolete and is not supported" #endif /* EFSYS_OPT_MCAST_FILTER_LIST */ /* Support BIST */ From f5969609b9417dbf50b02057d73d3561dfac6dbb Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Tue, 12 Jan 2016 15:28:10 +0000 Subject: [PATCH 42/82] sfxge: update NVRAM partition lookup for Medford Prior to Medford, option ROM config was stored with one partition per network port. Medford stores option ROM config in a single partition (as an array of configurations, one per PF). Update the EFXname /port to MCDI partition mapping for this. Submitted by: Andy Moreton Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D4885 --- sys/dev/sfxge/common/hunt_nvram.c | 95 +++++++++++++++++++++++++++---- 1 file changed, 83 insertions(+), 12 deletions(-) diff --git a/sys/dev/sfxge/common/hunt_nvram.c b/sys/dev/sfxge/common/hunt_nvram.c index 38db912bb29f..bb8f17b42c42 100644 --- a/sys/dev/sfxge/common/hunt_nvram.c +++ b/sys/dev/sfxge/common/hunt_nvram.c @@ -1509,8 +1509,6 @@ ef10_nvram_partn_set_version( #if EFSYS_OPT_NVRAM -/* FIXME: Update partition table for Medford */ - typedef struct ef10_parttbl_entry_s { unsigned int partn; unsigned int port; @@ -1518,7 +1516,7 @@ typedef struct ef10_parttbl_entry_s { } ef10_parttbl_entry_t; /* Translate EFX NVRAM types to firmware partition types */ -static ef10_parttbl_entry_t ef10_parttbl[] = { +static ef10_parttbl_entry_t hunt_parttbl[] = { {NVRAM_PARTITION_TYPE_MC_FIRMWARE, 1, EFX_NVRAM_MC_FIRMWARE}, {NVRAM_PARTITION_TYPE_MC_FIRMWARE, 2, EFX_NVRAM_MC_FIRMWARE}, {NVRAM_PARTITION_TYPE_MC_FIRMWARE, 3, EFX_NVRAM_MC_FIRMWARE}, @@ -1549,6 +1547,37 @@ static ef10_parttbl_entry_t ef10_parttbl[] = { {NVRAM_PARTITION_TYPE_FPGA_BACKUP, 4, EFX_NVRAM_FPGA_BACKUP} }; +static ef10_parttbl_entry_t medford_parttbl[] = { + {NVRAM_PARTITION_TYPE_MC_FIRMWARE, 1, EFX_NVRAM_MC_FIRMWARE}, + {NVRAM_PARTITION_TYPE_MC_FIRMWARE, 2, EFX_NVRAM_MC_FIRMWARE}, + {NVRAM_PARTITION_TYPE_MC_FIRMWARE, 3, EFX_NVRAM_MC_FIRMWARE}, + {NVRAM_PARTITION_TYPE_MC_FIRMWARE, 4, EFX_NVRAM_MC_FIRMWARE}, + {NVRAM_PARTITION_TYPE_MC_FIRMWARE_BACKUP, 1, EFX_NVRAM_MC_GOLDEN}, + {NVRAM_PARTITION_TYPE_MC_FIRMWARE_BACKUP, 2, EFX_NVRAM_MC_GOLDEN}, + {NVRAM_PARTITION_TYPE_MC_FIRMWARE_BACKUP, 3, EFX_NVRAM_MC_GOLDEN}, + {NVRAM_PARTITION_TYPE_MC_FIRMWARE_BACKUP, 4, EFX_NVRAM_MC_GOLDEN}, + {NVRAM_PARTITION_TYPE_EXPANSION_ROM, 1, EFX_NVRAM_BOOTROM}, + {NVRAM_PARTITION_TYPE_EXPANSION_ROM, 2, EFX_NVRAM_BOOTROM}, + {NVRAM_PARTITION_TYPE_EXPANSION_ROM, 3, EFX_NVRAM_BOOTROM}, + {NVRAM_PARTITION_TYPE_EXPANSION_ROM, 4, EFX_NVRAM_BOOTROM}, + {NVRAM_PARTITION_TYPE_EXPROM_CONFIG_PORT0, 1, EFX_NVRAM_BOOTROM_CFG}, + {NVRAM_PARTITION_TYPE_EXPROM_CONFIG_PORT0, 2, EFX_NVRAM_BOOTROM_CFG}, + {NVRAM_PARTITION_TYPE_EXPROM_CONFIG_PORT0, 3, EFX_NVRAM_BOOTROM_CFG}, + {NVRAM_PARTITION_TYPE_EXPROM_CONFIG_PORT0, 4, EFX_NVRAM_BOOTROM_CFG}, + {NVRAM_PARTITION_TYPE_DYNAMIC_CONFIG, 1, EFX_NVRAM_DYNAMIC_CFG}, + {NVRAM_PARTITION_TYPE_DYNAMIC_CONFIG, 2, EFX_NVRAM_DYNAMIC_CFG}, + {NVRAM_PARTITION_TYPE_DYNAMIC_CONFIG, 3, EFX_NVRAM_DYNAMIC_CFG}, + {NVRAM_PARTITION_TYPE_DYNAMIC_CONFIG, 4, EFX_NVRAM_DYNAMIC_CFG}, + {NVRAM_PARTITION_TYPE_FPGA, 1, EFX_NVRAM_FPGA}, + {NVRAM_PARTITION_TYPE_FPGA, 2, EFX_NVRAM_FPGA}, + {NVRAM_PARTITION_TYPE_FPGA, 3, EFX_NVRAM_FPGA}, + {NVRAM_PARTITION_TYPE_FPGA, 4, EFX_NVRAM_FPGA}, + {NVRAM_PARTITION_TYPE_FPGA_BACKUP, 1, EFX_NVRAM_FPGA_BACKUP}, + {NVRAM_PARTITION_TYPE_FPGA_BACKUP, 2, EFX_NVRAM_FPGA_BACKUP}, + {NVRAM_PARTITION_TYPE_FPGA_BACKUP, 3, EFX_NVRAM_FPGA_BACKUP}, + {NVRAM_PARTITION_TYPE_FPGA_BACKUP, 4, EFX_NVRAM_FPGA_BACKUP} +}; + static __checkReturn ef10_parttbl_entry_t * ef10_parttbl_entry( __in efx_nic_t *enp, @@ -1556,17 +1585,39 @@ ef10_parttbl_entry( { efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip); ef10_parttbl_entry_t *entry; - int i; + ef10_parttbl_entry_t *parttbl; + size_t parttbl_size = 0; + unsigned int i; EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES); - for (i = 0; i < EFX_ARRAY_SIZE(ef10_parttbl); i++) { - entry = &ef10_parttbl[i]; + switch (enp->en_family) { + case EFX_FAMILY_HUNTINGTON: + parttbl = hunt_parttbl; + parttbl_size = EFX_ARRAY_SIZE(hunt_parttbl); + break; - if (entry->port == emip->emi_port && entry->nvtype == type) - return (entry); + case EFX_FAMILY_MEDFORD: + parttbl = medford_parttbl; + parttbl_size = EFX_ARRAY_SIZE(medford_parttbl); + break; + + default: + EFSYS_ASSERT(B_FALSE); + goto not_found; } + if (parttbl != NULL) { + for (i = 0; i < parttbl_size; i++) { + entry = &parttbl[i]; + + if (entry->port == emip->emi_port && + entry->nvtype == type) { + return (entry); + } + } + } +not_found: return (NULL); } @@ -1579,10 +1630,12 @@ ef10_nvram_test( { efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip); ef10_parttbl_entry_t *entry; + ef10_parttbl_entry_t *parttbl; + size_t parttbl_size = 0; unsigned int npartns = 0; uint32_t *partns = NULL; size_t size; - int i; + unsigned int i; unsigned int j; efx_rc_t rc; @@ -1603,8 +1656,24 @@ ef10_nvram_test( * Iterate over the list of supported partition types * applicable to *this* port */ - for (i = 0; i < EFX_ARRAY_SIZE(ef10_parttbl); i++) { - entry = &ef10_parttbl[i]; + switch (enp->en_family) { + case EFX_FAMILY_HUNTINGTON: + parttbl = hunt_parttbl; + parttbl_size = EFX_ARRAY_SIZE(hunt_parttbl); + break; + + case EFX_FAMILY_MEDFORD: + parttbl = medford_parttbl; + parttbl_size = EFX_ARRAY_SIZE(medford_parttbl); + break; + + default: + EFSYS_ASSERT(B_FALSE); + goto fail3; + } + + for (i = 0; i < parttbl_size; i++) { + entry = &parttbl[i]; if (entry->port != emip->emi_port) continue; @@ -1613,7 +1682,7 @@ ef10_nvram_test( if (entry->partn == partns[j]) { rc = efx_mcdi_nvram_test(enp, entry->partn); if (rc != 0) - goto fail3; + goto fail4; } } } @@ -1621,6 +1690,8 @@ ef10_nvram_test( EFSYS_KMEM_FREE(enp->en_esip, size, partns); return (0); +fail4: + EFSYS_PROBE(fail3); fail3: EFSYS_PROBE(fail3); fail2: From 0c24a07e20875fba412e4a4937efbfb3dfa8fa57 Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Tue, 12 Jan 2016 15:28:59 +0000 Subject: [PATCH 43/82] sfxge: fix interrupt handling for Medford Submitted by: Andy Moreton Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D4886 --- sys/dev/sfxge/common/efx_impl.h | 4 + sys/dev/sfxge/common/efx_intr.c | 125 +++++++++++++++++++------------ sys/dev/sfxge/common/hunt_impl.h | 15 ++++ sys/dev/sfxge/common/hunt_intr.c | 42 +++++++++++ 4 files changed, 138 insertions(+), 48 deletions(-) diff --git a/sys/dev/sfxge/common/efx_impl.h b/sys/dev/sfxge/common/efx_impl.h index 4102e733fa2e..023479daa15a 100644 --- a/sys/dev/sfxge/common/efx_impl.h +++ b/sys/dev/sfxge/common/efx_impl.h @@ -342,6 +342,10 @@ typedef struct efx_intr_ops_s { void (*eio_disable)(efx_nic_t *); void (*eio_disable_unlocked)(efx_nic_t *); efx_rc_t (*eio_trigger)(efx_nic_t *, unsigned int); + void (*eio_status_line)(efx_nic_t *, boolean_t *, uint32_t *); + void (*eio_status_message)(efx_nic_t *, unsigned int, + boolean_t *); + void (*eio_fatal)(efx_nic_t *); void (*eio_fini)(efx_nic_t *); } efx_intr_ops_t; diff --git a/sys/dev/sfxge/common/efx_intr.c b/sys/dev/sfxge/common/efx_intr.c index b0eebe877d25..92eb7352d219 100644 --- a/sys/dev/sfxge/common/efx_intr.c +++ b/sys/dev/sfxge/common/efx_intr.c @@ -67,14 +67,26 @@ static void falconsiena_intr_fini( __in efx_nic_t *enp); +static void +falconsiena_intr_status_line( + __in efx_nic_t *enp, + __out boolean_t *fatalp, + __out uint32_t *qmaskp); + +static void +falconsiena_intr_status_message( + __in efx_nic_t *enp, + __in unsigned int message, + __out boolean_t *fatalp); + +static void +falconsiena_intr_fatal( + __in efx_nic_t *enp); static __checkReturn boolean_t falconsiena_intr_check_fatal( __in efx_nic_t *enp); -static void -falconsiena_intr_fatal( - __in efx_nic_t *enp); #endif /* EFSYS_OPT_FALCON || EFSYS_OPT_SIENA */ @@ -86,6 +98,9 @@ static efx_intr_ops_t __efx_intr_falcon_ops = { falconsiena_intr_disable, /* eio_disable */ falconsiena_intr_disable_unlocked, /* eio_disable_unlocked */ falconsiena_intr_trigger, /* eio_trigger */ + falconsiena_intr_status_line, /* eio_status_line */ + falconsiena_intr_status_message, /* eio_status_message */ + falconsiena_intr_fatal, /* eio_fatal */ falconsiena_intr_fini, /* eio_fini */ }; #endif /* EFSYS_OPT_FALCON */ @@ -97,6 +112,9 @@ static efx_intr_ops_t __efx_intr_siena_ops = { falconsiena_intr_disable, /* eio_disable */ falconsiena_intr_disable_unlocked, /* eio_disable_unlocked */ falconsiena_intr_trigger, /* eio_trigger */ + falconsiena_intr_status_line, /* eio_status_line */ + falconsiena_intr_status_message, /* eio_status_message */ + falconsiena_intr_fatal, /* eio_fatal */ falconsiena_intr_fini, /* eio_fini */ }; #endif /* EFSYS_OPT_SIENA */ @@ -108,6 +126,9 @@ static efx_intr_ops_t __efx_intr_ef10_ops = { ef10_intr_disable, /* eio_disable */ ef10_intr_disable_unlocked, /* eio_disable_unlocked */ ef10_intr_trigger, /* eio_trigger */ + ef10_intr_status_line, /* eio_status_line */ + ef10_intr_status_message, /* eio_status_message */ + ef10_intr_fatal, /* eio_fatal */ ef10_intr_fini, /* eio_fini */ }; #endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */ @@ -261,35 +282,12 @@ efx_intr_status_line( __out uint32_t *qmaskp) { efx_intr_t *eip = &(enp->en_intr); - efx_dword_t dword; + efx_intr_ops_t *eiop = eip->ei_eiop; EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_INTR); - /* Ensure Huntington and Falcon/Siena ISR at same location */ - EFX_STATIC_ASSERT(FR_BZ_INT_ISR0_REG_OFST == - ER_DZ_BIU_INT_ISR_REG_OFST); - - /* - * Read the queue mask and implicitly acknowledge the - * interrupt. - */ - EFX_BAR_READD(enp, FR_BZ_INT_ISR0_REG, &dword, B_FALSE); - *qmaskp = EFX_DWORD_FIELD(dword, EFX_DWORD_0); - - EFSYS_PROBE1(qmask, uint32_t, *qmaskp); - -#if EFSYS_OPT_HUNTINGTON - if (enp->en_family == EFX_FAMILY_HUNTINGTON) { - /* Huntington reports fatal errors via events */ - *fatalp = B_FALSE; - return; - } -#endif - if (*qmaskp & (1U << eip->ei_level)) - *fatalp = falconsiena_intr_check_fatal(enp); - else - *fatalp = B_FALSE; + eiop->eio_status_line(enp, fatalp, qmaskp); } void @@ -299,39 +297,25 @@ efx_intr_status_message( __out boolean_t *fatalp) { efx_intr_t *eip = &(enp->en_intr); + efx_intr_ops_t *eiop = eip->ei_eiop; EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_INTR); -#if EFSYS_OPT_HUNTINGTON - if (enp->en_family == EFX_FAMILY_HUNTINGTON) { - /* Huntington reports fatal errors via events */ - *fatalp = B_FALSE; - return; - } -#endif - if (message == eip->ei_level) - *fatalp = falconsiena_intr_check_fatal(enp); - else - *fatalp = B_FALSE; + eiop->eio_status_message(enp, message, fatalp); } void efx_intr_fatal( __in efx_nic_t *enp) { + efx_intr_t *eip = &(enp->en_intr); + efx_intr_ops_t *eiop = eip->ei_eiop; + EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_INTR); -#if EFSYS_OPT_HUNTINGTON - if (enp->en_family == EFX_FAMILY_HUNTINGTON) { - /* Huntington reports fatal errors via events */ - return; - } -#endif -#if EFSYS_OPT_FALCON || EFSYS_OPT_SIENA - falconsiena_intr_fatal(enp); -#endif + eiop->eio_fatal(enp); } @@ -514,6 +498,51 @@ falconsiena_intr_check_fatal( return (B_FALSE); } +static void +falconsiena_intr_status_line( + __in efx_nic_t *enp, + __out boolean_t *fatalp, + __out uint32_t *qmaskp) +{ + efx_intr_t *eip = &(enp->en_intr); + efx_dword_t dword; + + EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); + EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_INTR); + + /* + * Read the queue mask and implicitly acknowledge the + * interrupt. + */ + EFX_BAR_READD(enp, FR_BZ_INT_ISR0_REG, &dword, B_FALSE); + *qmaskp = EFX_DWORD_FIELD(dword, EFX_DWORD_0); + + EFSYS_PROBE1(qmask, uint32_t, *qmaskp); + + if (*qmaskp & (1U << eip->ei_level)) + *fatalp = falconsiena_intr_check_fatal(enp); + else + *fatalp = B_FALSE; +} + +static void +falconsiena_intr_status_message( + __in efx_nic_t *enp, + __in unsigned int message, + __out boolean_t *fatalp) +{ + efx_intr_t *eip = &(enp->en_intr); + + EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); + EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_INTR); + + if (message == eip->ei_level) + *fatalp = falconsiena_intr_check_fatal(enp); + else + *fatalp = B_FALSE; +} + + static void falconsiena_intr_fatal( __in efx_nic_t *enp) diff --git a/sys/dev/sfxge/common/hunt_impl.h b/sys/dev/sfxge/common/hunt_impl.h index 73f477e0612a..43bfcb652cd4 100644 --- a/sys/dev/sfxge/common/hunt_impl.h +++ b/sys/dev/sfxge/common/hunt_impl.h @@ -139,6 +139,21 @@ ef10_intr_trigger( __in efx_nic_t *enp, __in unsigned int level); + void +ef10_intr_status_line( + __in efx_nic_t *enp, + __out boolean_t *fatalp, + __out uint32_t *qmaskp); + + void +ef10_intr_status_message( + __in efx_nic_t *enp, + __in unsigned int message, + __out boolean_t *fatalp); + + void +ef10_intr_fatal( + __in efx_nic_t *enp); void ef10_intr_fini( __in efx_nic_t *enp); diff --git a/sys/dev/sfxge/common/hunt_intr.c b/sys/dev/sfxge/common/hunt_intr.c index 2033398f9ba7..6f9789f96d39 100644 --- a/sys/dev/sfxge/common/hunt_intr.c +++ b/sys/dev/sfxge/common/hunt_intr.c @@ -148,6 +148,48 @@ ef10_intr_trigger( return (rc); } + void +ef10_intr_status_line( + __in efx_nic_t *enp, + __out boolean_t *fatalp, + __out uint32_t *qmaskp) +{ + efx_dword_t dword; + + EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON || + enp->en_family == EFX_FAMILY_MEDFORD); + + /* Read the queue mask and implicitly acknowledge the interrupt. */ + EFX_BAR_READD(enp, ER_DZ_BIU_INT_ISR_REG, &dword, B_FALSE); + *qmaskp = EFX_DWORD_FIELD(dword, EFX_DWORD_0); + + EFSYS_PROBE1(qmask, uint32_t, *qmaskp); + + *fatalp = B_FALSE; +} + + void +ef10_intr_status_message( + __in efx_nic_t *enp, + __in unsigned int message, + __out boolean_t *fatalp) +{ + EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON || + enp->en_family == EFX_FAMILY_MEDFORD); + + _NOTE(ARGUNUSED(enp, message)) + + /* EF10 fatal errors are reported via events */ + *fatalp = B_FALSE; +} + + void +ef10_intr_fatal( + __in efx_nic_t *enp) +{ + /* EF10 fatal errors are reported via events */ + _NOTE(ARGUNUSED(enp)) +} void ef10_intr_fini( From 8eea4a0acb0ddca9bb3f1d65b9c53ea868057b28 Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Tue, 12 Jan 2016 15:31:20 +0000 Subject: [PATCH 44/82] sfxge: cleanup: use consistent types for NVRAM partitions Submitted by: Andy Moreton Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D4887 --- sys/dev/sfxge/common/hunt_impl.h | 14 +++++++------- sys/dev/sfxge/common/hunt_nvram.c | 16 ++++++++-------- sys/dev/sfxge/common/siena_impl.h | 16 ++++++++-------- sys/dev/sfxge/common/siena_nvram.c | 20 ++++++++++---------- sys/dev/sfxge/common/siena_vpd.c | 4 ++-- 5 files changed, 35 insertions(+), 35 deletions(-) diff --git a/sys/dev/sfxge/common/hunt_impl.h b/sys/dev/sfxge/common/hunt_impl.h index 43bfcb652cd4..c76d36efbca4 100644 --- a/sys/dev/sfxge/common/hunt_impl.h +++ b/sys/dev/sfxge/common/hunt_impl.h @@ -361,18 +361,18 @@ ef10_nvram_partn_write_segment_tlv( extern __checkReturn efx_rc_t ef10_nvram_partn_size( __in efx_nic_t *enp, - __in unsigned int partn, + __in uint32_t partn, __out size_t *sizep); extern __checkReturn efx_rc_t ef10_nvram_partn_lock( __in efx_nic_t *enp, - __in unsigned int partn); + __in uint32_t partn); extern __checkReturn efx_rc_t ef10_nvram_partn_read( __in efx_nic_t *enp, - __in unsigned int partn, + __in uint32_t partn, __in unsigned int offset, __out_bcount(size) caddr_t data, __in size_t size); @@ -380,14 +380,14 @@ ef10_nvram_partn_read( extern __checkReturn efx_rc_t ef10_nvram_partn_erase( __in efx_nic_t *enp, - __in unsigned int partn, + __in uint32_t partn, __in unsigned int offset, __in size_t size); extern __checkReturn efx_rc_t ef10_nvram_partn_write( __in efx_nic_t *enp, - __in unsigned int partn, + __in uint32_t partn, __in unsigned int offset, __out_bcount(size) caddr_t data, __in size_t size); @@ -395,7 +395,7 @@ ef10_nvram_partn_write( extern void ef10_nvram_partn_unlock( __in efx_nic_t *enp, - __in unsigned int partn); + __in uint32_t partn); #endif /* EFSYS_OPT_NVRAM || EFSYS_OPT_VPD */ @@ -457,7 +457,7 @@ ef10_nvram_rw_finish( extern __checkReturn efx_rc_t ef10_nvram_partn_set_version( __in efx_nic_t *enp, - __in unsigned int partn, + __in uint32_t partn, __in_ecount(4) uint16_t version[4]); extern __checkReturn efx_rc_t diff --git a/sys/dev/sfxge/common/hunt_nvram.c b/sys/dev/sfxge/common/hunt_nvram.c index bb8f17b42c42..0248221adbe2 100644 --- a/sys/dev/sfxge/common/hunt_nvram.c +++ b/sys/dev/sfxge/common/hunt_nvram.c @@ -1288,7 +1288,7 @@ ef10_nvram_partn_write_segment_tlv( __checkReturn efx_rc_t ef10_nvram_partn_size( __in efx_nic_t *enp, - __in unsigned int partn, + __in uint32_t partn, __out size_t *sizep) { efx_rc_t rc; @@ -1308,7 +1308,7 @@ ef10_nvram_partn_size( __checkReturn efx_rc_t ef10_nvram_partn_lock( __in efx_nic_t *enp, - __in unsigned int partn) + __in uint32_t partn) { efx_rc_t rc; @@ -1326,7 +1326,7 @@ ef10_nvram_partn_lock( __checkReturn efx_rc_t ef10_nvram_partn_read( __in efx_nic_t *enp, - __in unsigned int partn, + __in uint32_t partn, __in unsigned int offset, __out_bcount(size) caddr_t data, __in size_t size) @@ -1358,7 +1358,7 @@ ef10_nvram_partn_read( __checkReturn efx_rc_t ef10_nvram_partn_erase( __in efx_nic_t *enp, - __in unsigned int partn, + __in uint32_t partn, __in unsigned int offset, __in size_t size) { @@ -1403,7 +1403,7 @@ ef10_nvram_partn_erase( __checkReturn efx_rc_t ef10_nvram_partn_write( __in efx_nic_t *enp, - __in unsigned int partn, + __in uint32_t partn, __in unsigned int offset, __out_bcount(size) caddr_t data, __in size_t size) @@ -1457,7 +1457,7 @@ ef10_nvram_partn_write( void ef10_nvram_partn_unlock( __in efx_nic_t *enp, - __in unsigned int partn) + __in uint32_t partn) { boolean_t reboot; efx_rc_t rc; @@ -1475,7 +1475,7 @@ ef10_nvram_partn_unlock( __checkReturn efx_rc_t ef10_nvram_partn_set_version( __in efx_nic_t *enp, - __in unsigned int partn, + __in uint32_t partn, __in_ecount(4) uint16_t version[4]) { struct tlv_partition_version partn_version; @@ -1911,7 +1911,7 @@ ef10_nvram_set_version( __in_ecount(4) uint16_t version[4]) { ef10_parttbl_entry_t *entry; - unsigned int partn; + uint32_t partn; efx_rc_t rc; if ((entry = ef10_parttbl_entry(enp, type)) == NULL) { diff --git a/sys/dev/sfxge/common/siena_impl.h b/sys/dev/sfxge/common/siena_impl.h index 0433edbda922..a6afcf85a859 100644 --- a/sys/dev/sfxge/common/siena_impl.h +++ b/sys/dev/sfxge/common/siena_impl.h @@ -158,18 +158,18 @@ siena_mcdi_feature_supported( extern __checkReturn efx_rc_t siena_nvram_partn_size( __in efx_nic_t *enp, - __in unsigned int partn, + __in uint32_t partn, __out size_t *sizep); extern __checkReturn efx_rc_t siena_nvram_partn_lock( __in efx_nic_t *enp, - __in unsigned int partn); + __in uint32_t partn); extern __checkReturn efx_rc_t siena_nvram_partn_read( __in efx_nic_t *enp, - __in unsigned int partn, + __in uint32_t partn, __in unsigned int offset, __out_bcount(size) caddr_t data, __in size_t size); @@ -177,14 +177,14 @@ siena_nvram_partn_read( extern __checkReturn efx_rc_t siena_nvram_partn_erase( __in efx_nic_t *enp, - __in unsigned int partn, + __in uint32_t partn, __in unsigned int offset, __in size_t size); extern __checkReturn efx_rc_t siena_nvram_partn_write( __in efx_nic_t *enp, - __in unsigned int partn, + __in uint32_t partn, __in unsigned int offset, __out_bcount(size) caddr_t data, __in size_t size); @@ -192,12 +192,12 @@ siena_nvram_partn_write( extern void siena_nvram_partn_unlock( __in efx_nic_t *enp, - __in unsigned int partn); + __in uint32_t partn); extern __checkReturn efx_rc_t siena_nvram_get_dynamic_cfg( __in efx_nic_t *enp, - __in unsigned int index, + __in uint32_t partn, __in boolean_t vpd, __out siena_mc_dynamic_config_hdr_t **dcfgp, __out size_t *sizep); @@ -223,7 +223,7 @@ siena_nvram_size( extern __checkReturn efx_rc_t siena_nvram_get_subtype( __in efx_nic_t *enp, - __in unsigned int partn, + __in uint32_t partn, __out uint32_t *subtypep); extern __checkReturn efx_rc_t diff --git a/sys/dev/sfxge/common/siena_nvram.c b/sys/dev/sfxge/common/siena_nvram.c index ecc51952ea53..b1406ddbb57f 100644 --- a/sys/dev/sfxge/common/siena_nvram.c +++ b/sys/dev/sfxge/common/siena_nvram.c @@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$"); __checkReturn efx_rc_t siena_nvram_partn_size( __in efx_nic_t *enp, - __in unsigned int partn, + __in uint32_t partn, __out size_t *sizep) { efx_rc_t rc; @@ -72,7 +72,7 @@ siena_nvram_partn_size( __checkReturn efx_rc_t siena_nvram_partn_lock( __in efx_nic_t *enp, - __in unsigned int partn) + __in uint32_t partn) { efx_rc_t rc; @@ -91,7 +91,7 @@ siena_nvram_partn_lock( __checkReturn efx_rc_t siena_nvram_partn_read( __in efx_nic_t *enp, - __in unsigned int partn, + __in uint32_t partn, __in unsigned int offset, __out_bcount(size) caddr_t data, __in size_t size) @@ -123,7 +123,7 @@ siena_nvram_partn_read( __checkReturn efx_rc_t siena_nvram_partn_erase( __in efx_nic_t *enp, - __in unsigned int partn, + __in uint32_t partn, __in unsigned int offset, __in size_t size) { @@ -144,7 +144,7 @@ siena_nvram_partn_erase( __checkReturn efx_rc_t siena_nvram_partn_write( __in efx_nic_t *enp, - __in unsigned int partn, + __in uint32_t partn, __in unsigned int offset, __out_bcount(size) caddr_t data, __in size_t size) @@ -176,7 +176,7 @@ siena_nvram_partn_write( void siena_nvram_partn_unlock( __in efx_nic_t *enp, - __in unsigned int partn) + __in uint32_t partn) { boolean_t reboot; efx_rc_t rc; @@ -326,7 +326,7 @@ siena_nvram_size( __checkReturn efx_rc_t siena_nvram_get_dynamic_cfg( __in efx_nic_t *enp, - __in unsigned int partn, + __in uint32_t partn, __in boolean_t vpd, __out siena_mc_dynamic_config_hdr_t **dcfgp, __out size_t *sizep) @@ -455,7 +455,7 @@ siena_nvram_get_dynamic_cfg( __checkReturn efx_rc_t siena_nvram_get_subtype( __in efx_nic_t *enp, - __in unsigned int partn, + __in uint32_t partn, __out uint32_t *subtypep) { efx_mcdi_req_t req; @@ -515,8 +515,8 @@ siena_nvram_get_version( { siena_mc_dynamic_config_hdr_t *dcfg; siena_parttbl_entry_t *entry; - unsigned int dcfg_partn; - unsigned int partn; + uint32_t dcfg_partn; + uint32_t partn; unsigned int i; efx_rc_t rc; diff --git a/sys/dev/sfxge/common/siena_vpd.c b/sys/dev/sfxge/common/siena_vpd.c index df6797d2fbae..6498fdfcd341 100644 --- a/sys/dev/sfxge/common/siena_vpd.c +++ b/sys/dev/sfxge/common/siena_vpd.c @@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$"); static __checkReturn efx_rc_t siena_vpd_get_static( __in efx_nic_t *enp, - __in unsigned int partn, + __in uint32_t partn, __deref_out_bcount_opt(*sizep) caddr_t *svpdp, __out size_t *sizep) { @@ -207,7 +207,7 @@ siena_vpd_size( __out size_t *sizep) { efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip); - unsigned int partn; + uint32_t partn; efx_rc_t rc; EFSYS_ASSERT(enp->en_family == EFX_FAMILY_SIENA); From 339d7dad7ab09b5a4e6945fc4b6864be85287de3 Mon Sep 17 00:00:00 2001 From: Svatopluk Kraus Date: Tue, 12 Jan 2016 15:31:32 +0000 Subject: [PATCH 45/82] Fix local macro for early KVA allocation. Only crashdumpmap allocation was affected which is used for temporary mappings during panic dump. Approved by: kib (mentor) --- sys/arm/arm/pmap-v6-new.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/arm/arm/pmap-v6-new.c b/sys/arm/arm/pmap-v6-new.c index 5d7e5711d05c..9a756cfd94ab 100644 --- a/sys/arm/arm/pmap-v6-new.c +++ b/sys/arm/arm/pmap-v6-new.c @@ -1109,7 +1109,7 @@ pmap_bootstrap(vm_offset_t firstaddr) * mapping of pages. */ #define SYSMAP(c, p, v, n) do { \ - v = (c)pmap_preboot_reserve_pages(1); \ + v = (c)pmap_preboot_reserve_pages(n); \ p = pt2map_entry((vm_offset_t)v); \ } while (0) From 219e008793b6dea8c180bd666a6a90d60d3942f0 Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Tue, 12 Jan 2016 15:33:48 +0000 Subject: [PATCH 46/82] sfxge: pass context type and num_queues to efx_mcdi_rss_context_alloc Submitted by: Andy Moreton Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D4890 --- sys/dev/sfxge/common/hunt_rx.c | 38 +++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/sys/dev/sfxge/common/hunt_rx.c b/sys/dev/sfxge/common/hunt_rx.c index d5a38159fbd4..b0cdb52128f5 100644 --- a/sys/dev/sfxge/common/hunt_rx.c +++ b/sys/dev/sfxge/common/hunt_rx.c @@ -147,14 +147,34 @@ efx_mcdi_fini_rxq( static __checkReturn efx_rc_t efx_mcdi_rss_context_alloc( __in efx_nic_t *enp, + __in efx_rx_scale_support_t scale_support, + __in uint32_t num_queues, __out uint32_t *rss_contextp) { efx_mcdi_req_t req; uint8_t payload[MAX(MC_CMD_RSS_CONTEXT_ALLOC_IN_LEN, MC_CMD_RSS_CONTEXT_ALLOC_OUT_LEN)]; uint32_t rss_context; + uint32_t context_type; efx_rc_t rc; + if (num_queues > EFX_MAXRSS) { + rc = EINVAL; + goto fail1; + } + + switch (scale_support) { + case EFX_RX_SCALE_EXCLUSIVE: + context_type = MC_CMD_RSS_CONTEXT_ALLOC_IN_TYPE_EXCLUSIVE; + break; + case EFX_RX_SCALE_SHARED: + context_type = MC_CMD_RSS_CONTEXT_ALLOC_IN_TYPE_SHARED; + break; + default: + rc = EINVAL; + goto fail2; + } + (void) memset(payload, 0, sizeof (payload)); req.emr_cmd = MC_CMD_RSS_CONTEXT_ALLOC; req.emr_in_buf = payload; @@ -164,33 +184,36 @@ efx_mcdi_rss_context_alloc( MCDI_IN_SET_DWORD(req, RSS_CONTEXT_ALLOC_IN_UPSTREAM_PORT_ID, EVB_PORT_ID_ASSIGNED); - MCDI_IN_SET_DWORD(req, RSS_CONTEXT_ALLOC_IN_TYPE, - MC_CMD_RSS_CONTEXT_ALLOC_IN_TYPE_EXCLUSIVE); + MCDI_IN_SET_DWORD(req, RSS_CONTEXT_ALLOC_IN_TYPE, context_type); /* NUM_QUEUES is only used to validate indirection table offsets */ - MCDI_IN_SET_DWORD(req, RSS_CONTEXT_ALLOC_IN_NUM_QUEUES, 64); + MCDI_IN_SET_DWORD(req, RSS_CONTEXT_ALLOC_IN_NUM_QUEUES, num_queues); efx_mcdi_execute(enp, &req); if (req.emr_rc != 0) { rc = req.emr_rc; - goto fail1; + goto fail3; } if (req.emr_out_length_used < MC_CMD_RSS_CONTEXT_ALLOC_OUT_LEN) { rc = EMSGSIZE; - goto fail2; + goto fail4; } rss_context = MCDI_OUT_DWORD(req, RSS_CONTEXT_ALLOC_OUT_RSS_CONTEXT_ID); if (rss_context == EF10_RSS_CONTEXT_INVALID) { rc = ENOENT; - goto fail3; + goto fail5; } *rss_contextp = rss_context; return (0); +fail5: + EFSYS_PROBE(fail5); +fail4: + EFSYS_PROBE(fail4); fail3: EFSYS_PROBE(fail3); fail2: @@ -420,7 +443,8 @@ ef10_rx_init( { #if EFSYS_OPT_RX_SCALE - if (efx_mcdi_rss_context_alloc(enp, &enp->en_rss_context) == 0) { + if (efx_mcdi_rss_context_alloc(enp, EFX_RX_SCALE_EXCLUSIVE, EFX_MAXRSS, + &enp->en_rss_context) == 0) { /* * Allocated an exclusive RSS context, which allows both the * indirection table and key to be modified. From 1759d5d5e7d494ba0cd78b04e5203ecad6bfa5e9 Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Tue, 12 Jan 2016 15:35:00 +0000 Subject: [PATCH 47/82] sfxge: remove obsolete lookahead split RXQ support Submitted by: Andy Moreton Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D4891 --- sys/dev/sfxge/common/efx.h | 2 -- sys/dev/sfxge/common/efx_rx.c | 8 +------- sys/dev/sfxge/common/hunt_rx.c | 5 ----- 3 files changed, 1 insertion(+), 14 deletions(-) diff --git a/sys/dev/sfxge/common/efx.h b/sys/dev/sfxge/common/efx.h index 89404e73aae8..f7ff65d49317 100644 --- a/sys/dev/sfxge/common/efx.h +++ b/sys/dev/sfxge/common/efx.h @@ -1916,8 +1916,6 @@ efx_psuedo_hdr_pkt_length_get( typedef enum efx_rxq_type_e { EFX_RXQ_TYPE_DEFAULT, - EFX_RXQ_TYPE_SPLIT_HEADER, - EFX_RXQ_TYPE_SPLIT_PAYLOAD, EFX_RXQ_TYPE_SCATTER, EFX_RXQ_NTYPES } efx_rxq_type_t; diff --git a/sys/dev/sfxge/common/efx_rx.c b/sys/dev/sfxge/common/efx_rx.c index 48e6328b3d40..c017e3f510cf 100644 --- a/sys/dev/sfxge/common/efx_rx.c +++ b/sys/dev/sfxge/common/efx_rx.c @@ -1246,7 +1246,6 @@ falconsiena_rx_qcreate( efx_nic_cfg_t *encp = &(enp->en_nic_cfg); efx_oword_t oword; uint32_t size; - boolean_t split; boolean_t jumbo; efx_rc_t rc; @@ -1277,7 +1276,6 @@ falconsiena_rx_qcreate( switch (type) { case EFX_RXQ_TYPE_DEFAULT: - split = B_FALSE; jumbo = B_FALSE; break; @@ -1307,7 +1305,6 @@ falconsiena_rx_qcreate( rc = EINVAL; goto fail4; } - split = B_FALSE; jumbo = B_TRUE; break; #endif /* EFSYS_OPT_RX_SCATTER */ @@ -1318,10 +1315,7 @@ falconsiena_rx_qcreate( } /* Set up the new descriptor queue */ - EFX_POPULATE_OWORD_10(oword, - FRF_CZ_RX_HDR_SPLIT, split, - FRF_AZ_RX_ISCSI_DDIG_EN, 0, - FRF_AZ_RX_ISCSI_HDIG_EN, 0, + EFX_POPULATE_OWORD_7(oword, FRF_AZ_RX_DESCQ_BUF_BASE_ID, id, FRF_AZ_RX_DESCQ_EVQ_ID, eep->ee_index, FRF_AZ_RX_DESCQ_OWNER_ID, 0, diff --git a/sys/dev/sfxge/common/hunt_rx.c b/sys/dev/sfxge/common/hunt_rx.c index b0cdb52128f5..57b0c3d63991 100644 --- a/sys/dev/sfxge/common/hunt_rx.c +++ b/sys/dev/sfxge/common/hunt_rx.c @@ -739,11 +739,6 @@ ef10_rx_qcreate( disable_scatter = B_FALSE; } - /* - * Note: EFX_RXQ_TYPE_SPLIT_HEADER and EFX_RXQ_TYPE_SPLIT_PAYLOAD are - * not supported here. - */ - if ((rc = efx_mcdi_init_rxq(enp, n, eep->ee_index, label, index, esmp, disable_scatter)) != 0) goto fail3; From 16b3294e2f317d0708dc838d127f89112ab3bd30 Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Tue, 12 Jan 2016 16:21:34 +0000 Subject: [PATCH 48/82] sfxge: regenerate MCDI header Sponsored by: Solarflare Communications, Inc. MFC after: 2 days --- sys/dev/sfxge/common/efx_regs_mcdi.h | 920 +++++++++++++++++++++++++-- 1 file changed, 869 insertions(+), 51 deletions(-) diff --git a/sys/dev/sfxge/common/efx_regs_mcdi.h b/sys/dev/sfxge/common/efx_regs_mcdi.h index db8651e24164..a1d76abe4e0b 100644 --- a/sys/dev/sfxge/common/efx_regs_mcdi.h +++ b/sys/dev/sfxge/common/efx_regs_mcdi.h @@ -299,6 +299,9 @@ * have already installed filters. See the comment at * MC_CMD_WORKAROUND_BUG26807. */ #define MC_CMD_ERR_FILTERS_PRESENT 0x1014 +/* The clock whose frequency you've attempted to set set + * doesn't exist on this NIC */ +#define MC_CMD_ERR_NO_CLOCK 0x1015 #define MC_CMD_ERR_CODE_OFST 0 @@ -318,9 +321,11 @@ /* Point to the copycode entry point. */ #define SIENA_MC_BOOTROM_COPYCODE_VEC (0x800 - 3 * 0x4) #define HUNT_MC_BOOTROM_COPYCODE_VEC (0x8000 - 3 * 0x4) +#define MEDFORD_MC_BOOTROM_COPYCODE_VEC (0x10000 - 3 * 0x4) /* Points to the recovery mode entry point. */ #define SIENA_MC_BOOTROM_NOFLASH_VEC (0x800 - 2 * 0x4) #define HUNT_MC_BOOTROM_NOFLASH_VEC (0x8000 - 2 * 0x4) +#define MEDFORD_MC_BOOTROM_NOFLASH_VEC (0x10000 - 2 * 0x4) /* The command set exported by the boot ROM (MCDI v0) */ #define MC_CMD_GET_VERSION_V0_SUPPORTED_FUNCS { \ @@ -1456,9 +1461,11 @@ #define MC_CMD_FC_IN_DDR_TEST_START_B1_WIDTH 1 /* MC_CMD_FC_IN_DDR_TEST_POLL msgrequest */ -#define MC_CMD_FC_IN_DDR_TEST_POLL_LEN 8 +#define MC_CMD_FC_IN_DDR_TEST_POLL_LEN 12 #define MC_CMD_FC_IN_DDR_TEST_CMD_OFST 0 /* MC_CMD_FC_IN_DDR_TEST_HEADER_OFST 4 */ +/* Clear previous test result and prepare for restarting DDR test */ +#define MC_CMD_FC_IN_DDR_TEST_POLL_CLEAR_RESULT_FOR_DDR_TEST_OFST 8 /* MC_CMD_FC_IN_GET_ASSERT msgrequest */ #define MC_CMD_FC_IN_GET_ASSERT_LEN 4 @@ -1475,6 +1482,10 @@ #define MC_CMD_FC_IN_FPGA_BUILD_SERVICES 0x2 /* enum: Get the BSP version */ #define MC_CMD_FC_IN_FPGA_BUILD_BSP_VERSION 0x3 +/* enum: Get build register for V2 (SFA974X) */ +#define MC_CMD_FC_IN_FPGA_BUILD_BUILD_V2 0x4 +/* enum: GEt the services register for V2 (SFA974X) */ +#define MC_CMD_FC_IN_FPGA_BUILD_SERVICES_V2 0x5 /* MC_CMD_FC_IN_READ_MAP msgrequest */ #define MC_CMD_FC_IN_READ_MAP_LEN 8 @@ -1832,6 +1843,7 @@ #define MC_CMD_FC_IN_DDR_OP_OFST 4 #define MC_CMD_FC_IN_DDR_SET_SPD 0x0 /* enum */ #define MC_CMD_FC_IN_DDR_GET_STATUS 0x1 /* enum */ +#define MC_CMD_FC_IN_DDR_SET_INFO 0x2 /* enum */ #define MC_CMD_FC_IN_DDR_BANK_OFST 8 #define MC_CMD_FC_IN_DDR_BANK_B0 0x0 /* enum */ #define MC_CMD_FC_IN_DDR_BANK_B1 0x1 /* enum */ @@ -1855,6 +1867,15 @@ /* Page index of the spd data copied into MC_CMD_FC_IN_DDR_SPD */ #define MC_CMD_FC_IN_DDR_SPD_PAGE_ID_OFST 144 +/* MC_CMD_FC_IN_DDR_SET_INFO msgrequest */ +#define MC_CMD_FC_IN_DDR_SET_INFO_LEN 16 +/* MC_CMD_FC_IN_CMD_OFST 0 */ +/* MC_CMD_FC_IN_DDR_OP_OFST 4 */ +/* Affected bank */ +/* MC_CMD_FC_IN_DDR_BANK_OFST 8 */ +/* Size of DDR */ +#define MC_CMD_FC_IN_DDR_SIZE_OFST 12 + /* MC_CMD_FC_IN_DDR_GET_STATUS msgrequest */ #define MC_CMD_FC_IN_DDR_GET_STATUS_LEN 12 /* MC_CMD_FC_IN_CMD_OFST 0 */ @@ -2387,6 +2408,116 @@ #define MC_CMD_FC_OUT_FPGA_BUILD_REVISION_HIGH_LBN 0 #define MC_CMD_FC_OUT_FPGA_BUILD_REVISION_HIGH_WIDTH 16 +/* MC_CMD_FC_OUT_FPGA_BUILD_V2 msgresponse */ +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_LEN 32 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_COMPONENT_INFO_OFST 0 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_IS_APPLICATION_LBN 31 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_IS_APPLICATION_WIDTH 1 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_IS_LICENSED_LBN 30 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_IS_LICENSED_WIDTH 1 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_COMPONENT_ID_LBN 16 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_COMPONENT_ID_WIDTH 14 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_VERSION_MAJOR_LBN 12 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_VERSION_MAJOR_WIDTH 4 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_VERSION_MINOR_LBN 4 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_VERSION_MINOR_WIDTH 8 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_BUILD_NUM_LBN 0 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_BUILD_NUM_WIDTH 4 +/* Build timestamp (seconds since epoch) */ +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_TIMESTAMP_OFST 4 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_PARAMETERS_OFST 8 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_PMA_PASSTHROUGH_LBN 31 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_PMA_PASSTHROUGH_WIDTH 1 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_SODIMM2_QDR_DEF_LBN 29 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_SODIMM2_QDR_DEF_WIDTH 1 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_SODIMM1_QDR_DEF_LBN 28 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_SODIMM1_QDR_DEF_WIDTH 1 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_DDR3_ECC_ENABLED_LBN 27 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_DDR3_ECC_ENABLED_WIDTH 1 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_DISCRETE2_DDR3_DEF_LBN 26 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_DISCRETE2_DDR3_DEF_WIDTH 1 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_DISCRETE1_DDR3_DEF_LBN 25 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_DISCRETE1_DDR3_DEF_WIDTH 1 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_SODIMM2_TO_DDR3_DEF_LBN 24 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_SODIMM2_TO_DDR3_DEF_WIDTH 1 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_SODIMM1_T0_DDR3_DEF_LBN 23 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_SODIMM1_T0_DDR3_DEF_WIDTH 1 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_DISCRETE2_RLDRAM_DEF_LBN 22 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_DISCRETE2_RLDRAM_DEF_WIDTH 1 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_DISCRETE1_RLDRAM_DEF_LBN 21 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_DISCRETE1_RLDRAM_DEF_WIDTH 1 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_SODIMM2_RLDRAM_DEF_LBN 20 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_SODIMM2_RLDRAM_DEF_WIDTH 1 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_SODIMM1_RLDRAM_DEF_LBN 19 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_SODIMM1_RLDRAM_DEF_WIDTH 1 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_NIC0_3_SPEED_LBN 18 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_NIC0_3_SPEED_WIDTH 1 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_NIC0_3_SPEED_10G 0x0 /* enum */ +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_NIC0_3_SPEED_40G 0x1 /* enum */ +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_SFP4_7_SPEED_LBN 17 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_SFP4_7_SPEED_WIDTH 1 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_SFP4_7_SPEED_10G 0x0 /* enum */ +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_SFP4_7_SPEED_40G 0x1 /* enum */ +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_SFP0_3_SPEED_LBN 16 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_SFP0_3_SPEED_WIDTH 1 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_SFP0_3_SPEED_10G 0x0 /* enum */ +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_SFP0_3_SPEED_40G 0x1 /* enum */ +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_SFP7_DEF_LBN 15 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_SFP7_DEF_WIDTH 1 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_SFP6_DEF_LBN 14 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_SFP6_DEF_WIDTH 1 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_SFP5_DEF_LBN 13 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_SFP5_DEF_WIDTH 1 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_SFP4_DEF_LBN 12 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_SFP4_DEF_WIDTH 1 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_SFP3_DEF_LBN 11 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_SFP3_DEF_WIDTH 1 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_SFP2_DEF_LBN 10 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_SFP2_DEF_WIDTH 1 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_SFP1_DEF_LBN 9 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_SFP1_DEF_WIDTH 1 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_SFP0_DEF_LBN 8 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_SFP0_DEF_WIDTH 1 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_NIC3_DEF_LBN 7 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_NIC3_DEF_WIDTH 1 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_NIC2_DEF_LBN 6 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_NIC2_DEF_WIDTH 1 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_NIC1_DEF_LBN 5 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_NIC1_DEF_WIDTH 1 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_NIC0_DEF_LBN 4 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_NIC0_DEF_WIDTH 1 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_FPGA_TYPE_LBN 0 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_FPGA_TYPE_WIDTH 4 +#define MC_CMD_FC_FPGA_V2_TYPE_A3 0x0 /* enum */ +#define MC_CMD_FC_FPGA_V2_TYPE_A4 0x1 /* enum */ +#define MC_CMD_FC_FPGA_V2_TYPE_A5 0x2 /* enum */ +#define MC_CMD_FC_FPGA_V2_TYPE_A7 0x3 /* enum */ +#define MC_CMD_FC_FPGA_V2_TYPE_D3 0x8 /* enum */ +#define MC_CMD_FC_FPGA_V2_TYPE_D4 0x9 /* enum */ +#define MC_CMD_FC_FPGA_V2_TYPE_D5 0xa /* enum */ +#define MC_CMD_FC_FPGA_V2_TYPE_D7 0xb /* enum */ +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_IDENTIFIER_OFST 12 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_CHANGESET_LBN 0 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_CHANGESET_WIDTH 16 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_BUILD_FLAG_LBN 16 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_BUILD_FLAG_WIDTH 1 +/* MC_CMD_FC_FPGA_BUILD_FLAG_INTERNAL 0x0 */ +/* MC_CMD_FC_FPGA_BUILD_FLAG_RELEASE 0x1 */ +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_VERSION_HI_OFST 16 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_DEPLOYMENT_VERSION_MINOR_LBN 0 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_DEPLOYMENT_VERSION_MINOR_WIDTH 16 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_DEPLOYMENT_VERSION_MAJOR_LBN 16 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_DEPLOYMENT_VERSION_MAJOR_WIDTH 16 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_VERSION_LO_OFST 20 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_DEPLOYMENT_VERSION_BUILD_LBN 0 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_DEPLOYMENT_VERSION_BUILD_WIDTH 16 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_DEPLOYMENT_VERSION_MICRO_LBN 16 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_DEPLOYMENT_VERSION_MICRO_WIDTH 16 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_REVISION_LO_OFST 24 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_REVISION_HI_OFST 28 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_REVISION_HIGH_LBN 0 +#define MC_CMD_FC_OUT_FPGA_BUILD_V2_REVISION_HIGH_WIDTH 16 + /* MC_CMD_FC_OUT_FPGA_SERVICES msgresponse */ #define MC_CMD_FC_OUT_FPGA_SERVICES_LEN 32 #define MC_CMD_FC_OUT_FPGA_SERVICES_COMPONENT_INFO_OFST 0 @@ -2437,6 +2568,40 @@ #define MC_CMD_FC_OUT_FPGA_SERVICES_REVISION_HIGH_LBN 0 #define MC_CMD_FC_OUT_FPGA_SERVICES_REVISION_HIGH_WIDTH 16 +/* MC_CMD_FC_OUT_FPGA_SERVICES_V2 msgresponse */ +#define MC_CMD_FC_OUT_FPGA_SERVICES_V2_LEN 32 +#define MC_CMD_FC_OUT_FPGA_SERVICES_V2_COMPONENT_INFO_OFST 0 +#define MC_CMD_FC_OUT_FPGA_SERVICES_V2_IS_APPLICATION_LBN 31 +#define MC_CMD_FC_OUT_FPGA_SERVICES_V2_IS_APPLICATION_WIDTH 1 +#define MC_CMD_FC_OUT_FPGA_SERVICES_V2_IS_LICENSED_LBN 30 +#define MC_CMD_FC_OUT_FPGA_SERVICES_V2_IS_LICENSED_WIDTH 1 +#define MC_CMD_FC_OUT_FPGA_SERVICES_V2_COMPONENT_ID_LBN 16 +#define MC_CMD_FC_OUT_FPGA_SERVICES_V2_COMPONENT_ID_WIDTH 14 +#define MC_CMD_FC_OUT_FPGA_SERVICES_V2_VERSION_MAJOR_LBN 12 +#define MC_CMD_FC_OUT_FPGA_SERVICES_V2_VERSION_MAJOR_WIDTH 4 +#define MC_CMD_FC_OUT_FPGA_SERVICES_V2_VERSION_MINOR_LBN 4 +#define MC_CMD_FC_OUT_FPGA_SERVICES_V2_VERSION_MINOR_WIDTH 8 +#define MC_CMD_FC_OUT_FPGA_SERVICES_V2_BUILD_NUM_LBN 0 +#define MC_CMD_FC_OUT_FPGA_SERVICES_V2_BUILD_NUM_WIDTH 4 +/* Build timestamp (seconds since epoch) */ +#define MC_CMD_FC_OUT_FPGA_SERVICES_V2_TIMESTAMP_OFST 4 +#define MC_CMD_FC_OUT_FPGA_SERVICES_V2_PARAMETERS_OFST 8 +#define MC_CMD_FC_OUT_FPGA_SERVICES_V2_PTP_ENABLED_LBN 0 +#define MC_CMD_FC_OUT_FPGA_SERVICES_V2_PTP_ENABLED_WIDTH 1 +#define MC_CMD_FC_OUT_FPGA_SERVICES_V2_FC_FLASH_BOOTED_LBN 8 +#define MC_CMD_FC_OUT_FPGA_SERVICES_V2_FC_FLASH_BOOTED_WIDTH 1 +#define MC_CMD_FC_OUT_FPGA_SERVICES_V2_IDENTIFIER_OFST 12 +#define MC_CMD_FC_OUT_FPGA_SERVICES_V2_CHANGESET_LBN 0 +#define MC_CMD_FC_OUT_FPGA_SERVICES_V2_CHANGESET_WIDTH 16 +#define MC_CMD_FC_OUT_FPGA_SERVICES_V2_BUILD_FLAG_LBN 16 +#define MC_CMD_FC_OUT_FPGA_SERVICES_V2_BUILD_FLAG_WIDTH 1 +/* MC_CMD_FC_FPGA_BUILD_FLAG_INTERNAL 0x0 */ +/* MC_CMD_FC_FPGA_BUILD_FLAG_RELEASE 0x1 */ +#define MC_CMD_FC_OUT_FPGA_SERVICES_V2_REVISION_LO_OFST 24 +#define MC_CMD_FC_OUT_FPGA_SERVICES_V2_REVISION_HI_OFST 28 +#define MC_CMD_FC_OUT_FPGA_SERVICES_V2_REVISION_HIGH_LBN 0 +#define MC_CMD_FC_OUT_FPGA_SERVICES_V2_REVISION_HIGH_WIDTH 16 + /* MC_CMD_FC_OUT_BSP_VERSION msgresponse */ #define MC_CMD_FC_OUT_BSP_VERSION_LEN 4 /* Qsys system ID */ @@ -2718,6 +2883,9 @@ /* MC_CMD_FC_OUT_DDR_SET_SPD msgresponse */ #define MC_CMD_FC_OUT_DDR_SET_SPD_LEN 0 +/* MC_CMD_FC_OUT_DDR_SET_INFO msgresponse */ +#define MC_CMD_FC_OUT_DDR_SET_INFO_LEN 0 + /* MC_CMD_FC_OUT_DDR_GET_STATUS msgresponse */ #define MC_CMD_FC_OUT_DDR_GET_STATUS_LEN 4 #define MC_CMD_FC_OUT_DDR_GET_STATUS_FLAGS_OFST 0 @@ -3131,6 +3299,8 @@ #define MC_CMD_AOE_OUT_INFO_FPGA_VERSION_OFST 12 /* FPGA type - read from CPLD straps */ #define MC_CMD_AOE_OUT_INFO_FPGA_TYPE_OFST 16 +#define MC_CMD_AOE_OUT_INFO_FPGA_TYPE_A5_C2 0x1 /* enum */ +#define MC_CMD_AOE_OUT_INFO_FPGA_TYPE_A7_C2 0x2 /* enum */ /* FPGA state (debug) */ #define MC_CMD_AOE_OUT_INFO_FPGA_STATE_OFST 20 /* FPGA image - partition from which loaded */ @@ -3144,23 +3314,28 @@ /* Random pieces of information */ #define MC_CMD_AOE_OUT_INFO_FLAGS_OFST 32 /* enum: Power to FPGA supplied by PEG connector, not PCIe bus */ -#define MC_CMD_AOE_OUT_INFO_PEG_POWER 0x1 +#define MC_CMD_AOE_OUT_INFO_PEG_POWER 0x1 /* enum: CPLD apparently good */ -#define MC_CMD_AOE_OUT_INFO_CPLD_GOOD 0x2 +#define MC_CMD_AOE_OUT_INFO_CPLD_GOOD 0x2 /* enum: FPGA working normally */ -#define MC_CMD_AOE_OUT_INFO_FPGA_GOOD 0x4 +#define MC_CMD_AOE_OUT_INFO_FPGA_GOOD 0x4 /* enum: FPGA is powered */ -#define MC_CMD_AOE_OUT_INFO_FPGA_POWER 0x8 +#define MC_CMD_AOE_OUT_INFO_FPGA_POWER 0x8 /* enum: Board has incompatible SODIMMs fitted */ -#define MC_CMD_AOE_OUT_INFO_BAD_SODIMM 0x10 +#define MC_CMD_AOE_OUT_INFO_BAD_SODIMM 0x10 /* enum: Board has ByteBlaster connected */ -#define MC_CMD_AOE_OUT_INFO_HAS_BYTEBLASTER 0x20 -/* Revision of Modena board */ +#define MC_CMD_AOE_OUT_INFO_HAS_BYTEBLASTER 0x20 +/* enum: FPGA Boot flash has an invalid header. */ +#define MC_CMD_AOE_OUT_INFO_FPGA_BAD_BOOT_HDR 0x40 +/* enum: FPGA Application flash is accessible. */ +#define MC_CMD_AOE_OUT_INFO_FPGA_APP_FLASH_GOOD 0x80 +/* Revision of Modena and Sorrento boards. Sorrento can be R1_2 or R1_3. */ #define MC_CMD_AOE_OUT_INFO_BOARD_REVISION_OFST 36 #define MC_CMD_AOE_OUT_INFO_UNKNOWN 0x0 /* enum */ #define MC_CMD_AOE_OUT_INFO_R1_0 0x10 /* enum */ #define MC_CMD_AOE_OUT_INFO_R1_1 0x11 /* enum */ #define MC_CMD_AOE_OUT_INFO_R1_2 0x12 /* enum */ +#define MC_CMD_AOE_OUT_INFO_R1_3 0x13 /* enum */ /* Result of FC booting - not valid while a ByteBlaster is connected. */ #define MC_CMD_AOE_OUT_INFO_FC_BOOT_RESULT_OFST 40 /* enum: No error */ @@ -3931,15 +4106,30 @@ /* MC_CMD_PTP_OUT_GET_TIMESTAMP_CORRECTIONS msgresponse */ #define MC_CMD_PTP_OUT_GET_TIMESTAMP_CORRECTIONS_LEN 16 -/* Uncorrected error on transmit timestamps in NIC clock format */ +/* Uncorrected error on PTP transmit timestamps in NIC clock format */ #define MC_CMD_PTP_OUT_GET_TIMESTAMP_CORRECTIONS_TRANSMIT_OFST 0 -/* Uncorrected error on receive timestamps in NIC clock format */ +/* Uncorrected error on PTP receive timestamps in NIC clock format */ #define MC_CMD_PTP_OUT_GET_TIMESTAMP_CORRECTIONS_RECEIVE_OFST 4 /* Uncorrected error on PPS output in NIC clock format */ #define MC_CMD_PTP_OUT_GET_TIMESTAMP_CORRECTIONS_PPS_OUT_OFST 8 /* Uncorrected error on PPS input in NIC clock format */ #define MC_CMD_PTP_OUT_GET_TIMESTAMP_CORRECTIONS_PPS_IN_OFST 12 +/* MC_CMD_PTP_OUT_GET_TIMESTAMP_CORRECTIONS_V2 msgresponse */ +#define MC_CMD_PTP_OUT_GET_TIMESTAMP_CORRECTIONS_V2_LEN 24 +/* Uncorrected error on PTP transmit timestamps in NIC clock format */ +#define MC_CMD_PTP_OUT_GET_TIMESTAMP_CORRECTIONS_V2_PTP_TX_OFST 0 +/* Uncorrected error on PTP receive timestamps in NIC clock format */ +#define MC_CMD_PTP_OUT_GET_TIMESTAMP_CORRECTIONS_V2_PTP_RX_OFST 4 +/* Uncorrected error on PPS output in NIC clock format */ +#define MC_CMD_PTP_OUT_GET_TIMESTAMP_CORRECTIONS_V2_PPS_OUT_OFST 8 +/* Uncorrected error on PPS input in NIC clock format */ +#define MC_CMD_PTP_OUT_GET_TIMESTAMP_CORRECTIONS_V2_PPS_IN_OFST 12 +/* Uncorrected error on non-PTP transmit timestamps in NIC clock format */ +#define MC_CMD_PTP_OUT_GET_TIMESTAMP_CORRECTIONS_V2_GENERAL_TX_OFST 16 +/* Uncorrected error on non-PTP receive timestamps in NIC clock format */ +#define MC_CMD_PTP_OUT_GET_TIMESTAMP_CORRECTIONS_V2_GENERAL_RX_OFST 20 + /* MC_CMD_PTP_OUT_MANFTEST_PPS msgresponse */ #define MC_CMD_PTP_OUT_MANFTEST_PPS_LEN 4 /* Results of testing */ @@ -5203,7 +5393,7 @@ #define MC_CMD_SET_MAC 0x2c #undef MC_CMD_0x2c_PRIVILEGE_CTG -#define MC_CMD_0x2c_PRIVILEGE_CTG SRIOV_CTG_LINK +#define MC_CMD_0x2c_PRIVILEGE_CTG SRIOV_CTG_GENERAL /* MC_CMD_SET_MAC_IN msgrequest */ #define MC_CMD_SET_MAC_IN_LEN 28 @@ -5950,6 +6140,37 @@ /* amount to read in bytes */ #define MC_CMD_NVRAM_READ_IN_LENGTH_OFST 8 +/* MC_CMD_NVRAM_READ_IN_V2 msgrequest */ +#define MC_CMD_NVRAM_READ_IN_V2_LEN 16 +#define MC_CMD_NVRAM_READ_IN_V2_TYPE_OFST 0 +/* Enum values, see field(s): */ +/* MC_CMD_NVRAM_TYPES/MC_CMD_NVRAM_TYPES_OUT/TYPES */ +#define MC_CMD_NVRAM_READ_IN_V2_OFFSET_OFST 4 +/* amount to read in bytes */ +#define MC_CMD_NVRAM_READ_IN_V2_LENGTH_OFST 8 +/* Optional control info. If a partition is stored with an A/B versioning + * scheme (i.e. in more than one physical partition in NVRAM) the host can set + * this to control which underlying physical partition is used to read data + * from. This allows it to perform a read-modify-write-verify with the write + * lock continuously held by calling NVRAM_UPDATE_START, reading the old + * contents using MODE=TARGET_CURRENT, overwriting the old partition and then + * verifying by reading with MODE=TARGET_BACKUP. + */ +#define MC_CMD_NVRAM_READ_IN_V2_MODE_OFST 12 +/* enum: Same as omitting MODE: caller sees data in current partition unless it + * holds the write lock in which case it sees data in the partition it is + * updating. + */ +#define MC_CMD_NVRAM_READ_IN_V2_DEFAULT 0x0 +/* enum: Read from the current partition of an A/B pair, even if holding the + * write lock. + */ +#define MC_CMD_NVRAM_READ_IN_V2_TARGET_CURRENT 0x1 +/* enum: Read from the non-current (i.e. to be updated) partition of an A/B + * pair + */ +#define MC_CMD_NVRAM_READ_IN_V2_TARGET_BACKUP 0x2 + /* MC_CMD_NVRAM_READ_OUT msgresponse */ #define MC_CMD_NVRAM_READ_OUT_LENMIN 1 #define MC_CMD_NVRAM_READ_OUT_LENMAX 252 @@ -6329,6 +6550,8 @@ #define MC_CMD_SENSOR_PHY0_VCC 0x4c /* enum: Voltage supplied to the QSFP #1 from their power supply: mV */ #define MC_CMD_SENSOR_PHY1_VCC 0x4d +/* enum: Controller die temperature (TDIODE): degC */ +#define MC_CMD_SENSOR_CONTROLLER_TDIODE_TEMP 0x4e /* MC_CMD_SENSOR_INFO_ENTRY_TYPEDEF */ #define MC_CMD_SENSOR_ENTRY_OFST 4 #define MC_CMD_SENSOR_ENTRY_LEN 8 @@ -6406,7 +6629,7 @@ /* MC_CMD_READ_SENSORS_EXT_IN msgrequest */ #define MC_CMD_READ_SENSORS_EXT_IN_LEN 12 -/* DMA address of host buffer for sensor readings */ +/* DMA address of host buffer for sensor readings (must be 4Kbyte aligned). */ #define MC_CMD_READ_SENSORS_EXT_IN_DMA_ADDR_OFST 0 #define MC_CMD_READ_SENSORS_EXT_IN_DMA_ADDR_LEN 8 #define MC_CMD_READ_SENSORS_EXT_IN_DMA_ADDR_LO_OFST 0 @@ -7656,6 +7879,88 @@ #define LICENSED_APP_ID_ID_LBN 0 #define LICENSED_APP_ID_ID_WIDTH 32 +/* LICENSED_FEATURES structuredef */ +#define LICENSED_FEATURES_LEN 8 +/* Bitmask of licensed firmware features */ +#define LICENSED_FEATURES_MASK_OFST 0 +#define LICENSED_FEATURES_MASK_LEN 8 +#define LICENSED_FEATURES_MASK_LO_OFST 0 +#define LICENSED_FEATURES_MASK_HI_OFST 4 +#define LICENSED_FEATURES_RX_CUT_THROUGH_LBN 0 +#define LICENSED_FEATURES_RX_CUT_THROUGH_WIDTH 1 +#define LICENSED_FEATURES_PIO_LBN 1 +#define LICENSED_FEATURES_PIO_WIDTH 1 +#define LICENSED_FEATURES_EVQ_TIMER_LBN 2 +#define LICENSED_FEATURES_EVQ_TIMER_WIDTH 1 +#define LICENSED_FEATURES_CLOCK_LBN 3 +#define LICENSED_FEATURES_CLOCK_WIDTH 1 +#define LICENSED_FEATURES_RX_TIMESTAMPS_LBN 4 +#define LICENSED_FEATURES_RX_TIMESTAMPS_WIDTH 1 +#define LICENSED_FEATURES_TX_TIMESTAMPS_LBN 5 +#define LICENSED_FEATURES_TX_TIMESTAMPS_WIDTH 1 +#define LICENSED_FEATURES_RX_SNIFF_LBN 6 +#define LICENSED_FEATURES_RX_SNIFF_WIDTH 1 +#define LICENSED_FEATURES_TX_SNIFF_LBN 7 +#define LICENSED_FEATURES_TX_SNIFF_WIDTH 1 +#define LICENSED_FEATURES_PROXY_FILTER_OPS_LBN 8 +#define LICENSED_FEATURES_PROXY_FILTER_OPS_WIDTH 1 +#define LICENSED_FEATURES_MASK_LBN 0 +#define LICENSED_FEATURES_MASK_WIDTH 64 + +/* LICENSED_V3_APPS structuredef */ +#define LICENSED_V3_APPS_LEN 8 +/* Bitmask of licensed applications */ +#define LICENSED_V3_APPS_MASK_OFST 0 +#define LICENSED_V3_APPS_MASK_LEN 8 +#define LICENSED_V3_APPS_MASK_LO_OFST 0 +#define LICENSED_V3_APPS_MASK_HI_OFST 4 +#define LICENSED_V3_APPS_ONLOAD_LBN 0 +#define LICENSED_V3_APPS_ONLOAD_WIDTH 1 +#define LICENSED_V3_APPS_PTP_LBN 1 +#define LICENSED_V3_APPS_PTP_WIDTH 1 +#define LICENSED_V3_APPS_SOLARCAPTURE_PRO_LBN 2 +#define LICENSED_V3_APPS_SOLARCAPTURE_PRO_WIDTH 1 +#define LICENSED_V3_APPS_SOLARSECURE_LBN 3 +#define LICENSED_V3_APPS_SOLARSECURE_WIDTH 1 +#define LICENSED_V3_APPS_PERF_MONITOR_LBN 4 +#define LICENSED_V3_APPS_PERF_MONITOR_WIDTH 1 +#define LICENSED_V3_APPS_SOLARCAPTURE_LIVE_LBN 5 +#define LICENSED_V3_APPS_SOLARCAPTURE_LIVE_WIDTH 1 +#define LICENSED_V3_APPS_CAPTURE_SOLARSYSTEM_LBN 6 +#define LICENSED_V3_APPS_CAPTURE_SOLARSYSTEM_WIDTH 1 +#define LICENSED_V3_APPS_NETWORK_ACCESS_CONTROL_LBN 7 +#define LICENSED_V3_APPS_NETWORK_ACCESS_CONTROL_WIDTH 1 +#define LICENSED_V3_APPS_MASK_LBN 0 +#define LICENSED_V3_APPS_MASK_WIDTH 64 + +/* LICENSED_V3_FEATURES structuredef */ +#define LICENSED_V3_FEATURES_LEN 8 +/* Bitmask of licensed firmware features */ +#define LICENSED_V3_FEATURES_MASK_OFST 0 +#define LICENSED_V3_FEATURES_MASK_LEN 8 +#define LICENSED_V3_FEATURES_MASK_LO_OFST 0 +#define LICENSED_V3_FEATURES_MASK_HI_OFST 4 +#define LICENSED_V3_FEATURES_RX_CUT_THROUGH_LBN 0 +#define LICENSED_V3_FEATURES_RX_CUT_THROUGH_WIDTH 1 +#define LICENSED_V3_FEATURES_PIO_LBN 1 +#define LICENSED_V3_FEATURES_PIO_WIDTH 1 +#define LICENSED_V3_FEATURES_EVQ_TIMER_LBN 2 +#define LICENSED_V3_FEATURES_EVQ_TIMER_WIDTH 1 +#define LICENSED_V3_FEATURES_CLOCK_LBN 3 +#define LICENSED_V3_FEATURES_CLOCK_WIDTH 1 +#define LICENSED_V3_FEATURES_RX_TIMESTAMPS_LBN 4 +#define LICENSED_V3_FEATURES_RX_TIMESTAMPS_WIDTH 1 +#define LICENSED_V3_FEATURES_TX_TIMESTAMPS_LBN 5 +#define LICENSED_V3_FEATURES_TX_TIMESTAMPS_WIDTH 1 +#define LICENSED_V3_FEATURES_RX_SNIFF_LBN 6 +#define LICENSED_V3_FEATURES_RX_SNIFF_WIDTH 1 +#define LICENSED_V3_FEATURES_TX_SNIFF_LBN 7 +#define LICENSED_V3_FEATURES_TX_SNIFF_WIDTH 1 +#define LICENSED_V3_FEATURES_PROXY_FILTER_OPS_LBN 8 +#define LICENSED_V3_FEATURES_PROXY_FILTER_OPS_WIDTH 1 +#define LICENSED_V3_FEATURES_MASK_LBN 0 +#define LICENSED_V3_FEATURES_MASK_WIDTH 64 + /* TX_TIMESTAMP_EVENT structuredef */ #define TX_TIMESTAMP_EVENT_LEN 6 /* lower 16 bits of timestamp data */ @@ -8050,6 +8355,8 @@ #define MC_CMD_INIT_TXQ_EXT_IN_FLAG_INNER_IP_CSUM_EN_WIDTH 1 #define MC_CMD_INIT_TXQ_EXT_IN_FLAG_INNER_TCP_CSUM_EN_LBN 11 #define MC_CMD_INIT_TXQ_EXT_IN_FLAG_INNER_TCP_CSUM_EN_WIDTH 1 +#define MC_CMD_INIT_TXQ_EXT_IN_FLAG_TSOV2_EN_LBN 12 +#define MC_CMD_INIT_TXQ_EXT_IN_FLAG_TSOV2_EN_WIDTH 1 /* Owner ID to use if in buffer mode (zero if physical) */ #define MC_CMD_INIT_TXQ_EXT_IN_OWNER_ID_OFST 20 /* The port ID associated with the v-adaptor which should contain this DMAQ. */ @@ -8923,7 +9230,10 @@ /***********************************/ /* MC_CMD_PARSER_DISP_RW - * Direct read/write of parser-dispatcher state (DICPUs and LUE) for debugging + * Direct read/write of parser-dispatcher state (DICPUs and LUE) for debugging. + * Please note that this interface is only of use to debug tools which have + * knowledge of firmware and hardware data structures; nothing here is intended + * for use by normal driver code. */ #define MC_CMD_PARSER_DISP_RW 0xe5 #undef MC_CMD_0xe5_PRIVILEGE_CTG @@ -8942,6 +9252,12 @@ #define MC_CMD_PARSER_DISP_RW_IN_LUE 0x2 /* enum: Lookup engine (with requested metadata format) */ #define MC_CMD_PARSER_DISP_RW_IN_LUE_VERSIONED_METADATA 0x3 +/* enum: RX0 dispatcher CPU (alias for RX_DICPU; Medford has 2 RX DICPUs) */ +#define MC_CMD_PARSER_DISP_RW_IN_RX0_DICPU 0x0 +/* enum: RX1 dispatcher CPU (only valid for Medford) */ +#define MC_CMD_PARSER_DISP_RW_IN_RX1_DICPU 0x4 +/* enum: Miscellaneous other state (only valid for Medford) */ +#define MC_CMD_PARSER_DISP_RW_IN_MISC_STATE 0x5 /* identifies the type of operation requested */ #define MC_CMD_PARSER_DISP_RW_IN_OP_OFST 4 /* enum: read a word of DICPU DMEM or a LUE entry */ @@ -8950,8 +9266,12 @@ #define MC_CMD_PARSER_DISP_RW_IN_WRITE 0x1 /* enum: read-modify-write a word of DICPU DMEM (not valid for LUE) */ #define MC_CMD_PARSER_DISP_RW_IN_RMW 0x2 -/* data memory address or LUE index */ +/* data memory address (DICPU targets) or LUE index (LUE targets) */ #define MC_CMD_PARSER_DISP_RW_IN_ADDRESS_OFST 8 +/* selector (for MISC_STATE target) */ +#define MC_CMD_PARSER_DISP_RW_IN_SELECTOR_OFST 8 +/* enum: Port to datapath mapping */ +#define MC_CMD_PARSER_DISP_RW_IN_PORT_DP_MAPPING 0x1 /* value to write (for DMEM writes) */ #define MC_CMD_PARSER_DISP_RW_IN_DMEM_WRITE_VALUE_OFST 12 /* XOR value (for DMEM read-modify-writes: new = (old & mask) ^ value) */ @@ -8976,6 +9296,12 @@ */ #define MC_CMD_PARSER_DISP_RW_OUT_LUE_MGR_STATE_OFST 20 #define MC_CMD_PARSER_DISP_RW_OUT_LUE_MGR_STATE_LEN 32 +/* datapath(s) used for each port (for MISC_STATE PORT_DP_MAPPING selector) */ +#define MC_CMD_PARSER_DISP_RW_OUT_PORT_DP_MAPPING_OFST 0 +#define MC_CMD_PARSER_DISP_RW_OUT_PORT_DP_MAPPING_LEN 4 +#define MC_CMD_PARSER_DISP_RW_OUT_PORT_DP_MAPPING_NUM 4 +#define MC_CMD_PARSER_DISP_RW_OUT_DP0 0x1 /* enum */ +#define MC_CMD_PARSER_DISP_RW_OUT_DP1 0x2 /* enum */ /***********************************/ @@ -9656,6 +9982,14 @@ #define MC_CMD_GET_CAPABILITIES_OUT_LEN 20 /* First word of flags. */ #define MC_CMD_GET_CAPABILITIES_OUT_FLAGS1_OFST 0 +#define MC_CMD_GET_CAPABILITIES_OUT_VPORT_RECONFIGURE_LBN 3 +#define MC_CMD_GET_CAPABILITIES_OUT_VPORT_RECONFIGURE_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_OUT_TX_STRIPING_LBN 4 +#define MC_CMD_GET_CAPABILITIES_OUT_TX_STRIPING_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_OUT_VADAPTOR_QUERY_LBN 5 +#define MC_CMD_GET_CAPABILITIES_OUT_VADAPTOR_QUERY_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_OUT_EVB_PORT_VLAN_RESTRICT_LBN 6 +#define MC_CMD_GET_CAPABILITIES_OUT_EVB_PORT_VLAN_RESTRICT_WIDTH 1 #define MC_CMD_GET_CAPABILITIES_OUT_DRV_ATTACH_PREBOOT_LBN 7 #define MC_CMD_GET_CAPABILITIES_OUT_DRV_ATTACH_PREBOOT_WIDTH 1 #define MC_CMD_GET_CAPABILITIES_OUT_RX_FORCE_EVENT_MERGING_LBN 8 @@ -9824,6 +10158,200 @@ /* Licensed capabilities */ #define MC_CMD_GET_CAPABILITIES_OUT_LICENSE_CAPABILITIES_OFST 16 +/* MC_CMD_GET_CAPABILITIES_V2_IN msgrequest */ +#define MC_CMD_GET_CAPABILITIES_V2_IN_LEN 0 + +/* MC_CMD_GET_CAPABILITIES_V2_OUT msgresponse */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_LEN 26 +/* First word of flags. */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_FLAGS1_OFST 0 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_VPORT_RECONFIGURE_LBN 3 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_VPORT_RECONFIGURE_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TX_STRIPING_LBN 4 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TX_STRIPING_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_VADAPTOR_QUERY_LBN 5 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_VADAPTOR_QUERY_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_EVB_PORT_VLAN_RESTRICT_LBN 6 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_EVB_PORT_VLAN_RESTRICT_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_DRV_ATTACH_PREBOOT_LBN 7 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_DRV_ATTACH_PREBOOT_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RX_FORCE_EVENT_MERGING_LBN 8 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RX_FORCE_EVENT_MERGING_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_SET_MAC_ENHANCED_LBN 9 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_SET_MAC_ENHANCED_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_UNKNOWN_UCAST_DST_FILTER_ALWAYS_MULTI_RECIPIENT_LBN 10 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_UNKNOWN_UCAST_DST_FILTER_ALWAYS_MULTI_RECIPIENT_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_VADAPTOR_PERMIT_SET_MAC_WHEN_FILTERS_INSTALLED_LBN 11 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_VADAPTOR_PERMIT_SET_MAC_WHEN_FILTERS_INSTALLED_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TX_MAC_SECURITY_FILTERING_LBN 12 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TX_MAC_SECURITY_FILTERING_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_ADDITIONAL_RSS_MODES_LBN 13 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_ADDITIONAL_RSS_MODES_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_QBB_LBN 14 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_QBB_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RX_PACKED_STREAM_VAR_BUFFERS_LBN 15 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RX_PACKED_STREAM_VAR_BUFFERS_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RX_RSS_LIMITED_LBN 16 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RX_RSS_LIMITED_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RX_PACKED_STREAM_LBN 17 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RX_PACKED_STREAM_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RX_INCLUDE_FCS_LBN 18 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RX_INCLUDE_FCS_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TX_VLAN_INSERTION_LBN 19 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TX_VLAN_INSERTION_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RX_VLAN_STRIPPING_LBN 20 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RX_VLAN_STRIPPING_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TX_TSO_LBN 21 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TX_TSO_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RX_PREFIX_LEN_0_LBN 22 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RX_PREFIX_LEN_0_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RX_PREFIX_LEN_14_LBN 23 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RX_PREFIX_LEN_14_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RX_TIMESTAMP_LBN 24 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RX_TIMESTAMP_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RX_BATCHING_LBN 25 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RX_BATCHING_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_MCAST_FILTER_CHAINING_LBN 26 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_MCAST_FILTER_CHAINING_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_PM_AND_RXDP_COUNTERS_LBN 27 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_PM_AND_RXDP_COUNTERS_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RX_DISABLE_SCATTER_LBN 28 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RX_DISABLE_SCATTER_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TX_MCAST_UDP_LOOPBACK_LBN 29 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TX_MCAST_UDP_LOOPBACK_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_EVB_LBN 30 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_EVB_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_VXLAN_NVGRE_LBN 31 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_VXLAN_NVGRE_WIDTH 1 +/* RxDPCPU firmware id. */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RX_DPCPU_FW_ID_OFST 4 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RX_DPCPU_FW_ID_LEN 2 +/* enum: Standard RXDP firmware */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RXDP 0x0 +/* enum: Low latency RXDP firmware */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RXDP_LOW_LATENCY 0x1 +/* enum: Packed stream RXDP firmware */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RXDP_PACKED_STREAM 0x2 +/* enum: BIST RXDP firmware */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RXDP_BIST 0x10a +/* enum: RXDP Test firmware image 1 */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RXDP_TEST_FW_TO_MC_CUT_THROUGH 0x101 +/* enum: RXDP Test firmware image 2 */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RXDP_TEST_FW_TO_MC_STORE_FORWARD 0x102 +/* enum: RXDP Test firmware image 3 */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RXDP_TEST_FW_TO_MC_STORE_FORWARD_FIRST 0x103 +/* enum: RXDP Test firmware image 4 */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RXDP_TEST_EVERY_EVENT_BATCHABLE 0x104 +/* enum: RXDP Test firmware image 5 */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RXDP_TEST_BACKPRESSURE 0x105 +/* enum: RXDP Test firmware image 6 */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RXDP_TEST_FW_PACKET_EDITS 0x106 +/* enum: RXDP Test firmware image 7 */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RXDP_TEST_FW_RX_HDR_SPLIT 0x107 +/* enum: RXDP Test firmware image 8 */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RXDP_TEST_FW_DISABLE_DL 0x108 +/* enum: RXDP Test firmware image 9 */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RXDP_TEST_FW_DOORBELL_DELAY 0x10b +/* TxDPCPU firmware id. */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TX_DPCPU_FW_ID_OFST 6 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TX_DPCPU_FW_ID_LEN 2 +/* enum: Standard TXDP firmware */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TXDP 0x0 +/* enum: Low latency TXDP firmware */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TXDP_LOW_LATENCY 0x1 +/* enum: High packet rate TXDP firmware */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TXDP_HIGH_PACKET_RATE 0x3 +/* enum: BIST TXDP firmware */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TXDP_BIST 0x12d +/* enum: TXDP Test firmware image 1 */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TXDP_TEST_FW_TSO_EDIT 0x101 +/* enum: TXDP Test firmware image 2 */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TXDP_TEST_FW_PACKET_EDITS 0x102 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RXPD_FW_VERSION_OFST 8 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RXPD_FW_VERSION_LEN 2 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RXPD_FW_VERSION_REV_LBN 0 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RXPD_FW_VERSION_REV_WIDTH 12 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RXPD_FW_VERSION_TYPE_LBN 12 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RXPD_FW_VERSION_TYPE_WIDTH 4 +/* enum: reserved value - do not use (may indicate alternative interpretation + * of REV field in future) + */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RXPD_FW_TYPE_RESERVED 0x0 +/* enum: Trivial RX PD firmware for early Huntington development (Huntington + * development only) + */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RXPD_FW_TYPE_FIRST_PKT 0x1 +/* enum: RX PD firmware with approximately Siena-compatible behaviour + * (Huntington development only) + */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RXPD_FW_TYPE_SIENA_COMPAT 0x2 +/* enum: Virtual switching (full feature) RX PD production firmware */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RXPD_FW_TYPE_VSWITCH 0x3 +/* enum: siena_compat variant RX PD firmware using PM rather than MAC + * (Huntington development only) + */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RXPD_FW_TYPE_SIENA_COMPAT_PM 0x4 +/* enum: Low latency RX PD production firmware */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RXPD_FW_TYPE_LOW_LATENCY 0x5 +/* enum: Packed stream RX PD production firmware */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RXPD_FW_TYPE_PACKED_STREAM 0x6 +/* enum: RX PD firmware handling layer 2 only for high packet rate performance + * tests (Medford development only) + */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RXPD_FW_TYPE_LAYER2_PERF 0x7 +/* enum: RX PD firmware for GUE parsing prototype (Medford development only) */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RXPD_FW_TYPE_TESTFW_GUE_PROTOTYPE 0xe +/* enum: RX PD firmware parsing but not filtering network overlay tunnel + * encapsulations (Medford development only) + */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_RXPD_FW_TYPE_TESTFW_ENCAP_PARSING_ONLY 0xf +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TXPD_FW_VERSION_OFST 10 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TXPD_FW_VERSION_LEN 2 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TXPD_FW_VERSION_REV_LBN 0 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TXPD_FW_VERSION_REV_WIDTH 12 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TXPD_FW_VERSION_TYPE_LBN 12 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TXPD_FW_VERSION_TYPE_WIDTH 4 +/* enum: reserved value - do not use (may indicate alternative interpretation + * of REV field in future) + */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TXPD_FW_TYPE_RESERVED 0x0 +/* enum: Trivial TX PD firmware for early Huntington development (Huntington + * development only) + */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TXPD_FW_TYPE_FIRST_PKT 0x1 +/* enum: TX PD firmware with approximately Siena-compatible behaviour + * (Huntington development only) + */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TXPD_FW_TYPE_SIENA_COMPAT 0x2 +/* enum: Virtual switching (full feature) TX PD production firmware */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TXPD_FW_TYPE_VSWITCH 0x3 +/* enum: siena_compat variant TX PD firmware using PM rather than MAC + * (Huntington development only) + */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TXPD_FW_TYPE_SIENA_COMPAT_PM 0x4 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TXPD_FW_TYPE_LOW_LATENCY 0x5 /* enum */ +/* enum: TX PD firmware handling layer 2 only for high packet rate performance + * tests (Medford development only) + */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TXPD_FW_TYPE_LAYER2_PERF 0x7 +/* enum: RX PD firmware for GUE parsing prototype (Medford development only) */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TXPD_FW_TYPE_TESTFW_GUE_PROTOTYPE 0xe +/* Hardware capabilities of NIC */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_HW_CAPABILITIES_OFST 12 +/* Licensed capabilities */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_LICENSE_CAPABILITIES_OFST 16 +/* Second word of flags. Not present on older firmware (check the length). */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_FLAGS2_OFST 20 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TX_TSO_V2_LBN 0 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TX_TSO_V2_WIDTH 1 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TX_TSO_V2_ENCAP_LBN 1 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TX_TSO_V2_ENCAP_WIDTH 1 +/* Number of FATSOv2 contexts per datapath supported by this NIC. Not present + * on older firmware (check the length). + */ +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TX_TSO_V2_N_CONTEXTS_OFST 24 +#define MC_CMD_GET_CAPABILITIES_V2_OUT_TX_TSO_V2_N_CONTEXTS_LEN 2 + /***********************************/ /* MC_CMD_V2_EXTN @@ -10545,10 +11073,17 @@ #define MC_CMD_RSS_CONTEXT_SET_FLAGS_IN_LEN 8 /* The handle of the RSS context */ #define MC_CMD_RSS_CONTEXT_SET_FLAGS_IN_RSS_CONTEXT_ID_OFST 0 -/* Hash control flags. The _EN bits are always supported. The _MODE bits only - * work when the firmware reports ADDITIONAL_RSS_MODES in - * MC_CMD_GET_CAPABILITIES and override the _EN bits if any of them are not 0. - * See the RSS_MODE structure for the meaning of the mode bits. +/* Hash control flags. The _EN bits are always supported, but new modes are + * available when ADDITIONAL_RSS_MODES is reported by MC_CMD_GET_CAPABILITIES: + * in this case, the MODE fields may be set to non-zero values, and will take + * effect regardless of the settings of the _EN flags. See the RSS_MODE + * structure for the meaning of the mode bits. Drivers must check the + * capability before trying to set any _MODE fields, as older firmware will + * reject any attempt to set the FLAGS field to a value > 0xff with EINVAL. In + * the case where all the _MODE flags are zero, the _EN flags take effect, + * providing backward compatibility for existing drivers. (Setting all _MODE + * *and* all _EN flags to zero is valid, to disable RSS spreading for that + * particular packet type.) */ #define MC_CMD_RSS_CONTEXT_SET_FLAGS_IN_FLAGS_OFST 4 #define MC_CMD_RSS_CONTEXT_SET_FLAGS_IN_TOEPLITZ_IPV4_EN_LBN 0 @@ -10594,11 +11129,18 @@ /* MC_CMD_RSS_CONTEXT_GET_FLAGS_OUT msgresponse */ #define MC_CMD_RSS_CONTEXT_GET_FLAGS_OUT_LEN 8 -/* Hash control flags. If any _MODE bits are non-zero (which will only be true - * when the firmware reports ADDITIONAL_RSS_MODES) then the _EN bits should be - * disregarded (but are guaranteed to be consistent with the _MODE bits if - * RSS_CONTEXT_SET_FLAGS has never been called for this context since it was - * allocated). +/* Hash control flags. If all _MODE bits are zero (which will always be true + * for older firmware which does not report the ADDITIONAL_RSS_MODES + * capability), the _EN bits report the state. If any _MODE bits are non-zero + * (which will only be true when the firmware reports ADDITIONAL_RSS_MODES) + * then the _EN bits should be disregarded, although the _MODE flags are + * guaranteed to be consistent with the _EN flags for a freshly-allocated RSS + * context and in the case where the _EN flags were used in the SET. This + * provides backward compatibility: old drivers will not be attempting to + * derive any meaning from the _MODE bits (and can never set them to any value + * not representable by the _EN bits); new drivers can always determine the + * mode by looking only at the _MODE bits; the value returned by a GET can + * always be used for a SET regardless of old/new driver vs. old/new firmware. */ #define MC_CMD_RSS_CONTEXT_GET_FLAGS_OUT_FLAGS_OFST 4 #define MC_CMD_RSS_CONTEXT_GET_FLAGS_OUT_TOEPLITZ_IPV4_EN_LBN 0 @@ -11568,32 +12110,38 @@ #define MC_CMD_KR_TUNE_RXEQ_GET_OUT_PARAM_MAXNUM 63 #define MC_CMD_KR_TUNE_RXEQ_GET_OUT_PARAM_ID_LBN 0 #define MC_CMD_KR_TUNE_RXEQ_GET_OUT_PARAM_ID_WIDTH 8 -/* enum: Attenuation (0-15, TBD for Medford) */ +/* enum: Attenuation (0-15, Huntington) */ #define MC_CMD_KR_TUNE_RXEQ_GET_OUT_ATT 0x0 -/* enum: CTLE Boost (0-15, TBD for Medford) */ +/* enum: CTLE Boost (0-15, Huntington) */ #define MC_CMD_KR_TUNE_RXEQ_GET_OUT_BOOST 0x1 -/* enum: Edge DFE Tap1 (0 - max negative, 64 - zero, 127 - max positive, TBD - * for Medford) +/* enum: Edge DFE Tap1 (Huntington - 0 - max negative, 64 - zero, 127 - max + * positive, Medford - 0-31) */ #define MC_CMD_KR_TUNE_RXEQ_GET_OUT_EDFE_TAP1 0x2 -/* enum: Edge DFE Tap2 (0 - max negative, 32 - zero, 63 - max positive, TBD for - * Medford) +/* enum: Edge DFE Tap2 (Huntington - 0 - max negative, 32 - zero, 63 - max + * positive, Medford - 0-31) */ #define MC_CMD_KR_TUNE_RXEQ_GET_OUT_EDFE_TAP2 0x3 -/* enum: Edge DFE Tap3 (0 - max negative, 32 - zero, 63 - max positive, TBD for - * Medford) +/* enum: Edge DFE Tap3 (Huntington - 0 - max negative, 32 - zero, 63 - max + * positive, Medford - 0-16) */ #define MC_CMD_KR_TUNE_RXEQ_GET_OUT_EDFE_TAP3 0x4 -/* enum: Edge DFE Tap4 (0 - max negative, 32 - zero, 63 - max positive, TBD for - * Medford) +/* enum: Edge DFE Tap4 (Huntington - 0 - max negative, 32 - zero, 63 - max + * positive, Medford - 0-16) */ #define MC_CMD_KR_TUNE_RXEQ_GET_OUT_EDFE_TAP4 0x5 -/* enum: Edge DFE Tap5 (0 - max negative, 32 - zero, 63 - max positive, TBD for - * Medford) +/* enum: Edge DFE Tap5 (Huntington - 0 - max negative, 32 - zero, 63 - max + * positive, Medford - 0-16) */ #define MC_CMD_KR_TUNE_RXEQ_GET_OUT_EDFE_TAP5 0x6 -/* enum: Edge DFE DLEV (TBD for Medford) */ +/* enum: Edge DFE DLEV (0-128 for Medford) */ #define MC_CMD_KR_TUNE_RXEQ_GET_OUT_EDFE_DLEV 0x7 +/* enum: Variable Gain Amplifier (0-15, Medford) */ +#define MC_CMD_KR_TUNE_RXEQ_GET_OUT_VGA 0x8 +/* enum: CTLE EQ Capacitor (0-15, Medford) */ +#define MC_CMD_KR_TUNE_RXEQ_GET_OUT_CTLE_EQC 0x9 +/* enum: CTLE EQ Resistor (0-7, Medford) */ +#define MC_CMD_KR_TUNE_RXEQ_GET_OUT_CTLE_EQRES 0xa #define MC_CMD_KR_TUNE_RXEQ_GET_OUT_PARAM_LANE_LBN 8 #define MC_CMD_KR_TUNE_RXEQ_GET_OUT_PARAM_LANE_WIDTH 3 #define MC_CMD_KR_TUNE_RXEQ_GET_OUT_LANE_0 0x0 /* enum */ @@ -11665,26 +12213,32 @@ #define MC_CMD_KR_TUNE_TXEQ_GET_OUT_PARAM_MAXNUM 63 #define MC_CMD_KR_TUNE_TXEQ_GET_OUT_PARAM_ID_LBN 0 #define MC_CMD_KR_TUNE_TXEQ_GET_OUT_PARAM_ID_WIDTH 8 -/* enum: TX Amplitude */ +/* enum: TX Amplitude (Huntington, Medford) */ #define MC_CMD_KR_TUNE_TXEQ_GET_OUT_TX_LEV 0x0 -/* enum: De-Emphasis Tap1 Magnitude (0-7) */ +/* enum: De-Emphasis Tap1 Magnitude (0-7) (Huntington) */ #define MC_CMD_KR_TUNE_TXEQ_GET_OUT_TX_MODE 0x1 /* enum: De-Emphasis Tap1 Fine */ #define MC_CMD_KR_TUNE_TXEQ_GET_OUT_TX_DTLEV 0x2 -/* enum: De-Emphasis Tap2 Magnitude (0-6) */ +/* enum: De-Emphasis Tap2 Magnitude (0-6) (Huntington) */ #define MC_CMD_KR_TUNE_TXEQ_GET_OUT_TX_D2 0x3 -/* enum: De-Emphasis Tap2 Fine */ +/* enum: De-Emphasis Tap2 Fine (Huntington) */ #define MC_CMD_KR_TUNE_TXEQ_GET_OUT_TX_D2TLEV 0x4 -/* enum: Pre-Emphasis Magnitude */ +/* enum: Pre-Emphasis Magnitude (Huntington) */ #define MC_CMD_KR_TUNE_TXEQ_GET_OUT_TX_E 0x5 -/* enum: Pre-Emphasis Fine */ +/* enum: Pre-Emphasis Fine (Huntington) */ #define MC_CMD_KR_TUNE_TXEQ_GET_OUT_TX_ETLEV 0x6 -/* enum: TX Slew Rate Coarse control */ +/* enum: TX Slew Rate Coarse control (Huntington) */ #define MC_CMD_KR_TUNE_TXEQ_GET_OUT_TX_PREDRV_DLY 0x7 -/* enum: TX Slew Rate Fine control */ +/* enum: TX Slew Rate Fine control (Huntington) */ #define MC_CMD_KR_TUNE_TXEQ_GET_OUT_TX_SR_SET 0x8 -/* enum: TX Termination Impedance control */ +/* enum: TX Termination Impedance control (Huntington) */ #define MC_CMD_KR_TUNE_TXEQ_GET_OUT_TX_RT_SET 0x9 +/* enum: TX Amplitude Fine control (Medford) */ +#define MC_CMD_KR_TUNE_TXEQ_GET_OUT_TX_LEV_FINE 0xa +/* enum: Pre-shoot Tap (Medford) */ +#define MC_CMD_KR_TUNE_TXEQ_GET_OUT_TAP_ADV 0xb +/* enum: De-emphasis Tap (Medford) */ +#define MC_CMD_KR_TUNE_TXEQ_GET_OUT_TAP_DLY 0xc #define MC_CMD_KR_TUNE_TXEQ_GET_OUT_PARAM_LANE_LBN 8 #define MC_CMD_KR_TUNE_TXEQ_GET_OUT_PARAM_LANE_WIDTH 3 #define MC_CMD_KR_TUNE_TXEQ_GET_OUT_LANE_0 0x0 /* enum */ @@ -11871,8 +12425,12 @@ #define MC_CMD_PCIE_TUNE_RXEQ_GET_OUT_DFE_DLEV 0x7 /* enum: Figure of Merit */ #define MC_CMD_PCIE_TUNE_RXEQ_GET_OUT_FOM 0x8 +/* enum: CTLE EQ Capacitor (HF Gain) */ +#define MC_CMD_PCIE_TUNE_RXEQ_GET_OUT_CTLE_EQC 0x9 +/* enum: CTLE EQ Resistor (DC Gain) */ +#define MC_CMD_PCIE_TUNE_RXEQ_GET_OUT_CTLE_EQRES 0xa #define MC_CMD_PCIE_TUNE_RXEQ_GET_OUT_PARAM_LANE_LBN 8 -#define MC_CMD_PCIE_TUNE_RXEQ_GET_OUT_PARAM_LANE_WIDTH 4 +#define MC_CMD_PCIE_TUNE_RXEQ_GET_OUT_PARAM_LANE_WIDTH 5 #define MC_CMD_PCIE_TUNE_RXEQ_GET_OUT_LANE_0 0x0 /* enum */ #define MC_CMD_PCIE_TUNE_RXEQ_GET_OUT_LANE_1 0x1 /* enum */ #define MC_CMD_PCIE_TUNE_RXEQ_GET_OUT_LANE_2 0x2 /* enum */ @@ -11881,12 +12439,57 @@ #define MC_CMD_PCIE_TUNE_RXEQ_GET_OUT_LANE_5 0x5 /* enum */ #define MC_CMD_PCIE_TUNE_RXEQ_GET_OUT_LANE_6 0x6 /* enum */ #define MC_CMD_PCIE_TUNE_RXEQ_GET_OUT_LANE_7 0x7 /* enum */ -#define MC_CMD_PCIE_TUNE_RXEQ_GET_OUT_LANE_ALL 0x8 /* enum */ -#define MC_CMD_PCIE_TUNE_RXEQ_GET_OUT_RESERVED_LBN 12 -#define MC_CMD_PCIE_TUNE_RXEQ_GET_OUT_RESERVED_WIDTH 12 +#define MC_CMD_PCIE_TUNE_RXEQ_GET_OUT_LANE_8 0x8 /* enum */ +#define MC_CMD_PCIE_TUNE_RXEQ_GET_OUT_LANE_9 0x9 /* enum */ +#define MC_CMD_PCIE_TUNE_RXEQ_GET_OUT_LANE_10 0xa /* enum */ +#define MC_CMD_PCIE_TUNE_RXEQ_GET_OUT_LANE_11 0xb /* enum */ +#define MC_CMD_PCIE_TUNE_RXEQ_GET_OUT_LANE_12 0xc /* enum */ +#define MC_CMD_PCIE_TUNE_RXEQ_GET_OUT_LANE_13 0xd /* enum */ +#define MC_CMD_PCIE_TUNE_RXEQ_GET_OUT_LANE_14 0xe /* enum */ +#define MC_CMD_PCIE_TUNE_RXEQ_GET_OUT_LANE_15 0xf /* enum */ +#define MC_CMD_PCIE_TUNE_RXEQ_GET_OUT_LANE_ALL 0x10 /* enum */ +#define MC_CMD_PCIE_TUNE_RXEQ_GET_OUT_PARAM_AUTOCAL_LBN 13 +#define MC_CMD_PCIE_TUNE_RXEQ_GET_OUT_PARAM_AUTOCAL_WIDTH 1 +#define MC_CMD_PCIE_TUNE_RXEQ_GET_OUT_RESERVED_LBN 14 +#define MC_CMD_PCIE_TUNE_RXEQ_GET_OUT_RESERVED_WIDTH 10 #define MC_CMD_PCIE_TUNE_RXEQ_GET_OUT_PARAM_CURRENT_LBN 24 #define MC_CMD_PCIE_TUNE_RXEQ_GET_OUT_PARAM_CURRENT_WIDTH 8 +/* MC_CMD_PCIE_TUNE_RXEQ_SET_IN msgrequest */ +#define MC_CMD_PCIE_TUNE_RXEQ_SET_IN_LENMIN 8 +#define MC_CMD_PCIE_TUNE_RXEQ_SET_IN_LENMAX 252 +#define MC_CMD_PCIE_TUNE_RXEQ_SET_IN_LEN(num) (4+4*(num)) +/* Requested operation */ +#define MC_CMD_PCIE_TUNE_RXEQ_SET_IN_PCIE_TUNE_OP_OFST 0 +#define MC_CMD_PCIE_TUNE_RXEQ_SET_IN_PCIE_TUNE_OP_LEN 1 +/* Align the arguments to 32 bits */ +#define MC_CMD_PCIE_TUNE_RXEQ_SET_IN_PCIE_TUNE_RSVD_OFST 1 +#define MC_CMD_PCIE_TUNE_RXEQ_SET_IN_PCIE_TUNE_RSVD_LEN 3 +/* RXEQ Parameter */ +#define MC_CMD_PCIE_TUNE_RXEQ_SET_IN_PARAM_OFST 4 +#define MC_CMD_PCIE_TUNE_RXEQ_SET_IN_PARAM_LEN 4 +#define MC_CMD_PCIE_TUNE_RXEQ_SET_IN_PARAM_MINNUM 1 +#define MC_CMD_PCIE_TUNE_RXEQ_SET_IN_PARAM_MAXNUM 62 +#define MC_CMD_PCIE_TUNE_RXEQ_SET_IN_PARAM_ID_LBN 0 +#define MC_CMD_PCIE_TUNE_RXEQ_SET_IN_PARAM_ID_WIDTH 8 +/* Enum values, see field(s): */ +/* MC_CMD_PCIE_TUNE_RXEQ_GET_OUT/PARAM_ID */ +#define MC_CMD_PCIE_TUNE_RXEQ_SET_IN_PARAM_LANE_LBN 8 +#define MC_CMD_PCIE_TUNE_RXEQ_SET_IN_PARAM_LANE_WIDTH 5 +/* Enum values, see field(s): */ +/* MC_CMD_PCIE_TUNE_RXEQ_GET_OUT/PARAM_LANE */ +#define MC_CMD_PCIE_TUNE_RXEQ_SET_IN_PARAM_AUTOCAL_LBN 13 +#define MC_CMD_PCIE_TUNE_RXEQ_SET_IN_PARAM_AUTOCAL_WIDTH 1 +#define MC_CMD_PCIE_TUNE_RXEQ_SET_IN_RESERVED_LBN 14 +#define MC_CMD_PCIE_TUNE_RXEQ_SET_IN_RESERVED_WIDTH 2 +#define MC_CMD_PCIE_TUNE_RXEQ_SET_IN_PARAM_INITIAL_LBN 16 +#define MC_CMD_PCIE_TUNE_RXEQ_SET_IN_PARAM_INITIAL_WIDTH 8 +#define MC_CMD_PCIE_TUNE_RXEQ_SET_IN_RESERVED2_LBN 24 +#define MC_CMD_PCIE_TUNE_RXEQ_SET_IN_RESERVED2_WIDTH 8 + +/* MC_CMD_PCIE_TUNE_RXEQ_SET_OUT msgresponse */ +#define MC_CMD_PCIE_TUNE_RXEQ_SET_OUT_LEN 0 + /* MC_CMD_PCIE_TUNE_TXEQ_GET_IN msgrequest */ #define MC_CMD_PCIE_TUNE_TXEQ_GET_IN_LEN 4 /* Requested operation */ @@ -11961,6 +12564,7 @@ /***********************************/ /* MC_CMD_LICENSING * Operations on the NVRAM_PARTITION_TYPE_LICENSE application license partition + * - not used for V3 licensing */ #define MC_CMD_LICENSING 0xf3 #undef MC_CMD_0xf3_PRIVILEGE_CTG @@ -12005,6 +12609,95 @@ #define MC_CMD_LICENSING_OUT_SELF_TEST_PASS 0x1 +/***********************************/ +/* MC_CMD_LICENSING_V3 + * Operations on the NVRAM_PARTITION_TYPE_LICENSE application license partition + * - V3 licensing (Medford) + */ +#define MC_CMD_LICENSING_V3 0xd0 +#undef MC_CMD_0xd0_PRIVILEGE_CTG + +#define MC_CMD_0xd0_PRIVILEGE_CTG SRIOV_CTG_GENERAL + +/* MC_CMD_LICENSING_V3_IN msgrequest */ +#define MC_CMD_LICENSING_V3_IN_LEN 4 +/* identifies the type of operation requested */ +#define MC_CMD_LICENSING_V3_IN_OP_OFST 0 +/* enum: re-read and apply licenses after a license key partition update; note + * that this operation returns a zero-length response + */ +#define MC_CMD_LICENSING_V3_IN_OP_UPDATE_LICENSE 0x0 +/* enum: report counts of installed licenses */ +#define MC_CMD_LICENSING_V3_IN_OP_REPORT_LICENSE 0x1 + +/* MC_CMD_LICENSING_V3_OUT msgresponse */ +#define MC_CMD_LICENSING_V3_OUT_LEN 88 +/* count of keys which are valid */ +#define MC_CMD_LICENSING_V3_OUT_VALID_KEYS_OFST 0 +/* sum of UNVERIFIABLE_KEYS + WRONG_NODE_KEYS (for compatibility with + * MC_CMD_FC_OP_LICENSE) + */ +#define MC_CMD_LICENSING_V3_OUT_INVALID_KEYS_OFST 4 +/* count of keys which are invalid due to being unverifiable */ +#define MC_CMD_LICENSING_V3_OUT_UNVERIFIABLE_KEYS_OFST 8 +/* count of keys which are invalid due to being for the wrong node */ +#define MC_CMD_LICENSING_V3_OUT_WRONG_NODE_KEYS_OFST 12 +/* licensing state (for diagnostics; the exact meaning of the bits in this + * field are private to the firmware) + */ +#define MC_CMD_LICENSING_V3_OUT_LICENSING_STATE_OFST 16 +/* licensing subsystem self-test report (for manftest) */ +#define MC_CMD_LICENSING_V3_OUT_LICENSING_SELF_TEST_OFST 20 +/* enum: licensing subsystem self-test failed */ +#define MC_CMD_LICENSING_V3_OUT_SELF_TEST_FAIL 0x0 +/* enum: licensing subsystem self-test passed */ +#define MC_CMD_LICENSING_V3_OUT_SELF_TEST_PASS 0x1 +/* bitmask of licensed applications */ +#define MC_CMD_LICENSING_V3_OUT_LICENSED_APPS_OFST 24 +#define MC_CMD_LICENSING_V3_OUT_LICENSED_APPS_LEN 8 +#define MC_CMD_LICENSING_V3_OUT_LICENSED_APPS_LO_OFST 24 +#define MC_CMD_LICENSING_V3_OUT_LICENSED_APPS_HI_OFST 28 +/* reserved for future use */ +#define MC_CMD_LICENSING_V3_OUT_RESERVED_0_OFST 32 +#define MC_CMD_LICENSING_V3_OUT_RESERVED_0_LEN 24 +/* bitmask of licensed features */ +#define MC_CMD_LICENSING_V3_OUT_LICENSED_FEATURES_OFST 56 +#define MC_CMD_LICENSING_V3_OUT_LICENSED_FEATURES_LEN 8 +#define MC_CMD_LICENSING_V3_OUT_LICENSED_FEATURES_LO_OFST 56 +#define MC_CMD_LICENSING_V3_OUT_LICENSED_FEATURES_HI_OFST 60 +/* reserved for future use */ +#define MC_CMD_LICENSING_V3_OUT_RESERVED_1_OFST 64 +#define MC_CMD_LICENSING_V3_OUT_RESERVED_1_LEN 24 + + +/***********************************/ +/* MC_CMD_LICENSING_GET_ID_V3 + * Get ID and type from the NVRAM_PARTITION_TYPE_LICENSE application license + * partition - V3 licensing (Medford) + */ +#define MC_CMD_LICENSING_GET_ID_V3 0xd1 +#undef MC_CMD_0xd1_PRIVILEGE_CTG + +#define MC_CMD_0xd1_PRIVILEGE_CTG SRIOV_CTG_GENERAL + +/* MC_CMD_LICENSING_GET_ID_V3_IN msgrequest */ +#define MC_CMD_LICENSING_GET_ID_V3_IN_LEN 0 + +/* MC_CMD_LICENSING_GET_ID_V3_OUT msgresponse */ +#define MC_CMD_LICENSING_GET_ID_V3_OUT_LENMIN 8 +#define MC_CMD_LICENSING_GET_ID_V3_OUT_LENMAX 252 +#define MC_CMD_LICENSING_GET_ID_V3_OUT_LEN(num) (8+1*(num)) +/* type of license (eg 3) */ +#define MC_CMD_LICENSING_GET_ID_V3_OUT_LICENSE_TYPE_OFST 0 +/* length of the license ID (in bytes) */ +#define MC_CMD_LICENSING_GET_ID_V3_OUT_LICENSE_ID_LENGTH_OFST 4 +/* the unique license ID of the adapter */ +#define MC_CMD_LICENSING_GET_ID_V3_OUT_LICENSE_ID_OFST 8 +#define MC_CMD_LICENSING_GET_ID_V3_OUT_LICENSE_ID_LEN 1 +#define MC_CMD_LICENSING_GET_ID_V3_OUT_LICENSE_ID_MINNUM 0 +#define MC_CMD_LICENSING_GET_ID_V3_OUT_LICENSE_ID_MAXNUM 244 + + /***********************************/ /* MC_CMD_MC2MC_PROXY * Execute an arbitrary MCDI command on the slave MC of a dual-core device. @@ -12026,7 +12719,7 @@ /* MC_CMD_GET_LICENSED_APP_STATE * Query the state of an individual licensed application. (Note that the actual * state may be invalidated by the MC_CMD_LICENSING OP_UPDATE_LICENSE operation - * or a reboot of the MC.) + * or a reboot of the MC.) Not used for V3 licensing */ #define MC_CMD_GET_LICENSED_APP_STATE 0xf5 #undef MC_CMD_0xf5_PRIVILEGE_CTG @@ -12048,9 +12741,71 @@ #define MC_CMD_GET_LICENSED_APP_STATE_OUT_LICENSED 0x1 +/***********************************/ +/* MC_CMD_GET_LICENSED_V3_APP_STATE + * Query the state of an individual licensed application. (Note that the actual + * state may be invalidated by the MC_CMD_LICENSING_V3 OP_UPDATE_LICENSE + * operation or a reboot of the MC.) Used for V3 licensing (Medford) + */ +#define MC_CMD_GET_LICENSED_V3_APP_STATE 0xd2 +#undef MC_CMD_0xd2_PRIVILEGE_CTG + +#define MC_CMD_0xd2_PRIVILEGE_CTG SRIOV_CTG_GENERAL + +/* MC_CMD_GET_LICENSED_V3_APP_STATE_IN msgrequest */ +#define MC_CMD_GET_LICENSED_V3_APP_STATE_IN_LEN 8 +/* application ID to query (LICENSED_V3_APPS_xxx) expressed as a single bit + * mask + */ +#define MC_CMD_GET_LICENSED_V3_APP_STATE_IN_APP_ID_OFST 0 +#define MC_CMD_GET_LICENSED_V3_APP_STATE_IN_APP_ID_LEN 8 +#define MC_CMD_GET_LICENSED_V3_APP_STATE_IN_APP_ID_LO_OFST 0 +#define MC_CMD_GET_LICENSED_V3_APP_STATE_IN_APP_ID_HI_OFST 4 + +/* MC_CMD_GET_LICENSED_V3_APP_STATE_OUT msgresponse */ +#define MC_CMD_GET_LICENSED_V3_APP_STATE_OUT_LEN 4 +/* state of this application */ +#define MC_CMD_GET_LICENSED_V3_APP_STATE_OUT_STATE_OFST 0 +/* enum: no (or invalid) license is present for the application */ +#define MC_CMD_GET_LICENSED_V3_APP_STATE_OUT_NOT_LICENSED 0x0 +/* enum: a valid license is present for the application */ +#define MC_CMD_GET_LICENSED_V3_APP_STATE_OUT_LICENSED 0x1 + + +/***********************************/ +/* MC_CMD_GET_LICENSED_V3_FEATURE_STATES + * Query the state of an one or more licensed features. (Note that the actual + * state may be invalidated by the MC_CMD_LICENSING_V3 OP_UPDATE_LICENSE + * operation or a reboot of the MC.) Used for V3 licensing (Medford) + */ +#define MC_CMD_GET_LICENSED_V3_FEATURE_STATES 0xd3 +#undef MC_CMD_0xd3_PRIVILEGE_CTG + +#define MC_CMD_0xd3_PRIVILEGE_CTG SRIOV_CTG_GENERAL + +/* MC_CMD_GET_LICENSED_V3_FEATURE_STATES_IN msgrequest */ +#define MC_CMD_GET_LICENSED_V3_FEATURE_STATES_IN_LEN 8 +/* features to query (LICENSED_V3_FEATURES_xxx) expressed as a mask with one or + * more bits set + */ +#define MC_CMD_GET_LICENSED_V3_FEATURE_STATES_IN_FEATURES_OFST 0 +#define MC_CMD_GET_LICENSED_V3_FEATURE_STATES_IN_FEATURES_LEN 8 +#define MC_CMD_GET_LICENSED_V3_FEATURE_STATES_IN_FEATURES_LO_OFST 0 +#define MC_CMD_GET_LICENSED_V3_FEATURE_STATES_IN_FEATURES_HI_OFST 4 + +/* MC_CMD_GET_LICENSED_V3_FEATURE_STATES_OUT msgresponse */ +#define MC_CMD_GET_LICENSED_V3_FEATURE_STATES_OUT_LEN 8 +/* states of these features - bit set for licensed, clear for not licensed */ +#define MC_CMD_GET_LICENSED_V3_FEATURE_STATES_OUT_STATES_OFST 0 +#define MC_CMD_GET_LICENSED_V3_FEATURE_STATES_OUT_STATES_LEN 8 +#define MC_CMD_GET_LICENSED_V3_FEATURE_STATES_OUT_STATES_LO_OFST 0 +#define MC_CMD_GET_LICENSED_V3_FEATURE_STATES_OUT_STATES_HI_OFST 4 + + /***********************************/ /* MC_CMD_LICENSED_APP_OP - * Perform an action for an individual licensed application. + * Perform an action for an individual licensed application - not used for V3 + * licensing. */ #define MC_CMD_LICENSED_APP_OP 0xf6 #undef MC_CMD_0xf6_PRIVILEGE_CTG @@ -12116,6 +12871,69 @@ #define MC_CMD_LICENSED_APP_OP_MASK_OUT_LEN 0 +/***********************************/ +/* MC_CMD_LICENSED_V3_VALIDATE_APP + * Perform validation for an individual licensed application - V3 licensing + * (Medford) + */ +#define MC_CMD_LICENSED_V3_VALIDATE_APP 0xd4 +#undef MC_CMD_0xd4_PRIVILEGE_CTG + +#define MC_CMD_0xd4_PRIVILEGE_CTG SRIOV_CTG_GENERAL + +/* MC_CMD_LICENSED_V3_VALIDATE_APP_IN msgrequest */ +#define MC_CMD_LICENSED_V3_VALIDATE_APP_IN_LEN 72 +/* application ID expressed as a single bit mask */ +#define MC_CMD_LICENSED_V3_VALIDATE_APP_IN_APP_ID_OFST 0 +#define MC_CMD_LICENSED_V3_VALIDATE_APP_IN_APP_ID_LEN 8 +#define MC_CMD_LICENSED_V3_VALIDATE_APP_IN_APP_ID_LO_OFST 0 +#define MC_CMD_LICENSED_V3_VALIDATE_APP_IN_APP_ID_HI_OFST 4 +/* challenge for validation */ +#define MC_CMD_LICENSED_V3_VALIDATE_APP_IN_CHALLENGE_OFST 8 +#define MC_CMD_LICENSED_V3_VALIDATE_APP_IN_CHALLENGE_LEN 64 + +/* MC_CMD_LICENSED_V3_VALIDATE_APP_OUT msgresponse */ +#define MC_CMD_LICENSED_V3_VALIDATE_APP_OUT_LEN 72 +/* application expiry time */ +#define MC_CMD_LICENSED_V3_VALIDATE_APP_OUT_EXPIRY_TIME_OFST 0 +/* application expiry units */ +#define MC_CMD_LICENSED_V3_VALIDATE_APP_OUT_EXPIRY_UNITS_OFST 4 +/* enum: expiry units are accounting units */ +#define MC_CMD_LICENSED_V3_VALIDATE_APP_OUT_EXPIRY_UNIT_ACC 0x0 +/* enum: expiry units are calendar days */ +#define MC_CMD_LICENSED_V3_VALIDATE_APP_OUT_EXPIRY_UNIT_DAYS 0x1 +/* validation response to challenge */ +#define MC_CMD_LICENSED_V3_VALIDATE_APP_OUT_RESPONSE_OFST 8 +#define MC_CMD_LICENSED_V3_VALIDATE_APP_OUT_RESPONSE_LEN 64 + + +/***********************************/ +/* MC_CMD_LICENSED_V3_MASK_FEATURES + * Mask features - V3 licensing (Medford) + */ +#define MC_CMD_LICENSED_V3_MASK_FEATURES 0xd5 +#undef MC_CMD_0xd5_PRIVILEGE_CTG + +#define MC_CMD_0xd5_PRIVILEGE_CTG SRIOV_CTG_GENERAL + +/* MC_CMD_LICENSED_V3_MASK_FEATURES_IN msgrequest */ +#define MC_CMD_LICENSED_V3_MASK_FEATURES_IN_LEN 12 +/* mask to be applied to features to be changed */ +#define MC_CMD_LICENSED_V3_MASK_FEATURES_IN_MASK_OFST 0 +#define MC_CMD_LICENSED_V3_MASK_FEATURES_IN_MASK_LEN 8 +#define MC_CMD_LICENSED_V3_MASK_FEATURES_IN_MASK_LO_OFST 0 +#define MC_CMD_LICENSED_V3_MASK_FEATURES_IN_MASK_HI_OFST 4 +/* whether to turn on or turn off the masked features */ +#define MC_CMD_LICENSED_V3_MASK_FEATURES_IN_FLAG_OFST 8 +/* enum: turn the features off */ +#define MC_CMD_LICENSED_V3_MASK_FEATURES_IN_OFF 0x0 +/* enum: turn the features back on */ +#define MC_CMD_LICENSED_V3_MASK_FEATURES_IN_ON 0x1 + +/* MC_CMD_LICENSED_V3_MASK_FEATURES_OUT msgresponse */ +#define MC_CMD_LICENSED_V3_MASK_FEATURES_OUT_LEN 0 + + /***********************************/ /* MC_CMD_SET_PORT_SNIFF_CONFIG * Configure RX port sniffing for the physical port associated with the calling From c1f892e0d16efb8eefd25be64c36c3add2d29c8d Mon Sep 17 00:00:00 2001 From: Ian Lepore Date: Tue, 12 Jan 2016 16:31:07 +0000 Subject: [PATCH 49/82] Cast using uintfptr_t and eliminate the cast to uint64_t which is uneeded because rounding down cannot increase the number of bits needed to express the result. I had no idea there was such a thing as uintfptr_t. Requested by: bde --- sys/boot/uboot/lib/copy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/boot/uboot/lib/copy.c b/sys/boot/uboot/lib/copy.c index c0e8b81290bc..c96e7caf9712 100644 --- a/sys/boot/uboot/lib/copy.c +++ b/sys/boot/uboot/lib/copy.c @@ -100,7 +100,7 @@ uboot_loadaddr(u_int type, void *data, uint64_t addr) biggest_block = 0; biggest_size = 0; - subldr = rounddown2((uint64_t)(uintptr_t)_start, KERN_ALIGN); + subldr = rounddown2((uintfptr_t)_start, KERN_ALIGN); eubldr = roundup2((uint64_t)uboot_heap_end, KERN_ALIGN); for (i = 0; i < si->mr_no; i++) { if (si->mr[i].flags != MR_ATTR_DRAM) From fdfbb3f5b1b6199051e3421609c783b216cef6e5 Mon Sep 17 00:00:00 2001 From: Ian Lepore Date: Tue, 12 Jan 2016 18:42:00 +0000 Subject: [PATCH 50/82] Restore uart PPS signal capture polarity to its historical norm, and add an option to invert the polarity in software. Also add an option to capture very narrow pulses by using the hardware's MSR delta-bit capability of latching line state changes. This effectively reverts the mistake I made in r286595 which was based on empirical measurements made on hardware using TTL-level signaling, in which the logic levels are inverted from RS-232. Thus, this re-syncs the polarity with the requirements of RFC 2783, which is writen in terms of RS-232 signaling. Narrow-pulse mode uses the ability of most ns8250 and similar chips to provide a delta indication in the modem status register. The hardware is able to notice and latch the change when the pulse width is shorter than interrupt latency, which results in the signal no longer being asserted by time the interrupt service code runs. When running in this mode we get notified only that "a pulse happened" so the driver synthesizes both an ASSERT and a CLEAR event (with the same timestamp for each). When the pulse width is about equal to the interrupt latency the driver may intermittantly see both edges of the pulse. To prevent generating spurious events, the driver implements a half-second lockout period after generating an event before it will generate another. Differential Revision: https://reviews.freebsd.org/D4477 --- share/man/man4/uart.4 | 53 ++++++++++-- sys/dev/uart/uart_bus.h | 1 + sys/dev/uart/uart_core.c | 143 +++++++++++++++++++++------------ sys/dev/uart/uart_dev_ns8250.c | 76 ++++++++++++++---- sys/dev/uart/uart_ppstypes.h | 46 +++++++++++ 5 files changed, 247 insertions(+), 72 deletions(-) create mode 100644 sys/dev/uart/uart_ppstypes.h diff --git a/share/man/man4/uart.4 b/share/man/man4/uart.4 index 3fca2f89de8b..138e04924196 100644 --- a/share/man/man4/uart.4 +++ b/share/man/man4/uart.4 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 10, 2015 +.Dd December 9, 2015 .Dt UART 4 .Os .Sh NAME @@ -160,7 +160,9 @@ The API, accessed via is available on the tty device. To use the PPS capture feature with .Xr ntpd 8 , -symlink the tty device to +symlink the tty callout device +.Va /dev/cuau? +to .Va /dev/pps0. .Pp The @@ -175,15 +177,54 @@ it can be set in .Xr loader.conf 5 or .Xr sysctl.conf 5 . +.Pp The following capture modes are available: .Bl -tag -compact -offset "mmmm" -width "mmmm" -.It 0 +.It 0x00 Capture disabled. -.It 1 +.It 0x01 Capture pulses on the CTS line. -.It 2 -Capture pulses on the DCD line (default). +.It 0x02 +Capture pulses on the DCD line. .El +.Pp +The following values may be ORed with the capture mode to configure +capture processing options: +.Bl -tag -compact -offset "mmmm" -width "mmmm" +.It 0x10 +Invert the pulse (RS-232 logic low = ASSERT, high = CLEAR). +.It 0x20 +Attempt to capture narrow pulses. +.El +.Pp +Add the narrow pulse option when the incoming PPS pulse width is small +enough to prevent reliable capture in normal mode. +In narrow mode the driver uses the hardware's ability to latch a line +state change; not all hardware has this capability. +The hardware latch provides a reliable indication that a pulse occurred, +but prevents distinguishing between the CLEAR and ASSERT edges of the pulse. +For each detected pulse, the driver synthesizes both an ASSERT and a CLEAR +event, using the same timestamp for each. +To prevent spurious events when the hardware is intermittently able to +see both edges of a pulse, the driver will not generate a new pair of +events within a half second of the prior pair. +Both normal and narrow pulse modes work with +.Xr ntpd 8 . +.Pp +Add the invert option when the connection to the uart device uses TTL +level signals, or when the PPS source emits inverted pulses. +RFC 2783 defines an ASSERT event as a higher-voltage line level, and a CLEAR +event as a lower-voltage line level, in the context of the RS-232 protocol. +The modem control signals on a TTL-level connection are typically +inverted from the RS-232 levels. +For example, carrier presence is indicated by a high signal on an RS-232 +DCD line, and by a low signal on a TTL DCD line. +This is due to the use of inverting line driver buffers to convert between +TTL and RS-232 line levels in most hardware designs. +Generally speaking, a connection to a DB-9 style connector is an RS-232 +level signal at up to 12 volts. +A connection to header pins or an edge-connector on an embedded board +is typically a TTL signal at 3.3 or 5 volts. .Sh FILES .Bl -tag -width ".Pa /dev/ttyu?.init" -compact .It Pa /dev/ttyu? diff --git a/sys/dev/uart/uart_bus.h b/sys/dev/uart/uart_bus.h index 11d599e670fe..d46c28dd4e53 100644 --- a/sys/dev/uart/uart_bus.h +++ b/sys/dev/uart/uart_bus.h @@ -113,6 +113,7 @@ struct uart_softc { /* Pulse capturing support (PPS). */ struct pps_state sc_pps; int sc_pps_mode; + sbintime_t sc_pps_captime; /* Upper layer data. */ void *sc_softih; diff --git a/sys/dev/uart/uart_core.c b/sys/dev/uart/uart_core.c index 96b45299a18a..9650dd501e68 100644 --- a/sys/dev/uart/uart_core.c +++ b/sys/dev/uart/uart_core.c @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "uart_if.h" @@ -70,47 +71,47 @@ static int uart_force_poll; SYSCTL_INT(_debug, OID_AUTO, uart_force_poll, CTLFLAG_RDTUN, &uart_force_poll, 0, "Force UART polling"); -#define PPS_MODE_DISABLED 0 -#define PPS_MODE_CTS 1 -#define PPS_MODE_DCD 2 - -static inline int -uart_pps_signal(int pps_mode) -{ - - switch(pps_mode) { - case PPS_MODE_CTS: - return (SER_CTS); - case PPS_MODE_DCD: - return (SER_DCD); - } - return (0); -} static inline int uart_pps_mode_valid(int pps_mode) { + int opt; - switch(pps_mode) { - case PPS_MODE_DISABLED: - case PPS_MODE_CTS: - case PPS_MODE_DCD: - return (true); + switch(pps_mode & UART_PPS_SIGNAL_MASK) { + case UART_PPS_DISABLED: + case UART_PPS_CTS: + case UART_PPS_DCD: + break; + default: + return (false); } - return (false); + + opt = pps_mode & UART_PPS_OPTION_MASK; + if ((opt & ~(UART_PPS_INVERT_PULSE | UART_PPS_NARROW_PULSE)) != 0) + return (false); + + return (true); } -static const char * -uart_pps_mode_name(int pps_mode) +static void +uart_pps_print_mode(struct uart_softc *sc) { - switch(pps_mode) { - case PPS_MODE_DISABLED: - return ("disabled"); - case PPS_MODE_CTS: - return ("CTS"); - case PPS_MODE_DCD: - return ("DCD"); + + device_printf(sc->sc_dev, "PPS capture mode: "); + switch(sc->sc_pps_mode) { + case UART_PPS_DISABLED: + printf("disabled"); + case UART_PPS_CTS: + printf("CTS"); + case UART_PPS_DCD: + printf("DCD"); + default: + printf("invalid"); } - return ("invalid"); + if (sc->sc_pps_mode & UART_PPS_INVERT_PULSE) + printf("-Inverted"); + if (sc->sc_pps_mode & UART_PPS_NARROW_PULSE) + printf("-NarrowPulse"); + printf("\n"); } static int @@ -130,6 +131,55 @@ uart_pps_mode_sysctl(SYSCTL_HANDLER_ARGS) return(0); } +static void +uart_pps_process(struct uart_softc *sc, int ser_sig) +{ + sbintime_t now; + int is_assert, pps_sig; + + /* Which signal is configured as PPS? Early out if none. */ + switch(sc->sc_pps_mode & UART_PPS_SIGNAL_MASK) { + case UART_PPS_CTS: + pps_sig = SER_CTS; + break; + case UART_PPS_DCD: + pps_sig = SER_DCD; + break; + default: + return; + } + + /* Early out if there is no change in the signal configured as PPS. */ + if ((ser_sig & SER_DELTA(pps_sig)) == 0) + return; + + /* + * In narrow-pulse mode we need to synthesize both capture and clear + * events from a single "delta occurred" indication from the uart + * hardware because the pulse width is too narrow to reliably detect + * both edges. However, when the pulse width is close to our interrupt + * processing latency we might intermittantly catch both edges. To + * guard against generating spurious events when that happens, we use a + * separate timer to ensure at least half a second elapses before we + * generate another event. + */ + pps_capture(&sc->sc_pps); + if (sc->sc_pps_mode & UART_PPS_NARROW_PULSE) { + now = getsbinuptime(); + if (now > sc->sc_pps_captime + 500 * SBT_1MS) { + sc->sc_pps_captime = now; + pps_event(&sc->sc_pps, PPS_CAPTUREASSERT); + pps_event(&sc->sc_pps, PPS_CAPTURECLEAR); + } + } else { + is_assert = ser_sig & pps_sig; + if (sc->sc_pps_mode & UART_PPS_INVERT_PULSE) + is_assert = !is_assert; + pps_event(&sc->sc_pps, is_assert ? PPS_CAPTUREASSERT : + PPS_CAPTURECLEAR); + } +} + static void uart_pps_init(struct uart_softc *sc) { @@ -147,23 +197,23 @@ uart_pps_init(struct uart_softc *sc) * for one specific device. */ #ifdef UART_PPS_ON_CTS - sc->sc_pps_mode = PPS_MODE_CTS; + sc->sc_pps_mode = UART_PPS_CTS; #else - sc->sc_pps_mode = PPS_MODE_DCD; + sc->sc_pps_mode = UART_PPS_DCD; #endif TUNABLE_INT_FETCH("hw.uart.pps_mode", &sc->sc_pps_mode); SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "pps_mode", CTLTYPE_INT | CTLFLAG_RWTUN, sc, 0, uart_pps_mode_sysctl, "I", - "pulse capturing mode - 0/1/2 - disabled/CTS/DCD"); + "pulse mode: 0/1/2=disabled/CTS/DCD; " + "add 0x10 to invert, 0x20 for narrow pulse"); if (!uart_pps_mode_valid(sc->sc_pps_mode)) { device_printf(sc->sc_dev, - "Invalid pps_mode %d configured; disabling PPS capture\n", + "Invalid pps_mode 0x%02x configured; disabling PPS capture\n", sc->sc_pps_mode); - sc->sc_pps_mode = PPS_MODE_DISABLED; + sc->sc_pps_mode = UART_PPS_DISABLED; } else if (bootverbose) { - device_printf(sc->sc_dev, "PPS capture mode %d (%s)\n", - sc->sc_pps_mode, uart_pps_mode_name(sc->sc_pps_mode)); + uart_pps_print_mode(sc); } sc->sc_pps.ppscap = PPS_CAPTUREBOTH; @@ -313,23 +363,16 @@ static __inline int uart_intr_sigchg(void *arg) { struct uart_softc *sc = arg; - int new, old, pps_sig, sig; + int new, old, sig; sig = UART_GETSIG(sc); /* - * Time pulse counting support. Note that both CTS and DCD are - * active-low signals. The status bit is high to indicate that - * the signal on the line is low, which corresponds to a PPS - * clear event. + * Time pulse counting support, invoked whenever the PPS parameters are + * currently set to capture either edge of the signal. */ if (sc->sc_pps.ppsparam.mode & PPS_CAPTUREBOTH) { - pps_sig = uart_pps_signal(sc->sc_pps_mode); - if (sig & SER_DELTA(pps_sig)) { - pps_capture(&sc->sc_pps); - pps_event(&sc->sc_pps, (sig & pps_sig) ? - PPS_CAPTURECLEAR : PPS_CAPTUREASSERT); - } + uart_pps_process(sc, sig); } /* diff --git a/sys/dev/uart/uart_dev_ns8250.c b/sys/dev/uart/uart_dev_ns8250.c index ee0b37badb08..ee21f43aa6cf 100644 --- a/sys/dev/uart/uart_dev_ns8250.c +++ b/sys/dev/uart/uart_dev_ns8250.c @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #endif #include #include +#include #include @@ -401,11 +402,40 @@ static struct ofw_compat_data compat_data[] = { UART_FDT_CLASS_AND_DEVICE(compat_data); #endif -#define SIGCHG(c, i, s, d) \ - if (c) { \ - i |= (i & s) ? s : s | d; \ - } else { \ - i = (i & s) ? (i & ~s) | d : i; \ +/* Use token-pasting to form SER_ and MSR_ named constants. */ +#define SER(sig) SER_##sig +#define SERD(sig) SER_D##sig +#define MSR(sig) MSR_##sig +#define MSRD(sig) MSR_D##sig + +/* + * Detect signal changes using software delta detection. The previous state of + * the signals is in 'var' the new hardware state is in 'msr', and 'sig' is the + * short name (DCD, CTS, etc) of the signal bit being processed; 'var' gets the + * new state of both the signal and the delta bits. + */ +#define SIGCHGSW(var, msr, sig) \ + if ((msr) & MSR(sig)) { \ + if ((var & SER(sig)) == 0) \ + var |= SERD(sig) | SER(sig); \ + } else { \ + if ((var & SER(sig)) != 0) \ + var = SERD(sig) | (var & ~SER(sig)); \ + } + +/* + * Detect signal changes using the hardware msr delta bits. This is currently + * used only when PPS timing information is being captured using the "narrow + * pulse" option. With a narrow PPS pulse the signal may not still be asserted + * by time the interrupt handler is invoked. The hardware will latch the fact + * that it changed in the delta bits. + */ +#define SIGCHGHW(var, msr, sig) \ + if ((msr) & MSRD(sig)) { \ + if (((msr) & MSR(sig)) != 0) \ + var |= SERD(sig) | SER(sig); \ + else \ + var = SERD(sig) | (var & ~SER(sig)); \ } int @@ -532,21 +562,37 @@ ns8250_bus_flush(struct uart_softc *sc, int what) int ns8250_bus_getsig(struct uart_softc *sc) { - uint32_t new, old, sig; + uint32_t old, sig; uint8_t msr; + /* + * The delta bits are reputed to be broken on some hardware, so use + * software delta detection by default. Use the hardware delta bits + * when capturing PPS pulses which are too narrow for software detection + * to see the edges. Hardware delta for RI doesn't work like the + * others, so always use software for it. Other threads may be changing + * other (non-MSR) bits in sc_hwsig, so loop until it can succesfully + * update without other changes happening. Note that the SIGCHGxx() + * macros carefully preserve the delta bits when we have to loop several + * times and a signal transitions between iterations. + */ do { old = sc->sc_hwsig; sig = old; uart_lock(sc->sc_hwmtx); msr = uart_getreg(&sc->sc_bas, REG_MSR); uart_unlock(sc->sc_hwmtx); - SIGCHG(msr & MSR_DSR, sig, SER_DSR, SER_DDSR); - SIGCHG(msr & MSR_CTS, sig, SER_CTS, SER_DCTS); - SIGCHG(msr & MSR_DCD, sig, SER_DCD, SER_DDCD); - SIGCHG(msr & MSR_RI, sig, SER_RI, SER_DRI); - new = sig & ~SER_MASK_DELTA; - } while (!atomic_cmpset_32(&sc->sc_hwsig, old, new)); + if (sc->sc_pps_mode & UART_PPS_NARROW_PULSE) { + SIGCHGHW(sig, msr, DSR); + SIGCHGHW(sig, msr, CTS); + SIGCHGHW(sig, msr, DCD); + } else { + SIGCHGSW(sig, msr, DSR); + SIGCHGSW(sig, msr, CTS); + SIGCHGSW(sig, msr, DCD); + } + SIGCHGSW(sig, msr, RI); + } while (!atomic_cmpset_32(&sc->sc_hwsig, old, sig & ~SER_MASK_DELTA)); return (sig); } @@ -900,12 +946,10 @@ ns8250_bus_setsig(struct uart_softc *sc, int sig) old = sc->sc_hwsig; new = old; if (sig & SER_DDTR) { - SIGCHG(sig & SER_DTR, new, SER_DTR, - SER_DDTR); + new = (new & ~SER_DTR) | (sig & (SER_DTR | SER_DDTR)); } if (sig & SER_DRTS) { - SIGCHG(sig & SER_RTS, new, SER_RTS, - SER_DRTS); + new = (new & ~SER_RTS) | (sig & (SER_RTS | SER_DRTS)); } } while (!atomic_cmpset_32(&sc->sc_hwsig, old, new)); uart_lock(sc->sc_hwmtx); diff --git a/sys/dev/uart/uart_ppstypes.h b/sys/dev/uart/uart_ppstypes.h new file mode 100644 index 000000000000..142d0f19c992 --- /dev/null +++ b/sys/dev/uart/uart_ppstypes.h @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 2015 Ian Lepore + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _DEV_UART_PPSTYPES_H_ +#define _DEV_UART_PPSTYPES_H_ + +/* + * These constants are shared by several drivers including uart and usb_serial. + */ + +#define UART_PPS_SIGNAL_MASK 0x0f +#define UART_PPS_OPTION_MASK 0xf0 + +#define UART_PPS_DISABLED 0x00 +#define UART_PPS_CTS 0x01 +#define UART_PPS_DCD 0x02 + +#define UART_PPS_INVERT_PULSE 0x10 +#define UART_PPS_NARROW_PULSE 0x20 + +#endif /* _DEV_UART_PPSTYPES_H_ */ From b956ae7c20d2da1bcd90576bb702e8b102fdac64 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Tue, 12 Jan 2016 20:53:57 +0000 Subject: [PATCH 51/82] Update futimens/utimensat for MFC to stable/10: * Fix __FreeBSD_version check. * Update history section in man page. An MFC of this commit to stable/10 will allow using the new system calls instead of the fallback. MFC after: 3 days --- lib/libc/sys/futimens.c | 5 ++++- lib/libc/sys/utimensat.2 | 4 ++-- lib/libc/sys/utimensat.c | 5 ++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/libc/sys/futimens.c b/lib/libc/sys/futimens.c index 2014cc5cecf3..59fb37f5249a 100644 --- a/lib/libc/sys/futimens.c +++ b/lib/libc/sys/futimens.c @@ -42,8 +42,11 @@ futimens(int fd, const struct timespec times[2]) { struct timeval now, tv[2], *tvp; struct stat sb; + int osreldate; - if (__getosreldate() >= 1100056) + osreldate = __getosreldate(); + if (osreldate >= 1100056 || + (osreldate >= 1002506 && osreldate < 1100000)) return (__sys_futimens(fd, times)); if (times == NULL || (times[0].tv_nsec == UTIME_NOW && diff --git a/lib/libc/sys/utimensat.2 b/lib/libc/sys/utimensat.2 index 0f397c6a99aa..57ad904206ed 100644 --- a/lib/libc/sys/utimensat.2 +++ b/lib/libc/sys/utimensat.2 @@ -31,7 +31,7 @@ .\" @(#)utimes.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd January 23, 2015 +.Dd January 12, 2016 .Dt UTIMENSAT 2 .Os .Sh NAME @@ -289,4 +289,4 @@ The and .Fn utimensat system calls appeared in -.Fx 11.0 . +.Fx 10.3 . diff --git a/lib/libc/sys/utimensat.c b/lib/libc/sys/utimensat.c index 67d19cb2f9ba..a1c3c211fe95 100644 --- a/lib/libc/sys/utimensat.c +++ b/lib/libc/sys/utimensat.c @@ -42,8 +42,11 @@ utimensat(int fd, const char *path, const struct timespec times[2], int flag) { struct timeval now, tv[2], *tvp; struct stat sb; + int osreldate; - if (__getosreldate() >= 1100056) + osreldate = __getosreldate(); + if (osreldate >= 1100056 || + (osreldate >= 1002506 && osreldate < 1100000)) return (__sys_utimensat(fd, path, times, flag)); if ((flag & ~AT_SYMLINK_NOFOLLOW) != 0) { From d45f99dee1b9400d538c24e162a73a216159f6af Mon Sep 17 00:00:00 2001 From: Ian Lepore Date: Wed, 13 Jan 2016 00:22:12 +0000 Subject: [PATCH 52/82] Go back to using uintptr_t, because code that actually compiles is infinitely less buggy than code that is theoretically correct in some alternate universe. The uintfptr_t type is apparently a freebsd invention, and exists only when compiling the kernel. It's a little hard to say for sure, since it doesn't seem to be documented anywhere except in email advice to unsuspecting and overly-trusting souls, who then get to wear the pointy hat for blindly following advice without investigating or testing it first. --- sys/boot/uboot/lib/copy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/boot/uboot/lib/copy.c b/sys/boot/uboot/lib/copy.c index c96e7caf9712..131b88d85861 100644 --- a/sys/boot/uboot/lib/copy.c +++ b/sys/boot/uboot/lib/copy.c @@ -100,7 +100,7 @@ uboot_loadaddr(u_int type, void *data, uint64_t addr) biggest_block = 0; biggest_size = 0; - subldr = rounddown2((uintfptr_t)_start, KERN_ALIGN); + subldr = rounddown2((uintptr_t)_start, KERN_ALIGN); eubldr = roundup2((uint64_t)uboot_heap_end, KERN_ALIGN); for (i = 0; i < si->mr_no; i++) { if (si->mr[i].flags != MR_ATTR_DRAM) From 1b383bfca2e53d53a8a40c04a0a870fa0f424edd Mon Sep 17 00:00:00 2001 From: Steven Hartland Date: Wed, 13 Jan 2016 00:37:28 +0000 Subject: [PATCH 53/82] Fix typo in libefi.c Fix a typo in libefl.c (removal or L) introduced by r293724 MFC after: 2 weeks X-MFC-With: r293268 Sponsored by: Multiplay --- sys/boot/efi/libefi/libefi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/boot/efi/libefi/libefi.c b/sys/boot/efi/libefi/libefi.c index 0c24c6d64a72..f87b89acb2bc 100644 --- a/sys/boot/efi/libefi/libefi.c +++ b/sys/boot/efi/libefi/libefi.c @@ -179,7 +179,7 @@ efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *system_table) argv = malloc((argc + 1) * sizeof(CHAR16*)); argc = 0; if (addprog) - argv[argc++] = (CHAR16 *)"loader.efi"; + argv[argc++] = (CHAR16 *)L"loader.efi"; argp = args; while (argp != NULL && *argp != 0) { argp = arg_skipsep(argp); From 3bf7d9a6ebe7f0bd629f421399048bbf49b54e3a Mon Sep 17 00:00:00 2001 From: Marcelo Araujo Date: Wed, 13 Jan 2016 01:49:35 +0000 Subject: [PATCH 54/82] ypldap(8) is a feature ready to be used to translate nis(8) database to ldap(3). This commit, fix a core dump on ypldap(8) related with memory allocation. Also an example of how to set the ypldap.conf(5) properly is added to examples files. A new user _ypldap is required to be able to run ypldap(8) as well as in a chroot mode. Reviewed by: rodrigc (mentor), bjk Approved by: bapt (mentor) Relnotes: Yes Sponsored by: gandi.net Differential Revision: https://reviews.freebsd.org/D4744 --- UPDATING | 5 ++++ etc/master.passwd | 1 + share/examples/ypldap/ypldap.conf | 40 +++++++++++++++++++++++++++++++ usr.sbin/ypldap/yp.c | 4 ++-- usr.sbin/ypldap/ypldap.conf.5 | 5 +++- 5 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 share/examples/ypldap/ypldap.conf diff --git a/UPDATING b/UPDATING index 52ce52ae9c5e..126d8c13c829 100644 --- a/UPDATING +++ b/UPDATING @@ -31,6 +31,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11.x IS SLOW: disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20160113: + With the addition of ypldap(8), a new _ypldap user is now required + during installworld. "mergemaster -p" can be used to add the user + prior to installworld, as documented in the handbook. + 20151216: The tftp loader (pxeboot) now uses the option root-path directive. As a consequence it no longer looks for a pxeboot.4th file on the tftp diff --git a/etc/master.passwd b/etc/master.passwd index f2a4523131c1..fc7fef59438b 100644 --- a/etc/master.passwd +++ b/etc/master.passwd @@ -22,5 +22,6 @@ uucp:*:66:66::0:0:UUCP pseudo-user:/var/spool/uucppublic:/usr/local/libexec/uucp pop:*:68:6::0:0:Post Office Owner:/nonexistent:/usr/sbin/nologin auditdistd:*:78:77::0:0:Auditdistd unprivileged user:/var/empty:/usr/sbin/nologin www:*:80:80::0:0:World Wide Web Owner:/nonexistent:/usr/sbin/nologin +_ypldap:*:93:93::0:0:YP Ldap unprivileged user:/var/empty:/usr/sbin/nologin hast:*:845:845::0:0:HAST unprivileged user:/var/empty:/usr/sbin/nologin nobody:*:65534:65534::0:0:Unprivileged user:/nonexistent:/usr/sbin/nologin diff --git a/share/examples/ypldap/ypldap.conf b/share/examples/ypldap/ypldap.conf new file mode 100644 index 000000000000..83d25ac60ba8 --- /dev/null +++ b/share/examples/ypldap/ypldap.conf @@ -0,0 +1,40 @@ +$FreeBSD$ +domain "freebsd.org" +interval 60 +provide map "passwd.byname" +provide map "passwd.byuid" +provide map "group.byname" +provide map "group.bygid" +provide map "netid.byname" + +directory "127.0.0.1" { + # directory options + binddn "cn=ldap,dc=freebsd,dc=org" + bindcred "secret" + basedn "dc=freebsd.,dc=org" + # starting point for groups directory search, default to basedn + groupdn "ou=Groups,dc=freebsd,dc=org" + + # passwd maps configuration (RFC 2307 posixAccount object class) + passwd filter "(objectClass=posixAccount)" + + attribute name maps to "uid" + fixed attribute passwd "*" + attribute uid maps to "uidNumber" + attribute gid maps to "gidNumber" + attribute gecos maps to "cn" + attribute home maps to "homeDirectory" + attribute shell maps to "loginShell" + fixed attribute change "0" + fixed attribute expire "0" + fixed attribute class "" + + # group maps configuration (RFC 2307 posixGroup object class) + group filter "(objectClass=posixGroup)" + + attribute groupname maps to "cn" + fixed attribute grouppasswd "*" + attribute groupgid maps to "gidNumber" + # memberUid returns multiple group members + list groupmembers maps to "memberUid" +} diff --git a/usr.sbin/ypldap/yp.c b/usr.sbin/ypldap/yp.c index e46113636d44..367624574cea 100644 --- a/usr.sbin/ypldap/yp.c +++ b/usr.sbin/ypldap/yp.c @@ -83,10 +83,10 @@ void yp_enable_events(void) { int i; - extern fd_set svc_fdset; + extern fd_set svc_fdset; struct yp_event *ye; - for (i = 0; i < getdtablesize(); i++) { + for (i = 0; i < FD_SETSIZE; i++) { if (FD_ISSET(i, &svc_fdset)) { if ((ye = calloc(1, sizeof(*ye))) == NULL) fatal(NULL); diff --git a/usr.sbin/ypldap/ypldap.conf.5 b/usr.sbin/ypldap/ypldap.conf.5 index 5c22b3ba51cc..5c936a95e741 100644 --- a/usr.sbin/ypldap/ypldap.conf.5 +++ b/usr.sbin/ypldap/ypldap.conf.5 @@ -15,7 +15,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: April 30 2012 $ +.Dd $Mdocdate: January 13 2016 $ .Dt YPLDAP.CONF 5 .Os .Sh NAME @@ -155,6 +155,9 @@ Use the supplied LDAP filter to retrieve password entries. .It Pa /etc/ypldap.conf .Xr ypldap 8 configuration file. +.It Pa /usr/share/example/ypldap/ypldap.conf +.Xr ypldap 8 +configuration file example. .El .Sh SEE ALSO .Xr ypbind 8 , From a78d512838f4ec93f3b43bc1328a04470154d8ac Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Wed, 13 Jan 2016 06:34:51 +0000 Subject: [PATCH 55/82] sfxge: rename common hunt NIC methods to ef10 Submitted by: Mark Spender Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D4880 --- sys/dev/sfxge/common/efx_nic.c | 18 +++---- sys/dev/sfxge/common/hunt_impl.h | 28 +++++----- sys/dev/sfxge/common/hunt_nic.c | 90 ++++++++++++++++++-------------- sys/dev/sfxge/common/hunt_rx.c | 2 +- sys/dev/sfxge/common/hunt_tx.c | 10 ++-- 5 files changed, 79 insertions(+), 69 deletions(-) diff --git a/sys/dev/sfxge/common/efx_nic.c b/sys/dev/sfxge/common/efx_nic.c index f5f7aea1f4c9..69d61a021885 100644 --- a/sys/dev/sfxge/common/efx_nic.c +++ b/sys/dev/sfxge/common/efx_nic.c @@ -284,18 +284,18 @@ static efx_nic_ops_t __efx_nic_siena_ops = { #if EFSYS_OPT_HUNTINGTON static efx_nic_ops_t __efx_nic_hunt_ops = { - hunt_nic_probe, /* eno_probe */ - hunt_nic_set_drv_limits, /* eno_set_drv_limits */ - hunt_nic_reset, /* eno_reset */ - hunt_nic_init, /* eno_init */ - hunt_nic_get_vi_pool, /* eno_get_vi_pool */ - hunt_nic_get_bar_region, /* eno_get_bar_region */ + ef10_nic_probe, /* eno_probe */ + ef10_nic_set_drv_limits, /* eno_set_drv_limits */ + ef10_nic_reset, /* eno_reset */ + ef10_nic_init, /* eno_init */ + ef10_nic_get_vi_pool, /* eno_get_vi_pool */ + ef10_nic_get_bar_region, /* eno_get_bar_region */ #if EFSYS_OPT_DIAG ef10_sram_test, /* eno_sram_test */ - hunt_nic_register_test, /* eno_register_test */ + ef10_nic_register_test, /* eno_register_test */ #endif /* EFSYS_OPT_DIAG */ - hunt_nic_fini, /* eno_fini */ - hunt_nic_unprobe, /* eno_unprobe */ + ef10_nic_fini, /* eno_fini */ + ef10_nic_unprobe, /* eno_unprobe */ }; #endif /* EFSYS_OPT_HUNTINGTON */ diff --git a/sys/dev/sfxge/common/hunt_impl.h b/sys/dev/sfxge/common/hunt_impl.h index c76d36efbca4..e9bf760eaa07 100644 --- a/sys/dev/sfxge/common/hunt_impl.h +++ b/sys/dev/sfxge/common/hunt_impl.h @@ -52,7 +52,7 @@ extern "C" { /* Alignment requirement for value written to RX WPTR: * the WPTR must be aligned to an 8 descriptor boundary */ -#define HUNTINGTON_RX_WPTR_ALIGN 8 +#define EF10_RX_WPTR_ALIGN 8 /* Invalid RSS context handle */ #define EF10_RSS_CONTEXT_INVALID (0xffffffff) @@ -161,48 +161,48 @@ ef10_intr_fini( /* NIC */ extern __checkReturn efx_rc_t -hunt_nic_probe( +ef10_nic_probe( __in efx_nic_t *enp); extern __checkReturn efx_rc_t -hunt_nic_set_drv_limits( +ef10_nic_set_drv_limits( __inout efx_nic_t *enp, __in efx_drv_limits_t *edlp); extern __checkReturn efx_rc_t -hunt_nic_get_vi_pool( +ef10_nic_get_vi_pool( __in efx_nic_t *enp, __out uint32_t *vi_countp); extern __checkReturn efx_rc_t -hunt_nic_get_bar_region( +ef10_nic_get_bar_region( __in efx_nic_t *enp, __in efx_nic_region_t region, __out uint32_t *offsetp, __out size_t *sizep); extern __checkReturn efx_rc_t -hunt_nic_reset( +ef10_nic_reset( __in efx_nic_t *enp); extern __checkReturn efx_rc_t -hunt_nic_init( +ef10_nic_init( __in efx_nic_t *enp); #if EFSYS_OPT_DIAG extern __checkReturn efx_rc_t -hunt_nic_register_test( +ef10_nic_register_test( __in efx_nic_t *enp); #endif /* EFSYS_OPT_DIAG */ extern void -hunt_nic_fini( +ef10_nic_fini( __in efx_nic_t *enp); extern void -hunt_nic_unprobe( +ef10_nic_unprobe( __in efx_nic_t *enp); @@ -747,7 +747,7 @@ typedef uint32_t efx_piobuf_handle_t; #define EFX_PIOBUF_HANDLE_INVALID ((efx_piobuf_handle_t) -1) extern __checkReturn efx_rc_t -hunt_nic_pio_alloc( +ef10_nic_pio_alloc( __inout efx_nic_t *enp, __out uint32_t *bufnump, __out efx_piobuf_handle_t *handlep, @@ -756,19 +756,19 @@ hunt_nic_pio_alloc( __out size_t *sizep); extern __checkReturn efx_rc_t -hunt_nic_pio_free( +ef10_nic_pio_free( __inout efx_nic_t *enp, __in uint32_t bufnum, __in uint32_t blknum); extern __checkReturn efx_rc_t -hunt_nic_pio_link( +ef10_nic_pio_link( __inout efx_nic_t *enp, __in uint32_t vi_index, __in efx_piobuf_handle_t handle); extern __checkReturn efx_rc_t -hunt_nic_pio_unlink( +ef10_nic_pio_unlink( __inout efx_nic_t *enp, __in uint32_t vi_index); diff --git a/sys/dev/sfxge/common/hunt_nic.c b/sys/dev/sfxge/common/hunt_nic.c index 3f86032918c1..d716bd820167 100644 --- a/sys/dev/sfxge/common/hunt_nic.c +++ b/sys/dev/sfxge/common/hunt_nic.c @@ -50,7 +50,8 @@ efx_mcdi_get_port_assignment( MC_CMD_GET_PORT_ASSIGNMENT_OUT_LEN)]; efx_rc_t rc; - EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON); + EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON || + enp->en_family == EFX_FAMILY_MEDFORD); (void) memset(payload, 0, sizeof (payload)); req.emr_cmd = MC_CMD_GET_PORT_ASSIGNMENT; @@ -93,7 +94,8 @@ efx_mcdi_get_port_modes( MC_CMD_GET_PORT_MODES_OUT_LEN)]; efx_rc_t rc; - EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON); + EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON || + enp->en_family == EFX_FAMILY_MEDFORD); (void) memset(payload, 0, sizeof (payload)); req.emr_cmd = MC_CMD_GET_PORT_MODES; @@ -212,7 +214,8 @@ efx_mcdi_get_mac_address_pf( MC_CMD_GET_MAC_ADDRESSES_OUT_LEN)]; efx_rc_t rc; - EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON); + EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON || + enp->en_family == EFX_FAMILY_MEDFORD); (void) memset(payload, 0, sizeof (payload)); req.emr_cmd = MC_CMD_GET_MAC_ADDRESSES; @@ -269,7 +272,8 @@ efx_mcdi_get_mac_address_vf( MC_CMD_VPORT_GET_MAC_ADDRESSES_OUT_LENMAX)]; efx_rc_t rc; - EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON); + EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON || + enp->en_family == EFX_FAMILY_MEDFORD); (void) memset(payload, 0, sizeof (payload)); req.emr_cmd = MC_CMD_VPORT_GET_MAC_ADDRESSES; @@ -331,7 +335,8 @@ efx_mcdi_get_clock( MC_CMD_GET_CLOCK_OUT_LEN)]; efx_rc_t rc; - EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON); + EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON || + enp->en_family == EFX_FAMILY_MEDFORD); (void) memset(payload, 0, sizeof (payload)); req.emr_cmd = MC_CMD_GET_CLOCK; @@ -706,7 +711,7 @@ efx_mcdi_unlink_piobuf( } static void -hunt_nic_alloc_piobufs( +ef10_nic_alloc_piobufs( __in efx_nic_t *enp, __in uint32_t max_piobuf_count) { @@ -743,7 +748,7 @@ hunt_nic_alloc_piobufs( static void -hunt_nic_free_piobufs( +ef10_nic_free_piobufs( __in efx_nic_t *enp) { efx_piobuf_handle_t *handlep; @@ -760,7 +765,7 @@ hunt_nic_free_piobufs( /* Sub-allocate a block from a piobuf */ __checkReturn efx_rc_t -hunt_nic_pio_alloc( +ef10_nic_pio_alloc( __inout efx_nic_t *enp, __out uint32_t *bufnump, __out efx_piobuf_handle_t *handlep, @@ -774,7 +779,8 @@ hunt_nic_pio_alloc( uint32_t buf, blk; efx_rc_t rc; - EFSYS_ASSERT3U(enp->en_family, ==, EFX_FAMILY_HUNTINGTON); + EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON || + enp->en_family == EFX_FAMILY_MEDFORD); EFSYS_ASSERT(bufnump); EFSYS_ASSERT(handlep); EFSYS_ASSERT(blknump); @@ -824,7 +830,7 @@ hunt_nic_pio_alloc( /* Free a piobuf sub-allocated block */ __checkReturn efx_rc_t -hunt_nic_pio_free( +ef10_nic_pio_free( __inout efx_nic_t *enp, __in uint32_t bufnum, __in uint32_t blknum) @@ -856,7 +862,7 @@ hunt_nic_pio_free( } __checkReturn efx_rc_t -hunt_nic_pio_link( +ef10_nic_pio_link( __inout efx_nic_t *enp, __in uint32_t vi_index, __in efx_piobuf_handle_t handle) @@ -865,7 +871,7 @@ hunt_nic_pio_link( } __checkReturn efx_rc_t -hunt_nic_pio_unlink( +ef10_nic_pio_unlink( __inout efx_nic_t *enp, __in uint32_t vi_index) { @@ -873,7 +879,7 @@ hunt_nic_pio_unlink( } static __checkReturn efx_rc_t -hunt_get_datapath_caps( +ef10_get_datapath_caps( __in efx_nic_t *enp) { efx_nic_cfg_t *encp = &(enp->en_nic_cfg); @@ -964,7 +970,7 @@ static struct { efx_family_t family; uint32_t modes_mask; uint32_t stride; -} __hunt_external_port_mappings[] = { +} __ef10_external_port_mappings[] = { /* Supported modes requiring 1 output per port */ { EFX_FAMILY_HUNTINGTON, @@ -993,7 +999,7 @@ static struct { }; static __checkReturn efx_rc_t -hunt_external_port_mapping( +ef10_external_port_mapping( __in efx_nic_t *enp, __in uint32_t port, __out uint8_t *external_portp) @@ -1013,14 +1019,14 @@ hunt_external_port_mapping( * Infer the internal port -> external port mapping from * the possible port modes for this NIC. */ - for (i = 0; i < EFX_ARRAY_SIZE(__hunt_external_port_mappings); ++i) { - if (__hunt_external_port_mappings[i].family != + for (i = 0; i < EFX_ARRAY_SIZE(__ef10_external_port_mappings); ++i) { + if (__ef10_external_port_mappings[i].family != enp->en_family) continue; - matches = (__hunt_external_port_mappings[i].modes_mask & + matches = (__ef10_external_port_mappings[i].modes_mask & port_modes); if (matches != 0) { - stride = __hunt_external_port_mappings[i].stride; + stride = __ef10_external_port_mappings[i].stride; port_modes &= ~matches; } } @@ -1073,7 +1079,7 @@ hunt_board_cfg( */ emip->emi_port = port + 1; - if ((rc = hunt_external_port_mapping(enp, port, + if ((rc = ef10_external_port_mapping(enp, port, &encp->enc_external_port)) != 0) goto fail2; @@ -1237,7 +1243,7 @@ hunt_board_cfg( } /* Check capabilities of running datapath firmware */ - if ((rc = hunt_get_datapath_caps(enp)) != 0) + if ((rc = ef10_get_datapath_caps(enp)) != 0) goto fail12; /* Alignment for receive packet DMA buffers */ @@ -1245,7 +1251,7 @@ hunt_board_cfg( encp->enc_rx_buf_align_end = 64; /* RX DMA end padding */ /* Alignment for WPTR updates */ - encp->enc_rx_push_align = HUNTINGTON_RX_WPTR_ALIGN; + encp->enc_rx_push_align = EF10_RX_WPTR_ALIGN; /* * Set resource limits for MC_CMD_ALLOC_VIS. Note that we cannot use @@ -1339,14 +1345,15 @@ hunt_board_cfg( __checkReturn efx_rc_t -hunt_nic_probe( +ef10_nic_probe( __in efx_nic_t *enp) { efx_nic_cfg_t *encp = &(enp->en_nic_cfg); efx_drv_cfg_t *edcp = &(enp->en_drv_cfg); efx_rc_t rc; - EFSYS_ASSERT3U(enp->en_family, ==, EFX_FAMILY_HUNTINGTON); + EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON || + enp->en_family == EFX_FAMILY_MEDFORD); /* Read and clear any assertion state */ if ((rc = efx_mcdi_read_assertion(enp)) != 0) @@ -1426,7 +1433,7 @@ hunt_nic_probe( } __checkReturn efx_rc_t -hunt_nic_set_drv_limits( +ef10_nic_set_drv_limits( __inout efx_nic_t *enp, __in efx_drv_limits_t *edlp) { @@ -1501,7 +1508,7 @@ hunt_nic_set_drv_limits( __checkReturn efx_rc_t -hunt_nic_reset( +ef10_nic_reset( __in efx_nic_t *enp) { efx_mcdi_req_t req; @@ -1509,7 +1516,7 @@ hunt_nic_reset( MC_CMD_ENTITY_RESET_OUT_LEN)]; efx_rc_t rc; - /* hunt_nic_reset() is called to recover from BADASSERT failures. */ + /* ef10_nic_reset() is called to recover from BADASSERT failures. */ if ((rc = efx_mcdi_read_assertion(enp)) != 0) goto fail1; if ((rc = efx_mcdi_exit_assertion_handler(enp)) != 0) @@ -1548,7 +1555,7 @@ hunt_nic_reset( } __checkReturn efx_rc_t -hunt_nic_init( +ef10_nic_init( __in efx_nic_t *enp) { efx_drv_cfg_t *edcp = &(enp->en_drv_cfg); @@ -1559,14 +1566,15 @@ hunt_nic_init( uint32_t delay_us; efx_rc_t rc; - EFSYS_ASSERT3U(enp->en_family, ==, EFX_FAMILY_HUNTINGTON); + EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON || + enp->en_family == EFX_FAMILY_MEDFORD); /* Enable reporting of some events (e.g. link change) */ if ((rc = efx_mcdi_log_ctrl(enp)) != 0) goto fail1; /* Allocate (optional) on-chip PIO buffers */ - hunt_nic_alloc_piobufs(enp, edcp->edc_max_piobuf_count); + ef10_nic_alloc_piobufs(enp, edcp->edc_max_piobuf_count); /* * For best performance, PIO writes should use a write-combined @@ -1610,7 +1618,7 @@ hunt_nic_init( if (vi_count < min_vi_count + enp->en_arch.ef10.ena_piobuf_count) { /* Not enough extra VIs to map piobufs */ - hunt_nic_free_piobufs(enp); + ef10_nic_free_piobufs(enp); } enp->en_arch.ef10.ena_pio_write_vi_base = @@ -1700,7 +1708,7 @@ hunt_nic_init( fail2: EFSYS_PROBE(fail2); - hunt_nic_free_piobufs(enp); + ef10_nic_free_piobufs(enp); fail1: EFSYS_PROBE1(fail1, efx_rc_t, rc); @@ -1709,11 +1717,12 @@ hunt_nic_init( } __checkReturn efx_rc_t -hunt_nic_get_vi_pool( +ef10_nic_get_vi_pool( __in efx_nic_t *enp, __out uint32_t *vi_countp) { - EFSYS_ASSERT3U(enp->en_family, ==, EFX_FAMILY_HUNTINGTON); + EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON || + enp->en_family == EFX_FAMILY_MEDFORD); /* * Report VIs that the client driver can use. @@ -1725,7 +1734,7 @@ hunt_nic_get_vi_pool( } __checkReturn efx_rc_t -hunt_nic_get_bar_region( +ef10_nic_get_bar_region( __in efx_nic_t *enp, __in efx_nic_region_t region, __out uint32_t *offsetp, @@ -1733,7 +1742,8 @@ hunt_nic_get_bar_region( { efx_rc_t rc; - EFSYS_ASSERT3U(enp->en_family, ==, EFX_FAMILY_HUNTINGTON); + EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON || + enp->en_family == EFX_FAMILY_MEDFORD); /* * TODO: Specify host memory mapping alignment and granularity @@ -1767,7 +1777,7 @@ hunt_nic_get_bar_region( } void -hunt_nic_fini( +ef10_nic_fini( __in efx_nic_t *enp) { uint32_t i; @@ -1786,14 +1796,14 @@ hunt_nic_fini( } } - hunt_nic_free_piobufs(enp); + ef10_nic_free_piobufs(enp); (void) efx_mcdi_free_vis(enp); enp->en_arch.ef10.ena_vi_count = 0; } void -hunt_nic_unprobe( +ef10_nic_unprobe( __in efx_nic_t *enp) { #if EFSYS_OPT_MON_STATS @@ -1805,7 +1815,7 @@ hunt_nic_unprobe( #if EFSYS_OPT_DIAG __checkReturn efx_rc_t -hunt_nic_register_test( +ef10_nic_register_test( __in efx_nic_t *enp) { efx_rc_t rc; diff --git a/sys/dev/sfxge/common/hunt_rx.c b/sys/dev/sfxge/common/hunt_rx.c index 57b0c3d63991..c7226b27c7d8 100644 --- a/sys/dev/sfxge/common/hunt_rx.c +++ b/sys/dev/sfxge/common/hunt_rx.c @@ -651,7 +651,7 @@ ef10_rx_qpush( efx_dword_t dword; /* Hardware has alignment restriction for WPTR */ - wptr = P2ALIGN(added, HUNTINGTON_RX_WPTR_ALIGN); + wptr = P2ALIGN(added, EF10_RX_WPTR_ALIGN); if (pushed == wptr) return; diff --git a/sys/dev/sfxge/common/hunt_tx.c b/sys/dev/sfxge/common/hunt_tx.c index f8e09c999893..843e38ecf773 100755 --- a/sys/dev/sfxge/common/hunt_tx.c +++ b/sys/dev/sfxge/common/hunt_tx.c @@ -251,7 +251,7 @@ ef10_tx_qpio_enable( } /* Sub-allocate a PIO block from a piobuf */ - if ((rc = hunt_nic_pio_alloc(enp, + if ((rc = ef10_nic_pio_alloc(enp, &etp->et_pio_bufnum, &handle, &etp->et_pio_blknum, @@ -262,7 +262,7 @@ ef10_tx_qpio_enable( EFSYS_ASSERT3U(etp->et_pio_size, !=, 0); /* Link the piobuf to this TXQ */ - if ((rc = hunt_nic_pio_link(enp, etp->et_index, handle)) != 0) { + if ((rc = ef10_nic_pio_link(enp, etp->et_index, handle)) != 0) { goto fail3; } @@ -283,7 +283,7 @@ ef10_tx_qpio_enable( fail3: EFSYS_PROBE(fail3); - hunt_nic_pio_free(enp, etp->et_pio_bufnum, etp->et_pio_blknum); + ef10_nic_pio_free(enp, etp->et_pio_bufnum, etp->et_pio_blknum); etp->et_pio_size = 0; fail2: EFSYS_PROBE(fail2); @@ -301,10 +301,10 @@ ef10_tx_qpio_disable( if (etp->et_pio_size != 0) { /* Unlink the piobuf from this TXQ */ - hunt_nic_pio_unlink(enp, etp->et_index); + ef10_nic_pio_unlink(enp, etp->et_index); /* Free the sub-allocated PIO block */ - hunt_nic_pio_free(enp, etp->et_pio_bufnum, etp->et_pio_blknum); + ef10_nic_pio_free(enp, etp->et_pio_bufnum, etp->et_pio_blknum); etp->et_pio_size = 0; etp->et_pio_write_offset = 0; } From 1b02e3c0cf50104d6dc28a8c58492c73d2883a1e Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Wed, 13 Jan 2016 06:37:45 +0000 Subject: [PATCH 56/82] sfxge: remove unused common code EFSYS_OPT_RX_HDR_SPLIT The EFSYS_OPT_RX_HDR_SPLIT optional feature in the common code implemented the Lookahead Split feature of Windows. This split received packets at a preconfigured byte offset, and delivered the header and payload portions to separate receive queues. Now the common code interface has no callers, so remove it. Note that this should not be confused with the Header Data Split feature of Windows, which splits packets at a header boundary. Submitted by: Andy Moreton Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D4888 --- sys/dev/sfxge/common/efsys.h | 1 - sys/dev/sfxge/common/efx.h | 9 --- sys/dev/sfxge/common/efx_check.h | 9 +-- sys/dev/sfxge/common/efx_ev.c | 16 ++--- sys/dev/sfxge/common/efx_impl.h | 4 -- sys/dev/sfxge/common/efx_rx.c | 117 ------------------------------- sys/dev/sfxge/common/hunt_impl.h | 8 --- sys/dev/sfxge/common/hunt_rx.c | 26 ------- 8 files changed, 11 insertions(+), 179 deletions(-) diff --git a/sys/dev/sfxge/common/efsys.h b/sys/dev/sfxge/common/efsys.h index b3013dce89ce..4d72e28903e3 100644 --- a/sys/dev/sfxge/common/efsys.h +++ b/sys/dev/sfxge/common/efsys.h @@ -288,7 +288,6 @@ sfxge_map_mbuf_fast(bus_dma_tag_t tag, bus_dmamap_t map, #define EFSYS_OPT_QSTATS 1 #define EFSYS_OPT_FILTER 1 #define EFSYS_OPT_RX_SCATTER 0 -#define EFSYS_OPT_RX_HDR_SPLIT 0 #define EFSYS_OPT_EV_PREFETCH 0 diff --git a/sys/dev/sfxge/common/efx.h b/sys/dev/sfxge/common/efx.h index f7ff65d49317..5bf2c78ea3ae 100644 --- a/sys/dev/sfxge/common/efx.h +++ b/sys/dev/sfxge/common/efx.h @@ -1817,15 +1817,6 @@ extern void efx_rx_fini( __in efx_nic_t *enp); -#if EFSYS_OPT_RX_HDR_SPLIT - __checkReturn efx_rc_t -efx_rx_hdr_split_enable( - __in efx_nic_t *enp, - __in unsigned int hdr_buf_size, - __in unsigned int pld_buf_size); - -#endif /* EFSYS_OPT_RX_HDR_SPLIT */ - #if EFSYS_OPT_RX_SCATTER __checkReturn efx_rc_t efx_rx_scatter_enable( diff --git a/sys/dev/sfxge/common/efx_check.h b/sys/dev/sfxge/common/efx_check.h index eab4f4b191d2..199fab013f38 100644 --- a/sys/dev/sfxge/common/efx_check.h +++ b/sys/dev/sfxge/common/efx_check.h @@ -347,12 +347,9 @@ # endif #endif /* EFSYS_OPT_QSTATS */ -/* Support receive header split */ -#if EFSYS_OPT_RX_HDR_SPLIT -# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \ - EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) -# error "RX_HDR_SPLIT requires FALCON or SIENA or HUNTINGTON or MEDFORD" -# endif +/* Obsolete option */ +#ifdef EFSYS_OPT_RX_HDR_SPLIT +# error "RX_HDR_SPLIT is obsolete and is not supported" #endif /* EFSYS_OPT_RX_HDR_SPLIT */ /* Support receive scaling (RSS) */ diff --git a/sys/dev/sfxge/common/efx_ev.c b/sys/dev/sfxge/common/efx_ev.c index d0f549742f3e..5d3baecabf3a 100644 --- a/sys/dev/sfxge/common/efx_ev.c +++ b/sys/dev/sfxge/common/efx_ev.c @@ -498,7 +498,7 @@ falconsiena_ev_rx_not_ok( EFX_EV_QSTAT_INCR(eep, EV_RX_FRM_TRUNC); (*flagsp) |= EFX_DISCARD; -#if (EFSYS_OPT_RX_HDR_SPLIT || EFSYS_OPT_RX_SCATTER) +#if EFSYS_OPT_RX_SCATTER /* * Lookout for payload queue ran dry errors and ignore them. * @@ -513,7 +513,7 @@ falconsiena_ev_rx_not_ok( (EFX_QWORD_FIELD(*eqp, FSF_AZ_RX_EV_JUMBO_CONT) == 0) && (EFX_QWORD_FIELD(*eqp, FSF_AZ_RX_EV_BYTE_CNT) == 0)) ignore = B_TRUE; -#endif /* EFSYS_OPT_RX_HDR_SPLIT || EFSYS_OPT_RX_SCATTER */ +#endif /* EFSYS_OPT_RX_SCATTER */ } if (EFX_QWORD_FIELD(*eqp, FSF_AZ_RX_EV_ETH_CRC_ERR) != 0) { @@ -574,10 +574,10 @@ falconsiena_ev_rx( uint32_t size; uint32_t label; boolean_t ok; -#if (EFSYS_OPT_RX_HDR_SPLIT || EFSYS_OPT_RX_SCATTER) +#if EFSYS_OPT_RX_SCATTER boolean_t sop; boolean_t jumbo_cont; -#endif /* EFSYS_OPT_RX_HDR_SPLIT || EFSYS_OPT_RX_SCATTER */ +#endif /* EFSYS_OPT_RX_SCATTER */ uint32_t hdr_type; boolean_t is_v6; uint16_t flags; @@ -592,10 +592,10 @@ falconsiena_ev_rx( label = EFX_QWORD_FIELD(*eqp, FSF_AZ_RX_EV_Q_LABEL); ok = (EFX_QWORD_FIELD(*eqp, FSF_AZ_RX_EV_PKT_OK) != 0); -#if (EFSYS_OPT_RX_HDR_SPLIT || EFSYS_OPT_RX_SCATTER) +#if EFSYS_OPT_RX_SCATTER sop = (EFX_QWORD_FIELD(*eqp, FSF_AZ_RX_EV_SOP) != 0); jumbo_cont = (EFX_QWORD_FIELD(*eqp, FSF_AZ_RX_EV_JUMBO_CONT) != 0); -#endif /* EFSYS_OPT_RX_HDR_SPLIT || EFSYS_OPT_RX_SCATTER */ +#endif /* EFSYS_OPT_RX_SCATTER */ hdr_type = EFX_QWORD_FIELD(*eqp, FSF_AZ_RX_EV_HDR_TYPE); @@ -650,13 +650,13 @@ falconsiena_ev_rx( break; } -#if EFSYS_OPT_RX_SCATTER || EFSYS_OPT_RX_HDR_SPLIT +#if EFSYS_OPT_RX_SCATTER /* Report scatter and header/lookahead split buffer flags */ if (sop) flags |= EFX_PKT_START; if (jumbo_cont) flags |= EFX_PKT_CONT; -#endif /* EFSYS_OPT_RX_SCATTER || EFSYS_OPT_RX_HDR_SPLIT */ +#endif /* EFSYS_OPT_RX_SCATTER */ /* Detect errors included in the FSF_AZ_RX_EV_PKT_OK indication */ if (!ok) { diff --git a/sys/dev/sfxge/common/efx_impl.h b/sys/dev/sfxge/common/efx_impl.h index 023479daa15a..7d659cc2dddc 100644 --- a/sys/dev/sfxge/common/efx_impl.h +++ b/sys/dev/sfxge/common/efx_impl.h @@ -157,10 +157,6 @@ typedef struct efx_tx_ops_s { typedef struct efx_rx_ops_s { efx_rc_t (*erxo_init)(efx_nic_t *); void (*erxo_fini)(efx_nic_t *); -#if EFSYS_OPT_RX_HDR_SPLIT - efx_rc_t (*erxo_hdr_split_enable)(efx_nic_t *, unsigned int, - unsigned int); -#endif #if EFSYS_OPT_RX_SCATTER efx_rc_t (*erxo_scatter_enable)(efx_nic_t *, unsigned int); #endif diff --git a/sys/dev/sfxge/common/efx_rx.c b/sys/dev/sfxge/common/efx_rx.c index c017e3f510cf..d8edeb6ea244 100644 --- a/sys/dev/sfxge/common/efx_rx.c +++ b/sys/dev/sfxge/common/efx_rx.c @@ -48,14 +48,6 @@ static void falconsiena_rx_fini( __in efx_nic_t *enp); -#if EFSYS_OPT_RX_HDR_SPLIT -static __checkReturn efx_rc_t -falconsiena_rx_hdr_split_enable( - __in efx_nic_t *enp, - __in unsigned int hdr_buf_size, - __in unsigned int pld_buf_size); -#endif /* EFSYS_OPT_RX_HDR_SPLIT */ - #if EFSYS_OPT_RX_SCATTER static __checkReturn efx_rc_t falconsiena_rx_scatter_enable( @@ -131,9 +123,6 @@ falconsiena_rx_qdestroy( static efx_rx_ops_t __efx_rx_falcon_ops = { falconsiena_rx_init, /* erxo_init */ falconsiena_rx_fini, /* erxo_fini */ -#if EFSYS_OPT_RX_HDR_SPLIT - falconsiena_rx_hdr_split_enable, /* erxo_hdr_split_enable */ -#endif #if EFSYS_OPT_RX_SCATTER falconsiena_rx_scatter_enable, /* erxo_scatter_enable */ #endif @@ -155,9 +144,6 @@ static efx_rx_ops_t __efx_rx_falcon_ops = { static efx_rx_ops_t __efx_rx_siena_ops = { falconsiena_rx_init, /* erxo_init */ falconsiena_rx_fini, /* erxo_fini */ -#if EFSYS_OPT_RX_HDR_SPLIT - falconsiena_rx_hdr_split_enable, /* erxo_hdr_split_enable */ -#endif #if EFSYS_OPT_RX_SCATTER falconsiena_rx_scatter_enable, /* erxo_scatter_enable */ #endif @@ -179,9 +165,6 @@ static efx_rx_ops_t __efx_rx_siena_ops = { static efx_rx_ops_t __efx_rx_ef10_ops = { ef10_rx_init, /* erxo_init */ ef10_rx_fini, /* erxo_fini */ -#if EFSYS_OPT_RX_HDR_SPLIT - ef10_rx_hdr_split_enable, /* erxo_hdr_split_enable */ -#endif #if EFSYS_OPT_RX_SCATTER ef10_rx_scatter_enable, /* erxo_scatter_enable */ #endif @@ -289,32 +272,6 @@ efx_rx_fini( enp->en_mod_flags &= ~EFX_MOD_RX; } -#if EFSYS_OPT_RX_HDR_SPLIT - __checkReturn efx_rc_t -efx_rx_hdr_split_enable( - __in efx_nic_t *enp, - __in unsigned int hdr_buf_size, - __in unsigned int pld_buf_size) -{ - efx_rx_ops_t *erxop = enp->en_erxop; - efx_rc_t rc; - - EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); - EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_RX); - EFSYS_ASSERT3U(enp->en_family, >=, EFX_FAMILY_SIENA); - - if ((rc = erxop->erxo_hdr_split_enable(enp, hdr_buf_size, - pld_buf_size)) != 0) - goto fail1; - - return (0); - -fail1: - EFSYS_PROBE1(fail1, efx_rc_t, rc); - return (rc); -} -#endif /* EFSYS_OPT_RX_HDR_SPLIT */ - #if EFSYS_OPT_RX_SCATTER __checkReturn efx_rc_t efx_rx_scatter_enable( @@ -722,60 +679,6 @@ falconsiena_rx_init( return (0); } -#if EFSYS_OPT_RX_HDR_SPLIT -static __checkReturn efx_rc_t -falconsiena_rx_hdr_split_enable( - __in efx_nic_t *enp, - __in unsigned int hdr_buf_size, - __in unsigned int pld_buf_size) -{ - unsigned int nhdr32; - unsigned int npld32; - efx_oword_t oword; - efx_rc_t rc; - - nhdr32 = hdr_buf_size / 32; - if ((nhdr32 == 0) || - (nhdr32 >= (1 << FRF_CZ_RX_HDR_SPLIT_HDR_BUF_SIZE_WIDTH)) || - ((hdr_buf_size % 32) != 0)) { - rc = EINVAL; - goto fail1; - } - - npld32 = pld_buf_size / 32; - if ((npld32 == 0) || - (npld32 >= (1 << FRF_CZ_RX_HDR_SPLIT_PLD_BUF_SIZE_WIDTH)) || - ((pld_buf_size % 32) != 0)) { - rc = EINVAL; - goto fail2; - } - - if (enp->en_rx_qcount > 0) { - rc = EBUSY; - goto fail3; - } - - EFX_BAR_READO(enp, FR_AZ_RX_CFG_REG, &oword); - - EFX_SET_OWORD_FIELD(oword, FRF_CZ_RX_HDR_SPLIT_EN, 1); - EFX_SET_OWORD_FIELD(oword, FRF_CZ_RX_HDR_SPLIT_HDR_BUF_SIZE, nhdr32); - EFX_SET_OWORD_FIELD(oword, FRF_CZ_RX_HDR_SPLIT_PLD_BUF_SIZE, npld32); - - EFX_BAR_WRITEO(enp, FR_AZ_RX_CFG_REG, &oword); - - return (0); - -fail3: - EFSYS_PROBE(fail3); -fail2: - EFSYS_PROBE(fail2); -fail1: - EFSYS_PROBE1(fail1, efx_rc_t, rc); - - return (rc); -} -#endif /* EFSYS_OPT_RX_HDR_SPLIT */ - #if EFSYS_OPT_RX_SCATTER static __checkReturn efx_rc_t falconsiena_rx_scatter_enable( @@ -1279,26 +1182,6 @@ falconsiena_rx_qcreate( jumbo = B_FALSE; break; -#if EFSYS_OPT_RX_HDR_SPLIT - case EFX_RXQ_TYPE_SPLIT_HEADER: - if ((enp->en_family < EFX_FAMILY_SIENA) || ((index & 1) != 0)) { - rc = EINVAL; - goto fail4; - } - split = B_TRUE; - jumbo = B_TRUE; - break; - - case EFX_RXQ_TYPE_SPLIT_PAYLOAD: - if ((enp->en_family < EFX_FAMILY_SIENA) || ((index & 1) == 0)) { - rc = EINVAL; - goto fail4; - } - split = B_FALSE; - jumbo = B_TRUE; - break; -#endif /* EFSYS_OPT_RX_HDR_SPLIT */ - #if EFSYS_OPT_RX_SCATTER case EFX_RXQ_TYPE_SCATTER: if (enp->en_family < EFX_FAMILY_SIENA) { diff --git a/sys/dev/sfxge/common/hunt_impl.h b/sys/dev/sfxge/common/hunt_impl.h index e9bf760eaa07..c476c4961c10 100644 --- a/sys/dev/sfxge/common/hunt_impl.h +++ b/sys/dev/sfxge/common/hunt_impl.h @@ -845,14 +845,6 @@ extern __checkReturn efx_rc_t ef10_rx_init( __in efx_nic_t *enp); -#if EFSYS_OPT_RX_HDR_SPLIT -extern __checkReturn efx_rc_t -ef10_rx_hdr_split_enable( - __in efx_nic_t *enp, - __in unsigned int hdr_buf_size, - __in unsigned int pld_buf_size); -#endif /* EFSYS_OPT_RX_HDR_SPLIT */ - #if EFSYS_OPT_RX_SCATTER extern __checkReturn efx_rc_t ef10_rx_scatter_enable( diff --git a/sys/dev/sfxge/common/hunt_rx.c b/sys/dev/sfxge/common/hunt_rx.c index c7226b27c7d8..666885cf2e8c 100644 --- a/sys/dev/sfxge/common/hunt_rx.c +++ b/sys/dev/sfxge/common/hunt_rx.c @@ -466,32 +466,6 @@ ef10_rx_init( return (0); } -#if EFSYS_OPT_RX_HDR_SPLIT - __checkReturn efx_rc_t -ef10_rx_hdr_split_enable( - __in efx_nic_t *enp, - __in unsigned int hdr_buf_size, - __in unsigned int pld_buf_size) -{ - efx_rc_t rc; - - /* FIXME */ - _NOTE(ARGUNUSED(enp, hdr_buf_size, pld_buf_size)) - if (B_FALSE) { - rc = ENOTSUP; - goto fail1; - } - /* FIXME */ - - return (0); - -fail1: - EFSYS_PROBE1(fail1, efx_rc_t, rc); - - return (rc); -} -#endif /* EFSYS_OPT_RX_HDR_SPLIT */ - #if EFSYS_OPT_RX_SCATTER __checkReturn efx_rc_t ef10_rx_scatter_enable( From 0badfd7281fc20dec8f334279a8deb471728ab4b Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Wed, 13 Jan 2016 06:40:00 +0000 Subject: [PATCH 57/82] sfxge: rework RX prefix handling in the common code Submitted by: Andy Moreton Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D4889 --- sys/dev/sfxge/common/efx.h | 2 +- sys/dev/sfxge/common/efx_impl.h | 6 +- sys/dev/sfxge/common/efx_rx.c | 149 ++++++++++++++++--------------- sys/dev/sfxge/common/hunt_impl.h | 12 +++ sys/dev/sfxge/common/hunt_rx.c | 59 ++++++++++++ 5 files changed, 155 insertions(+), 73 deletions(-) diff --git a/sys/dev/sfxge/common/efx.h b/sys/dev/sfxge/common/efx.h index 5bf2c78ea3ae..b9d206173f32 100644 --- a/sys/dev/sfxge/common/efx.h +++ b/sys/dev/sfxge/common/efx.h @@ -1883,7 +1883,7 @@ efx_rx_scale_key_set( __in_ecount(n) uint8_t *key, __in size_t n); -extern uint32_t +extern __checkReturn uint32_t efx_psuedo_hdr_hash_get( __in efx_nic_t *enp, __in efx_rx_hash_alg_t func, diff --git a/sys/dev/sfxge/common/efx_impl.h b/sys/dev/sfxge/common/efx_impl.h index 7d659cc2dddc..a8c17f50c524 100644 --- a/sys/dev/sfxge/common/efx_impl.h +++ b/sys/dev/sfxge/common/efx_impl.h @@ -166,7 +166,11 @@ typedef struct efx_rx_ops_s { efx_rc_t (*erxo_scale_key_set)(efx_nic_t *, uint8_t *, size_t); efx_rc_t (*erxo_scale_tbl_set)(efx_nic_t *, unsigned int *, size_t); -#endif + uint32_t (*erxo_prefix_hash)(efx_nic_t *, efx_rx_hash_alg_t, + uint8_t *); +#endif /* EFSYS_OPT_RX_SCALE */ + efx_rc_t (*erxo_prefix_pktlen)(efx_nic_t *, uint8_t *, + uint16_t *); void (*erxo_qpost)(efx_rxq_t *, efsys_dma_addr_t *, size_t, unsigned int, unsigned int, unsigned int); diff --git a/sys/dev/sfxge/common/efx_rx.c b/sys/dev/sfxge/common/efx_rx.c index d8edeb6ea244..b8339ff1b316 100644 --- a/sys/dev/sfxge/common/efx_rx.c +++ b/sys/dev/sfxge/common/efx_rx.c @@ -75,6 +75,18 @@ falconsiena_rx_scale_tbl_set( __in_ecount(n) unsigned int *table, __in size_t n); +static __checkReturn uint32_t +falconsiena_rx_prefix_hash( + __in efx_nic_t *enp, + __in efx_rx_hash_alg_t func, + __in uint8_t *buffer); + +static __checkReturn efx_rc_t +falconsiena_rx_prefix_pktlen( + __in efx_nic_t *enp, + __in uint8_t *buffer, + __out uint16_t *lengthp); + #endif /* EFSYS_OPT_RX_SCALE */ static void @@ -130,7 +142,9 @@ static efx_rx_ops_t __efx_rx_falcon_ops = { falconsiena_rx_scale_mode_set, /* erxo_scale_mode_set */ falconsiena_rx_scale_key_set, /* erxo_scale_key_set */ falconsiena_rx_scale_tbl_set, /* erxo_scale_tbl_set */ + falconsiena_rx_prefix_hash, /* erxo_prefix_hash */ #endif + falconsiena_rx_prefix_pktlen, /* erxo_prefix_pktlen */ falconsiena_rx_qpost, /* erxo_qpost */ falconsiena_rx_qpush, /* erxo_qpush */ falconsiena_rx_qflush, /* erxo_qflush */ @@ -151,7 +165,9 @@ static efx_rx_ops_t __efx_rx_siena_ops = { falconsiena_rx_scale_mode_set, /* erxo_scale_mode_set */ falconsiena_rx_scale_key_set, /* erxo_scale_key_set */ falconsiena_rx_scale_tbl_set, /* erxo_scale_tbl_set */ + falconsiena_rx_prefix_hash, /* erxo_prefix_hash */ #endif + falconsiena_rx_prefix_pktlen, /* erxo_prefix_pktlen */ falconsiena_rx_qpost, /* erxo_qpost */ falconsiena_rx_qpush, /* erxo_qpush */ falconsiena_rx_qflush, /* erxo_qflush */ @@ -172,7 +188,9 @@ static efx_rx_ops_t __efx_rx_ef10_ops = { ef10_rx_scale_mode_set, /* erxo_scale_mode_set */ ef10_rx_scale_key_set, /* erxo_scale_key_set */ ef10_rx_scale_tbl_set, /* erxo_scale_tbl_set */ + ef10_rx_prefix_hash, /* erxo_prefix_hash */ #endif + ef10_rx_prefix_pktlen, /* erxo_prefix_pktlen */ ef10_rx_qpost, /* erxo_qpost */ ef10_rx_qpush, /* erxo_qpush */ ef10_rx_qflush, /* erxo_qflush */ @@ -553,92 +571,29 @@ efx_rx_qdestroy( erxop->erxo_qdestroy(erp); } -/* - * Psuedo-header info for Siena/Falcon. - * - * The psuedo-header is a byte array of one of the forms: - * - * 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 - * XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.TT.TT.TT.TT - * XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.LL.LL - * - * where: - * - * TT.TT.TT.TT is a 32-bit Toeplitz hash - * LL.LL is a 16-bit LFSR hash - * - * Hash values are in network (big-endian) byte order. - * - * - * On EF10 the pseudo-header is laid out as: - * (See also SF-109306-TC section 9) - * - * Toeplitz hash (32 bits, little-endian) - * Out-of-band outer VLAN tag - * (16 bits, big-endian, 0 if the packet did not have an outer VLAN tag) - * Out-of-band inner VLAN tag - * (16 bits, big-endian, 0 if the packet did not have an inner VLAN tag) - * Packet length (16 bits, little-endian, may be 0) - * MAC timestamp (32 bits, little-endian, may be 0) - * VLAN tag - * (16 bits, big-endian, 0 if the packet did not have an outer VLAN tag) - * VLAN tag - * (16 bits, big-endian, 0 if the packet did not have an inner VLAN tag) - */ - __checkReturn efx_rc_t efx_psuedo_hdr_pkt_length_get( __in efx_nic_t *enp, __in uint8_t *buffer, - __out uint16_t *pkt_lengthp) + __out uint16_t *lengthp) { - if (enp->en_family != EFX_FAMILY_HUNTINGTON && - enp->en_family != EFX_FAMILY_MEDFORD) { - EFSYS_ASSERT(0); - return (ENOTSUP); - } + efx_rx_ops_t *erxop = enp->en_erxop; - *pkt_lengthp = buffer[8] | (buffer[9] << 8); - - return (0); + return (erxop->erxo_prefix_pktlen(enp, buffer, lengthp)); } #if EFSYS_OPT_RX_SCALE - -uint32_t + __checkReturn uint32_t efx_psuedo_hdr_hash_get( __in efx_nic_t *enp, __in efx_rx_hash_alg_t func, __in uint8_t *buffer) { - if (func == EFX_RX_HASHALG_TOEPLITZ) { - switch (enp->en_family) { - case EFX_FAMILY_FALCON: - case EFX_FAMILY_SIENA: - return ((buffer[12] << 24) | - (buffer[13] << 16) | - (buffer[14] << 8) | - buffer[15]); - case EFX_FAMILY_HUNTINGTON: - case EFX_FAMILY_MEDFORD: - return (buffer[0] | - (buffer[1] << 8) | - (buffer[2] << 16) | - (buffer[3] << 24)); - default: - EFSYS_ASSERT(0); - return (0); - } - } else if (func == EFX_RX_HASHALG_LFSR) { - EFSYS_ASSERT(enp->en_family == EFX_FAMILY_FALCON || - enp->en_family == EFX_FAMILY_SIENA); - return ((buffer[14] << 8) | buffer[15]); - } else { - EFSYS_ASSERT(0); - return (0); - } -} + efx_rx_ops_t *erxop = enp->en_erxop; + EFSYS_ASSERT3U(enp->en_hash_support, ==, EFX_RX_HASH_AVAILABLE); + return (erxop->erxo_prefix_hash(enp, func, buffer)); +} #endif /* EFSYS_OPT_RX_SCALE */ #if EFSYS_OPT_FALCON || EFSYS_OPT_SIENA @@ -1026,6 +981,58 @@ falconsiena_rx_scale_tbl_set( } #endif +/* + * Falcon/Siena psuedo-header + * -------------------------- + * + * Receive packets are prefixed by an optional 16 byte pseudo-header. + * The psuedo-header is a byte array of one of the forms: + * + * 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + * xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.TT.TT.TT.TT + * xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.LL.LL + * + * where: + * TT.TT.TT.TT Toeplitz hash (32-bit big-endian) + * LL.LL LFSR hash (16-bit big-endian) + */ + +#if EFSYS_OPT_RX_SCALE +static __checkReturn uint32_t +falconsiena_rx_prefix_hash( + __in efx_nic_t *enp, + __in efx_rx_hash_alg_t func, + __in uint8_t *buffer) +{ + switch (func) { + case EFX_RX_HASHALG_TOEPLITZ: + return ((buffer[12] << 24) | + (buffer[13] << 16) | + (buffer[14] << 8) | + buffer[15]); + + case EFX_RX_HASHALG_LFSR: + return ((buffer[14] << 8) | buffer[15]); + + default: + EFSYS_ASSERT(0); + return (0); + } +} +#endif /* EFSYS_OPT_RX_SCALE */ + +static __checkReturn efx_rc_t +falconsiena_rx_prefix_pktlen( + __in efx_nic_t *enp, + __in uint8_t *buffer, + __out uint16_t *lengthp) +{ + /* Not supported by Falcon/Siena hardware */ + EFSYS_ASSERT(0); + return (ENOTSUP); +} + + static void falconsiena_rx_qpost( __in efx_rxq_t *erp, diff --git a/sys/dev/sfxge/common/hunt_impl.h b/sys/dev/sfxge/common/hunt_impl.h index c476c4961c10..6d65bc052934 100644 --- a/sys/dev/sfxge/common/hunt_impl.h +++ b/sys/dev/sfxge/common/hunt_impl.h @@ -874,6 +874,18 @@ ef10_rx_scale_tbl_set( __in_ecount(n) unsigned int *table, __in size_t n); +extern __checkReturn uint32_t +ef10_rx_prefix_hash( + __in efx_nic_t *enp, + __in efx_rx_hash_alg_t func, + __in uint8_t *buffer); + +extern __checkReturn efx_rc_t +ef10_rx_prefix_pktlen( + __in efx_nic_t *enp, + __in uint8_t *buffer, + __out uint16_t *lengthp); + #endif /* EFSYS_OPT_RX_SCALE */ extern void diff --git a/sys/dev/sfxge/common/hunt_rx.c b/sys/dev/sfxge/common/hunt_rx.c index 666885cf2e8c..de57f5b2edce 100644 --- a/sys/dev/sfxge/common/hunt_rx.c +++ b/sys/dev/sfxge/common/hunt_rx.c @@ -575,6 +575,65 @@ ef10_rx_scale_tbl_set( } #endif /* EFSYS_OPT_RX_SCALE */ + +/* + * EF10 RX pseudo-header + * --------------------- + * + * Receive packets are prefixed by an (optional) 14 byte pseudo-header: + * + * +00: Toeplitz hash value. + * (32bit little-endian) + * +04: Outer VLAN tag. Zero if the packet did not have an outer VLAN tag. + * (16bit big-endian) + * +06: Inner VLAN tag. Zero if the packet did not have an inner VLAN tag. + * (16bit big-endian) + * +08: Packet Length. Zero if the RX datapath was in cut-through mode. + * (16bit little-endian) + * +10: MAC timestamp. Zero if timestamping is not enabled. + * (32bit little-endian) + * + * See "The RX Pseudo-header" in SF-109306-TC. + */ + + __checkReturn efx_rc_t +ef10_rx_prefix_pktlen( + __in efx_nic_t *enp, + __in uint8_t *buffer, + __out uint16_t *lengthp) +{ + /* + * The RX pseudo-header contains the packet length, excluding the + * pseudo-header. If the hardware receive datapath was operating in + * cut-through mode then the length in the RX pseudo-header will be + * zero, and the packet length must be obtained from the DMA length + * reported in the RX event. + */ + *lengthp = buffer[8] | (buffer[9] << 8); + return (0); +} + +#if EFSYS_OPT_RX_SCALE + __checkReturn uint32_t +ef10_rx_prefix_hash( + __in efx_nic_t *enp, + __in efx_rx_hash_alg_t func, + __in uint8_t *buffer) +{ + switch (func) { + case EFX_RX_HASHALG_TOEPLITZ: + return (buffer[0] | + (buffer[1] << 8) | + (buffer[2] << 16) | + (buffer[3] << 24)); + + default: + EFSYS_ASSERT(0); + return (0); + } +} +#endif /* EFSYS_OPT_RX_SCALE */ + void ef10_rx_qpost( __in efx_rxq_t *erp, From 426f453b52657bfdff3942883667107f7281c217 Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Wed, 13 Jan 2016 06:41:39 +0000 Subject: [PATCH 58/82] sfxge: note VI_SHIFT reported in ALLOC_VIS response Submitted by: Andy Moreton Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D4892 --- sys/dev/sfxge/common/efx_impl.h | 1 + sys/dev/sfxge/common/hunt_nic.c | 22 +++++++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/sys/dev/sfxge/common/efx_impl.h b/sys/dev/sfxge/common/efx_impl.h index a8c17f50c524..b5a7ec190819 100644 --- a/sys/dev/sfxge/common/efx_impl.h +++ b/sys/dev/sfxge/common/efx_impl.h @@ -672,6 +672,7 @@ struct efx_nic_s { struct { int ena_vi_base; int ena_vi_count; + int ena_vi_shift; #if EFSYS_OPT_VPD caddr_t ena_svpd; size_t ena_svpd_length; diff --git a/sys/dev/sfxge/common/hunt_nic.c b/sys/dev/sfxge/common/hunt_nic.c index d716bd820167..4df27113aa3a 100644 --- a/sys/dev/sfxge/common/hunt_nic.c +++ b/sys/dev/sfxge/common/hunt_nic.c @@ -470,9 +470,9 @@ efx_mcdi_alloc_vis( __in efx_nic_t *enp, __in uint32_t min_vi_count, __in uint32_t max_vi_count, - __out_opt uint32_t *vi_basep, - __out uint32_t *vi_countp) - + __out uint32_t *vi_basep, + __out uint32_t *vi_countp, + __out uint32_t *vi_shiftp) { efx_mcdi_req_t req; uint8_t payload[MAX(MC_CMD_ALLOC_VIS_IN_LEN, @@ -506,11 +506,14 @@ efx_mcdi_alloc_vis( goto fail3; } - if (vi_basep != NULL) - *vi_basep = MCDI_OUT_DWORD(req, ALLOC_VIS_OUT_VI_BASE); + *vi_basep = MCDI_OUT_DWORD(req, ALLOC_VIS_OUT_VI_BASE); + *vi_countp = MCDI_OUT_DWORD(req, ALLOC_VIS_OUT_VI_COUNT); - if (vi_countp != NULL) - *vi_countp = MCDI_OUT_DWORD(req, ALLOC_VIS_OUT_VI_COUNT); + /* Report VI_SHIFT if available (always zero for Huntington) */ + if (req.emr_out_length_used < MC_CMD_ALLOC_VIS_EXT_OUT_LEN) + *vi_shiftp = 0; + else + *vi_shiftp = MCDI_OUT_DWORD(req, ALLOC_VIS_EXT_OUT_VI_SHIFT); return (0); @@ -1560,7 +1563,7 @@ ef10_nic_init( { efx_drv_cfg_t *edcp = &(enp->en_drv_cfg); uint32_t min_vi_count, max_vi_count; - uint32_t vi_count, vi_base; + uint32_t vi_count, vi_base, vi_shift; uint32_t i; uint32_t retry; uint32_t delay_us; @@ -1603,7 +1606,7 @@ ef10_nic_init( */ vi_count = 0; if ((rc = efx_mcdi_alloc_vis(enp, min_vi_count, max_vi_count, - &vi_base, &vi_count)) != 0) + &vi_base, &vi_count, &vi_shift)) != 0) goto fail3; EFSYS_PROBE2(vi_alloc, uint32_t, vi_base, uint32_t, vi_count); @@ -1615,6 +1618,7 @@ ef10_nic_init( enp->en_arch.ef10.ena_vi_base = vi_base; enp->en_arch.ef10.ena_vi_count = vi_count; + enp->en_arch.ef10.ena_vi_shift = vi_shift; if (vi_count < min_vi_count + enp->en_arch.ef10.ena_piobuf_count) { /* Not enough extra VIs to map piobufs */ From 0a687580976b2e996bc3e45a9e53a03b8a5eb12c Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Wed, 13 Jan 2016 06:42:51 +0000 Subject: [PATCH 59/82] sfxge: simplify MCDI request start Submitted by: Andy Moreton Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D4894 --- sys/dev/sfxge/common/hunt_mcdi.c | 84 ++++++++++++++++++------------- sys/dev/sfxge/common/siena_mcdi.c | 64 +++++++++++++++-------- 2 files changed, 92 insertions(+), 56 deletions(-) diff --git a/sys/dev/sfxge/common/hunt_mcdi.c b/sys/dev/sfxge/common/hunt_mcdi.c index d23259e70060..f9c73b416ddf 100644 --- a/sys/dev/sfxge/common/hunt_mcdi.c +++ b/sys/dev/sfxge/common/hunt_mcdi.c @@ -140,6 +140,48 @@ ef10_mcdi_fini( emip->emi_new_epoch = B_FALSE; } +static void +ef10_mcdi_send_request( + __in efx_nic_t *enp, + __in void *hdrp, + __in size_t hdr_len, + __in void *sdup, + __in size_t sdu_len) +{ + const efx_mcdi_transport_t *emtp = enp->en_mcdi.em_emtp; + efsys_mem_t *esmp = emtp->emt_dma_mem; + efx_dword_t dword; + unsigned int pos; + + EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON || + enp->en_family == EFX_FAMILY_MEDFORD); + + /* Write the header */ + for (pos = 0; pos < hdr_len; pos += sizeof (efx_dword_t)) { + dword = *(efx_dword_t *)((uint8_t *)hdrp + pos); + EFSYS_MEM_WRITED(esmp, pos, &dword); + } + + /* Write the payload */ + for (pos = 0; pos < sdu_len; pos += sizeof (efx_dword_t)) { + dword = *(efx_dword_t *)((uint8_t *)sdup + pos); + EFSYS_MEM_WRITED(esmp, hdr_len + pos, &dword); + } + + /* Guarantee ordering of memory (MCDI request) and PIO (MC doorbell) */ + EFSYS_DMA_SYNC_FOR_DEVICE(esmp, 0, hdr_len + sdu_len); + EFSYS_PIO_WRITE_BARRIER(); + + /* Ring the doorbell to post the command DMA address to the MC */ + EFX_POPULATE_DWORD_1(dword, EFX_DWORD_0, + EFSYS_MEM_ADDR(esmp) >> 32); + EFX_BAR_WRITED(enp, ER_DZ_MC_DB_LWRD_REG, &dword, B_FALSE); + + EFX_POPULATE_DWORD_1(dword, EFX_DWORD_0, + EFSYS_MEM_ADDR(esmp) & 0xffffffff); + EFX_BAR_WRITED(enp, ER_DZ_MC_DB_HWRD_REG, &dword, B_FALSE); +} + void ef10_mcdi_request_copyin( __in efx_nic_t *enp, @@ -148,14 +190,13 @@ ef10_mcdi_request_copyin( __in boolean_t ev_cpl, __in boolean_t new_epoch) { +#if EFSYS_OPT_MCDI_LOGGING const efx_mcdi_transport_t *emtp = enp->en_mcdi.em_emtp; - efsys_mem_t *esmp = emtp->emt_dma_mem; +#endif /* EFSYS_OPT_MCDI_LOGGING */ efx_mcdi_header_type_t hdr_type; - efx_dword_t dword; efx_dword_t hdr[2]; + size_t hdr_len; unsigned int xflags; - unsigned int pos; - size_t offset; EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON || enp->en_family == EFX_FAMILY_MEDFORD); @@ -164,13 +205,12 @@ ef10_mcdi_request_copyin( if (ev_cpl) xflags |= MCDI_HEADER_XFLAGS_EVREQ; - offset = 0; - hdr_type = EFX_MCDI_HEADER_TYPE(emrp->emr_cmd, MAX(emrp->emr_in_length, emrp->emr_out_length)); if (hdr_type == EFX_MCDI_HEADER_TYPE_V2) { /* Construct MCDI v2 header */ + hdr_len = sizeof (hdr); EFX_POPULATE_DWORD_8(hdr[0], MCDI_HEADER_CODE, MC_CMD_V2_EXTN, MCDI_HEADER_RESYNC, 1, @@ -180,16 +220,13 @@ ef10_mcdi_request_copyin( MCDI_HEADER_ERROR, 0, MCDI_HEADER_RESPONSE, 0, MCDI_HEADER_XFLAGS, xflags); - EFSYS_MEM_WRITED(esmp, offset, &hdr[0]); - offset += sizeof (efx_dword_t); EFX_POPULATE_DWORD_2(hdr[1], MC_CMD_V2_EXTN_IN_EXTENDED_CMD, emrp->emr_cmd, MC_CMD_V2_EXTN_IN_ACTUAL_LEN, emrp->emr_in_length); - EFSYS_MEM_WRITED(esmp, offset, &hdr[1]); - offset += sizeof (efx_dword_t); } else { /* Construct MCDI v1 header */ + hdr_len = sizeof (hdr[0]); EFX_POPULATE_DWORD_8(hdr[0], MCDI_HEADER_CODE, emrp->emr_cmd, MCDI_HEADER_RESYNC, 1, @@ -199,39 +236,18 @@ ef10_mcdi_request_copyin( MCDI_HEADER_ERROR, 0, MCDI_HEADER_RESPONSE, 0, MCDI_HEADER_XFLAGS, xflags); - EFSYS_MEM_WRITED(esmp, 0, &hdr[0]); - offset += sizeof (efx_dword_t); } #if EFSYS_OPT_MCDI_LOGGING if (emtp->emt_logger != NULL) { emtp->emt_logger(emtp->emt_context, EFX_LOG_MCDI_REQUEST, - &hdr, offset, + &hdr, hdr_len, emrp->emr_in_buf, emrp->emr_in_length); } #endif /* EFSYS_OPT_MCDI_LOGGING */ - /* Construct the payload */ - for (pos = 0; pos < emrp->emr_in_length; pos += sizeof (efx_dword_t)) { - memcpy(&dword, MCDI_IN(*emrp, efx_dword_t, pos), - MIN(sizeof (dword), emrp->emr_in_length - pos)); - EFSYS_MEM_WRITED(esmp, offset + pos, &dword); - } - - /* Ring the doorbell to post the command DMA address to the MC */ - EFSYS_ASSERT((EFSYS_MEM_ADDR(esmp) & 0xFF) == 0); - - /* Guarantee ordering of memory (MCDI request) and PIO (MC doorbell) */ - EFSYS_DMA_SYNC_FOR_DEVICE(esmp, 0, offset + emrp->emr_in_length); - EFSYS_PIO_WRITE_BARRIER(); - - EFX_POPULATE_DWORD_1(dword, - EFX_DWORD_0, EFSYS_MEM_ADDR(esmp) >> 32); - EFX_BAR_WRITED(enp, ER_DZ_MC_DB_LWRD_REG, &dword, B_FALSE); - - EFX_POPULATE_DWORD_1(dword, - EFX_DWORD_0, EFSYS_MEM_ADDR(esmp) & 0xffffffff); - EFX_BAR_WRITED(enp, ER_DZ_MC_DB_HWRD_REG, &dword, B_FALSE); + ef10_mcdi_send_request(enp, &hdr[0], hdr_len, + emrp->emr_in_buf, emrp->emr_in_length); } void diff --git a/sys/dev/sfxge/common/siena_mcdi.c b/sys/dev/sfxge/common/siena_mcdi.c index cb62f6dee3a4..5c1aec7baac7 100644 --- a/sys/dev/sfxge/common/siena_mcdi.c +++ b/sys/dev/sfxge/common/siena_mcdi.c @@ -53,6 +53,43 @@ __FBSDID("$FreeBSD$"); : MC_SMEM_P1_STATUS_OFST >> 2) +static void +siena_mcdi_send_request( + __in efx_nic_t *enp, + __in void *hdrp, + __in size_t hdr_len, + __in void *sdup, + __in size_t sdu_len) +{ + efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip); + efx_dword_t dword; + unsigned int pdur; + unsigned int dbr; + unsigned int pos; + + EFSYS_ASSERT(enp->en_family == EFX_FAMILY_SIENA); + + EFSYS_ASSERT(emip->emi_port == 1 || emip->emi_port == 2); + pdur = SIENA_MCDI_PDU(emip); + dbr = SIENA_MCDI_DOORBELL(emip); + + /* Write the header */ + EFSYS_ASSERT3U(hdr_len, ==, sizeof (efx_dword_t)); + dword = *(efx_dword_t *)hdrp; + EFX_BAR_TBL_WRITED(enp, FR_CZ_MC_TREG_SMEM, pdur, &dword, B_TRUE); + + /* Write the payload */ + for (pos = 0; pos < sdu_len; pos += sizeof (efx_dword_t)) { + dword = *(efx_dword_t *)((uint8_t *)sdup + pos); + EFX_BAR_TBL_WRITED(enp, FR_CZ_MC_TREG_SMEM, + pdur + 1 + (pos >> 2), &dword, B_FALSE); + } + + /* Ring the doorbell */ + EFX_POPULATE_DWORD_1(dword, EFX_DWORD_0, 0xd004be11); + EFX_BAR_TBL_WRITED(enp, FR_CZ_MC_TREG_SMEM, dbr, &dword, B_FALSE); +} + void siena_mcdi_request_copyin( __in efx_nic_t *enp, @@ -64,26 +101,19 @@ siena_mcdi_request_copyin( #if EFSYS_OPT_MCDI_LOGGING const efx_mcdi_transport_t *emtp = enp->en_mcdi.em_emtp; #endif - efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip); efx_dword_t hdr; - efx_dword_t dword; + size_t hdr_len; unsigned int xflags; - unsigned int pdur; - unsigned int dbr; - unsigned int pos; EFSYS_ASSERT(enp->en_family == EFX_FAMILY_SIENA); _NOTE(ARGUNUSED(new_epoch)) - EFSYS_ASSERT(emip->emi_port == 1 || emip->emi_port == 2); - pdur = SIENA_MCDI_PDU(emip); - dbr = SIENA_MCDI_DOORBELL(emip); - xflags = 0; if (ev_cpl) xflags |= MCDI_HEADER_XFLAGS_EVREQ; - /* Construct the header in shared memory */ + /* Construct the header */ + hdr_len = sizeof (hdr); EFX_POPULATE_DWORD_6(hdr, MCDI_HEADER_CODE, emrp->emr_cmd, MCDI_HEADER_RESYNC, 1, @@ -91,7 +121,6 @@ siena_mcdi_request_copyin( MCDI_HEADER_SEQ, seq, MCDI_HEADER_RESPONSE, 0, MCDI_HEADER_XFLAGS, xflags); - EFX_BAR_TBL_WRITED(enp, FR_CZ_MC_TREG_SMEM, pdur, &hdr, B_TRUE); #if EFSYS_OPT_MCDI_LOGGING if (emtp->emt_logger != NULL) { @@ -101,17 +130,8 @@ siena_mcdi_request_copyin( } #endif /* EFSYS_OPT_MCDI_LOGGING */ - /* Construct the payload */ - for (pos = 0; pos < emrp->emr_in_length; pos += sizeof (efx_dword_t)) { - memcpy(&dword, MCDI_IN(*emrp, efx_dword_t, pos), - MIN(sizeof (dword), emrp->emr_in_length - pos)); - EFX_BAR_TBL_WRITED(enp, FR_CZ_MC_TREG_SMEM, - pdur + 1 + (pos >> 2), &dword, B_FALSE); - } - - /* Ring the doorbell */ - EFX_POPULATE_DWORD_1(dword, EFX_DWORD_0, 0xd004be11); - EFX_BAR_TBL_WRITED(enp, FR_CZ_MC_TREG_SMEM, dbr, &dword, B_FALSE); + siena_mcdi_send_request(enp, &hdr, hdr_len, + emrp->emr_in_buf, emrp->emr_in_length); } void From bce88e313de0cd6e6672e2eb281e22eaa3d72505 Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Wed, 13 Jan 2016 06:44:05 +0000 Subject: [PATCH 60/82] sfxge: simplify conversion of NVRAM types to/from partition ids Submitted by: Andy Moreton Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D4895 --- sys/dev/sfxge/common/efx_impl.h | 2 + sys/dev/sfxge/common/efx_nvram.c | 3 + sys/dev/sfxge/common/hunt_impl.h | 6 + sys/dev/sfxge/common/hunt_nvram.c | 193 +++++++++++++---------------- sys/dev/sfxge/common/siena_impl.h | 6 + sys/dev/sfxge/common/siena_nvram.c | 117 ++++++++--------- 6 files changed, 156 insertions(+), 171 deletions(-) diff --git a/sys/dev/sfxge/common/efx_impl.h b/sys/dev/sfxge/common/efx_impl.h index b5a7ec190819..16c0898a0050 100644 --- a/sys/dev/sfxge/common/efx_impl.h +++ b/sys/dev/sfxge/common/efx_impl.h @@ -492,6 +492,8 @@ typedef struct efx_nvram_ops_s { efx_rc_t (*envo_set_version)(efx_nic_t *, efx_nvram_type_t, uint16_t *); + efx_rc_t (*envo_type_to_partn)(efx_nic_t *, efx_nvram_type_t, + uint32_t *); } efx_nvram_ops_t; #endif /* EFSYS_OPT_NVRAM */ diff --git a/sys/dev/sfxge/common/efx_nvram.c b/sys/dev/sfxge/common/efx_nvram.c index 78f4be4d73de..1809b305c65e 100644 --- a/sys/dev/sfxge/common/efx_nvram.c +++ b/sys/dev/sfxge/common/efx_nvram.c @@ -53,6 +53,7 @@ static efx_nvram_ops_t __efx_nvram_falcon_ops = { falcon_nvram_write_chunk, /* envo_write_chunk */ falcon_nvram_rw_finish, /* envo_rw_finish */ falcon_nvram_set_version, /* envo_set_version */ + falcon_nvram_type_to_partn, /* envo_type_to_partn */ }; #endif /* EFSYS_OPT_FALCON */ @@ -71,6 +72,7 @@ static efx_nvram_ops_t __efx_nvram_siena_ops = { siena_nvram_write_chunk, /* envo_write_chunk */ siena_nvram_rw_finish, /* envo_rw_finish */ siena_nvram_set_version, /* envo_set_version */ + siena_nvram_type_to_partn, /* envo_type_to_partn */ }; #endif /* EFSYS_OPT_SIENA */ @@ -89,6 +91,7 @@ static efx_nvram_ops_t __efx_nvram_ef10_ops = { ef10_nvram_write_chunk, /* envo_write_chunk */ ef10_nvram_rw_finish, /* envo_rw_finish */ ef10_nvram_set_version, /* envo_set_version */ + ef10_nvram_type_to_partn, /* envo_type_to_partn */ }; #endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */ diff --git a/sys/dev/sfxge/common/hunt_impl.h b/sys/dev/sfxge/common/hunt_impl.h index 6d65bc052934..ab5857f3d852 100644 --- a/sys/dev/sfxge/common/hunt_impl.h +++ b/sys/dev/sfxge/common/hunt_impl.h @@ -466,6 +466,12 @@ ef10_nvram_set_version( __in efx_nvram_type_t type, __in_ecount(4) uint16_t version[4]); +extern __checkReturn efx_rc_t +ef10_nvram_type_to_partn( + __in efx_nic_t *enp, + __in efx_nvram_type_t type, + __out uint32_t *partnp); + #endif /* EFSYS_OPT_NVRAM */ diff --git a/sys/dev/sfxge/common/hunt_nvram.c b/sys/dev/sfxge/common/hunt_nvram.c index 0248221adbe2..96265965a567 100644 --- a/sys/dev/sfxge/common/hunt_nvram.c +++ b/sys/dev/sfxge/common/hunt_nvram.c @@ -1578,47 +1578,86 @@ static ef10_parttbl_entry_t medford_parttbl[] = { {NVRAM_PARTITION_TYPE_FPGA_BACKUP, 4, EFX_NVRAM_FPGA_BACKUP} }; -static __checkReturn ef10_parttbl_entry_t * -ef10_parttbl_entry( +static __checkReturn efx_rc_t +ef10_parttbl_get( __in efx_nic_t *enp, - __in efx_nvram_type_t type) + __out ef10_parttbl_entry_t **parttblp, + __out size_t *parttbl_rowsp) { - efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip); - ef10_parttbl_entry_t *entry; - ef10_parttbl_entry_t *parttbl; - size_t parttbl_size = 0; - unsigned int i; - - EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES); - switch (enp->en_family) { case EFX_FAMILY_HUNTINGTON: - parttbl = hunt_parttbl; - parttbl_size = EFX_ARRAY_SIZE(hunt_parttbl); + *parttblp = hunt_parttbl; + *parttbl_rowsp = EFX_ARRAY_SIZE(hunt_parttbl); break; case EFX_FAMILY_MEDFORD: - parttbl = medford_parttbl; - parttbl_size = EFX_ARRAY_SIZE(medford_parttbl); + *parttblp = medford_parttbl; + *parttbl_rowsp = EFX_ARRAY_SIZE(medford_parttbl); break; default: EFSYS_ASSERT(B_FALSE); - goto not_found; + return (EINVAL); } + return (0); +} - if (parttbl != NULL) { - for (i = 0; i < parttbl_size; i++) { - entry = &parttbl[i]; + __checkReturn efx_rc_t +ef10_nvram_type_to_partn( + __in efx_nic_t *enp, + __in efx_nvram_type_t type, + __out uint32_t *partnp) +{ + efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip); + ef10_parttbl_entry_t *parttbl = NULL; + size_t parttbl_rows = 0; + unsigned int i; - if (entry->port == emip->emi_port && - entry->nvtype == type) { - return (entry); + EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES); + EFSYS_ASSERT(partnp != NULL); + + if (ef10_parttbl_get(enp, &parttbl, &parttbl_rows) == 0) { + for (i = 0; i < parttbl_rows; i++) { + ef10_parttbl_entry_t *entry = &parttbl[i]; + + if (entry->nvtype == type && + entry->port == emip->emi_port) { + *partnp = entry->partn; + return (0); } } } -not_found: - return (NULL); + + return (ENOTSUP); +} + + +static __checkReturn efx_rc_t +ef10_nvram_partn_to_type( + __in efx_nic_t *enp, + __in uint32_t partn, + __out efx_nvram_type_t *typep) +{ + efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip); + ef10_parttbl_entry_t *parttbl = NULL; + size_t parttbl_rows = 0; + unsigned int i; + + EFSYS_ASSERT(typep != NULL); + + if (ef10_parttbl_get(enp, &parttbl, &parttbl_rows) == 0) { + for (i = 0; i < parttbl_rows; i++) { + ef10_parttbl_entry_t *entry = &parttbl[i]; + + if (entry->partn == partn && + entry->port == emip->emi_port) { + *typep = entry->nvtype; + return (0); + } + } + } + + return (ENOTSUP); } @@ -1628,18 +1667,14 @@ ef10_parttbl_entry( ef10_nvram_test( __in efx_nic_t *enp) { - efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip); - ef10_parttbl_entry_t *entry; - ef10_parttbl_entry_t *parttbl; - size_t parttbl_size = 0; + efx_nvram_type_t type; unsigned int npartns = 0; uint32_t *partns = NULL; size_t size; unsigned int i; - unsigned int j; efx_rc_t rc; - /* Find supported partitions */ + /* Read available partitions from NVRAM partition map */ size = MC_CMD_NVRAM_PARTITIONS_OUT_TYPE_ID_MAXNUM * sizeof (uint32_t); EFSYS_KMEM_ALLOC(enp->en_esip, size, partns); if (partns == NULL) { @@ -1652,46 +1687,18 @@ ef10_nvram_test( goto fail2; } - /* - * Iterate over the list of supported partition types - * applicable to *this* port - */ - switch (enp->en_family) { - case EFX_FAMILY_HUNTINGTON: - parttbl = hunt_parttbl; - parttbl_size = EFX_ARRAY_SIZE(hunt_parttbl); - break; - - case EFX_FAMILY_MEDFORD: - parttbl = medford_parttbl; - parttbl_size = EFX_ARRAY_SIZE(medford_parttbl); - break; - - default: - EFSYS_ASSERT(B_FALSE); - goto fail3; - } - - for (i = 0; i < parttbl_size; i++) { - entry = &parttbl[i]; - - if (entry->port != emip->emi_port) + for (i = 0; i < npartns; i++) { + /* Check if the partition is supported for this port */ + if ((rc = ef10_nvram_partn_to_type(enp, partns[i], &type)) != 0) continue; - for (j = 0; j < npartns; j++) { - if (entry->partn == partns[j]) { - rc = efx_mcdi_nvram_test(enp, entry->partn); - if (rc != 0) - goto fail4; - } - } + if ((rc = efx_mcdi_nvram_test(enp, partns[i])) != 0) + goto fail3; } EFSYS_KMEM_FREE(enp->en_esip, size, partns); return (0); -fail4: - EFSYS_PROBE(fail3); fail3: EFSYS_PROBE(fail3); fail2: @@ -1710,15 +1717,11 @@ ef10_nvram_size( __in efx_nvram_type_t type, __out size_t *sizep) { - ef10_parttbl_entry_t *entry; uint32_t partn; efx_rc_t rc; - if ((entry = ef10_parttbl_entry(enp, type)) == NULL) { - rc = ENOTSUP; + if ((rc = ef10_nvram_type_to_partn(enp, type, &partn)) != 0) goto fail1; - } - partn = entry->partn; if ((rc = ef10_nvram_partn_size(enp, partn, sizep)) != 0) goto fail2; @@ -1742,15 +1745,11 @@ ef10_nvram_get_version( __out uint32_t *subtypep, __out_ecount(4) uint16_t version[4]) { - ef10_parttbl_entry_t *entry; uint32_t partn; efx_rc_t rc; - if ((entry = ef10_parttbl_entry(enp, type)) == NULL) { - rc = ENOTSUP; + if ((rc = ef10_nvram_type_to_partn(enp, type, &partn)) != 0) goto fail1; - } - partn = entry->partn; /* FIXME: get highest partn version from all ports */ /* FIXME: return partn description if available */ @@ -1775,15 +1774,11 @@ ef10_nvram_rw_start( __in efx_nvram_type_t type, __out size_t *chunk_sizep) { - ef10_parttbl_entry_t *entry; uint32_t partn; efx_rc_t rc; - if ((entry = ef10_parttbl_entry(enp, type)) == NULL) { - rc = ENOTSUP; + if ((rc = ef10_nvram_type_to_partn(enp, type, &partn)) != 0) goto fail1; - } - partn = entry->partn; if ((rc = ef10_nvram_partn_lock(enp, partn)) != 0) goto fail2; @@ -1809,16 +1804,13 @@ ef10_nvram_read_chunk( __out_bcount(size) caddr_t data, __in size_t size) { - ef10_parttbl_entry_t *entry; + uint32_t partn; efx_rc_t rc; - if ((entry = ef10_parttbl_entry(enp, type)) == NULL) { - rc = ENOTSUP; + if ((rc = ef10_nvram_type_to_partn(enp, type, &partn)) != 0) goto fail1; - } - if ((rc = ef10_nvram_partn_read(enp, entry->partn, - offset, data, size)) != 0) + if ((rc = ef10_nvram_partn_read(enp, partn, offset, data, size)) != 0) goto fail2; return (0); @@ -1836,19 +1828,17 @@ ef10_nvram_erase( __in efx_nic_t *enp, __in efx_nvram_type_t type) { - ef10_parttbl_entry_t *entry; + uint32_t partn; size_t size; efx_rc_t rc; - if ((entry = ef10_parttbl_entry(enp, type)) == NULL) { - rc = ENOTSUP; + if ((rc = ef10_nvram_type_to_partn(enp, type, &partn)) != 0) goto fail1; - } - if ((rc = ef10_nvram_partn_size(enp, entry->partn, &size)) != 0) + if ((rc = ef10_nvram_partn_size(enp, partn, &size)) != 0) goto fail2; - if ((rc = ef10_nvram_partn_erase(enp, entry->partn, 0, size)) != 0) + if ((rc = ef10_nvram_partn_erase(enp, partn, 0, size)) != 0) goto fail3; return (0); @@ -1871,16 +1861,13 @@ ef10_nvram_write_chunk( __in_bcount(size) caddr_t data, __in size_t size) { - ef10_parttbl_entry_t *entry; + uint32_t partn; efx_rc_t rc; - if ((entry = ef10_parttbl_entry(enp, type)) == NULL) { - rc = ENOTSUP; + if ((rc = ef10_nvram_type_to_partn(enp, type, &partn)) != 0) goto fail1; - } - if ((rc = ef10_nvram_partn_write(enp, entry->partn, - offset, data, size)) != 0) + if ((rc = ef10_nvram_partn_write(enp, partn, offset, data, size)) != 0) goto fail2; return (0); @@ -1898,10 +1885,11 @@ ef10_nvram_rw_finish( __in efx_nic_t *enp, __in efx_nvram_type_t type) { - ef10_parttbl_entry_t *entry; + uint32_t partn; + efx_rc_t rc; - if ((entry = ef10_parttbl_entry(enp, type)) != NULL) - ef10_nvram_partn_unlock(enp, entry->partn); + if ((rc = ef10_nvram_type_to_partn(enp, type, &partn)) == 0) + ef10_nvram_partn_unlock(enp, partn); } __checkReturn efx_rc_t @@ -1910,15 +1898,11 @@ ef10_nvram_set_version( __in efx_nvram_type_t type, __in_ecount(4) uint16_t version[4]) { - ef10_parttbl_entry_t *entry; uint32_t partn; efx_rc_t rc; - if ((entry = ef10_parttbl_entry(enp, type)) == NULL) { - rc = ENOTSUP; + if ((rc = ef10_nvram_type_to_partn(enp, type, &partn)) != 0) goto fail1; - } - partn = entry->partn; if ((rc = ef10_nvram_partn_set_version(enp, partn, version)) != 0) goto fail2; @@ -1927,7 +1911,6 @@ ef10_nvram_set_version( fail2: EFSYS_PROBE(fail2); - fail1: EFSYS_PROBE1(fail1, efx_rc_t, rc); diff --git a/sys/dev/sfxge/common/siena_impl.h b/sys/dev/sfxge/common/siena_impl.h index a6afcf85a859..effa113aabc4 100644 --- a/sys/dev/sfxge/common/siena_impl.h +++ b/sys/dev/sfxge/common/siena_impl.h @@ -271,6 +271,12 @@ siena_nvram_set_version( __in efx_nvram_type_t type, __in_ecount(4) uint16_t version[4]); +extern __checkReturn efx_rc_t +siena_nvram_type_to_partn( + __in efx_nic_t *enp, + __in efx_nvram_type_t type, + __out uint32_t *partnp); + #endif /* EFSYS_OPT_NVRAM */ #if EFSYS_OPT_VPD diff --git a/sys/dev/sfxge/common/siena_nvram.c b/sys/dev/sfxge/common/siena_nvram.c index b1406ddbb57f..9eb5bfbe0fbd 100644 --- a/sys/dev/sfxge/common/siena_nvram.c +++ b/sys/dev/sfxge/common/siena_nvram.c @@ -232,27 +232,31 @@ static siena_parttbl_entry_t siena_parttbl[] = { {MC_CMD_NVRAM_TYPE_CPLD, 2, EFX_NVRAM_CPLD}, }; -static __checkReturn siena_parttbl_entry_t * -siena_parttbl_entry( + __checkReturn efx_rc_t +siena_nvram_type_to_partn( __in efx_nic_t *enp, - __in efx_nvram_type_t type) + __in efx_nvram_type_t type, + __out uint32_t *partnp) { efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip); - siena_parttbl_entry_t *entry; unsigned int i; EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES); + EFSYS_ASSERT(partnp != NULL); for (i = 0; i < EFX_ARRAY_SIZE(siena_parttbl); i++) { - entry = &siena_parttbl[i]; + siena_parttbl_entry_t *entry = &siena_parttbl[i]; - if (entry->port == emip->emi_port && entry->nvtype == type) - return (entry); + if (entry->port == emip->emi_port && entry->nvtype == type) { + *partnp = entry->partn; + return (0); + } } - return (NULL); + return (ENOTSUP); } + #if EFSYS_OPT_DIAG __checkReturn efx_rc_t @@ -296,15 +300,13 @@ siena_nvram_size( __in efx_nvram_type_t type, __out size_t *sizep) { - siena_parttbl_entry_t *entry; + uint32_t partn; efx_rc_t rc; - if ((entry = siena_parttbl_entry(enp, type)) == NULL) { - rc = ENOTSUP; + if ((rc = siena_nvram_type_to_partn(enp, type, &partn)) != 0) goto fail1; - } - if ((rc = siena_nvram_partn_size(enp, entry->partn, sizep)) != 0) + if ((rc = siena_nvram_partn_size(enp, partn, sizep)) != 0) goto fail2; return (0); @@ -520,11 +522,8 @@ siena_nvram_get_version( unsigned int i; efx_rc_t rc; - if ((entry = siena_parttbl_entry(enp, type)) == NULL) { - rc = ENOTSUP; + if ((rc = siena_nvram_type_to_partn(enp, type, &partn)) != 0) goto fail1; - } - partn = entry->partn; if ((1 << partn) & ~enp->en_u.siena.enu_partn_mask) { rc = ENOTSUP; @@ -605,15 +604,13 @@ siena_nvram_rw_start( __in efx_nvram_type_t type, __out size_t *chunk_sizep) { - siena_parttbl_entry_t *entry; + uint32_t partn; efx_rc_t rc; - if ((entry = siena_parttbl_entry(enp, type)) == NULL) { - rc = ENOTSUP; + if ((rc = siena_nvram_type_to_partn(enp, type, &partn)) != 0) goto fail1; - } - if ((rc = siena_nvram_partn_lock(enp, entry->partn)) != 0) + if ((rc = siena_nvram_partn_lock(enp, partn)) != 0) goto fail2; if (chunk_sizep != NULL) @@ -637,16 +634,13 @@ siena_nvram_read_chunk( __out_bcount(size) caddr_t data, __in size_t size) { - siena_parttbl_entry_t *entry; + uint32_t partn; efx_rc_t rc; - if ((entry = siena_parttbl_entry(enp, type)) == NULL) { - rc = ENOTSUP; + if ((rc = siena_nvram_type_to_partn(enp, type, &partn)) != 0) goto fail1; - } - if ((rc = siena_nvram_partn_read(enp, entry->partn, - offset, data, size)) != 0) + if ((rc = siena_nvram_partn_read(enp, partn, offset, data, size)) != 0) goto fail2; return (0); @@ -664,19 +658,17 @@ siena_nvram_erase( __in efx_nic_t *enp, __in efx_nvram_type_t type) { - siena_parttbl_entry_t *entry; size_t size; + uint32_t partn; efx_rc_t rc; - if ((entry = siena_parttbl_entry(enp, type)) == NULL) { - rc = ENOTSUP; + if ((rc = siena_nvram_type_to_partn(enp, type, &partn)) != 0) goto fail1; - } - if ((rc = siena_nvram_partn_size(enp, entry->partn, &size)) != 0) + if ((rc = siena_nvram_partn_size(enp, partn, &size)) != 0) goto fail2; - if ((rc = siena_nvram_partn_erase(enp, entry->partn, 0, size)) != 0) + if ((rc = siena_nvram_partn_erase(enp, partn, 0, size)) != 0) goto fail3; return (0); @@ -699,16 +691,13 @@ siena_nvram_write_chunk( __in_bcount(size) caddr_t data, __in size_t size) { - siena_parttbl_entry_t *entry; + uint32_t partn; efx_rc_t rc; - if ((entry = siena_parttbl_entry(enp, type)) == NULL) { - rc = ENOTSUP; + if ((rc = siena_nvram_type_to_partn(enp, type, &partn)) != 0) goto fail1; - } - if ((rc = siena_nvram_partn_write(enp, entry->partn, - offset, data, size)) != 0) + if ((rc = siena_nvram_partn_write(enp, partn, offset, data, size)) != 0) goto fail2; return (0); @@ -726,10 +715,11 @@ siena_nvram_rw_finish( __in efx_nic_t *enp, __in efx_nvram_type_t type) { - siena_parttbl_entry_t *entry; + uint32_t partn; + efx_rc_t rc; - if ((entry = siena_parttbl_entry(enp, type)) != NULL) - siena_nvram_partn_unlock(enp, entry->partn); + if ((rc = siena_nvram_type_to_partn(enp, type, &partn)) == 0) + siena_nvram_partn_unlock(enp, partn); } __checkReturn efx_rc_t @@ -738,10 +728,11 @@ siena_nvram_set_version( __in efx_nvram_type_t type, __in_ecount(4) uint16_t version[4]) { + efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip); siena_mc_dynamic_config_hdr_t *dcfg = NULL; - siena_parttbl_entry_t *entry; - unsigned int dcfg_partn; - size_t partn_size; + siena_mc_fw_version_t *fwverp; + uint32_t dcfg_partn, partn; + size_t dcfg_size; unsigned int hdr_length; unsigned int vpd_length; unsigned int vpd_offset; @@ -753,16 +744,14 @@ siena_nvram_set_version( size_t length; efx_rc_t rc; - if ((entry = siena_parttbl_entry(enp, type)) == NULL) { - rc = ENOTSUP; + if ((rc = siena_nvram_type_to_partn(enp, type, &partn)) != 0) goto fail1; - } - dcfg_partn = (entry->port == 1) + dcfg_partn = (emip->emi_port == 1) ? MC_CMD_NVRAM_TYPE_DYNAMIC_CFG_PORT0 : MC_CMD_NVRAM_TYPE_DYNAMIC_CFG_PORT1; - if ((rc = siena_nvram_partn_size(enp, dcfg_partn, &partn_size)) != 0) + if ((rc = siena_nvram_partn_size(enp, dcfg_partn, &dcfg_size)) != 0) goto fail2; if ((rc = siena_nvram_partn_lock(enp, dcfg_partn)) != 0) @@ -781,7 +770,7 @@ siena_nvram_set_version( * NOTE: This function will blatt any fields trailing the version * vector, or the VPD chunk. */ - required_hdr_length = SIENA_DYNAMIC_CFG_SIZE(entry->partn + 1); + required_hdr_length = SIENA_DYNAMIC_CFG_SIZE(partn + 1); if (required_hdr_length + vpd_length > length) { rc = ENOSPC; goto fail4; @@ -804,24 +793,20 @@ siena_nvram_set_version( } /* Get the subtype to insert into the fw_subtype array */ - if ((rc = siena_nvram_get_subtype(enp, entry->partn, &subtype)) != 0) + if ((rc = siena_nvram_get_subtype(enp, partn, &subtype)) != 0) goto fail5; /* Fill out the new version */ - EFX_POPULATE_DWORD_1(dcfg->fw_version[entry->partn].fw_subtype, - EFX_DWORD_0, subtype); - EFX_POPULATE_WORD_1(dcfg->fw_version[entry->partn].version_w, - EFX_WORD_0, version[0]); - EFX_POPULATE_WORD_1(dcfg->fw_version[entry->partn].version_x, - EFX_WORD_0, version[1]); - EFX_POPULATE_WORD_1(dcfg->fw_version[entry->partn].version_y, - EFX_WORD_0, version[2]); - EFX_POPULATE_WORD_1(dcfg->fw_version[entry->partn].version_z, - EFX_WORD_0, version[3]); + fwverp = &dcfg->fw_version[partn]; + EFX_POPULATE_DWORD_1(fwverp->fw_subtype, EFX_DWORD_0, subtype); + EFX_POPULATE_WORD_1(fwverp->version_w, EFX_WORD_0, version[0]); + EFX_POPULATE_WORD_1(fwverp->version_x, EFX_WORD_0, version[1]); + EFX_POPULATE_WORD_1(fwverp->version_y, EFX_WORD_0, version[2]); + EFX_POPULATE_WORD_1(fwverp->version_z, EFX_WORD_0, version[3]); /* Update the version count */ - if (nitems < entry->partn + 1) { - nitems = entry->partn + 1; + if (nitems < partn + 1) { + nitems = partn + 1; EFX_POPULATE_DWORD_1(dcfg->num_fw_version_items, EFX_DWORD_0, nitems); } @@ -833,7 +818,7 @@ siena_nvram_set_version( dcfg->csum.eb_u8[0] -= cksum; /* Erase and write the new partition */ - if ((rc = siena_nvram_partn_erase(enp, dcfg_partn, 0, partn_size)) != 0) + if ((rc = siena_nvram_partn_erase(enp, dcfg_partn, 0, dcfg_size)) != 0) goto fail6; /* Write out the new structure to nvram */ From 4c28e9bcc2376fdbb1ad69f694fcef9cd4eaf785 Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Wed, 13 Jan 2016 06:45:05 +0000 Subject: [PATCH 61/82] sfxge: support MC_CMD_GET_CAPABILITIES_V2 Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D4896 --- sys/dev/sfxge/common/hunt_nic.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/sys/dev/sfxge/common/hunt_nic.c b/sys/dev/sfxge/common/hunt_nic.c index 4df27113aa3a..4b70a9e0e407 100644 --- a/sys/dev/sfxge/common/hunt_nic.c +++ b/sys/dev/sfxge/common/hunt_nic.c @@ -426,11 +426,12 @@ efx_mcdi_get_vector_cfg( static __checkReturn efx_rc_t efx_mcdi_get_capabilities( __in efx_nic_t *enp, - __out efx_dword_t *flagsp) + __out efx_dword_t *flagsp, + __out efx_dword_t *flags2p) { efx_mcdi_req_t req; uint8_t payload[MAX(MC_CMD_GET_CAPABILITIES_IN_LEN, - MC_CMD_GET_CAPABILITIES_OUT_LEN)]; + MC_CMD_GET_CAPABILITIES_V2_OUT_LEN)]; efx_rc_t rc; (void) memset(payload, 0, sizeof (payload)); @@ -438,7 +439,7 @@ efx_mcdi_get_capabilities( req.emr_in_buf = payload; req.emr_in_length = MC_CMD_GET_CAPABILITIES_IN_LEN; req.emr_out_buf = payload; - req.emr_out_length = MC_CMD_GET_CAPABILITIES_OUT_LEN; + req.emr_out_length = MC_CMD_GET_CAPABILITIES_V2_OUT_LEN; efx_mcdi_execute(enp, &req); @@ -454,6 +455,12 @@ efx_mcdi_get_capabilities( *flagsp = *MCDI_OUT2(req, efx_dword_t, GET_CAPABILITIES_OUT_FLAGS1); + if (req.emr_out_length_used < MC_CMD_GET_CAPABILITIES_V2_OUT_LEN) + EFX_ZERO_DWORD(*flags2p); + else + *flags2p = *MCDI_OUT2(req, efx_dword_t, + GET_CAPABILITIES_V2_OUT_FLAGS2); + return (0); fail2: @@ -887,9 +894,11 @@ ef10_get_datapath_caps( { efx_nic_cfg_t *encp = &(enp->en_nic_cfg); efx_dword_t datapath_capabilities; + efx_dword_t datapath_capabilities_v2; efx_rc_t rc; - if ((rc = efx_mcdi_get_capabilities(enp, &datapath_capabilities)) != 0) + if ((rc = efx_mcdi_get_capabilities(enp, &datapath_capabilities, + &datapath_capabilities_v2)) != 0) goto fail1; /* From 88cbf0f746d6c640abde8b4b496eb5d019ddab8a Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Wed, 13 Jan 2016 06:47:47 +0000 Subject: [PATCH 62/82] sfxge: add Medford firmware subtypes definitions Pulled firmware_ids.h from firmwaresrc and applied genfwdef script. Submitted by: Richard Houldsworth Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D4897 --- sys/dev/sfxge/common/ef10_tlv_layout.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/sys/dev/sfxge/common/ef10_tlv_layout.h b/sys/dev/sfxge/common/ef10_tlv_layout.h index e2c7082c67f8..4063165625d6 100644 --- a/sys/dev/sfxge/common/ef10_tlv_layout.h +++ b/sys/dev/sfxge/common/ef10_tlv_layout.h @@ -764,4 +764,20 @@ struct tlv_rx_event_merging_config { #define TLV_RX_EVENT_MERGING_MAX_EVENTS_DEFAULT 7 #define TLV_RX_EVENT_MERGING_TIMEOUT_NS_DEFAULT 8740 +#define TLV_TAG_PCIE_LINK_SETTINGS (0x101f0000) +struct tlv_pcie_link_settings { + uint32_t tag; + uint32_t length; + uint16_t gen; /* Target PCIe generation: 1, 2, 3 */ + uint16_t width; /* Number of lanes */ +}; + +#define TLV_TAG_LICENSE (0x20800000) + +typedef struct tlv_license { + uint32_t tag; + uint32_t length; + uint8_t data[]; +} tlv_license_t; + #endif /* CI_MGMT_TLV_LAYOUT_H */ From 51fd6441783477ecdbdb015523bd18f64f13ed5e Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Wed, 13 Jan 2016 07:11:43 +0000 Subject: [PATCH 63/82] sfxge: define FATSOv2 option descriptors Sponsored by: Solarflare Communications, Inc. MFC after: 2 days --- sys/dev/sfxge/common/efx_regs_ef10.h | 42 ++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/sys/dev/sfxge/common/efx_regs_ef10.h b/sys/dev/sfxge/common/efx_regs_ef10.h index c5ee15d2a66d..bd7619a82e31 100644 --- a/sys/dev/sfxge/common/efx_regs_ef10.h +++ b/sys/dev/sfxge/common/efx_regs_ef10.h @@ -429,6 +429,48 @@ extern "C" { #define ESF_DZ_TX_TSO_TCP_SEQNO_WIDTH 32 +/* TX_TSO_FATSO2A_DESC */ +#define ESF_DZ_TX_DESC_IS_OPT_LBN 63 +#define ESF_DZ_TX_DESC_IS_OPT_WIDTH 1 +#define ESF_DZ_TX_OPTION_TYPE_LBN 60 +#define ESF_DZ_TX_OPTION_TYPE_WIDTH 3 +#define ESE_DZ_TX_OPTION_DESC_TSO 7 +#define ESE_DZ_TX_OPTION_DESC_VLAN 6 +#define ESE_DZ_TX_OPTION_DESC_CRC_CSUM 0 +#define ESF_DZ_TX_TSO_OPTION_TYPE_LBN 56 +#define ESF_DZ_TX_TSO_OPTION_TYPE_WIDTH 4 +#define ESE_DZ_TX_TSO_OPTION_DESC_FATSO2B 3 +#define ESE_DZ_TX_TSO_OPTION_DESC_FATSO2A 2 +#define ESE_DZ_TX_TSO_OPTION_DESC_ENCAP 1 +#define ESE_DZ_TX_TSO_OPTION_DESC_NORMAL 0 +#define ESF_DZ_TX_TSO_IP_ID_LBN 32 +#define ESF_DZ_TX_TSO_IP_ID_WIDTH 16 +#define ESF_DZ_TX_TSO_TCP_SEQNO_LBN 0 +#define ESF_DZ_TX_TSO_TCP_SEQNO_WIDTH 32 + + +/* TX_TSO_FATSO2B_DESC */ +#define ESF_DZ_TX_DESC_IS_OPT_LBN 63 +#define ESF_DZ_TX_DESC_IS_OPT_WIDTH 1 +#define ESF_DZ_TX_OPTION_TYPE_LBN 60 +#define ESF_DZ_TX_OPTION_TYPE_WIDTH 3 +#define ESE_DZ_TX_OPTION_DESC_TSO 7 +#define ESE_DZ_TX_OPTION_DESC_VLAN 6 +#define ESE_DZ_TX_OPTION_DESC_CRC_CSUM 0 +#define ESF_DZ_TX_TSO_OPTION_TYPE_LBN 56 +#define ESF_DZ_TX_TSO_OPTION_TYPE_WIDTH 4 +#define ESE_DZ_TX_TSO_OPTION_DESC_FATSO2B 3 +#define ESE_DZ_TX_TSO_OPTION_DESC_FATSO2A 2 +#define ESE_DZ_TX_TSO_OPTION_DESC_ENCAP 1 +#define ESE_DZ_TX_TSO_OPTION_DESC_NORMAL 0 +#define ESF_DZ_TX_TSO_OUTER_IP_ID_LBN 16 +#define ESF_DZ_TX_TSO_OUTER_IP_ID_WIDTH 16 +#define ESF_DZ_TX_TSO_TCP_MSS_LBN 32 +#define ESF_DZ_TX_TSO_TCP_MSS_WIDTH 16 +#define ESF_DZ_TX_TSO_INNER_PE_CSUM_LBN 0 +#define ESF_DZ_TX_TSO_INNER_PE_CSUM_WIDTH 16 + + /* ES_TX_VLAN_DESC */ #define ESF_DZ_TX_DESC_IS_OPT_LBN 63 #define ESF_DZ_TX_DESC_IS_OPT_WIDTH 1 From 47d4cf2347b961c42f323e0c0e1279d6852f55f2 Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Wed, 13 Jan 2016 07:25:51 +0000 Subject: [PATCH 64/82] sfxge: cleanup: simplify EFX header includes Submitted by: Andy Moreton Sponsored by: Solarflare Communications, Inc. MFC after: 2 days --- sys/dev/sfxge/common/efx_bootcfg.c | 2 -- sys/dev/sfxge/common/efx_crc32.c | 2 -- sys/dev/sfxge/common/efx_ev.c | 5 ++--- sys/dev/sfxge/common/efx_filter.c | 3 --- sys/dev/sfxge/common/efx_hash.c | 2 -- sys/dev/sfxge/common/efx_intr.c | 3 --- sys/dev/sfxge/common/efx_mac.c | 2 -- sys/dev/sfxge/common/efx_mcdi.c | 4 ---- sys/dev/sfxge/common/efx_mcdi.h | 1 - sys/dev/sfxge/common/efx_mon.c | 3 --- sys/dev/sfxge/common/efx_nic.c | 3 --- sys/dev/sfxge/common/efx_nvram.c | 3 --- sys/dev/sfxge/common/efx_phy.c | 3 --- sys/dev/sfxge/common/efx_port.c | 2 -- sys/dev/sfxge/common/efx_rx.c | 3 --- sys/dev/sfxge/common/efx_sram.c | 3 --- sys/dev/sfxge/common/efx_tx.c | 3 --- sys/dev/sfxge/common/efx_vpd.c | 3 --- sys/dev/sfxge/common/efx_wol.c | 2 -- sys/dev/sfxge/common/hunt_ev.c | 3 --- sys/dev/sfxge/common/hunt_filter.c | 3 --- sys/dev/sfxge/common/hunt_intr.c | 1 - sys/dev/sfxge/common/hunt_mac.c | 1 - sys/dev/sfxge/common/hunt_mcdi.c | 1 - sys/dev/sfxge/common/hunt_nic.c | 3 ++- sys/dev/sfxge/common/hunt_nvram.c | 3 --- sys/dev/sfxge/common/hunt_phy.c | 1 - sys/dev/sfxge/common/hunt_rx.c | 1 - sys/dev/sfxge/common/hunt_sram.c | 1 - sys/dev/sfxge/common/hunt_tx.c | 1 - sys/dev/sfxge/common/hunt_vpd.c | 3 --- sys/dev/sfxge/common/mcdi_mon.c | 1 - sys/dev/sfxge/common/medford_nic.c | 1 - sys/dev/sfxge/common/siena_mac.c | 1 - sys/dev/sfxge/common/siena_mcdi.c | 1 - sys/dev/sfxge/common/siena_nic.c | 1 - sys/dev/sfxge/common/siena_nvram.c | 3 --- sys/dev/sfxge/common/siena_phy.c | 1 - sys/dev/sfxge/common/siena_sram.c | 1 - sys/dev/sfxge/common/siena_vpd.c | 3 --- 40 files changed, 4 insertions(+), 83 deletions(-) diff --git a/sys/dev/sfxge/common/efx_bootcfg.c b/sys/dev/sfxge/common/efx_bootcfg.c index 97e829df9adf..16ee33798841 100644 --- a/sys/dev/sfxge/common/efx_bootcfg.c +++ b/sys/dev/sfxge/common/efx_bootcfg.c @@ -31,9 +31,7 @@ #include __FBSDID("$FreeBSD$"); -#include "efsys.h" #include "efx.h" -#include "efx_types.h" #include "efx_impl.h" #if EFSYS_OPT_BOOTCFG diff --git a/sys/dev/sfxge/common/efx_crc32.c b/sys/dev/sfxge/common/efx_crc32.c index 1fb8b024a872..23d77aeb7646 100644 --- a/sys/dev/sfxge/common/efx_crc32.c +++ b/sys/dev/sfxge/common/efx_crc32.c @@ -31,9 +31,7 @@ #include __FBSDID("$FreeBSD$"); -#include "efsys.h" #include "efx.h" -#include "efx_types.h" #include "efx_impl.h" /* diff --git a/sys/dev/sfxge/common/efx_ev.c b/sys/dev/sfxge/common/efx_ev.c index 5d3baecabf3a..037dbfac2ee4 100644 --- a/sys/dev/sfxge/common/efx_ev.c +++ b/sys/dev/sfxge/common/efx_ev.c @@ -31,12 +31,11 @@ #include __FBSDID("$FreeBSD$"); -#include "efsys.h" #include "efx.h" -#include "efx_types.h" -#include "efx_regs.h" #include "efx_impl.h" +#if EFSYS_OPT_MON_MCDI #include "mcdi_mon.h" +#endif #if EFSYS_OPT_QSTATS #define EFX_EV_QSTAT_INCR(_eep, _stat) \ diff --git a/sys/dev/sfxge/common/efx_filter.c b/sys/dev/sfxge/common/efx_filter.c index 93cf540539bc..e2763ae5f9ec 100644 --- a/sys/dev/sfxge/common/efx_filter.c +++ b/sys/dev/sfxge/common/efx_filter.c @@ -31,10 +31,7 @@ #include __FBSDID("$FreeBSD$"); -#include "efsys.h" #include "efx.h" -#include "efx_types.h" -#include "efx_regs.h" #include "efx_impl.h" diff --git a/sys/dev/sfxge/common/efx_hash.c b/sys/dev/sfxge/common/efx_hash.c index 3005c1bb4738..db8b12caa858 100644 --- a/sys/dev/sfxge/common/efx_hash.c +++ b/sys/dev/sfxge/common/efx_hash.c @@ -42,9 +42,7 @@ #include __FBSDID("$FreeBSD$"); -#include "efsys.h" #include "efx.h" -#include "efx_types.h" #include "efx_impl.h" /* Hash initial value */ diff --git a/sys/dev/sfxge/common/efx_intr.c b/sys/dev/sfxge/common/efx_intr.c index 92eb7352d219..eb570fc1a084 100644 --- a/sys/dev/sfxge/common/efx_intr.c +++ b/sys/dev/sfxge/common/efx_intr.c @@ -31,10 +31,7 @@ #include __FBSDID("$FreeBSD$"); -#include "efsys.h" #include "efx.h" -#include "efx_types.h" -#include "efx_regs.h" #include "efx_impl.h" diff --git a/sys/dev/sfxge/common/efx_mac.c b/sys/dev/sfxge/common/efx_mac.c index 79f8516efd91..c8794a69f3d6 100644 --- a/sys/dev/sfxge/common/efx_mac.c +++ b/sys/dev/sfxge/common/efx_mac.c @@ -31,9 +31,7 @@ #include __FBSDID("$FreeBSD$"); -#include "efsys.h" #include "efx.h" -#include "efx_types.h" #include "efx_impl.h" #if EFSYS_OPT_MAC_FALCON_GMAC diff --git a/sys/dev/sfxge/common/efx_mcdi.c b/sys/dev/sfxge/common/efx_mcdi.c index 600da9aeb1a5..07224c71d8b1 100644 --- a/sys/dev/sfxge/common/efx_mcdi.c +++ b/sys/dev/sfxge/common/efx_mcdi.c @@ -31,11 +31,7 @@ #include __FBSDID("$FreeBSD$"); -#include "efsys.h" #include "efx.h" -#include "efx_types.h" -#include "efx_regs.h" -#include "efx_regs_mcdi.h" #include "efx_impl.h" #if EFSYS_OPT_MCDI diff --git a/sys/dev/sfxge/common/efx_mcdi.h b/sys/dev/sfxge/common/efx_mcdi.h index 53f76b32d91c..d100775847d8 100644 --- a/sys/dev/sfxge/common/efx_mcdi.h +++ b/sys/dev/sfxge/common/efx_mcdi.h @@ -34,7 +34,6 @@ #define _SYS_EFX_MCDI_H #include "efx.h" -#include "efx_regs.h" #include "efx_regs_mcdi.h" #ifdef __cplusplus diff --git a/sys/dev/sfxge/common/efx_mon.c b/sys/dev/sfxge/common/efx_mon.c index 8603b8b7609f..9803b4398ee7 100644 --- a/sys/dev/sfxge/common/efx_mon.c +++ b/sys/dev/sfxge/common/efx_mon.c @@ -31,10 +31,7 @@ #include __FBSDID("$FreeBSD$"); -#include "efsys.h" #include "efx.h" -#include "efx_types.h" -#include "efx_regs.h" #include "efx_impl.h" #if EFSYS_OPT_MON_NULL diff --git a/sys/dev/sfxge/common/efx_nic.c b/sys/dev/sfxge/common/efx_nic.c index 69d61a021885..07acc56d779c 100644 --- a/sys/dev/sfxge/common/efx_nic.c +++ b/sys/dev/sfxge/common/efx_nic.c @@ -31,10 +31,7 @@ #include __FBSDID("$FreeBSD$"); -#include "efsys.h" #include "efx.h" -#include "efx_types.h" -#include "efx_regs.h" #include "efx_impl.h" __checkReturn efx_rc_t diff --git a/sys/dev/sfxge/common/efx_nvram.c b/sys/dev/sfxge/common/efx_nvram.c index 1809b305c65e..759763623db8 100644 --- a/sys/dev/sfxge/common/efx_nvram.c +++ b/sys/dev/sfxge/common/efx_nvram.c @@ -31,10 +31,7 @@ #include __FBSDID("$FreeBSD$"); -#include "efsys.h" #include "efx.h" -#include "efx_types.h" -#include "efx_regs.h" #include "efx_impl.h" #if EFSYS_OPT_NVRAM diff --git a/sys/dev/sfxge/common/efx_phy.c b/sys/dev/sfxge/common/efx_phy.c index 07422086b19e..dd966beacc44 100644 --- a/sys/dev/sfxge/common/efx_phy.c +++ b/sys/dev/sfxge/common/efx_phy.c @@ -31,10 +31,7 @@ #include __FBSDID("$FreeBSD$"); -#include "efsys.h" #include "efx.h" -#include "efx_types.h" -#include "efx_regs.h" #include "efx_impl.h" #if EFSYS_OPT_FALCON #include "falcon_nvram.h" diff --git a/sys/dev/sfxge/common/efx_port.c b/sys/dev/sfxge/common/efx_port.c index e74cfe6ff290..ca2a69b221ec 100644 --- a/sys/dev/sfxge/common/efx_port.c +++ b/sys/dev/sfxge/common/efx_port.c @@ -31,9 +31,7 @@ #include __FBSDID("$FreeBSD$"); -#include "efsys.h" #include "efx.h" -#include "efx_types.h" #include "efx_impl.h" __checkReturn efx_rc_t diff --git a/sys/dev/sfxge/common/efx_rx.c b/sys/dev/sfxge/common/efx_rx.c index b8339ff1b316..a0b143f2b764 100644 --- a/sys/dev/sfxge/common/efx_rx.c +++ b/sys/dev/sfxge/common/efx_rx.c @@ -31,10 +31,7 @@ #include __FBSDID("$FreeBSD$"); -#include "efsys.h" #include "efx.h" -#include "efx_types.h" -#include "efx_regs.h" #include "efx_impl.h" diff --git a/sys/dev/sfxge/common/efx_sram.c b/sys/dev/sfxge/common/efx_sram.c index c400ca0157dc..f2a7b7881859 100644 --- a/sys/dev/sfxge/common/efx_sram.c +++ b/sys/dev/sfxge/common/efx_sram.c @@ -31,10 +31,7 @@ #include __FBSDID("$FreeBSD$"); -#include "efsys.h" #include "efx.h" -#include "efx_types.h" -#include "efx_regs.h" #include "efx_impl.h" __checkReturn efx_rc_t diff --git a/sys/dev/sfxge/common/efx_tx.c b/sys/dev/sfxge/common/efx_tx.c index bcd92c99d735..cff77426fe06 100644 --- a/sys/dev/sfxge/common/efx_tx.c +++ b/sys/dev/sfxge/common/efx_tx.c @@ -31,10 +31,7 @@ #include __FBSDID("$FreeBSD$"); -#include "efsys.h" #include "efx.h" -#include "efx_types.h" -#include "efx_regs.h" #include "efx_impl.h" #if EFSYS_OPT_QSTATS diff --git a/sys/dev/sfxge/common/efx_vpd.c b/sys/dev/sfxge/common/efx_vpd.c index 032dcd689f9c..c1762e62193f 100644 --- a/sys/dev/sfxge/common/efx_vpd.c +++ b/sys/dev/sfxge/common/efx_vpd.c @@ -31,10 +31,7 @@ #include __FBSDID("$FreeBSD$"); -#include "efsys.h" #include "efx.h" -#include "efx_types.h" -#include "efx_regs.h" #include "efx_impl.h" #if EFSYS_OPT_VPD diff --git a/sys/dev/sfxge/common/efx_wol.c b/sys/dev/sfxge/common/efx_wol.c index d0d1fa079944..aea3c55d0c48 100644 --- a/sys/dev/sfxge/common/efx_wol.c +++ b/sys/dev/sfxge/common/efx_wol.c @@ -31,9 +31,7 @@ #include __FBSDID("$FreeBSD$"); -#include "efsys.h" #include "efx.h" -#include "efx_types.h" #include "efx_impl.h" #if EFSYS_OPT_WOL diff --git a/sys/dev/sfxge/common/hunt_ev.c b/sys/dev/sfxge/common/hunt_ev.c index 4742cbf61384..2cea2e05bfe0 100644 --- a/sys/dev/sfxge/common/hunt_ev.c +++ b/sys/dev/sfxge/common/hunt_ev.c @@ -31,10 +31,7 @@ #include __FBSDID("$FreeBSD$"); -#include "efsys.h" #include "efx.h" -#include "efx_types.h" -#include "efx_regs.h" #include "efx_impl.h" #if EFSYS_OPT_MON_STATS #include "mcdi_mon.h" diff --git a/sys/dev/sfxge/common/hunt_filter.c b/sys/dev/sfxge/common/hunt_filter.c index 49ed0142ed06..eaa0720c65cd 100644 --- a/sys/dev/sfxge/common/hunt_filter.c +++ b/sys/dev/sfxge/common/hunt_filter.c @@ -31,10 +31,7 @@ #include __FBSDID("$FreeBSD$"); -#include "efsys.h" #include "efx.h" -#include "efx_types.h" -#include "efx_regs_mcdi.h" #include "efx_impl.h" #if EFSYS_OPT_HUNTINGTON diff --git a/sys/dev/sfxge/common/hunt_intr.c b/sys/dev/sfxge/common/hunt_intr.c index 6f9789f96d39..7a4293c97c4e 100644 --- a/sys/dev/sfxge/common/hunt_intr.c +++ b/sys/dev/sfxge/common/hunt_intr.c @@ -31,7 +31,6 @@ #include __FBSDID("$FreeBSD$"); -#include "efsys.h" #include "efx.h" #include "efx_impl.h" diff --git a/sys/dev/sfxge/common/hunt_mac.c b/sys/dev/sfxge/common/hunt_mac.c index e93919a038a3..358c4d91e920 100644 --- a/sys/dev/sfxge/common/hunt_mac.c +++ b/sys/dev/sfxge/common/hunt_mac.c @@ -31,7 +31,6 @@ #include __FBSDID("$FreeBSD$"); -#include "efsys.h" #include "efx.h" #include "efx_impl.h" diff --git a/sys/dev/sfxge/common/hunt_mcdi.c b/sys/dev/sfxge/common/hunt_mcdi.c index f9c73b416ddf..5b321505fbfa 100644 --- a/sys/dev/sfxge/common/hunt_mcdi.c +++ b/sys/dev/sfxge/common/hunt_mcdi.c @@ -31,7 +31,6 @@ #include __FBSDID("$FreeBSD$"); -#include "efsys.h" #include "efx.h" #include "efx_impl.h" diff --git a/sys/dev/sfxge/common/hunt_nic.c b/sys/dev/sfxge/common/hunt_nic.c index 4b70a9e0e407..d87f3cd0694f 100644 --- a/sys/dev/sfxge/common/hunt_nic.c +++ b/sys/dev/sfxge/common/hunt_nic.c @@ -31,10 +31,11 @@ #include __FBSDID("$FreeBSD$"); -#include "efsys.h" #include "efx.h" #include "efx_impl.h" +#if EFSYS_OPT_MON_MCDI #include "mcdi_mon.h" +#endif #if EFSYS_OPT_HUNTINGTON diff --git a/sys/dev/sfxge/common/hunt_nvram.c b/sys/dev/sfxge/common/hunt_nvram.c index 96265965a567..324c0d8873ba 100644 --- a/sys/dev/sfxge/common/hunt_nvram.c +++ b/sys/dev/sfxge/common/hunt_nvram.c @@ -31,10 +31,7 @@ #include __FBSDID("$FreeBSD$"); -#include "efsys.h" #include "efx.h" -#include "efx_types.h" -#include "efx_regs.h" #include "efx_impl.h" #if EFSYS_OPT_HUNTINGTON diff --git a/sys/dev/sfxge/common/hunt_phy.c b/sys/dev/sfxge/common/hunt_phy.c index e8d234aa9ed6..c25e8200c510 100644 --- a/sys/dev/sfxge/common/hunt_phy.c +++ b/sys/dev/sfxge/common/hunt_phy.c @@ -31,7 +31,6 @@ #include __FBSDID("$FreeBSD$"); -#include "efsys.h" #include "efx.h" #include "efx_impl.h" diff --git a/sys/dev/sfxge/common/hunt_rx.c b/sys/dev/sfxge/common/hunt_rx.c index de57f5b2edce..984d48dc3b6b 100644 --- a/sys/dev/sfxge/common/hunt_rx.c +++ b/sys/dev/sfxge/common/hunt_rx.c @@ -31,7 +31,6 @@ #include __FBSDID("$FreeBSD$"); -#include "efsys.h" #include "efx.h" #include "efx_impl.h" diff --git a/sys/dev/sfxge/common/hunt_sram.c b/sys/dev/sfxge/common/hunt_sram.c index 6b4b3be4a79d..1e35991280d0 100644 --- a/sys/dev/sfxge/common/hunt_sram.c +++ b/sys/dev/sfxge/common/hunt_sram.c @@ -31,7 +31,6 @@ #include __FBSDID("$FreeBSD$"); -#include "efsys.h" #include "efx.h" #include "efx_impl.h" diff --git a/sys/dev/sfxge/common/hunt_tx.c b/sys/dev/sfxge/common/hunt_tx.c index 843e38ecf773..593db8835058 100755 --- a/sys/dev/sfxge/common/hunt_tx.c +++ b/sys/dev/sfxge/common/hunt_tx.c @@ -31,7 +31,6 @@ #include __FBSDID("$FreeBSD$"); -#include "efsys.h" #include "efx.h" #include "efx_impl.h" diff --git a/sys/dev/sfxge/common/hunt_vpd.c b/sys/dev/sfxge/common/hunt_vpd.c index ecdb7ab8a108..58e9a66ac712 100644 --- a/sys/dev/sfxge/common/hunt_vpd.c +++ b/sys/dev/sfxge/common/hunt_vpd.c @@ -31,10 +31,7 @@ #include __FBSDID("$FreeBSD$"); -#include "efsys.h" #include "efx.h" -#include "efx_types.h" -#include "efx_regs.h" #include "efx_impl.h" diff --git a/sys/dev/sfxge/common/mcdi_mon.c b/sys/dev/sfxge/common/mcdi_mon.c index d443cbadaa8c..4c7f961aaff4 100644 --- a/sys/dev/sfxge/common/mcdi_mon.c +++ b/sys/dev/sfxge/common/mcdi_mon.c @@ -31,7 +31,6 @@ #include __FBSDID("$FreeBSD$"); -#include "efsys.h" #include "efx.h" #include "efx_impl.h" diff --git a/sys/dev/sfxge/common/medford_nic.c b/sys/dev/sfxge/common/medford_nic.c index a293ae33df68..68c8184f5b18 100644 --- a/sys/dev/sfxge/common/medford_nic.c +++ b/sys/dev/sfxge/common/medford_nic.c @@ -31,7 +31,6 @@ #include __FBSDID("$FreeBSD$"); -#include "efsys.h" #include "efx.h" #include "efx_impl.h" #include "mcdi_mon.h" diff --git a/sys/dev/sfxge/common/siena_mac.c b/sys/dev/sfxge/common/siena_mac.c index ff8e11a9053a..12ecffdb482f 100644 --- a/sys/dev/sfxge/common/siena_mac.c +++ b/sys/dev/sfxge/common/siena_mac.c @@ -31,7 +31,6 @@ #include __FBSDID("$FreeBSD$"); -#include "efsys.h" #include "efx.h" #include "efx_impl.h" diff --git a/sys/dev/sfxge/common/siena_mcdi.c b/sys/dev/sfxge/common/siena_mcdi.c index 5c1aec7baac7..b6d6fcbc29f6 100644 --- a/sys/dev/sfxge/common/siena_mcdi.c +++ b/sys/dev/sfxge/common/siena_mcdi.c @@ -31,7 +31,6 @@ #include __FBSDID("$FreeBSD$"); -#include "efsys.h" #include "efx.h" #include "efx_impl.h" diff --git a/sys/dev/sfxge/common/siena_nic.c b/sys/dev/sfxge/common/siena_nic.c index e3f1732c7465..70e7b5d1ccad 100644 --- a/sys/dev/sfxge/common/siena_nic.c +++ b/sys/dev/sfxge/common/siena_nic.c @@ -31,7 +31,6 @@ #include __FBSDID("$FreeBSD$"); -#include "efsys.h" #include "efx.h" #include "efx_impl.h" #include "mcdi_mon.h" diff --git a/sys/dev/sfxge/common/siena_nvram.c b/sys/dev/sfxge/common/siena_nvram.c index 9eb5bfbe0fbd..8f107b49f61b 100644 --- a/sys/dev/sfxge/common/siena_nvram.c +++ b/sys/dev/sfxge/common/siena_nvram.c @@ -31,10 +31,7 @@ #include __FBSDID("$FreeBSD$"); -#include "efsys.h" #include "efx.h" -#include "efx_types.h" -#include "efx_regs.h" #include "efx_impl.h" #if EFSYS_OPT_SIENA diff --git a/sys/dev/sfxge/common/siena_phy.c b/sys/dev/sfxge/common/siena_phy.c index d39ae97d853a..920314a0f4ef 100644 --- a/sys/dev/sfxge/common/siena_phy.c +++ b/sys/dev/sfxge/common/siena_phy.c @@ -31,7 +31,6 @@ #include __FBSDID("$FreeBSD$"); -#include "efsys.h" #include "efx.h" #include "efx_impl.h" diff --git a/sys/dev/sfxge/common/siena_sram.c b/sys/dev/sfxge/common/siena_sram.c index 9a9c5cacb5e7..762de42506e9 100644 --- a/sys/dev/sfxge/common/siena_sram.c +++ b/sys/dev/sfxge/common/siena_sram.c @@ -31,7 +31,6 @@ #include __FBSDID("$FreeBSD$"); -#include "efsys.h" #include "efx.h" #include "efx_impl.h" diff --git a/sys/dev/sfxge/common/siena_vpd.c b/sys/dev/sfxge/common/siena_vpd.c index 6498fdfcd341..9a07f9130e00 100644 --- a/sys/dev/sfxge/common/siena_vpd.c +++ b/sys/dev/sfxge/common/siena_vpd.c @@ -31,10 +31,7 @@ #include __FBSDID("$FreeBSD$"); -#include "efsys.h" #include "efx.h" -#include "efx_types.h" -#include "efx_regs.h" #include "efx_impl.h" #if EFSYS_OPT_VPD From 7de2d9ec2f51be0d8531f8f54d8d1b53389b066f Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Wed, 13 Jan 2016 07:31:59 +0000 Subject: [PATCH 65/82] Add conf.sh file missed in r293621 MFC after: 16 days Sponsored by: EMC / Isilon Storage Division --- tools/regression/geom_gate/conf.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100755 tools/regression/geom_gate/conf.sh diff --git a/tools/regression/geom_gate/conf.sh b/tools/regression/geom_gate/conf.sh new file mode 100755 index 000000000000..4eede088ad29 --- /dev/null +++ b/tools/regression/geom_gate/conf.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# $FreeBSD$ + +name="$(mktemp -u gate.XXXXXX)" +class="gate" +base=`basename $0` + +kldstat -q -m g_${class} || kldload geom_${class} || exit 1 + +. `dirname $0`/../geom_subr.sh From 86ec4b8565dc77986d3113e38d48dc5cbcbee78c Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Wed, 13 Jan 2016 07:46:21 +0000 Subject: [PATCH 66/82] sfxge: cleanup: prefast fixes in common code Submitted by: Andrew Lee Sponsored by: Solarflare Communications, Inc. MFC after: 2 days --- sys/dev/sfxge/common/efx.h | 4 ++-- sys/dev/sfxge/common/efx_filter.c | 4 ++-- sys/dev/sfxge/common/efx_impl.h | 2 +- sys/dev/sfxge/common/hunt_impl.h | 8 ++++---- sys/dev/sfxge/common/hunt_mcdi.c | 8 ++++---- sys/dev/sfxge/common/hunt_nvram.c | 4 ++-- sys/dev/sfxge/common/siena_impl.h | 8 ++++---- sys/dev/sfxge/common/siena_mcdi.c | 8 ++++---- 8 files changed, 23 insertions(+), 23 deletions(-) diff --git a/sys/dev/sfxge/common/efx.h b/sys/dev/sfxge/common/efx.h index b9d206173f32..0483c9a7c4b4 100644 --- a/sys/dev/sfxge/common/efx.h +++ b/sys/dev/sfxge/common/efx.h @@ -2235,14 +2235,14 @@ efx_filter_supported_filters( extern void efx_filter_spec_init_rx( - __inout efx_filter_spec_t *spec, + __out efx_filter_spec_t *spec, __in efx_filter_priority_t priority, __in efx_filter_flag_t flags, __in efx_rxq_t *erp); extern void efx_filter_spec_init_tx( - __inout efx_filter_spec_t *spec, + __out efx_filter_spec_t *spec, __in efx_txq_t *etp); extern __checkReturn efx_rc_t diff --git a/sys/dev/sfxge/common/efx_filter.c b/sys/dev/sfxge/common/efx_filter.c index e2763ae5f9ec..a4b59cc7db20 100644 --- a/sys/dev/sfxge/common/efx_filter.c +++ b/sys/dev/sfxge/common/efx_filter.c @@ -292,7 +292,7 @@ efx_filter_reconfigure( void efx_filter_spec_init_rx( - __inout efx_filter_spec_t *spec, + __out efx_filter_spec_t *spec, __in efx_filter_priority_t priority, __in efx_filter_flag_t flags, __in efx_rxq_t *erp) @@ -311,7 +311,7 @@ efx_filter_spec_init_rx( void efx_filter_spec_init_tx( - __inout efx_filter_spec_t *spec, + __out efx_filter_spec_t *spec, __in efx_txq_t *etp) { EFSYS_ASSERT3P(spec, !=, NULL); diff --git a/sys/dev/sfxge/common/efx_impl.h b/sys/dev/sfxge/common/efx_impl.h index 16c0898a0050..5397ffebbbb7 100644 --- a/sys/dev/sfxge/common/efx_impl.h +++ b/sys/dev/sfxge/common/efx_impl.h @@ -1120,7 +1120,7 @@ efx_vpd_hunk_next( __in size_t size, __out efx_vpd_tag_t *tagp, __out efx_vpd_keyword_t *keyword, - __out_bcount_opt(*paylenp) unsigned int *payloadp, + __out_opt unsigned int *payloadp, __out_opt uint8_t *paylenp, __inout unsigned int *contp); diff --git a/sys/dev/sfxge/common/hunt_impl.h b/sys/dev/sfxge/common/hunt_impl.h index ab5857f3d852..f8c3b5e67678 100644 --- a/sys/dev/sfxge/common/hunt_impl.h +++ b/sys/dev/sfxge/common/hunt_impl.h @@ -289,10 +289,10 @@ ef10_mcdi_poll_response( extern void ef10_mcdi_read_response( - __in efx_nic_t *enp, - __out void *bufferp, - __in size_t offset, - __in size_t length); + __in efx_nic_t *enp, + __out_bcount(length) void *bufferp, + __in size_t offset, + __in size_t length); extern void ef10_mcdi_request_copyout( diff --git a/sys/dev/sfxge/common/hunt_mcdi.c b/sys/dev/sfxge/common/hunt_mcdi.c index 5b321505fbfa..1cccb23afce3 100644 --- a/sys/dev/sfxge/common/hunt_mcdi.c +++ b/sys/dev/sfxge/common/hunt_mcdi.c @@ -307,10 +307,10 @@ ef10_mcdi_poll_response( void ef10_mcdi_read_response( - __in efx_nic_t *enp, - __out void *bufferp, - __in size_t offset, - __in size_t length) + __in efx_nic_t *enp, + __out_bcount(length) void *bufferp, + __in size_t offset, + __in size_t length) { const efx_mcdi_transport_t *emtp = enp->en_mcdi.em_emtp; efsys_mem_t *esmp = emtp->emt_dma_mem; diff --git a/sys/dev/sfxge/common/hunt_nvram.c b/sys/dev/sfxge/common/hunt_nvram.c index 324c0d8873ba..763e8aca2711 100644 --- a/sys/dev/sfxge/common/hunt_nvram.c +++ b/sys/dev/sfxge/common/hunt_nvram.c @@ -240,7 +240,7 @@ tlv_validate_state( static efx_rc_t tlv_init_cursor( - __in tlv_cursor_t *cursor, + __out tlv_cursor_t *cursor, __in uint32_t *block, __in uint32_t *limit) { @@ -255,7 +255,7 @@ tlv_init_cursor( static efx_rc_t tlv_init_cursor_from_size( - __in tlv_cursor_t *cursor, + __out tlv_cursor_t *cursor, __in uint8_t *block, __in size_t size) { diff --git a/sys/dev/sfxge/common/siena_impl.h b/sys/dev/sfxge/common/siena_impl.h index effa113aabc4..639ac6b43fb7 100644 --- a/sys/dev/sfxge/common/siena_impl.h +++ b/sys/dev/sfxge/common/siena_impl.h @@ -127,10 +127,10 @@ siena_mcdi_poll_response( extern void siena_mcdi_read_response( - __in efx_nic_t *enp, - __out void *bufferp, - __in size_t offset, - __in size_t length); + __in efx_nic_t *enp, + __out_bcount(length) void *bufferp, + __in size_t offset, + __in size_t length); extern void siena_mcdi_request_copyout( diff --git a/sys/dev/sfxge/common/siena_mcdi.c b/sys/dev/sfxge/common/siena_mcdi.c index b6d6fcbc29f6..f3af2bf6f479 100644 --- a/sys/dev/sfxge/common/siena_mcdi.c +++ b/sys/dev/sfxge/common/siena_mcdi.c @@ -216,10 +216,10 @@ siena_mcdi_poll_response( void siena_mcdi_read_response( - __in efx_nic_t *enp, - __out void *bufferp, - __in size_t offset, - __in size_t length) + __in efx_nic_t *enp, + __out_bcount(length) void *bufferp, + __in size_t offset, + __in size_t length) { efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip); unsigned int pdur; From e02305fc28e433515a36ffb81864c1da817b12b1 Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Wed, 13 Jan 2016 07:55:47 +0000 Subject: [PATCH 67/82] sfxge: cleanup: fix typo in unused EFX_QWORD_IS_SET64 Submitted by: Richard Houldsworth Sponsored by: Solarflare Communications, Inc. MFC after: 2 days --- sys/dev/sfxge/common/efx_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/sfxge/common/efx_types.h b/sys/dev/sfxge/common/efx_types.h index f112a4c17a26..ae4c6d97ae9e 100644 --- a/sys/dev/sfxge/common/efx_types.h +++ b/sys/dev/sfxge/common/efx_types.h @@ -536,7 +536,7 @@ extern int fix_lint; (_oword).eo_u32[3]) == ~((uint32_t)0)) #define EFX_QWORD_IS_SET64(_qword) \ - (((_qword).eq_u64[0]) == ~((uint32_t)0)) + (((_qword).eq_u64[0]) == ~((uint64_t)0)) #define EFX_QWORD_IS_SET32(_qword) \ (((_qword).eq_u32[0] & \ From 6e4d48127c4ff994c6b50605ce5622e2a5854989 Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Wed, 13 Jan 2016 08:09:28 +0000 Subject: [PATCH 68/82] sfxge: cleanup: fix return code types Submitted by: Richard Houldsworth Sponsored by: Solarflare Communications, Inc. MFC after: 2 days --- sys/dev/sfxge/common/efx_mcdi.h | 2 +- sys/dev/sfxge/common/hunt_nvram.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/sfxge/common/efx_mcdi.h b/sys/dev/sfxge/common/efx_mcdi.h index d100775847d8..36b3d8d44aae 100644 --- a/sys/dev/sfxge/common/efx_mcdi.h +++ b/sys/dev/sfxge/common/efx_mcdi.h @@ -54,7 +54,7 @@ struct efx_mcdi_req_s { uint8_t *emr_in_buf; size_t emr_in_length; /* Outputs: retcode, buffer, length, and length used*/ - int emr_rc; + efx_rc_t emr_rc; uint8_t *emr_out_buf; size_t emr_out_length; size_t emr_out_length_used; diff --git a/sys/dev/sfxge/common/hunt_nvram.c b/sys/dev/sfxge/common/hunt_nvram.c index 763e8aca2711..cbead9b66a9a 100644 --- a/sys/dev/sfxge/common/hunt_nvram.c +++ b/sys/dev/sfxge/common/hunt_nvram.c @@ -1103,7 +1103,7 @@ ef10_nvram_segment_write_tlv( __in boolean_t write) { efx_rc_t rc; - int status; + efx_rc_t status; size_t original_segment_size; size_t modified_segment_size; From 09d986419d8834aa4fdb998695a8b7cce7e8e52a Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Wed, 13 Jan 2016 09:14:27 +0000 Subject: [PATCH 69/82] Integrate tools/regression/geom_{concat,eli,gate,mirror,nop,raid3,shsec,stripe,uzip} in to the FreeBSD test suite as tests/sys/geom/class/{concat,eli,gate,mirror,nop,raid3,shsec,stripe,uzip} The tools/regression/geom and tools/regression/geom_part testcases are being left alone because both test sets are both currently broken. The majority of this work was done on ^/user/ngie/more-tests2 . The differences are as follows: - tests/sys/geom/class/Makefile.inc is not present; it was inlined into the class's Makefiles for explicitness. - The testcases officially require root via kyua - The geom_gate(4) tests don't use the pidfile changes proposed in https://reviews.freebsd.org/D4836 . MFC after: 1 month Sponsored by: EMC / Isilon Storage Division --- etc/mtree/BSD.tests.dist | 26 ++++++++++++ tests/sys/Makefile | 1 + tests/sys/geom/Makefile | 7 ++++ tests/sys/geom/class/Makefile | 21 ++++++++++ .../sys/geom/class/concat/1_test.sh | 0 .../sys/geom/class/concat/2_test.sh | 0 tests/sys/geom/class/concat/Makefile | 16 +++++++ .../sys/geom/class/concat}/conf.sh | 0 tests/sys/geom/class/eli/Makefile | 42 +++++++++++++++++++ .../sys/geom/class/eli/attach_d_test.sh | 0 .../sys/geom/class/eli}/conf.sh | 0 .../sys/geom/class/eli/configure_b_B_test.sh | 0 .../sys/geom/class/eli/delkey_test.sh | 0 .../sys/geom/class/eli/detach_l_test.sh | 0 .../sys/geom/class/eli/init_B_test.sh | 0 .../sys/geom/class/eli/init_J_test.sh | 0 .../sys/geom/class/eli/init_a_test.sh | 0 .../sys/geom/class/eli/init_i_P_test.sh | 0 .../sys/geom/class/eli/init_test.sh | 0 .../sys/geom/class/eli/integrity_copy_test.sh | 0 .../sys/geom/class/eli/integrity_data_test.sh | 0 .../sys/geom/class/eli/integrity_hmac_test.sh | 0 .../sys/geom/class/eli/kill_test.sh | 0 .../sys/geom/class/eli/nokey_test.sh | 0 .../sys/geom/class/eli/onetime_a_test.sh | 0 .../sys/geom/class/eli/onetime_d_test.sh | 0 .../sys/geom/class/eli/onetime_test.sh | 0 .../sys/geom/class/eli/readonly_test.sh | 0 .../sys/geom/class/eli/resize_test.sh | 0 .../sys/geom/class/eli/setkey_test.sh | 0 .../sys/geom/class/gate/1_test.sh | 0 .../sys/geom/class/gate/2_test.sh | 0 .../sys/geom/class/gate/3_test.sh | 0 tests/sys/geom/class/gate/Makefile | 17 ++++++++ .../sys/geom/class/gate}/conf.sh | 0 .../sys/geom/class}/geom_subr.sh | 0 .../sys/geom/class/mirror/1_test.sh | 0 .../sys/geom/class/mirror/2_test.sh | 0 .../sys/geom/class/mirror/3_test.sh | 0 .../sys/geom/class/mirror/4_test.sh | 0 .../sys/geom/class/mirror/5_test.sh | 0 .../sys/geom/class/mirror/6_test.sh | 0 .../sys/geom/class/mirror/7_test.sh | 0 tests/sys/geom/class/mirror/Makefile | 21 ++++++++++ .../sys/geom/class/mirror}/conf.sh | 0 .../sys/geom/class/nop/1_test.sh | 0 .../sys/geom/class/nop/2_test.sh | 0 tests/sys/geom/class/nop/Makefile | 16 +++++++ .../sys/geom/class/nop}/conf.sh | 0 .../sys/geom/class/raid3/10_test.sh | 0 .../sys/geom/class/raid3/11_test.sh | 0 .../sys/geom/class/raid3/12_test.sh | 0 .../sys/geom/class/raid3/1_test.sh | 0 .../sys/geom/class/raid3/2_test.sh | 0 .../sys/geom/class/raid3/3_test.sh | 0 .../sys/geom/class/raid3/4_test.sh | 0 .../sys/geom/class/raid3/5_test.sh | 0 .../sys/geom/class/raid3/6_test.sh | 0 .../sys/geom/class/raid3/7_test.sh | 0 .../sys/geom/class/raid3/8_test.sh | 0 .../sys/geom/class/raid3/9_test.sh | 0 tests/sys/geom/class/raid3/Makefile | 26 ++++++++++++ .../sys/geom/class/raid3}/conf.sh | 0 .../sys/geom/class/shsec/1_test.sh | 0 .../sys/geom/class/shsec/2_test.sh | 0 tests/sys/geom/class/shsec/Makefile | 16 +++++++ .../sys/geom/class/shsec}/conf.sh | 0 .../sys/geom/class/stripe/1_test.sh | 0 .../sys/geom/class/stripe/2_test.sh | 0 tests/sys/geom/class/stripe/Makefile | 16 +++++++ .../sys/geom/class/stripe}/conf.sh | 0 .../sys/geom/class/uzip/1_test.sh | 2 +- tests/sys/geom/class/uzip/Makefile | 42 +++++++++++++++++++ .../sys/geom/class/uzip}/conf.sh | 0 .../sys/geom/class/uzip}/etalon/etalon.txt | 0 .../sys/geom/class/uzip}/test-1.img.uzip.uue | 0 tools/regression/geom_uzip/Makefile | 23 ---------- 77 files changed, 268 insertions(+), 24 deletions(-) create mode 100644 tests/sys/geom/Makefile create mode 100644 tests/sys/geom/class/Makefile rename tools/regression/geom_concat/test-1.t => tests/sys/geom/class/concat/1_test.sh (100%) rename tools/regression/geom_concat/test-2.t => tests/sys/geom/class/concat/2_test.sh (100%) create mode 100644 tests/sys/geom/class/concat/Makefile rename {tools/regression/geom_concat => tests/sys/geom/class/concat}/conf.sh (100%) create mode 100644 tests/sys/geom/class/eli/Makefile rename tools/regression/geom_eli/attach-d.t => tests/sys/geom/class/eli/attach_d_test.sh (100%) rename {tools/regression/geom_eli => tests/sys/geom/class/eli}/conf.sh (100%) rename tools/regression/geom_eli/configure-b-B.t => tests/sys/geom/class/eli/configure_b_B_test.sh (100%) rename tools/regression/geom_eli/delkey.t => tests/sys/geom/class/eli/delkey_test.sh (100%) rename tools/regression/geom_eli/detach-l.t => tests/sys/geom/class/eli/detach_l_test.sh (100%) rename tools/regression/geom_eli/init-B.t => tests/sys/geom/class/eli/init_B_test.sh (100%) rename tools/regression/geom_eli/init-J.t => tests/sys/geom/class/eli/init_J_test.sh (100%) rename tools/regression/geom_eli/init-a.t => tests/sys/geom/class/eli/init_a_test.sh (100%) rename tools/regression/geom_eli/init-i-P.t => tests/sys/geom/class/eli/init_i_P_test.sh (100%) rename tools/regression/geom_eli/init.t => tests/sys/geom/class/eli/init_test.sh (100%) rename tools/regression/geom_eli/integrity-copy.t => tests/sys/geom/class/eli/integrity_copy_test.sh (100%) rename tools/regression/geom_eli/integrity-data.t => tests/sys/geom/class/eli/integrity_data_test.sh (100%) rename tools/regression/geom_eli/integrity-hmac.t => tests/sys/geom/class/eli/integrity_hmac_test.sh (100%) rename tools/regression/geom_eli/kill.t => tests/sys/geom/class/eli/kill_test.sh (100%) rename tools/regression/geom_eli/nokey.t => tests/sys/geom/class/eli/nokey_test.sh (100%) rename tools/regression/geom_eli/onetime-a.t => tests/sys/geom/class/eli/onetime_a_test.sh (100%) rename tools/regression/geom_eli/onetime-d.t => tests/sys/geom/class/eli/onetime_d_test.sh (100%) rename tools/regression/geom_eli/onetime.t => tests/sys/geom/class/eli/onetime_test.sh (100%) rename tools/regression/geom_eli/readonly.t => tests/sys/geom/class/eli/readonly_test.sh (100%) rename tools/regression/geom_eli/resize.t => tests/sys/geom/class/eli/resize_test.sh (100%) rename tools/regression/geom_eli/setkey.t => tests/sys/geom/class/eli/setkey_test.sh (100%) rename tools/regression/geom_gate/test-1.t => tests/sys/geom/class/gate/1_test.sh (100%) rename tools/regression/geom_gate/test-2.t => tests/sys/geom/class/gate/2_test.sh (100%) rename tools/regression/geom_gate/test-3.t => tests/sys/geom/class/gate/3_test.sh (100%) create mode 100644 tests/sys/geom/class/gate/Makefile rename {tools/regression/geom_gate => tests/sys/geom/class/gate}/conf.sh (100%) rename {tools/regression => tests/sys/geom/class}/geom_subr.sh (100%) rename tools/regression/geom_mirror/test-1.t => tests/sys/geom/class/mirror/1_test.sh (100%) rename tools/regression/geom_mirror/test-2.t => tests/sys/geom/class/mirror/2_test.sh (100%) rename tools/regression/geom_mirror/test-3.t => tests/sys/geom/class/mirror/3_test.sh (100%) rename tools/regression/geom_mirror/test-4.t => tests/sys/geom/class/mirror/4_test.sh (100%) rename tools/regression/geom_mirror/test-5.t => tests/sys/geom/class/mirror/5_test.sh (100%) rename tools/regression/geom_mirror/test-6.t => tests/sys/geom/class/mirror/6_test.sh (100%) rename tools/regression/geom_mirror/test-7.t => tests/sys/geom/class/mirror/7_test.sh (100%) create mode 100644 tests/sys/geom/class/mirror/Makefile rename {tools/regression/geom_mirror => tests/sys/geom/class/mirror}/conf.sh (100%) rename tools/regression/geom_nop/test-1.t => tests/sys/geom/class/nop/1_test.sh (100%) rename tools/regression/geom_nop/test-2.t => tests/sys/geom/class/nop/2_test.sh (100%) create mode 100644 tests/sys/geom/class/nop/Makefile rename {tools/regression/geom_nop => tests/sys/geom/class/nop}/conf.sh (100%) rename tools/regression/geom_raid3/test-10.t => tests/sys/geom/class/raid3/10_test.sh (100%) rename tools/regression/geom_raid3/test-11.t => tests/sys/geom/class/raid3/11_test.sh (100%) rename tools/regression/geom_raid3/test-12.t => tests/sys/geom/class/raid3/12_test.sh (100%) rename tools/regression/geom_raid3/test-1.t => tests/sys/geom/class/raid3/1_test.sh (100%) rename tools/regression/geom_raid3/test-2.t => tests/sys/geom/class/raid3/2_test.sh (100%) rename tools/regression/geom_raid3/test-3.t => tests/sys/geom/class/raid3/3_test.sh (100%) rename tools/regression/geom_raid3/test-4.t => tests/sys/geom/class/raid3/4_test.sh (100%) rename tools/regression/geom_raid3/test-5.t => tests/sys/geom/class/raid3/5_test.sh (100%) rename tools/regression/geom_raid3/test-6.t => tests/sys/geom/class/raid3/6_test.sh (100%) rename tools/regression/geom_raid3/test-7.t => tests/sys/geom/class/raid3/7_test.sh (100%) rename tools/regression/geom_raid3/test-8.t => tests/sys/geom/class/raid3/8_test.sh (100%) rename tools/regression/geom_raid3/test-9.t => tests/sys/geom/class/raid3/9_test.sh (100%) create mode 100644 tests/sys/geom/class/raid3/Makefile rename {tools/regression/geom_raid3 => tests/sys/geom/class/raid3}/conf.sh (100%) rename tools/regression/geom_shsec/test-1.t => tests/sys/geom/class/shsec/1_test.sh (100%) rename tools/regression/geom_shsec/test-2.t => tests/sys/geom/class/shsec/2_test.sh (100%) create mode 100644 tests/sys/geom/class/shsec/Makefile rename {tools/regression/geom_shsec => tests/sys/geom/class/shsec}/conf.sh (100%) rename tools/regression/geom_stripe/test-1.t => tests/sys/geom/class/stripe/1_test.sh (100%) rename tools/regression/geom_stripe/test-2.t => tests/sys/geom/class/stripe/2_test.sh (100%) create mode 100644 tests/sys/geom/class/stripe/Makefile rename {tools/regression/geom_stripe => tests/sys/geom/class/stripe}/conf.sh (100%) rename tools/regression/geom_uzip/test-1.t => tests/sys/geom/class/uzip/1_test.sh (91%) create mode 100644 tests/sys/geom/class/uzip/Makefile rename {tools/regression/geom_uzip => tests/sys/geom/class/uzip}/conf.sh (100%) rename {tools/regression/geom_uzip => tests/sys/geom/class/uzip}/etalon/etalon.txt (100%) rename {tools/regression/geom_uzip => tests/sys/geom/class/uzip}/test-1.img.uzip.uue (100%) delete mode 100644 tools/regression/geom_uzip/Makefile diff --git a/etc/mtree/BSD.tests.dist b/etc/mtree/BSD.tests.dist index ff3232417cf7..ea10412a94e9 100644 --- a/etc/mtree/BSD.tests.dist +++ b/etc/mtree/BSD.tests.dist @@ -376,6 +376,32 @@ .. file .. + geom + class + concat + .. + eli + .. + gate + .. + gpt + .. + mirror + .. + nop + .. + raid3 + .. + shsec + .. + stripe + .. + uzip + etalon + .. + .. + .. + .. kern acct .. diff --git a/tests/sys/Makefile b/tests/sys/Makefile index 4e653be6530a..18a24a452f00 100644 --- a/tests/sys/Makefile +++ b/tests/sys/Makefile @@ -8,6 +8,7 @@ TESTS_SUBDIRS+= acl TESTS_SUBDIRS+= aio TESTS_SUBDIRS+= fifo TESTS_SUBDIRS+= file +TESTS_SUBDIRS+= geom TESTS_SUBDIRS+= kern TESTS_SUBDIRS+= kqueue TESTS_SUBDIRS+= mac diff --git a/tests/sys/geom/Makefile b/tests/sys/geom/Makefile new file mode 100644 index 000000000000..bf8604dcabc3 --- /dev/null +++ b/tests/sys/geom/Makefile @@ -0,0 +1,7 @@ +# $FreeBSD$ + +TESTSDIR= ${TESTSBASE}/sys/geom + +TESTS_SUBDIRS+= class + +.include diff --git a/tests/sys/geom/class/Makefile b/tests/sys/geom/class/Makefile new file mode 100644 index 000000000000..c70561691420 --- /dev/null +++ b/tests/sys/geom/class/Makefile @@ -0,0 +1,21 @@ +# $FreeBSD$ + +TESTSDIR= ${TESTSBASE}/sys/geom/class + +TESTS_SUBDIRS+= concat +TESTS_SUBDIRS+= eli +TESTS_SUBDIRS+= gate +# XXX: might not work due to geom(4) changes; more investigation's needed +#TESTS_SUBDIRS+= gpt +TESTS_SUBDIRS+= mirror +TESTS_SUBDIRS+= nop +TESTS_SUBDIRS+= raid3 +TESTS_SUBDIRS+= shsec +TESTS_SUBDIRS+= stripe +TESTS_SUBDIRS+= uzip + +BINDIR= ${TESTSDIR} + +FILES+= geom_subr.sh + +.include diff --git a/tools/regression/geom_concat/test-1.t b/tests/sys/geom/class/concat/1_test.sh similarity index 100% rename from tools/regression/geom_concat/test-1.t rename to tests/sys/geom/class/concat/1_test.sh diff --git a/tools/regression/geom_concat/test-2.t b/tests/sys/geom/class/concat/2_test.sh similarity index 100% rename from tools/regression/geom_concat/test-2.t rename to tests/sys/geom/class/concat/2_test.sh diff --git a/tests/sys/geom/class/concat/Makefile b/tests/sys/geom/class/concat/Makefile new file mode 100644 index 000000000000..5659b5d38215 --- /dev/null +++ b/tests/sys/geom/class/concat/Makefile @@ -0,0 +1,16 @@ +# $FreeBSD$ + +TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T} + +TAP_TESTS_SH+= 1_test +TAP_TESTS_SH+= 2_test + +FILES+= conf.sh +FILESNAME_conf.sh= conf.sh +FILESDIR= ${TESTSDIR} + +.for t in ${TAP_TESTS_SH} +TEST_METADATA.$t+= required_user="root" +.endfor + +.include diff --git a/tools/regression/geom_concat/conf.sh b/tests/sys/geom/class/concat/conf.sh similarity index 100% rename from tools/regression/geom_concat/conf.sh rename to tests/sys/geom/class/concat/conf.sh diff --git a/tests/sys/geom/class/eli/Makefile b/tests/sys/geom/class/eli/Makefile new file mode 100644 index 000000000000..8f4ca60d03c3 --- /dev/null +++ b/tests/sys/geom/class/eli/Makefile @@ -0,0 +1,42 @@ +# $FreeBSD$ + +TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T} + +TAP_TESTS_SH+= attach_d_test +TAP_TESTS_SH+= configure_b_B_test +TAP_TESTS_SH+= delkey_test +TAP_TESTS_SH+= detach_l_test +TAP_TESTS_SH+= init_B_test +TAP_TESTS_SH+= init_J_test +TAP_TESTS_SH+= init_a_test +TAP_TESTS_SH+= init_i_P_test +TAP_TESTS_SH+= init_test +TAP_TESTS_SH+= integrity_copy_test +TAP_TESTS_SH+= integrity_data_test +TAP_TESTS_SH+= integrity_hmac_test +TAP_TESTS_SH+= kill_test +TAP_TESTS_SH+= nokey_test +TAP_TESTS_SH+= onetime_a_test +TAP_TESTS_SH+= onetime_d_test +TAP_TESTS_SH+= onetime_test +TAP_TESTS_SH+= readonly_test +TAP_TESTS_SH+= resize_test +TAP_TESTS_SH+= setkey_test + +TEST_METADATA.init_a_test+= timeout="1200" +TEST_METADATA.init_test+= timeout="300" +TEST_METADATA.integrity_copy_test+= timeout="1200" +TEST_METADATA.integrity_data_test+= timeout="600" +TEST_METADATA.integrity_hmac_test+= timeout="600" +TEST_METADATA.onetime_a_test+= timeout="600" +TEST_METADATA.onetime_test+= timeout="600" + +FILES+= conf.sh +FILESNAME_conf.sh= conf.sh +FILESDIR= ${TESTSDIR} + +.for t in ${TAP_TESTS_SH} +TEST_METADATA.$t+= required_user="root" +.endfor + +.include diff --git a/tools/regression/geom_eli/attach-d.t b/tests/sys/geom/class/eli/attach_d_test.sh similarity index 100% rename from tools/regression/geom_eli/attach-d.t rename to tests/sys/geom/class/eli/attach_d_test.sh diff --git a/tools/regression/geom_eli/conf.sh b/tests/sys/geom/class/eli/conf.sh similarity index 100% rename from tools/regression/geom_eli/conf.sh rename to tests/sys/geom/class/eli/conf.sh diff --git a/tools/regression/geom_eli/configure-b-B.t b/tests/sys/geom/class/eli/configure_b_B_test.sh similarity index 100% rename from tools/regression/geom_eli/configure-b-B.t rename to tests/sys/geom/class/eli/configure_b_B_test.sh diff --git a/tools/regression/geom_eli/delkey.t b/tests/sys/geom/class/eli/delkey_test.sh similarity index 100% rename from tools/regression/geom_eli/delkey.t rename to tests/sys/geom/class/eli/delkey_test.sh diff --git a/tools/regression/geom_eli/detach-l.t b/tests/sys/geom/class/eli/detach_l_test.sh similarity index 100% rename from tools/regression/geom_eli/detach-l.t rename to tests/sys/geom/class/eli/detach_l_test.sh diff --git a/tools/regression/geom_eli/init-B.t b/tests/sys/geom/class/eli/init_B_test.sh similarity index 100% rename from tools/regression/geom_eli/init-B.t rename to tests/sys/geom/class/eli/init_B_test.sh diff --git a/tools/regression/geom_eli/init-J.t b/tests/sys/geom/class/eli/init_J_test.sh similarity index 100% rename from tools/regression/geom_eli/init-J.t rename to tests/sys/geom/class/eli/init_J_test.sh diff --git a/tools/regression/geom_eli/init-a.t b/tests/sys/geom/class/eli/init_a_test.sh similarity index 100% rename from tools/regression/geom_eli/init-a.t rename to tests/sys/geom/class/eli/init_a_test.sh diff --git a/tools/regression/geom_eli/init-i-P.t b/tests/sys/geom/class/eli/init_i_P_test.sh similarity index 100% rename from tools/regression/geom_eli/init-i-P.t rename to tests/sys/geom/class/eli/init_i_P_test.sh diff --git a/tools/regression/geom_eli/init.t b/tests/sys/geom/class/eli/init_test.sh similarity index 100% rename from tools/regression/geom_eli/init.t rename to tests/sys/geom/class/eli/init_test.sh diff --git a/tools/regression/geom_eli/integrity-copy.t b/tests/sys/geom/class/eli/integrity_copy_test.sh similarity index 100% rename from tools/regression/geom_eli/integrity-copy.t rename to tests/sys/geom/class/eli/integrity_copy_test.sh diff --git a/tools/regression/geom_eli/integrity-data.t b/tests/sys/geom/class/eli/integrity_data_test.sh similarity index 100% rename from tools/regression/geom_eli/integrity-data.t rename to tests/sys/geom/class/eli/integrity_data_test.sh diff --git a/tools/regression/geom_eli/integrity-hmac.t b/tests/sys/geom/class/eli/integrity_hmac_test.sh similarity index 100% rename from tools/regression/geom_eli/integrity-hmac.t rename to tests/sys/geom/class/eli/integrity_hmac_test.sh diff --git a/tools/regression/geom_eli/kill.t b/tests/sys/geom/class/eli/kill_test.sh similarity index 100% rename from tools/regression/geom_eli/kill.t rename to tests/sys/geom/class/eli/kill_test.sh diff --git a/tools/regression/geom_eli/nokey.t b/tests/sys/geom/class/eli/nokey_test.sh similarity index 100% rename from tools/regression/geom_eli/nokey.t rename to tests/sys/geom/class/eli/nokey_test.sh diff --git a/tools/regression/geom_eli/onetime-a.t b/tests/sys/geom/class/eli/onetime_a_test.sh similarity index 100% rename from tools/regression/geom_eli/onetime-a.t rename to tests/sys/geom/class/eli/onetime_a_test.sh diff --git a/tools/regression/geom_eli/onetime-d.t b/tests/sys/geom/class/eli/onetime_d_test.sh similarity index 100% rename from tools/regression/geom_eli/onetime-d.t rename to tests/sys/geom/class/eli/onetime_d_test.sh diff --git a/tools/regression/geom_eli/onetime.t b/tests/sys/geom/class/eli/onetime_test.sh similarity index 100% rename from tools/regression/geom_eli/onetime.t rename to tests/sys/geom/class/eli/onetime_test.sh diff --git a/tools/regression/geom_eli/readonly.t b/tests/sys/geom/class/eli/readonly_test.sh similarity index 100% rename from tools/regression/geom_eli/readonly.t rename to tests/sys/geom/class/eli/readonly_test.sh diff --git a/tools/regression/geom_eli/resize.t b/tests/sys/geom/class/eli/resize_test.sh similarity index 100% rename from tools/regression/geom_eli/resize.t rename to tests/sys/geom/class/eli/resize_test.sh diff --git a/tools/regression/geom_eli/setkey.t b/tests/sys/geom/class/eli/setkey_test.sh similarity index 100% rename from tools/regression/geom_eli/setkey.t rename to tests/sys/geom/class/eli/setkey_test.sh diff --git a/tools/regression/geom_gate/test-1.t b/tests/sys/geom/class/gate/1_test.sh similarity index 100% rename from tools/regression/geom_gate/test-1.t rename to tests/sys/geom/class/gate/1_test.sh diff --git a/tools/regression/geom_gate/test-2.t b/tests/sys/geom/class/gate/2_test.sh similarity index 100% rename from tools/regression/geom_gate/test-2.t rename to tests/sys/geom/class/gate/2_test.sh diff --git a/tools/regression/geom_gate/test-3.t b/tests/sys/geom/class/gate/3_test.sh similarity index 100% rename from tools/regression/geom_gate/test-3.t rename to tests/sys/geom/class/gate/3_test.sh diff --git a/tests/sys/geom/class/gate/Makefile b/tests/sys/geom/class/gate/Makefile new file mode 100644 index 000000000000..11ceb944cfdf --- /dev/null +++ b/tests/sys/geom/class/gate/Makefile @@ -0,0 +1,17 @@ +# $FreeBSD$ + +TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T} + +TAP_TESTS_SH+= 1_test +TAP_TESTS_SH+= 2_test +TAP_TESTS_SH+= 3_test + +FILES+= conf.sh +FILESNAME_conf.sh= conf.sh +FILESDIR= ${TESTSDIR} + +.for t in ${TAP_TESTS_SH} +TEST_METADATA.$t+= required_user="root" +.endfor + +.include diff --git a/tools/regression/geom_gate/conf.sh b/tests/sys/geom/class/gate/conf.sh similarity index 100% rename from tools/regression/geom_gate/conf.sh rename to tests/sys/geom/class/gate/conf.sh diff --git a/tools/regression/geom_subr.sh b/tests/sys/geom/class/geom_subr.sh similarity index 100% rename from tools/regression/geom_subr.sh rename to tests/sys/geom/class/geom_subr.sh diff --git a/tools/regression/geom_mirror/test-1.t b/tests/sys/geom/class/mirror/1_test.sh similarity index 100% rename from tools/regression/geom_mirror/test-1.t rename to tests/sys/geom/class/mirror/1_test.sh diff --git a/tools/regression/geom_mirror/test-2.t b/tests/sys/geom/class/mirror/2_test.sh similarity index 100% rename from tools/regression/geom_mirror/test-2.t rename to tests/sys/geom/class/mirror/2_test.sh diff --git a/tools/regression/geom_mirror/test-3.t b/tests/sys/geom/class/mirror/3_test.sh similarity index 100% rename from tools/regression/geom_mirror/test-3.t rename to tests/sys/geom/class/mirror/3_test.sh diff --git a/tools/regression/geom_mirror/test-4.t b/tests/sys/geom/class/mirror/4_test.sh similarity index 100% rename from tools/regression/geom_mirror/test-4.t rename to tests/sys/geom/class/mirror/4_test.sh diff --git a/tools/regression/geom_mirror/test-5.t b/tests/sys/geom/class/mirror/5_test.sh similarity index 100% rename from tools/regression/geom_mirror/test-5.t rename to tests/sys/geom/class/mirror/5_test.sh diff --git a/tools/regression/geom_mirror/test-6.t b/tests/sys/geom/class/mirror/6_test.sh similarity index 100% rename from tools/regression/geom_mirror/test-6.t rename to tests/sys/geom/class/mirror/6_test.sh diff --git a/tools/regression/geom_mirror/test-7.t b/tests/sys/geom/class/mirror/7_test.sh similarity index 100% rename from tools/regression/geom_mirror/test-7.t rename to tests/sys/geom/class/mirror/7_test.sh diff --git a/tests/sys/geom/class/mirror/Makefile b/tests/sys/geom/class/mirror/Makefile new file mode 100644 index 000000000000..931f7d0dcb57 --- /dev/null +++ b/tests/sys/geom/class/mirror/Makefile @@ -0,0 +1,21 @@ +# $FreeBSD$ + +TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T} + +TAP_TESTS_SH+= 1_test +TAP_TESTS_SH+= 2_test +TAP_TESTS_SH+= 3_test +TAP_TESTS_SH+= 4_test +TAP_TESTS_SH+= 5_test +TAP_TESTS_SH+= 6_test +TAP_TESTS_SH+= 7_test + +FILES+= conf.sh +FILESNAME_conf.sh= conf.sh +FILESDIR= ${TESTSDIR} + +.for t in ${TAP_TESTS_SH} +TEST_METADATA.$t+= required_user="root" +.endfor + +.include diff --git a/tools/regression/geom_mirror/conf.sh b/tests/sys/geom/class/mirror/conf.sh similarity index 100% rename from tools/regression/geom_mirror/conf.sh rename to tests/sys/geom/class/mirror/conf.sh diff --git a/tools/regression/geom_nop/test-1.t b/tests/sys/geom/class/nop/1_test.sh similarity index 100% rename from tools/regression/geom_nop/test-1.t rename to tests/sys/geom/class/nop/1_test.sh diff --git a/tools/regression/geom_nop/test-2.t b/tests/sys/geom/class/nop/2_test.sh similarity index 100% rename from tools/regression/geom_nop/test-2.t rename to tests/sys/geom/class/nop/2_test.sh diff --git a/tests/sys/geom/class/nop/Makefile b/tests/sys/geom/class/nop/Makefile new file mode 100644 index 000000000000..5659b5d38215 --- /dev/null +++ b/tests/sys/geom/class/nop/Makefile @@ -0,0 +1,16 @@ +# $FreeBSD$ + +TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T} + +TAP_TESTS_SH+= 1_test +TAP_TESTS_SH+= 2_test + +FILES+= conf.sh +FILESNAME_conf.sh= conf.sh +FILESDIR= ${TESTSDIR} + +.for t in ${TAP_TESTS_SH} +TEST_METADATA.$t+= required_user="root" +.endfor + +.include diff --git a/tools/regression/geom_nop/conf.sh b/tests/sys/geom/class/nop/conf.sh similarity index 100% rename from tools/regression/geom_nop/conf.sh rename to tests/sys/geom/class/nop/conf.sh diff --git a/tools/regression/geom_raid3/test-10.t b/tests/sys/geom/class/raid3/10_test.sh similarity index 100% rename from tools/regression/geom_raid3/test-10.t rename to tests/sys/geom/class/raid3/10_test.sh diff --git a/tools/regression/geom_raid3/test-11.t b/tests/sys/geom/class/raid3/11_test.sh similarity index 100% rename from tools/regression/geom_raid3/test-11.t rename to tests/sys/geom/class/raid3/11_test.sh diff --git a/tools/regression/geom_raid3/test-12.t b/tests/sys/geom/class/raid3/12_test.sh similarity index 100% rename from tools/regression/geom_raid3/test-12.t rename to tests/sys/geom/class/raid3/12_test.sh diff --git a/tools/regression/geom_raid3/test-1.t b/tests/sys/geom/class/raid3/1_test.sh similarity index 100% rename from tools/regression/geom_raid3/test-1.t rename to tests/sys/geom/class/raid3/1_test.sh diff --git a/tools/regression/geom_raid3/test-2.t b/tests/sys/geom/class/raid3/2_test.sh similarity index 100% rename from tools/regression/geom_raid3/test-2.t rename to tests/sys/geom/class/raid3/2_test.sh diff --git a/tools/regression/geom_raid3/test-3.t b/tests/sys/geom/class/raid3/3_test.sh similarity index 100% rename from tools/regression/geom_raid3/test-3.t rename to tests/sys/geom/class/raid3/3_test.sh diff --git a/tools/regression/geom_raid3/test-4.t b/tests/sys/geom/class/raid3/4_test.sh similarity index 100% rename from tools/regression/geom_raid3/test-4.t rename to tests/sys/geom/class/raid3/4_test.sh diff --git a/tools/regression/geom_raid3/test-5.t b/tests/sys/geom/class/raid3/5_test.sh similarity index 100% rename from tools/regression/geom_raid3/test-5.t rename to tests/sys/geom/class/raid3/5_test.sh diff --git a/tools/regression/geom_raid3/test-6.t b/tests/sys/geom/class/raid3/6_test.sh similarity index 100% rename from tools/regression/geom_raid3/test-6.t rename to tests/sys/geom/class/raid3/6_test.sh diff --git a/tools/regression/geom_raid3/test-7.t b/tests/sys/geom/class/raid3/7_test.sh similarity index 100% rename from tools/regression/geom_raid3/test-7.t rename to tests/sys/geom/class/raid3/7_test.sh diff --git a/tools/regression/geom_raid3/test-8.t b/tests/sys/geom/class/raid3/8_test.sh similarity index 100% rename from tools/regression/geom_raid3/test-8.t rename to tests/sys/geom/class/raid3/8_test.sh diff --git a/tools/regression/geom_raid3/test-9.t b/tests/sys/geom/class/raid3/9_test.sh similarity index 100% rename from tools/regression/geom_raid3/test-9.t rename to tests/sys/geom/class/raid3/9_test.sh diff --git a/tests/sys/geom/class/raid3/Makefile b/tests/sys/geom/class/raid3/Makefile new file mode 100644 index 000000000000..526c175e9976 --- /dev/null +++ b/tests/sys/geom/class/raid3/Makefile @@ -0,0 +1,26 @@ +# $FreeBSD$ + +TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T} + +TAP_TESTS_SH+= 1_test +TAP_TESTS_SH+= 2_test +TAP_TESTS_SH+= 3_test +TAP_TESTS_SH+= 4_test +TAP_TESTS_SH+= 5_test +TAP_TESTS_SH+= 6_test +TAP_TESTS_SH+= 7_test +TAP_TESTS_SH+= 8_test +TAP_TESTS_SH+= 9_test +TAP_TESTS_SH+= 10_test +TAP_TESTS_SH+= 11_test +TAP_TESTS_SH+= 12_test + +FILES+= conf.sh +FILESNAME_conf.sh= conf.sh +FILESDIR= ${TESTSDIR} + +.for t in ${TAP_TESTS_SH} +TEST_METADATA.$t+= required_user="root" +.endfor + +.include diff --git a/tools/regression/geom_raid3/conf.sh b/tests/sys/geom/class/raid3/conf.sh similarity index 100% rename from tools/regression/geom_raid3/conf.sh rename to tests/sys/geom/class/raid3/conf.sh diff --git a/tools/regression/geom_shsec/test-1.t b/tests/sys/geom/class/shsec/1_test.sh similarity index 100% rename from tools/regression/geom_shsec/test-1.t rename to tests/sys/geom/class/shsec/1_test.sh diff --git a/tools/regression/geom_shsec/test-2.t b/tests/sys/geom/class/shsec/2_test.sh similarity index 100% rename from tools/regression/geom_shsec/test-2.t rename to tests/sys/geom/class/shsec/2_test.sh diff --git a/tests/sys/geom/class/shsec/Makefile b/tests/sys/geom/class/shsec/Makefile new file mode 100644 index 000000000000..5659b5d38215 --- /dev/null +++ b/tests/sys/geom/class/shsec/Makefile @@ -0,0 +1,16 @@ +# $FreeBSD$ + +TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T} + +TAP_TESTS_SH+= 1_test +TAP_TESTS_SH+= 2_test + +FILES+= conf.sh +FILESNAME_conf.sh= conf.sh +FILESDIR= ${TESTSDIR} + +.for t in ${TAP_TESTS_SH} +TEST_METADATA.$t+= required_user="root" +.endfor + +.include diff --git a/tools/regression/geom_shsec/conf.sh b/tests/sys/geom/class/shsec/conf.sh similarity index 100% rename from tools/regression/geom_shsec/conf.sh rename to tests/sys/geom/class/shsec/conf.sh diff --git a/tools/regression/geom_stripe/test-1.t b/tests/sys/geom/class/stripe/1_test.sh similarity index 100% rename from tools/regression/geom_stripe/test-1.t rename to tests/sys/geom/class/stripe/1_test.sh diff --git a/tools/regression/geom_stripe/test-2.t b/tests/sys/geom/class/stripe/2_test.sh similarity index 100% rename from tools/regression/geom_stripe/test-2.t rename to tests/sys/geom/class/stripe/2_test.sh diff --git a/tests/sys/geom/class/stripe/Makefile b/tests/sys/geom/class/stripe/Makefile new file mode 100644 index 000000000000..5659b5d38215 --- /dev/null +++ b/tests/sys/geom/class/stripe/Makefile @@ -0,0 +1,16 @@ +# $FreeBSD$ + +TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T} + +TAP_TESTS_SH+= 1_test +TAP_TESTS_SH+= 2_test + +FILES+= conf.sh +FILESNAME_conf.sh= conf.sh +FILESDIR= ${TESTSDIR} + +.for t in ${TAP_TESTS_SH} +TEST_METADATA.$t+= required_user="root" +.endfor + +.include diff --git a/tools/regression/geom_stripe/conf.sh b/tests/sys/geom/class/stripe/conf.sh similarity index 100% rename from tools/regression/geom_stripe/conf.sh rename to tests/sys/geom/class/stripe/conf.sh diff --git a/tools/regression/geom_uzip/test-1.t b/tests/sys/geom/class/uzip/1_test.sh similarity index 91% rename from tools/regression/geom_uzip/test-1.t rename to tests/sys/geom/class/uzip/1_test.sh index b156c067456b..222b6c9afdec 100644 --- a/tools/regression/geom_uzip/test-1.t +++ b/tests/sys/geom/class/uzip/1_test.sh @@ -6,7 +6,7 @@ testsdir=$(dirname $0) echo "1..1" -UUE=$testsdir/test-1.img.uzip.uue +UUE=$testsdir/1.img.uzip.uue uudecode $UUE us0=$(attach_md -f $(basename $UUE .uue)) || exit 1 sleep 1 diff --git a/tests/sys/geom/class/uzip/Makefile b/tests/sys/geom/class/uzip/Makefile new file mode 100644 index 000000000000..b9624068739f --- /dev/null +++ b/tests/sys/geom/class/uzip/Makefile @@ -0,0 +1,42 @@ +# +# $FreeBSD$ +# +# Regression test for geom_uzip. +# + +TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T} + +IMAGE= 1.img +ZIMAGE= ${IMAGE}.uzip +UZIMAGE= ${ZIMAGE}.uue + +CLEANFILES+= ${IMAGE} ${UZIMAGE} ${ZIMAGE} + +${IMAGE}: + makefs -s 1048576 ${.TARGET} ${.CURDIR}/etalon + +${ZIMAGE}: ${IMAGE} + mkuzip -o ${.TARGET} ${.ALLSRC} + +${UZIMAGE}: ${IMAGE} ${ZIMAGE} + printf "#\n# $$" >${.TARGET} + printf "FreeBSD$$\n#\n\n" >> ${.TARGET} + uuencode ${ZIMAGE} ${ZIMAGE} >>${.TARGET} + +FILES+= conf.sh +FILESNAME_conf.sh= conf.sh + +FILES+= ${UZIMAGE} +FILESDIR= ${TESTSDIR} + +FILESGROUPS= FILES etalon +etalon+= etalon/etalon.txt +etalonDIR= ${TESTSDIR}/etalon + +TAP_TESTS_SH+= 1_test + +.for t in ${TAP_TESTS_SH} +TEST_METADATA.$t+= required_user="root" +.endfor + +.include diff --git a/tools/regression/geom_uzip/conf.sh b/tests/sys/geom/class/uzip/conf.sh similarity index 100% rename from tools/regression/geom_uzip/conf.sh rename to tests/sys/geom/class/uzip/conf.sh diff --git a/tools/regression/geom_uzip/etalon/etalon.txt b/tests/sys/geom/class/uzip/etalon/etalon.txt similarity index 100% rename from tools/regression/geom_uzip/etalon/etalon.txt rename to tests/sys/geom/class/uzip/etalon/etalon.txt diff --git a/tools/regression/geom_uzip/test-1.img.uzip.uue b/tests/sys/geom/class/uzip/test-1.img.uzip.uue similarity index 100% rename from tools/regression/geom_uzip/test-1.img.uzip.uue rename to tests/sys/geom/class/uzip/test-1.img.uzip.uue diff --git a/tools/regression/geom_uzip/Makefile b/tools/regression/geom_uzip/Makefile deleted file mode 100644 index 3186ef61d7bb..000000000000 --- a/tools/regression/geom_uzip/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -# -# $FreeBSD$ -# -# Regression test for geom_ugz. -# - -IMAGE= test-1.img -ZIMAGE= ${IMAGE}.uzip -UZIMAGE= ${ZIMAGE}.uue - -test: - prove -rv ./test-1.t - -image: - makefs -s 1048576 ${IMAGE} etalon - printf "#\n# $$" >${UZIMAGE} - printf "FreeBSD$$\n#\n\n" >> ${UZIMAGE} - mkuzip -o ${ZIMAGE} ${IMAGE} - uuencode ${ZIMAGE} ${ZIMAGE} >>${UZIMAGE} - rm ${ZIMAGE} - -clean: - rm -f ${IMAGE} ${ZIMAGE} From 7ea3f72efb1ba559d2ff9701c750186c6b792763 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Wed, 13 Jan 2016 12:01:28 +0000 Subject: [PATCH 70/82] Switch legacy pty clone handler to use make_dev_s(9). Add MAKEDEV_CHECKNAME flag to the call, this is required to not panic on race between the clone and destructing the closed master. Reported by and discussed with: bde Tested by: pho (as part of the larger patch) Sponsored by: The FreeBSD Foundation MFC after: 3 weeks --- sys/dev/pty/pty.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/sys/dev/pty/pty.c b/sys/dev/pty/pty.c index 5e2d822fe291..666ee8790f3b 100644 --- a/sys/dev/pty/pty.c +++ b/sys/dev/pty/pty.c @@ -97,6 +97,8 @@ static void pty_clone(void *arg, struct ucred *cr, char *name, int namelen, struct cdev **dev) { + struct make_dev_args mda; + int error; /* Cloning is already satisfied. */ if (*dev != NULL) @@ -117,8 +119,17 @@ pty_clone(void *arg, struct ucred *cr, char *name, int namelen, return; /* Create the controller device node. */ - *dev = make_dev_credf(MAKEDEV_REF, &ptydev_cdevsw, 0, - NULL, UID_ROOT, GID_WHEEL, 0666, "%s", name); + make_dev_args_init(&mda); + mda.mda_flags = MAKEDEV_CHECKNAME | MAKEDEV_REF; + mda.mda_devsw = &ptydev_cdevsw; + mda.mda_uid = UID_ROOT; + mda.mda_gid = GID_WHEEL; + mda.mda_mode = 0666; + error = make_dev_s(&mda, dev, "%s", name); + if (error != 0) { + printf("pty_clone: failed to create %s: %d\n", name, error); + *dev = NULL; + } } static int From c77f6350ee35c60d4397731b2992e6386e935597 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Wed, 13 Jan 2016 14:02:07 +0000 Subject: [PATCH 71/82] Move the funsetown(9) call from audit_pipe_close() to cdevpriv destructor. As result, close method becomes trivial and removed. Final cdevsw close method might be called without file context (e.g. in vn_open_vnode() if the vnode is reclaimed meantime), which leaves ap_sigio registered for notification, despite cdevpriv destructor frees the memory later. Call destructor instead of doing a cleanup inline, for devfs_set_cdevpriv() failure in open. This adds missed funsetown(9) call and locks ap to satisfy audit_pipe_free() invariants. Reported and tested by: pho (previous version) Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/security/audit/audit_pipe.c | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/sys/security/audit/audit_pipe.c b/sys/security/audit/audit_pipe.c index f9c63d22413b..b53cfaade29d 100644 --- a/sys/security/audit/audit_pipe.c +++ b/sys/security/audit/audit_pipe.c @@ -223,7 +223,6 @@ static struct cdev *audit_pipe_dev; * Special device methods and definition. */ static d_open_t audit_pipe_open; -static d_close_t audit_pipe_close; static d_read_t audit_pipe_read; static d_ioctl_t audit_pipe_ioctl; static d_poll_t audit_pipe_poll; @@ -232,7 +231,6 @@ static d_kqfilter_t audit_pipe_kqfilter; static struct cdevsw audit_pipe_cdevsw = { .d_version = D_VERSION, .d_open = audit_pipe_open, - .d_close = audit_pipe_close, .d_read = audit_pipe_read, .d_ioctl = audit_pipe_ioctl, .d_poll = audit_pipe_poll, @@ -658,6 +656,7 @@ audit_pipe_dtor(void *arg) struct audit_pipe *ap; ap = arg; + funsetown(&ap->ap_sigio); AUDIT_PIPE_LIST_WLOCK(); AUDIT_PIPE_LOCK(ap); audit_pipe_free(ap); @@ -676,33 +675,13 @@ audit_pipe_open(struct cdev *dev, int oflags, int devtype, struct thread *td) int error; ap = audit_pipe_alloc(); - if (ap == NULL) { + if (ap == NULL) return (ENOMEM); - } fsetown(td->td_proc->p_pid, &ap->ap_sigio); error = devfs_set_cdevpriv(ap, audit_pipe_dtor); - if (error != 0) { - AUDIT_PIPE_LIST_WLOCK(); - audit_pipe_free(ap); - AUDIT_PIPE_LIST_WUNLOCK(); - } - return (0); -} - -/* - * Close audit pipe, tear down all records, etc. - */ -static int -audit_pipe_close(struct cdev *dev, int fflag, int devtype, struct thread *td) -{ - struct audit_pipe *ap; - int error; - - error = devfs_get_cdevpriv((void **)&ap); if (error != 0) - return (error); - funsetown(&ap->ap_sigio); - return (0); + audit_pipe_dtor(ap); + return (error); } /* From a53b7c692dcb812b3745f113e0d99d29cac58ff6 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Wed, 13 Jan 2016 14:03:06 +0000 Subject: [PATCH 72/82] Make devfs_fpdrop() static. It was not a public KPI, and it has no reason to remain exported for some time. Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/fs/devfs/devfs_vnops.c | 2 +- sys/sys/conf.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c index 8a6b0c516f4a..a8f31113ace3 100644 --- a/sys/fs/devfs/devfs_vnops.c +++ b/sys/fs/devfs/devfs_vnops.c @@ -192,7 +192,7 @@ devfs_destroy_cdevpriv(struct cdev_privdata *p) free(p, M_CDEVPDATA); } -void +static void devfs_fpdrop(struct file *fp) { struct cdev_privdata *p; diff --git a/sys/sys/conf.h b/sys/sys/conf.h index a0dbc724fc5e..6d2cac90387c 100644 --- a/sys/sys/conf.h +++ b/sys/sys/conf.h @@ -299,7 +299,6 @@ typedef void d_priv_dtor_t(void *data); int devfs_get_cdevpriv(void **datap); int devfs_set_cdevpriv(void *priv, d_priv_dtor_t *dtr); void devfs_clear_cdevpriv(void); -void devfs_fpdrop(struct file *fp); /* XXX This is not public KPI */ ino_t devfs_alloc_cdp_inode(void); void devfs_free_cdp_inode(ino_t ino); From fa89f6924010f5334711682113e31ae5a14051bc Mon Sep 17 00:00:00 2001 From: Michael Tuexen Date: Wed, 13 Jan 2016 14:28:12 +0000 Subject: [PATCH 73/82] Store the timer type for logging, because the timer can be freed during processing the timerout. MFC after: 3 days --- sys/netinet/sctputil.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index f2e9457806b4..4cf134bf733c 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -1495,6 +1495,7 @@ sctp_timeout_handler(void *t) #endif int did_output; + int type; tmr = (struct sctp_timer *)t; inp = (struct sctp_inpcb *)tmr->ep; @@ -1563,8 +1564,9 @@ sctp_timeout_handler(void *t) return; } } + type = tmr->type; tmr->stopped_from = 0xa005; - SCTPDBG(SCTP_DEBUG_TIMER1, "Timer type %d goes off\n", tmr->type); + SCTPDBG(SCTP_DEBUG_TIMER1, "Timer type %d goes off\n", type); if (!SCTP_OS_TIMER_ACTIVE(&tmr->timer)) { if (inp) { SCTP_INP_DECR_REF(inp); @@ -1580,7 +1582,7 @@ sctp_timeout_handler(void *t) if (stcb) { SCTP_TCB_LOCK(stcb); atomic_add_int(&stcb->asoc.refcnt, -1); - if ((tmr->type != SCTP_TIMER_TYPE_ASOCKILL) && + if ((type != SCTP_TIMER_TYPE_ASOCKILL) && ((stcb->asoc.state == 0) || (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED))) { SCTP_TCB_UNLOCK(stcb); @@ -1592,7 +1594,7 @@ sctp_timeout_handler(void *t) } } /* record in stopped what t-o occured */ - tmr->stopped_from = tmr->type; + tmr->stopped_from = type; /* mark as being serviced now */ if (SCTP_OS_TIMER_PENDING(&tmr->timer)) { @@ -1610,7 +1612,7 @@ sctp_timeout_handler(void *t) SCTP_OS_TIMER_DEACTIVATE(&tmr->timer); /* call the handler for the appropriate timer type */ - switch (tmr->type) { + switch (type) { case SCTP_TIMER_TYPE_ZERO_COPY: if (inp == NULL) { break; @@ -1894,11 +1896,11 @@ sctp_timeout_handler(void *t) goto out_no_decr; default: SCTPDBG(SCTP_DEBUG_TIMER1, "sctp_timeout_handler:unknown timer %d\n", - tmr->type); + type); break; } #ifdef SCTP_AUDITING_ENABLED - sctp_audit_log(0xF1, (uint8_t) tmr->type); + sctp_audit_log(0xF1, (uint8_t) type); if (inp) sctp_auditing(5, inp, stcb, net); #endif @@ -1921,8 +1923,7 @@ sctp_timeout_handler(void *t) SCTP_INP_DECR_REF(inp); } out_no_decr: - SCTPDBG(SCTP_DEBUG_TIMER1, "Timer now complete (type %d)\n", - tmr->type); + SCTPDBG(SCTP_DEBUG_TIMER1, "Timer now complete (type = %d)\n", type); CURVNET_RESTORE(); } From 0eb64f4e4442acb2eb2813e01a79286770f8bdd4 Mon Sep 17 00:00:00 2001 From: "Alexander V. Chernikov" Date: Wed, 13 Jan 2016 14:32:48 +0000 Subject: [PATCH 74/82] Remove RTF_RNH_LOCKED support from rtalloc1_fib(). Last caller using it was eliminated in r293471. Sponsored by: Yandex LLC --- sys/net/route.c | 21 +++++---------------- sys/net/route.h | 2 +- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/sys/net/route.c b/sys/net/route.c index 9698dd398ac0..bcc56d9d6fb6 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -409,7 +409,6 @@ rtalloc1_fib(struct sockaddr *dst, int report, u_long ignflags, struct rtentry *newrt; struct rt_addrinfo info; int err = 0, msgtype = RTM_MISS; - int needlock; KASSERT((fibnum < rt_numfibs), ("rtalloc1_fib: bad fibnum")); rnh = rt_tables_get_rnh(fibnum, dst->sa_family); @@ -420,23 +419,16 @@ rtalloc1_fib(struct sockaddr *dst, int report, u_long ignflags, /* * Look up the address in the table for that Address Family */ - needlock = !(ignflags & RTF_RNH_LOCKED); - if (needlock) - RADIX_NODE_HEAD_RLOCK(rnh); -#ifdef INVARIANTS - else - RADIX_NODE_HEAD_LOCK_ASSERT(rnh); -#endif + RADIX_NODE_HEAD_RLOCK(rnh); rn = rnh->rnh_matchaddr(dst, rnh); if (rn && ((rn->rn_flags & RNF_ROOT) == 0)) { newrt = RNTORT(rn); RT_LOCK(newrt); RT_ADDREF(newrt); - if (needlock) - RADIX_NODE_HEAD_RUNLOCK(rnh); - goto done; + RADIX_NODE_HEAD_RUNLOCK(rnh); + return (newrt); - } else if (needlock) + } else RADIX_NODE_HEAD_RUNLOCK(rnh); /* @@ -456,10 +448,7 @@ rtalloc1_fib(struct sockaddr *dst, int report, u_long ignflags, bzero(&info, sizeof(info)); info.rti_info[RTAX_DST] = dst; rt_missmsg_fib(msgtype, &info, 0, err, fibnum); - } -done: - if (newrt) - RT_LOCK_ASSERT(newrt); + } return (newrt); } diff --git a/sys/net/route.h b/sys/net/route.h index f30a72fb31ed..9ce286523db0 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -175,7 +175,7 @@ struct rtentry { /* 0x8000000 and up unassigned */ #define RTF_STICKY 0x10000000 /* always route dst->src */ -#define RTF_RNH_LOCKED 0x40000000 /* radix node head is locked */ +#define RTF_RNH_LOCKED 0x40000000 /* unused */ #define RTF_GWFLAG_COMPAT 0x80000000 /* a compatibility bit for interacting with existing routing apps */ From 739e2464e975a98815724b635e61abb11a421fac Mon Sep 17 00:00:00 2001 From: Ian Lepore Date: Wed, 13 Jan 2016 14:39:39 +0000 Subject: [PATCH 75/82] Fix the spelling of fueword* to eliminate compile warnings about mismatched begin/end symbols when the warning level is turned up. Submitted by: Steve Kiernan --- sys/arm/arm/fusu.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/arm/arm/fusu.S b/sys/arm/arm/fusu.S index dee2455a0d34..54d263c7984a 100644 --- a/sys/arm/arm/fusu.S +++ b/sys/arm/arm/fusu.S @@ -139,8 +139,8 @@ EENTRY_NP(fueword32) mov r0, #0x00000000 str r0, [r2, #PCB_ONFAULT] RET -EEND(fuword32) -END(fuword) +EEND(fueword32) +END(fueword) /* * fusword(caddr_t uaddr); From 88b85228a461f0bc559d9c8bfa72e05250b0de18 Mon Sep 17 00:00:00 2001 From: Steven Hartland Date: Wed, 13 Jan 2016 14:47:13 +0000 Subject: [PATCH 76/82] Increase efiboot.img size used in ISO creation Due to recent and upcoming changes to add additional functionality to the EFI loader its now bigger than the space allocates for efiboot.img so increase this in line with boot1.efifat. MFC after: 2 weeks X-MFC-With: r293268 Sponsored by: Multiplay --- release/amd64/mkisoimages.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/amd64/mkisoimages.sh b/release/amd64/mkisoimages.sh index f72dd9e64d82..153f31f6c7b8 100644 --- a/release/amd64/mkisoimages.sh +++ b/release/amd64/mkisoimages.sh @@ -28,7 +28,7 @@ if [ "x$1" = "x-b" ]; then bootable="-o bootimage=i386;$4/boot/cdboot -o no-emul-boot" # Make EFI system partition (should be done with makefs in the future) - dd if=/dev/zero of=efiboot.img bs=4k count=100 + dd if=/dev/zero of=efiboot.img bs=4k count=200 device=`mdconfig -a -t vnode -f efiboot.img` newfs_msdos -F 12 -m 0xf8 /dev/$device mkdir efi From fafb1ee7bdc5d8a7d07cd03b2fb0bbb76f7a9d7c Mon Sep 17 00:00:00 2001 From: Andrew Turner Date: Wed, 13 Jan 2016 15:54:17 +0000 Subject: [PATCH 77/82] Remove the compat code to handle the kernel passing us an unalinged stackpointer. Userland expects the kernel to pass it an aligned sp and pass a pointer to the arguments in x0. The kernel side was updated in r289502, 3 months ago. Sponsored by: ABT Systems Ltd --- lib/csu/aarch64/crt1.c | 6 +----- libexec/rtld-elf/aarch64/rtld_start.S | 8 +------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/lib/csu/aarch64/crt1.c b/lib/csu/aarch64/crt1.c index ed24f4689ed3..40279b79853d 100644 --- a/lib/csu/aarch64/crt1.c +++ b/lib/csu/aarch64/crt1.c @@ -54,11 +54,7 @@ __asm(" .text \n" " .align 0 \n" " .globl _start \n" " _start: \n" -/* TODO: Remove this when the kernel correctly aligns the stack */ -" cbnz x0, 1f \n" /* Are we using a new kernel? */ -" mov x0, sp \n" /* No, load the args from sp */ -" and sp, x0, #~0xf \n" /* And align the stack */ -"1: mov x3, x2 \n" /* cleanup */ +" mov x3, x2 \n" /* cleanup */ " add x1, x0, #8 \n" /* load argv */ " ldr x0, [x0] \n" /* load argc */ " add x2, x1, x0, lsl #3 \n" /* env is after argv */ diff --git a/libexec/rtld-elf/aarch64/rtld_start.S b/libexec/rtld-elf/aarch64/rtld_start.S index 2270efcb87d9..41397f944911 100644 --- a/libexec/rtld-elf/aarch64/rtld_start.S +++ b/libexec/rtld-elf/aarch64/rtld_start.S @@ -34,13 +34,7 @@ ENTRY(.rtld_start) mov x19, x0 /* Put ps_strings in a callee-saved register */ mov x20, sp /* And the stack pointer */ - /* Handle the old style stack */ - /* TODO: Remove this when the kernel correctly aligns the stack */ - cbnz x0, 1f - mov x0, sp /* sp points to the args */ - and sp, x0, #~0xf /* Align the stack as needed */ - -1: sub sp, sp, #16 /* Make room for obj_main & exit proc */ + sub sp, sp, #16 /* Make room for obj_main & exit proc */ mov x1, sp /* exit_proc */ add x2, x1, #8 /* obj_main */ From 0191f57ff13f55e93126d5c899ca2f0e49b0e383 Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Wed, 13 Jan 2016 17:33:50 +0000 Subject: [PATCH 78/82] Fix Coverity warnings regarding r293229 rpcbind/check_bound.c Fix CID1347798, a memory leak in mergeaddr. rpcbind/tests/addrmerge_test.c Fix CID1347800 through CID1347803, memory leaks in ATF tests. They are harmless because each ATF test case runs in its own process, but they are trivial to fix. Fix a few other leaks that Coverity didn't detect, too. Coverity CID: 1347798, 1347800, 1347801, 1347802, 1347803 MFC after: 2 weeks X-MFC-With: 293229 Sponsored by: Spectra Logic Corp --- usr.sbin/rpcbind/check_bound.c | 11 ++++++----- usr.sbin/rpcbind/tests/addrmerge_test.c | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/usr.sbin/rpcbind/check_bound.c b/usr.sbin/rpcbind/check_bound.c index 64b73c741d81..23c38bc13290 100644 --- a/usr.sbin/rpcbind/check_bound.c +++ b/usr.sbin/rpcbind/check_bound.c @@ -184,18 +184,19 @@ mergeaddr(SVCXPRT *xprt, char *netid, char *uaddr, char *saddr) dg_data = (struct svc_dg_data*)xprt->xp_p2; if (dg_data != NULL && dg_data->su_srcaddr.buf != NULL) { c_uaddr = taddr2uaddr(fdl->nconf, &dg_data->su_srcaddr); + allocated_uaddr = c_uaddr; } else if (saddr != NULL) { c_uaddr = saddr; } else { c_uaddr = taddr2uaddr(fdl->nconf, svc_getrpccaller(xprt)); - if (c_uaddr == NULL) { - syslog(LOG_ERR, "taddr2uaddr failed for %s", - fdl->nconf->nc_netid); - return (NULL); - } allocated_uaddr = c_uaddr; } + if (c_uaddr == NULL) { + syslog(LOG_ERR, "taddr2uaddr failed for %s", + fdl->nconf->nc_netid); + return (NULL); + } #ifdef ND_DEBUG if (debugging) { diff --git a/usr.sbin/rpcbind/tests/addrmerge_test.c b/usr.sbin/rpcbind/tests/addrmerge_test.c index 357354af1c70..d2bc9e299dbe 100644 --- a/usr.sbin/rpcbind/tests/addrmerge_test.c +++ b/usr.sbin/rpcbind/tests/addrmerge_test.c @@ -435,6 +435,7 @@ ATF_TC_BODY(addrmerge_localhost_only, tc) /* We must return localhost if there is nothing better */ ATF_REQUIRE(maddr != NULL); ATF_CHECK_STREQ("127.0.0.1.3.46", maddr); + free(maddr); } ATF_TC_WITHOUT_HEAD(addrmerge_singlehomed); @@ -450,6 +451,7 @@ ATF_TC_BODY(addrmerge_singlehomed, tc) ATF_REQUIRE(maddr != NULL); ATF_CHECK_STREQ("192.0.2.2.3.46", maddr); + free(maddr); } ATF_TC_WITHOUT_HEAD(addrmerge_one_addr_on_each_subnet); @@ -466,6 +468,7 @@ ATF_TC_BODY(addrmerge_one_addr_on_each_subnet, tc) /* We must return the address on the caller's subnet */ ATF_REQUIRE(maddr != NULL); ATF_CHECK_STREQ("192.0.2.2.3.46", maddr); + free(maddr); } @@ -488,6 +491,7 @@ ATF_TC_BODY(addrmerge_one_addr_on_each_subnet_rev, tc) /* We must return the address on the caller's subnet */ ATF_REQUIRE(maddr != NULL); ATF_CHECK_STREQ("192.0.2.2.3.46", maddr); + free(maddr); } ATF_TC_WITHOUT_HEAD(addrmerge_point2point); @@ -505,6 +509,7 @@ ATF_TC_BODY(addrmerge_point2point, tc) /* addrmerge should disprefer P2P interfaces */ ATF_REQUIRE(maddr != NULL); ATF_CHECK_STREQ("192.0.2.130.3.46", maddr); + free(maddr); } /* Like addrerge_point2point, but getifaddrs returns a different order */ @@ -523,6 +528,7 @@ ATF_TC_BODY(addrmerge_point2point_rev, tc) /* addrmerge should disprefer P2P interfaces */ ATF_REQUIRE(maddr != NULL); ATF_CHECK_STREQ("192.0.2.130.3.46", maddr); + free(maddr); } /* @@ -544,6 +550,7 @@ ATF_TC_BODY(addrmerge_bindip, tc) /* We must return the address to which we are bound */ ATF_REQUIRE(maddr != NULL); ATF_CHECK_STREQ("192.0.2.3.3.46", maddr); + free(maddr); } /* Like addrmerge_bindip, but getifaddrs returns a different order */ @@ -562,6 +569,7 @@ ATF_TC_BODY(addrmerge_bindip_rev, tc) /* We must return the address to which we are bound */ ATF_REQUIRE(maddr != NULL); ATF_CHECK_STREQ("192.0.2.3.3.46", maddr); + free(maddr); } /* @@ -582,6 +590,7 @@ ATF_TC_BODY(addrmerge_recvdstaddr, tc) /* We must return the address on which the request was received */ ATF_REQUIRE(maddr != NULL); ATF_CHECK_STREQ("192.0.2.2.3.46", maddr); + free(maddr); } ATF_TC_WITHOUT_HEAD(addrmerge_recvdstaddr_rev); @@ -598,6 +607,7 @@ ATF_TC_BODY(addrmerge_recvdstaddr_rev, tc) /* We must return the address on which the request was received */ ATF_REQUIRE(maddr != NULL); ATF_CHECK_STREQ("192.0.2.2.3.46", maddr); + free(maddr); } #ifdef INET6 @@ -614,6 +624,7 @@ ATF_TC_BODY(addrmerge_localhost_only6, tc) /* We must return localhost if there is nothing better */ ATF_REQUIRE(maddr != NULL); ATF_CHECK_STREQ("::1.3.46", maddr); + free(maddr); } ATF_TC_WITHOUT_HEAD(addrmerge_singlehomed6); @@ -629,6 +640,7 @@ ATF_TC_BODY(addrmerge_singlehomed6, tc) ATF_REQUIRE(maddr != NULL); ATF_CHECK_STREQ("2001:db8::2.3.46", maddr); + free(maddr); } ATF_TC_WITHOUT_HEAD(addrmerge_one_addr_on_each_subnet6); @@ -645,6 +657,7 @@ ATF_TC_BODY(addrmerge_one_addr_on_each_subnet6, tc) /* We must return the address on the caller's subnet */ ATF_REQUIRE(maddr != NULL); ATF_CHECK_STREQ("2001:db8::2.3.46", maddr); + free(maddr); } @@ -667,6 +680,7 @@ ATF_TC_BODY(addrmerge_one_addr_on_each_subnet6_rev, tc) /* We must return the address on the caller's subnet */ ATF_REQUIRE(maddr != NULL); ATF_CHECK_STREQ("2001:db8::2.3.46", maddr); + free(maddr); } ATF_TC_WITHOUT_HEAD(addrmerge_point2point6); @@ -684,6 +698,7 @@ ATF_TC_BODY(addrmerge_point2point6, tc) /* addrmerge should disprefer P2P interfaces */ ATF_REQUIRE(maddr != NULL); ATF_CHECK_STREQ("2001:db8:1::2.3.46", maddr); + free(maddr); } /* Like addrerge_point2point, but getifaddrs returns a different order */ @@ -702,6 +717,7 @@ ATF_TC_BODY(addrmerge_point2point6_rev, tc) /* addrmerge should disprefer P2P interfaces */ ATF_REQUIRE(maddr != NULL); ATF_CHECK_STREQ("2001:db8:1::2.3.46", maddr); + free(maddr); } ATF_TC_WITHOUT_HEAD(addrmerge_bindip6); @@ -719,6 +735,7 @@ ATF_TC_BODY(addrmerge_bindip6, tc) /* We must return the address to which we are bound */ ATF_REQUIRE(maddr != NULL); ATF_CHECK_STREQ("2001:db8::3.3.46", maddr); + free(maddr); } /* Like addrerge_bindip, but getifaddrs returns a different order */ @@ -737,6 +754,7 @@ ATF_TC_BODY(addrmerge_bindip6_rev, tc) /* We must return the address to which we are bound */ ATF_REQUIRE(maddr != NULL); ATF_CHECK_STREQ("2001:db8::3.3.46", maddr); + free(maddr); } /* @@ -761,6 +779,7 @@ ATF_TC_BODY(addrmerge_ipv6_linklocal, tc) /* We must return the address to which we are bound */ ATF_REQUIRE(maddr != NULL); ATF_CHECK_STREQ("fe80::2.3.46", maddr); + free(maddr); } ATF_TC_WITHOUT_HEAD(addrmerge_ipv6_linklocal_rev); @@ -781,6 +800,7 @@ ATF_TC_BODY(addrmerge_ipv6_linklocal_rev, tc) /* We must return the address to which we are bound */ ATF_REQUIRE(maddr != NULL); ATF_CHECK_STREQ("fe80::2.3.46", maddr); + free(maddr); } ATF_TC_WITHOUT_HEAD(addrmerge_recvdstaddr6); @@ -797,6 +817,7 @@ ATF_TC_BODY(addrmerge_recvdstaddr6, tc) /* We must return the address on which the request was received */ ATF_REQUIRE(maddr != NULL); ATF_CHECK_STREQ("2001:db8::2.3.46", maddr); + free(maddr); } ATF_TC_WITHOUT_HEAD(addrmerge_recvdstaddr6_rev); @@ -813,6 +834,7 @@ ATF_TC_BODY(addrmerge_recvdstaddr6_rev, tc) /* We must return the address on which the request was received */ ATF_REQUIRE(maddr != NULL); ATF_CHECK_STREQ("2001:db8::2.3.46", maddr); + free(maddr); } #endif /* INET6 */ From 1da56163f2f8b788886942fa6b652e11e02abb5c Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Wed, 13 Jan 2016 17:59:12 +0000 Subject: [PATCH 79/82] Remove some unneeded headers --- usr.sbin/pkg/config.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/usr.sbin/pkg/config.c b/usr.sbin/pkg/config.c index b0271f580eee..2fea11f50fe4 100644 --- a/usr.sbin/pkg/config.c +++ b/usr.sbin/pkg/config.c @@ -31,21 +31,14 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include -#include #include #include -#include #include #include -#include -#include -#include #include -#include #include #include "config.h" From 4b09a8fdbc9ed6158674cf8a44425c65c02433b4 Mon Sep 17 00:00:00 2001 From: Steven Hartland Date: Wed, 13 Jan 2016 18:33:12 +0000 Subject: [PATCH 80/82] Improve non-interactive forth cmd error reporting Non-interactive forth command errors where silent even for critical issues e.g. failing to load a required kernel module or mfs_root. This resulted in later unexplained and hard to trace errors such as mount root failures. This introduces additional command return codes that are treated appropriately by the non-interactive command processor (bf_command). * CMD_CRIT = print error * CMD_FATAL = panic Also fix minor style(9) issues with command_load return codes. MFC after: 2 weeks X-MFC-With: r293268 Sponsored by: Multiplay --- sys/boot/common/bootstrap.h | 5 ++++- sys/boot/common/interp_forth.c | 12 +++++++++++- sys/boot/common/module.c | 31 ++++++++++++++++++++++--------- 3 files changed, 37 insertions(+), 11 deletions(-) diff --git a/sys/boot/common/bootstrap.h b/sys/boot/common/bootstrap.h index 5904c820ecb6..78d742d62718 100644 --- a/sys/boot/common/bootstrap.h +++ b/sys/boot/common/bootstrap.h @@ -56,7 +56,10 @@ typedef int (bootblk_cmd_t)(int argc, char *argv[]); extern char *command_errmsg; extern char command_errbuf[]; /* XXX blah, length */ #define CMD_OK 0 -#define CMD_ERROR 1 +#define CMD_WARN 1 +#define CMD_ERROR 2 +#define CMD_CRIT 3 +#define CMD_FATAL 4 /* interp.c */ void interact(const char *rc); diff --git a/sys/boot/common/interp_forth.c b/sys/boot/common/interp_forth.c index 37b377b0ee53..7137d3770922 100644 --- a/sys/boot/common/interp_forth.c +++ b/sys/boot/common/interp_forth.c @@ -138,13 +138,23 @@ bf_command(FICL_VM *vm) } else { result=BF_PARSE; } + + switch (result) { + case CMD_CRIT: + printf("%s\n", command_errmsg); + break; + case CMD_FATAL: + panic("%s\n", command_errmsg); + } + free(line); /* * If there was error during nested ficlExec(), we may no longer have * valid environment to return. Throw all exceptions from here. */ - if (result != 0) + if (result != CMD_OK) vmThrow(vm, result); + /* This is going to be thrown!!! */ stackPushINT(vm->pStack,result); } diff --git a/sys/boot/common/module.c b/sys/boot/common/module.c index b01b497b39b2..d73f1c8d0fb9 100644 --- a/sys/boot/common/module.c +++ b/sys/boot/common/module.c @@ -112,7 +112,7 @@ command_load(int argc, char *argv[]) typestr = NULL; if (argc == 1) { command_errmsg = "no filename specified"; - return(CMD_ERROR); + return (CMD_CRIT); } while ((ch = getopt(argc, argv, "kt:")) != -1) { switch(ch) { @@ -126,7 +126,7 @@ command_load(int argc, char *argv[]) case '?': default: /* getopt has already reported an error */ - return(CMD_OK); + return (CMD_OK); } } argv += (optind - 1); @@ -138,33 +138,46 @@ command_load(int argc, char *argv[]) if (dofile) { if ((argc != 2) || (typestr == NULL) || (*typestr == 0)) { command_errmsg = "invalid load type"; - return(CMD_ERROR); + return (CMD_CRIT); } fp = file_findfile(argv[1], typestr); if (fp) { sprintf(command_errbuf, "warning: file '%s' already loaded", argv[1]); - return (CMD_ERROR); + return (CMD_WARN); } - return (file_loadraw(argv[1], typestr, 1) ? CMD_OK : CMD_ERROR); + if (file_loadraw(argv[1], typestr, 1) != NULL) + return (CMD_OK); + + /* Failing to load mfs_root is never going to end well! */ + if (strcmp("mfs_root", typestr) == 0) + return (CMD_FATAL); + + return (CMD_ERROR); } /* * Do we have explicit KLD load ? */ if (dokld || file_havepath(argv[1])) { error = mod_loadkld(argv[1], argc - 2, argv + 2); - if (error == EEXIST) + if (error == EEXIST) { sprintf(command_errbuf, "warning: KLD '%s' already loaded", argv[1]); - return (error == 0 ? CMD_OK : CMD_ERROR); + return (CMD_WARN); + } + + return (error == 0 ? CMD_OK : CMD_CRIT); } /* * Looks like a request for a module. */ error = mod_load(argv[1], NULL, argc - 2, argv + 2); - if (error == EEXIST) + if (error == EEXIST) { sprintf(command_errbuf, "warning: module '%s' already loaded", argv[1]); - return (error == 0 ? CMD_OK : CMD_ERROR); + return (CMD_WARN); + } + + return (error == 0 ? CMD_OK : CMD_CRIT); } COMMAND_SET(load_geli, "load_geli", "load a geli key", command_load_geli); From 4ec1c9bfacb13ccd42e36c47eff2211d28a36ab2 Mon Sep 17 00:00:00 2001 From: Jung-uk Kim Date: Wed, 13 Jan 2016 19:19:50 +0000 Subject: [PATCH 81/82] Remove dead code when the target processor has POPCNT instruction. --- sys/amd64/amd64/pmap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 8b04eab99006..d2d0248c6984 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -3018,11 +3018,14 @@ reserve_pv_entries(pmap_t pmap, int needed, struct rwlock **lockp) retry: avail = 0; TAILQ_FOREACH(pc, &pmap->pm_pvchunk, pc_list) { +#ifndef __POPCNT__ if ((cpu_feature2 & CPUID2_POPCNT) == 0) { free = bitcount64(pc->pc_map[0]); free += bitcount64(pc->pc_map[1]); free += bitcount64(pc->pc_map[2]); - } else { + } else +#endif + { free = popcnt_pc_map_elem_pq(pc->pc_map[0]); free += popcnt_pc_map_elem_pq(pc->pc_map[1]); free += popcnt_pc_map_elem_pq(pc->pc_map[2]); From bd2ebb612d4a86c2208df75ce327bf53304a927a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-S=C3=A9bastien=20P=C3=A9dron?= Date: Wed, 13 Jan 2016 19:52:25 +0000 Subject: [PATCH 82/82] drm/i915: Further reduce the diff with Linux 3.8 There is no functional change. The goal is to ease the future update to Linux 3.8's i915 driver. --- sys/dev/drm2/i915/i915_gem.c | 17 +++++---- sys/dev/drm2/i915/i915_gem_execbuffer.c | 8 ++--- sys/dev/drm2/i915/i915_gem_gtt.c | 46 +++++++++++++------------ sys/dev/drm2/i915/i915_gem_tiling.c | 6 ++-- sys/dev/drm2/i915/i915_irq.c | 39 ++++++++++++--------- sys/dev/drm2/i915/intel_crt.c | 3 +- sys/dev/drm2/i915/intel_display.c | 19 +++++----- sys/dev/drm2/i915/intel_overlay.c | 13 +++---- 8 files changed, 82 insertions(+), 69 deletions(-) diff --git a/sys/dev/drm2/i915/i915_gem.c b/sys/dev/drm2/i915/i915_gem.c index 95edcf9acd24..2d97f74f00a1 100644 --- a/sys/dev/drm2/i915/i915_gem.c +++ b/sys/dev/drm2/i915/i915_gem.c @@ -156,7 +156,7 @@ i915_gem_wait_for_error(struct drm_device *dev) int ret; if (!atomic_load_acq_int(&dev_priv->mm.wedged)) - return (0); + return 0; mtx_lock(&dev_priv->error_completion_lock); while (dev_priv->error_completion == 0) { @@ -166,7 +166,7 @@ i915_gem_wait_for_error(struct drm_device *dev) ret = -ERESTARTSYS; if (ret != 0) { mtx_unlock(&dev_priv->error_completion_lock); - return (ret); + return ret; } } mtx_unlock(&dev_priv->error_completion_lock); @@ -1861,26 +1861,30 @@ i915_gem_object_put_pages_range(struct drm_i915_gem_object *obj, static void i915_gem_object_put_pages_gtt(struct drm_i915_gem_object *obj) { - vm_page_t page; - int page_count, i; + int page_count = obj->base.size / PAGE_SIZE; + int i; KASSERT(obj->madv != I915_MADV_PURGED_INTERNAL, ("Purged object")); if (obj->tiling_mode != I915_TILING_NONE) i915_gem_object_save_bit_17_swizzle(obj); + if (obj->madv == I915_MADV_DONTNEED) obj->dirty = 0; - page_count = obj->base.size / PAGE_SIZE; + VM_OBJECT_WLOCK(obj->base.vm_obj); #if GEM_PARANOID_CHECK_GTT i915_gem_assert_pages_not_mapped(obj->base.dev, obj->pages, page_count); #endif for (i = 0; i < page_count; i++) { - page = obj->pages[i]; + vm_page_t page = obj->pages[i]; + if (obj->dirty) vm_page_dirty(page); + if (obj->madv == I915_MADV_WILLNEED) vm_page_reference(page); + vm_page_lock(page); vm_page_unwire(obj->pages[i], PQ_ACTIVE); vm_page_unlock(page); @@ -1888,6 +1892,7 @@ i915_gem_object_put_pages_gtt(struct drm_i915_gem_object *obj) } VM_OBJECT_WUNLOCK(obj->base.vm_obj); obj->dirty = 0; + free(obj->pages, DRM_I915_GEM); obj->pages = NULL; } diff --git a/sys/dev/drm2/i915/i915_gem_execbuffer.c b/sys/dev/drm2/i915/i915_gem_execbuffer.c index 61d0fa15eaa7..6ed1bb9428e1 100644 --- a/sys/dev/drm2/i915/i915_gem_execbuffer.c +++ b/sys/dev/drm2/i915/i915_gem_execbuffer.c @@ -411,8 +411,8 @@ i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj, reloc->offset += obj->gtt_offset; reloc_page = pmap_mapdev_attr(dev->agp->base + (reloc->offset & ~PAGE_MASK), PAGE_SIZE, PAT_WRITE_COMBINING); - reloc_entry = (uint32_t *)(reloc_page + (reloc->offset & - PAGE_MASK)); + reloc_entry = (uint32_t *) + (reloc_page + (reloc->offset & PAGE_MASK)); *(volatile uint32_t *)reloc_entry = reloc->delta; pmap_unmapdev((vm_offset_t)reloc_page, PAGE_SIZE); } @@ -502,7 +502,7 @@ i915_gem_execbuffer_relocate(struct drm_device *dev, struct list_head *objects) { struct drm_i915_gem_object *obj; - int ret, pflags; + int ret = 0, pflags; /* Try to move as many of the relocation targets off the active list * to avoid unnecessary fallbacks to the slow path, as we cannot wait @@ -510,7 +510,6 @@ i915_gem_execbuffer_relocate(struct drm_device *dev, */ i915_gem_retire_requests(dev); - ret = 0; /* This is the fast path and we cannot handle a pagefault whilst * holding the device lock lest the user pass in the relocations * contained within a mmaped bo. For in such a case we, the page @@ -952,6 +951,7 @@ validate_exec_list(struct drm_i915_gem_exec_object2 *exec, int count, *map = malloc(count * sizeof(*ma), DRM_I915_GEM, M_WAITOK | M_ZERO); *maplen = malloc(count * sizeof(*maplen), DRM_I915_GEM, M_WAITOK | M_ZERO); + for (i = 0; i < count; i++) { /* First check for malicious input causing overflow */ if (exec[i].relocation_count > diff --git a/sys/dev/drm2/i915/i915_gem_gtt.c b/sys/dev/drm2/i915/i915_gem_gtt.c index cc7e9cf2e137..794297943cb6 100644 --- a/sys/dev/drm2/i915/i915_gem_gtt.c +++ b/sys/dev/drm2/i915/i915_gem_gtt.c @@ -107,21 +107,22 @@ int i915_gem_init_aliasing_ppgtt(struct drm_device *dev) I915_PPGTT_PT_ENTRIES); ppgtt->pd_offset = (first_pd_entry_in_global_pt) * sizeof(uint32_t); dev_priv->mm.aliasing_ppgtt = ppgtt; - return (0); + + return 0; } -static void -i915_ppgtt_insert_pages(struct i915_hw_ppgtt *ppgtt, unsigned first_entry, - unsigned num_entries, vm_page_t *pages, uint32_t pte_flags) +static void i915_ppgtt_insert_pages(struct i915_hw_ppgtt *ppgtt, + unsigned first_entry, + unsigned num_entries, + vm_page_t *pages, + uint32_t pte_flags) { uint32_t *pt_vaddr, pte; - struct sf_buf *sf; - unsigned act_pd, first_pte; - unsigned last_pte, i; + unsigned act_pd = first_entry / I915_PPGTT_PT_ENTRIES; + unsigned first_pte = first_entry % I915_PPGTT_PT_ENTRIES; + unsigned j, last_pte; vm_paddr_t page_addr; - - act_pd = first_entry / I915_PPGTT_PT_ENTRIES; - first_pte = first_entry % I915_PPGTT_PT_ENTRIES; + struct sf_buf *sf; while (num_entries) { last_pte = first_pte + num_entries; @@ -132,10 +133,10 @@ i915_ppgtt_insert_pages(struct i915_hw_ppgtt *ppgtt, unsigned first_entry, sf = sf_buf_alloc(ppgtt->pt_pages[act_pd], SFB_CPUPRIVATE); pt_vaddr = (uint32_t *)(uintptr_t)sf_buf_kva(sf); - for (i = first_pte; i < last_pte; i++) { + for (j = first_pte; j < last_pte; j++) { page_addr = VM_PAGE_TO_PHYS(*pages); pte = GEN6_PTE_ADDR_ENCODE(page_addr); - pt_vaddr[i] = pte | pte_flags; + pt_vaddr[j] = pte | pte_flags; pages++; } @@ -194,18 +195,21 @@ void i915_gem_init_ppgtt(struct drm_device *dev) struct intel_ring_buffer *ring; struct i915_hw_ppgtt *ppgtt = dev_priv->mm.aliasing_ppgtt; u_int first_pd_entry_in_global_pt; - vm_paddr_t pt_addr; uint32_t pd_entry; int i; if (!dev_priv->mm.aliasing_ppgtt) return; + first_pd_entry_in_global_pt = 512 * 1024 - I915_PPGTT_PD_ENTRIES; for (i = 0; i < ppgtt->num_pd_entries; i++) { + vm_paddr_t pt_addr; + pt_addr = VM_PAGE_TO_PHYS(ppgtt->pt_pages[i]); pd_entry = GEN6_PDE_ADDR_ENCODE(pt_addr); pd_entry |= GEN6_PDE_VALID; + intel_gtt_write(first_pd_entry_in_global_pt + i, pd_entry); } intel_gtt_read_pte(first_pd_entry_in_global_pt); @@ -217,7 +221,7 @@ void i915_gem_init_ppgtt(struct drm_device *dev) if (INTEL_INFO(dev)->gen == 6) { uint32_t ecochk, gab_ctl, ecobits; - ecobits = I915_READ(GAC_ECO_BITS); + ecobits = I915_READ(GAC_ECO_BITS); I915_WRITE(GAC_ECO_BITS, ecobits | ECOBITS_PPGTT_CACHE64B); gab_ctl = I915_READ(GAB_CTL); @@ -336,9 +340,8 @@ int i915_gem_gtt_prepare_object(struct drm_i915_gem_object *obj) return 0; } -void -i915_gem_gtt_bind_object(struct drm_i915_gem_object *obj, - enum i915_cache_level cache_level) +void i915_gem_gtt_bind_object(struct drm_i915_gem_object *obj, + enum i915_cache_level cache_level) { struct drm_device *dev; struct drm_i915_private *dev_priv; @@ -375,15 +378,14 @@ void i915_gem_gtt_finish_object(struct drm_i915_gem_object *obj) } int i915_gem_init_global_gtt(struct drm_device *dev, - unsigned long start, - unsigned long mappable_end, - unsigned long end) + unsigned long start, + unsigned long mappable_end, + unsigned long end) { - drm_i915_private_t *dev_priv; + drm_i915_private_t *dev_priv = dev->dev_private; unsigned long mappable; int error; - dev_priv = dev->dev_private; mappable = min(end, mappable_end) - start; /* Substract the guard page ... */ diff --git a/sys/dev/drm2/i915/i915_gem_tiling.c b/sys/dev/drm2/i915/i915_gem_tiling.c index 689db4e7a294..8e849a3fb680 100644 --- a/sys/dev/drm2/i915/i915_gem_tiling.c +++ b/sys/dev/drm2/i915/i915_gem_tiling.c @@ -453,15 +453,15 @@ i915_gem_get_tiling(struct drm_device *dev, void *data, * by the GPU. */ static void -i915_gem_swizzle_page(vm_page_t m) +i915_gem_swizzle_page(vm_page_t page) { char temp[64]; - char *vaddr; struct sf_buf *sf; + char *vaddr; int i; /* XXXKIB sleep */ - sf = sf_buf_alloc(m, SFB_DEFAULT); + sf = sf_buf_alloc(page, SFB_DEFAULT); vaddr = (char *)sf_buf_kva(sf); for (i = 0; i < PAGE_SIZE; i += 128) { diff --git a/sys/dev/drm2/i915/i915_irq.c b/sys/dev/drm2/i915/i915_irq.c index d0b7e6205fa4..d452b69699b7 100644 --- a/sys/dev/drm2/i915/i915_irq.c +++ b/sys/dev/drm2/i915/i915_irq.c @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include + #include #include #include @@ -770,42 +771,47 @@ i915_error_object_create(struct drm_i915_private *dev_priv, struct drm_i915_gem_object *src) { struct drm_i915_error_object *dst; - struct sf_buf *sf; - void *d, *s; - int page, page_count; + int i, count; u32 reloc_offset; if (src == NULL || src->pages == NULL) return NULL; - page_count = src->base.size / PAGE_SIZE; + count = src->base.size / PAGE_SIZE; - dst = malloc(sizeof(*dst) + page_count * sizeof(u32 *), DRM_I915_GEM, - M_NOWAIT); + dst = malloc(sizeof(*dst) + count * sizeof(u32 *), DRM_I915_GEM, M_NOWAIT); if (dst == NULL) - return (NULL); + return NULL; reloc_offset = src->gtt_offset; - for (page = 0; page < page_count; page++) { + for (i = 0; i < count; i++) { + void *d; + d = malloc(PAGE_SIZE, DRM_I915_GEM, M_NOWAIT); if (d == NULL) goto unwind; if (reloc_offset < dev_priv->mm.gtt_mappable_end && src->has_global_gtt_mapping) { + void *s; + /* Simply ignore tiling or any overlapping fence. * It's part of the error state, and this hopefully * captures what the GPU read. */ s = pmap_mapdev_attr(src->base.dev->agp->base + - reloc_offset, PAGE_SIZE, PAT_WRITE_COMBINING); + reloc_offset, + PAGE_SIZE, PAT_WRITE_COMBINING); memcpy(d, s, PAGE_SIZE); pmap_unmapdev((vm_offset_t)s, PAGE_SIZE); } else { - drm_clflush_pages(&src->pages[page], 1); + struct sf_buf *sf; + void *s; + + drm_clflush_pages(&src->pages[i], 1); sched_pin(); - sf = sf_buf_alloc(src->pages[page], SFB_CPUPRIVATE | + sf = sf_buf_alloc(src->pages[i], SFB_CPUPRIVATE | SFB_NOWAIT); if (sf != NULL) { s = (void *)(uintptr_t)sf_buf_kva(sf); @@ -817,21 +823,21 @@ i915_error_object_create(struct drm_i915_private *dev_priv, } sched_unpin(); - drm_clflush_pages(&src->pages[page], 1); + drm_clflush_pages(&src->pages[i], 1); } - dst->pages[page] = d; + dst->pages[i] = d; reloc_offset += PAGE_SIZE; } - dst->page_count = page_count; + dst->page_count = count; dst->gtt_offset = src->gtt_offset; return dst; unwind: - while (page--) - free(dst->pages[page], DRM_I915_GEM); + while (i--) + free(dst->pages[i], DRM_I915_GEM); free(dst, DRM_I915_GEM); return NULL; } @@ -2571,6 +2577,7 @@ void intel_irq_init(struct drm_device *dev) dev->max_vblank_count = 0xffffffff; /* full 32 bit counter */ dev->driver->get_vblank_counter = gm45_get_vblank_counter; } + if (drm_core_check_feature(dev, DRIVER_MODESET)) dev->driver->get_vblank_timestamp = i915_get_vblank_timestamp; else diff --git a/sys/dev/drm2/i915/intel_crt.c b/sys/dev/drm2/i915/intel_crt.c index ef6bf4ce99cc..6bad47fbdcc7 100644 --- a/sys/dev/drm2/i915/intel_crt.c +++ b/sys/dev/drm2/i915/intel_crt.c @@ -598,8 +598,7 @@ void intel_crt_init(struct drm_device *dev) crt = malloc(sizeof(struct intel_crt), DRM_MEM_KMS, M_WAITOK | M_ZERO); - intel_connector = malloc(sizeof(struct intel_connector), DRM_MEM_KMS, - M_WAITOK | M_ZERO); + intel_connector = malloc(sizeof(struct intel_connector), DRM_MEM_KMS, M_WAITOK | M_ZERO); connector = &intel_connector->base; drm_connector_init(dev, &intel_connector->base, diff --git a/sys/dev/drm2/i915/intel_display.c b/sys/dev/drm2/i915/intel_display.c index b360380d67f3..5af8c050e5a1 100644 --- a/sys/dev/drm2/i915/intel_display.c +++ b/sys/dev/drm2/i915/intel_display.c @@ -1382,9 +1382,8 @@ intel_sbi_write(struct drm_i915_private *dev_priv, u16 reg, u32 value) static u32 intel_sbi_read(struct drm_i915_private *dev_priv, u16 reg) { - u32 value; + u32 value = 0; - value = 0; mtx_lock(&dev_priv->dpio_lock); if (wait_for((I915_READ(SBI_CTL_STAT) & SBI_READY) == 0, 100)) { DRM_ERROR("timeout waiting for SBI to become ready\n"); @@ -1469,7 +1468,7 @@ static void intel_disable_pch_pll(struct intel_crtc *intel_crtc) /* PCH only available on ILK+ */ KASSERT(dev_priv->info->gen >= 5, ("Wrong device gen")); if (pll == NULL) - return; + return; if (pll->refcount == 0) { DRM_DEBUG_KMS("pll->refcount == 0\n"); @@ -1495,7 +1494,7 @@ static void intel_disable_pch_pll(struct intel_crtc *intel_crtc) /* Make sure transcoder isn't still depending on us */ assert_transcoder_disabled(dev_priv, intel_crtc->pipe); - + reg = pll->pll_reg; val = I915_READ(reg); val &= ~DPLL_VCO_ENABLE; @@ -1507,7 +1506,7 @@ static void intel_disable_pch_pll(struct intel_crtc *intel_crtc) } static void intel_enable_transcoder(struct drm_i915_private *dev_priv, - enum pipe pipe) + enum pipe pipe) { int reg; u32 val, pipeconf_val; @@ -1517,7 +1516,8 @@ static void intel_enable_transcoder(struct drm_i915_private *dev_priv, KASSERT(dev_priv->info->gen >= 5, ("Wrong device gen")); /* Make sure PCH DPLL is enabled */ - assert_pch_pll_enabled(dev_priv, to_intel_crtc(crtc)); + assert_pch_pll_enabled(dev_priv, + to_intel_crtc(crtc)); /* FDI must be feeding us bits for PCH ports */ assert_fdi_tx_enabled(dev_priv, pipe); @@ -1527,9 +1527,11 @@ static void intel_enable_transcoder(struct drm_i915_private *dev_priv, DRM_ERROR("Attempting to enable transcoder on Haswell with pipe > 0\n"); return; } + reg = TRANSCONF(pipe); val = I915_READ(reg); pipeconf_val = I915_READ(PIPECONF(pipe)); + if (HAS_PCH_IBX(dev_priv->dev)) { /* * make the BPC in transcoder be consistent with @@ -1886,6 +1888,7 @@ static int i9xx_update_plane(struct drm_crtc *crtc, struct drm_framebuffer *fb, DRM_ERROR("Unknown color depth %d\n", fb->bits_per_pixel); return -EINVAL; } + if (INTEL_INFO(dev)->gen >= 4) { if (obj->tiling_mode != I915_TILING_NONE) dspcntr |= DISPPLANE_TILED; @@ -2525,7 +2528,7 @@ static void ivb_manual_fdi_link_train(struct drm_crtc *crtc) POSTING_READ(reg); DELAY(150); - for (i = 0; i < 4; i++ ) { + for (i = 0; i < 4; i++) { reg = FDI_TX_CTL(pipe); temp = I915_READ(reg); temp &= ~FDI_LINK_TRAIN_VOL_EMP_MASK; @@ -7132,7 +7135,7 @@ int intel_modeset_vga_set_state(struct drm_device *dev, bool state) else gmch_ctrl |= INTEL_GMCH_VGA_DISABLE; pci_write_config(bridge_dev, INTEL_GMCH_CTRL, gmch_ctrl, 2); - return (0); + return 0; } struct intel_display_error_state { diff --git a/sys/dev/drm2/i915/intel_overlay.c b/sys/dev/drm2/i915/intel_overlay.c index 94b8d5d481a2..349a74f59cb4 100644 --- a/sys/dev/drm2/i915/intel_overlay.c +++ b/sys/dev/drm2/i915/intel_overlay.c @@ -1138,8 +1138,7 @@ int intel_overlay_put_image(struct drm_device *dev, void *data, return ret; } - params = malloc(sizeof(struct put_image_params), DRM_I915_GEM, - M_WAITOK | M_ZERO); + params = malloc(sizeof(struct put_image_params), DRM_I915_GEM, M_WAITOK | M_ZERO); drmmode_obj = drm_mode_object_find(dev, put_image_rec->crtc_id, DRM_MODE_OBJECT_CRTC); @@ -1403,8 +1402,7 @@ void intel_setup_overlay(struct drm_device *dev) if (!HAS_OVERLAY(dev)) return; - overlay = malloc(sizeof(struct intel_overlay), DRM_I915_GEM, - M_WAITOK | M_ZERO); + overlay = malloc(sizeof(struct intel_overlay), DRM_I915_GEM, M_WAITOK | M_ZERO); DRM_LOCK(dev); if (dev_priv->overlay != NULL) goto out_free; @@ -1523,16 +1521,15 @@ intel_overlay_capture_error_state(struct drm_device *dev) memcpy(&error->regs, regs, sizeof(struct overlay_registers)); intel_overlay_unmap_regs(overlay, regs); - return (error); + return error; err: free(error, DRM_I915_GEM); - return (NULL); + return NULL; } void -intel_overlay_print_error_state(struct sbuf *m, - struct intel_overlay_error_state *error) +intel_overlay_print_error_state(struct sbuf *m, struct intel_overlay_error_state *error) { sbuf_printf(m, "Overlay, status: 0x%08x, interrupt: 0x%08x\n", error->dovsta, error->isr);