This list is closed, nobody may subscribe to it.
2004 |
Jan
(53) |
Feb
(78) |
Mar
(34) |
Apr
(26) |
May
(25) |
Jun
(34) |
Jul
(16) |
Aug
(16) |
Sep
(2) |
Oct
(58) |
Nov
(13) |
Dec
(32) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(62) |
Feb
(4) |
Mar
(40) |
Apr
(9) |
May
(13) |
Jun
(26) |
Jul
(32) |
Aug
(24) |
Sep
(18) |
Oct
(18) |
Nov
(14) |
Dec
|
2006 |
Jan
(15) |
Feb
(2) |
Mar
(23) |
Apr
(2) |
May
(2) |
Jun
(13) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2007 |
Jan
(1) |
Feb
(45) |
Mar
|
Apr
(13) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(31) |
Dec
(5) |
2008 |
Jan
(6) |
Feb
(34) |
Mar
(113) |
Apr
(40) |
May
(19) |
Jun
(5) |
Jul
(41) |
Aug
(13) |
Sep
(53) |
Oct
(4) |
Nov
(53) |
Dec
|
2009 |
Jan
(1) |
Feb
(29) |
Mar
(66) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(163) |
Nov
|
Dec
(91) |
From: <aot...@us...> - 2005-01-04 21:40:33
|
Update of /cvsroot/gc-linux/linux/sound/ppc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24768/sound/ppc Modified Files: Kconfig Log Message: Merge 2.6.10 Index: Kconfig =================================================================== RCS file: /cvsroot/gc-linux/linux/sound/ppc/Kconfig,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- Kconfig 20 Oct 2004 00:15:42 -0000 1.6 +++ Kconfig 4 Jan 2005 21:39:35 -0000 1.7 @@ -13,6 +13,11 @@ tristate "PowerMac (AWACS, DACA, Burgundy, Tumbler, Keywest)" depends on SND && I2C && INPUT select SND_PCM + help + Say Y here to include support for the integrated sound device. + + To compile this driver as a module, choose M here: the module + will be called snd-powermac. config SND_GAMECUBE tristate "Nintendo GameCube audio" |
From: <aot...@us...> - 2005-01-04 21:40:29
|
Update of /cvsroot/gc-linux/linux/arch/ppc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24768/arch/ppc Modified Files: Kconfig Log Message: Merge 2.6.10 Index: Kconfig =================================================================== RCS file: /cvsroot/gc-linux/linux/arch/ppc/Kconfig,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- Kconfig 22 Oct 2004 20:06:10 -0000 1.21 +++ Kconfig 4 Jan 2005 21:39:00 -0000 1.22 @@ -11,6 +11,10 @@ config UID16 bool +config GENERIC_HARDIRQS + bool + default y + config RWSEM_GENERIC_SPINLOCK bool @@ -70,6 +74,7 @@ bool "POWER4 and 970 (G5)" config 8xx + depends on BROKEN bool "8xx" config E500 @@ -184,18 +189,6 @@ here. Saying Y here will not hurt performance (on any machine) but will increase the size of the kernel. -config CPU_FREQ - bool "CPU Frequency scaling" - help - Clock scaling allows you to change the clock speed of CPUs on the - fly. This is a nice method to save battery power on notebooks, - because the lower the clock speed, the less power the CPU consumes. - - For more information, take a look at <file:Documentation/cpu-freq> or - at <http://www.brodo.de/cpufreq/> - - If in doubt, say N. - source "drivers/cpufreq/Kconfig" config CPU_FREQ_PMAC @@ -794,16 +787,6 @@ bool "PC PS/2 style Keyboard" depends on 4xx || CPM2 -config SERIAL_CONSOLE - bool - depends on 8xx - default y - -config SERIAL_CONSOLE_BAUD - int - depends on EV64260 - default "115200" - config PPCBUG_NVRAM bool "Enable reading PPCBUG NVRAM during boot" if PPLUS || LOPEC default y if PPC_PREP |
From: <aot...@us...> - 2005-01-04 21:40:24
|
Update of /cvsroot/gc-linux/linux/arch/ppc/configs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24768/arch/ppc/configs Modified Files: gamecube_defconfig Log Message: Merge 2.6.10 Index: gamecube_defconfig =================================================================== RCS file: /cvsroot/gc-linux/linux/arch/ppc/configs/gamecube_defconfig,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- gamecube_defconfig 20 Oct 2004 22:48:10 -0000 1.24 +++ gamecube_defconfig 4 Jan 2005 21:39:03 -0000 1.25 @@ -1,9 +1,10 @@ # # Automatically generated make config: don't edit -# Linux kernel version: 2.6.9 -# Tue Oct 19 23:48:03 2004 +# Linux kernel version: 2.6.10 +# Tue Jan 4 22:33:25 2005 # CONFIG_MMU=y +CONFIG_GENERIC_HARDIRQS=y CONFIG_RWSEM_XCHGADD_ALGORITHM=y CONFIG_HAVE_DEC_LOCK=y CONFIG_PPC=y @@ -29,18 +30,19 @@ # CONFIG_AUDIT is not set CONFIG_LOG_BUF_SHIFT=14 # CONFIG_HOTPLUG is not set +CONFIG_KOBJECT_UEVENT=y # CONFIG_IKCONFIG is not set # CONFIG_EMBEDDED is not set CONFIG_KALLSYMS=y # CONFIG_KALLSYMS_EXTRA_PASS is not set CONFIG_FUTEX=y CONFIG_EPOLL=y -CONFIG_IOSCHED_NOOP=y -CONFIG_IOSCHED_AS=y -CONFIG_IOSCHED_DEADLINE=y -CONFIG_IOSCHED_CFQ=y # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set CONFIG_SHMEM=y +CONFIG_CC_ALIGN_FUNCTIONS=0 +CONFIG_CC_ALIGN_LABELS=0 +CONFIG_CC_ALIGN_LOOPS=0 +CONFIG_CC_ALIGN_JUMPS=0 # CONFIG_TINY_SHMEM is not set # @@ -51,6 +53,7 @@ # CONFIG_MODULE_FORCE_UNLOAD is not set CONFIG_OBSOLETE_MODPARM=y # CONFIG_MODVERSIONS is not set +# CONFIG_MODULE_SRCVERSION_ALL is not set CONFIG_KMOD=y # @@ -68,6 +71,7 @@ # CONFIG_CPU_FREQ is not set CONFIG_EMBEDDEDBOOT=y CONFIG_PPC_STD_MMU=y +CONFIG_NOT_COHERENT_CACHE=y # # Platform options @@ -128,6 +132,8 @@ CONFIG_LOWMEM_SIZE=0x30000000 CONFIG_KERNEL_START=0xc0000000 CONFIG_TASK_SIZE=0x80000000 +CONFIG_CONSISTENT_START=0xff100000 +CONFIG_CONSISTENT_SIZE=0x00200000 CONFIG_BOOT_LOAD=0x00800000 # @@ -160,13 +166,25 @@ # CONFIG_BLK_DEV_FD is not set # CONFIG_GAMECUBE_ARAM is not set # CONFIG_GAMECUBE_MEMCARD is not set +# CONFIG_GAMECUBE_SD is not set CONFIG_BLK_DEV_LOOP=y # CONFIG_BLK_DEV_CRYPTOLOOP is not set # CONFIG_BLK_DEV_NBD is not set CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_COUNT=16 CONFIG_BLK_DEV_RAM_SIZE=4096 CONFIG_BLK_DEV_INITRD=y +CONFIG_INITRAMFS_SOURCE="" CONFIG_LBD=y +# CONFIG_CDROM_PKTCDVD is not set + +# +# IO Schedulers +# +CONFIG_IOSCHED_NOOP=y +CONFIG_IOSCHED_AS=y +CONFIG_IOSCHED_DEADLINE=y +CONFIG_IOSCHED_CFQ=y # # ATA/ATAPI/MFM/RLL support @@ -226,6 +244,8 @@ # CONFIG_INET_ESP is not set # CONFIG_INET_IPCOMP is not set # CONFIG_INET_TUNNEL is not set +CONFIG_IP_TCPDIAG=y +# CONFIG_IP_TCPDIAG_IPV6 is not set # CONFIG_IPV6 is not set # CONFIG_NETFILTER is not set @@ -245,7 +265,6 @@ # CONFIG_NET_DIVERT is not set # CONFIG_ECONET is not set # CONFIG_WAN_ROUTER is not set -# CONFIG_NET_HW_FLOWCONTROL is not set # # QoS and/or fair queueing @@ -409,6 +428,7 @@ # # Misc devices # +CONFIG_GCN_GQR=m # # Multimedia devices @@ -425,6 +445,7 @@ # CONFIG_FB=y CONFIG_FB_MODE_HELPERS=y +# CONFIG_FB_TILEBLITTING is not set # CONFIG_FB_CT65550 is not set # CONFIG_FB_VGA16 is not set CONFIG_FB_GAMECUBE=y @@ -492,6 +513,12 @@ # # USB support # +# CONFIG_USB_ARCH_HAS_HCD is not set +# CONFIG_USB_ARCH_HAS_OHCI is not set + +# +# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information +# # # USB Gadget Support @@ -499,6 +526,11 @@ # CONFIG_USB_GADGET is not set # +# MMC/SD Card support +# +# CONFIG_MMC is not set + +# # File systems # CONFIG_EXT2_FS=y @@ -511,6 +543,7 @@ # CONFIG_MINIX_FS is not set # CONFIG_ROMFS_FS is not set # CONFIG_QUOTA is not set +CONFIG_DNOTIFY=y # CONFIG_AUTOFS_FS is not set # CONFIG_AUTOFS4_FS is not set @@ -539,6 +572,7 @@ # CONFIG_DEVFS_FS is not set # CONFIG_DEVPTS_FS_XATTR is not set CONFIG_TMPFS=y +# CONFIG_TMPFS_XATTR is not set # CONFIG_HUGETLB_PAGE is not set CONFIG_RAMFS=y @@ -625,7 +659,7 @@ # Library routines # # CONFIG_CRC_CCITT is not set -# CONFIG_CRC32 is not set +CONFIG_CRC32=y # CONFIG_LIBCRC32C is not set # @@ -641,6 +675,7 @@ # # Security options # +# CONFIG_KEYS is not set # CONFIG_SECURITY is not set # |
From: <aot...@us...> - 2005-01-04 21:40:23
|
Update of /cvsroot/gc-linux/linux/arch/ppc/boot/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24768/arch/ppc/boot/common Modified Files: util.S Log Message: Merge 2.6.10 Index: util.S =================================================================== RCS file: /cvsroot/gc-linux/linux/arch/ppc/boot/common/util.S,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- util.S 19 Oct 2004 23:18:39 -0000 1.5 +++ util.S 4 Jan 2005 21:39:01 -0000 1.6 @@ -27,6 +27,7 @@ .text +#ifdef CONFIG_6xx .globl disable_6xx_mmu disable_6xx_mmu: /* Establish default MSR value, exception prefix 0xFFF. @@ -121,6 +122,7 @@ sync isync blr +#endif .globl _setup_L2CR _setup_L2CR: |
From: <he...@us...> - 2005-01-04 21:37:32
|
Update of /cvsroot/gc-linux/htdocs/xml/en In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24631 Modified Files: news.xml Log Message: 3 January 200, SDLOAD Index: news.xml =================================================================== RCS file: /cvsroot/gc-linux/htdocs/xml/en/news.xml,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- news.xml 21 Dec 2004 17:54:25 -0000 1.29 +++ news.xml 4 Jan 2005 21:37:12 -0000 1.30 @@ -2,6 +2,11 @@ <?xml-stylesheet href="news.xsl" type="text/xsl"?> <news> <item> + <date>3 January 2005</date> + <title>SDLOAD</title> + <text>by <a href="http://www.gcdev.com/">Costis</a> allows the user to boot code on an unmodified GC within seconds, only with an Action Replay and an SD card. We also have a read-only SD card kernel driver by Rob.</text> + </item> + <item> <date>20 December 2004</date> <title>Chaos Communication Congress 2004</title> <text>Members of the GameCube-Linux and Xbox-Linux teams will be present at the <a href='http://www.ccc.de/congress/2004/'>21C3</a> in Berlin, December 27th to 29th. Thanks a lot to <a href='http://www.smartxx.com/'>Team SmartXX</a> for donating 4 hotel rooms (8 beds) - members of the SmartXX Team will also be at the 21C3 and you can meet them personally. Also don't miss the <a href='http://www.ccc.de/congress/2004/fahrplan-preview/day_1.html'>GameCube-Linux presentation</a>.</text> |
From: <rob...@us...> - 2004-12-30 10:21:24
|
Update of /cvsroot/gc-linux/ipl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12817 Modified Files: Makefile Log Message: fixed crappy dol by using doltool for generation (dol didn't load in pso) added makefile target pso to load the ipl using pso Index: Makefile =================================================================== RCS file: /cvsroot/gc-linux/ipl/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- Makefile 29 Dec 2004 11:10:29 -0000 1.1.1.1 +++ Makefile 30 Dec 2004 10:21:15 -0000 1.2 @@ -24,6 +24,12 @@ AS=$(CROSS)as CFLAGS_LOCAL= + +PSOLOAD=./psoload2 +DOLTOOL=./doltool + +PSOLOAD_ARGS=-i 192.168.100.30 + endif # Configuration @@ -85,8 +91,14 @@ .S.o: $(CC) $(AFLAGS) -c -o $@ $*.S -main.dol: dolhdr main.bin - cat dolhdr main.bin > $@ +#main.dol: dolhdr main.bin +# cat dolhdr main.bin > $@ + +psoload: main.dol + $(PSOLOAD) $(PSOLOAD_ARGS) main.dol + +main.dol: main.elf + $(DOLTOOL) -d main.elf main.bin: main.elf $(OBJCOPY) -O binary $< $@ |
From: <rob...@us...> - 2004-12-29 11:49:37
|
Update of /cvsroot/gc-linux/ipl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25026 Modified Files: main.c Log Message: fix include disk/sd.h in main.c Index: main.c =================================================================== RCS file: /cvsroot/gc-linux/ipl/main.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- main.c 29 Dec 2004 11:10:30 -0000 1.1.1.1 +++ main.c 29 Dec 2004 11:49:28 -0000 1.2 @@ -8,7 +8,7 @@ #include "video.h" #include "color.h" #include "time.h" -#include "sd.h" +#include "disk/sd.h" #include <linux/string.h> #include <network.h> #include <dvd.h> |
From: <rob...@us...> - 2004-12-29 11:46:18
|
Update of /cvsroot/gc-linux/ipl/lwip/core/ipv6 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24482 Added Files: README icmp6.c ip6.c ip6_addr.c Log Message: adding lwip/core/ipv6 --- NEW FILE: README --- IPv6 support in lwIP is very experimental. --- NEW FILE: icmp6.c --- /* * Copyright (c) 2001-2004 Swedish Institute of Computer Science. * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. * * Author: Adam Dunkels <ad...@si...> * */ /* Some ICMP messages should be passed to the transport protocols. This is not implemented. */ #include "lwip/opt.h" #include "lwip/icmp.h" #include "lwip/inet.h" #include "lwip/ip.h" #include "lwip/def.h" #include "lwip/stats.h" void icmp_input(struct pbuf *p, struct netif *inp) { unsigned char type; struct icmp_echo_hdr *iecho; struct ip_hdr *iphdr; struct ip_addr tmpaddr; #ifdef ICMP_STATS ++lwip_stats.icmp.recv; #endif /* ICMP_STATS */ /* TODO: check length before accessing payload! */ type = ((char *)p->payload)[0]; switch (type) { case ICMP6_ECHO: LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: ping\n")); if (p->tot_len < sizeof(struct icmp_echo_hdr)) { LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: bad ICMP echo received\n")); pbuf_free(p); #ifdef ICMP_STATS ++lwip_stats.icmp.lenerr; #endif /* ICMP_STATS */ return; } iecho = p->payload; iphdr = (struct ip_hdr *)((char *)p->payload - IP_HLEN); if (inet_chksum_pbuf(p) != 0) { LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: checksum failed for received ICMP echo (%x)\n", inet_chksum_pseudo(p, &(iphdr->src), &(iphdr->dest), IP_PROTO_ICMP, p->tot_len))); #ifdef ICMP_STATS ++lwip_stats.icmp.chkerr; #endif /* ICMP_STATS */ /* return;*/ } LWIP_DEBUGF(ICMP_DEBUG, ("icmp: p->len %d p->tot_len %d\n", p->len, p->tot_len)); ip_addr_set(&tmpaddr, &(iphdr->src)); ip_addr_set(&(iphdr->src), &(iphdr->dest)); ip_addr_set(&(iphdr->dest), &tmpaddr); iecho->type = ICMP6_ER; /* adjust the checksum */ if (iecho->chksum >= htons(0xffff - (ICMP6_ECHO << 8))) { iecho->chksum += htons(ICMP6_ECHO << 8) + 1; } else { iecho->chksum += htons(ICMP6_ECHO << 8); } LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: checksum failed for received ICMP echo (%x)\n", inet_chksum_pseudo(p, &(iphdr->src), &(iphdr->dest), IP_PROTO_ICMP, p->tot_len))); #ifdef ICMP_STATS ++lwip_stats.icmp.xmit; #endif /* ICMP_STATS */ /* LWIP_DEBUGF("icmp: p->len %u p->tot_len %u\n", p->len, p->tot_len);*/ ip_output_if (p, &(iphdr->src), IP_HDRINCL, iphdr->hoplim, IP_PROTO_ICMP, inp); break; default: LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: ICMP type %d not supported.\n", (int)type)); #ifdef ICMP_STATS ++lwip_stats.icmp.proterr; ++lwip_stats.icmp.drop; #endif /* ICMP_STATS */ } pbuf_free(p); } void icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t) { struct pbuf *q; struct ip_hdr *iphdr; struct icmp_dur_hdr *idur; q = pbuf_alloc(PBUF_IP, 8 + IP_HLEN + 8, PBUF_RAM); /* ICMP header + IP header + 8 bytes of data */ iphdr = p->payload; idur = q->payload; idur->type = (char)ICMP6_DUR; idur->icode = (char)t; memcpy((char *)q->payload + 8, p->payload, IP_HLEN + 8); /* calculate checksum */ idur->chksum = 0; idur->chksum = inet_chksum(idur, q->len); #ifdef ICMP_STATS ++lwip_stats.icmp.xmit; #endif /* ICMP_STATS */ ip_output(q, NULL, (struct ip_addr *)&(iphdr->src), ICMP_TTL, IP_PROTO_ICMP); pbuf_free(q); } void icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t) { struct pbuf *q; struct ip_hdr *iphdr; struct icmp_te_hdr *tehdr; LWIP_DEBUGF(ICMP_DEBUG, ("icmp_time_exceeded\n")); q = pbuf_alloc(PBUF_IP, 8 + IP_HLEN + 8, PBUF_RAM); iphdr = p->payload; tehdr = q->payload; tehdr->type = (char)ICMP6_TE; tehdr->icode = (char)t; /* copy fields from original packet */ memcpy((char *)q->payload + 8, (char *)p->payload, IP_HLEN + 8); /* calculate checksum */ tehdr->chksum = 0; tehdr->chksum = inet_chksum(tehdr, q->len); #ifdef ICMP_STATS ++lwip_stats.icmp.xmit; #endif /* ICMP_STATS */ ip_output(q, NULL, (struct ip_addr *)&(iphdr->src), ICMP_TTL, IP_PROTO_ICMP); pbuf_free(q); } --- NEW FILE: ip6.c --- /* * Copyright (c) 2001-2004 Swedish Institute of Computer Science. * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. * * Author: Adam Dunkels <ad...@si...> * */ /* ip.c * * This is the code for the IP layer for IPv6. * */ #include "lwip/opt.h" #include "lwip/def.h" #include "lwip/mem.h" #include "lwip/ip.h" #include "lwip/inet.h" #include "lwip/netif.h" #include "lwip/icmp.h" #include "lwip/udp.h" #include "lwip/tcp.h" #include "lwip/stats.h" #include "arch/perf.h" /* ip_init: * * Initializes the IP layer. */ void ip_init(void) { } /* ip_route: * * Finds the appropriate network interface for a given IP address. It searches the * list of network interfaces linearly. A match is found if the masked IP address of * the network interface equals the masked IP address given to the function. */ struct netif * ip_route(struct ip_addr *dest) { struct netif *netif; for(netif = netif_list; netif != NULL; netif = netif->next) { if (ip_addr_maskcmp(dest, &(netif->ip_addr), &(netif->netmask))) { return netif; } } return netif_default; } /* ip_forward: * * Forwards an IP packet. It finds an appropriate route for the packet, decrements * the TTL value of the packet, adjusts the checksum and outputs the packet on the * appropriate interface. */ static void ip_forward(struct pbuf *p, struct ip_hdr *iphdr) { struct netif *netif; PERF_START; if ((netif = ip_route((struct ip_addr *)&(iphdr->dest))) == NULL) { LWIP_DEBUGF(IP_DEBUG, ("ip_input: no forwarding route found for ")); #if IP_DEBUG ip_addr_debug_print(IP_DEBUG, &(iphdr->dest)); #endif /* IP_DEBUG */ LWIP_DEBUGF(IP_DEBUG, ("\n")); pbuf_free(p); return; } /* Decrement TTL and send ICMP if ttl == 0. */ if (--iphdr->hoplim == 0) { /* Don't send ICMP messages in response to ICMP messages */ if (iphdr->nexthdr != IP_PROTO_ICMP) { icmp_time_exceeded(p, ICMP_TE_TTL); } pbuf_free(p); return; } /* Incremental update of the IP checksum. */ /* if (iphdr->chksum >= htons(0xffff - 0x100)) { iphdr->chksum += htons(0x100) + 1; } else { iphdr->chksum += htons(0x100); }*/ LWIP_DEBUGF(IP_DEBUG, ("ip_forward: forwarding packet to ")); #if IP_DEBUG ip_addr_debug_print(IP_DEBUG, &(iphdr->dest)); #endif /* IP_DEBUG */ LWIP_DEBUGF(IP_DEBUG, ("\n")); #ifdef IP_STATS ++lwip_stats.ip.fw; ++lwip_stats.ip.xmit; #endif /* IP_STATS */ PERF_STOP("ip_forward"); netif->output(netif, p, (struct ip_addr *)&(iphdr->dest)); } /* ip_input: * * This function is called by the network interface device driver when an IP packet is * received. The function does the basic checks of the IP header such as packet size * being at least larger than the header size etc. If the packet was not destined for * us, the packet is forwarded (using ip_forward). The IP checksum is always checked. * * Finally, the packet is sent to the upper layer protocol input function. */ void ip_input(struct pbuf *p, struct netif *inp) { struct ip_hdr *iphdr; struct netif *netif; PERF_START; #if IP_DEBUG ip_debug_print(p); #endif /* IP_DEBUG */ #ifdef IP_STATS ++lwip_stats.ip.recv; #endif /* IP_STATS */ /* identify the IP header */ iphdr = p->payload; if (iphdr->v != 6) { LWIP_DEBUGF(IP_DEBUG, ("IP packet dropped due to bad version number\n")); #if IP_DEBUG ip_debug_print(p); #endif /* IP_DEBUG */ pbuf_free(p); #ifdef IP_STATS ++lwip_stats.ip.err; ++lwip_stats.ip.drop; #endif /* IP_STATS */ return; } /* is this packet for us? */ for(netif = netif_list; netif != NULL; netif = netif->next) { #if IP_DEBUG LWIP_DEBUGF(IP_DEBUG, ("ip_input: iphdr->dest ")); ip_addr_debug_print(IP_DEBUG, &(iphdr->dest)); LWIP_DEBUGF(IP_DEBUG, ("netif->ip_addr ")); ip_addr_debug_print(IP_DEBUG, &(netif->ip_addr)); LWIP_DEBUGF(IP_DEBUG, ("\n")); #endif /* IP_DEBUG */ if (ip_addr_cmp(&(iphdr->dest), &(netif->ip_addr))) { break; } } if (netif == NULL) { /* packet not for us, route or discard */ #ifdef IP_FORWARD ip_forward(p, iphdr); #endif pbuf_free(p); return; } pbuf_realloc(p, IP_HLEN + ntohs(iphdr->len)); /* send to upper layers */ #if IP_DEBUG /* LWIP_DEBUGF("ip_input: \n"); ip_debug_print(p); LWIP_DEBUGF("ip_input: p->len %u p->tot_len %u\n", p->len, p->tot_len);*/ #endif /* IP_DEBUG */ pbuf_header(p, -IP_HLEN); switch (iphdr->nexthdr) { case IP_PROTO_UDP: udp_input(p); break; case IP_PROTO_TCP: tcp_input(p); break; case IP_PROTO_ICMP: icmp_input(p, inp); break; default: /* send ICMP destination protocol unreachable */ icmp_dest_unreach(p, ICMP_DUR_PROTO); pbuf_free(p); LWIP_DEBUGF(IP_DEBUG, ("Unsupported transport protocol %u\n", iphdr->nexthdr)); #ifdef IP_STATS ++lwip_stats.ip.proterr; ++lwip_stats.ip.drop; #endif /* IP_STATS */ } PERF_STOP("ip_input"); } /* ip_output_if: * * Sends an IP packet on a network interface. This function constructs the IP header * and calculates the IP header checksum. If the source IP address is NULL, * the IP address of the outgoing network interface is filled in as source address. */ err_t ip_output_if (struct pbuf *p, struct ip_addr *src, struct ip_addr *dest, u8_t ttl, u8_t proto, struct netif *netif) { struct ip_hdr *iphdr; PERF_START; printf("len %u tot_len %u\n", p->len, p->tot_len); if (pbuf_header(p, IP_HLEN)) { LWIP_DEBUGF(IP_DEBUG, ("ip_output: not enough room for IP header in pbuf\n")); #ifdef IP_STATS ++lwip_stats.ip.err; #endif /* IP_STATS */ return ERR_BUF; } printf("len %u tot_len %u\n", p->len, p->tot_len); iphdr = p->payload; if (dest != IP_HDRINCL) { printf("!IP_HDRLINCL\n"); iphdr->hoplim = ttl; iphdr->nexthdr = proto; iphdr->len = htons(p->tot_len - IP_HLEN); ip_addr_set(&(iphdr->dest), dest); iphdr->v = 6; if (ip_addr_isany(src)) { ip_addr_set(&(iphdr->src), &(netif->ip_addr)); } else { ip_addr_set(&(iphdr->src), src); } } else { dest = &(iphdr->dest); } #ifdef IP_STATS ++lwip_stats.ip.xmit; #endif /* IP_STATS */ LWIP_DEBUGF(IP_DEBUG, ("ip_output_if: %c%c (len %u)\n", netif->name[0], netif->name[1], p->tot_len)); #if IP_DEBUG ip_debug_print(p); #endif /* IP_DEBUG */ PERF_STOP("ip_output_if"); return netif->output(netif, p, dest); } /* ip_output: * * Simple interface to ip_output_if. It finds the outgoing network interface and * calls upon ip_output_if to do the actual work. */ err_t ip_output(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest, u8_t ttl, u8_t proto) { struct netif *netif; if ((netif = ip_route(dest)) == NULL) { LWIP_DEBUGF(IP_DEBUG, ("ip_output: No route to 0x%lx\n", dest->addr)); #ifdef IP_STATS ++lwip_stats.ip.rterr; #endif /* IP_STATS */ return ERR_RTE; } return ip_output_if (p, src, dest, ttl, proto, netif); } #if IP_DEBUG void ip_debug_print(struct pbuf *p) { struct ip_hdr *iphdr = p->payload; char *payload; payload = (char *)iphdr + IP_HLEN; LWIP_DEBUGF(IP_DEBUG, ("IP header:\n")); LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n")); LWIP_DEBUGF(IP_DEBUG, ("|%2d | %x%x | %x%x | (v, traffic class, flow label)\n", iphdr->v, iphdr->tclass1, iphdr->tclass2, iphdr->flow1, iphdr->flow2)); LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n")); LWIP_DEBUGF(IP_DEBUG, ("| %5u | %2u | %2u | (len, nexthdr, hoplim)\n", ntohs(iphdr->len), iphdr->nexthdr, iphdr->hoplim)); LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n")); LWIP_DEBUGF(IP_DEBUG, ("| %4lx | %4lx | (src)\n", ntohl(iphdr->src.addr[0]) >> 16 & 0xffff, ntohl(iphdr->src.addr[0]) & 0xffff)); LWIP_DEBUGF(IP_DEBUG, ("| %4lx | %4lx | (src)\n", ntohl(iphdr->src.addr[1]) >> 16 & 0xffff, ntohl(iphdr->src.addr[1]) & 0xffff)); LWIP_DEBUGF(IP_DEBUG, ("| %4lx | %4lx | (src)\n", ntohl(iphdr->src.addr[2]) >> 16 & 0xffff, ntohl(iphdr->src.addr[2]) & 0xffff)); LWIP_DEBUGF(IP_DEBUG, ("| %4lx | %4lx | (src)\n", ntohl(iphdr->src.addr[3]) >> 16 & 0xffff, ntohl(iphdr->src.addr[3]) & 0xffff)); LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n")); LWIP_DEBUGF(IP_DEBUG, ("| %4lx | %4lx | (dest)\n", ntohl(iphdr->dest.addr[0]) >> 16 & 0xffff, ntohl(iphdr->dest.addr[0]) & 0xffff)); LWIP_DEBUGF(IP_DEBUG, ("| %4lx | %4lx | (dest)\n", ntohl(iphdr->dest.addr[1]) >> 16 & 0xffff, ntohl(iphdr->dest.addr[1]) & 0xffff)); LWIP_DEBUGF(IP_DEBUG, ("| %4lx | %4lx | (dest)\n", ntohl(iphdr->dest.addr[2]) >> 16 & 0xffff, ntohl(iphdr->dest.addr[2]) & 0xffff)); LWIP_DEBUGF(IP_DEBUG, ("| %4lx | %4lx | (dest)\n", ntohl(iphdr->dest.addr[3]) >> 16 & 0xffff, ntohl(iphdr->dest.addr[3]) & 0xffff)); LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n")); } #endif /* IP_DEBUG */ --- NEW FILE: ip6_addr.c --- /* * Copyright (c) 2001-2004 Swedish Institute of Computer Science. * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. * * Author: Adam Dunkels <ad...@si...> * */ #include "lwip/ip_addr.h" #include "lwip/inet.h" int ip_addr_maskcmp(struct ip_addr *addr1, struct ip_addr *addr2, struct ip_addr *mask) { return((addr1->addr[0] & mask->addr[0]) == (addr2->addr[0] & mask->addr[0]) && (addr1->addr[1] & mask->addr[1]) == (addr2->addr[1] & mask->addr[1]) && (addr1->addr[2] & mask->addr[2]) == (addr2->addr[2] & mask->addr[2]) && (addr1->addr[3] & mask->addr[3]) == (addr2->addr[3] & mask->addr[3])); } int ip_addr_cmp(struct ip_addr *addr1, struct ip_addr *addr2) { return(addr1->addr[0] == addr2->addr[0] && addr1->addr[1] == addr2->addr[1] && addr1->addr[2] == addr2->addr[2] && addr1->addr[3] == addr2->addr[3]); } void ip_addr_set(struct ip_addr *dest, struct ip_addr *src) { memcpy(dest, src, sizeof(struct ip_addr)); /* dest->addr[0] = src->addr[0]; dest->addr[1] = src->addr[1]; dest->addr[2] = src->addr[2]; dest->addr[3] = src->addr[3];*/ } int ip_addr_isany(struct ip_addr *addr) { if (addr == NULL) return 1; return((addr->addr[0] | addr->addr[1] | addr->addr[2] | addr->addr[3]) == 0); } /*#if IP_DEBUG*/ void ip_addr_debug_print(struct ip_addr *addr) { printf("%lx:%lx:%lx:%lx:%lx:%lx:%lx:%lx", ntohl(addr->addr[0]) >> 16 & 0xffff, ntohl(addr->addr[0]) & 0xffff, ntohl(addr->addr[1]) >> 16 & 0xffff, ntohl(addr->addr[1]) & 0xffff, ntohl(addr->addr[2]) >> 16 & 0xffff, ntohl(addr->addr[2]) & 0xffff, ntohl(addr->addr[3]) >> 16 & 0xffff, ntohl(addr->addr[3]) & 0xffff); } /*#endif*/ /* IP_DEBUG */ |
From: <rob...@us...> - 2004-12-29 11:45:17
|
Update of /cvsroot/gc-linux/ipl/lwip/core/ipv4 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24322 Added Files: icmp.c ip.c ip_addr.c ip_frag.c Log Message: adding lwip/ipv4 --- NEW FILE: icmp.c --- /* * Copyright (c) 2001-2004 Swedish Institute of Computer Science. * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. * * Author: Adam Dunkels <ad...@si...> * */ /* Some ICMP messages should be passed to the transport protocols. This is not implemented. */ #include "lwip/opt.h" #include "lwip/icmp.h" #include "lwip/inet.h" #include "lwip/ip.h" #include "lwip/def.h" #include "lwip/stats.h" #include "lwip/snmp.h" void icmp_input(struct pbuf *p, struct netif *inp) { unsigned char type; unsigned char code; struct icmp_echo_hdr *iecho; struct ip_hdr *iphdr; struct ip_addr tmpaddr; u16_t hlen; ICMP_STATS_INC(icmp.recv); snmp_inc_icmpinmsgs(); iphdr = p->payload; hlen = IPH_HL(iphdr) * 4; if (pbuf_header(p, -((s16_t)hlen)) || (p->tot_len < sizeof(u16_t)*2)) { LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: short ICMP (%u bytes) received\n", p->tot_len)); pbuf_free(p); ICMP_STATS_INC(icmp.lenerr); snmp_inc_icmpinerrors(); return; } type = *((u8_t *)p->payload); code = *(((u8_t *)p->payload)+1); switch (type) { case ICMP_ECHO: if (ip_addr_isbroadcast(&iphdr->dest, &inp->netmask) || ip_addr_ismulticast(&iphdr->dest)) { LWIP_DEBUGF(ICMP_DEBUG, ("Smurf.\n")); ICMP_STATS_INC(icmp.err); pbuf_free(p); return; } LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: ping\n")); if (p->tot_len < sizeof(struct icmp_echo_hdr)) { LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: bad ICMP echo received\n")); pbuf_free(p); ICMP_STATS_INC(icmp.lenerr); snmp_inc_icmpinerrors(); return; } iecho = p->payload; if (inet_chksum_pbuf(p) != 0) { LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: checksum failed for received ICMP echo\n")); pbuf_free(p); ICMP_STATS_INC(icmp.chkerr); snmp_inc_icmpinerrors(); return; } tmpaddr.addr = iphdr->src.addr; iphdr->src.addr = iphdr->dest.addr; iphdr->dest.addr = tmpaddr.addr; ICMPH_TYPE_SET(iecho, ICMP_ER); /* adjust the checksum */ if (iecho->chksum >= htons(0xffff - (ICMP_ECHO << 8))) { iecho->chksum += htons(ICMP_ECHO << 8) + 1; } else { iecho->chksum += htons(ICMP_ECHO << 8); } ICMP_STATS_INC(icmp.xmit); /* increase number of messages attempted to send */ snmp_inc_icmpoutmsgs(); /* increase number of echo replies attempted to send */ snmp_inc_icmpoutechoreps(); pbuf_header(p, hlen); ip_output_if(p, &(iphdr->src), IP_HDRINCL, IPH_TTL(iphdr), 0, IP_PROTO_ICMP, inp); break; default: LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: ICMP type %d code %d not supported.\n", (int)type, (int)code)); ICMP_STATS_INC(icmp.proterr); ICMP_STATS_INC(icmp.drop); } pbuf_free(p); } void icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t) { struct pbuf *q; struct ip_hdr *iphdr; struct icmp_dur_hdr *idur; q = pbuf_alloc(PBUF_IP, 8 + IP_HLEN + 8, PBUF_RAM); /* ICMP header + IP header + 8 bytes of data */ iphdr = p->payload; idur = q->payload; ICMPH_TYPE_SET(idur, ICMP_DUR); ICMPH_CODE_SET(idur, t); memcpy((char *)q->payload + 8, p->payload, IP_HLEN + 8); /* calculate checksum */ idur->chksum = 0; idur->chksum = inet_chksum(idur, q->len); ICMP_STATS_INC(icmp.xmit); /* increase number of messages attempted to send */ snmp_inc_icmpoutmsgs(); /* increase number of destination unreachable messages attempted to send */ snmp_inc_icmpoutdestunreachs(); ip_output(q, NULL, &(iphdr->src), ICMP_TTL, 0, IP_PROTO_ICMP); pbuf_free(q); } #if IP_FORWARD void icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t) { struct pbuf *q; struct ip_hdr *iphdr; struct icmp_te_hdr *tehdr; q = pbuf_alloc(PBUF_IP, 8 + IP_HLEN + 8, PBUF_RAM); iphdr = p->payload; LWIP_DEBUGF(ICMP_DEBUG, ("icmp_time_exceeded from ")); ip_addr_debug_print(ICMP_DEBUG, &(iphdr->src)); LWIP_DEBUGF(ICMP_DEBUG, (" to ")); ip_addr_debug_print(ICMP_DEBUG, &(iphdr->dest)); LWIP_DEBUGF(ICMP_DEBUG, ("\n")); tehdr = q->payload; ICMPH_TYPE_SET(tehdr, ICMP_TE); ICMPH_CODE_SET(tehdr, t); /* copy fields from original packet */ memcpy((char *)q->payload + 8, (char *)p->payload, IP_HLEN + 8); /* calculate checksum */ tehdr->chksum = 0; tehdr->chksum = inet_chksum(tehdr, q->len); ICMP_STATS_INC(icmp.xmit); /* increase number of messages attempted to send */ snmp_inc_icmpoutmsgs(); /* increase number of destination unreachable messages attempted to send */ snmp_inc_icmpouttimeexcds(); ip_output(q, NULL, &(iphdr->src), ICMP_TTL, 0, IP_PROTO_ICMP); pbuf_free(q); } #endif /* IP_FORWARD */ --- NEW FILE: ip.c --- /* * Copyright (c) 2001-2004 Swedish Institute of Computer Science. * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. * * Author: Adam Dunkels <ad...@si...> * */ /* ip.c * * This is the code for the IP layer. * */ #include "lwip/opt.h" #include "lwip/def.h" #include "lwip/mem.h" #include "lwip/ip.h" #include "lwip/ip_frag.h" #include "lwip/inet.h" #include "lwip/netif.h" #include "lwip/icmp.h" #include "lwip/raw.h" #include "lwip/udp.h" #include "lwip/tcp.h" #include "lwip/stats.h" #include "arch/perf.h" #include "lwip/snmp.h" #if LWIP_DHCP # include "lwip/dhcp.h" #endif /* LWIP_DHCP */ /* ip_init: * * Initializes the IP layer. */ void ip_init(void) { } /* ip_route: * * Finds the appropriate network interface for a given IP address. It * searches the list of network interfaces linearly. A match is found * if the masked IP address of the network interface equals the masked * IP address given to the function. */ struct netif * ip_route(struct ip_addr *dest) { struct netif *netif; /* iterate through netifs */ for(netif = netif_list; netif != NULL; netif = netif->next) { /* network mask matches? */ if (ip_addr_maskcmp(dest, &(netif->ip_addr), &(netif->netmask))) { /* return netif on which to forward IP packet */ return netif; } } /* no matching netif found, use default netif */ return netif_default; } #if IP_FORWARD /* ip_forward: * * Forwards an IP packet. It finds an appropriate route for the * packet, decrements the TTL value of the packet, adjusts the * checksum and outputs the packet on the appropriate interface. */ static void ip_forward(struct pbuf *p, struct ip_hdr *iphdr, struct netif *inp) { struct netif *netif; PERF_START; /* Find network interface where to forward this IP packet to. */ netif = ip_route((struct ip_addr *)&(iphdr->dest)); if (netif == NULL) { LWIP_DEBUGF(IP_DEBUG, ("ip_forward: no forwarding route for 0x%lx found\n", iphdr->dest.addr)); snmp_inc_ipnoroutes(); return; } /* Do not forward packets onto the same network interface on which they arrived. */ if (netif == inp) { LWIP_DEBUGF(IP_DEBUG, ("ip_forward: not bouncing packets back on incoming interface.\n")); snmp_inc_ipnoroutes(); return; } /* decrement TTL */ IPH_TTL_SET(iphdr, IPH_TTL(iphdr) - 1); /* send ICMP if TTL == 0 */ if (IPH_TTL(iphdr) == 0) { /* Don't send ICMP messages in response to ICMP messages */ if (IPH_PROTO(iphdr) != IP_PROTO_ICMP) { icmp_time_exceeded(p, ICMP_TE_TTL); snmp_inc_icmpouttimeexcds(); } return; } /* Incrementally update the IP checksum. */ if (IPH_CHKSUM(iphdr) >= htons(0xffff - 0x100)) { IPH_CHKSUM_SET(iphdr, IPH_CHKSUM(iphdr) + htons(0x100) + 1); } else { IPH_CHKSUM_SET(iphdr, IPH_CHKSUM(iphdr) + htons(0x100)); } LWIP_DEBUGF(IP_DEBUG, ("ip_forward: forwarding packet to 0x%lx\n", iphdr->dest.addr)); IP_STATS_INC(ip.fw); IP_STATS_INC(ip.xmit); snmp_inc_ipforwdatagrams(); PERF_STOP("ip_forward"); /* transmit pbuf on chosen interface */ netif->output(netif, p, (struct ip_addr *)&(iphdr->dest)); } #endif /* IP_FORWARD */ /* ip_input: * * This function is called by the network interface device driver when * an IP packet is received. The function does the basic checks of the * IP header such as packet size being at least larger than the header * size etc. If the packet was not destined for us, the packet is * forwarded (using ip_forward). The IP checksum is always checked. * * Finally, the packet is sent to the upper layer protocol input function. */ err_t ip_input(struct pbuf *p, struct netif *inp) { static struct ip_hdr *iphdr; static struct netif *netif; static u16_t iphdrlen; IP_STATS_INC(ip.recv); snmp_inc_ipinreceives(); /* identify the IP header */ iphdr = p->payload; if (IPH_V(iphdr) != 4) { LWIP_DEBUGF(IP_DEBUG | 1, ("IP packet dropped due to bad version number %u\n", IPH_V(iphdr))); ip_debug_print(p); pbuf_free(p); IP_STATS_INC(ip.err); IP_STATS_INC(ip.drop); snmp_inc_ipunknownprotos(); return ERR_OK; } /* obtain IP header length in number of 32-bit words */ iphdrlen = IPH_HL(iphdr); /* calculate IP header length in bytes */ iphdrlen *= 4; /* header length exceeds first pbuf length? */ if (iphdrlen > p->len) { LWIP_DEBUGF(IP_DEBUG | 2, ("IP header (len %u) does not fit in first pbuf (len %u), IP packet droppped.\n", iphdrlen, p->len)); /* free (drop) packet pbufs */ pbuf_free(p); IP_STATS_INC(ip.lenerr); IP_STATS_INC(ip.drop); snmp_inc_ipindiscards(); return ERR_OK; } /* verify checksum */ if (inet_chksum(iphdr, iphdrlen) != 0) { LWIP_DEBUGF(IP_DEBUG | 2, ("Checksum (0x%x) failed, IP packet dropped.\n", inet_chksum(iphdr, iphdrlen))); ip_debug_print(p); pbuf_free(p); IP_STATS_INC(ip.chkerr); IP_STATS_INC(ip.drop); snmp_inc_ipindiscards(); return ERR_OK; } /* Trim pbuf. This should have been done at the netif layer, but we'll do it anyway just to be sure that its done. */ pbuf_realloc(p, ntohs(IPH_LEN(iphdr))); /* is this packet for us? */ for(netif = netif_list; netif != NULL; netif = netif->next) { LWIP_DEBUGF(IP_DEBUG, ("ip_input: iphdr->dest 0x%lx netif->ip_addr 0x%lx (0x%lx, 0x%lx, 0x%lx)\n", iphdr->dest.addr, netif->ip_addr.addr, iphdr->dest.addr & netif->netmask.addr, netif->ip_addr.addr & netif->netmask.addr, iphdr->dest.addr & ~(netif->netmask.addr))); /* interface configured? */ if (!ip_addr_isany(&(netif->ip_addr))) { /* unicast to this interface address? */ if (ip_addr_cmp(&(iphdr->dest), &(netif->ip_addr)) || /* or broadcast matching this interface network address? */ (ip_addr_isbroadcast(&(iphdr->dest), &(netif->netmask)) && ip_addr_maskcmp(&(iphdr->dest), &(netif->ip_addr), &(netif->netmask))) || /* or restricted broadcast? */ ip_addr_cmp(&(iphdr->dest), IP_ADDR_BROADCAST)) { LWIP_DEBUGF(IP_DEBUG, ("ip_input: packet accepted on interface %c%c\n", netif->name[0], netif->name[1])); /* break out of for loop */ break; } } } #if LWIP_DHCP /* Pass DHCP messages regardless of destination address. DHCP traffic is addressed using link layer addressing (such as Ethernet MAC) so we must not filter on IP. According to RFC 1542 section 3.1.1, referred by RFC 2131). */ if (netif == NULL) { /* remote port is DHCP server? */ if (IPH_PROTO(iphdr) == IP_PROTO_UDP) { LWIP_DEBUGF(IP_DEBUG | DBG_TRACE | 1, ("ip_input: UDP packet to DHCP client port %u\n", ntohs(((struct udp_hdr *)((u8_t *)iphdr + iphdrlen))->dest))); if (ntohs(((struct udp_hdr *)((u8_t *)iphdr + iphdrlen))->dest) == DHCP_CLIENT_PORT) { LWIP_DEBUGF(IP_DEBUG | DBG_TRACE | 1, ("ip_input: DHCP packet accepted.\n")); netif = inp; } } } #endif /* LWIP_DHCP */ /* packet not for us? */ if (netif == NULL) { /* packet not for us, route or discard */ LWIP_DEBUGF(IP_DEBUG | DBG_TRACE | 1, ("ip_input: packet not for us.\n")); #if IP_FORWARD /* non-broadcast packet? */ if (!ip_addr_isbroadcast(&(iphdr->dest), &(inp->netmask))) { /* try to forward IP packet on (other) interfaces */ ip_forward(p, iphdr, inp); } else #endif /* IP_FORWARD */ { snmp_inc_ipindiscards(); } pbuf_free(p); return ERR_OK; } #if IP_REASSEMBLY if ((IPH_OFFSET(iphdr) & htons(IP_OFFMASK | IP_MF)) != 0) { LWIP_DEBUGF(IP_DEBUG, ("IP packet is a fragment (id=0x%04x tot_len=%u len=%u MF=%u offset=%u), calling ip_reass()\n", ntohs(IPH_ID(iphdr)), p->tot_len, ntohs(IPH_LEN(iphdr)), !!(IPH_OFFSET(iphdr) & htons(IP_MF)), (ntohs(IPH_OFFSET(iphdr)) & IP_OFFMASK)*8)); p = ip_reass(p); if (p == NULL) { return ERR_OK; } iphdr = p->payload; } #else /* IP_REASSEMBLY */ if ((IPH_OFFSET(iphdr) & htons(IP_OFFMASK | IP_MF)) != 0) { pbuf_free(p); LWIP_DEBUGF(IP_DEBUG | 2, ("IP packet dropped since it was fragmented (0x%x) (while IP_REASSEMBLY == 0).\n", ntohs(IPH_OFFSET(iphdr)))); IP_STATS_INC(ip.opterr); IP_STATS_INC(ip.drop); snmp_inc_ipunknownprotos(); return ERR_OK; } #endif /* IP_REASSEMBLY */ #if IP_OPTIONS == 0 if (iphdrlen > IP_HLEN) { LWIP_DEBUGF(IP_DEBUG | 2, ("IP packet dropped since there were IP options (while IP_OPTIONS == 0).\n")); pbuf_free(p); IP_STATS_INC(ip.opterr); IP_STATS_INC(ip.drop); snmp_inc_ipunknownprotos(); return ERR_OK; } #endif /* IP_OPTIONS == 0 */ /* send to upper layers */ LWIP_DEBUGF(IP_DEBUG, ("ip_input: \n")); ip_debug_print(p); LWIP_DEBUGF(IP_DEBUG, ("ip_input: p->len %d p->tot_len %d\n", p->len, p->tot_len)); #if LWIP_RAW if (!raw_input(p, inp)) { #endif /* LWIP_RAW */ switch (IPH_PROTO(iphdr)) { #if LWIP_UDP case IP_PROTO_UDP: case IP_PROTO_UDPLITE: snmp_inc_ipindelivers(); udp_input(p, inp); break; #endif /* LWIP_UDP */ #if LWIP_TCP case IP_PROTO_TCP: snmp_inc_ipindelivers(); tcp_input(p, inp); break; #endif /* LWIP_TCP */ case IP_PROTO_ICMP: snmp_inc_ipindelivers(); icmp_input(p, inp); break; default: /* send ICMP destination protocol unreachable unless is was a broadcast */ if (!ip_addr_isbroadcast(&(iphdr->dest), &(inp->netmask)) && !ip_addr_ismulticast(&(iphdr->dest))) { p->payload = iphdr; icmp_dest_unreach(p, ICMP_DUR_PROTO); } pbuf_free(p); LWIP_DEBUGF(IP_DEBUG | 2, ("Unsupported transport protocol %d\n", IPH_PROTO(iphdr))); IP_STATS_INC(ip.proterr); IP_STATS_INC(ip.drop); snmp_inc_ipunknownprotos(); } #if LWIP_RAW } /* LWIP_RAW */ #endif return ERR_OK; } /* ip_output_if: * * Sends an IP packet on a network interface. This function constructs * the IP header and calculates the IP header checksum. If the source * IP address is NULL, the IP address of the outgoing network * interface is filled in as source address. */ err_t ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest, u8_t ttl, u8_t tos, u8_t proto, struct netif *netif) { static struct ip_hdr *iphdr; static u16_t ip_id = 0; snmp_inc_ipoutrequests(); if (dest != IP_HDRINCL) { if (pbuf_header(p, IP_HLEN)) { LWIP_DEBUGF(IP_DEBUG | 2, ("ip_output: not enough room for IP header in pbuf\n")); IP_STATS_INC(ip.err); snmp_inc_ipoutdiscards(); return ERR_BUF; } iphdr = p->payload; IPH_TTL_SET(iphdr, ttl); IPH_PROTO_SET(iphdr, proto); ip_addr_set(&(iphdr->dest), dest); IPH_VHLTOS_SET(iphdr, 4, IP_HLEN / 4, tos); IPH_LEN_SET(iphdr, htons(p->tot_len)); IPH_OFFSET_SET(iphdr, htons(IP_DF)); IPH_ID_SET(iphdr, htons(ip_id)); ++ip_id; if (ip_addr_isany(src)) { ip_addr_set(&(iphdr->src), &(netif->ip_addr)); } else { ip_addr_set(&(iphdr->src), src); } IPH_CHKSUM_SET(iphdr, 0); IPH_CHKSUM_SET(iphdr, inet_chksum(iphdr, IP_HLEN)); } else { iphdr = p->payload; dest = &(iphdr->dest); } #if IP_FRAG /* don't fragment if interface has mtu set to 0 [loopif] */ if (netif->mtu && (p->tot_len > netif->mtu)) return ip_frag(p,netif,dest); #endif IP_STATS_INC(ip.xmit); LWIP_DEBUGF(IP_DEBUG, ("ip_output_if: %c%c%u\n", netif->name[0], netif->name[1], netif->num)); ip_debug_print(p); LWIP_DEBUGF(IP_DEBUG, ("netif->output()")); return netif->output(netif, p, dest); } /* ip_output: * * Simple interface to ip_output_if. It finds the outgoing network * interface and calls upon ip_output_if to do the actual work. */ err_t ip_output(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest, u8_t ttl, u8_t tos, u8_t proto) { struct netif *netif; if ((netif = ip_route(dest)) == NULL) { LWIP_DEBUGF(IP_DEBUG | 2, ("ip_output: No route to 0x%lx\n", dest->addr)); IP_STATS_INC(ip.rterr); snmp_inc_ipoutdiscards(); return ERR_RTE; } return ip_output_if(p, src, dest, ttl, tos, proto, netif); } #if IP_DEBUG void ip_debug_print(struct pbuf *p) { struct ip_hdr *iphdr = p->payload; u8_t *payload; payload = (u8_t *)iphdr + IP_HLEN; LWIP_DEBUGF(IP_DEBUG, ("IP header:\n")); LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n")); LWIP_DEBUGF(IP_DEBUG, ("|%2d |%2d | 0x%02x | %5u | (v, hl, tos, len)\n", IPH_V(iphdr), IPH_HL(iphdr), IPH_TOS(iphdr), ntohs(IPH_LEN(iphdr)))); LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n")); LWIP_DEBUGF(IP_DEBUG, ("| %5u |%u%u%u| %4u | (id, flags, offset)\n", ntohs(IPH_ID(iphdr)), ntohs(IPH_OFFSET(iphdr)) >> 15 & 1, ntohs(IPH_OFFSET(iphdr)) >> 14 & 1, ntohs(IPH_OFFSET(iphdr)) >> 13 & 1, ntohs(IPH_OFFSET(iphdr)) & IP_OFFMASK)); LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n")); LWIP_DEBUGF(IP_DEBUG, ("| %3u | %3u | 0x%04x | (ttl, proto, chksum)\n", IPH_TTL(iphdr), IPH_PROTO(iphdr), ntohs(IPH_CHKSUM(iphdr)))); LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n")); LWIP_DEBUGF(IP_DEBUG, ("| %3ld | %3ld | %3ld | %3ld | (src)\n", ntohl(iphdr->src.addr) >> 24 & 0xff, ntohl(iphdr->src.addr) >> 16 & 0xff, ntohl(iphdr->src.addr) >> 8 & 0xff, ntohl(iphdr->src.addr) & 0xff)); LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n")); LWIP_DEBUGF(IP_DEBUG, ("| %3ld | %3ld | %3ld | %3ld | (dest)\n", ntohl(iphdr->dest.addr) >> 24 & 0xff, ntohl(iphdr->dest.addr) >> 16 & 0xff, ntohl(iphdr->dest.addr) >> 8 & 0xff, ntohl(iphdr->dest.addr) & 0xff)); LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n")); } #endif /* IP_DEBUG */ --- NEW FILE: ip_addr.c --- /* * Copyright (c) 2001-2004 Swedish Institute of Computer Science. * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. * * Author: Adam Dunkels <ad...@si...> * */ #include "lwip/ip_addr.h" #include "lwip/inet.h" /* used by IP_ADDR_ANY and IP_ADDR_BROADCAST in ip_addr.h */ const struct ip_addr ip_addr_any = { 0x00000000UL }; const struct ip_addr ip_addr_broadcast = { 0xffffffffUL }; --- NEW FILE: ip_frag.c --- /* * Copyright (c) 2001-2004 Swedish Institute of Computer Science. * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. * * Author: Jani Monoses <ja...@iv...> * original reassembly code by Adam Dunkels <ad...@si...> * */ /* ip_frag.c * * This is the code for IP segmentation and reassembly * */ #include "lwip/opt.h" #include "lwip/sys.h" #include "lwip/ip.h" #include "lwip/ip_frag.h" #include "lwip/netif.h" #include "lwip/stats.h" /* * Copy len bytes from offset in pbuf to buffer * * helper used by both ip_reass and ip_frag */ static struct pbuf * copy_from_pbuf(struct pbuf *p, u16_t * offset, u8_t * buffer, u16_t len) { u16_t l; p->payload = (u8_t *)p->payload + *offset; p->len -= *offset; while (len) { l = len < p->len ? len : p->len; memcpy(buffer, p->payload, l); buffer += l; len -= l; if (len) p = p->next; else *offset = l; } return p; } #define IP_REASS_BUFSIZE 5760 #define IP_REASS_MAXAGE 30 #define IP_REASS_TMO 1000 static u8_t ip_reassbuf[IP_HLEN + IP_REASS_BUFSIZE]; static u8_t ip_reassbitmap[IP_REASS_BUFSIZE / (8 * 8)]; static const u8_t bitmap_bits[8] = { 0xff, 0x7f, 0x3f, 0x1f, 0x0f, 0x07, 0x03, 0x01 }; static u16_t ip_reasslen; static u8_t ip_reassflags; #define IP_REASS_FLAG_LASTFRAG 0x01 static u8_t ip_reasstmr; /* Reassembly timer */ static void ip_reass_timer(void *arg) { (void)arg; if (ip_reasstmr > 1) { ip_reasstmr--; sys_timeout(IP_REASS_TMO, ip_reass_timer, NULL); } else if (ip_reasstmr == 1) ip_reasstmr = 0; } struct pbuf * ip_reass(struct pbuf *p) { struct pbuf *q; struct ip_hdr *fraghdr, *iphdr; u16_t offset, len; u16_t i; IPFRAG_STATS_INC(ip_frag.recv); iphdr = (struct ip_hdr *) ip_reassbuf; fraghdr = (struct ip_hdr *) p->payload; /* If ip_reasstmr is zero, no packet is present in the buffer, so we write the IP header of the fragment into the reassembly buffer. The timer is updated with the maximum age. */ if (ip_reasstmr == 0) { LWIP_DEBUGF(IP_REASS_DEBUG, ("ip_reass: new packet\n")); memcpy(iphdr, fraghdr, IP_HLEN); ip_reasstmr = IP_REASS_MAXAGE; sys_timeout(IP_REASS_TMO, ip_reass_timer, NULL); ip_reassflags = 0; /* Clear the bitmap. */ memset(ip_reassbitmap, 0, sizeof(ip_reassbitmap)); } /* Check if the incoming fragment matches the one currently present in the reasembly buffer. If so, we proceed with copying the fragment into the buffer. */ if (ip_addr_cmp(&iphdr->src, &fraghdr->src) && ip_addr_cmp(&iphdr->dest, &fraghdr->dest) && IPH_ID(iphdr) == IPH_ID(fraghdr)) { LWIP_DEBUGF(IP_REASS_DEBUG, ("ip_reass: matching old packet\n")); IPFRAG_STATS_INC(ip_frag.cachehit); /* Find out the offset in the reassembly buffer where we should copy the fragment. */ len = ntohs(IPH_LEN(fraghdr)) - IPH_HL(fraghdr) * 4; offset = (ntohs(IPH_OFFSET(fraghdr)) & IP_OFFMASK) * 8; /* If the offset or the offset + fragment length overflows the reassembly buffer, we discard the entire packet. */ if (offset > IP_REASS_BUFSIZE || offset + len > IP_REASS_BUFSIZE) { LWIP_DEBUGF(IP_REASS_DEBUG, ("ip_reass: fragment outside of buffer (%d:%d/%d).\n", offset, offset + len, IP_REASS_BUFSIZE)); sys_untimeout(ip_reass_timer, NULL); ip_reasstmr = 0; goto nullreturn; } /* Copy the fragment into the reassembly buffer, at the right offset. */ LWIP_DEBUGF(IP_REASS_DEBUG, ("ip_reass: copying with offset %d into %d:%d\n", offset, IP_HLEN + offset, IP_HLEN + offset + len)); i = IPH_HL(fraghdr) * 4; copy_from_pbuf(p, &i, &ip_reassbuf[IP_HLEN + offset], len); /* Update the bitmap. */ if (offset / (8 * 8) == (offset + len) / (8 * 8)) { LWIP_DEBUGF(IP_REASS_DEBUG, ("ip_reass: updating single byte in bitmap.\n")); /* If the two endpoints are in the same byte, we only update that byte. */ ip_reassbitmap[offset / (8 * 8)] |= bitmap_bits[(offset / 8) & 7] & ~bitmap_bits[((offset + len) / 8) & 7]; } else { /* If the two endpoints are in different bytes, we update the bytes in the endpoints and fill the stuff inbetween with 0xff. */ ip_reassbitmap[offset / (8 * 8)] |= bitmap_bits[(offset / 8) & 7]; LWIP_DEBUGF(IP_REASS_DEBUG, ("ip_reass: updating many bytes in bitmap (%d:%d).\n", 1 + offset / (8 * 8), (offset + len) / (8 * 8))); for (i = 1 + offset / (8 * 8); i < (offset + len) / (8 * 8); ++i) { ip_reassbitmap[i] = 0xff; } ip_reassbitmap[(offset + len) / (8 * 8)] |= ~bitmap_bits[((offset + len) / 8) & 7]; } /* If this fragment has the More Fragments flag set to zero, we know that this is the last fragment, so we can calculate the size of the entire packet. We also set the IP_REASS_FLAG_LASTFRAG flag to indicate that we have received the final fragment. */ if ((ntohs(IPH_OFFSET(fraghdr)) & IP_MF) == 0) { ip_reassflags |= IP_REASS_FLAG_LASTFRAG; ip_reasslen = offset + len; LWIP_DEBUGF(IP_REASS_DEBUG, ("ip_reass: last fragment seen, total len %d\n", ip_reasslen)); } /* Finally, we check if we have a full packet in the buffer. We do this by checking if we have the last fragment and if all bits in the bitmap are set. */ if (ip_reassflags & IP_REASS_FLAG_LASTFRAG) { /* Check all bytes up to and including all but the last byte in the bitmap. */ for (i = 0; i < ip_reasslen / (8 * 8) - 1; ++i) { if (ip_reassbitmap[i] != 0xff) { LWIP_DEBUGF(IP_REASS_DEBUG, ("ip_reass: last fragment seen, bitmap %d/%d failed (%x)\n", i, ip_reasslen / (8 * 8) - 1, ip_reassbitmap[i])); goto nullreturn; } } /* Check the last byte in the bitmap. It should contain just the right amount of bits. */ if (ip_reassbitmap[ip_reasslen / (8 * 8)] != (u8_t) ~ bitmap_bits[ip_reasslen / 8 & 7]) { LWIP_DEBUGF(IP_REASS_DEBUG, ("ip_reass: last fragment seen, bitmap %d didn't contain %x (%x)\n", ip_reasslen / (8 * 8), ~bitmap_bits[ip_reasslen / 8 & 7], ip_reassbitmap[ip_reasslen / (8 * 8)])); goto nullreturn; } /* Pretend to be a "normal" (i.e., not fragmented) IP packet from now on. */ ip_reasslen += IP_HLEN; IPH_LEN_SET(iphdr, htons(ip_reasslen)); IPH_OFFSET_SET(iphdr, 0); IPH_CHKSUM_SET(iphdr, 0); IPH_CHKSUM_SET(iphdr, inet_chksum(iphdr, IP_HLEN)); /* If we have come this far, we have a full packet in the buffer, so we allocate a pbuf and copy the packet into it. We also reset the timer. */ sys_untimeout(ip_reass_timer, NULL); ip_reasstmr = 0; pbuf_free(p); p = pbuf_alloc(PBUF_LINK, ip_reasslen, PBUF_POOL); if (p != NULL) { i = 0; for (q = p; q != NULL; q = q->next) { /* Copy enough bytes to fill this pbuf in the chain. The available data in the pbuf is given by the q->len variable. */ LWIP_DEBUGF(IP_REASS_DEBUG, ("ip_reass: memcpy from %p (%d) to %p, %d bytes\n", &ip_reassbuf[i], i, q->payload, q->len > ip_reasslen - i ? ip_reasslen - i : q->len)); memcpy(q->payload, &ip_reassbuf[i], q->len > ip_reasslen - i ? ip_reasslen - i : q->len); i += q->len; } IPFRAG_STATS_INC(ip_frag.fw); } else { IPFRAG_STATS_INC(ip_frag.memerr); } LWIP_DEBUGF(IP_REASS_DEBUG, ("ip_reass: p %p\n", (void*)p)); return p; } } nullreturn: IPFRAG_STATS_INC(ip_frag.drop); pbuf_free(p); return NULL; } #define MAX_MTU 1500 static u8_t buf[MEM_ALIGN_SIZE(MAX_MTU)]; /** * Fragment an IP packet if too large * * Chop the packet in mtu sized chunks and send them in order * by using a fixed size static memory buffer (PBUF_ROM) */ err_t ip_frag(struct pbuf *p, struct netif *netif, struct ip_addr *dest) { struct pbuf *rambuf; struct pbuf *header; struct ip_hdr *iphdr; u16_t nfb = 0; u16_t left, cop; u16_t mtu = netif->mtu; u16_t ofo, omf; u16_t last; u16_t poff = IP_HLEN; u16_t tmp; /* Get a RAM based MTU sized pbuf */ rambuf = pbuf_alloc(PBUF_LINK, 0, PBUF_REF); rambuf->tot_len = rambuf->len = mtu; rambuf->payload = MEM_ALIGN((void *)buf); /* Copy the IP header in it */ iphdr = rambuf->payload; memcpy(iphdr, p->payload, IP_HLEN); /* Save original offset */ tmp = ntohs(IPH_OFFSET(iphdr)); ofo = tmp & IP_OFFMASK; omf = tmp & IP_MF; left = p->tot_len - IP_HLEN; while (left) { last = (left <= mtu - IP_HLEN); /* Set new offset and MF flag */ ofo += nfb; tmp = omf | (IP_OFFMASK & (ofo)); if (!last) tmp = tmp | IP_MF; IPH_OFFSET_SET(iphdr, htons(tmp)); /* Fill this fragment */ nfb = (mtu - IP_HLEN) / 8; cop = last ? left : nfb * 8; p = copy_from_pbuf(p, &poff, (u8_t *) iphdr + IP_HLEN, cop); /* Correct header */ IPH_LEN_SET(iphdr, htons(cop + IP_HLEN)); IPH_CHKSUM_SET(iphdr, 0); IPH_CHKSUM_SET(iphdr, inet_chksum(iphdr, IP_HLEN)); if (last) pbuf_realloc(rambuf, left + IP_HLEN); /* This part is ugly: we alloc a RAM based pbuf for * the link level header for each chunk and then * free it.A PBUF_ROM style pbuf for which pbuf_header * worked would make things simpler. */ header = pbuf_alloc(PBUF_LINK, 0, PBUF_RAM); pbuf_chain(header, rambuf); netif->output(netif, header, dest); IPFRAG_STATS_INC(ip_frag.xmit); pbuf_free(header); left -= cop; } pbuf_free(rambuf); return ERR_OK; } |
From: <rob...@us...> - 2004-12-29 11:41:19
|
Update of /cvsroot/gc-linux/ipl/lwip/core/ipv6 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23847/ipv6 Log Message: Directory /cvsroot/gc-linux/ipl/lwip/core/ipv6 added to the repository |
From: <rob...@us...> - 2004-12-29 11:41:04
|
Update of /cvsroot/gc-linux/ipl/lwip/core/ipv4 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23783/ipv4 Log Message: Directory /cvsroot/gc-linux/ipl/lwip/core/ipv4 added to the repository |
From: <rob...@us...> - 2004-12-29 11:24:47
|
Update of /cvsroot/gc-linux/ipl/lwip/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21573/core Log Message: Directory /cvsroot/gc-linux/ipl/lwip/core added to the repository |
From: <aot...@us...> - 2004-12-23 23:30:31
|
Update of /cvsroot/gc-linux/linux/drivers/video In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5524/drivers/video Removed Files: fbmem.c Log Message: Obsolete with driver init moving into driver-specific files (2.6.9) --- fbmem.c DELETED --- |
From: <he...@us...> - 2004-12-21 17:57:19
|
Update of /cvsroot/gc-linux/htdocs/xml/en In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3801 Modified Files: yagcd.xml Log Message: Removed the link to the broken online yagcd. Index: yagcd.xml =================================================================== RCS file: /cvsroot/gc-linux/htdocs/xml/en/yagcd.xml,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- yagcd.xml 6 Dec 2004 13:37:38 -0000 1.10 +++ yagcd.xml 21 Dec 2004 17:56:51 -0000 1.11 @@ -12,9 +12,6 @@ <li /><a href="../../down/yet_another_gamecube_doc.txt.tar.gz">txt</a> (for terminal users and easy grep-ing)<br /> -<br />and last not least the online version is -<li /><a href="yagcd/index.html">here</a><br /> - <br />for the curious there is now a <a href="../../down/yagcd_changelog.txt">changelog</a> |
From: <he...@us...> - 2004-12-21 17:54:35
|
Update of /cvsroot/gc-linux/htdocs/xml/en In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2986 Modified Files: news.xml Log Message: 20 December 2004, Chaos Communication Congress 2004 Index: news.xml =================================================================== RCS file: /cvsroot/gc-linux/htdocs/xml/en/news.xml,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- news.xml 7 Dec 2004 10:51:55 -0000 1.28 +++ news.xml 21 Dec 2004 17:54:25 -0000 1.29 @@ -2,6 +2,11 @@ <?xml-stylesheet href="news.xsl" type="text/xsl"?> <news> <item> + <date>20 December 2004</date> + <title>Chaos Communication Congress 2004</title> + <text>Members of the GameCube-Linux and Xbox-Linux teams will be present at the <a href='http://www.ccc.de/congress/2004/'>21C3</a> in Berlin, December 27th to 29th. Thanks a lot to <a href='http://www.smartxx.com/'>Team SmartXX</a> for donating 4 hotel rooms (8 beds) - members of the SmartXX Team will also be at the 21C3 and you can meet them personally. Also don't miss the <a href='http://www.ccc.de/congress/2004/fahrplan-preview/day_1.html'>GameCube-Linux presentation</a>.</text> + </item> + <item> <date>6 December 2004</date> <title>X Server experiments</title> <text>Wallbraker and Stonebone have been playing around with some X servers. They have managed to compile The KDrive Tiny X Server with the existing SDL port and their mouse emulation hack, thus getting a functional X Server. <a href="pic/fluxcube.png">Here</a> is a screenshot of their early work.</text> |
From: <rob...@us...> - 2004-12-10 12:23:45
|
Update of /cvsroot/gc-linux/linux/drivers/exi In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17179/drivers/exi Modified Files: gcn-exi-lite-tmbinc-exi_c.c Log Message: Added the SD and MMC card driver (alpha) Modified gcn-exi-lite-tmbinc-exi_c.c to output 0xff's upon *reading* from the exi bus, instead of outputting semi-random data. This is a requirement to meet the SD spec, and should not influence other drivers using the exi framework Index: gcn-exi-lite-tmbinc-exi_c.c =================================================================== RCS file: /cvsroot/gc-linux/linux/drivers/exi/gcn-exi-lite-tmbinc-exi_c.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- gcn-exi-lite-tmbinc-exi_c.c 19 Oct 2004 22:49:40 -0000 1.1 +++ gcn-exi-lite-tmbinc-exi_c.c 10 Dec 2004 12:23:34 -0000 1.2 @@ -28,6 +28,11 @@ volatile unsigned long *exi = (volatile unsigned long *)0xCC006800; if (mode == EXI_WRITE) exi[channel * 5 + 4] = *(unsigned long*)data; + else + /* even if we read, something is sent out. What should it be? + make it 0xffffffff. This makes sure the SD-card driver is happy */ + exi[channel * 5 + 4] = (unsigned long) 0xffffffff; + exi[channel * 5 + 3] = ((len-1)<<4)|(mode<<2)|1; if (mode == EXI_READ) { |
From: <rob...@us...> - 2004-12-10 12:23:45
|
Update of /cvsroot/gc-linux/linux/drivers/block In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17179/drivers/block Modified Files: Kconfig Makefile Added Files: gcn-sd.c Log Message: Added the SD and MMC card driver (alpha) Modified gcn-exi-lite-tmbinc-exi_c.c to output 0xff's upon *reading* from the exi bus, instead of outputting semi-random data. This is a requirement to meet the SD spec, and should not influence other drivers using the exi framework --- NEW FILE: gcn-sd.c --- /* * drivers/block/gcn-sd.c * * Nintendo GameCube SD/MMC memory card driver * Copyright (C) 2004 The GameCube Linux Team * * Copyright (C) 2004 by Rob Reilink (ro...@re...) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * */ /* * * THE AUTHOR OF THIS SOFTWARE AND HARDWARE CAN NOT BE HELD LIABLE * FOR ANY POSSIBLE DAMAGE CAUSED TO THE GAMECUBE, THE SD- OR MMC * CARD OR ANY OTHER HARDWARE USED. YOU USE THIS INFORMATION AND * SOFTWARE AT YOUR OWN RISK * * How to connect the SD/MMC card to the GC * * GC P5 (mem card B) SD/MMC * 2 gnd 3,6 vss1,vss2 * 4 3v3 4 vdd * 5 do 2 DataIn * 7 di 7 DataOut * 9 /cs 1 /CS * 11 clk 5 clk * 1 connected to 12 (card detect) * * According to 'good electronics practise' it is advised to solder a 100nF * capacitor between vdd and vss near the SD/MMC connector * * Please note the layout of the pads on the sd card: * __________________ * / | * / 1 2 3 4 5 6 7 8 | * | 9 | * | | * | | * | | * | | * | | * | | * | | * | | * |___________________| * * Pin 8 and 9 do not exist on the MMC card; that explains the 'weird' numbering * * To connect the card to the gamecube you can either solder wires to the bottom * side of the mainboard (they can be led to the outside through a hole in the metal * shielding on the right of the cube, but be sure the wires do not get damaged by * the sharp edge) or scrap a GC memory card. For the last option, ne sure that the * original electronics are disconnected! * * If you choose to connect it by soldering, do not use the memory card slot anymore! * * For the connection to the card, it seems you can use an old floppy connector, but * there are also special SD connectors available. The SD connector accepts both SD * and MMC cards; the MMC connector only accepts MMC cards (they are thinner). It is * therefore better to buy an SD connector. * * Note that this software has only been tested with an SD card. * The MMC-adaptor commercially available has not been tested, but might work as well */ /* Software hints * * # This driver is in alpha stage: * Only reading supported, not writing * Card size is reported as about 100MB, it is not read from the card * Cards are NOT hot-pluggable * The driver cannot be compiled as module due to dependence of the * EXI driver which is still 'work in progress' * * # add the following line to /drivers/block/Makefile: * obj-$(CONFIG_GAMECUBE_SD) += gcn-sd.o * * # add the following lines to /drivers/block/Kconfig: * config GAMECUBE_SD * tristate "Nintendo GameCube SD and MMC memory card (EXPERIMENTAL)" * depends on GAMECUBE && EXI && EXPERIMENTAL * help * This enables support for SD and MMC memory cards * * # to support fat, it might be nescessary to select cp437=y under Filesystems->NLS * * # This is the author's first real kernel driver, so please tell me * how it 'should have been done' ;) */ /* * TODO: clean up this */ #include <linux/module.h> /* Needed by all modules */ #include <linux/kernel.h> /* Needed for KERN_ALERT */ #include <linux/fs.h> #include <linux/init.h> #include <linux/ioport.h> #include <linux/exi.h> #include <asm/uaccess.h> #include <linux/blkdev.h> #ifndef EXI_LITE #error Sorry, this driver needs currently the gcn-exi-lite framework. #endif #define DEVICE_NAME "gcn-sd" #define DRIVER_AUTHOR "Rob Reilink <ro...@re...>" #define DRIVER_DESC "Gamecube SD-card driver" #define DRIVER_MODULE_NAME "gcn-sd" #define PFX DRIVER_MODULE_NAME ": " #define GCN_SD_MAJOR 0 #define SUCCESS 0 #define FAIL -1 #define GCN_SD_SPEED 4 static int Major; static struct request_queue *queue; static struct gcn_sd_device_struct { unsigned long size; spinlock_t lock; struct gendisk *gd; } gcn_sd_device; /* * Funtions start here * */ /* * EXI/SD functions * */ static char gcn_sd_cmd_short_nofinish(unsigned char cmd) { unsigned char dat; int tries; exi_select(1,0,GCN_SD_SPEED); dat=cmd|0x40; exi_write(1,&dat,1); dat=255; for (tries=0;(tries < 30) && (dat == 0xff);tries++) exi_read(1,&dat,1); return dat; } static char gcn_sd_cmd_nofinish(unsigned char cmd, unsigned long data) { unsigned char snd[6],ret; int tries; exi_select(1,0,GCN_SD_SPEED); snd[0]=cmd|0x40; snd[1]=data >> 24; snd[2]=(data >> 16) & 0xff; snd[3]=(data >> 8) & 0xff; snd[4]=data & 0xff; snd[5]=0x95; exi_write(1,&snd,6); //wait loop ret=0xff; for(tries=0;(tries<100) && (ret==0xff);tries++) exi_read(1,&ret,1); return ret; } static void gcn_sd_finish(void) { unsigned char zero=0; exi_deselect(1); /*last dummy write. This may look weird, accessing the device after it has been deselected, but the SD manual states that a SD card needs 8 extra clock cycles *after* deselection, and this is how to generate those */ exi_write(1, &zero, 1); } inline static char gcn_sd_cmd(unsigned char cmd) { char i=gcn_sd_cmd_nofinish(cmd,0); gcn_sd_finish(); return i; } inline static char gcn_sd_cmd_short(unsigned char cmd) { char i=gcn_sd_cmd_short_nofinish(cmd); gcn_sd_finish(); return i; } /* returns: found?SUCCESS:FAIL */ static int gcn_sd_init(void) { int i,ret; long c; int tries=0; //Send 80 clocks while not selected exi_select(1,1,GCN_SD_SPEED); //SLOOW TODO:fast, select=-1 ofzo (niets selecten) exi_deselect(1); for(i=0;i<20;i++) { c=0xffffffff; exi_write(1,&c,4); } //send CMD0 to init gcn_sd_cmd(0); gcn_sd_cmd_short(0); for(tries=0;tries<100;tries++) { if ((ret=gcn_sd_cmd_short(58))==0) return SUCCESS; printk(KERN_ALERT PFX "cmd 58 returned %d\n",ret); if ((ret=gcn_sd_cmd_short(1))==0) return SUCCESS; printk(KERN_ALERT PFX "cmd 1 returned %d\n",ret); } return FAIL; } static int gcn_sd_read_csd(void) { unsigned char c; unsigned char data[16]; int tries; c=gcn_sd_cmd_short_nofinish(9); if (c!=0) { gcn_sd_finish(); printk(KERN_INFO PFX "could not read csd(%d)\n",c); return FAIL; } for (tries=0;(tries<100000) & (c!=0xfe);tries++) exi_read(1,&c,1); if (c!=0xfe) { gcn_sd_finish(); printk(KERN_ERR PFX "error: no start token after csd read request\n"); return FAIL; } exi_read(1,data,16); gcn_sd_finish(); int i; printk(KERN_INFO PFX "CSD data:"); for (i=0;i<16;i++) printk ("%x ",data[i]); printk("\n"); return SUCCESS; } static int gcn_sd_block_read(unsigned long sector,void * data) { unsigned char c; long dummy; int tries; c=gcn_sd_cmd_nofinish(17,(sector) << 9); if (c!=0) { gcn_sd_finish(); printk(KERN_ERR PFX "error: read command returned %d while reading sector %lu\n" ,c,sector); return FAIL; } //Wait for start of data token 0xfe TODO put this in a function for (tries=0;(tries<100000) & (c!=0xfe);tries++) exi_read(1,&c,1); if (c!=0xfe) { gcn_sd_finish(); printk(KERN_ERR PFX "error: no start token after read request sector=%lu\n" ,sector); return FAIL; } exi_read(1,data,512); exi_read(1,&dummy,3); //response,CRC, dummy. todo: use it? gcn_sd_finish(); return SUCCESS; } /* * Block driver functions * */ static void gcn_sd_request(request_queue_t *q) { struct request *req; int sector,tries,success; while ((req=elv_next_request(q)) != NULL) { if (!blk_fs_request(req)) { end_request(req,0); continue; } if (rq_data_dir(req)) { //write printk(KERN_ALERT "WRITE not implemented yet\n"); /* gcn_sd_read_csd(); gcn_sd_init(); if (gcn_sd_init()==SUCCESS) { printk(KERN_ALERT PFX "resetting succeeded\n"); } else { printk(KERN_ALERT PFX "resetting failed\n"); } end_request(req,1);*/ } else { //read //printk(KERN_ALERT "READ start=%lu num=%u\n", (unsigned long)req->sector,req->current_nr_sectors); success=1; tries=0; //process one sector at a time for (sector=0;sector < req->current_nr_sectors;sector++) { if (gcn_sd_block_read(req->sector+sector,req->buffer+(sector<<9))==SUCCESS) { tries=0; } else { tries++; sector--; if (tries>10) { success=0; break; } } } end_request(req,success); //TODO 0 } } } static int gcn_sd_open (struct inode *inode, struct file *file) { // printk(KERN_INFO "gcn-sd device driver: open\n"); return SUCCESS; } static int gcn_sd_release(struct inode *inode, struct file *file) { // printk(KERN_INFO "gcn-sd device driver: release\n"); return SUCCESS; } struct block_device_operations gcn_sd_bdops = { //TODO: ioctl? open: gcn_sd_open, release: gcn_sd_release }; static int __init init_gcn_sd(void) { if (gcn_sd_init()!=SUCCESS) { printk(KERN_WARNING PFX "No SD-card found; driver not registered\n"); return 0; //TODO: what should we return? } printk(KERN_INFO PFX "SD-card found\n"); // gcn_sd_read_csd(); //Init device struct gcn_sd_device.size=200000*512; spin_lock_init(&gcn_sd_device.lock); //Registed device, get major number Major = register_blkdev(GCN_SD_MAJOR, DEVICE_NAME); if (Major <= 0) { printk(KERN_ALERT PFX "Registering the block device failed with %d\n", Major); return Major; } printk(KERN_INFO PFX "got major %d\n",Major); //Init gendisk gcn_sd_device.gd=alloc_disk(16); if (!gcn_sd_device.gd) { printk(KERN_ALERT PFX "Could not allocate gendisk\n"); //TODO:unreg return -EFAULT; } gcn_sd_device.gd->major=Major; gcn_sd_device.gd->first_minor=0; gcn_sd_device.gd->fops=&gcn_sd_bdops; gcn_sd_device.gd->private_data=&gcn_sd_device; strcpy(gcn_sd_device.gd->disk_name,"gcnsd0"); set_capacity(gcn_sd_device.gd, 200000); //TODO //init queue queue = blk_init_queue(gcn_sd_request, &gcn_sd_device.lock); if (queue == NULL) { printk(KERN_ALERT PFX "Could not init queue\n"); //TODO: unreg return -EFAULT; } blk_queue_hardsect_size(queue, 512); gcn_sd_device.gd->queue = queue; //add the disk add_disk(gcn_sd_device.gd); return 0; } static void __exit cleanup_gcn_sd(void) { printk(KERN_INFO PFX "unloading\n"); int ret = unregister_blkdev(Major, DRIVER_MODULE_NAME); if (ret < 0) printk(KERN_ALERT "Error in unregister_blkdev: %d\n", ret); } MODULE_LICENSE("GPL"); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); module_init(init_gcn_sd); module_exit(cleanup_gcn_sd); Index: Kconfig =================================================================== RCS file: /cvsroot/gc-linux/linux/drivers/block/Kconfig,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- Kconfig 19 Oct 2004 23:47:09 -0000 1.8 +++ Kconfig 10 Dec 2004 12:23:34 -0000 1.9 @@ -83,6 +83,22 @@ To compile this driver as a module, choose M here: the module will be called gcn-memcard. +config GAMECUBE_SD + tristate "Nintendo GameCube SD and MMC memory card (EXPERIMENTAL)" + depends on GAMECUBE && EXI && EXPERIMENTAL + help + This enables support for SD and MMC cards + WARNING: driver is in alpha stage. Only reading supported. Card + is reported as around 100MB, its size is not read from the card. + Cards are NOT hot-pluggable. Compilation as module is broken. + + You probably want to compile FAT support, and the required + codepages, or mount wil complain. See Filesystems -> DOS/FAT/NT + filesystems and Filesystems -> Native Language Support + + For schematic to connect the SD or MMC card, and more notes and + warnings, see drivers/block/gcn-sd.c + config ATARI_ACSI tristate "Atari ACSI support" depends on ATARI && BROKEN Index: Makefile =================================================================== RCS file: /cvsroot/gc-linux/linux/drivers/block/Makefile,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- Makefile 19 Oct 2004 23:47:09 -0000 1.8 +++ Makefile 10 Dec 2004 12:23:34 -0000 1.9 @@ -30,6 +30,7 @@ obj-$(CONFIG_AMIGA_Z2RAM) += z2ram.o obj-$(CONFIG_GAMECUBE_ARAM) += gcn-aram.o obj-$(CONFIG_GAMECUBE_MEMCARD) += gcn-memcard.o +obj-$(CONFIG_GAMECUBE_SD) += gcn-sd.o obj-$(CONFIG_BLK_DEV_RAM) += rd.o obj-$(CONFIG_BLK_DEV_LOOP) += loop.o obj-$(CONFIG_BLK_DEV_PS2) += ps2esdi.o |
From: <he...@us...> - 2004-12-07 10:52:56
|
Update of /cvsroot/gc-linux/htdocs/pic In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32419 Added Files: fluxcube.png Log Message: 6 December 2004, X Server experiments --- NEW FILE: fluxcube.png --- (This appears to be a binary file; contents omitted.) |
From: <he...@us...> - 2004-12-07 10:52:05
|
Update of /cvsroot/gc-linux/htdocs/xml/en In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32200 Modified Files: news.xml Log Message: 6 December 2004, X Server experiments Index: news.xml =================================================================== RCS file: /cvsroot/gc-linux/htdocs/xml/en/news.xml,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- news.xml 16 Nov 2004 22:42:31 -0000 1.27 +++ news.xml 7 Dec 2004 10:51:55 -0000 1.28 @@ -2,6 +2,11 @@ <?xml-stylesheet href="news.xsl" type="text/xsl"?> <news> <item> + <date>6 December 2004</date> + <title>X Server experiments</title> + <text>Wallbraker and Stonebone have been playing around with some X servers. They have managed to compile The KDrive Tiny X Server with the existing SDL port and their mouse emulation hack, thus getting a functional X Server. <a href="pic/fluxcube.png">Here</a> is a screenshot of their early work.</text> + </item> + <item> <date>16 November 2004</date> <title>Latest kernel build, now targetted for nbd-root too</title> <text>As the recently released nbd-root concept seems to make it easy for users to try gc-linux (specially Windows users), from now on the <a href="docs/download.html">Latest Kernel Build</a> for nbd-root will be available too on the download page.</text> |
From: <pal...@us...> - 2004-12-06 18:35:26
|
Update of /cvsroot/gc-linux/libgx/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20533/include Added Files: ps_cast.h Log Message: Added PS Fast Casting --- NEW FILE: ps_cast.h --- #ifndef __PS_CAST__ #define __PS_CAST__ #ifdef __cplusplus extern "C" { #endif /* returns 0 on success */ int PSInitFastCast(); void PSCastSingleF32toU8(float *f,unsigned char *c); void PSCastSingleU8toF32(unsigned char *c,float *f); void PSCastSingleF32toU16(float *f,unsigned short *s); void PSCastSingleU16toF32(unsigned short *s,float *f); void PSCastSingleF32toS8(float *f,char *c); void PSCastSingleS8toF32(char *c,float *f); void PSCastSingleF32toS16(float *f,short *s); void PSCastSingleS16toF32(short *s,float *f); void PSCastDoubleF32toU8(float *f,unsigned char *c); void PSCastDoubleU8toF32(unsigned char *c,float *f); void PSCastDoubleF32toU16(float *f,unsigned short *s); void PSCastDoubleU16toF32(unsigned short *s,float *f); void PSCastDoubleF32toS8(float *f,char *c); void PSCastDoubleS8toF32(char *c,float *f); void PSCastDoubleF32toS16(float *f,short *s); void PSCastDoubleS16toF32(short *s,float *f); void PSCopy2Floats(float *dest,float *src); #ifdef __cplusplus } #endif #endif |
From: <pal...@us...> - 2004-12-06 18:35:25
|
Update of /cvsroot/gc-linux/libgx/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20533/src Modified Files: Makefile.am Added Files: ps_cast.S ps_cast_init.c Log Message: Added PS Fast Casting --- NEW FILE: ps_cast.S --- #include "asm.h" #define DECLARES(prefix,float,int,gqr_arg,gqr) \ _GLOBAL(PSCast##prefix##float##to##int) \ psql f0,0(r3),gqr_arg,gqr0; \ psqst f0,0(r4),gqr_arg,gqr; \ blr; \ _GLOBAL(PSCast##prefix##int##to##float) \ psql f0,0(r3),gqr_arg,gqr; \ psqst f0,0(r4),gqr_arg,gqr0; \ blr; #define DECLARE(a,b,c) DECLARES(Single,a,b,1,c) DECLARES(Double,a,b,0,c) DECLARE(F32,U8,gqr2) DECLARE(F32,U16,gqr3) DECLARE(F32,S8,gqr4) DECLARE(F32,S16,gqr5) _GLOBAL(PSCopy2Floats) psql f0,0(r4),0,gqr0 psqst f0,0(r3),0,gqr0 blr --- NEW FILE: ps_cast_init.c --- #include <unistd.h> #include <fcntl.h> #include <errno.h> #include "ps_cast.h" /* GQR is 2-7 LD_SCALE 13-15 LD_TYPE 18-23 ST_SCALE 29-31 ST_TYPE ST_TYPE is 0 - single-precision floating-point (no conversion) 1-3 reserved 4 u8 5 u16 6 s8 7 s16 */ #define TYPE_U8 4 #define TYPE_U16 5 #define TYPE_S8 6 #define TYPE_S16 7 #define SCALE_NONE 0 #define MAKE_GQR(ls,lt,ss,st) (((ls) << 24)|((lt) << 16)|((ss) << 8)|(st)) static int Load(unsigned int gqr,unsigned int value) { char fname[64]; int fd; int len; int ret; /* open the device */ sprintf(fname,"/proc/sys/gqr/gqr%i",gqr); fd = open(fname,O_RDWR); if (fd < 0) return errno; len = sprintf(fname,"%u",value); ret = (write(fd,fname,len) != len); close(fd); return ret; } int PSInitFastCast() { return (Load(0,0) || /* GQR 2 - u8 */ Load(2,MAKE_GQR(SCALE_NONE,TYPE_U8,SCALE_NONE,TYPE_U8)) || /* GQR 3 - u16 */ Load(3,MAKE_GQR(SCALE_NONE,TYPE_U16,SCALE_NONE,TYPE_U16)) || /* GQR 4 - s8 */ Load(4,MAKE_GQR(SCALE_NONE,TYPE_S8,SCALE_NONE,TYPE_S8)) || /* GQR 5 - s16 */ Load(5,MAKE_GQR(SCALE_NONE,TYPE_S16,SCALE_NONE,TYPE_S16))); } Index: Makefile.am =================================================================== RCS file: /cvsroot/gc-linux/libgx/src/Makefile.am,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Makefile.am 31 Oct 2004 22:34:59 -0000 1.2 +++ Makefile.am 6 Dec 2004 18:35:15 -0000 1.3 @@ -2,5 +2,5 @@ AM_CFLAGS=-Wa,-mgekko -Wa,-mregnames -Wa,-gstabs+ lib_LTLIBRARIES = libgx.la -libgx_la_SOURCES=gx.c gu.c gx_asm.S gu_asm.S +libgx_la_SOURCES=gx.c gu.c gx_asm.S gu_asm.S ps_cast_init.c ps_cast.S |
From: <pal...@us...> - 2004-12-06 18:35:25
|
Update of /cvsroot/gc-linux/libgx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20533 Modified Files: ChangeLog Makefile.am Log Message: Added PS Fast Casting Index: ChangeLog =================================================================== RCS file: /cvsroot/gc-linux/libgx/ChangeLog,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- ChangeLog 22 Oct 2004 20:13:53 -0000 1.1.1.1 +++ ChangeLog 6 Dec 2004 18:35:14 -0000 1.2 @@ -2,3 +2,6 @@ Initial checkin +12/6/2004 - tcj + +Added the PSCast functions Index: Makefile.am =================================================================== RCS file: /cvsroot/gc-linux/libgx/Makefile.am,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- Makefile.am 22 Oct 2004 20:13:53 -0000 1.1.1.1 +++ Makefile.am 6 Dec 2004 18:35:14 -0000 1.2 @@ -2,4 +2,4 @@ SUBDIRS = src -include_HEADERS=include/gx.h include/gu.h +include_HEADERS=include/gx.h include/gu.h include/ps_cast.h |
From: <he...@us...> - 2004-12-06 14:02:34
|
Update of /cvsroot/gc-linux/htdocs/down In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22065 Added Files: dmesg.txt zImage-nfs.isobel.txt Log Message: Added some of the files in down/ being referenced on the web site. --- NEW FILE: dmesg.txt --- Total memory = 23MB; using 64kB for hash table (at c01c0000) Linux version 2.6.1 (mist@l) (gcc version 3.3) #5 Tue Feb 3 00:30:18 CET 2004 On node 0 totalpages: 5964 DMA zone: 5964 pages, LIFO batch:1 Normal zone: 0 pages, LIFO batch:1 HighMem zone: 0 pages, LIFO batch:1 Building zonelist for node : 0 Kernel command line: root=/dev/ram0 video=gamecubefb ip=192.168.0.47 PID hash table entries: 128 (order 7: 1024 bytes) Console: colour dummy device 80x25 Memory: 21512k available (1200k kernel code, 452k data, 100k init, 0k highmem) Calibrating delay loop... 484.96 BogoMIPS Dentry cache hash table entries: 4096 (order: 2, 16384 bytes) Inode-cache hash table entries: 2048 (order: 1, 8192 bytes) Mount-cache hash table entries: 512 (order: 0, 4096 bytes) checking if image is initramfs...it isn't (no cpio magic); looks like an initrd Freeing initrd memory: 249k freed POSIX conformance testing by UNIFIX NET: Registered protocol family 16 PCI: Probing PCI hardware gamecubefb: framebuffer at 0x174c000, mapped to 0xd174c000, size 720k gamecubefb: mode is 640x576x16, linelength=1280, pages=0 fb0: GameCube frame buffer device enable_irq(1) unbalanced enable_irq(2) unbalanced ikconfig 0.7 with /proc/config* devfs: v1.22 (20021013) Richard Gooch (rg...@at...) devfs: boot_options: 0x0 Console: switching to colour frame buffer device 80x36 pty: 256 Unix98 ptys configured Generic RTC Driver v1.07 RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize loop: loaded (max 8 devices) eth0: Nintendo GameCube broadband adapter, 00:09:bf:01:c8:a4. Console: switching to colour frame buffer device 80x36 mice: PS/2 mouse device common for all mice NET: Registered protocol family 2 IP: routing cache hash table of 512 buckets, 4Kbytes TCP: Hash tables configured (established 1024 bind 2048) IP-Config: Guessing netmask 255.255.255.0 IP-Config: Complete: device=eth0, addr=192.168.0.47, mask=255.255.255.0, gw=255.255.255.255, host=192.168.0.47, domain=, nis-domain=(none), bootserver=255.255.255.255, rootserver=255.255.255.255, rootpath= NET: Registered protocol family 1 RAMDISK: Compressed image found at block 0 VFS: Mounted root (ext2 filesystem) readonly. Freeing unused kernel memory: 100k init --- NEW FILE: zImage-nfs.isobel.txt --- GameCube NFS-Root PICO-HOWTO ____________________________ zImage-nfs.isobel.dol works on the following test environment: Subnet: 192.168.0.0 255.255.255.0 ----------+----------------------+-------- | | | | +------+-------+ +------+-------+ | NFS Server | | GameCube | | 192.168.0.49 | | 192.168.0.47 | +--------------+ +--------------+ /nfsroot/cube The nfs server must be configured to export the /nfsroot/cube directory like in the following /etc/exports file: # cat /etc/exports /nfsroot/cube 192.168.0.47(rw,sync,no_root_squash) Steve_- has provided a 22 MB Debian base system image for the use with NFS-Root (you can dump it over /nfsroot/cube). Read the howto at: http://www.gc-linux.org/down/debian_woody-unconfigured_base.guide.txt Get the image at http://www.gc-linux.org/down/ Cheers, isobel |
From: <he...@us...> - 2004-12-06 13:59:46
|
Update of /cvsroot/gc-linux/htdocs/xml/en In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21353 Modified Files: download.xml Log Message: Fixed link afer moving down/old/zImage-nfs.isobel.txt to down/zImage-nfs.isobel.txt. Index: download.xml =================================================================== RCS file: /cvsroot/gc-linux/htdocs/xml/en/download.xml,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- download.xml 16 Nov 2004 22:41:52 -0000 1.10 +++ download.xml 6 Dec 2004 13:59:20 -0000 1.11 @@ -17,7 +17,7 @@ <p>This build always has the latest features, but might not work reliably. You may choose between two different kernel images.</p> - <p>The <a href="../down/isobel/zImage.nfs.dol">zImage.nfs.dol (~1 MB)</a> requires a NFS-served <a href="http://www.tldp.org/HOWTO/NFS-Root.html">root</a> filesystem, like vaguely described <a href="../down/old/zImage-nfs.isobel.txt">here</a>. If you are on Linux, and have already played with NFS, try this image.</p> + <p>The <a href="../down/isobel/zImage.nfs.dol">zImage.nfs.dol (~1 MB)</a> requires a NFS-served <a href="http://www.tldp.org/HOWTO/NFS-Root.html">root</a> filesystem, like vaguely described <a href="../down/zImage-nfs.isobel.txt">here</a>. If you are on Linux, and have already played with NFS, try this image.</p> <p>The <a href="../down/isobel/zImage.nbdc.dol">zImage.nbdc.dol (~1.7 MB)</a> requires a nbd-root, like described <a href="../down/isobel/nbd-root/readme.txt">here</a>. If your PC runs Windows, or you are new to Linux, use this image.</p> |
From: <he...@us...> - 2004-12-06 13:54:43
|
Update of /cvsroot/gc-linux/htdocs/down In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20626/down Log Message: Directory /cvsroot/gc-linux/htdocs/down added to the repository |