kernels/linux-2.4.0/arch/parisc/kernel/lba_pci.c
/*
** LBA rev 2.0, 2.1, 2.2, and 3.0 bus walks require a complex
** workaround for cfg cycles:
**	-- preserve  LBA state
**	-- LBA_FLAG_NO_DMA_DURING_CFG workaround
**	-- turn on smart mode
**	-- probe with config writes before doing config reads
**	-- check ERROR_STATUS
**	-- clear ERROR_STATUS
**	-- restore LBA state
**
** The workaround is only used for device discovery.
*/
LBA rev 2.0, 2.1, 2.2, and 3.0 bus walks require a complex
workaround for cfg cycles:
preserve  LBA state
LBA_FLAG_NO_DMA_DURING_CFG workaround
turn on smart mode
probe with config writes before doing config reads
check ERROR_STATUS
clear ERROR_STATUS
restore LBA state

The workaround is only used for device discovery.
LBA rev 2 . 0 2 . 1 2 . 2 and 3 . 0 bus walks require a complex workaround for cfg cycles : preserve LBA state LBA_FLAG_NO_DMA_DURING_CFG workaround turn on smart mode probe with config writes before doing config reads check ERROR_STATUS clear ERROR_STATUS restore LBA state The workaround is only used for device discovery .
static int
lba_device_present( u8 bus, u8 dfn, struct lba_device *d)
{
	u8 first_bus = d->hba.hba_bus->secondary;
	u8 last_sub_bus = d->hba.hba_bus->subordinate;
#if 0
        u8 dev = PCI_SLOT(dfn);
        u8 func = PCI_FUNC(dfn);
#endif
	ASSERT(bus >= first_bus);
	ASSERT(bus <= last_sub_bus);
	ASSERT((bus - first_bus) < LBA_MAX_NUM_BUSES);
	if ((bus < first_bus) ||
	    (bus > last_sub_bus) ||
	    ((bus - first_bus) >= LBA_MAX_NUM_BUSES))
	{
	    return(FALSE);
	}
#if 0
	bus -= first_bus;
	return (((d->devices[bus][dev]) >> func) & 0x1);
#else
	return TRUE;
#endif
}
static int lba_device_present ( u8 bus , u8 dfn , struct lba_device * d ) { u8 first_bus = d -> hba . hba_bus -> secondary ; u8 last_sub_bus = d -> hba . hba_bus -> subordinate ; #if 0 u8 dev = PCI_SLOT ( dfn ) ; u8 func = PCI_FUNC ( dfn ) ; #endif ASSERT ( bus >= first_bus ) ; ASSERT ( bus <= last_sub_bus ) ; ASSERT ( ( bus - first_bus ) < LBA_MAX_NUM_BUSES ) ; if ( ( bus < first_bus ) || ( bus > last_sub_bus ) || ( ( bus - first_bus ) >= LBA_MAX_NUM_BUSES ) ) { return ( FALSE ) ; } #if 0 bus -= first_bus ; return ( ( ( d -> devices [ bus ] [ dev ] ) >> func ) & 0x1 ) ; #else return TRUE ; #endif }
LBA rev 2.0, 2.1, 2.2, and 3.0 bus walks require a complex
workaround for cfg cycles:
 preserve  LBA state
 LBA_FLAG_NO_DMA_DURING_CFG workaround
 turn on smart mode
 probe with config writes before doing config reads
 check ERROR_STATUS
 clear ERROR_STATUS
 restore LBA state
LBA rev 2 . 0 2 . 1 2 . 2 and 3 . 0 bus walks require a complex workaround for cfg cycles : preserve LBA state LBA_FLAG_NO_DMA_DURING_CFG workaround turn on smart mode probe with config writes before doing config reads check ERROR_STATUS clear ERROR_STATUS restore LBA state
/* FIXME - see below in this function */ /* devices that fall into any of these cases won't get claimed */ /*
** FIXME: Need to implement code to fill the devices bitmap based
** on contents of the local pci_bus tree "data base".
** pci_register_ops() walks the bus for us and builds the tree.
** For now, always do the config cycle.
*/