示例#1
0
 def print_pci_config_all( self ):
     logger().log( "[pci] enumerating available PCI devices..." )
    	pci_devices = self.enumerate_devices()
     for (b, d, f, vid, did) in pci_devices:
         cfg_buf = self.dump_pci_config( b, d, f )
         logger().log( "\n[pci] PCI device {:02X}:{:02X}.{:02X} configuration:".format(b,d,f) )
         pretty_print_hex_buffer( cfg_buf )
示例#2
0
文件: pci.py 项目: daveti/chipsec
 def print_pci_config_all( self ):
     logger().log( "[pci] enumerating available PCI devices..." )
    	pci_devices = self.enumerate_devices()
     for (b, d, f, vid, did) in pci_devices:
         cfg_buf = self.dump_pci_config( b, d, f )
         logger().log( "\n[pci] PCI device %02X:%02X.%02X configuration:" % (b,d,f) )
         pretty_print_hex_buffer( cfg_buf )
示例#3
0
 def dump_device(self):
     logger().log("\n[vmm] VirtIO device %02x:%02x.%01x" % (self.bus, self.dev, self.fun))
     dev_cfg = self.cs.pci.dump_pci_config(self.bus, self.dev, self.fun)
     pretty_print_hex_buffer( dev_cfg )
     bars = self.cs.pci.get_device_bars(self.bus, self.dev, self.fun)
     for (bar, isMMIO, is64bit, bar_off, bar_reg, size) in bars:
         if isMMIO:
             chipsec.hal.mmio.dump_MMIO( self.cs, bar, size )
         else:
             self.cs.io.dump_IO( bar, size, 4 )
示例#4
0
文件: vmm.py 项目: zhujun74/chipsec
 def dump_device(self):
     logger().log("\n[vmm] VirtIO device {:02X}:{:02X}.{:01X}".format(self.bus, self.dev, self.fun))
     dev_cfg = self.cs.pci.dump_pci_config(self.bus, self.dev, self.fun)
     pretty_print_hex_buffer( dev_cfg )
     bars = self.cs.pci.get_device_bars(self.bus, self.dev, self.fun)
     for (bar, isMMIO, is64bit, bar_off, bar_reg, size) in bars:
         if isMMIO:
             self.cs.mmio.dump_MMIO( bar, size )
         else:
             self.cs.io.dump_IO( bar, size, 4 )
示例#5
0
文件: vmm.py 项目: daveti/chipsec
 def dump_device(self):
     logger().log("\n[vmm] VirtIO device %02x:%02x.%01x" % (self.bus, self.dev, self.fun))
     dev_cfg = self.cs.pci.dump_pci_config(self.bus, self.dev, self.fun)
     pretty_print_hex_buffer( dev_cfg )
     bars = self.cs.pci.get_device_bars(self.bus, self.dev, self.fun)
     for (bar, isMMIO, is64bit, bar_off, bar_reg) in bars:
         if isMMIO:
             chipsec.hal.mmio.dump_MMIO( self.cs, bar, 0x1000 )
         else:
             self.cs.io.dump_IO( bar, 0x100, 4 )
示例#6
0
    def pci_dump(self):
        if self.bus is not None:
            if self.device is not None and self.function is not None:
                devices = [(self.bus, self.device, self.function, 0x0000, 0x0000)]
            else:
                devices = self.cs.pci.enumerate_devices(self.bus, self.device, self.function)

            for (_bus, _device, _function, _vid, _did) in devices:
                self.logger.log("[CHIPSEC] PCI device {:02X}:{:02X}.{:02X} configuration:".format(_bus, _device, _function))
                cfg_buf = self.cs.pci.dump_pci_config(_bus, _device, _function)
                pretty_print_hex_buffer(cfg_buf)
        else:
            self.logger.log( "[CHIPSEC] Dumping configuration of available PCI devices..." )
            self.cs.pci.print_pci_config_all()
示例#7
0
    def pci_dump(self):
        if self.bus is not None:
            all_devices = self.cs.pci.enumerate_devices()
            if self.device is not None:
                if self.function is None:
                    devices = list(_ for _ in all_devices if (_[0] == self.bus) and (_[1] == self.device) )
                else:
                    devices = [(self.bus, self.device, self.function)]
            else:
                devices = list(_ for _ in all_devices if (_[0] == self.bus) )

            for (_bus,_device,_function) in devices:
                self.logger.log( "[CHIPSEC] PCI device {:02X}:{:02X}.{:02X} configuration:".format(_bus,_device,_function) )
                cfg_buf = self.cs.pci.dump_pci_config(_bus,_device,_function)
                pretty_print_hex_buffer( cfg_buf )
        else:
            self.logger.log( "[CHIPSEC] Dumping configuration of available PCI devices..." )
            self.cs.pci.print_pci_config_all()
