Annotation of driverkit/notes/autoconfigInternal, revision 1.1

1.1     ! root        1: Internal autoconfig
        !             2: 
        !             3: * kern_dev_t - a linked list. Starts empty. Add to it on detection
        !             4:   of valid dev_type. Never free. Why should we? Probably don't need
        !             5:   ref_count!
        !             6: 
        !             7: * need configurable table mapping dev_types to classes, with common
        !             8:   probe: function.
        !             9:   
        !            10:   indirectDevices are the classes which need to be probed with the
        !            11:   the id of the device. In internalDevMap, this is a null-terminated
        !            12:   array of strings.
        !            13:        
        !            14:        eg      className = "SCSIController"
        !            15:                indirectDevices = "SCSIDisk", "SCSITape", 
        !            16:                        "SCSIGeneric", NULL.
        !            17:                        
        !            18:   struct internalDevMap {
        !            19:        const char      *className;
        !            20:        const char      *indirectDevices[];
        !            21:        slot_id_t       slot_id;
        !            22:        dev_id_t        dev_id;
        !            23:   }
        !            24:   
        !            25: * Need need a way to probe 'devices' which don't need hardware, like using
        !            26:   a list of internalDevMaps with invalid slot/dev ids.
        !            27:   
        !            28:   struct pseudoDevice {
        !            29:        const char      *className;
        !            30:        const char      *indirectDevices[];
        !            31:   }
        !            32:   
        !            33: /*
        !            34:  * This routine runs as a thread in IOTask so that it can allocate a
        !            35:  * device_master port which can be object_copyin'd during 
        !            36:  * register_device_master. Then, all of the drivers in IOTask can share 
        !            37:  * this port.
        !            38:  */
        !            39: autoconfigInternal() {
        !            40:     init kern_dev_list;
        !            41:     allocate device_master, register via register_device_master();
        !            42:     
        !            43:     /*
        !            44:      * Create a kern_dev_t for each piece of hardware, including native
        !            45:      * devices and NextBus devices.
        !            46:      */
        !            47:     for each native dev_number {
        !            48:        if valid dev_type {
        !            49:            create a kern_dev_t for it {
        !            50:                init dev_number, phys params;
        !            51:                all else = null/empty;
        !            52:            }
        !            53:        }
        !            54:        add to kern_dev_list;
        !            55:     }
        !            56:     
        !            57:     for each NextBus board {
        !            58:         if slot device
        !            59:            create a kern_dev_t for it;
        !            60:        else
        !            61:            for each valid dev_type
        !            62:                create a kern_dev_t for it;
        !            63:     }
        !            64:     
        !            65:     /*
        !            66:      * Start up each device's driver.
        !            67:      */
        !            68:     for each elt in kern_dev_list {
        !            69:        if an internalDevMap exists for this slot/dev {
        !            70:            if [className probe:dev_number deviceMaster:masterPort] {
        !            71:                mark kern_dev inUse;  // should be done by driver via
        !            72:                                      // dev_port_create()
        !            73:                foreach indirectDevice {
        !            74:                    [indirectDevice probe:directDevice];
        !            75:                }
        !            76:            }
        !            77:        }
        !            78:     }
        !            79:     
        !            80:     /*
        !            81:      * Start up pseudoDevices.
        !            82:      */
        !            83:     for each elt in pseudoDevice array {
        !            84:        if [className probe] {
        !            85:            foreach indirectDevice {
        !            86:                [indirectDevice probe:directDevice];
        !            87:            }
        !            88:        }
        !            89:     }
        !            90: }
        !            91: 
        !            92: Questions
        !            93: 
        !            94: * how to pass device_master port to internal drivers? What ports does a 
        !            95:   kernel thread have access to when it starts?
        !            96: 
        !            97: * Are driver threads in the kernel task, or threads in a separate task?
        !            98: 
        !            99: * Do the calls to the dma module have to be in a thread, instead of in
        !           100:   probe: (in kernel's autoconf context)? Does mach_user_internal work for
        !           101:   threads in kernel task? Should IOThreadFork() fork threads off of the
        !           102:   kernel task, or a separate one?
        !           103:   

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.