Ticket #1590: partially-fixed-edited.diff

File partially-fixed-edited.diff, 5.0 KB (added by Adek336, 15 years ago)

works

Line 
1Index: build/jam/HaikuImage
2===================================================================
3--- build/jam/HaikuImage (wersja 28329)
4+++ build/jam/HaikuImage (kopia robocza)
5@@ -136,7 +136,7 @@
6 $(X86_ONLY)via_rhine wb840 $(X86_ONLY)ipro100 $(X86_ONLY)nforce
7 #vlance
8 $(X86_ONLY)marvell_yukon $(X86_ONLY)syskonnect usb_ecm
9- $(GPL_ONLY)bcm440x $(GPL_ONLY)bcm570x
10+ $(GPL_ONLY)bcm440x $(GPL_ONLY)bcm570x broadcom_bcm570x
11 ;
12 #BEOS_ADD_ONS_DRIVERS_ACPI = $(X86_ONLY)acpi_button ;
13 BEOS_ADD_ONS_BUS_MANAGERS = pci $(X86_ONLY)ps2 $(X86_ONLY)isa ide scsi
14Index: src/libs/compat/freebsd_network/compat/sys/mbuf.h
15===================================================================
16--- src/libs/compat/freebsd_network/compat/sys/mbuf.h (wersja 28329)
17+++ src/libs/compat/freebsd_network/compat/sys/mbuf.h (kopia robocza)
18@@ -82,6 +82,9 @@
19
20 #define M_BCAST 0x00000200
21 #define M_MCAST 0x00000400
22+#define M_FRAG 0x00000800
23+#define M_FIRSTFRAG 0x00001000
24+#define M_LASTFRAG 0x00002000
25 #define M_VLANTAG 0x00010000
26
27 #define CSUM_IP 0x0001
28@@ -124,6 +127,7 @@
29 struct mbuf *m_get(int how, short type);
30 struct mbuf *m_gethdr(int how, short type);
31 void m_clget(struct mbuf *m, int how);
32+void * m_cljget(struct mbuf *m, int how, int size);
33
34 void m_extadd(struct mbuf *m, caddr_t buffer, u_int size,
35 void (*freeHook)(void *, void *), void *args, int flags, int type);
36Index: src/libs/compat/freebsd_network/mbuf.c
37===================================================================
38--- src/libs/compat/freebsd_network/mbuf.c (wersja 28329)
39+++ src/libs/compat/freebsd_network/mbuf.c (kopia robocza)
40@@ -150,6 +150,36 @@
41 construct_ext_mbuf(m, how);
42 }
43
44+ /*
45+ * Comment from the freebsd (mbuf.h):
46+ * m_cljget() is different from m_clget() as it can allocate clusters without
47+ * attaching them to an mbuf. In that case the return value is the pointer
48+ * to the cluster of the requested size. If an mbuf was specified, it gets
49+ * the cluster attached to it and the return value can be safely ignored.
50+ * For size it takes MCLBYTES, MJUMPAGESIZE, MJUM9BYTES, MJUM16BYTES.
51+ */
52+ void *
53+ m_cljget(struct mbuf *m, int how, int size)
54+ {
55+ // TODO: implement this
56+ panic("m_cljget not yet implemented");
57+ return (void *) NULL;
58+
59+ /*
60+ // This is the freebsd code
61+ uma_zone_t zone;
62+
63+ if (m && m->m_flags & M_EXT)
64+ printf("%s: %p mbuf already has cluster\n", __func__, m);
65+ if (m != NULL)
66+ m->m_ext.ext_buf = NULL;
67+
68+ zone = m_getzone(size);
69+ return (uma_zalloc_arg(zone, m, how));
70+ */
71+ }
72+
73+
74
75 void
76 m_freem(struct mbuf *mb)
77Index: src/libs/compat/freebsd_network/fbsd_mii_physubr.c
78===================================================================
79--- src/libs/compat/freebsd_network/fbsd_mii_physubr.c (wersja 28329)
80+++ src/libs/compat/freebsd_network/fbsd_mii_physubr.c (kopia robocza)
81@@ -510,8 +510,11 @@
82 }
83
84 if (sc->mii_capabilities & BMSR_ANEG) {
85- ADD(IFM_MAKEWORD(IFM_ETHER, IFM_AUTO, 0, sc->mii_inst),
86- MII_NMEDIA); /* intentionally invalid index */
87+ dprintf("FIXME: sc->mii_capabilities & BMSR_ANEG\n");
88+ //ADD(IFM_MAKEWORD(IFM_ETHER, IFM_AUTO, 0, sc->mii_inst),
89+ //MII_NMEDIA); /* intentionally invalid index */
90 PRINT("auto");
91 }
92 #undef ADD
93Index: src/add-ons/kernel/drivers/network/broadcom_bcm570x/dev/bge/glue.c
94===================================================================
95--- src/add-ons/kernel/drivers/network/broadcom_bcm570x/dev/bge/glue.c (wersja 28329)
96+++ src/add-ons/kernel/drivers/network/broadcom_bcm570x/dev/bge/glue.c (kopia robocza)
97@@ -5,6 +5,7 @@
98
99
100 #include <sys/bus.h>
101+#include "if_bgereg.h"
102
103
104 HAIKU_FBSD_DRIVER_GLUE(broadcom_bcm570x, bge, pci);
105@@ -25,3 +26,51 @@
106 return __haiku_probe_miibus(dev, drivers);
107 }
108
109+int
110+__haiku_disable_interrupts(device_t dev)
111+{
112+ struct bge_softc *sc = device_get_softc(dev);
113+
114+ // Obtain the status and return 0 if the bge did not set the intr
115+ u_int32_t status = CSR_READ_4(sc, BGE_MAC_STS);
116+
117+ // sc->transmitting: a packet is being transmitted; status & 0x1000: link state change(?)
118+ // checking BGE_PCI_PCISTATE register for interrupt like the linux driver does
119+ if ( ((status & 0x1000)==0)&&(sc->transmitting==0) && ((pci_read_config(sc->bge_dev, BGE_PCI_PCISTATE,4) & BGE_PCISTATE_INTR_STATE) != 0)) {
120+ return 0;
121+ }
122+ sc->transmitting=0;
123+
124+ // Clear the interrupt, the bge intr handler will take care of it
125+ BGE_SETBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_MASK_PCI_INTR);
126+ bge_writembx(sc, BGE_MBX_IRQ0_LO, 1);
127+
128+ // save the status for the interrupt handler
129+ atomic_or((int32 *)&sc->bge_intr_status, status);
130+ return 1;
131+}
132+
133+
134+void
135+__haiku_reenable_interrupts(device_t dev)
136+{
137+ struct bge_softc *sc = device_get_softc(dev);
138+ BGE_SETBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_CLEAR_INTA);
139+ BGE_CLRBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_MASK_PCI_INTR);
140+ bge_writembx(sc, BGE_MBX_IRQ0_LO, 0);
141+}