dcons_os.c (185107) | dcons_os.c (186876) |
---|---|
1/*- 2 * Copyright (C) 2003,2004 3 * Hidetoshi Shimokawa. 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 --- 17 unchanged lines hidden (view full) --- 26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * | 1/*- 2 * Copyright (C) 2003,2004 3 * Hidetoshi Shimokawa. 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 --- 17 unchanged lines hidden (view full) --- 26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * |
34 * $FreeBSD: head/sys/dev/dcons/dcons_os.c 185107 2008-11-19 21:12:26Z ed $ | 34 * $FreeBSD: head/sys/dev/dcons/dcons_os.c 186876 2009-01-07 21:25:44Z marius $ |
35 */ 36 37#include <sys/param.h> 38#include <sys/kdb.h> 39#include <gdb/gdb.h> 40#include <sys/kernel.h> 41#include <sys/module.h> 42#include <sys/systm.h> --- 288 unchanged lines hidden (view full) --- 331 { 332 /* 333 * DCONS_FORCE_CONSOLE == 0 or kernel module case. 334 * if the module is loaded after boot, 335 * bssbuf could be non-continuous. 336 */ 337 dg.buf = (struct dcons_buf *) contigmalloc(dg.size, 338 M_DEVBUF, 0, 0x10000, 0xffffffff, PAGE_SIZE, 0ul); | 35 */ 36 37#include <sys/param.h> 38#include <sys/kdb.h> 39#include <gdb/gdb.h> 40#include <sys/kernel.h> 41#include <sys/module.h> 42#include <sys/systm.h> --- 288 unchanged lines hidden (view full) --- 331 { 332 /* 333 * DCONS_FORCE_CONSOLE == 0 or kernel module case. 334 * if the module is loaded after boot, 335 * bssbuf could be non-continuous. 336 */ 337 dg.buf = (struct dcons_buf *) contigmalloc(dg.size, 338 M_DEVBUF, 0, 0x10000, 0xffffffff, PAGE_SIZE, 0ul); |
339 if (dg.buf == NULL) 340 return (-1); |
|
339 dcons_init(dg.buf, dg.size, sc); 340 } 341 342ok: 343 dcons_buf = dg.buf; 344 345 drv_init = 1; 346 --- 48 unchanged lines hidden (view full) --- 395static int 396dcons_modevent(module_t mode, int type, void *data) 397{ 398 int err = 0, ret; 399 400 switch (type) { 401 case MOD_LOAD: 402 ret = dcons_drv_init(1); | 341 dcons_init(dg.buf, dg.size, sc); 342 } 343 344ok: 345 dcons_buf = dg.buf; 346 347 drv_init = 1; 348 --- 48 unchanged lines hidden (view full) --- 397static int 398dcons_modevent(module_t mode, int type, void *data) 399{ 400 int err = 0, ret; 401 402 switch (type) { 403 case MOD_LOAD: 404 ret = dcons_drv_init(1); |
403 dcons_attach(); | |
404 if (ret == 0) { | 405 if (ret == 0) { |
406 dcons_attach(); |
|
405 dcons_cnprobe(&dcons_consdev); 406 dcons_cninit(&dcons_consdev); 407 cnadd(&dcons_consdev); 408 } 409 break; 410 case MOD_UNLOAD: 411 printf("dcons: unload\n"); | 407 dcons_cnprobe(&dcons_consdev); 408 dcons_cninit(&dcons_consdev); 409 cnadd(&dcons_consdev); 410 } 411 break; 412 case MOD_UNLOAD: 413 printf("dcons: unload\n"); |
412 callout_stop(&dcons_callout); 413 cnremove(&dcons_consdev); 414 dcons_detach(DCONS_CON); 415 dcons_detach(DCONS_GDB); 416 dg.buf->magic = 0; | 414 if (drv_init == 1) { 415 callout_stop(&dcons_callout); 416 cnremove(&dcons_consdev); 417 dcons_detach(DCONS_CON); 418 dcons_detach(DCONS_GDB); 419 dg.buf->magic = 0; |
417 | 420 |
418 contigfree(dg.buf, DCONS_BUF_SIZE, M_DEVBUF); | 421 contigfree(dg.buf, DCONS_BUF_SIZE, M_DEVBUF); 422 } |
419 420 break; 421 case MOD_SHUTDOWN: 422#if 0 /* Keep connection after halt */ 423 dg.buf->magic = 0; 424#endif 425 break; 426 default: --- 56 unchanged lines hidden --- | 423 424 break; 425 case MOD_SHUTDOWN: 426#if 0 /* Keep connection after halt */ 427 dg.buf->magic = 0; 428#endif 429 break; 430 default: --- 56 unchanged lines hidden --- |