Ticket #1945: glue.c

File glue.c, 1.5 KB (added by euan, 12 years ago)

updated marvell_yukon_sk/dev/sk/glue.c with interrupts implemented. Needs someone to look at...

Line 
1/*
2 * Copyright 2007, Hugo Santos. All Rights Reserved.
3 * Copyright 2007, Axel Dörfler, axeld@pinc-software.de. All Rights Reserved.
4 * Distributed under the terms of the MIT License.
5 */
6
7
8#include <sys/bus.h>
9#include <sys/rman.h>
10#include "if_skreg.h"
11
12
13HAIKU_FBSD_DRIVER_GLUE(marvell_yukon_sk, skc, pci)
14
15extern driver_t *DRIVER_MODULE_NAME(e1000phy, miibus);
16extern driver_t *DRIVER_MODULE_NAME(ukphy, miibus);
17extern driver_t *DRIVER_MODULE_NAME(xmphy, miibus);
18
19
20driver_t *
21__haiku_select_miibus_driver(device_t dev)
22{
23 driver_t *drivers[] = {
24 DRIVER_MODULE_NAME(xmphy, miibus),
25 DRIVER_MODULE_NAME(e1000phy, miibus),
26 DRIVER_MODULE_NAME(ukphy, miibus),
27 NULL
28 };
29
30 return __haiku_probe_miibus(dev, drivers);
31}
32
33int
34__haiku_disable_interrupts(device_t dev)
35{
36 struct sk_softc *sc = device_get_softc(dev);
37 u_int32_t status;
38
39 status = CSR_READ_4(sc, SK_ISSR);
40 if (status == 0 || status == 0xffffffff || sc->sk_suspended)
41 return 0;
42
43 if (sc->sk_if[0] != NULL)
44 sc->sk_intrmask &= ~SK_INTRS1;
45 if (sc->sk_if[1] != NULL)
46 sc->sk_intrmask &= ~SK_INTRS2;
47
48 CSR_WRITE_4(sc, SK_IMR, sc->sk_intrmask);
49
50 return 1;
51}
52
53
54void
55__haiku_reenable_interrupts(device_t dev)
56{
57 struct sk_softc *sc = device_get_softc(dev);
58
59 CSR_READ_4(sc, SK_ISSR);
60 if (sc->sk_if[0] != NULL)
61 sc->sk_intrmask |= SK_INTRS1;
62 if (sc->sk_if[1] != NULL)
63 sc->sk_intrmask |= SK_INTRS2;
64
65// sc->sk_intrmask |= SK_ISR_EXTERNAL_REG;
66
67 CSR_WRITE_4(sc, SK_IMR, sc->sk_intrmask);
68}
69
70HAIKU_DRIVER_REQUIREMENTS(0 /*FBSD_TASKQUEUES | FBSD_FAST_TASKQUEUE | FBSD_SWI_TASKQUEUE*/);
71