From owner-freebsd-current@FreeBSD.ORG Thu Jan 31 22:52:47 2013 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id B31D5CFA for ; Thu, 31 Jan 2013 22:52:47 +0000 (UTC) (envelope-from neelnatu@gmail.com) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx1.freebsd.org (Postfix) with ESMTP id 5A9DB929 for ; Thu, 31 Jan 2013 22:52:47 +0000 (UTC) Received: by mail-vc0-f177.google.com with SMTP id m18so2080956vcm.8 for ; Thu, 31 Jan 2013 14:52:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=l8OeIY2z62pFWa9RMFpwYjpaOxkXziqn3dCr9XLVsEA=; b=e7XxRo1XuaGnHo7Iq2iKqvz7/dMVsPLLORltzZLOoMphzOK107rXY4hVa0VekXG+bA EqwwAqUJWlw2ZLCYwgnAuv+WZ74SeWHRisqzFqLrur0PrEbCsDkq06uTC0U87WVGimUr 811a/FEk4au++ABEFdK2bIb+Kiks6CqewYUtTQdeJAkkwoq0cjjex9RJFY4glQVFIAuP DA+PixOFV3J6f4qPeACecEc4nSvpuv+uALNuPysCRMH++i5eJ1eaeYo2gPa13ij1+Gy9 aI+CdTmQFpQkkH9H81/QAgUyj60WiUyLqqpcBIORRymnXrqhA7BA4beo5Yirmsq6+MHR P6/g== MIME-Version: 1.0 X-Received: by 10.52.26.229 with SMTP id o5mr8418951vdg.66.1359672766837; Thu, 31 Jan 2013 14:52:46 -0800 (PST) Received: by 10.220.21.141 with HTTP; Thu, 31 Jan 2013 14:52:46 -0800 (PST) Date: Thu, 31 Jan 2013 14:52:46 -0800 Message-ID: Subject: PATCH: display MSI-X table and pba offsets from "pciconf -c" From: Neel Natu To: current@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jan 2013 22:52:47 -0000 Hi, The following patch teaches pciconf(8) to display the table and pba offsets when it displays the MSI-X capability. The new output format will look like: cap 11[70] = MSI-X supports 10 messages in map 0x1c[0x0][0x2000] enabled OR cap 11[70] = MSI-X supports 10 messages in maps 0x10[0x0] and 0x14[0x1000] enabled Any objections to committing the patch? best Neel Index: usr.sbin/pciconf/cap.c =================================================================== --- cap.c (revision 246087) +++ cap.c (working copy) @@ -449,22 +449,30 @@ static void cap_msix(int fd, struct pci_conf *p, uint8_t ptr) { - uint32_t val; + uint32_t val, table_offset, pba_offset; uint16_t ctrl; int msgnum, table_bar, pba_bar; ctrl = read_config(fd, &p->pc_sel, ptr + PCIR_MSIX_CTRL, 2); msgnum = (ctrl & PCIM_MSIXCTRL_TABLE_SIZE) + 1; + val = read_config(fd, &p->pc_sel, ptr + PCIR_MSIX_TABLE, 4); table_bar = PCIR_BAR(val & PCIM_MSIX_BIR_MASK); + table_offset = val & ~PCIM_MSIX_BIR_MASK; + val = read_config(fd, &p->pc_sel, ptr + PCIR_MSIX_PBA, 4); - pba_bar = PCIR_BAR(val & PCIM_MSIX_BIR_MASK); + pba_bar = PCIR_BAR(val & PCIM_MSIX_BIR_MASK); + pba_offset = val & ~PCIM_MSIX_BIR_MASK; + printf("MSI-X supports %d message%s ", msgnum, (msgnum == 1) ? "" : "s"); - if (table_bar == pba_bar) - printf("in map 0x%x", table_bar); - else - printf("in maps 0x%x and 0x%x", table_bar, pba_bar); + if (table_bar == pba_bar) { + printf("in map 0x%x[0x%x][0x%x]", + table_bar, table_offset, pba_offset); + } else { + printf("in maps 0x%x[0x%x] and 0x%x[0x%x]", + table_bar, table_offset, pba_bar, pba_offset); + } if (ctrl & PCIM_MSIXCTRL_MSIX_ENABLE) printf(" enabled"); }