示例#8
0
    def run(self):
        if len(self.argv) < 3:
            print PCICommand.__doc__
            return

        op = self.argv[2]
        t = time.time()

        if ('enumerate' == op):
            self.logger.log("[CHIPSEC] Enumerating available PCIe devices..")
            print_pci_devices(self.cs.pci.enumerate_devices())
            self.logger.log("[CHIPSEC] (pci) time elapsed %.3f" %
                            (time.time() - t))
            return

        elif ('dump' == op):

            if len(self.argv) == 3:
                self.logger.log(
                    "[CHIPSEC] dumping configuration of available PCI devices.."
                )
                self.cs.pci.print_pci_config_all()

            elif len(self.argv) > 5:
                bus = int(self.argv[3], 16)
                device = int(self.argv[4], 16)
                function = int(self.argv[5], 16)
                self.logger.log(
                    "[CHIPSEC] PCI device %02X:%02X.%02X configuration:" %
                    (bus, device, function))
                cfg_buf = self.cs.pci.dump_pci_config(bus, device, function)
                pretty_print_hex_buffer(cfg_buf)
            else:
                print PCICommand.__doc__
                return

        elif ('xrom' == op):

            if len(self.argv) < 5:
                self.logger.log("[CHIPSEC] enumerating PCI expansion ROMs..")
                xrom_addr = int(self.argv[3], 16) if len(
                    self.argv) == 4 else None
                _xroms = self.cs.pci.enumerate_xroms(True, True, xrom_addr)
                self.logger.log("[CHIPSEC] found %d PCI expansion ROMs" %
                                len(_xroms))
                if len(_xroms) > 0: print_pci_XROMs(_xroms)
            elif len(self.argv) > 5:
                bus = int(self.argv[3], 16)
                device = int(self.argv[4], 16)
                function = int(self.argv[5], 16)
                xrom_addr = int(self.argv[6],
                                16) if len(self.argv) > 6 else None
                self.logger.log(
                    "[CHIPSEC] locating PCI expansion ROM (XROM) of %02X:%02X.%02X..."
                    % (bus, device, function))
                exists, xrom = self.cs.pci.find_XROM(bus, device, function,
                                                     True, True, xrom_addr)
                if exists:
                    self.logger.log("[CHIPSEC] found XROM of %02X:%02X.%02X" %
                                    (bus, device, function))
                    if xrom is not None:
                        self.logger.log(
                            "[CHIPSEC] XROM enabled = %d, base = 0x%08X, size = 0x%08X"
                            % (xrom.en, xrom.base, xrom.size))
                        if xrom.header is not None:
                            self.logger.log("[CHIPSEC] XROM header: %s" %
                                            xrom.header)
                else:
                    self.logger.log(
                        "[CHIPSEC] coudn't find XROM of %02X:%02X.%02X" %
                        (bus, device, function))
            else:
                print PCICommand.__doc__
                return

        else:

            if len(self.argv) < 6:
                print PCICommand.__doc__
                return

            bus = int(self.argv[2], 16)
            device = int(self.argv[3], 16)
            function = int(self.argv[4], 16)
            offset = int(self.argv[5], 16)
            width = 4
            if len(self.argv) > 6:
                width = chipsec_util.get_option_width(
                    self.argv[6]) if chipsec_util.is_option_valid_width(
                        self.argv[6]) else int(self.argv[6], 16)

            if 8 == len(self.argv):
                value = int(self.argv[7], 16)
                self.logger.log(
                    "[CHIPSEC] write 0x%X to PCI %02X:%02X.%02X + 0x%02X" %
                    (value, bus, device, function, offset))
                if 1 == width:
                    self.cs.pci.write_byte(bus, device, function, offset,
                                           value)
                elif 2 == width:
                    self.cs.pci.write_word(bus, device, function, offset,
                                           value)
                elif 4 == width:
                    self.cs.pci.write_dword(bus, device, function, offset,
                                            value)
                else:
                    self.logger.error("width should be one of %s" %
                                      chipsec_util.CMD_OPTS_WIDTH)
            else:
                if 1 == width:
                    pci_value = self.cs.pci.read_byte(bus, device, function,
                                                      offset)
                elif 2 == width:
                    pci_value = self.cs.pci.read_word(bus, device, function,
                                                      offset)
                elif 4 == width:
                    pci_value = self.cs.pci.read_dword(bus, device, function,
                                                       offset)
                else:
                    self.logger.error("width should be one of %s" %
                                      chipsec_util.CMD_OPTS_WIDTH)
                    return
                self.logger.log("[CHIPSEC] PCI %02X:%02X.%02X + 0x%02X: 0x%X" %
                                (bus, device, function, offset, pci_value))

        self.logger.log("[CHIPSEC] (pci) time elapsed %.3f" %
                        (time.time() - t))
