Changes in uspace/srv/bd/ata_bd/ata_bd.c [e092dc5:228e490] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/bd/ata_bd/ata_bd.c
re092dc5 r228e490 65 65 #include <macros.h> 66 66 67 #include "ata_hw.h"68 67 #include "ata_bd.h" 69 68 … … 71 70 #define NAMESPACE "bd" 72 71 73 /** Number of defined legacy controller base addresses. */74 #define LEGACY_CTLS 475 76 72 /** Physical block size. Should be always 512. */ 77 73 static const size_t block_size = 512; … … 81 77 82 78 /** I/O base address of the command registers. */ 83 static uintptr_t cmd_physical ;79 static uintptr_t cmd_physical = 0x1f0; 84 80 /** I/O base address of the control registers. */ 85 static uintptr_t ctl_physical; 86 87 /** I/O base addresses for legacy (ISA-compatible) controllers. */ 88 static ata_base_t legacy_base[LEGACY_CTLS] = { 89 { 0x1f0, 0x3f0 }, 90 { 0x170, 0x370 }, 91 { 0x1e8, 0x3e8 }, 92 { 0x168, 0x368 } 93 }; 81 static uintptr_t ctl_physical = 0x170; 94 82 95 83 static ata_cmd_t *cmd; … … 99 87 static disk_t disk[MAX_DISKS]; 100 88 101 static void print_syntax(void);102 89 static int ata_bd_init(void); 103 90 static void ata_bd_connection(ipc_callid_t iid, ipc_call_t *icall); … … 123 110 int i, rc; 124 111 int n_disks; 125 unsigned ctl_num;126 char *eptr;127 112 128 113 printf(NAME ": ATA disk driver\n"); 129 114 130 if (argc > 1) { 131 ctl_num = strtoul(argv[1], &eptr, 0); 132 if (*eptr != '\0' || ctl_num == 0 || ctl_num > 4) { 133 printf("Invalid argument.\n"); 134 print_syntax(); 135 return -1; 136 } 137 } else { 138 ctl_num = 1; 139 } 140 141 cmd_physical = legacy_base[ctl_num - 1].cmd; 142 ctl_physical = legacy_base[ctl_num - 1].ctl; 143 144 printf("I/O address %p/%p\n", (void *) cmd_physical, 145 (void *) ctl_physical); 115 printf("I/O address %p/%p\n", (void *) ctl_physical, 116 (void *) cmd_physical); 146 117 147 118 if (ata_bd_init() != EOK) … … 168 139 continue; 169 140 170 snprintf(name, 16, "%s/ ata%udisk%d", NAMESPACE, ctl_num, i);141 snprintf(name, 16, "%s/disk%d", NAMESPACE, i); 171 142 rc = devmap_device_register(name, &disk[i].devmap_handle); 172 143 if (rc != EOK) { … … 189 160 /* Not reached */ 190 161 return 0; 191 }192 193 194 static void print_syntax(void)195 {196 printf("Syntax: " NAME " <controller_number>\n");197 printf("Controller number = 1..4\n");198 162 } 199 163
Note:
See TracChangeset
for help on using the changeset viewer.