File:  [NetBSD Developer Wiki] / wikisrc / users / jakllsch.mdwn
Revision 1.4: download - view: text, annotated - select for diffs
Sat May 1 20:15:13 2010 UTC (11 years, 3 months ago) by wiki
Branches: MAIN
CVS tags: HEAD
web commit by jakllsch: some notes on ddb usage

    1: # Jonathan Kollasch
    2: 
    3: ## [[!template id=man name="ddb" section="4"]] tips
    4: 
    5: ### locating a softc
    6: This locates a device's softc using it's `cfdriver_t` (e.g. `&mainbus_cd`, `&cpu_cd`) and its "device unit" (e.g. the `0` in `mainbus0`).
    7: 
    8:     db{0}> call device_lookup_private(ohci_cd, 0)
    9:     0xffff800045fb2008
   10: 
   11: ### locating structure members
   12: This uses [[!template id=man name="gdb" section="1"]] and a kernel with debugging symbols to find the offset to a element in a structure.
   13: 
   14:     $ gdb netbsd.gdb
   15:     ...
   16:     (gdb) print &((struct ohci_softc *)0)->iot
   17:     $3 = (bus_space_tag_t *) 0x478
   18:     (gdb) print &((struct ohci_softc *)0)->ioh
   19:     $4 = (bus_space_handle_t *) 0x480
   20: 
   21: ### peeking at mapped registers
   22: 
   23:     db{0}> call bus_space_read_4(*(ffff800045fb2008+478), *(ffff800045fb2008+480), 0)
   24:     0x110
   25: 
   26: ## Unfinished Projects
   27: 
   28: ### x86 UEFI kernel loader
   29: Building this for x64 UEFI requires the `ms_abi` function attribute introduced in GCC 4.4 or so.
   30: This project uses Intel UEFI headers and some existing FreeBSD work.
   31: Needs more work and cleanup, also toolchain updates.
   32: Work has been done using the OVMF BIOS images for Qemu.
   33: 
   34: ### bcm47xx for evbmips
   35: Boots multiuser on NFS root, needs more work and cleanup.
   36: This project is on hold until there's a miniature userland that fits in 4-8MiB flash storage devices, on a flash-oriented file system.
   37: [[!template id=man name="bce" section="4"]] and [[!template id=man name="bwi" section="4"]] would need refactoring to be bus-independent.
   38: 
   39: ### Conexant PCI DTV driver
   40: I have some code for 23880-3 and 887 host interfaces.
   41: This type of hardware is hard to find freely available docs for.
   42: Tuner/demod drivers from Linux could be ported, but would still be GPLed.
   43: Probably better to keep these drivers in userland.
   44: 
   45: Should try to coordinate with what FreeBSD is doing: <http://wiki.freebsd.org/HDTV>.
   46: 
   47: ### Memory-mapped PCI config access on x86
   48: Needs cleanup, and maybe some more validation of MCFG tables.
   49: 
   50: ### Toshiba ACPI LCD backlight driver
   51: Loosly based on [[!template id=man name="vald" section="4"]]. Currently attaches to `TOS1900`/`VALZ`, but doesn't interact with this device.
   52: This driver should really attach to `\_SB.PCI0.GFX0.LCD` or
   53: `\_SB.PCI0.PEGP.VGA.LCD`, which are the devices that get notified of
   54: brightness button pushes, and contain the `_BCL`, `_BCM`, and `_BQC`
   55: methods that access the brightness adjustment function.
   56: Such an attachment does not appear to be possible (or at the very least, easy)
   57: at present.
   58: 
   59: ## Possible Projects
   60: ### AMD PowerNow/Cool'n'Quiet states loaded from ACPI tables
   61: 

CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb