digi.c (104094) | digi.c (109623) |
---|---|
1/*- 2 * Copyright (c) 2001 Brian Somers <brian@Awfulhak.org> 3 * based on work by Slawa Olhovchenkov 4 * John Prince <johnp@knight-trosoft.com> 5 * Eric Hernes 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 12 unchanged lines hidden (view full) --- 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * | 1/*- 2 * Copyright (c) 2001 Brian Somers <brian@Awfulhak.org> 3 * based on work by Slawa Olhovchenkov 4 * John Prince <johnp@knight-trosoft.com> 5 * Eric Hernes 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 12 unchanged lines hidden (view full) --- 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * |
29 * $FreeBSD: head/sys/dev/digi/digi.c 104094 2002-09-28 17:15:38Z phk $ | 29 * $FreeBSD: head/sys/dev/digi/digi.c 109623 2003-01-21 08:56:16Z alfred $ |
30 */ 31 32/*- 33 * TODO: 34 * Figure out what the con bios stuff is supposed to do 35 * Test with *LOTS* more cards - I only have a PCI8r and an ISA Xem. 36 */ 37 --- 503 unchanged lines hidden (view full) --- 541 sc->numports = 256; 542 } else 543 device_printf(sc->dev, "%s, %d ports found\n", sc->name, 544 sc->numports); 545 546 if (sc->ports) 547 free(sc->ports, M_TTYS); 548 sc->ports = malloc(sizeof(struct digi_p) * sc->numports, | 30 */ 31 32/*- 33 * TODO: 34 * Figure out what the con bios stuff is supposed to do 35 * Test with *LOTS* more cards - I only have a PCI8r and an ISA Xem. 36 */ 37 --- 503 unchanged lines hidden (view full) --- 541 sc->numports = 256; 542 } else 543 device_printf(sc->dev, "%s, %d ports found\n", sc->name, 544 sc->numports); 545 546 if (sc->ports) 547 free(sc->ports, M_TTYS); 548 sc->ports = malloc(sizeof(struct digi_p) * sc->numports, |
549 M_TTYS, M_WAITOK | M_ZERO); | 549 M_TTYS, M_ZERO); |
550 551 if (sc->ttys) 552 free(sc->ttys, M_TTYS); 553 sc->ttys = malloc(sizeof(struct tty) * sc->numports, | 550 551 if (sc->ttys) 552 free(sc->ttys, M_TTYS); 553 sc->ttys = malloc(sizeof(struct tty) * sc->numports, |
554 M_TTYS, M_WAITOK | M_ZERO); | 554 M_TTYS, M_ZERO); |
555 556 /* 557 * XXX Should read port 0xc90 for an array of 2byte values, 1 per 558 * port. If the value is 0, the port is broken.... 559 */ 560 561 ptr = sc->setwin(sc, 0); 562 --- 467 unchanged lines hidden (view full) --- 1030 int modlen, res; 1031 1032 KASSERT(sc->bios.data == NULL, ("Uninitialised BIOS variable")); 1033 KASSERT(sc->fep.data == NULL, ("Uninitialised FEP variable")); 1034 KASSERT(sc->link.data == NULL, ("Uninitialised LINK variable")); 1035 KASSERT(sc->module != NULL, ("Uninitialised module name")); 1036 1037 modlen = strlen(sc->module); | 555 556 /* 557 * XXX Should read port 0xc90 for an array of 2byte values, 1 per 558 * port. If the value is 0, the port is broken.... 559 */ 560 561 ptr = sc->setwin(sc, 0); 562 --- 467 unchanged lines hidden (view full) --- 1030 int modlen, res; 1031 1032 KASSERT(sc->bios.data == NULL, ("Uninitialised BIOS variable")); 1033 KASSERT(sc->fep.data == NULL, ("Uninitialised FEP variable")); 1034 KASSERT(sc->link.data == NULL, ("Uninitialised LINK variable")); 1035 KASSERT(sc->module != NULL, ("Uninitialised module name")); 1036 1037 modlen = strlen(sc->module); |
1038 modfile = malloc(modlen + 6, M_TEMP, M_WAITOK); | 1038 modfile = malloc(modlen + 6, M_TEMP, 0); |
1039 snprintf(modfile, modlen + 6, "digi_%s", sc->module); 1040 if ((res = linker_reference_module(modfile, NULL, &lf)) != 0) { 1041 if (res == ENOENT && rootdev == NODEV) 1042 printf("%s: Failed to autoload module: No filesystem\n", 1043 modfile); 1044 else 1045 printf("%s: Failed %d to autoload module\n", modfile, 1046 res); 1047 } 1048 free(modfile, M_TEMP); 1049 if (res != 0) 1050 return (res); 1051 | 1039 snprintf(modfile, modlen + 6, "digi_%s", sc->module); 1040 if ((res = linker_reference_module(modfile, NULL, &lf)) != 0) { 1041 if (res == ENOENT && rootdev == NODEV) 1042 printf("%s: Failed to autoload module: No filesystem\n", 1043 modfile); 1044 else 1045 printf("%s: Failed %d to autoload module\n", modfile, 1046 res); 1047 } 1048 free(modfile, M_TEMP); 1049 if (res != 0) 1050 return (res); 1051 |
1052 sym = malloc(modlen + 10, M_TEMP, M_WAITOK); | 1052 sym = malloc(modlen + 10, M_TEMP, 0); |
1053 snprintf(sym, modlen + 10, "digi_mod_%s", sc->module); 1054 if ((symptr = linker_file_lookup_symbol(lf, sym, 0)) == NULL) 1055 printf("digi_%s.ko: Symbol `%s' not found\n", sc->module, sym); 1056 free(sym, M_TEMP); 1057 1058 digi_mod = (struct digi_mod *)symptr; 1059 if (digi_mod->dm_version != DIGI_MOD_VERSION) { 1060 printf("digi_%s.ko: Invalid version %d (need %d)\n", 1061 sc->module, digi_mod->dm_version, DIGI_MOD_VERSION); 1062 linker_file_unload(lf); 1063 return (EINVAL); 1064 } 1065 1066 sc->bios.size = digi_mod->dm_bios.size; 1067 if (sc->bios.size != 0 && digi_mod->dm_bios.data != NULL) { | 1053 snprintf(sym, modlen + 10, "digi_mod_%s", sc->module); 1054 if ((symptr = linker_file_lookup_symbol(lf, sym, 0)) == NULL) 1055 printf("digi_%s.ko: Symbol `%s' not found\n", sc->module, sym); 1056 free(sym, M_TEMP); 1057 1058 digi_mod = (struct digi_mod *)symptr; 1059 if (digi_mod->dm_version != DIGI_MOD_VERSION) { 1060 printf("digi_%s.ko: Invalid version %d (need %d)\n", 1061 sc->module, digi_mod->dm_version, DIGI_MOD_VERSION); 1062 linker_file_unload(lf); 1063 return (EINVAL); 1064 } 1065 1066 sc->bios.size = digi_mod->dm_bios.size; 1067 if (sc->bios.size != 0 && digi_mod->dm_bios.data != NULL) { |
1068 sc->bios.data = malloc(sc->bios.size, M_TTYS, M_WAITOK); | 1068 sc->bios.data = malloc(sc->bios.size, M_TTYS, 0); |
1069 bcopy(digi_mod->dm_bios.data, sc->bios.data, sc->bios.size); 1070 } 1071 1072 sc->fep.size = digi_mod->dm_fep.size; 1073 if (sc->fep.size != 0 && digi_mod->dm_fep.data != NULL) { | 1069 bcopy(digi_mod->dm_bios.data, sc->bios.data, sc->bios.size); 1070 } 1071 1072 sc->fep.size = digi_mod->dm_fep.size; 1073 if (sc->fep.size != 0 && digi_mod->dm_fep.data != NULL) { |
1074 sc->fep.data = malloc(sc->fep.size, M_TTYS, M_WAITOK); | 1074 sc->fep.data = malloc(sc->fep.size, M_TTYS, 0); |
1075 bcopy(digi_mod->dm_fep.data, sc->fep.data, sc->fep.size); 1076 } 1077 1078 sc->link.size = digi_mod->dm_link.size; 1079 if (sc->link.size != 0 && digi_mod->dm_link.data != NULL) { | 1075 bcopy(digi_mod->dm_fep.data, sc->fep.data, sc->fep.size); 1076 } 1077 1078 sc->link.size = digi_mod->dm_link.size; 1079 if (sc->link.size != 0 && digi_mod->dm_link.data != NULL) { |
1080 sc->link.data = malloc(sc->link.size, M_TTYS, M_WAITOK); | 1080 sc->link.data = malloc(sc->link.size, M_TTYS, 0); |
1081 bcopy(digi_mod->dm_link.data, sc->link.data, sc->link.size); 1082 } 1083 1084 linker_file_unload(lf); 1085 1086 return (0); 1087} 1088 --- 875 unchanged lines hidden --- | 1081 bcopy(digi_mod->dm_link.data, sc->link.data, sc->link.size); 1082 } 1083 1084 linker_file_unload(lf); 1085 1086 return (0); 1087} 1088 --- 875 unchanged lines hidden --- |