ppbconf.c (38061) | ppbconf.c (39134) |
---|---|
1/*- 2 * Copyright (c) 1997, 1998 Nicolas Souchu 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 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 1997, 1998 Nicolas Souchu 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 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $Id: ppbconf.c,v 1.4 1997/09/01 00:51:46 bde Exp $ | 26 * $Id: ppbconf.c,v 1.6 1998/08/03 19:14:31 msmith Exp $ |
27 * 28 */ 29#include <sys/param.h> 30#include <sys/systm.h> 31#include <sys/kernel.h> 32#include <sys/malloc.h> 33 34#include <vm/vm.h> --- 54 unchanged lines hidden (view full) --- 89 "hard disk", "PCMCIA", "multimedia device", 90 "floppy disk", "ports", "scanner", 91 "digital camera", "unknown device", NULL }; 92 93/* 94 * search_token() 95 * 96 * Search the first occurence of a token within a string | 27 * 28 */ 29#include <sys/param.h> 30#include <sys/systm.h> 31#include <sys/kernel.h> 32#include <sys/malloc.h> 33 34#include <vm/vm.h> --- 54 unchanged lines hidden (view full) --- 89 "hard disk", "PCMCIA", "multimedia device", 90 "floppy disk", "ports", "scanner", 91 "digital camera", "unknown device", NULL }; 92 93/* 94 * search_token() 95 * 96 * Search the first occurence of a token within a string |
97 * 98 * XXX should use strxxx() calls |
|
97 */ 98static char * 99search_token(char *str, int slen, char *token) 100{ 101 char *p; 102 int tlen, i, j; 103 104#define UNKNOWN_LENGTH -1 --- 45 unchanged lines hidden (view full) --- 150 ppb->ppb_link->adapter_unit); 151 152 if (ppb_request_bus(&pnpdev, PPB_DONTWAIT)) { 153 if (bootverbose) 154 printf("ppb: <PnP> cannot allocate ppbus!\n"); 155 return (-1); 156 } 157 | 99 */ 100static char * 101search_token(char *str, int slen, char *token) 102{ 103 char *p; 104 int tlen, i, j; 105 106#define UNKNOWN_LENGTH -1 --- 45 unchanged lines hidden (view full) --- 152 ppb->ppb_link->adapter_unit); 153 154 if (ppb_request_bus(&pnpdev, PPB_DONTWAIT)) { 155 if (bootverbose) 156 printf("ppb: <PnP> cannot allocate ppbus!\n"); 157 return (-1); 158 } 159 |
158 ppb_wctr(&pnpdev, nINIT | SELECTIN); 159 160 /* select NIBBLE_1284_REQUEST_ID mode */ 161 if ((error = nibble_1284_mode(&pnpdev, NIBBLE_1284_REQUEST_ID))) { | 160 if ((error = ppb_1284_negociate(&pnpdev, NIBBLE_1284_REQUEST_ID))) { |
162 if (bootverbose) | 161 if (bootverbose) |
163 printf("ppb: <PnP> nibble_1284_mode()=%d\n", error); | 162 printf("ppb: <PnP> ppb_1284_negociate()=%d\n", error); 163 |
164 goto end_detect; 165 } | 164 goto end_detect; 165 } |
166 | 166 |
167 len = 0; | 167 len = 0; |
168 for (q = str; !(ppb_rstr(&pnpdev) & ERROR); q++) { | 168 for (q=str; !(ppb_rstr(&pnpdev) & PERROR); q++) { |
169 if ((error = nibble_1284_inbyte(&pnpdev, q))) { | 169 if ((error = nibble_1284_inbyte(&pnpdev, q))) { |
170 if (bootverbose) | 170 if (bootverbose) { 171 *q = '\0'; 172 printf("ppb: <PnP> len=%d, %s\n", len, str); |
171 printf("ppb: <PnP> nibble_1284_inbyte()=%d\n", 172 error); | 173 printf("ppb: <PnP> nibble_1284_inbyte()=%d\n", 174 error); |
175 } |
|
173 goto end_detect; 174 } | 176 goto end_detect; 177 } |
178 |
|
175 if (len++ >= PPB_PnP_STRING_SIZE) { 176 printf("ppb: <PnP> not space left!\n"); 177 goto end_detect; 178 } 179 } 180 *q = '\0'; 181 182 nibble_1284_sync(&pnpdev); --- 49 unchanged lines hidden (view full) --- 232 class_id = i; 233 goto end_detect; 234 } 235 } 236 237 class_id = PPB_PnP_UNKNOWN; 238 239end_detect: | 179 if (len++ >= PPB_PnP_STRING_SIZE) { 180 printf("ppb: <PnP> not space left!\n"); 181 goto end_detect; 182 } 183 } 184 *q = '\0'; 185 186 nibble_1284_sync(&pnpdev); --- 49 unchanged lines hidden (view full) --- 236 class_id = i; 237 goto end_detect; 238 } 239 } 240 241 class_id = PPB_PnP_UNKNOWN; 242 243end_detect: |
244 if ((error = ppb_1284_terminate(&pnpdev, VALID_STATE)) && bootverbose) 245 printf("ppb: ppb_1284_terminate()=%d\n", error); 246 |
|
240 ppb_release_bus(&pnpdev); 241 return (class_id); 242} 243 244/* 245 * ppb_attachdevs() 246 * 247 * Called by ppcattach(), this function probes the ppbus and --- 198 unchanged lines hidden --- | 247 ppb_release_bus(&pnpdev); 248 return (class_id); 249} 250 251/* 252 * ppb_attachdevs() 253 * 254 * Called by ppcattach(), this function probes the ppbus and --- 198 unchanged lines hidden --- |