mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-01-09 15:08:02 -05:00
replace libpciaccess autogen with just pci regs (#8983)
* replace libpciaccess autogen with just pci regs * add pci.py
This commit is contained in:
@@ -271,15 +271,11 @@ generate_qcom() {
|
||||
python3 -c "import tinygrad.runtime.autogen.qcom_dsp"
|
||||
}
|
||||
|
||||
generate_pciaccess() {
|
||||
generate_pci() {
|
||||
clang2py -k cdefstum \
|
||||
/usr/include/pciaccess.h \
|
||||
/usr/include/linux/pci_regs.h \
|
||||
-l /usr/lib/x86_64-linux-gnu/libpciaccess.so \
|
||||
-o $BASE/libpciaccess.py
|
||||
sed -i "s\import ctypes\import ctypes, os\g" $BASE/libpciaccess.py
|
||||
fixup $BASE/libpciaccess.py
|
||||
sed -i "s/ctypes\.CDLL('\([^']*\)')/ctypes.CDLL('\1') if os.path.exists('\1') else None/g" $BASE/libpciaccess.py
|
||||
-o $BASE/pci.py
|
||||
fixup $BASE/pci.py
|
||||
}
|
||||
|
||||
generate_vfio() {
|
||||
@@ -382,7 +378,7 @@ elif [ "$1" == "libc" ]; then generate_libc
|
||||
elif [ "$1" == "llvm" ]; then generate_llvm
|
||||
elif [ "$1" == "kgsl" ]; then generate_kgsl
|
||||
elif [ "$1" == "adreno" ]; then generate_adreno
|
||||
elif [ "$1" == "pci" ]; then generate_pciaccess
|
||||
elif [ "$1" == "pci" ]; then generate_pci
|
||||
elif [ "$1" == "vfio" ]; then generate_vfio
|
||||
elif [ "$1" == "webgpu" ]; then generate_webgpu
|
||||
elif [ "$1" == "all" ]; then generate_opencl; generate_hip; generate_comgr; generate_cuda; generate_nvrtc; generate_hsa; generate_kfd; generate_nv; generate_amd; generate_io_uring; generate_libc; generate_am; generate_webgpu
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import re, ctypes, sys
|
||||
|
||||
from tinygrad.runtime.autogen import libpciaccess
|
||||
from tinygrad.runtime.autogen.am import am, mp_11_0, mp_13_0_0, nbio_4_3_0, mmhub_3_0_0, gc_11_0_0, osssys_6_0_0
|
||||
|
||||
def parse_amdgpu_logs(log_content, register_names=None):
|
||||
|
||||
@@ -6,564 +6,11 @@
|
||||
# POINTER_SIZE is: 8
|
||||
# LONGDOUBLE_SIZE is: 16
|
||||
#
|
||||
import ctypes, os
|
||||
|
||||
|
||||
class AsDictMixin:
|
||||
@classmethod
|
||||
def as_dict(cls, self):
|
||||
result = {}
|
||||
if not isinstance(self, AsDictMixin):
|
||||
# not a structure, assume it's already a python object
|
||||
return self
|
||||
if not hasattr(cls, "_fields_"):
|
||||
return result
|
||||
# sys.version_info >= (3, 5)
|
||||
# for (field, *_) in cls._fields_: # noqa
|
||||
for field_tuple in cls._fields_: # noqa
|
||||
field = field_tuple[0]
|
||||
if field.startswith('PADDING_'):
|
||||
continue
|
||||
value = getattr(self, field)
|
||||
type_ = type(value)
|
||||
if hasattr(value, "_length_") and hasattr(value, "_type_"):
|
||||
# array
|
||||
if not hasattr(type_, "as_dict"):
|
||||
value = [v for v in value]
|
||||
else:
|
||||
type_ = type_._type_
|
||||
value = [type_.as_dict(v) for v in value]
|
||||
elif hasattr(value, "contents") and hasattr(value, "_type_"):
|
||||
# pointer
|
||||
try:
|
||||
if not hasattr(type_, "as_dict"):
|
||||
value = value.contents
|
||||
else:
|
||||
type_ = type_._type_
|
||||
value = type_.as_dict(value.contents)
|
||||
except ValueError:
|
||||
# nullptr
|
||||
value = None
|
||||
elif isinstance(value, AsDictMixin):
|
||||
# other structure
|
||||
value = type_.as_dict(value)
|
||||
result[field] = value
|
||||
return result
|
||||
|
||||
|
||||
class Structure(ctypes.Structure, AsDictMixin):
|
||||
|
||||
def __init__(self, *args, **kwds):
|
||||
# We don't want to use positional arguments fill PADDING_* fields
|
||||
|
||||
args = dict(zip(self.__class__._field_names_(), args))
|
||||
args.update(kwds)
|
||||
super(Structure, self).__init__(**args)
|
||||
|
||||
@classmethod
|
||||
def _field_names_(cls):
|
||||
if hasattr(cls, '_fields_'):
|
||||
return (f[0] for f in cls._fields_ if not f[0].startswith('PADDING'))
|
||||
else:
|
||||
return ()
|
||||
|
||||
@classmethod
|
||||
def get_type(cls, field):
|
||||
for f in cls._fields_:
|
||||
if f[0] == field:
|
||||
return f[1]
|
||||
return None
|
||||
|
||||
@classmethod
|
||||
def bind(cls, bound_fields):
|
||||
fields = {}
|
||||
for name, type_ in cls._fields_:
|
||||
if hasattr(type_, "restype"):
|
||||
if name in bound_fields:
|
||||
if bound_fields[name] is None:
|
||||
fields[name] = type_()
|
||||
else:
|
||||
# use a closure to capture the callback from the loop scope
|
||||
fields[name] = (
|
||||
type_((lambda callback: lambda *args: callback(*args))(
|
||||
bound_fields[name]))
|
||||
)
|
||||
del bound_fields[name]
|
||||
else:
|
||||
# default callback implementation (does nothing)
|
||||
try:
|
||||
default_ = type_(0).restype().value
|
||||
except TypeError:
|
||||
default_ = None
|
||||
fields[name] = type_((
|
||||
lambda default_: lambda *args: default_)(default_))
|
||||
else:
|
||||
# not a callback function, use default initialization
|
||||
if name in bound_fields:
|
||||
fields[name] = bound_fields[name]
|
||||
del bound_fields[name]
|
||||
else:
|
||||
fields[name] = type_()
|
||||
if len(bound_fields) != 0:
|
||||
raise ValueError(
|
||||
"Cannot bind the following unknown callback(s) {}.{}".format(
|
||||
cls.__name__, bound_fields.keys()
|
||||
))
|
||||
return cls(**fields)
|
||||
|
||||
|
||||
class Union(ctypes.Union, AsDictMixin):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
_libraries = {}
|
||||
_libraries['libpciaccess.so'] = ctypes.CDLL('/usr/lib/x86_64-linux-gnu/libpciaccess.so') if os.path.exists('/usr/lib/x86_64-linux-gnu/libpciaccess.so') else None
|
||||
c_int128 = ctypes.c_ubyte*16
|
||||
c_uint128 = c_int128
|
||||
void = None
|
||||
if ctypes.sizeof(ctypes.c_longdouble) == 16:
|
||||
c_long_double_t = ctypes.c_longdouble
|
||||
else:
|
||||
c_long_double_t = ctypes.c_ubyte*16
|
||||
|
||||
def string_cast(char_pointer, encoding='utf-8', errors='strict'):
|
||||
value = ctypes.cast(char_pointer, ctypes.c_char_p).value
|
||||
if value is not None and encoding is not None:
|
||||
value = value.decode(encoding, errors=errors)
|
||||
return value
|
||||
|
||||
|
||||
def char_pointer_cast(string, encoding='utf-8'):
|
||||
if encoding is not None:
|
||||
try:
|
||||
string = string.encode(encoding)
|
||||
except AttributeError:
|
||||
# In Python3, bytes has no encode attribute
|
||||
pass
|
||||
string = ctypes.c_char_p(string)
|
||||
return ctypes.cast(string, ctypes.POINTER(ctypes.c_char))
|
||||
import ctypes
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
PCIACCESS_H = True # macro
|
||||
# __deprecated = ((deprecated)) # macro
|
||||
PCI_DEV_MAP_FLAG_WRITABLE = (1<<0) # macro
|
||||
PCI_DEV_MAP_FLAG_WRITE_COMBINE = (1<<1) # macro
|
||||
PCI_DEV_MAP_FLAG_CACHABLE = (1<<2) # macro
|
||||
PCI_MATCH_ANY = (~0) # macro
|
||||
def PCI_ID_COMPARE(a, b): # macro
|
||||
return (((a)==(~0)) or ((a)==(b)))
|
||||
VGA_ARB_RSRC_NONE = 0x00 # macro
|
||||
VGA_ARB_RSRC_LEGACY_IO = 0x01 # macro
|
||||
VGA_ARB_RSRC_LEGACY_MEM = 0x02 # macro
|
||||
VGA_ARB_RSRC_NORMAL_IO = 0x04 # macro
|
||||
VGA_ARB_RSRC_NORMAL_MEM = 0x08 # macro
|
||||
pciaddr_t = ctypes.c_uint64
|
||||
class struct_pci_device_iterator(Structure):
|
||||
pass
|
||||
|
||||
class struct_pci_device(Structure):
|
||||
pass
|
||||
|
||||
try:
|
||||
pci_device_has_kernel_driver = _libraries['libpciaccess.so'].pci_device_has_kernel_driver
|
||||
pci_device_has_kernel_driver.restype = ctypes.c_int32
|
||||
pci_device_has_kernel_driver.argtypes = [ctypes.POINTER(struct_pci_device)]
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_device_is_boot_vga = _libraries['libpciaccess.so'].pci_device_is_boot_vga
|
||||
pci_device_is_boot_vga.restype = ctypes.c_int32
|
||||
pci_device_is_boot_vga.argtypes = [ctypes.POINTER(struct_pci_device)]
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_device_read_rom = _libraries['libpciaccess.so'].pci_device_read_rom
|
||||
pci_device_read_rom.restype = ctypes.c_int32
|
||||
pci_device_read_rom.argtypes = [ctypes.POINTER(struct_pci_device), ctypes.POINTER(None)]
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_device_map_region = _libraries['libpciaccess.so'].pci_device_map_region
|
||||
pci_device_map_region.restype = ctypes.c_int32
|
||||
pci_device_map_region.argtypes = [ctypes.POINTER(struct_pci_device), ctypes.c_uint32, ctypes.c_int32]
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_device_unmap_region = _libraries['libpciaccess.so'].pci_device_unmap_region
|
||||
pci_device_unmap_region.restype = ctypes.c_int32
|
||||
pci_device_unmap_region.argtypes = [ctypes.POINTER(struct_pci_device), ctypes.c_uint32]
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_device_map_range = _libraries['libpciaccess.so'].pci_device_map_range
|
||||
pci_device_map_range.restype = ctypes.c_int32
|
||||
pci_device_map_range.argtypes = [ctypes.POINTER(struct_pci_device), pciaddr_t, pciaddr_t, ctypes.c_uint32, ctypes.POINTER(ctypes.POINTER(None))]
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_device_unmap_range = _libraries['libpciaccess.so'].pci_device_unmap_range
|
||||
pci_device_unmap_range.restype = ctypes.c_int32
|
||||
pci_device_unmap_range.argtypes = [ctypes.POINTER(struct_pci_device), ctypes.POINTER(None), pciaddr_t]
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_device_map_memory_range = _libraries['libpciaccess.so'].pci_device_map_memory_range
|
||||
pci_device_map_memory_range.restype = ctypes.c_int32
|
||||
pci_device_map_memory_range.argtypes = [ctypes.POINTER(struct_pci_device), pciaddr_t, pciaddr_t, ctypes.c_int32, ctypes.POINTER(ctypes.POINTER(None))]
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_device_unmap_memory_range = _libraries['libpciaccess.so'].pci_device_unmap_memory_range
|
||||
pci_device_unmap_memory_range.restype = ctypes.c_int32
|
||||
pci_device_unmap_memory_range.argtypes = [ctypes.POINTER(struct_pci_device), ctypes.POINTER(None), pciaddr_t]
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_device_probe = _libraries['libpciaccess.so'].pci_device_probe
|
||||
pci_device_probe.restype = ctypes.c_int32
|
||||
pci_device_probe.argtypes = [ctypes.POINTER(struct_pci_device)]
|
||||
except AttributeError:
|
||||
pass
|
||||
class struct_pci_agp_info(Structure):
|
||||
pass
|
||||
|
||||
try:
|
||||
pci_device_get_agp_info = _libraries['libpciaccess.so'].pci_device_get_agp_info
|
||||
pci_device_get_agp_info.restype = ctypes.POINTER(struct_pci_agp_info)
|
||||
pci_device_get_agp_info.argtypes = [ctypes.POINTER(struct_pci_device)]
|
||||
except AttributeError:
|
||||
pass
|
||||
class struct_pci_bridge_info(Structure):
|
||||
pass
|
||||
|
||||
try:
|
||||
pci_device_get_bridge_info = _libraries['libpciaccess.so'].pci_device_get_bridge_info
|
||||
pci_device_get_bridge_info.restype = ctypes.POINTER(struct_pci_bridge_info)
|
||||
pci_device_get_bridge_info.argtypes = [ctypes.POINTER(struct_pci_device)]
|
||||
except AttributeError:
|
||||
pass
|
||||
class struct_pci_pcmcia_bridge_info(Structure):
|
||||
pass
|
||||
|
||||
try:
|
||||
pci_device_get_pcmcia_bridge_info = _libraries['libpciaccess.so'].pci_device_get_pcmcia_bridge_info
|
||||
pci_device_get_pcmcia_bridge_info.restype = ctypes.POINTER(struct_pci_pcmcia_bridge_info)
|
||||
pci_device_get_pcmcia_bridge_info.argtypes = [ctypes.POINTER(struct_pci_device)]
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_device_get_bridge_buses = _libraries['libpciaccess.so'].pci_device_get_bridge_buses
|
||||
pci_device_get_bridge_buses.restype = ctypes.c_int32
|
||||
pci_device_get_bridge_buses.argtypes = [ctypes.POINTER(struct_pci_device), ctypes.POINTER(ctypes.c_int32), ctypes.POINTER(ctypes.c_int32), ctypes.POINTER(ctypes.c_int32)]
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_system_init = _libraries['libpciaccess.so'].pci_system_init
|
||||
pci_system_init.restype = ctypes.c_int32
|
||||
pci_system_init.argtypes = []
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_system_init_dev_mem = _libraries['libpciaccess.so'].pci_system_init_dev_mem
|
||||
pci_system_init_dev_mem.restype = None
|
||||
pci_system_init_dev_mem.argtypes = [ctypes.c_int32]
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_system_cleanup = _libraries['libpciaccess.so'].pci_system_cleanup
|
||||
pci_system_cleanup.restype = None
|
||||
pci_system_cleanup.argtypes = []
|
||||
except AttributeError:
|
||||
pass
|
||||
class struct_pci_slot_match(Structure):
|
||||
pass
|
||||
|
||||
try:
|
||||
pci_slot_match_iterator_create = _libraries['libpciaccess.so'].pci_slot_match_iterator_create
|
||||
pci_slot_match_iterator_create.restype = ctypes.POINTER(struct_pci_device_iterator)
|
||||
pci_slot_match_iterator_create.argtypes = [ctypes.POINTER(struct_pci_slot_match)]
|
||||
except AttributeError:
|
||||
pass
|
||||
class struct_pci_id_match(Structure):
|
||||
pass
|
||||
|
||||
try:
|
||||
pci_id_match_iterator_create = _libraries['libpciaccess.so'].pci_id_match_iterator_create
|
||||
pci_id_match_iterator_create.restype = ctypes.POINTER(struct_pci_device_iterator)
|
||||
pci_id_match_iterator_create.argtypes = [ctypes.POINTER(struct_pci_id_match)]
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_iterator_destroy = _libraries['libpciaccess.so'].pci_iterator_destroy
|
||||
pci_iterator_destroy.restype = None
|
||||
pci_iterator_destroy.argtypes = [ctypes.POINTER(struct_pci_device_iterator)]
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_device_next = _libraries['libpciaccess.so'].pci_device_next
|
||||
pci_device_next.restype = ctypes.POINTER(struct_pci_device)
|
||||
pci_device_next.argtypes = [ctypes.POINTER(struct_pci_device_iterator)]
|
||||
except AttributeError:
|
||||
pass
|
||||
uint32_t = ctypes.c_uint32
|
||||
try:
|
||||
pci_device_find_by_slot = _libraries['libpciaccess.so'].pci_device_find_by_slot
|
||||
pci_device_find_by_slot.restype = ctypes.POINTER(struct_pci_device)
|
||||
pci_device_find_by_slot.argtypes = [uint32_t, uint32_t, uint32_t, uint32_t]
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_device_get_parent_bridge = _libraries['libpciaccess.so'].pci_device_get_parent_bridge
|
||||
pci_device_get_parent_bridge.restype = ctypes.POINTER(struct_pci_device)
|
||||
pci_device_get_parent_bridge.argtypes = [ctypes.POINTER(struct_pci_device)]
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_get_strings = _libraries['libpciaccess.so'].pci_get_strings
|
||||
pci_get_strings.restype = None
|
||||
pci_get_strings.argtypes = [ctypes.POINTER(struct_pci_id_match), ctypes.POINTER(ctypes.POINTER(ctypes.c_char)), ctypes.POINTER(ctypes.POINTER(ctypes.c_char)), ctypes.POINTER(ctypes.POINTER(ctypes.c_char)), ctypes.POINTER(ctypes.POINTER(ctypes.c_char))]
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_device_get_device_name = _libraries['libpciaccess.so'].pci_device_get_device_name
|
||||
pci_device_get_device_name.restype = ctypes.POINTER(ctypes.c_char)
|
||||
pci_device_get_device_name.argtypes = [ctypes.POINTER(struct_pci_device)]
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_device_get_subdevice_name = _libraries['libpciaccess.so'].pci_device_get_subdevice_name
|
||||
pci_device_get_subdevice_name.restype = ctypes.POINTER(ctypes.c_char)
|
||||
pci_device_get_subdevice_name.argtypes = [ctypes.POINTER(struct_pci_device)]
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_device_get_vendor_name = _libraries['libpciaccess.so'].pci_device_get_vendor_name
|
||||
pci_device_get_vendor_name.restype = ctypes.POINTER(ctypes.c_char)
|
||||
pci_device_get_vendor_name.argtypes = [ctypes.POINTER(struct_pci_device)]
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_device_get_subvendor_name = _libraries['libpciaccess.so'].pci_device_get_subvendor_name
|
||||
pci_device_get_subvendor_name.restype = ctypes.POINTER(ctypes.c_char)
|
||||
pci_device_get_subvendor_name.argtypes = [ctypes.POINTER(struct_pci_device)]
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_device_enable = _libraries['libpciaccess.so'].pci_device_enable
|
||||
pci_device_enable.restype = None
|
||||
pci_device_enable.argtypes = [ctypes.POINTER(struct_pci_device)]
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_device_cfg_read = _libraries['libpciaccess.so'].pci_device_cfg_read
|
||||
pci_device_cfg_read.restype = ctypes.c_int32
|
||||
pci_device_cfg_read.argtypes = [ctypes.POINTER(struct_pci_device), ctypes.POINTER(None), pciaddr_t, pciaddr_t, ctypes.POINTER(ctypes.c_uint64)]
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_device_cfg_read_u8 = _libraries['libpciaccess.so'].pci_device_cfg_read_u8
|
||||
pci_device_cfg_read_u8.restype = ctypes.c_int32
|
||||
pci_device_cfg_read_u8.argtypes = [ctypes.POINTER(struct_pci_device), ctypes.POINTER(ctypes.c_ubyte), pciaddr_t]
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_device_cfg_read_u16 = _libraries['libpciaccess.so'].pci_device_cfg_read_u16
|
||||
pci_device_cfg_read_u16.restype = ctypes.c_int32
|
||||
pci_device_cfg_read_u16.argtypes = [ctypes.POINTER(struct_pci_device), ctypes.POINTER(ctypes.c_uint16), pciaddr_t]
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_device_cfg_read_u32 = _libraries['libpciaccess.so'].pci_device_cfg_read_u32
|
||||
pci_device_cfg_read_u32.restype = ctypes.c_int32
|
||||
pci_device_cfg_read_u32.argtypes = [ctypes.POINTER(struct_pci_device), ctypes.POINTER(ctypes.c_uint32), pciaddr_t]
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_device_cfg_write = _libraries['libpciaccess.so'].pci_device_cfg_write
|
||||
pci_device_cfg_write.restype = ctypes.c_int32
|
||||
pci_device_cfg_write.argtypes = [ctypes.POINTER(struct_pci_device), ctypes.POINTER(None), pciaddr_t, pciaddr_t, ctypes.POINTER(ctypes.c_uint64)]
|
||||
except AttributeError:
|
||||
pass
|
||||
uint8_t = ctypes.c_uint8
|
||||
try:
|
||||
pci_device_cfg_write_u8 = _libraries['libpciaccess.so'].pci_device_cfg_write_u8
|
||||
pci_device_cfg_write_u8.restype = ctypes.c_int32
|
||||
pci_device_cfg_write_u8.argtypes = [ctypes.POINTER(struct_pci_device), uint8_t, pciaddr_t]
|
||||
except AttributeError:
|
||||
pass
|
||||
uint16_t = ctypes.c_uint16
|
||||
try:
|
||||
pci_device_cfg_write_u16 = _libraries['libpciaccess.so'].pci_device_cfg_write_u16
|
||||
pci_device_cfg_write_u16.restype = ctypes.c_int32
|
||||
pci_device_cfg_write_u16.argtypes = [ctypes.POINTER(struct_pci_device), uint16_t, pciaddr_t]
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_device_cfg_write_u32 = _libraries['libpciaccess.so'].pci_device_cfg_write_u32
|
||||
pci_device_cfg_write_u32.restype = ctypes.c_int32
|
||||
pci_device_cfg_write_u32.argtypes = [ctypes.POINTER(struct_pci_device), uint32_t, pciaddr_t]
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_device_cfg_write_bits = _libraries['libpciaccess.so'].pci_device_cfg_write_bits
|
||||
pci_device_cfg_write_bits.restype = ctypes.c_int32
|
||||
pci_device_cfg_write_bits.argtypes = [ctypes.POINTER(struct_pci_device), uint32_t, uint32_t, pciaddr_t]
|
||||
except AttributeError:
|
||||
pass
|
||||
class struct_pci_mem_region(Structure):
|
||||
pass
|
||||
|
||||
struct_pci_mem_region._pack_ = 1 # source:False
|
||||
struct_pci_mem_region._fields_ = [
|
||||
('memory', ctypes.POINTER(None)),
|
||||
('bus_addr', ctypes.c_uint64),
|
||||
('base_addr', ctypes.c_uint64),
|
||||
('size', ctypes.c_uint64),
|
||||
('is_IO', ctypes.c_uint32, 1),
|
||||
('is_prefetchable', ctypes.c_uint32, 1),
|
||||
('is_64', ctypes.c_uint32, 1),
|
||||
('PADDING_0', ctypes.c_uint64, 61),
|
||||
]
|
||||
|
||||
class struct_pci_pcmcia_bridge_info_0(Structure):
|
||||
pass
|
||||
|
||||
struct_pci_pcmcia_bridge_info_0._pack_ = 1 # source:False
|
||||
struct_pci_pcmcia_bridge_info_0._fields_ = [
|
||||
('base', ctypes.c_uint32),
|
||||
('limit', ctypes.c_uint32),
|
||||
]
|
||||
|
||||
class struct_pci_pcmcia_bridge_info_1(Structure):
|
||||
pass
|
||||
|
||||
struct_pci_pcmcia_bridge_info_1._pack_ = 1 # source:False
|
||||
struct_pci_pcmcia_bridge_info_1._fields_ = [
|
||||
('base', ctypes.c_uint32),
|
||||
('limit', ctypes.c_uint32),
|
||||
]
|
||||
|
||||
try:
|
||||
pci_device_vgaarb_init = _libraries['libpciaccess.so'].pci_device_vgaarb_init
|
||||
pci_device_vgaarb_init.restype = ctypes.c_int32
|
||||
pci_device_vgaarb_init.argtypes = []
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_device_vgaarb_fini = _libraries['libpciaccess.so'].pci_device_vgaarb_fini
|
||||
pci_device_vgaarb_fini.restype = None
|
||||
pci_device_vgaarb_fini.argtypes = []
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_device_vgaarb_set_target = _libraries['libpciaccess.so'].pci_device_vgaarb_set_target
|
||||
pci_device_vgaarb_set_target.restype = ctypes.c_int32
|
||||
pci_device_vgaarb_set_target.argtypes = [ctypes.POINTER(struct_pci_device)]
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_device_vgaarb_decodes = _libraries['libpciaccess.so'].pci_device_vgaarb_decodes
|
||||
pci_device_vgaarb_decodes.restype = ctypes.c_int32
|
||||
pci_device_vgaarb_decodes.argtypes = [ctypes.c_int32]
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_device_vgaarb_lock = _libraries['libpciaccess.so'].pci_device_vgaarb_lock
|
||||
pci_device_vgaarb_lock.restype = ctypes.c_int32
|
||||
pci_device_vgaarb_lock.argtypes = []
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_device_vgaarb_trylock = _libraries['libpciaccess.so'].pci_device_vgaarb_trylock
|
||||
pci_device_vgaarb_trylock.restype = ctypes.c_int32
|
||||
pci_device_vgaarb_trylock.argtypes = []
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_device_vgaarb_unlock = _libraries['libpciaccess.so'].pci_device_vgaarb_unlock
|
||||
pci_device_vgaarb_unlock.restype = ctypes.c_int32
|
||||
pci_device_vgaarb_unlock.argtypes = []
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_device_vgaarb_get_info = _libraries['libpciaccess.so'].pci_device_vgaarb_get_info
|
||||
pci_device_vgaarb_get_info.restype = ctypes.c_int32
|
||||
pci_device_vgaarb_get_info.argtypes = [ctypes.POINTER(struct_pci_device), ctypes.POINTER(ctypes.c_int32), ctypes.POINTER(ctypes.c_int32)]
|
||||
except AttributeError:
|
||||
pass
|
||||
class struct_pci_io_handle(Structure):
|
||||
pass
|
||||
|
||||
try:
|
||||
pci_device_open_io = _libraries['libpciaccess.so'].pci_device_open_io
|
||||
pci_device_open_io.restype = ctypes.POINTER(struct_pci_io_handle)
|
||||
pci_device_open_io.argtypes = [ctypes.POINTER(struct_pci_device), pciaddr_t, pciaddr_t]
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_legacy_open_io = _libraries['libpciaccess.so'].pci_legacy_open_io
|
||||
pci_legacy_open_io.restype = ctypes.POINTER(struct_pci_io_handle)
|
||||
pci_legacy_open_io.argtypes = [ctypes.POINTER(struct_pci_device), pciaddr_t, pciaddr_t]
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_device_close_io = _libraries['libpciaccess.so'].pci_device_close_io
|
||||
pci_device_close_io.restype = None
|
||||
pci_device_close_io.argtypes = [ctypes.POINTER(struct_pci_device), ctypes.POINTER(struct_pci_io_handle)]
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_io_read32 = _libraries['libpciaccess.so'].pci_io_read32
|
||||
pci_io_read32.restype = uint32_t
|
||||
pci_io_read32.argtypes = [ctypes.POINTER(struct_pci_io_handle), uint32_t]
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_io_read16 = _libraries['libpciaccess.so'].pci_io_read16
|
||||
pci_io_read16.restype = uint16_t
|
||||
pci_io_read16.argtypes = [ctypes.POINTER(struct_pci_io_handle), uint32_t]
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_io_read8 = _libraries['libpciaccess.so'].pci_io_read8
|
||||
pci_io_read8.restype = uint8_t
|
||||
pci_io_read8.argtypes = [ctypes.POINTER(struct_pci_io_handle), uint32_t]
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_io_write32 = _libraries['libpciaccess.so'].pci_io_write32
|
||||
pci_io_write32.restype = None
|
||||
pci_io_write32.argtypes = [ctypes.POINTER(struct_pci_io_handle), uint32_t, uint32_t]
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_io_write16 = _libraries['libpciaccess.so'].pci_io_write16
|
||||
pci_io_write16.restype = None
|
||||
pci_io_write16.argtypes = [ctypes.POINTER(struct_pci_io_handle), uint32_t, uint16_t]
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_io_write8 = _libraries['libpciaccess.so'].pci_io_write8
|
||||
pci_io_write8.restype = None
|
||||
pci_io_write8.argtypes = [ctypes.POINTER(struct_pci_io_handle), uint32_t, uint8_t]
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_device_map_legacy = _libraries['libpciaccess.so'].pci_device_map_legacy
|
||||
pci_device_map_legacy.restype = ctypes.c_int32
|
||||
pci_device_map_legacy.argtypes = [ctypes.POINTER(struct_pci_device), pciaddr_t, pciaddr_t, ctypes.c_uint32, ctypes.POINTER(ctypes.POINTER(None))]
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
pci_device_unmap_legacy = _libraries['libpciaccess.so'].pci_device_unmap_legacy
|
||||
pci_device_unmap_legacy.restype = ctypes.c_int32
|
||||
pci_device_unmap_legacy.argtypes = [ctypes.POINTER(struct_pci_device), ctypes.POINTER(None), pciaddr_t]
|
||||
except AttributeError:
|
||||
pass
|
||||
LINUX_PCI_REGS_H = True # macro
|
||||
PCI_CFG_SPACE_SIZE = 256 # macro
|
||||
PCI_CFG_SPACE_EXP_SIZE = 4096 # macro
|
||||
@@ -1504,103 +951,6 @@ PCI_PL_16GT_LE_CTRL = 0x20 # macro
|
||||
PCI_PL_16GT_LE_CTRL_DSP_TX_PRESET_MASK = 0x0000000F # macro
|
||||
PCI_PL_16GT_LE_CTRL_USP_TX_PRESET_MASK = 0x000000F0 # macro
|
||||
PCI_PL_16GT_LE_CTRL_USP_TX_PRESET_SHIFT = 4 # macro
|
||||
struct_pci_device._pack_ = 1 # source:False
|
||||
struct_pci_device._fields_ = [
|
||||
('domain_16', ctypes.c_uint16),
|
||||
('bus', ctypes.c_ubyte),
|
||||
('dev', ctypes.c_ubyte),
|
||||
('func', ctypes.c_ubyte),
|
||||
('PADDING_0', ctypes.c_ubyte),
|
||||
('vendor_id', ctypes.c_uint16),
|
||||
('device_id', ctypes.c_uint16),
|
||||
('subvendor_id', ctypes.c_uint16),
|
||||
('subdevice_id', ctypes.c_uint16),
|
||||
('PADDING_1', ctypes.c_ubyte * 2),
|
||||
('device_class', ctypes.c_uint32),
|
||||
('revision', ctypes.c_ubyte),
|
||||
('PADDING_2', ctypes.c_ubyte * 3),
|
||||
('regions', struct_pci_mem_region * 6),
|
||||
('rom_size', ctypes.c_uint64),
|
||||
('irq', ctypes.c_int32),
|
||||
('PADDING_3', ctypes.c_ubyte * 4),
|
||||
('user_data', ctypes.c_int64),
|
||||
('vgaarb_rsrc', ctypes.c_int32),
|
||||
('domain', ctypes.c_uint32),
|
||||
]
|
||||
|
||||
struct_pci_agp_info._pack_ = 1 # source:False
|
||||
struct_pci_agp_info._fields_ = [
|
||||
('config_offset', ctypes.c_uint32),
|
||||
('major_version', ctypes.c_ubyte),
|
||||
('minor_version', ctypes.c_ubyte),
|
||||
('rates', ctypes.c_ubyte),
|
||||
('fast_writes', ctypes.c_uint32, 1),
|
||||
('addr64', ctypes.c_uint32, 1),
|
||||
('htrans', ctypes.c_uint32, 1),
|
||||
('gart64', ctypes.c_uint32, 1),
|
||||
('coherent', ctypes.c_uint32, 1),
|
||||
('sideband', ctypes.c_uint32, 1),
|
||||
('isochronus', ctypes.c_uint32, 1),
|
||||
('PADDING_0', ctypes.c_uint8, 1),
|
||||
('async_req_size', ctypes.c_uint32, 8),
|
||||
('calibration_cycle_timing', ctypes.c_ubyte),
|
||||
('max_requests', ctypes.c_ubyte),
|
||||
('PADDING_1', ctypes.c_ubyte),
|
||||
]
|
||||
|
||||
struct_pci_bridge_info._pack_ = 1 # source:False
|
||||
struct_pci_bridge_info._fields_ = [
|
||||
('primary_bus', ctypes.c_ubyte),
|
||||
('secondary_bus', ctypes.c_ubyte),
|
||||
('subordinate_bus', ctypes.c_ubyte),
|
||||
('secondary_latency_timer', ctypes.c_ubyte),
|
||||
('io_type', ctypes.c_ubyte),
|
||||
('mem_type', ctypes.c_ubyte),
|
||||
('prefetch_mem_type', ctypes.c_ubyte),
|
||||
('PADDING_0', ctypes.c_ubyte),
|
||||
('secondary_status', ctypes.c_uint16),
|
||||
('bridge_control', ctypes.c_uint16),
|
||||
('io_base', ctypes.c_uint32),
|
||||
('io_limit', ctypes.c_uint32),
|
||||
('mem_base', ctypes.c_uint32),
|
||||
('mem_limit', ctypes.c_uint32),
|
||||
('PADDING_1', ctypes.c_ubyte * 4),
|
||||
('prefetch_mem_base', ctypes.c_uint64),
|
||||
('prefetch_mem_limit', ctypes.c_uint64),
|
||||
]
|
||||
|
||||
struct_pci_pcmcia_bridge_info._pack_ = 1 # source:False
|
||||
struct_pci_pcmcia_bridge_info._fields_ = [
|
||||
('primary_bus', ctypes.c_ubyte),
|
||||
('card_bus', ctypes.c_ubyte),
|
||||
('subordinate_bus', ctypes.c_ubyte),
|
||||
('cardbus_latency_timer', ctypes.c_ubyte),
|
||||
('secondary_status', ctypes.c_uint16),
|
||||
('bridge_control', ctypes.c_uint16),
|
||||
('io', struct_pci_pcmcia_bridge_info_0 * 2),
|
||||
('mem', struct_pci_pcmcia_bridge_info_1 * 2),
|
||||
]
|
||||
|
||||
struct_pci_slot_match._pack_ = 1 # source:False
|
||||
struct_pci_slot_match._fields_ = [
|
||||
('domain', ctypes.c_uint32),
|
||||
('bus', ctypes.c_uint32),
|
||||
('dev', ctypes.c_uint32),
|
||||
('func', ctypes.c_uint32),
|
||||
('match_data', ctypes.c_int64),
|
||||
]
|
||||
|
||||
struct_pci_id_match._pack_ = 1 # source:False
|
||||
struct_pci_id_match._fields_ = [
|
||||
('vendor_id', ctypes.c_uint32),
|
||||
('device_id', ctypes.c_uint32),
|
||||
('subvendor_id', ctypes.c_uint32),
|
||||
('subdevice_id', ctypes.c_uint32),
|
||||
('device_class', ctypes.c_uint32),
|
||||
('device_class_mask', ctypes.c_uint32),
|
||||
('match_data', ctypes.c_int64),
|
||||
]
|
||||
|
||||
__all__ = \
|
||||
['HT_3BIT_CAP_MASK', 'HT_5BIT_CAP_MASK',
|
||||
'HT_CAPTYPE_DIRECT_ROUTE', 'HT_CAPTYPE_ERROR_RETRY',
|
||||
@@ -1611,8 +961,8 @@ __all__ = \
|
||||
'HT_CAP_SIZEOF_LONG', 'HT_CAP_SIZEOF_SHORT', 'HT_MSI_ADDR_HI',
|
||||
'HT_MSI_ADDR_LO', 'HT_MSI_ADDR_LO_MASK', 'HT_MSI_FIXED_ADDR',
|
||||
'HT_MSI_FLAGS', 'HT_MSI_FLAGS_ENABLE', 'HT_MSI_FLAGS_FIXED',
|
||||
'LINUX_PCI_REGS_H', 'PCIACCESS_H', 'PCI_ACS_CAP', 'PCI_ACS_CR',
|
||||
'PCI_ACS_CTRL', 'PCI_ACS_DT', 'PCI_ACS_EC', 'PCI_ACS_EGRESS_BITS',
|
||||
'LINUX_PCI_REGS_H', 'PCI_ACS_CAP', 'PCI_ACS_CR', 'PCI_ACS_CTRL',
|
||||
'PCI_ACS_DT', 'PCI_ACS_EC', 'PCI_ACS_EGRESS_BITS',
|
||||
'PCI_ACS_EGRESS_CTL_V', 'PCI_ACS_RR', 'PCI_ACS_SV', 'PCI_ACS_TB',
|
||||
'PCI_ACS_UF', 'PCI_AF_CAP', 'PCI_AF_CAP_FLR', 'PCI_AF_CAP_TP',
|
||||
'PCI_AF_CTRL', 'PCI_AF_CTRL_FLR', 'PCI_AF_LENGTH',
|
||||
@@ -1684,10 +1034,8 @@ __all__ = \
|
||||
'PCI_COMMAND_IO', 'PCI_COMMAND_MASTER', 'PCI_COMMAND_MEMORY',
|
||||
'PCI_COMMAND_PARITY', 'PCI_COMMAND_SERR', 'PCI_COMMAND_SPECIAL',
|
||||
'PCI_COMMAND_VGA_PALETTE', 'PCI_COMMAND_WAIT', 'PCI_DEVICE_ID',
|
||||
'PCI_DEV_MAP_FLAG_CACHABLE', 'PCI_DEV_MAP_FLAG_WRITABLE',
|
||||
'PCI_DEV_MAP_FLAG_WRITE_COMBINE', 'PCI_DLF_CAP',
|
||||
'PCI_DLF_EXCHANGE_ENABLE', 'PCI_DPA_BASE_SIZEOF', 'PCI_DPA_CAP',
|
||||
'PCI_DPA_CAP_SUBSTATE_MASK', 'PCI_DVSEC_HEADER1',
|
||||
'PCI_DLF_CAP', 'PCI_DLF_EXCHANGE_ENABLE', 'PCI_DPA_BASE_SIZEOF',
|
||||
'PCI_DPA_CAP', 'PCI_DPA_CAP_SUBSTATE_MASK', 'PCI_DVSEC_HEADER1',
|
||||
'PCI_DVSEC_HEADER2', 'PCI_EA_BASE', 'PCI_EA_BEI',
|
||||
'PCI_EA_BEI_BAR0', 'PCI_EA_BEI_BAR5', 'PCI_EA_BEI_BRIDGE',
|
||||
'PCI_EA_BEI_ENI', 'PCI_EA_BEI_RESERVED', 'PCI_EA_BEI_ROM',
|
||||
@@ -1873,26 +1221,25 @@ __all__ = \
|
||||
'PCI_L1SS_CTL1_PCIPM_L1_2', 'PCI_L1SS_CTL2', 'PCI_LATENCY_TIMER',
|
||||
'PCI_LTR_MAX_NOSNOOP_LAT', 'PCI_LTR_MAX_SNOOP_LAT',
|
||||
'PCI_LTR_SCALE_MASK', 'PCI_LTR_SCALE_SHIFT', 'PCI_LTR_VALUE_MASK',
|
||||
'PCI_MATCH_ANY', 'PCI_MAX_LAT', 'PCI_MEMORY_BASE',
|
||||
'PCI_MEMORY_LIMIT', 'PCI_MEMORY_RANGE_MASK',
|
||||
'PCI_MEMORY_RANGE_TYPE_MASK', 'PCI_MIN_GNT',
|
||||
'PCI_MSIX_ENTRY_CTRL_MASKBIT', 'PCI_MSIX_ENTRY_DATA',
|
||||
'PCI_MSIX_ENTRY_LOWER_ADDR', 'PCI_MSIX_ENTRY_SIZE',
|
||||
'PCI_MSIX_ENTRY_UPPER_ADDR', 'PCI_MSIX_ENTRY_VECTOR_CTRL',
|
||||
'PCI_MSIX_FLAGS', 'PCI_MSIX_FLAGS_BIRMASK',
|
||||
'PCI_MSIX_FLAGS_ENABLE', 'PCI_MSIX_FLAGS_MASKALL',
|
||||
'PCI_MSIX_FLAGS_QSIZE', 'PCI_MSIX_PBA', 'PCI_MSIX_PBA_BIR',
|
||||
'PCI_MSIX_PBA_OFFSET', 'PCI_MSIX_TABLE', 'PCI_MSIX_TABLE_BIR',
|
||||
'PCI_MSIX_TABLE_OFFSET', 'PCI_MSI_ADDRESS_HI',
|
||||
'PCI_MSI_ADDRESS_LO', 'PCI_MSI_DATA_32', 'PCI_MSI_DATA_64',
|
||||
'PCI_MSI_FLAGS', 'PCI_MSI_FLAGS_64BIT', 'PCI_MSI_FLAGS_ENABLE',
|
||||
'PCI_MSI_FLAGS_MASKBIT', 'PCI_MSI_FLAGS_QMASK',
|
||||
'PCI_MSI_FLAGS_QSIZE', 'PCI_MSI_MASK_32', 'PCI_MSI_MASK_64',
|
||||
'PCI_MSI_PENDING_32', 'PCI_MSI_PENDING_64', 'PCI_MSI_RFU',
|
||||
'PCI_PASID_CAP', 'PCI_PASID_CAP_EXEC', 'PCI_PASID_CAP_PRIV',
|
||||
'PCI_PASID_CTRL', 'PCI_PASID_CTRL_ENABLE', 'PCI_PASID_CTRL_EXEC',
|
||||
'PCI_PASID_CTRL_PRIV', 'PCI_PL_16GT_LE_CTRL',
|
||||
'PCI_PL_16GT_LE_CTRL_DSP_TX_PRESET_MASK',
|
||||
'PCI_MAX_LAT', 'PCI_MEMORY_BASE', 'PCI_MEMORY_LIMIT',
|
||||
'PCI_MEMORY_RANGE_MASK', 'PCI_MEMORY_RANGE_TYPE_MASK',
|
||||
'PCI_MIN_GNT', 'PCI_MSIX_ENTRY_CTRL_MASKBIT',
|
||||
'PCI_MSIX_ENTRY_DATA', 'PCI_MSIX_ENTRY_LOWER_ADDR',
|
||||
'PCI_MSIX_ENTRY_SIZE', 'PCI_MSIX_ENTRY_UPPER_ADDR',
|
||||
'PCI_MSIX_ENTRY_VECTOR_CTRL', 'PCI_MSIX_FLAGS',
|
||||
'PCI_MSIX_FLAGS_BIRMASK', 'PCI_MSIX_FLAGS_ENABLE',
|
||||
'PCI_MSIX_FLAGS_MASKALL', 'PCI_MSIX_FLAGS_QSIZE', 'PCI_MSIX_PBA',
|
||||
'PCI_MSIX_PBA_BIR', 'PCI_MSIX_PBA_OFFSET', 'PCI_MSIX_TABLE',
|
||||
'PCI_MSIX_TABLE_BIR', 'PCI_MSIX_TABLE_OFFSET',
|
||||
'PCI_MSI_ADDRESS_HI', 'PCI_MSI_ADDRESS_LO', 'PCI_MSI_DATA_32',
|
||||
'PCI_MSI_DATA_64', 'PCI_MSI_FLAGS', 'PCI_MSI_FLAGS_64BIT',
|
||||
'PCI_MSI_FLAGS_ENABLE', 'PCI_MSI_FLAGS_MASKBIT',
|
||||
'PCI_MSI_FLAGS_QMASK', 'PCI_MSI_FLAGS_QSIZE', 'PCI_MSI_MASK_32',
|
||||
'PCI_MSI_MASK_64', 'PCI_MSI_PENDING_32', 'PCI_MSI_PENDING_64',
|
||||
'PCI_MSI_RFU', 'PCI_PASID_CAP', 'PCI_PASID_CAP_EXEC',
|
||||
'PCI_PASID_CAP_PRIV', 'PCI_PASID_CTRL', 'PCI_PASID_CTRL_ENABLE',
|
||||
'PCI_PASID_CTRL_EXEC', 'PCI_PASID_CTRL_PRIV',
|
||||
'PCI_PL_16GT_LE_CTRL', 'PCI_PL_16GT_LE_CTRL_DSP_TX_PRESET_MASK',
|
||||
'PCI_PL_16GT_LE_CTRL_USP_TX_PRESET_MASK',
|
||||
'PCI_PL_16GT_LE_CTRL_USP_TX_PRESET_SHIFT', 'PCI_PM_BPCC_ENABLE',
|
||||
'PCI_PM_CAP_AUX_POWER', 'PCI_PM_CAP_D1', 'PCI_PM_CAP_D2',
|
||||
@@ -1983,41 +1330,4 @@ __all__ = \
|
||||
'PCI_X_STATUS_COMPLEX', 'PCI_X_STATUS_DEVFN',
|
||||
'PCI_X_STATUS_MAX_CUM', 'PCI_X_STATUS_MAX_READ',
|
||||
'PCI_X_STATUS_MAX_SPLIT', 'PCI_X_STATUS_SPL_DISC',
|
||||
'PCI_X_STATUS_SPL_ERR', 'PCI_X_STATUS_UNX_SPL',
|
||||
'VGA_ARB_RSRC_LEGACY_IO', 'VGA_ARB_RSRC_LEGACY_MEM',
|
||||
'VGA_ARB_RSRC_NONE', 'VGA_ARB_RSRC_NORMAL_IO',
|
||||
'VGA_ARB_RSRC_NORMAL_MEM', 'pci_device_cfg_read',
|
||||
'pci_device_cfg_read_u16', 'pci_device_cfg_read_u32',
|
||||
'pci_device_cfg_read_u8', 'pci_device_cfg_write',
|
||||
'pci_device_cfg_write_bits', 'pci_device_cfg_write_u16',
|
||||
'pci_device_cfg_write_u32', 'pci_device_cfg_write_u8',
|
||||
'pci_device_close_io', 'pci_device_enable',
|
||||
'pci_device_find_by_slot', 'pci_device_get_agp_info',
|
||||
'pci_device_get_bridge_buses', 'pci_device_get_bridge_info',
|
||||
'pci_device_get_device_name', 'pci_device_get_parent_bridge',
|
||||
'pci_device_get_pcmcia_bridge_info',
|
||||
'pci_device_get_subdevice_name', 'pci_device_get_subvendor_name',
|
||||
'pci_device_get_vendor_name', 'pci_device_has_kernel_driver',
|
||||
'pci_device_is_boot_vga', 'pci_device_map_legacy',
|
||||
'pci_device_map_memory_range', 'pci_device_map_range',
|
||||
'pci_device_map_region', 'pci_device_next', 'pci_device_open_io',
|
||||
'pci_device_probe', 'pci_device_read_rom',
|
||||
'pci_device_unmap_legacy', 'pci_device_unmap_memory_range',
|
||||
'pci_device_unmap_range', 'pci_device_unmap_region',
|
||||
'pci_device_vgaarb_decodes', 'pci_device_vgaarb_fini',
|
||||
'pci_device_vgaarb_get_info', 'pci_device_vgaarb_init',
|
||||
'pci_device_vgaarb_lock', 'pci_device_vgaarb_set_target',
|
||||
'pci_device_vgaarb_trylock', 'pci_device_vgaarb_unlock',
|
||||
'pci_get_strings', 'pci_id_match_iterator_create',
|
||||
'pci_io_read16', 'pci_io_read32', 'pci_io_read8',
|
||||
'pci_io_write16', 'pci_io_write32', 'pci_io_write8',
|
||||
'pci_iterator_destroy', 'pci_legacy_open_io',
|
||||
'pci_slot_match_iterator_create', 'pci_system_cleanup',
|
||||
'pci_system_init', 'pci_system_init_dev_mem', 'pciaddr_t',
|
||||
'struct_pci_agp_info', 'struct_pci_bridge_info',
|
||||
'struct_pci_device', 'struct_pci_device_iterator',
|
||||
'struct_pci_id_match', 'struct_pci_io_handle',
|
||||
'struct_pci_mem_region', 'struct_pci_pcmcia_bridge_info',
|
||||
'struct_pci_pcmcia_bridge_info_0',
|
||||
'struct_pci_pcmcia_bridge_info_1', 'struct_pci_slot_match',
|
||||
'uint16_t', 'uint32_t', 'uint8_t']
|
||||
'PCI_X_STATUS_SPL_ERR', 'PCI_X_STATUS_UNX_SPL']
|
||||
@@ -8,7 +8,7 @@ from tinygrad.ops import sint
|
||||
from tinygrad.device import BufferSpec
|
||||
from tinygrad.helpers import getenv, to_mv, round_up, data64_le, mv_address, DEBUG, OSX
|
||||
from tinygrad.renderer.cstyle import AMDRenderer
|
||||
from tinygrad.runtime.autogen import kfd, hsa, amd_gpu, libc, libpciaccess, vfio
|
||||
from tinygrad.runtime.autogen import kfd, hsa, amd_gpu, libc, pci, vfio
|
||||
from tinygrad.runtime.autogen.am import am
|
||||
from tinygrad.runtime.support.compiler_hip import AMDCompiler
|
||||
from tinygrad.runtime.support.elf import elf_loader
|
||||
@@ -494,8 +494,8 @@ class PCIIface:
|
||||
self.adev = AMDev(self.pcibus, self._map_pci_range(0), dbell:=self._map_pci_range(2).cast('Q'), self._map_pci_range(5).cast('I'))
|
||||
self.doorbell_cpu_addr = mv_address(dbell)
|
||||
|
||||
pci_cmd = int.from_bytes(self.cfg_fd.read(2, binary=True, offset=libpciaccess.PCI_COMMAND), byteorder='little') | libpciaccess.PCI_COMMAND_MASTER
|
||||
self.cfg_fd.write(pci_cmd.to_bytes(2, byteorder='little'), binary=True, offset=libpciaccess.PCI_COMMAND)
|
||||
pci_cmd = int.from_bytes(self.cfg_fd.read(2, binary=True, offset=pci.PCI_COMMAND), byteorder='little') | pci.PCI_COMMAND_MASTER
|
||||
self.cfg_fd.write(pci_cmd.to_bytes(2, byteorder='little'), binary=True, offset=pci.PCI_COMMAND)
|
||||
|
||||
array_count = self.adev.gc_info.gc_num_sa_per_se * self.adev.gc_info.gc_num_se
|
||||
simd_count = 2 * array_count * (self.adev.gc_info.gc_num_wgp0_per_sa + self.adev.gc_info.gc_num_wgp1_per_sa)
|
||||
|
||||
Reference in New Issue
Block a user