From: "Michael S. Tsirkin" <mst@redhat.com>
To: Gleb Natapov <gleb@redhat.com>
Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, blauwirbel@gmail.com,
armbru@redhat.com, alex.williamson@redhat.com,
kevin@koconnor.net
Subject: Re: [PATCHv4 08/15] Add get_fw_dev_path callback for pci bus.
Date: Sun, 14 Nov 2010 20:27:20 +0200 [thread overview]
Message-ID: <20101114182720.GA12570@redhat.com> (raw)
In-Reply-To: <1289749181-12070-9-git-send-email-gleb@redhat.com>
On Sun, Nov 14, 2010 at 05:39:34PM +0200, Gleb Natapov wrote:
>
> Signed-off-by: Gleb Natapov <gleb@redhat.com>
> ---
> hw/pci.c | 108 ++++++++++++++++++++++++++++++++++++++++++++++++-------------
> 1 files changed, 85 insertions(+), 23 deletions(-)
>
> diff --git a/hw/pci.c b/hw/pci.c
> index 962886e..114b435 100644
> --- a/hw/pci.c
> +++ b/hw/pci.c
> @@ -43,12 +43,14 @@
>
> static void pcibus_dev_print(Monitor *mon, DeviceState *dev, int indent);
> static char *pcibus_get_dev_path(DeviceState *dev);
> +static char *pcibus_get_fw_dev_path(DeviceState *dev);
>
> struct BusInfo pci_bus_info = {
> .name = "PCI",
> .size = sizeof(PCIBus),
> .print_dev = pcibus_dev_print,
> .get_dev_path = pcibus_get_dev_path,
> + .get_fw_dev_path = pcibus_get_fw_dev_path,
> .props = (Property[]) {
> DEFINE_PROP_PCI_DEVFN("addr", PCIDevice, devfn, -1),
> DEFINE_PROP_STRING("romfile", PCIDevice, romfile),
> @@ -1061,45 +1063,63 @@ void pci_msi_notify(PCIDevice *dev, unsigned int vector)
> typedef struct {
> uint16_t class;
> const char *desc;
> + const char *fw_name;
> + uint16_t fw_ign_bits;
> } pci_class_desc;
>
> static const pci_class_desc pci_class_descriptions[] =
> {
> - { 0x0100, "SCSI controller"},
> - { 0x0101, "IDE controller"},
> - { 0x0102, "Floppy controller"},
> - { 0x0103, "IPI controller"},
> - { 0x0104, "RAID controller"},
> + { 0x0001, "VGA controller", "display"},
> + { 0x0100, "SCSI controller", "scsi"},
> + { 0x0101, "IDE controller", "ide"},
> + { 0x0102, "Floppy controller", "fdc"},
> + { 0x0103, "IPI controller", "ipi"},
> + { 0x0104, "RAID controller", "raid"},
> { 0x0106, "SATA controller"},
> { 0x0107, "SAS controller"},
> { 0x0180, "Storage controller"},
> - { 0x0200, "Ethernet controller"},
> - { 0x0201, "Token Ring controller"},
> - { 0x0202, "FDDI controller"},
> - { 0x0203, "ATM controller"},
> + { 0x0200, "Ethernet controller", "ethernet"},
> + { 0x0201, "Token Ring controller", "token-ring"},
> + { 0x0202, "FDDI controller", "fddi"},
> + { 0x0203, "ATM controller", "atm"},
> { 0x0280, "Network controller"},
> - { 0x0300, "VGA controller"},
> + { 0x0300, "VGA controller", "display", 0x00ff},
> { 0x0301, "XGA controller"},
> { 0x0302, "3D controller"},
> { 0x0380, "Display controller"},
> - { 0x0400, "Video controller"},
> - { 0x0401, "Audio controller"},
> + { 0x0400, "Video controller", "video"},
> + { 0x0401, "Audio controller", "sound"},
> { 0x0402, "Phone"},
> { 0x0480, "Multimedia controller"},
> - { 0x0500, "RAM controller"},
> - { 0x0501, "Flash controller"},
> + { 0x0500, "RAM controller", "memory"},
> + { 0x0501, "Flash controller", "flash"},
> { 0x0580, "Memory controller"},
> - { 0x0600, "Host bridge"},
> - { 0x0601, "ISA bridge"},
> - { 0x0602, "EISA bridge"},
> - { 0x0603, "MC bridge"},
> - { 0x0604, "PCI bridge"},
> - { 0x0605, "PCMCIA bridge"},
> - { 0x0606, "NUBUS bridge"},
> - { 0x0607, "CARDBUS bridge"},
> + { 0x0600, "Host bridge", "host"},
> + { 0x0601, "ISA bridge", "isa"},
> + { 0x0602, "EISA bridge", "eisa"},
> + { 0x0603, "MC bridge", "mca"},
> + { 0x0604, "PCI bridge", "pci"},
> + { 0x0605, "PCMCIA bridge", "pcmcia"},
> + { 0x0606, "NUBUS bridge", "nubus"},
> + { 0x0607, "CARDBUS bridge", "cardbus"},
> { 0x0608, "RACEWAY bridge"},
> { 0x0680, "Bridge"},
> - { 0x0c03, "USB controller"},
> + { 0x0700, "Serial port", "serial"},
> + { 0x0701, "Parallel port", "parallel"},
> + { 0x0800, "Interrupt controller", "interrupt-controller"},
> + { 0x0801, "DMA controller", "dma-controller"},
> + { 0x0802, "Timer", "timer"},
> + { 0x0803, "RTC", "rtc"},
> + { 0x0900, "Keyboard", "keyboard"},
> + { 0x0901, "Pen", "pen"},
> + { 0x0902, "Mouse", "mouse"},
> + { 0x0A00, "Dock station", "dock", 0x00ff},
> + { 0x0B00, "i386 cpu", "cpu", 0x00ff},
> + { 0x0c00, "Fireware contorller", "fireware"},
> + { 0x0c01, "Access bus controller", "access-bus"},
> + { 0x0c02, "SSA controller", "ssa"},
> + { 0x0c03, "USB controller", "usb"},
> + { 0x0c04, "Fibre channel controller", "fibre-channel"},
> { 0, NULL}
> };
>
> @@ -1825,6 +1845,48 @@ static void pcibus_dev_print(Monitor *mon, DeviceState *dev, int indent)
> }
> }
>
> +static char *pci_dev_fw_name(DeviceState *dev, char *buf, int len)
> +{
> + PCIDevice *d = (PCIDevice *)dev;
> + const char *name = NULL;
> + const pci_class_desc *desc = pci_class_descriptions;
> + int class = pci_get_word(d->config + PCI_CLASS_DEVICE);
> +
> + while (desc->desc &&
> + (class & ~desc->fw_ign_bits) !=
> + (desc->class & ~desc->fw_ign_bits)) {
> + desc++;
> + }
> +
> + if (desc->desc) {
> + name = desc->fw_name;
> + }
> +
> + if (name) {
> + pstrcpy(buf, len, name);
> + } else {
> + snprintf(buf, len, "pci%04x,%04x",
> + pci_get_word(d->config + PCI_VENDOR_ID),
> + pci_get_word(d->config + PCI_DEVICE_ID));
> + }
> +
> + return buf;
> +}
> +
> +static char *pcibus_get_fw_dev_path(DeviceState *dev)
> +{
> + PCIDevice *d = (PCIDevice *)dev;
> + char path[50], name[33];
> + int off;
> +
> + off = snprintf(path, sizeof(path), "%s@%x",
> + pci_dev_fw_name(dev, name, sizeof name),
> + PCI_SLOT(d->devfn));
> + if (PCI_FUNC(d->devfn))
> + snprintf(path + off, sizeof(path) + off, ",%x", PCI_FUNC(d->devfn));
Can we *always* specify a slot number in the name?
If yes I think we should, because I think we saw that the short form is
ambiguous: if there's a device at a slot != 0, openfirmware will
to match that against the name.
Right?
> + return strdup(path);
> +}
> +
> static char *pcibus_get_dev_path(DeviceState *dev)
> {
> PCIDevice *d = (PCIDevice *)dev;
> --
> 1.7.1
next prev parent reply other threads:[~2010-11-14 18:27 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-14 15:39 [PATCHv4 00/15] boot order specification Gleb Natapov
2010-11-14 15:39 ` [PATCHv4 01/15] Introduce fw_name field to DeviceInfo structure Gleb Natapov
2010-11-14 15:39 ` [PATCHv4 02/15] Introduce new BusInfo callback get_fw_dev_path Gleb Natapov
2010-11-14 15:39 ` [PATCHv4 03/15] Keep track of ISA ports ISA device is using in qdev Gleb Natapov
2010-11-14 15:39 ` [PATCHv4 04/15] Add get_fw_dev_path callback to ISA bus " Gleb Natapov
2010-11-14 15:39 ` [PATCHv4 05/15] Store IDE bus id in IDEBus structure for easy access Gleb Natapov
2010-11-14 15:39 ` [PATCHv4 06/15] Add get_fw_dev_path callback to IDE bus Gleb Natapov
2010-11-14 15:39 ` [PATCHv4 07/15] Add get_dev_path callback for system bus Gleb Natapov
2010-11-14 15:39 ` [PATCHv4 08/15] Add get_fw_dev_path callback for pci bus Gleb Natapov
2010-11-14 18:27 ` Michael S. Tsirkin [this message]
2010-11-14 18:42 ` Gleb Natapov
2010-11-14 15:39 ` [PATCHv4 09/15] Record which USBDevice USBPort belongs too Gleb Natapov
2010-11-14 15:39 ` [PATCHv4 10/15] Add get_dev_path callback for usb bus Gleb Natapov
2010-11-14 15:39 ` [PATCHv4 11/15] Add bootindex parameter to net/block/fd device Gleb Natapov
2010-11-14 15:39 ` [PATCHv4 12/15] Change fw_cfg_add_file() to get full file path as a parameter Gleb Natapov
2010-11-14 15:39 ` [PATCHv4 13/15] Add bootindex for option roms Gleb Natapov
2010-11-14 21:33 ` Blue Swirl
2010-11-15 10:18 ` Gleb Natapov
2010-11-14 15:39 ` [PATCHv4 14/15] Add notifier that will be called when machine is fully created Gleb Natapov
2010-11-14 15:39 ` [PATCHv4 15/15] Pass boot device list to firmware Gleb Natapov
2010-11-14 18:41 ` Michael S. Tsirkin
2010-11-14 18:52 ` Gleb Natapov
2010-11-14 20:56 ` Michael S. Tsirkin
2010-11-14 20:57 ` Michael S. Tsirkin
2010-11-14 20:49 ` Blue Swirl
2010-11-14 20:54 ` Michael S. Tsirkin
2010-11-14 21:13 ` Blue Swirl
2010-11-14 21:45 ` Michael S. Tsirkin
2010-11-14 22:50 ` Blue Swirl
2010-11-15 8:42 ` Gleb Natapov
2010-11-15 20:29 ` Blue Swirl
2010-11-16 14:11 ` Gleb Natapov
2010-11-16 18:30 ` Blue Swirl
2010-11-16 19:02 ` Gleb Natapov
2010-11-17 21:54 ` Blue Swirl
2010-11-18 10:18 ` Gleb Natapov
2010-11-18 11:38 ` Michael S. Tsirkin
2010-11-18 11:45 ` Gleb Natapov
2010-11-18 11:52 ` Michael S. Tsirkin
2010-11-18 12:16 ` Gleb Natapov
2010-11-18 12:23 ` Michael S. Tsirkin
2010-11-18 12:37 ` Gleb Natapov
2010-11-18 13:12 ` Michael S. Tsirkin
2010-11-18 13:16 ` Gleb Natapov
2010-11-15 3:40 ` Kevin O'Connor
2010-11-15 7:40 ` Gleb Natapov
2010-11-15 7:53 ` Michael S. Tsirkin
2010-11-15 8:09 ` Gleb Natapov
2010-11-15 13:26 ` Kevin O'Connor
2010-11-15 13:36 ` Gleb Natapov
2010-11-15 13:46 ` Gleb Natapov
2010-11-16 2:52 ` Kevin O'Connor
2010-11-16 7:22 ` Gleb Natapov
2010-11-16 13:49 ` Kevin O'Connor
2010-11-16 18:19 ` Blue Swirl
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=20101114182720.GA12570@redhat.com \
--to=mst@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=armbru@redhat.com \
--cc=blauwirbel@gmail.com \
--cc=gleb@redhat.com \
--cc=kevin@koconnor.net \
--cc=kvm@vger.kernel.org \
--cc=qemu-devel@nongnu.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.