('bootp_siaddr', ctypes.c_uint32), ('bootp_giaddr', ctypes.c_uint32), ('bootp_chaddr', ctypes.c_uint8 * 16), ('bootp_sname', ctypes.c_uint8 * 64), ('bootp_file', ctypes.c_uint8 * 128), ('dhcp_magic', ctypes.c_uint32), ('dhcp_options', ctypes.c_uint8 * 60)] MACFMT = '%02x:%02x:%02x:%02x:%02x:%02x' dev = 'pci0:2:1:0' logging.basicConfig(level=logging.DEBUG) pcicfg = bus.map(dev, 'pcicfg') logging.debug('pcicfg=%s (%s)' % (pcicfg, dev)) vendor = bus.read_2(pcicfg, 0) device = bus.read_2(pcicfg, 2) if vendor != 0x1022 or device != 0x2000: logging.error('Not an AMD PCnet-PCI (vendor=%x, device=%x)' % (vendor, device)) sys.exit(1) command = bus.read_2(pcicfg, 4) if not (command & 1): logging.info('enabling I/O port decoding') command |= 1 bus.write_2(pcicfg, 4, command)
('bootp_yiaddr', ctypes.c_uint32), ('bootp_siaddr', ctypes.c_uint32), ('bootp_giaddr', ctypes.c_uint32), ('bootp_chaddr', ctypes.c_uint8 * 16), ('bootp_sname', ctypes.c_uint8 * 64), ('bootp_file', ctypes.c_uint8 * 128), ('dhcp_magic', ctypes.c_uint32), ('dhcp_options', ctypes.c_uint8 * 60)] MACFMT = '%02x:%02x:%02x:%02x:%02x:%02x' dev = 'pci0:2:1:0' logging.basicConfig(level=logging.DEBUG) pcicfg = bus.map(dev, 'pcicfg') logging.debug('pcicfg=%s (%s)' % (pcicfg, dev)) vendor = bus.read_2(pcicfg, 0) device = bus.read_2(pcicfg, 2) if vendor != 0x1022 or device != 0x2000: logging.error('Not an AMD PCnet-PCI (vendor=%x, device=%x)' % (vendor, device)) sys.exit(1) command = bus.read_2(pcicfg, 4) if not (command & 1): logging.info('enabling I/O port decoding') command |= 1 bus.write_2(pcicfg, 4, command)