示例#9
0
    def run(self):
        if len(self.argv) < 3:
            print PCICommand.__doc__
            return

        op = self.argv[2]
        t = time.time()

        if ('enumerate' == op):
            self.logger.log("[CHIPSEC] Enumerating available PCIe devices..")
            print_pci_devices(self.cs.pci.enumerate_devices())
            self.logger.log("[CHIPSEC] (pci) time elapsed %.3f" %
                            (time.time() - t))
            return

        elif ('dump' == op):

            if len(self.argv) == 3:
                self.logger.log(
                    "[CHIPSEC] dumping configuration of available PCI devices.."
                )
                self.cs.pci.print_pci_config_all()

            elif len(self.argv) > 5:
                bus = int(self.argv[3], 16)
                device = int(self.argv[4], 16)
                function = int(self.argv[5], 16)
                self.logger.log(
                    "[CHIPSEC] PCI device %02X:%02X.%02X configuration:" %
                    (bus, device, function))
                cfg_buf = self.cs.pci.dump_pci_config(bus, device, function)
                pretty_print_hex_buffer(cfg_buf)
            else:
                print PCICommand.__doc__
                return

        elif ('xrom' == op):

            if len(self.argv) < 5:
                self.logger.log("[CHIPSEC] enumerating PCI expansion ROMs..")
                xrom_addr = int(self.argv[3], 16) if len(
                    self.argv) == 4 else None
                _xroms = self.cs.pci.enumerate_xroms(True, True, xrom_addr)
                self.logger.log("[CHIPSEC] found %d PCI expansion ROMs" %
                                len(_xroms))
                if len(_xroms) > 0: print_pci_XROMs(_xroms)
            elif len(self.argv) > 5:
                bus = int(self.argv[3], 16)
                device = int(self.argv[4], 16)
                function = int(self.argv[5], 16)
                xrom_addr = int(self.argv[6],
                                16) if len(self.argv) > 6 else None
                self.logger.log(
                    "[CHIPSEC] locating PCI expansion ROM (XROM) of %02X:%02X.%02X..."
                    % (bus, device, function))
                exists, xrom = self.cs.pci.find_XROM(bus, device, function,
                                                     True, True, xrom_addr)
                if exists:
                    self.logger.log("[CHIPSEC] found XROM of %02X:%02X.%02X" %
                                    (bus, device, function))
                    if xrom is not None:
                        self.logger.log(
                            "[CHIPSEC] XROM enabled = %d, base = 0x%08X, size = 0x%08X"
                            % (xrom.en, xrom.base, xrom.size))
                        if xrom.header is not None:
                            self.logger.log("[CHIPSEC] XROM header: %s" %
                                            xrom.header)
                else:
                    self.logger.log(
                        "[CHIPSEC] coudn't find XROM of %02X:%02X.%02X" %
                        (bus, device, function))
            else:
                print PCICommand.__doc__
                return

        elif ('cmd' == op):
            cmd_mask = 0xFFFF
            pci_class = None
            pci_sub_class = None
            if len(self.argv) >= 4:
                cmd_mask = int(self.argv[3], 16)
            if len(self.argv) >= 5:
                pci_class = int(self.argv[4], 16)
            if len(self.argv) >= 6:
                pci_sub_class = int(self.argv[5], 16)
            self.logger.log('BDF     | VID:DID   | CMD  | CLS | Sub CLS')
            self.logger.log('------------------------------------------')
            for (b, d, f, vid, did) in self.cs.pci.enumerate_devices():
                dev_cls = self.cs.pci.read_byte(b, d, f, PCI_HDR_CLS_OFF)
                if pci_class is not None and (dev_cls != pci_class):
                    continue
                dev_sub_cls = self.cs.pci.read_byte(b, d, f,
                                                    PCI_HDR_SUB_CLS_OFF)
                if pci_sub_class is not None and (dev_sub_cls !=
                                                  pci_sub_class):
                    continue
                cmd_reg = self.cs.pci.read_word(b, d, f, PCI_HDR_CMD_OFF)
                if (cmd_reg & cmd_mask) == 0:
                    continue
                self.logger.log(
                    '{:02X}:{:02X}.{:X} | {:04X}:{:04X} | {:04X} | {:02X}  | {:02X}'
                    .format(b, d, f, vid, did, cmd_reg, dev_cls, dev_sub_cls))
        else:

            if len(self.argv) < 6:
                print PCICommand.__doc__
                return

            bus = int(self.argv[2], 16)
            device = int(self.argv[3], 16)
            function = int(self.argv[4], 16)
            offset = int(self.argv[5], 16)
            width = 4
            if len(self.argv) > 6:
                width = chipsec_util.get_option_width(
                    self.argv[6]) if chipsec_util.is_option_valid_width(
                        self.argv[6]) else int(self.argv[6], 16)

            if 8 == len(self.argv):
                value = int(self.argv[7], 16)
                self.logger.log(
                    "[CHIPSEC] write 0x%X to PCI %02X:%02X.%02X + 0x%02X" %
                    (value, bus, device, function, offset))
                if 1 == width:
                    self.cs.pci.write_byte(bus, device, function, offset,
                                           value)
                elif 2 == width:
                    self.cs.pci.write_word(bus, device, function, offset,
                                           value)
                elif 4 == width:
                    self.cs.pci.write_dword(bus, device, function, offset,
                                            value)
                else:
                    self.logger.error("width should be one of %s" %
                                      chipsec_util.CMD_OPTS_WIDTH)
            else:
                if 1 == width:
                    pci_value = self.cs.pci.read_byte(bus, device, function,
                                                      offset)
                elif 2 == width:
                    pci_value = self.cs.pci.read_word(bus, device, function,
                                                      offset)
                elif 4 == width:
                    pci_value = self.cs.pci.read_dword(bus, device, function,
                                                       offset)
                else:
                    self.logger.error("width should be one of %s" %
                                      chipsec_util.CMD_OPTS_WIDTH)
                    return
                self.logger.log("[CHIPSEC] PCI %02X:%02X.%02X + 0x%02X: 0x%X" %
                                (bus, device, function, offset, pci_value))

        self.logger.log("[CHIPSEC] (pci) time elapsed %.3f" %
                        (time.time() - t))
