mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-11 09:50:12 +00:00
Add consistency check to the functions that map port or memory ranges:
Return failure, if the enable bit corresponding to the map type has not been set in the command register. This feature was requested by Justin Gibbs, who pointed out that some early PCI to PCI bridges do not correctly support memory windows (I assume because of the risk of deadlocks that have been taken care of in the PCI 2.2 spec) and that some BIOS clears the memory address decode enable bit in the command register of the PCI device, if it finds them behind such a bridge.
This commit is contained in:
parent
a9ad937362
commit
8ae85778a3
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=26231
@ -23,7 +23,7 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: pci_compat.c,v 1.1 1997/05/26 15:08:35 se Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -70,13 +70,26 @@ pci_mapno(pcicfgregs *cfg, int reg)
|
||||
return (map);
|
||||
}
|
||||
|
||||
static int
|
||||
pci_porten(pcicfgregs *cfg)
|
||||
{
|
||||
return ((cfg->cmdreg & PCIM_CMD_PORTEN) != 0);
|
||||
}
|
||||
|
||||
static int
|
||||
pci_isportmap(pcicfgregs *cfg, int map)
|
||||
|
||||
{
|
||||
return ((unsigned)map < cfg->nummaps
|
||||
&& (cfg->map[map].type & PCI_MAPPORT) != 0);
|
||||
}
|
||||
|
||||
static int
|
||||
pci_memen(pcicfgregs *cfg)
|
||||
{
|
||||
return ((cfg->cmdreg & PCIM_CMD_MEMEN) != 0);
|
||||
}
|
||||
|
||||
static int
|
||||
pci_ismemmap(pcicfgregs *cfg, int map)
|
||||
{
|
||||
@ -103,7 +116,7 @@ int pci_map_port(pcici_t cfg, u_long reg, u_short* pa)
|
||||
int map;
|
||||
|
||||
map = pci_mapno(cfg, reg);
|
||||
if (pci_isportmap(cfg, map)) {
|
||||
if (pci_porten(cfg) && pci_isportmap(cfg, map)) {
|
||||
u_int32_t iobase;
|
||||
u_int32_t iosize;
|
||||
|
||||
@ -126,7 +139,7 @@ int pci_map_mem(pcici_t cfg, u_long reg, vm_offset_t* va, vm_offset_t* pa)
|
||||
int map;
|
||||
|
||||
map = pci_mapno(cfg, reg);
|
||||
if (pci_ismemmap(cfg, map)) {
|
||||
if (pci_memen(cfg) && pci_ismemmap(cfg, map)) {
|
||||
u_int32_t paddr;
|
||||
u_int32_t psize;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user