File: usb.c

package info (click to toggle)
mol 0.9.61-6
  • links: PTS
  • area: contrib
  • in suites: woody
  • size: 6,140 kB
  • ctags: 8,491
  • sloc: ansic: 50,560; asm: 2,826; sh: 458; makefile: 373; perl: 165; lex: 135; yacc: 131
file content (64 lines) | stat: -rw-r--r-- 1,302 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/* 
 *   Creation Date: <2000/10/24 00:29:26 samuel>
 *   Time-stamp: <2000/12/29 00:59:06 samuel>
 *   
 *	<usb.c>
 *	
 *	Hack needed by certain NewWorld ROMs
 *   
 *   Copyright (C) 2000 Samuel Rydh (samuel@ibrium.se)
 *   
 *   This program is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU General Public License
 *   as published by the Free Software Foundation
 *   
 */

#include "mol_config.h"
#include "pci.h"
#include "booter.h"
#include "driver_mgr.h"
#include "promif.h"
#include "debugger.h"

#define VENDOR		0x6666
#define DEVICE_ID	0x1234
#define CLASS_CODE	0x0

pci_dev_info_t usb_pci_config = {
	/* vendor, device ID, revision, class */
	VENDOR, DEVICE_ID, 0x00, CLASS_CODE
};

static int usb_init( void );
static void usb_cleanup( void );

driver_interface_t usb_driver = {
	"usb_hack", usb_init, usb_cleanup
};

static int 
usb_init( void )
{
	int bus, devfn;
	mol_device_node_t *dn;

	if( !is_newworld_boot() )
		return 0;

	if( !(dn = prom_find_devices( "usb" )) )
		return 0;
	if( pci_device_loc( dn, &bus, &devfn ) ){
		printm("Could not get devfn of usb device!\n");
		return 0;
	}
	add_pci_device( bus, devfn, &usb_pci_config, NULL );

	// printm("USB hack (%d %d)\n", bus, devfn>>3);
	return 1;
}

static void
usb_cleanup( void )
{
}