2 * The PCI Library -- Access to i386 I/O ports on GNU Hurd
4 * Copyright (c) 2003 Marco Gerards <metgerards@student.han.nl>
5 * Copyright (c) 2003 Martin Mares <mj@ucw.cz>
6 * Copyright (c) 2006 Samuel Thibault <samuel.thibault@ens-lyon.org> and
7 * Thomas Schwinge <tschwinge@gnu.org>
9 * Can be freely distributed and used under the terms of the GNU GPL.
14 #include <mach/machine/mach_i386.h>
15 #include <device/device.h>
20 static mach_port_t io_port;
23 intel_setup_io(struct pci_access *a)
27 if ((errno = get_privileged_ports(NULL, &device)))
28 a->warn("i386-io-hurd: Can't get_privileged_ports(): %m");
30 if (!errno && (errno = device_open(device, D_READ | D_WRITE, "io", &io_port)))
31 a->warn("i386-io-hurd: Can't device_open(): %m");
33 mach_port_deallocate(mach_task_self(), device);
35 if (!errno && (errno = i386_io_port_add(mach_thread_self(), io_port)))
36 a->warn("i386-io-hurd: Can't i386_io_port_add(): %m");
42 intel_cleanup_io(struct pci_access *a)
44 if ((errno = i386_io_port_remove(mach_thread_self(), io_port)))
45 a->warn("i386-io-hurd: Can't i386_io_port_remove(): %m");
47 mach_port_deallocate(mach_task_self(), io_port);