uart_cpu_ia64.c (120381) | uart_cpu_ia64.c (120452) |
---|---|
1/* 2 * Copyright (c) 2003 Marcel Moolenaar 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 2003 Marcel Moolenaar 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/dev/uart/uart_cpu_ia64.c 120381 2003-09-23 13:03:22Z nyan $"); | 28__FBSDID("$FreeBSD: head/sys/dev/uart/uart_cpu_ia64.c 120452 2003-09-26 05:14:56Z marcel $"); |
29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/bus.h> 33 34#include <machine/bootinfo.h> 35#include <machine/bus.h> 36#include <machine/dig64.h> --- 14 unchanged lines hidden (view full) --- 51 return ((b1->bsh == b2->bsh && b1->bst == b2->bst) ? 1 : 0); 52} 53 54int 55uart_cpu_getdev(int devtype, struct uart_devinfo *di) 56{ 57 struct dig64_hcdp_table *tbl; 58 struct dig64_hcdp_entry *ent; | 29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/bus.h> 33 34#include <machine/bootinfo.h> 35#include <machine/bus.h> 36#include <machine/dig64.h> --- 14 unchanged lines hidden (view full) --- 51 return ((b1->bsh == b2->bsh && b1->bst == b2->bst) ? 1 : 0); 52} 53 54int 55uart_cpu_getdev(int devtype, struct uart_devinfo *di) 56{ 57 struct dig64_hcdp_table *tbl; 58 struct dig64_hcdp_entry *ent; |
59 bus_addr_t addr; |
|
59 unsigned int i, ivar; 60 61 /* 62 * Use the DIG64 HCDP table if present. 63 */ 64 if (bootinfo.bi_hcdp != 0) { 65 tbl = (void*)IA64_PHYS_TO_RR7(bootinfo.bi_hcdp); 66 for (i = 0; i < tbl->entries; i++) { 67 ent = tbl->entry + i; 68 69 if (devtype == UART_DEV_CONSOLE && 70 ent->type != DIG64_HCDP_CONSOLE) 71 continue; 72 73 if (devtype == UART_DEV_DBGPORT && 74 ent->type != DIG64_HCDP_DBGPORT) 75 continue; 76 | 60 unsigned int i, ivar; 61 62 /* 63 * Use the DIG64 HCDP table if present. 64 */ 65 if (bootinfo.bi_hcdp != 0) { 66 tbl = (void*)IA64_PHYS_TO_RR7(bootinfo.bi_hcdp); 67 for (i = 0; i < tbl->entries; i++) { 68 ent = tbl->entry + i; 69 70 if (devtype == UART_DEV_CONSOLE && 71 ent->type != DIG64_HCDP_CONSOLE) 72 continue; 73 74 if (devtype == UART_DEV_DBGPORT && 75 ent->type != DIG64_HCDP_DBGPORT) 76 continue; 77 |
78 addr = ent->address.addr_high; 79 addr = (addr << 32) + ent->address.addr_low; |
|
77 di->ops = uart_ns8250_ops; | 80 di->ops = uart_ns8250_ops; |
78 di->bas.iobase = (ent->address.addr_high << 32) + 79 ent->address.addr_low; 80 di->bas.bst = IA64_BUS_SPACE_IO; | 81 di->bas.chan = 0; |
81 di->bas.bst = (ent->address.addr_space == 0) 82 ? IA64_BUS_SPACE_MEM : IA64_BUS_SPACE_IO; | 82 di->bas.bst = (ent->address.addr_space == 0) 83 ? IA64_BUS_SPACE_MEM : IA64_BUS_SPACE_IO; |
83 if (bus_space_map(di->bas.bst, di->bas.iobase, 8, 0, 84 &di->bas.bsh) != 0) | 84 if (bus_space_map(di->bas.bst, addr, 8, 0, 85 &di->bas.bsh) != 0) |
85 continue; 86 di->bas.regshft = 0; 87 di->bas.rclk = ent->pclock << 4; 88 /* We don't deal with 64-bit baud rates. */ 89 di->baudrate = ent->baud_low; 90 di->databits = ent->databits; 91 di->stopbits = ent->stopbits; 92 di->parity = (ent->parity >= 6) ? UART_PARITY_NONE --- 26 unchanged lines hidden (view full) --- 119 if (resource_int_value("uart", i, "port", &ivar) != 0 || 120 ivar == 0) 121 continue; 122 /* 123 * Got it. Fill in the instance and return it. We only have 124 * ns8250 and successors on i386. 125 */ 126 di->ops = uart_ns8250_ops; | 86 continue; 87 di->bas.regshft = 0; 88 di->bas.rclk = ent->pclock << 4; 89 /* We don't deal with 64-bit baud rates. */ 90 di->baudrate = ent->baud_low; 91 di->databits = ent->databits; 92 di->stopbits = ent->stopbits; 93 di->parity = (ent->parity >= 6) ? UART_PARITY_NONE --- 26 unchanged lines hidden (view full) --- 120 if (resource_int_value("uart", i, "port", &ivar) != 0 || 121 ivar == 0) 122 continue; 123 /* 124 * Got it. Fill in the instance and return it. We only have 125 * ns8250 and successors on i386. 126 */ 127 di->ops = uart_ns8250_ops; |
127 di->bas.iobase = ivar; | 128 di->bas.chan = 0; |
128 di->bas.bst = IA64_BUS_SPACE_IO; 129 if (bus_space_map(di->bas.bst, ivar, 8, 0, &di->bas.bsh) != 0) 130 continue; 131 di->bas.regshft = 0; 132 di->bas.rclk = 0; 133 if (resource_int_value("uart", i, "baud", &ivar) != 0) 134 ivar = 0; 135 di->baudrate = ivar; 136 di->databits = 8; 137 di->stopbits = 1; 138 di->parity = UART_PARITY_NONE; 139 return (0); 140 } 141 142 return (ENXIO); 143} | 129 di->bas.bst = IA64_BUS_SPACE_IO; 130 if (bus_space_map(di->bas.bst, ivar, 8, 0, &di->bas.bsh) != 0) 131 continue; 132 di->bas.regshft = 0; 133 di->bas.rclk = 0; 134 if (resource_int_value("uart", i, "baud", &ivar) != 0) 135 ivar = 0; 136 di->baudrate = ivar; 137 di->databits = 8; 138 di->stopbits = 1; 139 di->parity = UART_PARITY_NONE; 140 return (0); 141 } 142 143 return (ENXIO); 144} |