/*-
* Copyright (c) 2000 Tsubai Masanari. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
static pcireg_t
bandit_conf_read(void *cookie, pcitag_t tag, int reg)
{
pci_chipset_tag_t pc = cookie;
pcireg_t data;
int bus, dev, func, s;
uint32_t x;
if ((unsigned int)reg >= PCI_CONF_SIZE)
return (pcireg_t) -1;
pci_decompose_tag(pc, tag, &bus, &dev, &func);
/*
* bandit's minimum device number of the first bus is 11.
* So we behave as if there is no device when dev < 11.
*/
if (func > 7)
panic("pci_conf_read: func > 7");
if (bus == pc->pc_bus) {
if (dev < 11)
return 0xffffffff;
x = (1 << dev) | (func << 8) | reg;
} else
x = tag | reg | 1;
s = splhigh();
out32rb(pc->pc_addr, x);
DELAY(10);
data = 0xffffffff;
if (!badaddr(pc->pc_data, 4))
data = in32rb(pc->pc_data);
DELAY(10);
out32rb(pc->pc_addr, 0);
DELAY(10);
splx(s);
return data;
}
static void
bandit_conf_write(void *cookie, pcitag_t tag, int reg, pcireg_t data)
{
pci_chipset_tag_t pc = cookie;
int bus, dev, func, s;
u_int32_t x;
if ((unsigned int)reg >= PCI_CONF_SIZE)
return;
pci_decompose_tag(pc, tag, &bus, &dev, &func);
if (func > 7)
panic("pci_conf_write: func > 7");
if (bus == pc->pc_bus) {
if (dev < 11)
panic("pci_conf_write: dev < 11");
x = (1 << dev) | (func << 8) | reg;
} else
x = tag | reg | 1;
/*
* XXX
* /chaos really hates writes to config space, so we just don't do them
*/
static void
chaos_conf_write(void *cookie, pcitag_t tag, int reg, pcireg_t data)
{
}