示例#10
0
    def run(self):
        if len(self.argv) < 3:
            print PCICommand.__doc__
            return

        op = self.argv[2]
        t = time.time()

        if ( 'enumerate' == op ):
            self.logger.log( "[CHIPSEC] Enumerating available PCIe devices.." )
            print_pci_devices( self.cs.pci.enumerate_devices() )
            self.logger.log( "[CHIPSEC] (pci) time elapsed %.3f" % (time.time()-t) )
            return

        elif ( 'dump' == op ):

            if len(self.argv) == 3:
                self.logger.log( "[CHIPSEC] dumping configuration of available PCI devices.." )
                self.cs.pci.print_pci_config_all()

            elif len(self.argv) > 5:
                bus       = int(self.argv[3],16)
                device    = int(self.argv[4],16)
                function  = int(self.argv[5],16)
                self.logger.log( "[CHIPSEC] PCI device %02X:%02X.%02X configuration:" % (bus,device,function) )
                cfg_buf = self.cs.pci.dump_pci_config( bus, device, function )
                pretty_print_hex_buffer( cfg_buf )
            else:
                print PCICommand.__doc__
                return

        elif ( 'xrom' == op ):

            if len(self.argv) < 5:
                self.logger.log( "[CHIPSEC] enumerating PCI expansion ROMs.." )
                xrom_addr = int(self.argv[3],16) if len(self.argv) == 4 else None
                _xroms = self.cs.pci.enumerate_xroms( True, True, xrom_addr )
                self.logger.log( "[CHIPSEC] found %d PCI expansion ROMs" % len(_xroms) )
                if len(_xroms) > 0: print_pci_XROMs( _xroms )
            elif len(self.argv) > 5:
                bus       = int(self.argv[3],16)
                device    = int(self.argv[4],16)
                function  = int(self.argv[5],16)
                xrom_addr = int(self.argv[6],16) if len(self.argv) > 6 else None
                self.logger.log( "[CHIPSEC] locating PCI expansion ROM (XROM) of %02X:%02X.%02X..." % (bus,device,function) )
                exists,xrom = self.cs.pci.find_XROM( bus, device, function, True, True, xrom_addr )
                if exists:
                    self.logger.log( "[CHIPSEC] found XROM of %02X:%02X.%02X" % (bus,device,function) )
                    if xrom is not None:
                        self.logger.log( "[CHIPSEC] XROM enabled = %d, base = 0x%08X, size = 0x%08X" % (xrom.en,xrom.base,xrom.size) )
                        if xrom.header is not None: self.logger.log( "[CHIPSEC] XROM header: %s" % xrom.header )
                else:
                    self.logger.log( "[CHIPSEC] coudn't find XROM of %02X:%02X.%02X" % (bus,device,function) )
            else:
                print PCICommand.__doc__
                return

        elif ('cmd' == op):
            cmd_mask = 0xFFFF
            pci_class = None
            pci_sub_class = None
            if len(self.argv) >= 4:
                cmd_mask = int(self.argv[3],16)
            if len(self.argv) >= 5:
                pci_class = int(self.argv[4],16)
            if len(self.argv) >= 6:
                pci_sub_class = int(self.argv[5],16)
            self.logger.log('BDF     | VID:DID   | CMD  | CLS | Sub CLS')
            self.logger.log('------------------------------------------')
            for (b, d, f, vid, did) in self.cs.pci.enumerate_devices():
                dev_cls = self.cs.pci.read_byte(b, d, f, PCI_HDR_CLS_OFF)
                if pci_class is not None and (dev_cls != pci_class):
                    continue
                dev_sub_cls = self.cs.pci.read_byte(b, d, f, PCI_HDR_SUB_CLS_OFF)
                if pci_sub_class is not None and (dev_sub_cls != pci_sub_class):
                    continue
                cmd_reg = self.cs.pci.read_word(b, d, f, PCI_HDR_CMD_OFF)
                if (cmd_reg & cmd_mask) == 0:
                    continue
                self.logger.log('{:02X}:{:02X}.{:X} | {:04X}:{:04X} | {:04X} | {:02X}  | {:02X}'.format(b, d, f, vid, did, cmd_reg, dev_cls, dev_sub_cls))
        else:

            if len(self.argv) < 6:
                print PCICommand.__doc__
                return

            bus      = int(self.argv[2],16)
            device   = int(self.argv[3],16)
            function = int(self.argv[4],16)
            offset   = int(self.argv[5],16)
            width    = 4
            if len(self.argv) > 6:
                width = chipsec_util.get_option_width(self.argv[6]) if chipsec_util.is_option_valid_width(self.argv[6]) else int(self.argv[6],16)

            if 8 == len(self.argv):
                value = int(self.argv[7], 16)
                self.logger.log( "[CHIPSEC] write 0x%X to PCI %02X:%02X.%02X + 0x%02X" % (value, bus, device, function, offset) )
                if   1 == width: self.cs.pci.write_byte ( bus, device, function, offset, value )
                elif 2 == width: self.cs.pci.write_word ( bus, device, function, offset, value )
                elif 4 == width: self.cs.pci.write_dword( bus, device, function, offset, value )
                else: self.logger.error( "width should be one of %s" % chipsec_util.CMD_OPTS_WIDTH )
            else:
                if   1 == width: pci_value = self.cs.pci.read_byte (bus, device, function, offset)
                elif 2 == width: pci_value = self.cs.pci.read_word (bus, device, function, offset)
                elif 4 == width: pci_value = self.cs.pci.read_dword(bus, device, function, offset)
                else:
                    self.logger.error( "width should be one of %s" % chipsec_util.CMD_OPTS_WIDTH )
                    return
                self.logger.log( "[CHIPSEC] PCI %02X:%02X.%02X + 0x%02X: 0x%X" % (bus, device, function, offset, pci_value) )

        self.logger.log( "[CHIPSEC] (pci) time elapsed %.3f" % (time.time()-t) )
