added pci_set_max_read_req, pci_get_max_read_req and definitions required by if_re.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37040 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
6c4ac6b0b1
commit
af90dcab6f
@ -752,6 +752,54 @@ pci_alloc_msix(device_t dev, int *count)
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
pci_get_max_read_req(device_t dev)
|
||||
{
|
||||
int cap;
|
||||
uint16_t val;
|
||||
|
||||
if (pci_find_extcap(dev, PCIY_EXPRESS, &cap) != 0)
|
||||
return (0);
|
||||
val = pci_read_config(dev, cap + PCIR_EXPRESS_DEVICE_CTL, 2);
|
||||
val &= PCIM_EXP_CTL_MAX_READ_REQUEST;
|
||||
val >>= 12;
|
||||
return (1 << (val + 7));
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
fls(int mask)
|
||||
{
|
||||
int bit;
|
||||
if (mask == 0)
|
||||
return (0);
|
||||
for (bit = 1; mask != 1; bit++)
|
||||
mask = (unsigned int)mask >> 1;
|
||||
return (bit);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
pci_set_max_read_req(device_t dev, int size)
|
||||
{
|
||||
int cap;
|
||||
uint16_t val;
|
||||
|
||||
if (pci_find_extcap(dev, PCIY_EXPRESS, &cap) != 0)
|
||||
return (0);
|
||||
if (size < 128)
|
||||
size = 128;
|
||||
if (size > 4096)
|
||||
size = 4096;
|
||||
size = (1 << (fls(size) - 1));
|
||||
val = pci_read_config(dev, cap + PCIR_EXPRESS_DEVICE_CTL, 2);
|
||||
val &= ~PCIM_EXP_CTL_MAX_READ_REQUEST;
|
||||
val |= (fls(size) - 8) << 12;
|
||||
pci_write_config(dev, cap + PCIR_EXPRESS_DEVICE_CTL, val, 2);
|
||||
return (size);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
pci_get_powerstate(device_t dev)
|
||||
{
|
||||
|
@ -51,6 +51,9 @@ int pci_release_msi(device_t dev);
|
||||
int pci_msix_count(device_t dev);
|
||||
int pci_alloc_msix(device_t dev, int *count);
|
||||
|
||||
int pci_get_max_read_req(device_t dev);
|
||||
int pci_set_max_read_req(device_t dev, int size);
|
||||
|
||||
int pci_get_powerstate(device_t dev);
|
||||
int pci_set_powerstate(device_t dev, int newPowerState);
|
||||
|
||||
|
@ -22,21 +22,26 @@
|
||||
#define IF_Gbps(x) (IF_Mbps((x) * 1000))
|
||||
|
||||
/* Capabilities that interfaces can advertise. */
|
||||
#define IFCAP_RXCSUM 0x0001 /* can offload checksum on RX */
|
||||
#define IFCAP_TXCSUM 0x0002 /* can offload checksum on TX */
|
||||
#define IFCAP_NETCONS 0x0004 /* can be a network console */
|
||||
#define IFCAP_VLAN_MTU 0x0008 /* VLAN-compatible MTU */
|
||||
#define IFCAP_VLAN_HWTAGGING 0x0010 /* hardware VLAN tag support */
|
||||
#define IFCAP_JUMBO_MTU 0x0020 /* 9000 byte MTU supported */
|
||||
#define IFCAP_POLLING 0x0040 /* driver supports polling */
|
||||
#define IFCAP_VLAN_HWCSUM 0x0080
|
||||
#define IFCAP_TSO4 0x0100 /* supports TCP segmentation offload */
|
||||
#define IFCAP_RXCSUM 0x00001 /* can offload checksum on RX */
|
||||
#define IFCAP_TXCSUM 0x00002 /* can offload checksum on TX */
|
||||
#define IFCAP_NETCONS 0x00004 /* can be a network console */
|
||||
#define IFCAP_VLAN_MTU 0x00008 /* VLAN-compatible MTU */
|
||||
#define IFCAP_VLAN_HWTAGGING 0x00010 /* hardware VLAN tag support */
|
||||
#define IFCAP_JUMBO_MTU 0x00020 /* 9000 byte MTU supported */
|
||||
#define IFCAP_POLLING 0x00040 /* driver supports polling */
|
||||
#define IFCAP_VLAN_HWCSUM 0x00080
|
||||
#define IFCAP_TSO4 0x00100 /* supports TCP segmentation offload */
|
||||
#define IFCAP_TSO6 0x00200 /* can do TCP6 Segmentation Offload */
|
||||
#define IFCAP_WOL_UCAST 0x00800 /* wake on any unicast frame */
|
||||
#define IFCAP_WOL_MCAST 0x01000 /* wake on any multicast frame */
|
||||
#define IFCAP_WOL_MAGIC 0x02000 /* wake on any Magic Packet */
|
||||
#define IFCAP_VLAN_HWFILTER 0x10000 /* interface hw can filter vlan tag */
|
||||
#define IFCAP_POLLING_NOCOUNT 0x20000
|
||||
#define IFCAP_VLAN_HWTSO 0x40000
|
||||
#define IFCAP_LINKSTATE 0x80000
|
||||
|
||||
#define IFCAP_HWCSUM (IFCAP_RXCSUM | IFCAP_TXCSUM)
|
||||
#define IFCAP_TSO (IFCAP_TSO4 | IFCAP_TSO6)
|
||||
#define IFCAP_WOL (IFCAP_WOL_UCAST | IFCAP_WOL_MCAST | IFCAP_WOL_MAGIC)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user