Beispiel #1
0
        uint ReadConfig(int bus, int dev, int func, int reg_no)
        {
            uint address = (uint)reg_no;

            address &= 0xfc;        // zero out lower 2 bits
            address |= ((uint)func & 0x7U) << 8;
            address |= ((uint)dev & 0x1fU) << 11;
            address |= ((uint)bus & 0xffU) << 16;
            address |= 0x80000000U;

            CONFIG_ADDRESS.Write(CONFIG_ADDRESS.Addr32, 4, address);
            return(CONFIG_DATA.Read(CONFIG_DATA.Addr32, 4));
        }
Beispiel #2
0
        void WriteConfig(int bus, int dev, int func, int reg_no, uint val)
        {
            uint address = (uint)reg_no;

            address &= 0xfc;        // zero out lower 2 bits
            address |= ((uint)func & 0x7U) << 8;
            address |= ((uint)dev & 0x1fU) << 11;
            address |= ((uint)bus & 0xffU) << 16;
            address |= 0x80000000U;

            CONFIG_ADDRESS.Write(CONFIG_ADDRESS.Addr32, 4, address);
            CONFIG_DATA.Write(CONFIG_DATA.Addr32, 4, val);
        }
Beispiel #3
0
        public void WriteConfig(int reg_no, uint val)
        {
            /* Disallow write access to BARs - these have to be remapped
             * by the pci driver itself via a call to GetBAR to ensure a
             * driver does not arbritrarily grant its device write access to
             * any part of memory */
            if (reg_no >= 0x10 && reg_no < 0x28)
            {
                return;
            }

            uint address = (uint)reg_no;

            address &= 0xfc;        // zero out lower 2 bits
            address |= ((uint)func & 0x7U) << 8;
            address |= ((uint)dev & 0x1fU) << 11;
            address |= ((uint)bus & 0xffU) << 16;
            address |= 0x80000000U;

            CONFIG_ADDRESS.Write(CONFIG_ADDRESS.Addr32, 4, address);
            CONFIG_DATA.Write(CONFIG_DATA.Addr32, 4, val);
        }