示例#11
0
文件: pci_cmd.py 项目: daveti/chipsec
    def run(self):
        if len(self.argv) < 3:
            print PCICommand.__doc__
            return

        op = self.argv[2]
        t = time.time()

        if ( 'enumerate' == op ):
            self.logger.log( "[CHIPSEC] Enumerating available PCIe devices.." )
            print_pci_devices( self.cs.pci.enumerate_devices() )
            self.logger.log( "[CHIPSEC] (pci) time elapsed %.3f" % (time.time()-t) )
            return

        elif ( 'dump' == op ):

            if len(self.argv) == 3:
                self.logger.log( "[CHIPSEC] dumping configuration of available PCI devices.." )
                self.cs.pci.print_pci_config_all()

            elif len(self.argv) > 5:
                bus       = int(self.argv[3],16)
                device    = int(self.argv[4],16)
                function  = int(self.argv[5],16)
                self.logger.log( "[CHIPSEC] PCI device %02X:%02X.%02X configuration:" % (bus,device,function) )
                cfg_buf = self.cs.pci.dump_pci_config( bus, device, function )
                pretty_print_hex_buffer( cfg_buf )
            else:
                print PCICommand.__doc__
                return

        elif ( 'xrom' == op ):

            if len(self.argv) < 5:
                self.logger.log( "[CHIPSEC] enumerating PCI expansion ROMs.." )
                xrom_addr = int(self.argv[3],16) if len(self.argv) == 4 else None
                _xroms = self.cs.pci.enumerate_xroms( True, True, xrom_addr )
                self.logger.log( "[CHIPSEC] found %d PCI expansion ROMs" % len(_xroms) )
                if len(_xroms) > 0: print_pci_XROMs( _xroms )
            elif len(self.argv) > 5:
                bus       = int(self.argv[3],16)
                device    = int(self.argv[4],16)
                function  = int(self.argv[5],16)
                xrom_addr = int(self.argv[6],16) if len(self.argv) > 6 else None
                self.logger.log( "[CHIPSEC] locating PCI expansion ROM (XROM) of %02X:%02X.%02X..." % (bus,device,function) )
                exists,xrom = self.cs.pci.find_XROM( bus, device, function, True, True, xrom_addr )
                if exists:
                    self.logger.log( "[CHIPSEC] found XROM of %02X:%02X.%02X" % (bus,device,function) )
                    if xrom is not None:
                        self.logger.log( "[CHIPSEC] XROM enabled = %d, base = 0x%08X, size = 0x%08X" % (xrom.en,xrom.base,xrom.size) )
                        if xrom.header is not None: self.logger.log( "[CHIPSEC] XROM header: %s" % xrom.header )
                else:
                    self.logger.log( "[CHIPSEC] coudn't find XROM of %02X:%02X.%02X" % (bus,device,function) )
            else:
                print PCICommand.__doc__
                return

        else:

            if len(self.argv) < 6:
                print PCICommand.__doc__
                return

            bus      = int(self.argv[2],16)
            device   = int(self.argv[3],16)
            function = int(self.argv[4],16)
            offset   = int(self.argv[5],16)
            width    = 4
            if len(self.argv) > 6:
                width = chipsec_util.get_option_width(self.argv[6]) if chipsec_util.is_option_valid_width(self.argv[6]) else int(self.argv[6],16)

            if 8 == len(self.argv):
                value = int(self.argv[7], 16)
                self.logger.log( "[CHIPSEC] write 0x%X to PCI %02X:%02X.%02X + 0x%02X" % (value, bus, device, function, offset) )
                if   1 == width: self.cs.pci.write_byte ( bus, device, function, offset, value )
                elif 2 == width: self.cs.pci.write_word ( bus, device, function, offset, value )
                elif 4 == width: self.cs.pci.write_dword( bus, device, function, offset, value )
                else: self.logger.error( "width should be one of %s" % chipsec_util.CMD_OPTS_WIDTH )
            else:
                if   1 == width: pci_value = self.cs.pci.read_byte (bus, device, function, offset)
                elif 2 == width: pci_value = self.cs.pci.read_word (bus, device, function, offset)
                elif 4 == width: pci_value = self.cs.pci.read_dword(bus, device, function, offset)
                else:
                    self.logger.error( "width should be one of %s" % chipsec_util.CMD_OPTS_WIDTH )
                    return
                self.logger.log( "[CHIPSEC] PCI %02X:%02X.%02X + 0x%02X: 0x%X" % (bus, device, function, offset, pci_value) )

        self.logger.log( "[CHIPSEC] (pci) time elapsed %.3f" % (time.time()-t) )