Hello, Here is a fixed version, tried on GNU/Hurd: note that pci_mem_region has a base_addr field, not base.
Samuel Signed-off-by: Samuel Thibault <[email protected]> Signed-off-by: Adam Jackson <[email protected]> --- src/x86_pci.c.original 2010-10-23 20:22:31.000000000 +0000 +++ src/x86_pci.c 2010-10-23 20:23:38.000000000 +0000 @@ -5,6 +5,7 @@ * (C) Copyright IBM Corporation 2006 * Copyright (c) 2008 Juan Romero Pardines * Copyright (c) 2008 Mark Kettenis + * Copyright 2010 Red Hat, Inc. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -544,6 +545,73 @@ return 0; } +static struct pci_io_handle * +pci_device_x86_open_legacy_io(struct pci_io_handle *ret, + struct pci_device *dev, pciaddr_t base, + pciaddr_t size) +{ + ret->base = base; + ret->size = size; + + return ret; +} + +static struct pci_io_handle * +pci_device_x86_open_device_io(struct pci_io_handle *ret, + struct pci_device *dev, int bar, + pciaddr_t base, pciaddr_t size) +{ + return pci_device_x86_open_legacy_io(ret, dev, + dev->regions[bar].base_addr + base, + size); + +} + +static void +pci_device_x86_close_io(struct pci_device *dev, + struct pci_io_handle *handle) +{ +} + +static uint32_t +pci_device_x86_read32(struct pci_io_handle *handle, uint32_t port) +{ + return inl(port + handle->base); +} + +static uint16_t +pci_device_x86_read16(struct pci_io_handle *handle, uint32_t port) +{ + return inw(port + handle->base); +} + +static uint8_t +pci_device_x86_read8(struct pci_io_handle *handle, uint32_t port) +{ + return inb(port + handle->base); +} + +static void +pci_device_x86_write32(struct pci_io_handle *handle, uint32_t port, + uint32_t data) +{ + outl(data, port + handle->base); +} + +static void +pci_device_x86_write16(struct pci_io_handle *handle, uint32_t port, + uint16_t data) +{ + outw(data, port + handle->base); +} + +static void +pci_device_x86_write8(struct pci_io_handle *handle, uint32_t port, + uint8_t data) +{ + outb(data, port + handle->base); +} + static void pci_system_x86_destroy(void) { @@ -559,6 +627,15 @@ .read = pci_device_x86_read, .write = pci_device_x86_write, .fill_capabilities = pci_fill_capabilities_generic, + .open_device_io = pci_device_x86_open_device_io, + .open_legacy_io = pci_device_x86_open_legacy_io, + .close_io = pci_device_x86_close_io, + .read32 = pci_device_x86_read32, + .read16 = pci_device_x86_read16, + .read8 = pci_device_x86_read8, + .write32 = pci_device_x86_write32, + .write16 = pci_device_x86_write16, + .write8 = pci_device_x86_write8, }; static int pci_probe(struct pci_system_x86 *pci_sys_x86) _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
