- Merge from r249476: Ensure that PCI bus BUS_GET_DMA_TAG() method sees
the actual PCI device which makes the request for DMA tag, instead of some descendant of the PCI device, by creating a pass-through trampoline. - Sprinkle const on tables. - Use NULL instead of 0 for pointers. - Take advantage of nitems(). MFC after: 1 week
This commit is contained in:
parent
1cb4c501ae
commit
2dc26832f7
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=251133
@ -162,7 +162,7 @@ TUNABLE_INT("hw.msk.jumbo_disable", &jumbo_disable);
|
||||
/*
|
||||
* Devices supported by this driver.
|
||||
*/
|
||||
static struct msk_product {
|
||||
static const struct msk_product {
|
||||
uint16_t msk_vendorid;
|
||||
uint16_t msk_deviceid;
|
||||
const char *msk_name;
|
||||
@ -257,6 +257,7 @@ static int mskc_shutdown(device_t);
|
||||
static int mskc_setup_rambuffer(struct msk_softc *);
|
||||
static int mskc_suspend(device_t);
|
||||
static int mskc_resume(device_t);
|
||||
static bus_dma_tag_t mskc_get_dma_tag(device_t, device_t);
|
||||
static void mskc_reset(struct msk_softc *);
|
||||
|
||||
static int msk_probe(device_t);
|
||||
@ -334,6 +335,8 @@ static device_method_t mskc_methods[] = {
|
||||
DEVMETHOD(device_resume, mskc_resume),
|
||||
DEVMETHOD(device_shutdown, mskc_shutdown),
|
||||
|
||||
DEVMETHOD(bus_get_dma_tag, mskc_get_dma_tag),
|
||||
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
||||
@ -368,9 +371,9 @@ static driver_t msk_driver = {
|
||||
|
||||
static devclass_t msk_devclass;
|
||||
|
||||
DRIVER_MODULE(mskc, pci, mskc_driver, mskc_devclass, 0, 0);
|
||||
DRIVER_MODULE(msk, mskc, msk_driver, msk_devclass, 0, 0);
|
||||
DRIVER_MODULE(miibus, msk, miibus_driver, miibus_devclass, 0, 0);
|
||||
DRIVER_MODULE(mskc, pci, mskc_driver, mskc_devclass, NULL, NULL);
|
||||
DRIVER_MODULE(msk, mskc, msk_driver, msk_devclass, NULL, NULL);
|
||||
DRIVER_MODULE(miibus, msk, miibus_driver, miibus_devclass, NULL, NULL);
|
||||
|
||||
static struct resource_spec msk_res_spec_io[] = {
|
||||
{ SYS_RES_IOPORT, PCIR_BAR(1), RF_ACTIVE },
|
||||
@ -1180,15 +1183,14 @@ msk_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
|
||||
static int
|
||||
mskc_probe(device_t dev)
|
||||
{
|
||||
struct msk_product *mp;
|
||||
const struct msk_product *mp;
|
||||
uint16_t vendor, devid;
|
||||
int i;
|
||||
|
||||
vendor = pci_get_vendor(dev);
|
||||
devid = pci_get_device(dev);
|
||||
mp = msk_products;
|
||||
for (i = 0; i < sizeof(msk_products)/sizeof(msk_products[0]);
|
||||
i++, mp++) {
|
||||
for (i = 0; i < nitems(msk_products); i++, mp++) {
|
||||
if (vendor == mp->msk_vendorid && devid == mp->msk_deviceid) {
|
||||
device_set_desc(dev, mp->msk_name);
|
||||
return (BUS_PROBE_DEFAULT);
|
||||
@ -2118,6 +2120,13 @@ mskc_detach(device_t dev)
|
||||
return (0);
|
||||
}
|
||||
|
||||
static bus_dma_tag_t
|
||||
mskc_get_dma_tag(device_t bus, device_t child __unused)
|
||||
{
|
||||
|
||||
return (bus_get_dma_tag(bus));
|
||||
}
|
||||
|
||||
struct msk_dmamap_arg {
|
||||
bus_addr_t msk_busaddr;
|
||||
};
|
||||
|
@ -143,7 +143,7 @@ static const char rcsid[] =
|
||||
"$FreeBSD$";
|
||||
#endif
|
||||
|
||||
static struct sk_type sk_devs[] = {
|
||||
static const struct sk_type sk_devs[] = {
|
||||
{
|
||||
VENDORID_SK,
|
||||
DEVICEID_SK_V1,
|
||||
@ -193,6 +193,7 @@ static int skc_detach(device_t);
|
||||
static int skc_shutdown(device_t);
|
||||
static int skc_suspend(device_t);
|
||||
static int skc_resume(device_t);
|
||||
static bus_dma_tag_t skc_get_dma_tag(device_t, device_t);
|
||||
static int sk_detach(device_t);
|
||||
static int sk_probe(device_t);
|
||||
static int sk_attach(device_t);
|
||||
@ -296,6 +297,8 @@ static device_method_t skc_methods[] = {
|
||||
DEVMETHOD(device_resume, skc_resume),
|
||||
DEVMETHOD(device_shutdown, skc_shutdown),
|
||||
|
||||
DEVMETHOD(bus_get_dma_tag, skc_get_dma_tag),
|
||||
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
||||
@ -330,9 +333,9 @@ static driver_t sk_driver = {
|
||||
|
||||
static devclass_t sk_devclass;
|
||||
|
||||
DRIVER_MODULE(skc, pci, skc_driver, skc_devclass, 0, 0);
|
||||
DRIVER_MODULE(sk, skc, sk_driver, sk_devclass, 0, 0);
|
||||
DRIVER_MODULE(miibus, sk, miibus_driver, miibus_devclass, 0, 0);
|
||||
DRIVER_MODULE(skc, pci, skc_driver, skc_devclass, NULL, NULL);
|
||||
DRIVER_MODULE(sk, skc, sk_driver, sk_devclass, NULL, NULL);
|
||||
DRIVER_MODULE(miibus, sk, miibus_driver, miibus_devclass, NULL, NULL);
|
||||
|
||||
static struct resource_spec sk_res_spec_io[] = {
|
||||
{ SYS_RES_IOPORT, PCIR_BAR(1), RF_ACTIVE },
|
||||
@ -1186,7 +1189,7 @@ static int
|
||||
skc_probe(dev)
|
||||
device_t dev;
|
||||
{
|
||||
struct sk_type *t = sk_devs;
|
||||
const struct sk_type *t = sk_devs;
|
||||
|
||||
while(t->sk_name != NULL) {
|
||||
if ((pci_get_vendor(dev) == t->sk_vid) &&
|
||||
@ -1888,6 +1891,13 @@ skc_detach(dev)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static bus_dma_tag_t
|
||||
skc_get_dma_tag(device_t bus, device_t child __unused)
|
||||
{
|
||||
|
||||
return (bus_get_dma_tag(bus));
|
||||
}
|
||||
|
||||
struct sk_dmamap_arg {
|
||||
bus_addr_t sk_busaddr;
|
||||
};
|
||||
@ -3185,7 +3195,7 @@ sk_init_xmac(sc_if)
|
||||
struct sk_softc *sc;
|
||||
struct ifnet *ifp;
|
||||
u_int16_t eaddr[(ETHER_ADDR_LEN+1)/2];
|
||||
struct sk_bcom_hack bhack[] = {
|
||||
static const struct sk_bcom_hack bhack[] = {
|
||||
{ 0x18, 0x0c20 }, { 0x17, 0x0012 }, { 0x15, 0x1104 }, { 0x17, 0x0013 },
|
||||
{ 0x15, 0x0404 }, { 0x17, 0x8006 }, { 0x15, 0x0132 }, { 0x17, 0x8006 },
|
||||
{ 0x15, 0x0232 }, { 0x17, 0x800D }, { 0x15, 0x000F }, { 0x18, 0x0420 },
|
||||
|
@ -1289,7 +1289,7 @@
|
||||
struct sk_type {
|
||||
u_int16_t sk_vid;
|
||||
u_int16_t sk_did;
|
||||
char *sk_name;
|
||||
const char *sk_name;
|
||||
};
|
||||
|
||||
#define SK_ADDR_LO(x) ((u_int64_t) (x) & 0xffffffff)
|
||||
|
Loading…
Reference in New Issue
Block a user