mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Lucas Stach <l.stach@pengutronix.de>
To: Antony Pavlov <antonynpavlov@gmail.com>
Cc: "Clément Leger" <cleger@kalray.eu>, barebox@lists.infradead.org
Subject: Re: [RFC v3 2/5] commands: add 'lspci' command
Date: Mon, 30 Jun 2014 12:21:50 +0200	[thread overview]
Message-ID: <1404123710.4305.18.camel@weser.hi.pengutronix.de> (raw)
In-Reply-To: <1403735538-25437-3-git-send-email-antonynpavlov@gmail.com>

Am Donnerstag, den 26.06.2014, 02:32 +0400 schrieb Antony Pavlov:
> Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
> ---
>  commands/Kconfig  |  8 ++++++++
>  commands/Makefile |  1 +
>  commands/lspci.c  | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 58 insertions(+)
>  create mode 100644 commands/lspci.c
> 

[...]

> diff --git a/commands/lspci.c b/commands/lspci.c
> new file mode 100644
> index 0000000..5e1f6dd
> --- /dev/null
> +++ b/commands/lspci.c
> @@ -0,0 +1,49 @@
> +/*
> + * Copyright (C) 2011-2014 Antony Pavlov <antonynpavlov@gmail.com>
> + *
> + * This file is part of barebox.
> + * See file CREDITS for list of people who contributed to this project.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2
> + * as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + */
> +
> +#include <common.h>
> +#include <command.h>
> +#include <complete.h>
> +#include <linux/pci.h>
> +
> +static int do_lspci(int argc, char *argv[])
> +{
> +	struct pci_dev *dev;
> +
> +	if (!pci_root) {
> +		printf("no pci!\n");

Please rephrase this to something like "No PCI root busses found".

> +		return 1;
> +	}
> +
> +	list_for_each_entry(dev, &pci_root->devices, bus_list) {
> +		printf("%02x: %04x: %04x:%04x (rev %02x)\n",
> +			      dev->devfn,
> +			      (dev->class >> 8) & 0xffff,
> +			      dev->vendor,
> +			      dev->device,
> +			      dev->revision);
> +	}
> +
> +	return 0;
> +}
> +
> +BAREBOX_CMD_START(lspci)
> +	.cmd            = do_lspci,
> +	BAREBOX_CMD_DESC("Show PCI info")
> +	BAREBOX_CMD_GROUP(CMD_GRP_INFO)
> +	BAREBOX_CMD_COMPLETE(empty_complete)
> +BAREBOX_CMD_END

-- 
Pengutronix e.K.             | Lucas Stach                 |
Industrial Linux Solutions   | http://www.pengutronix.de/  |


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2014-06-30 10:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-25 22:32 [RFC v3 0/5] barebox PCI support Antony Pavlov
2014-06-25 22:32 ` [RFC v3 1/5] PCI: initial commit Antony Pavlov
2014-06-30 10:18   ` Lucas Stach
2014-07-01  7:29     ` Clément Léger
2014-07-01  7:48       ` Antony Pavlov
2014-06-25 22:32 ` [RFC v3 2/5] commands: add 'lspci' command Antony Pavlov
2014-06-30 10:21   ` Lucas Stach [this message]
2014-06-30 17:32     ` Antony Pavlov
2014-06-25 22:32 ` [RFC v3 3/5] net: add RealTek RTL-8139 PCI Ethernet driver Antony Pavlov
2014-06-25 22:32 ` [RFC v3 4/5] MIPS: add PCI support for GT64120-based Malta board Antony Pavlov
2014-06-25 22:32 ` [RFC v3 5/5] MIPS: qemu-malta_defconfig: enable PCI & network stuff Antony Pavlov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1404123710.4305.18.camel@weser.hi.pengutronix.de \
    --to=l.stach@pengutronix.de \
    --cc=antonynpavlov@gmail.com \
    --cc=barebox@lists.infradead.org \
    --cc=cleger@kalray.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox