diff --git a/src/drivers/net/efi/nii.c b/src/drivers/net/efi/nii.c index f2c6647..0ba45fd 100644 --- a/src/drivers/net/efi/nii.c +++ b/src/drivers/net/efi/nii.c @@ -437,7 +437,7 @@ static int nii_issue_cpb_db ( struct nii_nic *nii, unsigned int op, void *cpb, static int nii_issue_cpb ( struct nii_nic *nii, unsigned int op, void *cpb, size_t cpb_len ) { - return nii_issue_cpb_db ( nii, op, cpb, cpb_len, NULL, 0 ); + return nii_issue_cpb_db ( nii, op, cpb, cpb_len, PXE_DBADDR_NOT_USED, PXE_DBSIZE_NOT_USED ); } /** @@ -487,6 +487,8 @@ static int nii_start_undi ( struct nii_nic *nii ) { cpb.Unique_ID = ( ( intptr_t ) nii ); /* Issue command */ + DBGC2 ( nii, "start NII %s\n", + nii->dev.name); if ( ( stat = nii_issue_cpb ( nii, PXE_OPCODE_START, &cpb, sizeof ( cpb ) ) ) < 0 ) { rc = -EIO_STAT ( stat ); @@ -508,6 +510,8 @@ static void nii_stop_undi ( struct nii_nic *nii ) { int rc; /* Issue command */ + DBGC2 ( nii, "stop NII %s\n", + nii->dev.name); if ( ( stat = nii_issue ( nii, PXE_OPCODE_STOP ) ) < 0 ) { rc = -EIO_STAT ( stat ); DBGC ( nii, "NII %s could not stop: %s\n", @@ -531,6 +535,8 @@ static int nii_get_init_info ( struct nii_nic *nii, int rc; /* Issue command */ + DBGC2 ( nii, "get NII %s init info\n", + nii->dev.name); if ( ( stat = nii_issue_db ( nii, PXE_OPCODE_GET_INIT_INFO, &db, sizeof ( db ) ) ) < 0 ) { rc = -EIO_STAT ( stat ); @@ -594,7 +600,9 @@ static int nii_initialise ( struct nii_nic *nii ) { /* Issue command */ op = NII_OP ( PXE_OPCODE_INITIALIZE, - PXE_OPFLAGS_INITIALIZE_DO_NOT_DETECT_CABLE ); + 0 ); + DBGC2 ( nii, "initialise NII %s\n", + nii->dev.name); if ( ( stat = nii_issue_cpb_db ( nii, op, &cpb, sizeof ( cpb ), &db, sizeof ( db ) ) ) < 0 ) { rc = -EIO_STAT ( stat ); @@ -621,6 +629,8 @@ static void nii_shutdown ( struct nii_nic *nii ) { int rc; /* Issue command */ + DBGC2 ( nii, "shutdown NII %s\n", + nii->dev.name); if ( ( stat = nii_issue ( nii, PXE_OPCODE_SHUTDOWN ) ) < 0 ) { rc = -EIO_STAT ( stat ); DBGC ( nii, "NII %s could not shut down: %s\n", @@ -645,13 +655,18 @@ static int nii_get_station_address ( struct nii_nic *nii, PXE_DB_STATION_ADDRESS db; int stat; int rc; + unsigned int op; /* Initialise UNDI */ if ( ( rc = nii_initialise ( nii ) ) != 0 ) goto err_initialise; + + op = NII_OP ( PXE_OPCODE_STATION_ADDRESS, PXE_OPFLAGS_STATION_ADDRESS_READ); /* Issue command */ - if ( ( stat = nii_issue_db ( nii, PXE_OPCODE_STATION_ADDRESS, &db, + DBGC2 ( nii, "get NII %s station address\n", + nii->dev.name); + if ( ( stat = nii_issue_db ( nii, op, &db, sizeof ( db ) ) ) < 0 ) { rc = -EIO_STAT ( stat ); DBGC ( nii, "NII %s could not get station address: %s\n", @@ -685,14 +700,26 @@ static int nii_set_station_address ( struct nii_nic *nii, PXE_CPB_STATION_ADDRESS cpb; int stat; int rc; + unsigned int op; + + if ( (nii->undi->Implementation & PXE_ROMID_IMP_STATION_ADDR_SETTABLE) == 0) { + DBGC ( nii, "NII %s could not set station address: unsupported by implementation\n", + nii->dev.name); + return 0; + } /* Construct parameter block */ memset ( &cpb, 0, sizeof ( cpb ) ); memcpy ( cpb.StationAddr, netdev->ll_addr, netdev->ll_protocol->ll_addr_len ); + op = NII_OP ( PXE_OPCODE_STATION_ADDRESS, + ( PXE_OPFLAGS_STATION_ADDRESS_WRITE + ) ); /* Issue command */ - if ( ( stat = nii_issue_cpb ( nii, PXE_OPCODE_STATION_ADDRESS, + DBGC2 ( nii, "NII %s set station address\n", + nii->dev.name); + if ( ( stat = nii_issue_cpb ( nii, op, &cpb, sizeof ( cpb ) ) ) < 0 ) { rc = -EIO_STAT ( stat ); DBGC ( nii, "NII %s could not set station address: %s\n", @@ -710,17 +737,21 @@ static int nii_set_station_address ( struct nii_nic *nii, * @ret rc Return status code */ static int nii_set_rx_filters ( struct nii_nic *nii ) { - unsigned int op; + unsigned int op,flags = 0; int stat; int rc; + //PXE_UINT32 Implementation = nii->undi->Implementation; /* Issue command */ - op = NII_OP ( PXE_OPCODE_RECEIVE_FILTERS, - ( PXE_OPFLAGS_RECEIVE_FILTER_ENABLE | - PXE_OPFLAGS_RECEIVE_FILTER_UNICAST | - PXE_OPFLAGS_RECEIVE_FILTER_BROADCAST | - PXE_OPFLAGS_RECEIVE_FILTER_PROMISCUOUS | - PXE_OPFLAGS_RECEIVE_FILTER_ALL_MULTICAST ) ); + //flags = PXE_OPFLAGS_RECEIVE_FILTER_ENABLE; + flags = PXE_OPFLAGS_RECEIVE_FILTER_ENABLE | PXE_OPFLAGS_RECEIVE_FILTER_UNICAST | PXE_OPFLAGS_RECEIVE_FILTER_BROADCAST; + //flags |= PXE_OPFLAGS_RECEIVE_FILTER_UNICAST; + //flags |= (Implementation & PXE_ROMID_IMP_BROADCAST_RX_SUPPORTED) ? PXE_OPFLAGS_RECEIVE_FILTER_BROADCAST : 0 ; + //flags |= (Implementation & PXE_ROMID_IMP_PROMISCUOUS_RX_SUPPORTED) ? PXE_OPFLAGS_RECEIVE_FILTER_PROMISCUOUS : 0; + //flags |= (Implementation & PXE_ROMID_IMP_FILTERED_MULTICAST_RX_SUPPORTED) ? PXE_OPFLAGS_RECEIVE_FILTER_ALL_MULTICAST : 0; + op = NII_OP ( PXE_OPCODE_RECEIVE_FILTERS, flags ); + DBGC2 ( nii, "set rx filters for NII %s: 0x%x\n", + nii->dev.name, flags); if ( ( stat = nii_issue ( nii, op ) ) < 0 ) { rc = -EIO_STAT ( stat ); DBGC ( nii, "NII %s could not set receive filters: %s\n", @@ -744,6 +775,7 @@ static int nii_transmit ( struct net_device *netdev, PXE_CPB_TRANSMIT cpb; int stat; int rc; + unsigned int op; /* Defer the packet if there is already a transmission in progress */ if ( nii->txbuf ) { @@ -751,6 +783,11 @@ static int nii_transmit ( struct net_device *netdev, return 0; } + op = NII_OP (PXE_OPCODE_TRANSMIT, + ( PXE_OPFLAGS_TRANSMIT_WHOLE | + PXE_OPFLAGS_TRANSMIT_BLOCK + ) ); + /* Construct parameter block */ memset ( &cpb, 0, sizeof ( cpb ) ); cpb.FrameAddr = virt_to_bus ( iobuf->data ); @@ -758,7 +795,9 @@ static int nii_transmit ( struct net_device *netdev, cpb.MediaheaderLen = netdev->ll_protocol->ll_header_len; /* Transmit packet */ - if ( ( stat = nii_issue_cpb ( nii, PXE_OPCODE_TRANSMIT, &cpb, + DBGC2 ( nii, "NII %s transmit\n", + nii->dev.name); + if ( ( stat = nii_issue_cpb ( nii, op, &cpb, sizeof ( cpb ) ) ) < 0 ) { rc = -EIO_STAT ( stat ); DBGC ( nii, "NII %s could not transmit: %s\n", @@ -1038,6 +1077,8 @@ int nii_start ( struct efi_device *efidev ) { } DBGC ( nii, "NII %s using UNDI v%x.%x at %p entry %p\n", nii->dev.name, nii->nii->MajorVer, nii->nii->MinorVer, nii->undi, nii->issue ); + DBGC2 ( nii, "NII %s implements: 0x%x\n", + nii->dev.name, nii->undi->Implementation); /* Open PCI I/O protocols and locate BARs */ if ( ( rc = nii_pci_open ( nii ) ) != 0 )