From 9929ff6b5b1ef6d7ebf19351b6b7094c207e9282 Mon Sep 17 00:00:00 2001 From: Marcel Moolenaar Date: Fri, 29 Apr 2005 02:03:11 +0000 Subject: [PATCH] Add pci_is_vga_ioport_range() and pci_is_vga_memory_range() as inline functions. These functions centralize the details of which I/O port and memory ranges belong to VGA. Reviewed by: imp@, jhb@ --- sys/dev/pci/pcivar.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/sys/dev/pci/pcivar.h b/sys/dev/pci/pcivar.h index 75bc8d3f9e4d..c90d6591983e 100644 --- a/sys/dev/pci/pcivar.h +++ b/sys/dev/pci/pcivar.h @@ -287,6 +287,24 @@ pci_disable_io(device_t dev, int space) return(PCI_DISABLE_IO(device_get_parent(dev), dev, space)); } +/* + * Check if the address range falls within the VGA defined address range(s) + */ +static __inline int +pci_is_vga_ioport_range(u_long start, u_long end) +{ + + return (((start >= 0x3b0 && end <= 0x3bb) || + (start >= 0x3c0 && end <= 0x3df)) ? 1 : 0); +} + +static __inline int +pci_is_vga_memory_range(u_long start, u_long end) +{ + + return ((start >= 0xa0000 && end <= 0xbffff) ? 1 : 0); +} + /* * PCI power states are as defined by ACPI: *