aboutsummaryrefslogtreecommitdiff
path: root/kernel/drivers
diff options
context:
space:
mode:
authorMarvin Borner2020-09-27 22:21:09 +0200
committerMarvin Borner2020-09-27 22:21:09 +0200
commit1901e251f3e02abad4bffeef383f1136861008dc (patch)
tree8a41cd500fec473ffb271a430550b813dc2cca10 /kernel/drivers
parent9286bba7b273301dd777dd15feec40492ccd9a03 (diff)
Networky things
Idk, really
Diffstat (limited to 'kernel/drivers')
-rw-r--r--kernel/drivers/rtl8139.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/kernel/drivers/rtl8139.c b/kernel/drivers/rtl8139.c
index 4a5ed16..c901892 100644
--- a/kernel/drivers/rtl8139.c
+++ b/kernel/drivers/rtl8139.c
@@ -20,11 +20,17 @@ static u32 rtl_iobase = 0;
u8 *rtl8139_get_mac()
{
+ if (!rtl_device_pci)
+ return NULL;
+
return mac;
}
void rtl8139_receive_packet()
{
+ if (!rtl_device_pci)
+ return;
+
u16 *t = (u16 *)(rx_buffer + current_packet_ptr);
u16 length = *(t + 1);
t += 2;
@@ -46,7 +52,10 @@ static u8 tsd_array[4] = { 0x10, 0x14, 0x18, 0x1C };
static u8 tx_current = 0;
void rtl8139_send_packet(void *data, u32 len)
{
- printf("Sending packet %d\n\n", len);
+ if (!rtl_device_pci)
+ return;
+
+ /* printf("Sending packet %d\n\n", len); */
outl(rtl_iobase + tsad_array[tx_current], (u32)data);
outl(rtl_iobase + tsd_array[tx_current++], len);
if (tx_current > 3)
@@ -62,7 +71,10 @@ void rtl8139_find(u32 device, u16 vendor_id, u16 device_id, void *extra)
void rtl8139_irq_handler()
{
- print("RTL INT!\n");
+ if (!rtl_device_pci)
+ return;
+
+ /* print("\nRTL INT!\n"); */
u16 status = inw(rtl_iobase + RTL_PORT_ISR);
if (status & RTL_TOK) {