2N/A/*
2N/A * GRUB -- GRand Unified Bootloader
2N/A * Copyright (C) 2008,2009 Free Software Foundation, Inc.
2N/A *
2N/A * GRUB is free software: you can redistribute it and/or modify
2N/A * it under the terms of the GNU General Public License as published by
2N/A * the Free Software Foundation, either version 3 of the License, or
2N/A * (at your option) any later version.
2N/A *
2N/A * GRUB is distributed in the hope that it will be useful,
2N/A * but WITHOUT ANY WARRANTY; without even the implied warranty of
2N/A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2N/A * GNU General Public License for more details.
2N/A *
2N/A * You should have received a copy of the GNU General Public License
2N/A * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
2N/A */
2N/A
2N/A#ifndef GRUB_CPU_PCI_H
2N/A#define GRUB_CPU_PCI_H 1
2N/A
2N/A#include <grub/types.h>
2N/A#include <grub/i386/io.h>
2N/A
2N/A#define GRUB_MACHINE_PCI_IO_BASE 0
2N/A#define GRUB_PCI_ADDR_REG 0xcf8
2N/A#define GRUB_PCI_DATA_REG 0xcfc
2N/A#define GRUB_PCI_NUM_BUS 256
2N/A#define GRUB_PCI_NUM_DEVICES 32
2N/A
2N/Astatic inline grub_uint32_t
2N/Agrub_pci_read (grub_pci_address_t addr)
2N/A{
2N/A grub_outl (addr, GRUB_PCI_ADDR_REG);
2N/A return grub_inl (GRUB_PCI_DATA_REG);
2N/A}
2N/A
2N/Astatic inline grub_uint16_t
2N/Agrub_pci_read_word (grub_pci_address_t addr)
2N/A{
2N/A grub_outl (addr & ~3, GRUB_PCI_ADDR_REG);
2N/A return grub_inw (GRUB_PCI_DATA_REG + (addr & 3));
2N/A}
2N/A
2N/Astatic inline grub_uint8_t
2N/Agrub_pci_read_byte (grub_pci_address_t addr)
2N/A{
2N/A grub_outl (addr & ~3, GRUB_PCI_ADDR_REG);
2N/A return grub_inb (GRUB_PCI_DATA_REG + (addr & 3));
2N/A}
2N/A
2N/Astatic inline void
2N/Agrub_pci_write (grub_pci_address_t addr, grub_uint32_t data)
2N/A{
2N/A grub_outl (addr, GRUB_PCI_ADDR_REG);
2N/A grub_outl (data, GRUB_PCI_DATA_REG);
2N/A}
2N/A
2N/Astatic inline void
2N/Agrub_pci_write_word (grub_pci_address_t addr, grub_uint16_t data)
2N/A{
2N/A grub_outl (addr & ~3, GRUB_PCI_ADDR_REG);
2N/A grub_outw (data, GRUB_PCI_DATA_REG + (addr & 3));
2N/A}
2N/A
2N/Astatic inline void
2N/Agrub_pci_write_byte (grub_pci_address_t addr, grub_uint8_t data)
2N/A{
2N/A grub_outl (addr & ~3, GRUB_PCI_ADDR_REG);
2N/A grub_outb (data, GRUB_PCI_DATA_REG + (addr & 3));
2N/A}
2N/A
2N/Astatic inline volatile void *
2N/Agrub_pci_device_map_range (grub_pci_device_t dev __attribute__ ((unused)),
2N/A grub_addr_t base,
2N/A grub_size_t size __attribute__ ((unused)))
2N/A{
2N/A return (volatile void *) base;
2N/A}
2N/A
2N/Astatic inline void
2N/Agrub_pci_device_unmap_range (grub_pci_device_t dev __attribute__ ((unused)),
2N/A volatile void *mem __attribute__ ((unused)),
2N/A grub_size_t size __attribute__ ((unused)))
2N/A{
2N/A}
2N/A
2N/A
2N/A#endif /* GRUB_CPU_PCI_H */