freebsd compat. layer: couple fixes, sending now works with PCNET. enabled ifmedia_ioctl, and when opening a device, set it down, change media to ETHER/AUTO and set it back up so it sees a IFF_UP.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21047 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -7,7 +7,7 @@ UsePrivateHeaders kernel net ;
|
|||||||
UseHeaders [ FDirName $(SUBDIR) .. .. ] : true ;
|
UseHeaders [ FDirName $(SUBDIR) .. .. ] : true ;
|
||||||
UseHeaders [ FDirName $(HAIKU_TOP) src libs compat freebsd_network compat ] : true ;
|
UseHeaders [ FDirName $(HAIKU_TOP) src libs compat freebsd_network compat ] : true ;
|
||||||
|
|
||||||
SubDirCcFlags [ FDefines _KERNEL=1 ] ;
|
SubDirCcFlags [ FDefines _KERNEL=1 LEDEBUG=128 ] ;
|
||||||
|
|
||||||
KernelAddon pcnet :
|
KernelAddon pcnet :
|
||||||
am7990.c
|
am7990.c
|
||||||
|
|||||||
@@ -172,6 +172,8 @@ am79900_config(struct am79900_softc *sc, const char* name, int unit)
|
|||||||
if (mem > sc->lsc.sc_memsize)
|
if (mem > sc->lsc.sc_memsize)
|
||||||
panic("%s: memsize", __func__);
|
panic("%s: memsize", __func__);
|
||||||
|
|
||||||
|
sc->lsc.sc_flags |= LE_DEBUG;
|
||||||
|
|
||||||
lance_attach(&sc->lsc);
|
lance_attach(&sc->lsc);
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
@@ -450,10 +452,12 @@ am79900_intr(void *arg)
|
|||||||
if (sc->sc_flags & LE_DEBUG)
|
if (sc->sc_flags & LE_DEBUG)
|
||||||
if_printf(ifp, "%s: entering with isr=%04x\n", __func__, isr);
|
if_printf(ifp, "%s: entering with isr=%04x\n", __func__, isr);
|
||||||
#endif
|
#endif
|
||||||
|
#if 0
|
||||||
if ((isr & LE_C0_INTR) == 0) {
|
if ((isr & LE_C0_INTR) == 0) {
|
||||||
LE_UNLOCK(sc);
|
LE_UNLOCK(sc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Clear interrupt source flags and turn off interrupts. If we
|
* Clear interrupt source flags and turn off interrupts. If we
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ UsePrivateHeaders kernel net ;
|
|||||||
UseHeaders [ FDirName $(SUBDIR) ] : true ;
|
UseHeaders [ FDirName $(SUBDIR) ] : true ;
|
||||||
UseHeaders [ FDirName $(SUBDIR) compat ] : true ;
|
UseHeaders [ FDirName $(SUBDIR) compat ] : true ;
|
||||||
|
|
||||||
SubDirCcFlags [ FDefines _KERNEL=1 ] ;
|
SubDirCcFlags [ FDefines _KERNEL=1 KTR=1 ] ;
|
||||||
|
|
||||||
Library libfreebsd_network.a :
|
Library libfreebsd_network.a :
|
||||||
bus.c
|
bus.c
|
||||||
|
|||||||
@@ -528,7 +528,7 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags,
|
|||||||
printf("bus_dmamem_alloc failed to align memory properly.\n");
|
printf("bus_dmamem_alloc failed to align memory properly.\n");
|
||||||
}
|
}
|
||||||
CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d",
|
CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d",
|
||||||
__func__, dmat, dmat->flags, ENOMEM);
|
__func__, dmat, dmat->flags, 0);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -293,10 +293,13 @@ _kernel_contigmalloc(const char *file, int line, size_t size, int flags,
|
|||||||
snprintf(name, sizeof(name), "contig:%s:%d", file, line);
|
snprintf(name, sizeof(name), "contig:%s:%d", file, line);
|
||||||
|
|
||||||
area = create_area(name, &addr, B_ANY_KERNEL_ADDRESS, size,
|
area = create_area(name, &addr, B_ANY_KERNEL_ADDRESS, size,
|
||||||
B_FULL_LOCK | B_CONTIGUOUS, 0);
|
B_FULL_LOCK | B_CONTIGUOUS, B_READ_AREA | B_WRITE_AREA);
|
||||||
if (area < 0)
|
if (area < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
driver_printf("(%s) addr = %p, area = %d, size = %lu\n",
|
||||||
|
name, addr, area, size);
|
||||||
|
|
||||||
return addr;
|
return addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -308,6 +311,21 @@ _kernel_contigfree(void *addr, size_t size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Marcus' vtophys */
|
||||||
|
unsigned long
|
||||||
|
vtophys(vm_offset_t vaddr)
|
||||||
|
{
|
||||||
|
physical_entry pe;
|
||||||
|
status_t status;
|
||||||
|
|
||||||
|
status = get_memory_map((void *)vaddr, 1, &pe, 1);
|
||||||
|
if (status < 0)
|
||||||
|
panic("fbsd compat: get_memory_map failed for %p, error %08lx\n",
|
||||||
|
(void *)vaddr, status);
|
||||||
|
|
||||||
|
return (unsigned long)pe.address;
|
||||||
|
}
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
init_compat_layer()
|
init_compat_layer()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -58,7 +58,7 @@
|
|||||||
* Host to big endian, host to little endian, big endian to host, and little
|
* Host to big endian, host to little endian, big endian to host, and little
|
||||||
* endian to host byte order functions as detailed in byteorder(9).
|
* endian to host byte order functions as detailed in byteorder(9).
|
||||||
*/
|
*/
|
||||||
#if _YTE_ORDER == _LITTLE_ENDIAN
|
#if _BYTE_ORDER == _LITTLE_ENDIAN
|
||||||
#define htobe16(x) bswap16((x))
|
#define htobe16(x) bswap16((x))
|
||||||
#define htobe32(x) bswap32((x))
|
#define htobe32(x) bswap32((x))
|
||||||
#define htobe64(x) bswap64((x))
|
#define htobe64(x) bswap64((x))
|
||||||
|
|||||||
@@ -128,9 +128,15 @@ extern struct ktr_entry ktr_buf[];
|
|||||||
|
|
||||||
#ifdef KTR
|
#ifdef KTR
|
||||||
|
|
||||||
|
#if 0
|
||||||
void ktr_tracepoint(u_int mask, const char *file, int line,
|
void ktr_tracepoint(u_int mask, const char *file, int line,
|
||||||
const char *format, u_long arg1, u_long arg2, u_long arg3,
|
const char *format, u_long arg1, u_long arg2, u_long arg3,
|
||||||
u_long arg4, u_long arg5, u_long arg6);
|
u_long arg4, u_long arg5, u_long arg6);
|
||||||
|
#else
|
||||||
|
extern void driver_printf(const char *format, ...);
|
||||||
|
#define ktr_tracepoint(mask, file, line, format, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||||
|
driver_printf("(%s:%i) " format "\n", file, line, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define CTR6(m, format, p1, p2, p3, p4, p5, p6) do { \
|
#define CTR6(m, format, p1, p2, p3, p4, p5, p6) do { \
|
||||||
if (KTR_COMPILE & (m)) \
|
if (KTR_COMPILE & (m)) \
|
||||||
|
|||||||
@@ -17,19 +17,6 @@ typedef void * pmap_t;
|
|||||||
|
|
||||||
#define pmap_kextract(vaddr) vtophys(vaddr)
|
#define pmap_kextract(vaddr) vtophys(vaddr)
|
||||||
|
|
||||||
/* Marcus' vtophys */
|
unsigned long vtophys(vm_offset_t vaddr);
|
||||||
static inline unsigned long
|
|
||||||
vtophys(vm_offset_t vaddr)
|
|
||||||
{
|
|
||||||
physical_entry pe;
|
|
||||||
status_t status;
|
|
||||||
|
|
||||||
status = get_memory_map((void *)vaddr, 1, &pe, 1);
|
|
||||||
if (status < 0)
|
|
||||||
panic("fbsd compat: get_memory_map failed for %p, error %08lx\n",
|
|
||||||
(void *)vaddr, status);
|
|
||||||
|
|
||||||
return (unsigned long)pe.address;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -14,6 +14,8 @@
|
|||||||
#include <Drivers.h>
|
#include <Drivers.h>
|
||||||
#include <ether_driver.h>
|
#include <ether_driver.h>
|
||||||
|
|
||||||
|
#include <sys/sockio.h>
|
||||||
|
|
||||||
#include <compat/sys/haiku-module.h>
|
#include <compat/sys/haiku-module.h>
|
||||||
|
|
||||||
#include <compat/sys/bus.h>
|
#include <compat/sys/bus.h>
|
||||||
@@ -118,6 +120,21 @@ compat_open(const char *name, uint32 flags, void **cookie)
|
|||||||
|
|
||||||
driver_printf(" ... status = 0x%ld\n", status);
|
driver_printf(" ... status = 0x%ld\n", status);
|
||||||
|
|
||||||
|
if (status == 0) {
|
||||||
|
struct ifnet *ifp = dev->ifp;
|
||||||
|
struct ifreq ifr;
|
||||||
|
|
||||||
|
ifp->if_flags = 0;
|
||||||
|
ifp->if_ioctl(ifp, SIOCSIFFLAGS, NULL);
|
||||||
|
|
||||||
|
memset(&ifr, 0, sizeof(ifr));
|
||||||
|
ifr.ifr_media = IFM_MAKEWORD(IFM_ETHER, IFM_AUTO, 0, 0);
|
||||||
|
ifp->if_ioctl(ifp, SIOCSIFMEDIA, &ifr);
|
||||||
|
|
||||||
|
ifp->if_flags = IFF_UP;
|
||||||
|
ifp->if_ioctl(ifp, SIOCSIFFLAGS, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
*cookie = dev;
|
*cookie = dev;
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
|
|||||||
@@ -295,7 +295,7 @@ ether_sprintf(const u_char *ap)
|
|||||||
{
|
{
|
||||||
static char etherbuf[18];
|
static char etherbuf[18];
|
||||||
snprintf(etherbuf, sizeof (etherbuf),
|
snprintf(etherbuf, sizeof (etherbuf),
|
||||||
"%02x:%02x:%02x:%02x:%02x:%02x",
|
"%02lx:%02lx:%02lx:%02lx:%02lx:%02lx",
|
||||||
(uint32)ap[0], (uint32)ap[1], (uint32)ap[2], (uint32)ap[3],
|
(uint32)ap[0], (uint32)ap[1], (uint32)ap[2], (uint32)ap[3],
|
||||||
(uint32)ap[4], (uint32)ap[5]);
|
(uint32)ap[4], (uint32)ap[5]);
|
||||||
return (etherbuf);
|
return (etherbuf);
|
||||||
|
|||||||
@@ -62,11 +62,13 @@
|
|||||||
* Useful for debugging newly-ported drivers.
|
* Useful for debugging newly-ported drivers.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define IFMEDIA_DEBUG
|
||||||
|
|
||||||
static struct ifmedia_entry *ifmedia_match(struct ifmedia *ifm,
|
static struct ifmedia_entry *ifmedia_match(struct ifmedia *ifm,
|
||||||
int flags, int mask);
|
int flags, int mask);
|
||||||
|
|
||||||
#ifdef IFMEDIA_DEBUG
|
#ifdef IFMEDIA_DEBUG
|
||||||
int ifmedia_debug = 0;
|
int ifmedia_debug = 1;
|
||||||
static void ifmedia_printword(int);
|
static void ifmedia_printword(int);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -198,7 +200,6 @@ ifmedia_ioctl(ifp, ifr, ifm, cmd)
|
|||||||
struct ifmedia *ifm;
|
struct ifmedia *ifm;
|
||||||
u_long cmd;
|
u_long cmd;
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
struct ifmedia_entry *match;
|
struct ifmedia_entry *match;
|
||||||
struct ifmediareq *ifmr = (struct ifmediareq *) ifr;
|
struct ifmediareq *ifmr = (struct ifmediareq *) ifr;
|
||||||
int error = 0, sticky;
|
int error = 0, sticky;
|
||||||
@@ -330,9 +331,13 @@ ifmedia_ioctl(ifp, ifr, ifm, cmd)
|
|||||||
*/
|
*/
|
||||||
sticky = error;
|
sticky = error;
|
||||||
if ((error == 0 || error == E2BIG) && ifmr->ifm_count != 0) {
|
if ((error == 0 || error == E2BIG) && ifmr->ifm_count != 0) {
|
||||||
|
#if 0
|
||||||
error = copyout((caddr_t)kptr,
|
error = copyout((caddr_t)kptr,
|
||||||
(caddr_t)ifmr->ifm_ulist,
|
(caddr_t)ifmr->ifm_ulist,
|
||||||
ifmr->ifm_count * sizeof(int));
|
ifmr->ifm_count * sizeof(int));
|
||||||
|
#endif
|
||||||
|
/* this ioctl() is only called from within the kernel -hugo */
|
||||||
|
memcpy(kptr, ifmr->ifm_ulist, ifmr->ifm_count * sizeof(int));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error == 0)
|
if (error == 0)
|
||||||
@@ -350,8 +355,6 @@ ifmedia_ioctl(ifp, ifr, ifm, cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (error);
|
return (error);
|
||||||
#endif
|
|
||||||
return ENOTSUP;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user