📄 aic79xx_osm.c
字号:
intahd_dmamap_load(struct ahd_softc *ahd, bus_dma_tag_t dmat, bus_dmamap_t map, void *buf, bus_size_t buflen, bus_dmamap_callback_t *cb, void *cb_arg, int flags){ /* * Assume for now that this will only be used during * initialization and not for per-transaction buffer mapping. */ bus_dma_segment_t stack_sg;#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0) stack_sg.ds_addr = map->bus_addr;#else#define VIRT_TO_BUS(a) (uint32_t)virt_to_bus((void *)(a)) stack_sg.ds_addr = VIRT_TO_BUS(buf);#endif stack_sg.ds_len = dmat->maxsize; cb(cb_arg, &stack_sg, /*nseg*/1, /*error*/0); return (0);}voidahd_dmamap_destroy(struct ahd_softc *ahd, bus_dma_tag_t dmat, bus_dmamap_t map){ /* * The map may is NULL in our < 2.3.X implementation. */ if (map != NULL) free(map, M_DEVBUF);}intahd_dmamap_unload(struct ahd_softc *ahd, bus_dma_tag_t dmat, bus_dmamap_t map){ /* Nothing to do */ return (0);}/********************* Platform Dependent Functions ***************************/intahd_softc_comp(struct ahd_softc *lahd, struct ahd_softc *rahd){ int value; char primary_channel; /* * Under Linux, cards are ordered as follows: * 1) PCI devices with BIOS enabled sorted by bus/slot/func. * 2) All remaining PCI devices sorted by bus/slot/func. */ value = (lahd->flags & AHD_BIOS_ENABLED) - (rahd->flags & AHD_BIOS_ENABLED); if (value != 0) /* Controllers with BIOS enabled have a *higher* priority */ return (-value); /* Still equal. Sort by bus/slot/func. */ if (aic79xx_reverse_scan != 0) value = ahd_get_pci_bus(rahd->dev_softc) - ahd_get_pci_bus(lahd->dev_softc); else value = ahd_get_pci_bus(lahd->dev_softc) - ahd_get_pci_bus(rahd->dev_softc); if (value != 0) return (value); if (aic79xx_reverse_scan != 0) value = ahd_get_pci_slot(rahd->dev_softc) - ahd_get_pci_slot(lahd->dev_softc); else value = ahd_get_pci_slot(lahd->dev_softc) - ahd_get_pci_slot(rahd->dev_softc); if (value != 0) return (value); /* * On multi-function devices, the user can choose * to have function 1 probed before function 0. * Give whichever channel is the primary channel * the lowest priority. */ primary_channel = (lahd->flags & AHD_PRIMARY_CHANNEL) + 'A'; value = 1; if (lahd->channel == primary_channel) value = -1; return (value);}static voidahd_linux_setup_tag_info(char *p, char *end, char *s){ char *base; char *tok; char *tok_end; char *tok_end2; int i; int instance; int targ; int done; char tok_list[] = {'.', ',', '{', '}', '\0'}; if (*p != ':') return; instance = -1; targ = -1; done = FALSE; base = p; /* Forward us just past the ':' */ tok = base + 1; tok_end = strchr(tok, '\0'); if (tok_end < end) *tok_end = ','; while (!done) { switch (*tok) { case '{': if (instance == -1) instance = 0; else if (targ == -1) targ = 0; tok++; break; case '}': if (targ != -1) targ = -1; else if (instance != -1) instance = -1; tok++; break; case ',': case '.': if (instance == -1) done = TRUE; else if (targ >= 0) targ++; else if (instance >= 0) instance++; if ((targ >= AHD_NUM_TARGETS) || (instance >= NUM_ELEMENTS(aic79xx_tag_info))) done = TRUE; tok++; if (!done) { base = tok; } break; case '\0': done = TRUE; break; default: done = TRUE; tok_end = strchr(tok, '\0'); for (i = 0; tok_list[i]; i++) { tok_end2 = strchr(tok, tok_list[i]); if ((tok_end2) && (tok_end2 < tok_end)) { tok_end = tok_end2; done = FALSE; } } if ((instance >= 0) && (targ >= 0) && (instance < NUM_ELEMENTS(aic79xx_tag_info)) && (targ < AHD_NUM_TARGETS)) { aic79xx_tag_info[instance].tag_commands[targ] = simple_strtoul(tok, NULL, 0) & 0xff; } tok = tok_end; break; } } while ((p != base) && (p != NULL)) p = strsep(&s, ",.");}static voidahd_linux_setup_rd_strm_info(char *p, char *end, char *s){ char *base; char *tok; char *tok_end; char *tok_end2; int i; int instance; int done; char tok_list[] = {'.', ',', '{', '}', '\0'}; if (*p != ':') return; instance = -1; done = FALSE; base = p; /* Forward us just past the ':' */ tok = base + 1; tok_end = strchr(tok, '\0'); if (tok_end < end) *tok_end = ','; while (!done) { switch (*tok) { case '{': if (instance == -1) instance = 0; tok++; break; case '}': if (instance != -1) instance = -1; tok++; break; case ',': case '.': if (instance == -1) done = TRUE; else if (instance >= 0) instance++; if (instance >= NUM_ELEMENTS(aic79xx_rd_strm_info)) done = TRUE; tok++; if (!done) { base = tok; } break; case '\0': done = TRUE; break; default: done = TRUE; tok_end = strchr(tok, '\0'); for (i = 0; tok_list[i]; i++) { tok_end2 = strchr(tok, tok_list[i]); if ((tok_end2) && (tok_end2 < tok_end)) { tok_end = tok_end2; done = FALSE; } } if ((instance >= 0) && (instance < NUM_ELEMENTS(aic79xx_rd_strm_info))) { aic79xx_rd_strm_info[instance] = simple_strtoul(tok, NULL, 0) & 0xffff; } tok = tok_end; break; } } while ((p != base) && (p != NULL)) p = strsep(&s, ",.");}static voidahd_linux_setup_dv(char *p, char *end, char *s){ char *base; char *tok; char *tok_end; char *tok_end2; int i; int instance; int done; char tok_list[] = {'.', ',', '{', '}', '\0'}; if (*p != ':') return; instance = -1; done = FALSE; base = p; /* Forward us just past the ':' */ tok = base + 1; tok_end = strchr(tok, '\0'); if (tok_end < end) *tok_end = ','; while (!done) { switch (*tok) { case '{': if (instance == -1) instance = 0; tok++; break; case '}': if (instance != -1) instance = -1; tok++; break; case ',': case '.': if (instance == -1) done = TRUE; else if (instance >= 0) instance++; if (instance >= NUM_ELEMENTS(aic79xx_dv_settings)) done = TRUE; tok++; if (!done) { base = tok; } break; case '\0': done = TRUE; break; default: done = TRUE; tok_end = strchr(tok, '\0'); for (i = 0; tok_list[i]; i++) { tok_end2 = strchr(tok, tok_list[i]); if ((tok_end2) && (tok_end2 < tok_end)) { tok_end = tok_end2; done = FALSE; } } if ((instance >= 0) && (instance < NUM_ELEMENTS(aic79xx_dv_settings))) { aic79xx_dv_settings[instance] = simple_strtol(tok, NULL, 0); } tok = tok_end; break; } } while ((p != base) && (p != NULL)) p = strsep(&s, ",.");}static voidahd_linux_setup_iocell_info(char *p, char *end, char *s, int index){ char *base; char *tok; char *tok_end; char *tok_end2; uint8_t *iocell_info; int i; int instance; int done; char tok_list[] = {'.', ',', '{', '}', '\0'}; if (*p != ':') return; instance = -1; done = FALSE; base = p; /* Forward us just past the ':' */ tok = base + 1; tok_end = strchr(tok, '\0'); if (tok_end < end) *tok_end = ','; while (!done) { switch (*tok) { case '{': if (instance == -1) instance = 0; tok++; break; case '}': if (instance != -1) instance = -1; tok++; break; case ',': case '.': if (instance == -1) done = TRUE; else if (instance >= 0) instance++; if (instance >= NUM_ELEMENTS(aic79xx_iocell_info)) done = TRUE; tok++; if (!done) { base = tok; } break; case '\0': done = TRUE; break; default: done = TRUE; tok_end = strchr(tok, '\0'); for (i = 0; tok_list[i]; i++) { tok_end2 = strchr(tok, tok_list[i]); if ((tok_end2) && (tok_end2 < tok_end)) { tok_end = tok_end2; done = FALSE; } } if ((instance >= 0) && (instance < NUM_ELEMENTS(aic79xx_iocell_info))) { iocell_info = (uint8_t*)&aic79xx_iocell_info[instance]; iocell_info[index] = simple_strtoul(tok, NULL, 0) & 0xffff; } tok = tok_end; break; } } while ((p != base) && (p != NULL)) p = strsep(&s, ",.");}static voidahd_linux_setup_tag_info_global(char *p){ int tags, i, j; tags = simple_strtoul(p + 1, NULL, 0) & 0xff; printf("Setting Global Tags= %d\n", tags); for (i = 0; i < NUM_ELEMENTS(aic79xx_tag_info); i++) { for (j = 0; j < AHD_NUM_TARGETS; j++) { aic79xx_tag_info[i].tag_commands[j] = tags; } }}/* * Handle Linux boot parameters. This routine allows for assigning a value * to a parameter with a ':' between the parameter and the value. * ie. aic79xx=stpwlev:1,extended */static intaic79xx_setup(char *s){ int i, n; char *p; char *end; static struct { const char *name; uint32_t *flag; } options[] = { { "extended", &aic79xx_extended }, { "no_reset", &aic79xx_no_reset }, { "verbose", &aic79xx_verbose }, { "allow_memio", &aic79xx_allow_memio},#ifdef AHD_DEBUG { "debug", &ahd_debug },#endif { "reverse_scan", &aic79xx_reverse_scan }, { "periodic_otag", &aic79xx_periodic_otag }, { "pci_parity", &aic79xx_pci_parity }, { "seltime", &aic79xx_seltime }, { "tag_info", NULL }, { "global_tag_depth", NULL}, { "rd_strm", NULL }, { "dv", NULL }, { "slewrate", NULL }, { "precomp", NULL }, { "amplitude", NULL }, }; end = strchr(s, '\0'); while ((p = strsep(&s, ",.")) != NULL) { if (*p == '\0') continue; for (i = 0; i < NUM_ELEMENTS(options); i++) { n = strlen(options[i].name); if (strncmp(options[i].name, p, n) != 0) continue; if (!strncmp(p, "global_tag_depth", n)) { ahd_linux_setup_tag_info_global(
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -